funhi-chart 1.3.8 → 1.3.9
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.
package/dist/index.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* TradingView Lightweight Charts™ v4.2.3
|
|
5
5
|
* Copyright (c) 2025 TradingView, Inc.
|
|
6
6
|
* Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
*/const u={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},d={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},f={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},m={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},p={baseValue:{type:"price",price:0},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},g={color:"#26a69a",base:0},v={color:"#2196f3"},b={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}};var w,y,S;function C(t,e){const i={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]}[e];t.setLineDash(i)}function M(t,e,i,s){t.beginPath();const n=t.lineWidth%2?.5:0;t.moveTo(i,e+n),t.lineTo(s,e+n),t.stroke()}function x(t,e){if(!t)throw new Error("Assertion failed"+(e?": "+e:""))}function E(t){if(void 0===t)throw new Error("Value is undefined");return t}function _(t){if(null===t)throw new Error("Value is null");return t}function z(t){return _(E(t))}(S=w||(w={}))[S.Simple=0]="Simple",S[S.WithSteps=1]="WithSteps",S[S.Curved=2]="Curved",function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(y||(y={}));const k={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function T(t){return t<0?0:t>255?255:Math.round(t)||0}function R(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const N=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,L=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,O=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,P=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function $(t){(t=t.toLowerCase())in k&&(t=k[t]);{const e=P.exec(t)||O.exec(t);if(e)return[T(parseInt(e[1],10)),T(parseInt(e[2],10)),T(parseInt(e[3],10)),R(e.length<5?1:parseFloat(e[4]))]}{const e=L.exec(t);if(e)return[T(parseInt(e[1],16)),T(parseInt(e[2],16)),T(parseInt(e[3],16)),1]}{const e=N.exec(t);if(e)return[T(17*parseInt(e[1],16)),T(17*parseInt(e[2],16)),T(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function V(t){return.199*t[0]+.687*t[1]+.114*t[2]}function D(t){const e=$(t);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:V(e)>160?"black":"white"}}class B{constructor(){this.h=[]}l(t,e,i){const s={o:t,_:e,u:!0===i};this.h.push(s)}v(t){const e=this.h.findIndex(e=>t===e.o);e>-1&&this.h.splice(e,1)}p(t){this.h=this.h.filter(e=>e._!==t)}m(t,e,i){const s=[...this.h];this.h=this.h.filter(t=>!t.u),s.forEach(s=>s.o(t,e,i))}M(){return this.h.length>0}S(){this.h=[]}}function F(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&Object.prototype.hasOwnProperty.call(i,e)&&!["__proto__","constructor","prototype"].includes(e)&&("object"!=typeof i[e]||void 0===t[e]||Array.isArray(i[e])?t[e]=i[e]:F(t[e],i[e]));return t}function A(t){return"number"==typeof t&&isFinite(t)}function W(t){return"number"==typeof t&&t%1==0}function j(t){return"string"==typeof t}function I(t){return"boolean"==typeof t}function U(t){const e=t;if(!e||"object"!=typeof e)return e;let i,s,n;for(s in i=Array.isArray(e)?[]:{},e)e.hasOwnProperty(s)&&(n=e[s],i[s]=n&&"object"==typeof n?U(n):n);return i}function H(t){return null!==t}function K(t){return null===t?void 0:t}const q="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function X(t,e,i){return void 0===e&&(e=q),`${i=void 0!==i?`${i} `:""}${t}px ${e}`}class G{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=t}W(){const t=this.k,e=this.j(),i=this.H();return t.P===e&&t.D===i||(t.P=e,t.D=i,t.R=X(e,i),t.L=2.5/12*e,t.B=t.L,t.A=e/12*t.T,t.I=e/12*t.T,t.N=0),t.V=this.$(),t.O=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class J{constructor(){this.Y=[]}Z(t){this.Y=t}X(t,e,i){this.Y.forEach(s=>{s.X(t,e,i)})}}class Q{X(t,e,i){t.useBitmapCoordinateSpace(t=>this.K(t,e,i))}}class Y extends Q{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(null===this.G||null===this.G.tt)return;const s=this.G.tt,n=this.G,r=Math.max(1,Math.floor(e))%2/2,o=o=>{t.beginPath();for(let h=s.to-1;h>=s.from;--h){const s=n.it[h],l=Math.round(s.nt*e)+r,a=s.st*i,c=o*i+r;t.moveTo(l,a),t.arc(l,a,c,0,2*Math.PI)}t.fill()};n.et>0&&(t.fillStyle=n.rt,o(n.ht+n.et)),t.fillStyle=n.lt,o(n.ht)}}function Z(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const tt={from:0,to:1};class et{constructor(t,e){this.ut=new J,this.ct=[],this.dt=[],this.ft=!0,this.F=t,this.vt=e,this.ut.Z(this.ct)}bt(t){const e=this.F.wt();e.length!==this.ct.length&&(this.dt=e.map(Z),this.ct=this.dt.map(t=>{const e=new Y;return e.J(t),e}),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const t=2===this.vt.W().mode,e=this.F.wt(),i=this.vt.xt(),s=this.F.St();e.forEach((e,n)=>{var r;const o=this.dt[n],h=e.kt(i);if(t||null===h||!e.yt())return void(o.tt=null);const l=_(e.Ct());o.lt=h.Tt,o.ht=h.ht,o.et=h.Pt,o.it[0]._t=h._t,o.it[0].st=e.Dt().Rt(h._t,l.Vt),o.rt=null!==(r=h.Ot)&&void 0!==r?r:this.F.Bt(o.it[0].st/e.Dt().At()),o.it[0].ot=i,o.it[0].nt=s.It(i),o.tt=tt})}}class it extends Q{constructor(t){super(),this.zt=t}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.zt)return;const n=this.zt.Lt.yt,r=this.zt.Et.yt;if(!n&&!r)return;const o=Math.round(this.zt.nt*i),h=Math.round(this.zt.st*s);t.lineCap="butt",n&&o>=0&&(t.lineWidth=Math.floor(this.zt.Lt.et*i),t.strokeStyle=this.zt.Lt.V,t.fillStyle=this.zt.Lt.V,C(t,this.zt.Lt.Nt),function(t,e,i,s){t.beginPath();const n=t.lineWidth%2?.5:0;t.moveTo(e+n,0),t.lineTo(e+n,s),t.stroke()}(t,o,0,e.height)),r&&h>=0&&(t.lineWidth=Math.floor(this.zt.Et.et*s),t.strokeStyle=this.zt.Et.V,t.fillStyle=this.zt.Et.V,C(t,this.zt.Et.Nt),M(t,h,0,e.width))}}class st{constructor(t){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,V:"",yt:!1},Et:{et:1,Nt:0,V:"",yt:!1},nt:0,st:0},this.Wt=new it(this.Ft),this.jt=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const t=this.jt.yt(),e=_(this.jt.Ht()),i=e.$t().W().crosshair,s=this.Ft;if(2===i.mode)return s.Et.yt=!1,void(s.Lt.yt=!1);s.Et.yt=t&&this.jt.Ut(e),s.Lt.yt=t&&this.jt.qt(),s.Et.et=i.horzLine.width,s.Et.Nt=i.horzLine.style,s.Et.V=i.horzLine.color,s.Lt.et=i.vertLine.width,s.Lt.Nt=i.vertLine.style,s.Lt.V=i.vertLine.color,s.nt=this.jt.Yt(),s.st=this.jt.Zt()}}function nt(t,e,i,s,n,r){t.fillRect(e+r,i,s-2*r,r),t.fillRect(e+r,i+n-r,s-2*r,r),t.fillRect(e,i,r,n),t.fillRect(e+s-r,i,r,n)}function rt(t,e,i,s,n,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(e,i,s,n),t.restore()}function ot(t,e,i,s,n,r){t.beginPath(),t.roundRect?t.roundRect(e,i,s,n,r):(t.lineTo(e+s-r[1],i),0!==r[1]&&t.arcTo(e+s,i,e+s,i+r[1],r[1]),t.lineTo(e+s,i+n-r[2]),0!==r[2]&&t.arcTo(e+s,i+n,e+s-r[2],i+n,r[2]),t.lineTo(e+r[3],i+n),0!==r[3]&&t.arcTo(e,i+n,e,i+n-r[3],r[3]),t.lineTo(e,i+r[0]),0!==r[0]&&t.arcTo(e,i,e+r[0],i,r[0]))}function ht(t,e,i,s,n,r,o=0,h=[0,0,0,0],l=""){if(t.save(),!o||!l||l===r)return ot(t,e,i,s,n,h),t.fillStyle=r,t.fill(),void t.restore();const a=o/2;var c;ot(t,e+a,i+a,s-o,n-o,(c=-a,h.map(t=>0===t?t:t+c))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==l&&(t.lineWidth=o,t.strokeStyle=l,t.closePath(),t.stroke()),t.restore()}function lt(t,e,i,s,n,r,o){t.save(),t.globalCompositeOperation="copy";const h=t.createLinearGradient(0,0,0,n);h.addColorStop(0,r),h.addColorStop(1,o),t.fillStyle=h,t.fillRect(e,i,s,n),t.restore()}class at{constructor(t,e){this.J(t,e)}J(t,e){this.zt=t,this.Xt=e}At(t,e){return this.zt.yt?t.P+t.L+t.B:0}X(t,e,i,s){if(!this.zt.yt||0===this.zt.Kt.length)return;const n=this.zt.V,r=this.Xt.t,o=t.useBitmapCoordinateSpace(t=>{const o=t.context;o.font=e.R;const h=this.Gt(t,e,i,s),l=h.Jt;return h.Qt?ht(o,l.ti,l.ii,l.ni,l.si,r,l.ei,[l.ht,0,0,l.ht],r):ht(o,l.ri,l.ii,l.ni,l.si,r,l.ei,[0,l.ht,l.ht,0],r),this.zt.hi&&(o.fillStyle=n,o.fillRect(l.ri,l.li,l.ai-l.ri,l.oi)),this.zt._i&&(o.fillStyle=e.O,o.fillRect(h.Qt?l.ui-l.ei:0,l.ii,l.ei,l.ci-l.ii)),h});t.useMediaCoordinateSpace(({context:t})=>{const i=o.di;t.font=e.R,t.textAlign=o.Qt?"right":"left",t.textBaseline="middle",t.fillStyle=n,t.fillText(this.zt.Kt,i.fi,(i.ii+i.ci)/2+i.pi)})}Gt(t,e,i,s){var n;const{context:r,bitmapSize:o,mediaSize:h,horizontalPixelRatio:l,verticalPixelRatio:a}=t,c=this.zt.hi||!this.zt.mi?e.T:0,u=this.zt.bi?e.C:0,d=e.L+this.Xt.wi,f=e.B+this.Xt.gi,m=e.A,p=e.I,g=this.zt.Kt,v=e.P,b=i.Mi(r,g),w=Math.ceil(i.xi(r,g)),y=v+d+f,S=e.C+m+p+w+c,C=Math.max(1,Math.floor(a));let M=Math.round(y*a);M%2!=C%2&&(M+=1);const x=u>0?Math.max(1,Math.floor(u*l)):0,E=Math.round(S*l),_=Math.round(c*l),z=null!==(n=this.Xt.Si)&&void 0!==n?n:this.Xt.ki,k=Math.round(z*a)-Math.floor(.5*a),T=Math.floor(k+C/2-M/2),R=T+M,N="right"===s,L=N?h.width-u:u,O=N?o.width-x:x;let P,$,V;return N?(P=O-E,$=O-_,V=L-c-m-u):(P=O+E,$=O+_,V=L+c+m),{Qt:N,Jt:{ii:T,li:k,ci:R,ni:E,si:M,ht:2*l,ei:x,ti:P,ri:O,ai:$,oi:C,ui:o.width},di:{ii:T/a,ci:R/a,fi:V,pi:b}}}}class ct{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Kt:"",yt:!1,hi:!0,mi:!1,Ot:"",V:"#FFF",_i:!1,bi:!1},this.Ti={Kt:"",yt:!1,hi:!1,mi:!0,Ot:"",V:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(t||at)(this.Ci,this.yi),this.Ri=new(t||at)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(t,e=!1){return Math.max(this.Pi.At(t,e),this.Ri.At(t,e))}Vi(){return this.yi.Si||0}Oi(t){this.yi.Si=t}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(t){return this.Di(),this.Ci.hi=this.Ci.hi&&t.W().ticksVisible,this.Ti.hi=this.Ti.hi&&t.W().ticksVisible,this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Pi}Ii(){return this.Di(),this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Ri}Di(){this.ft&&(this.Ci.hi=!0,this.Ti.hi=!1,this.zi(this.Ci,this.Ti,this.yi))}}class ut extends ct{constructor(t,e,i){super(),this.jt=t,this.Li=e,this.Ei=i}zi(t,e,i){if(t.yt=!1,2===this.jt.W().mode)return;const s=this.jt.W().horzLine;if(!s.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||null===n)return;const r=D(s.labelBackgroundColor);i.t=r.t,t.V=r.i;const o=2/12*this.Li.P();i.wi=o,i.gi=o;const h=this.Ei(this.Li);i.ki=h.ki,t.Kt=this.Li.Fi(h._t,n),t.yt=!0}}const dt=/[1-9]/g;class ft{constructor(){this.zt=null}J(t){this.zt=t}X(t,e){if(null===this.zt||!1===this.zt.yt||0===this.zt.Kt.length)return;const i=t.useMediaCoordinateSpace(({context:t})=>(t.font=e.R,Math.round(e.Wi.xi(t,_(this.zt).Kt,dt))));if(i<=0)return;const s=e.ji,n=i+2*s,r=n/2,o=this.zt.Hi;let h=this.zt.ki,l=Math.floor(h-r)+.5;l<0?(h+=Math.abs(0-l),l=Math.floor(h-r)+.5):l+n>o&&(h-=Math.abs(o-(l+n)),l=Math.floor(h-r)+.5);const a=l+n,c=Math.ceil(0+e.C+e.T+e.L+e.P+e.B);t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{const n=_(this.zt);t.fillStyle=n.t;const r=Math.round(l*i),o=Math.round(0*s),h=Math.round(a*i),u=Math.round(c*s),d=Math.round(2*i);if(t.beginPath(),t.moveTo(r,o),t.lineTo(r,u-d),t.arcTo(r,u,r+d,u,d),t.lineTo(h-d,u),t.arcTo(h,u,h,u-d,d),t.lineTo(h,o),t.fill(),n.hi){const r=Math.round(n.ki*i),h=o,l=Math.round((h+e.T)*s);t.fillStyle=n.V;const a=Math.max(1,Math.floor(i)),c=Math.floor(.5*i);t.fillRect(r-c,h,a,l-h)}}),t.useMediaCoordinateSpace(({context:t})=>{const i=_(this.zt),n=0+e.C+e.T+e.L+e.P/2;t.font=e.R,t.textAlign="left",t.textBaseline="middle",t.fillStyle=i.V;const r=e.Wi.Mi(t,"Apr0");t.translate(l+s,n+r),t.fillText(i.Kt,0,0)})}}class mt{constructor(t,e,i){this.ft=!0,this.Wt=new ft,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=t,this.$i=e,this.Ei=i}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const t=this.Ft;if(t.yt=!1,2===this.vt.W().mode)return;const e=this.vt.W().vertLine;if(!e.labelVisible)return;const i=this.$i.St();if(i.Ni())return;t.Hi=i.Hi();const s=this.Ei();if(null===s)return;t.ki=s.ki;const n=i.Ui(this.vt.xt());t.Kt=i.qi(_(n)),t.yt=!0;const r=D(e.labelBackgroundColor);t.t=r.t,t.V=r.i,t.hi=i.W().ticksVisible}}class pt{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(t){this.Zi=t}Dt(){return this.Yi}Gi(t){this.Yi=t}Ji(t){return[]}Qi(){return[]}yt(){return!0}}var gt;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden"}(gt||(gt={}));class vt extends pt{constructor(t,e){super(),this.tn=null,this.nn=NaN,this.sn=0,this.en=!0,this.rn=new Map,this.hn=!1,this.ln=NaN,this.an=NaN,this._n=NaN,this.un=NaN,this.$i=t,this.cn=e,this.dn=new et(t,this),this.fn=((t,e)=>i=>{const s=e(),n=t();if(i===_(this.tn).vn())return{_t:n,ki:s};{const t=_(i.Ct());return{_t:i.pn(s,t),ki:s}}})(()=>this.nn,()=>this.an);const i=((t,e)=>()=>{const i=this.$i.St().mn(t()),s=e();return i&&Number.isFinite(s)?{ot:i,ki:s}:null})(()=>this.sn,()=>this.Yt());this.bn=new mt(this,t,i),this.wn=new st(this)}W(){return this.cn}gn(t,e){this._n=t,this.un=e}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(t,e,i){this.hn||(this.hn=!0),this.en=!0,this.yn(t,e,i)}xt(){return this.sn}Yt(){return this.ln}Zt(){return this.an}yt(){return this.en}Cn(){this.en=!1,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn()}Pn(t){return null!==this.tn?[this.wn,this.dn]:[]}Ut(t){return t===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(t,e){this.en&&this.tn===t||this.rn.clear();const i=[];return this.tn===t&&i.push(this.Dn(this.rn,e,this.fn)),i}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach(t=>t.bt()),this.bn.bt(),this.dn.bt()}On(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,e,i){this.Bn(t,e,i)&&this.Vn()}Bn(t,e,i){const s=this.ln,n=this.an,r=this.nn,o=this.sn,h=this.tn,l=this.On(i);this.sn=t,this.ln=isNaN(t)?NaN:this.$i.St().It(t),this.tn=i;const a=null!==l?l.Ct():null;return null!==l&&null!==a?(this.nn=e,this.an=l.Rt(e,a)):(this.nn=NaN,this.an=NaN),s!==this.ln||n!==this.an||o!==this.sn||r!==this.nn||h!==this.tn}Tn(){const t=this.$i.wt().map(t=>t.In().An()).filter(H),e=0===t.length?null:Math.max(...t);this.sn=null!==e?e:NaN}Dn(t,e,i){let s=t.get(e);return void 0===s&&(s=new ut(this,e,i),t.set(e,s)),s}}function bt(t){return"left"===t||"right"===t}class wt{constructor(t){this.zn=new Map,this.Ln=[],this.En=t}Nn(t,e){const i=function(t,e){return void 0===t?e:{Fn:Math.max(t.Fn,e.Fn),Wn:t.Wn||e.Wn}}(this.zn.get(t),e);this.zn.set(t,i)}jn(){return this.En}Hn(t){const e=this.zn.get(t);return void 0===e?{Fn:this.En}:{Fn:Math.max(this.En,e.Fn),Wn:e.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(t){this.Un(),this.Ln=[{qn:1,Vt:t}]}Zn(t){this.Xn(),this.Ln.push({qn:5,Vt:t})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(t){this.Un(),this.Ln.push({qn:2,Vt:t})}Jn(t){this.Un(),this.Ln.push({qn:3,Vt:t})}Qn(){return this.Ln}ts(t){for(const e of t.Ln)this.ns(e);this.En=Math.max(this.En,t.En),t.zn.forEach((t,e)=>{this.Nn(e,t)})}static ss(){return new wt(2)}static es(){return new wt(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Vt);break;case 2:this.Gn(t.Vt);break;case 3:this.Jn(t.Vt);break;case 4:this.Kn();break;case 5:this.Zn(t.Vt);break;case 6:this.Xn()}}Xn(){const t=this.Ln.findIndex(t=>5===t.qn);-1!==t&&this.Ln.splice(t,1)}}function yt(t,e){if(!A(t))return"n/a";if(!W(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return 0===e?t.toString():("0000000000000000"+t.toString()).slice(-e)}class St{constructor(t,e){if(e||(e=1),A(t)&&W(t)||(t=100),t<0)throw new TypeError("invalid base");this.Li=t,this.rs=e,this.hs()}format(t){const e=t<0?"−":"";return t=Math.abs(t),e+this.ls(t)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this._s++}}ls(t){const e=this.Li/this.rs;let i=Math.floor(t),s="";const n=void 0!==this._s?this._s:NaN;if(e>1){let r=+(Math.round(t*e)-i*e).toFixed(this._s);r>=e&&(r-=e,i+=1),s="."+yt(+r.toFixed(this._s)*this.rs,n)}else i=Math.round(i*e)/e,n>0&&(s="."+yt(0,n));return i.toFixed(0)+s}}class Ct extends St{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class Mt{constructor(t){this.us=t}format(t){let e="";return t<0&&(e="-",t=-t),t<995?e+this.cs(t):t<999995?e+this.cs(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),e+this.cs(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),e+this.cs(t/1e9)+"B")}cs(t){let e;const i=Math.pow(10,this.us);return e=(t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.us).replace(/\.?0+$/,""):String(t),e.replace(/(\.[1-9]*)0+$/,(t,e)=>e)}}function xt(t,e,i,s,n,r,o){if(0===e.length||s.from>=e.length||s.to<=0)return;const{context:h,horizontalPixelRatio:l,verticalPixelRatio:a}=t,c=e[s.from];let u=r(t,c),d=c;if(s.to-s.from<2){const e=n/2;h.beginPath();const i={nt:c.nt-e,st:c.st},s={nt:c.nt+e,st:c.st};h.moveTo(i.nt*l,i.st*a),h.lineTo(s.nt*l,s.st*a),o(t,u,i,s)}else{const n=(e,i)=>{o(t,u,d,i),h.beginPath(),u=e,d=i};let f=d;h.beginPath(),h.moveTo(c.nt*l,c.st*a);for(let o=s.from+1;o<s.to;++o){f=e[o];const s=r(t,f);switch(i){case 0:h.lineTo(f.nt*l,f.st*a);break;case 1:h.lineTo(f.nt*l,e[o-1].st*a),s!==u&&(n(s,f),h.lineTo(f.nt*l,e[o-1].st*a)),h.lineTo(f.nt*l,f.st*a);break;case 2:{const[t,i]=kt(e,o-1,o);h.bezierCurveTo(t.nt*l,t.st*a,i.nt*l,i.st*a,f.nt*l,f.st*a);break}}1!==i&&s!==u&&(n(s,f),h.moveTo(f.nt*l,f.st*a))}(d!==f||d===f&&1===i)&&o(t,u,d,f)}}const Et=6;function _t(t,e){return{nt:t.nt-e.nt,st:t.st-e.st}}function zt(t,e){return{nt:t.nt/e,st:t.st/e}}function kt(t,e,i){const s=Math.max(0,e-1),n=Math.min(t.length-1,i+1);var r,o;return[(r=t[e],o=zt(_t(t[i],t[s]),Et),{nt:r.nt+o.nt,st:r.st+o.st}),_t(t[i],zt(_t(t[n],t[e]),Et))]}function Tt(t,e,i,s,n){const{context:r,horizontalPixelRatio:o,verticalPixelRatio:h}=e;r.lineTo(n.nt*o,t*h),r.lineTo(s.nt*o,t*h),r.closePath(),r.fillStyle=i,r.fill()}class Rt extends Q{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){var e;if(null===this.G)return;const{it:i,tt:s,ds:n,et:r,Nt:o,fs:h}=this.G,l=null!==(e=this.G.vs)&&void 0!==e?e:this.G.ps?0:t.mediaSize.height;if(null===s)return;const a=t.context;a.lineCap="butt",a.lineJoin="round",a.lineWidth=r,C(a,o),a.lineWidth=1,xt(t,i,h,s,n,this.bs.bind(this),Tt.bind(null,l))}}function Nt(t,e,i){return Math.min(Math.max(t,e),i)}function Lt(t,e,i){return e-t<=i}function Ot(t){const e=Math.ceil(t);return e%2==0?e-1:e}class Pt{ws(t,e){const i=this.gs,{Ms:s,xs:n,Ss:r,ks:o,ys:h,vs:l}=e;if(void 0===this.Cs||void 0===i||i.Ms!==s||i.xs!==n||i.Ss!==r||i.ks!==o||i.vs!==l||i.ys!==h){const i=t.context.createLinearGradient(0,0,0,h);if(i.addColorStop(0,s),null!=l){const e=Nt(l*t.verticalPixelRatio/h,0,1);i.addColorStop(e,n),i.addColorStop(e,r)}i.addColorStop(1,o),this.Cs=i,this.gs=e}return this.Cs}}class $t extends Rt{constructor(){super(...arguments),this.Ts=new Pt}bs(t,e){return this.Ts.ws(t,{Ms:e.Ps,xs:"",Ss:"",ks:e.Rs,ys:t.bitmapSize.height})}}function Vt(t,e){const i=t.context;i.strokeStyle=e,i.stroke()}class Dt extends Q{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){if(null===this.G)return;const{it:e,tt:i,ds:s,fs:n,et:r,Nt:o,Ds:h}=this.G;if(null===i)return;const l=t.context;l.lineCap="butt",l.lineWidth=r*t.verticalPixelRatio,C(l,o),l.lineJoin="round";const a=this.Vs.bind(this);void 0!==n&&xt(t,e,n,i,s,a,Vt),h&&function(t,e,i,s,n){const{horizontalPixelRatio:r,verticalPixelRatio:o,context:h}=t;let l=null;const a=Math.max(1,Math.floor(r))%2/2,c=i*o+a;for(let i=s.to-1;i>=s.from;--i){const s=e[i];if(s){const e=n(t,s);e!==l&&(h.beginPath(),null!==l&&h.fill(),h.fillStyle=e,l=e);const i=Math.round(s.nt*r)+a,u=s.st*o;h.moveTo(i,u),h.arc(i,u,c,0,2*Math.PI)}}h.fill()}(t,e,h,i,a)}}class Bt extends Dt{Vs(t,e){return e.lt}}function Ft(t,e,i,s,n=0,r=e.length){let o=r-n;for(;0<o;){const r=o>>1,h=n+r;s(e[h],i)===t?(n=h+1,o-=r+1):o=r}return n}const At=Ft.bind(null,!0),Wt=Ft.bind(null,!1);function jt(t,e){return t.ot<e}function It(t,e){return e<t.ot}function Ut(t,e,i){const s=e.Os(),n=e.ui(),r=At(t,s,jt),o=Wt(t,n,It);if(!i)return{from:r,to:o};let h=r,l=o;return r>0&&r<t.length&&t[r].ot>=s&&(h=r-1),o>0&&o<t.length&&t[o-1].ot<=n&&(l=o+1),{from:h,to:l}}class Ht{constructor(t,e,i){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=t,this.Ns=e,this.Fs=i}bt(t){this.Bs=!0,"data"===t&&(this.As=!0),"options"===t&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),null===this.Ls?null:this.js):null}Hs(){this.zs=this.zs.map(t=>Object.assign(Object.assign({},t),this.Es.Us().$s(t.ot)))}qs(){this.Ls=null}Ws(){this.As&&(this.Ys(),this.As=!1),this.Is&&(this.Hs(),this.Is=!1),this.Bs&&(this.Zs(),this.Bs=!1)}Zs(){const t=this.Es.Dt(),e=this.Ns.St();if(this.qs(),e.Ni()||t.Ni())return;const i=e.Xs();if(null===i)return;if(0===this.Es.In().Ks())return;const s=this.Es.Ct();null!==s&&(this.Ls=Ut(this.zs,i,this.Fs),this.Gs(t,e,s.Vt),this.Js())}}class Kt extends Ht{constructor(t,e){super(t,e,!0)}Gs(t,e,i){e.Qs(this.zs,K(this.Ls)),t.te(this.zs,i,K(this.Ls))}ie(t,e){return{ot:t,_t:e,nt:NaN,st:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map(e=>{const i=e.Vt[3];return this.se(e.ee,i,t)})}}class qt extends Kt{constructor(t,e){super(t,e),this.js=new J,this.re=new $t,this.he=new Bt,this.js.Z([this.re,this.he])}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.W();this.re.J({fs:t.lineType,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,vs:null,ps:t.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:t.lineVisible?t.lineType:void 0,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0})}}class Xt extends Q{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(t){this.zt=t}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;this.ae=this._e(e),this.ae>=2&&Math.max(1,Math.floor(e))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(e)):this.ae;let s=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*e);for(let r=this.zt.tt.from;r<this.zt.tt.to;++r){const o=this.zt.In[r];s!==o.ce&&(t.fillStyle=o.ce,s=o.ce);const h=Math.floor(.5*this.oe),l=Math.round(o.nt*e),a=l-h,c=this.oe,u=a+c-1,d=Math.min(o.de,o.fe),f=Math.max(o.de,o.fe),m=Math.round(d*i)-h,p=Math.round(f*i)+h,g=Math.max(p-m,this.oe);t.fillRect(a,m,c,g);const v=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const e=l-v;let s=Math.max(m,Math.round(o.pe*i)-h),n=s+c-1;n>m+g-1&&(n=m+g-1,s=n-c+1),t.fillRect(e,s,a-e,n-s+1)}const e=l+v;let s=Math.max(m,Math.round(o.me*i)-h),n=s+c-1;n>m+g-1&&(n=m+g-1,s=n-c+1),t.fillRect(u+1,s,e-u,n-s+1)}}}_e(t){const e=Math.floor(t);return Math.max(e,Math.floor(function(t,e){return Math.floor(.3*t*e)}(_(this.zt).le,t)))}}class Gt extends Ht{constructor(t,e){super(t,e,!1)}Gs(t,e,i){e.Qs(this.zs,K(this.Ls)),t.be(this.zs,i,K(this.Ls))}we(t,e,i){return{ot:t,ge:e.Vt[0],Me:e.Vt[1],xe:e.Vt[2],Se:e.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map(e=>this.se(e.ee,e,t))}}class Jt extends Gt{constructor(){super(...arguments),this.js=new Xt}se(t,e,i){return Object.assign(Object.assign({},this.we(t,e,i)),i.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:t.openVisible,ue:t.thinBars,tt:this.Ls})}}class Qt extends Rt{constructor(){super(...arguments),this.Ts=new Pt}bs(t,e){const i=this.G;return this.Ts.ws(t,{Ms:e.ke,xs:e.ye,Ss:e.Ce,ks:e.Te,ys:t.bitmapSize.height,vs:i.vs})}}class Yt extends Dt{constructor(){super(...arguments),this.Pe=new Pt}Vs(t,e){const i=this.G;return this.Pe.ws(t,{Ms:e.Re,xs:e.Re,Ss:e.De,ks:e.De,ys:t.bitmapSize.height,vs:i.vs})}}class Zt extends Kt{constructor(t,e){super(t,e),this.js=new J,this.Ve=new Qt,this.Oe=new Yt,this.js.Z([this.Ve,this.Oe])}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.Ct();if(null===t)return;const e=this.Es.W(),i=this.Es.Dt().Rt(e.baseValue.price,t.Vt),s=this.Ns.St().le();this.Ve.J({it:this.zs,et:e.lineWidth,Nt:e.lineStyle,fs:e.lineType,vs:i,ps:!1,tt:this.Ls,ds:s}),this.Oe.J({it:this.zs,et:e.lineWidth,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,vs:i,tt:this.Ls,ds:s})}}class te extends Q{constructor(){super(...arguments),this.zt=null,this.ae=0}J(t){this.zt=t}K(t){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;const{horizontalPixelRatio:e}=t;this.ae=function(t,e){if(t>=2.5&&t<=4)return Math.floor(3*e);const i=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.floor(t*i*e),n=Math.floor(t*e),r=Math.min(s,n);return Math.max(Math.floor(e),r)}(this.zt.le,e),this.ae>=2&&Math.floor(e)%2!=this.ae%2&&this.ae--;const i=this.zt.In;this.zt.Be&&this.Ae(t,i,this.zt.tt),this.zt._i&&this.Ie(t,i,this.zt.tt);const s=this.ze(e);(!this.zt._i||this.ae>2*s)&&this.Le(t,i,this.zt.tt)}Ae(t,e,i){if(null===this.zt)return;const{context:s,horizontalPixelRatio:n,verticalPixelRatio:r}=t;let o="",h=Math.min(Math.floor(n),Math.floor(this.zt.le*n));h=Math.max(Math.floor(n),Math.min(h,this.ae));const l=Math.floor(.5*h);let a=null;for(let t=i.from;t<i.to;t++){const i=e[t];i.Ee!==o&&(s.fillStyle=i.Ee,o=i.Ee);const c=Math.round(Math.min(i.pe,i.me)*r),u=Math.round(Math.max(i.pe,i.me)*r),d=Math.round(i.de*r),f=Math.round(i.fe*r);let m=Math.round(n*i.nt)-l;const p=m+h-1;null!==a&&(m=Math.max(a+1,m),m=Math.min(m,p));const g=p-m+1;s.fillRect(m,d,g,c-d),s.fillRect(m,u+1,g,f-u),a=p}}ze(t){let e=Math.floor(1*t);this.ae<=2*e&&(e=Math.floor(.5*(this.ae-1)));const i=Math.max(Math.floor(t),e);return this.ae<=2*i?Math.max(Math.floor(t),Math.floor(1*t)):i}Ie(t,e,i){if(null===this.zt)return;const{context:s,horizontalPixelRatio:n,verticalPixelRatio:r}=t;let o="";const h=this.ze(n);let l=null;for(let t=i.from;t<i.to;t++){const i=e[t];i.Ne!==o&&(s.fillStyle=i.Ne,o=i.Ne);let a=Math.round(i.nt*n)-Math.floor(.5*this.ae);const c=a+this.ae-1,u=Math.round(Math.min(i.pe,i.me)*r),d=Math.round(Math.max(i.pe,i.me)*r);if(null!==l&&(a=Math.max(l+1,a),a=Math.min(a,c)),this.zt.le*n>2*h)nt(s,a,u,c-a+1,d-u+1,h);else{const t=c-a+1;s.fillRect(a,u,t,d-u+1)}l=c}}Le(t,e,i){if(null===this.zt)return;const{context:s,horizontalPixelRatio:n,verticalPixelRatio:r}=t;let o="";const h=this.ze(n);for(let t=i.from;t<i.to;t++){const i=e[t];let l=Math.round(Math.min(i.pe,i.me)*r),a=Math.round(Math.max(i.pe,i.me)*r),c=Math.round(i.nt*n)-Math.floor(.5*this.ae),u=c+this.ae-1;if(i.ce!==o){const t=i.ce;s.fillStyle=t,o=t}this.zt._i&&(c+=h,l+=h,u-=h,a-=h),l>a||s.fillRect(c,l,u-c+1,a-l+1)}}}class ee extends Gt{constructor(){super(...arguments),this.js=new te}se(t,e,i){return Object.assign(Object.assign({},this.we(t,e,i)),i.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:t.wickVisible,_i:t.borderVisible,tt:this.Ls})}}class ie{constructor(t,e){this.Fe=t,this.Li=e}X(t,e,i){this.Fe.draw(t,this.Li,e,i)}}class se extends Ht{constructor(t,e,i){super(t,e,!1),this.wn=i,this.js=new ie(this.wn.renderer(),e=>{const i=t.Ct();return null===i?null:t.Dt().Rt(e,i.Vt)})}We(t){return this.wn.priceValueBuilder(t)}je(t){return this.wn.isWhitespace(t)}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map(e=>Object.assign(Object.assign({ot:e.ee,nt:NaN},t.$s(e.ee)),{He:e.$e}))}Gs(t,e){e.Qs(this.zs,K(this.Ls))}Js(){this.wn.update({bars:this.zs.map(ne),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function ne(t){return{x:t.nt,time:t.ot,originalData:t.He,barColor:t.ce}}class re extends Q{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(t){this.zt=t,this.Ue=[]}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.Ue.length||this.qe(e);const s=Math.max(1,Math.floor(i)),n=Math.round(this.zt.Ye*i)-Math.floor(s/2),r=n+s;for(let e=this.zt.tt.from;e<this.zt.tt.to;e++){const o=this.zt.it[e],h=this.Ue[e-this.zt.tt.from],l=Math.round(o.st*i);let a,c;t.fillStyle=o.ce,l<=n?(a=l,c=r):(a=n,c=l-Math.floor(s/2)+s),t.fillRect(h.Os,a,h.ui-h.Os+1,c-a)}}qe(t){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return void(this.Ue=[]);const e=Math.ceil(this.zt.le*t)<=1?0:Math.max(1,Math.floor(t)),i=Math.round(this.zt.le*t)-e;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let e=this.zt.tt.from;e<this.zt.tt.to;e++){const s=this.zt.it[e],n=Math.round(s.nt*t);let r,o;if(i%2){const t=(i-1)/2;r=n-t,o=n+t}else{const t=i/2;r=n-t,o=n+t-1}this.Ue[e-this.zt.tt.from]={Os:r,ui:o,Ze:n,Xe:s.nt*t,ot:s.ot}}for(let t=this.zt.tt.from+1;t<this.zt.tt.to;t++){const i=this.Ue[t-this.zt.tt.from],s=this.Ue[t-this.zt.tt.from-1];i.ot===s.ot+1&&i.Os-s.ui!==e+1&&(s.Ze>s.Xe?s.ui=i.Os-e-1:i.Os=s.ui+e+1)}let s=Math.ceil(this.zt.le*t);for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const e=this.Ue[t-this.zt.tt.from];e.ui<e.Os&&(e.ui=e.Os);const i=e.ui-e.Os+1;s=Math.min(i,s)}if(e>0&&s<4)for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const e=this.Ue[t-this.zt.tt.from];e.ui-e.Os+1>s&&(e.Ze>e.Xe?e.ui-=1:e.Os+=1)}}}class oe extends Kt{constructor(){super(...arguments),this.js=new re}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,_(this.Es.Ct()).Vt)};this.js.J(t)}}class he extends Kt{constructor(){super(...arguments),this.js=new Bt}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.W(),e={it:this.zs,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(e)}}const le=/[2-9]/g;class ae{constructor(t=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=t}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(t,e,i){return this.sr(t,e,i).width}Mi(t,e,i){const s=this.sr(t,e,i);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}sr(t,e,i){const s=i||le,n=String(e).replace(s,"0");if(this.tr.has(n))return E(this.tr.get(n)).er;if(this.Ke===this.ir){const t=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(t),this.Je++,this.Ke--}t.save(),t.textBaseline="middle";const r=t.measureText(n);return t.restore(),0===r.width&&e.length||(this.tr.set(n,{er:r,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),r}}class ce{constructor(t){this.hr=null,this.k=null,this.lr="right",this.ar=t}_r(t,e,i){this.hr=t,this.k=e,this.lr=i}X(t){null!==this.k&&null!==this.hr&&this.hr.X(t,this.k,this.ar,this.lr)}}class ue{constructor(t,e,i){this.ur=t,this.ar=new ae(50),this.cr=e,this.F=i,this.j=-1,this.Wt=new ce(this.ar)}gt(){const t=this.F.dr(this.cr);if(null===t)return null;const e=t.vr(this.cr)?t.pr():this.cr.Dt();if(null===e)return null;const i=t.mr(e);if("overlay"===i)return null;const s=this.F.br();return s.P!==this.j&&(this.j=s.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),s,i),this.Wt}}class de extends Q{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}wr(t,e){var i;if(!(null===(i=this.zt)||void 0===i?void 0:i.yt))return null;const{st:s,et:n,gr:r}=this.zt;return e>=s-n-7&&e<=s+n+7?{Mr:this.zt,gr:r}:null}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.zt)return;if(!1===this.zt.yt)return;const n=Math.round(this.zt.st*s);n<0||n>e.height||(t.lineCap="butt",t.strokeStyle=this.zt.V,t.lineWidth=Math.floor(this.zt.et*i),C(t,this.zt.Nt),M(t,n,0,e.width))}}class fe{constructor(t){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new de,this.ft=!0,this.Es=t,this.Ns=t.$t(),this.kr.J(this.Sr)}bt(){this.ft=!0}gt(){return this.Es.yt()?(this.ft&&(this.yr(),this.ft=!1),this.kr):null}}class me extends fe{constructor(t){super(t)}yr(){this.Sr.yt=!1;const t=this.Es.Dt(),e=t.Cr().Cr;if(2!==e&&3!==e)return;const i=this.Es.W();if(!i.baseLineVisible||!this.Es.yt())return;const s=this.Es.Ct();null!==s&&(this.Sr.yt=!0,this.Sr.st=t.Rt(s.Vt,s.Vt),this.Sr.V=i.baseLineColor,this.Sr.et=i.baseLineWidth,this.Sr.Nt=i.baseLineStyle)}}class pe extends Q{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}$e(){return this.zt}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){const s=this.zt;if(null===s)return;const n=Math.max(1,Math.floor(e)),r=n%2/2,o=Math.round(s.Xe.x*e)+r,h=s.Xe.y*i;t.fillStyle=s.Tr,t.beginPath();const l=Math.max(2,1.5*s.Pr)*e;t.arc(o,h,l,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.Rr,t.beginPath(),t.arc(o,h,s.ht*e,0,2*Math.PI,!1),t.fill(),t.lineWidth=n,t.strokeStyle=s.Dr,t.beginPath(),t.arc(o,h,s.ht*e+n/2,0,2*Math.PI,!1),t.stroke()}}const ge=[{Vr:0,Or:.25,Br:4,Ar:10,Ir:.25,zr:0,Lr:.4,Er:.8},{Vr:.25,Or:.525,Br:10,Ar:14,Ir:0,zr:0,Lr:.8,Er:0},{Vr:.525,Or:1,Br:14,Ar:14,Ir:0,zr:0,Lr:0,Er:0}];function ve(t,e,i,s){return function(t,e){if("transparent"===t)return t;const i=$(t),s=i[3];return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${e*s})`}(t,i+(s-i)*e)}function be(t,e){const i=t%2600/2600;let s;for(const t of ge)if(i>=t.Vr&&i<=t.Or){s=t;break}x(void 0!==s,"Last price animation internal logic error");const n=(i-s.Vr)/(s.Or-s.Vr);return{Rr:ve(e,n,s.Ir,s.zr),Dr:ve(e,n,s.Lr,s.Er),ht:(r=n,o=s.Br,h=s.Ar,o+(h-o)*r)};var r,o,h}class we{constructor(t){this.Wt=new pe,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=t}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),2===this.jr.W().lastPriceAnimation){const t=performance.now(),e=this.Wr-t;if(e>0)return void(e<650&&(this.Wr+=2600));this.Fr=t,this.Wr=t+2600}}bt(){this.ft=!0}Ur(){this.Nr=!0}yt(){return 0!==this.jr.W().lastPriceAnimation}qr(){switch(this.jr.W().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.Wr}}gt(){return this.ft?(this.Mt(),this.ft=!1,this.Nr=!1):this.Nr&&(this.Yr(),this.Nr=!1),this.Wt}Mt(){this.Wt.J(null);const t=this.jr.$t().St(),e=t.Xs(),i=this.jr.Ct();if(null===e||null===i)return;const s=this.jr.Zr(!0);if(s.Xr||!e.Kr(s.ee))return;const n={x:t.It(s.ee),y:this.jr.Dt().Rt(s._t,i.Vt)},r=s.V,o=this.jr.W().lineWidth,h=be(this.Gr(),r);this.Wt.J({Tr:r,Pr:o,Rr:h.Rr,Dr:h.Dr,ht:h.ht,Xe:n})}Yr(){const t=this.Wt.$e();if(null!==t){const e=be(this.Gr(),t.Tr);t.Rr=e.Rr,t.Dr=e.Dr,t.ht=e.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function ye(t,e){return Ot(Math.min(Math.max(t,12),30)*e)}function Se(t,e){switch(t){case"arrowDown":case"arrowUp":return ye(e,1);case"circle":return ye(e,.8);case"square":return ye(e,.7)}}function Ce(t){return function(t){const e=Math.ceil(t);return e%2!=0?e-1:e}(ye(t,1))}function Me(t){return Math.max(ye(t,.1),3)}function xe(t,e,i){return e?t:i?Math.ceil(t/2):0}function Ee(t,e,i,s,n){const r=Se("square",i),o=(r-1)/2,h=t-o,l=e-o;return s>=h&&s<=h+r&&n>=l&&n<=l+r}function _e(t,e,i,s){const n=(Se("arrowUp",s)-1)/2*i.Jr,r=(Ot(s/2)-1)/2*i.Jr;e.beginPath(),t?(e.moveTo(i.nt-n,i.st),e.lineTo(i.nt,i.st-n),e.lineTo(i.nt+n,i.st),e.lineTo(i.nt+r,i.st),e.lineTo(i.nt+r,i.st+n),e.lineTo(i.nt-r,i.st+n),e.lineTo(i.nt-r,i.st)):(e.moveTo(i.nt-n,i.st),e.lineTo(i.nt,i.st+n),e.lineTo(i.nt+n,i.st),e.lineTo(i.nt+r,i.st),e.lineTo(i.nt+r,i.st-n),e.lineTo(i.nt-r,i.st-n),e.lineTo(i.nt-r,i.st)),e.fill()}class ze extends Q{constructor(){super(...arguments),this.zt=null,this.ar=new ae,this.j=-1,this.H="",this.Qr=""}J(t){this.zt=t}_r(t,e){this.j===t&&this.H===e||(this.j=t,this.H=e,this.Qr=X(t,e),this.ar.nr())}wr(t,e){if(null===this.zt||null===this.zt.tt)return null;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const s=this.zt.it[i];if(Te(s,t,e))return{Mr:s.th,gr:s.gr}}return null}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i},s,n){if(null!==this.zt&&null!==this.zt.tt){t.textBaseline="middle",t.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const n=this.zt.it[s];void 0!==n.Kt&&(n.Kt.Hi=this.ar.xi(t,n.Kt.ih),n.Kt.At=this.j,n.Kt.nt=n.nt-n.Kt.Hi/2),ke(n,t,e,i)}}}}function ke(t,e,i,s){e.fillStyle=t.V,void 0!==t.Kt&&function(t,e,i,s,n,r){t.save(),t.scale(n,r),t.fillText(e,i,s),t.restore()}(e,t.Kt.ih,t.Kt.nt,t.Kt.st,i,s),function(t,e,i){if(0!==t.Ks){switch(t.nh){case"arrowDown":return void _e(!1,e,i,t.Ks);case"arrowUp":return void _e(!0,e,i,t.Ks);case"circle":return void function(t,e,i){const s=(Se("circle",i)-1)/2;t.beginPath(),t.arc(e.nt,e.st,s*e.Jr,0,2*Math.PI,!1),t.fill()}(e,i,t.Ks);case"square":return void function(t,e,i){const s=Se("square",i),n=(s-1)*e.Jr/2,r=e.nt-n,o=e.st-n;t.fillRect(r,o,s*e.Jr,s*e.Jr)}(e,i,t.Ks)}t.nh}}(t,e,function(t,e,i){const s=Math.max(1,Math.floor(e))%2/2;return{nt:Math.round(t.nt*e)+s,st:t.st*i,Jr:e}}(t,i,s))}function Te(t,e,i){return!(void 0===t.Kt||!function(t,e,i,s,n,r){const o=s/2;return n>=t&&n<=t+i&&r>=e-o&&r<=e+o}(t.Kt.nt,t.Kt.st,t.Kt.Hi,t.Kt.At,e,i))||function(t,e,i){if(0===t.Ks)return!1;switch(t.nh){case"arrowDown":case"arrowUp":return function(t,e,i,s,n,r){return Ee(e,i,s,n,r)}(0,t.nt,t.st,t.Ks,e,i);case"circle":return function(t,e,i,s,n){const r=2+Se("circle",i)/2,o=t-s,h=e-n;return Math.sqrt(o*o+h*h)<=r}(t.nt,t.st,t.Ks,e,i);case"square":return Ee(t.nt,t.st,t.Ks,e,i)}}(t,e,i)}function Re(t,e,i,s,n,r,o,h,l){const a=A(i)?i:i.Se,c=A(i)?i:i.Me,u=A(i)?i:i.xe,d=A(e.size)?Math.max(e.size,0):1,f=Ce(h.le())*d,m=f/2;switch(t.Ks=f,e.position){case"inBar":return t.st=o.Rt(a,l),void(void 0!==t.Kt&&(t.Kt.st=t.st+m+r+.6*n));case"aboveBar":return t.st=o.Rt(c,l)-m-s.sh,void 0!==t.Kt&&(t.Kt.st=t.st-m-.6*n,s.sh+=1.2*n),void(s.sh+=f+r);case"belowBar":return t.st=o.Rt(u,l)+m+s.eh,void 0!==t.Kt&&(t.Kt.st=t.st+m+r+.6*n,s.eh+=1.2*n),void(s.eh+=f+r)}e.position}class Ne{constructor(t,e){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new ze,this.jr=t,this.$i=e,this.zt={it:[],tt:null}}bt(t){this.ft=!0,this.hh=!0,"data"===t&&(this.rh=!0,this.oh=null)}gt(t){if(!this.jr.yt())return null;this.ft&&this._h();const e=this.$i.W().layout;return this.Wt._r(e.fontSize,e.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const t=this.$i.St().le(),e=Me(t),i=1.5*Ce(t)+2*e,s=this.fh();this.ah={above:xe(i,s.aboveBar,s.inBar),below:xe(i,s.belowBar,s.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return null===this.oh&&(this.oh=this.jr.dh().reduce((t,e)=>(t[e.position]||(t[e.position]=!0),t),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const t=this.jr.Dt(),e=this.$i.St(),i=this.jr.dh();this.rh&&(this.zt.it=i.map(t=>({ot:t.time,nt:0,st:0,Ks:0,nh:t.shape,V:t.color,th:t.th,gr:t.id,Kt:void 0})),this.rh=!1);const s=this.$i.W().layout;this.zt.tt=null;const n=e.Xs();if(null===n)return;const r=this.jr.Ct();if(null===r)return;if(0===this.zt.it.length)return;let o=NaN;const h=Me(e.le()),l={sh:h,eh:h};this.zt.tt=Ut(this.zt.it,n,!0);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const a=i[n];a.time!==o&&(l.sh=h,l.eh=h,o=a.time);const c=this.zt.it[n];c.nt=e.It(a.time),void 0!==a.text&&a.text.length>0&&(c.Kt={ih:a.text,nt:0,st:0,Hi:0,At:0});const u=this.jr.ph(a.time);null!==u&&Re(c,a,u,l,s.fontSize,h,t,e,r.Vt)}this.ft=!1}}class Le extends fe{constructor(t){super(t)}yr(){const t=this.Sr;t.yt=!1;const e=this.Es.W();if(!e.priceLineVisible||!this.Es.yt())return;const i=this.Es.Zr(0===e.priceLineSource);i.Xr||(t.yt=!0,t.st=i.ki,t.V=this.Es.mh(i.V),t.et=e.priceLineWidth,t.Nt=e.priceLineStyle)}}class Oe extends ct{constructor(t){super(),this.jt=t}zi(t,e,i){t.yt=!1,e.yt=!1;const s=this.jt;if(!s.yt())return;const n=s.W(),r=n.lastValueVisible,o=""!==s.bh(),h=0===n.seriesLastValueMode,l=s.Zr(!1);if(l.Xr)return;r&&(t.Kt=this.wh(l,r,h),t.yt=0!==t.Kt.length),(o||h)&&(e.Kt=this.gh(l,r,o,h),e.yt=e.Kt.length>0);const a=s.mh(l.V),c=D(a);i.t=c.t,i.ki=l.ki,e.Ot=s.$t().Bt(l.ki/s.Dt().At()),t.Ot=a,t.V=c.i,e.V=c.i}gh(t,e,i,s){let n="";const r=this.jt.bh();return i&&0!==r.length&&(n+=`${r} `),e&&s&&(n+=this.jt.Dt().Mh()?t.xh:t.Sh),n.trim()}wh(t,e,i){return e?i?this.jt.Dt().Mh()?t.Sh:t.xh:t.Kt:""}}function Pe(t,e,i,s){const n=Number.isFinite(e),r=Number.isFinite(i);return n&&r?t(e,i):n||r?n?e:i:s}class $e{constructor(t,e){this.kh=t,this.yh=e}Ch(t){return null!==t&&this.kh===t.kh&&this.yh===t.yh}Th(){return new $e(this.kh,this.yh)}Ph(){return this.kh}Rh(){return this.yh}Dh(){return this.yh-this.kh}Ni(){return this.yh===this.kh||Number.isNaN(this.yh)||Number.isNaN(this.kh)}ts(t){return null===t?this:new $e(Pe(Math.min,this.Ph(),t.Ph(),-1/0),Pe(Math.max,this.Rh(),t.Rh(),1/0))}Vh(t){if(!A(t))return;if(0===this.yh-this.kh)return;const e=.5*(this.yh+this.kh);let i=this.yh-e,s=this.kh-e;i*=t,s*=t,this.yh=e+i,this.kh=e+s}Oh(t){A(t)&&(this.yh+=t,this.kh+=t)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(t){return null===t?null:new $e(t.minValue,t.maxValue)}}class Ve{constructor(t,e){this.Ih=t,this.zh=e||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return null===this.Ih?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(t){return null===t?null:new Ve($e.Ah(t.priceRange),t.margins)}}class De extends fe{constructor(t,e){super(t),this.Nh=e}yr(){const t=this.Sr;t.yt=!1;const e=this.Nh.W();if(!this.Es.yt()||!e.lineVisible)return;const i=this.Nh.Fh();null!==i&&(t.yt=!0,t.st=i,t.V=e.color,t.et=e.lineWidth,t.Nt=e.lineStyle,t.gr=this.Nh.W().id)}}class Be extends ct{constructor(t,e){super(),this.jr=t,this.Nh=e}zi(t,e,i){t.yt=!1,e.yt=!1;const s=this.Nh.W(),n=s.axisLabelVisible,r=""!==s.title,o=this.jr;if(!n||!o.yt())return;const h=this.Nh.Fh();if(null===h)return;r&&(e.Kt=s.title,e.yt=!0),e.Ot=o.$t().Bt(h/o.Dt().At()),t.Kt=this.Wh(s.price),t.yt=!0;const l=D(s.axisLabelColor||s.color);i.t=l.t;const a=s.axisLabelTextColor||l.i;t.V=a,e.V=a,i.ki=h}Wh(t){const e=this.jr.Ct();return null===e?"":this.jr.Dt().Fi(t,e.Vt)}}class Fe{constructor(t,e){this.jr=t,this.cn=e,this.jh=new De(t,this),this.ur=new Be(t,this),this.Hh=new ue(this.ur,t,t.$t())}$h(t){F(this.cn,t),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const t=this.jr,e=t.Dt();if(t.$t().St().Ni()||e.Ni())return null;const i=t.Ct();return null===i?null:e.Rt(this.cn.price,i.Vt)}}class Ae extends pt{constructor(t){super(),this.$i=t}$t(){return this.$i}}const We={Bar:(t,e,i,s)=>{var n;const r=e.upColor,o=e.downColor,h=_(t(i,s)),l=z(h.Vt[0])<=z(h.Vt[3]);return{ce:null!==(n=h.V)&&void 0!==n?n:l?r:o}},Candlestick:(t,e,i,s)=>{var n,r,o;const h=e.upColor,l=e.downColor,a=e.borderUpColor,c=e.borderDownColor,u=e.wickUpColor,d=e.wickDownColor,f=_(t(i,s)),m=z(f.Vt[0])<=z(f.Vt[3]);return{ce:null!==(n=f.V)&&void 0!==n?n:m?h:l,Ne:null!==(r=f.Ot)&&void 0!==r?r:m?a:c,Ee:null!==(o=f.Xh)&&void 0!==o?o:m?u:d}},Custom:(t,e,i,s)=>{var n;return{ce:null!==(n=_(t(i,s)).V)&&void 0!==n?n:e.color}},Area:(t,e,i,s)=>{var n,r,o,h;const l=_(t(i,s));return{ce:null!==(n=l.lt)&&void 0!==n?n:e.lineColor,lt:null!==(r=l.lt)&&void 0!==r?r:e.lineColor,Ps:null!==(o=l.Ps)&&void 0!==o?o:e.topColor,Rs:null!==(h=l.Rs)&&void 0!==h?h:e.bottomColor}},Baseline:(t,e,i,s)=>{var n,r,o,h,l,a;const c=_(t(i,s));return{ce:c.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:null!==(n=c.Re)&&void 0!==n?n:e.topLineColor,De:null!==(r=c.De)&&void 0!==r?r:e.bottomLineColor,ke:null!==(o=c.ke)&&void 0!==o?o:e.topFillColor1,ye:null!==(h=c.ye)&&void 0!==h?h:e.topFillColor2,Ce:null!==(l=c.Ce)&&void 0!==l?l:e.bottomFillColor1,Te:null!==(a=c.Te)&&void 0!==a?a:e.bottomFillColor2}},Line:(t,e,i,s)=>{var n,r;const o=_(t(i,s));return{ce:null!==(n=o.V)&&void 0!==n?n:e.color,lt:null!==(r=o.V)&&void 0!==r?r:e.color}},Histogram:(t,e,i,s)=>{var n;return{ce:null!==(n=_(t(i,s)).V)&&void 0!==n?n:e.color}}};class je{constructor(t){this.Kh=(t,e)=>void 0!==e?e.Vt:this.jr.In().Gh(t),this.jr=t,this.Jh=We[t.Qh()]}$s(t,e){return this.Jh(this.Kh,this.jr.W(),t,e)}}var Ie;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"}(Ie||(Ie={}));const Ue=30;class He{constructor(){this.tl=[],this.il=new Map,this.nl=new Map}sl(){return this.Ks()>0?this.tl[this.tl.length-1]:null}el(){return this.Ks()>0?this.rl(0):null}An(){return this.Ks()>0?this.rl(this.tl.length-1):null}Ks(){return this.tl.length}Ni(){return 0===this.Ks()}Kr(t){return null!==this.hl(t,0)}Gh(t){return this.ll(t)}ll(t,e=0){const i=this.hl(t,e);return null===i?null:Object.assign(Object.assign({},this.al(i)),{ee:this.rl(i)})}ne(){return this.tl}ol(t,e,i){if(this.Ni())return null;let s=null;for(const n of i)s=Ke(s,this._l(t,e,n));return s}J(t){this.nl.clear(),this.il.clear(),this.tl=t}rl(t){return this.tl[t].ee}al(t){return this.tl[t]}hl(t,e){const i=this.ul(t);if(null===i&&0!==e)switch(e){case-1:return this.cl(t);case 1:return this.dl(t);default:throw new TypeError("Unknown search mode")}return i}cl(t){let e=this.fl(t);return e>0&&(e-=1),e!==this.tl.length&&this.rl(e)<t?e:null}dl(t){const e=this.vl(t);return e!==this.tl.length&&t<this.rl(e)?e:null}ul(t){const e=this.fl(t);return e===this.tl.length||t<this.tl[e].ee?null:e}fl(t){return At(this.tl,t,(t,e)=>t.ee<e)}vl(t){return Wt(this.tl,t,(t,e)=>t.ee>e)}pl(t,e,i){let s=null;for(let n=t;n<e;n++){const t=this.tl[n].Vt[i];Number.isNaN(t)||(null===s?s={ml:t,bl:t}:(t<s.ml&&(s.ml=t),t>s.bl&&(s.bl=t)))}return s}_l(t,e,i){if(this.Ni())return null;let s=null;const n=_(this.el()),r=_(this.An()),o=Math.max(t,n),h=Math.min(e,r),l=Math.ceil(o/Ue)*Ue,a=Math.max(l,Math.floor(h/Ue)*Ue);{const t=this.fl(o),n=this.vl(Math.min(h,l,e));s=Ke(s,this.pl(t,n,i))}let c=this.il.get(i);void 0===c&&(c=new Map,this.il.set(i,c));for(let t=Math.max(l+1,o);t<a;t+=Ue){const e=Math.floor(t/Ue);let n=c.get(e);if(void 0===n){const t=this.fl(e*Ue),s=this.vl((e+1)*Ue-1);n=this.pl(t,s,i),c.set(e,n)}s=Ke(s,n)}{const t=this.fl(a),e=this.vl(h);s=Ke(s,this.pl(t,e,i))}return s}}function Ke(t,e){return null===t?e:null===e?t:{ml:Math.min(t.ml,e.ml),bl:Math.max(t.bl,e.bl)}}class qe{constructor(t){this.wl=t}X(t,e,i){this.wl.draw(t)}gl(t,e,i){var s,n;null===(n=(s=this.wl).drawBackground)||void 0===n||n.call(s,t)}}class Xe{constructor(t){this.tr=null,this.wn=t}gt(){var t;const e=this.wn.renderer();if(null===e)return null;if((null===(t=this.tr)||void 0===t?void 0:t.Ml)===e)return this.tr.xl;const i=new qe(e);return this.tr={Ml:e,xl:i},i}Sl(){var t,e,i;return null!==(i=null===(e=(t=this.wn).zOrder)||void 0===e?void 0:e.call(t))&&void 0!==i?i:"normal"}}function Ge(t){var e,i,s,n,r;return{Kt:t.text(),ki:t.coordinate(),Si:null===(e=t.fixedCoordinate)||void 0===e?void 0:e.call(t),V:t.textColor(),t:t.backColor(),yt:null===(s=null===(i=t.visible)||void 0===i?void 0:i.call(t))||void 0===s||s,hi:null===(r=null===(n=t.tickVisible)||void 0===n?void 0:n.call(t))||void 0===r||r}}class Je{constructor(t,e){this.Wt=new ft,this.kl=t,this.yl=e}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Ge(this.kl))),this.Wt}}class Qe extends ct{constructor(t,e){super(),this.kl=t,this.Li=e}zi(t,e,i){const s=Ge(this.kl);i.t=s.t,t.V=s.V;const n=2/12*this.Li.P();i.wi=n,i.gi=n,i.ki=s.ki,i.Si=s.Si,t.Kt=s.Kt,t.yt=s.yt,t.hi=s.hi}}class Ye{constructor(t,e){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=t,this.jr=e}Ol(){return this.Vl}Vn(){var t,e;null===(e=(t=this.Vl).updateAllViews)||void 0===e||e.call(t)}Pn(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).paneViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Cl)||void 0===s?void 0:s.Ml)===n)return this.Cl.xl;const r=n.map(t=>new Xe(t));return this.Cl={Ml:n,xl:r},r}Qi(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).timeAxisViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Tl)||void 0===s?void 0:s.Ml)===n)return this.Tl.xl;const r=this.jr.$t().St(),o=n.map(t=>new Je(t,r));return this.Tl={Ml:n,xl:o},o}Rn(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).priceAxisViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Pl)||void 0===s?void 0:s.Ml)===n)return this.Pl.xl;const r=this.jr.Dt(),o=n.map(t=>new Qe(t,r));return this.Pl={Ml:n,xl:o},o}Bl(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).priceAxisPaneViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Rl)||void 0===s?void 0:s.Ml)===n)return this.Rl.xl;const r=n.map(t=>new Xe(t));return this.Rl={Ml:n,xl:r},r}Al(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).timeAxisPaneViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Dl)||void 0===s?void 0:s.Ml)===n)return this.Dl.xl;const r=n.map(t=>new Xe(t));return this.Dl={Ml:n,xl:r},r}Il(t,e){var i,s,n;return null!==(n=null===(s=(i=this.Vl).autoscaleInfo)||void 0===s?void 0:s.call(i,t,e))&&void 0!==n?n:null}wr(t,e){var i,s,n;return null!==(n=null===(s=(i=this.Vl).hitTest)||void 0===s?void 0:s.call(i,t,e))&&void 0!==n?n:null}}function Ze(t,e,i,s){t.forEach(t=>{e(t).forEach(t=>{t.Sl()===i&&s.push(t)})})}function ti(t){return t.Pn()}function ei(t){return t.Bl()}function ii(t){return t.Al()}class si extends Ae{constructor(t,e,i,s,n){super(t),this.zt=new He,this.jh=new Le(this),this.zl=[],this.Ll=new me(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=e,this.$l=i;const r=new Oe(this);this.rn=[r],this.Hh=new ue(r,this,t),"Area"!==i&&"Line"!==i&&"Baseline"!==i||(this.El=new we(this)),this.Ul(),this.ql(n)}S(){null!==this.jl&&clearTimeout(this.jl)}mh(t){return this.cn.priceLineColor||t}Zr(t){const e={Xr:!0},i=this.Dt();if(this.$t().St().Ni()||i.Ni()||this.zt.Ni())return e;const s=this.$t().St().Xs(),n=this.Ct();if(null===s||null===n)return e;let r,o;if(t){const t=this.zt.sl();if(null===t)return e;r=t,o=t.ee}else{const t=this.zt.ll(s.ui(),-1);if(null===t)return e;if(r=this.zt.Gh(t.ee),null===r)return e;o=t.ee}const h=r.Vt[3],l=this.Us().$s(o,{Vt:r}),a=i.Rt(h,n.Vt);return{Xr:!1,_t:h,Kt:i.Fi(h,n.Vt),xh:i.Yl(h),Sh:i.Zl(h,n.Vt),V:l.ce,ki:a,ee:o}}Us(){return null!==this.Nl||(this.Nl=new je(this)),this.Nl}W(){return this.cn}$h(t){const e=t.priceScaleId;void 0!==e&&e!==this.cn.priceScaleId&&this.$t().Xl(this,e),F(this.cn,t),void 0!==t.priceFormat&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(t,e){this.zt.J(t),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),null!==this.El&&(e&&e.ta?this.El.$r():0===t.length&&this.El.Hr());const i=this.$t().dr(this);this.$t().ia(i),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(t){this.Fl=t,this.Ql();const e=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(e),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(t){const e=new Fe(this,t);return this.zl.push(e),this.$t().Gl(this),e}ra(t){const e=this.zl.indexOf(t);-1!==e&&this.zl.splice(e,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const t=this.ha();return null===t?null:{Vt:t.Vt[3],la:t.ot}}ha(){const t=this.$t().St().Xs();if(null===t)return null;const e=t.Os();return this.zt.ll(e,1)}In(){return this.zt}ph(t){const e=this.zt.Gh(t);return null===e?null:"Bar"===this.$l||"Candlestick"===this.$l||"Custom"===this.$l?{ge:e.Vt[0],Me:e.Vt[1],xe:e.Vt[2],Se:e.Vt[3]}:e.Vt[3]}aa(t){const e=[];Ze(this.Hl,ti,"top",e);const i=this.El;return null!==i&&i.yt()?(null===this.jl&&i.qr()&&(this.jl=setTimeout(()=>{this.jl=null,this.$t().oa()},0)),i.Ur(),e.unshift(i),e):e}Pn(){const t=[];this._a()||t.push(this.Ll),t.push(this.wn,this.jh,this.dn);const e=this.zl.map(t=>t.qh());return t.push(...e),Ze(this.Hl,ti,"normal",t),t}ua(){return this.ca(ti,"bottom")}da(t){return this.ca(ei,t)}fa(t){return this.ca(ii,t)}va(t,e){return this.Hl.map(i=>i.wr(t,e)).filter(t=>null!==t)}Ji(t){return[this.Hh,...this.zl.map(t=>t.Yh())]}Rn(t,e){if(e!==this.Yi&&!this._a())return[];const i=[...this.rn];for(const t of this.zl)i.push(t.Zh());return this.Hl.forEach(t=>{i.push(...t.Rn())}),i}Qi(){const t=[];return this.Hl.forEach(e=>{t.push(...e.Qi())}),t}Il(t,e){if(void 0!==this.cn.autoscaleInfoProvider){const i=this.cn.autoscaleInfoProvider(()=>{const i=this.pa(t,e);return null===i?null:i.Bh()});return Ve.Ah(i)}return this.pa(t,e)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var t;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),null===(t=this.El)||void 0===t||t.bt(),this.Hl.forEach(t=>t.Vn())}Dt(){return _(super.Dt())}kt(t){if("Line"!==this.$l&&"Area"!==this.$l&&"Baseline"!==this.$l||!this.cn.crosshairMarkerVisible)return null;const e=this.zt.Gh(t);return null===e?null:{_t:e.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(t)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(t){this.Hl.push(new Ye(t,this))}ya(t){this.Hl=this.Hl.filter(e=>e.Ol()!==t)}Ca(){if(this.wn instanceof se!=0)return t=>this.wn.We(t)}Ta(){if(this.wn instanceof se!=0)return t=>this.wn.je(t)}_a(){return!bt(this.Dt().Pa())}pa(t,e){if(!W(t)||!W(e)||this.zt.Ni())return null;const i="Line"===this.$l||"Area"===this.$l||"Baseline"===this.$l||"Histogram"===this.$l?[3]:[2,1],s=this.zt.ol(t,e,i);let n=null!==s?new $e(s.ml,s.bl):null;if("Histogram"===this.Qh()){const t=this.cn.base,e=new $e(t,t);n=null!==n?n.ts(e):e}let r=this.dn.uh();return this.Hl.forEach(i=>{const s=i.Il(t,e);if(null==s?void 0:s.priceRange){const t=new $e(s.priceRange.minValue,s.priceRange.maxValue);n=null!==n?n.ts(t):t}var o,h,l,a;(null==s?void 0:s.margins)&&(o=r,h=s.margins,r={above:Math.max(null!==(l=null==o?void 0:o.above)&&void 0!==l?l:0,h.above),below:Math.max(null!==(a=null==o?void 0:o.below)&&void 0!==a?a:0,h.below)})}),new Ve(n,r)}ga(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}Ma(){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(t){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.Us().$s(t).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new Mt(this.cn.priceFormat.precision);break;case"percent":this.wa=new Ct(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.wa=new St(t,this.cn.priceFormat.minMove*t)}}null!==this.Yi&&this.Yi.Ra()}Ql(){const t=this.$t().St();if(!t.Da()||this.zt.Ni())return void(this.Wl=[]);const e=_(this.zt.el());this.Wl=this.Fl.map((i,s)=>{const n=_(t.Va(i.time,!0)),r=n<e?1:-1;return{time:_(this.zt.ll(n,r)).ee,position:i.position,shape:i.shape,color:i.color,id:i.id,th:s,text:i.text,size:i.size,originalTime:i.originalTime}})}ql(t){switch(this.dn=new Ne(this,this.$t()),this.$l){case"Bar":this.wn=new Jt(this,this.$t());break;case"Candlestick":this.wn=new ee(this,this.$t());break;case"Line":this.wn=new he(this,this.$t());break;case"Custom":this.wn=new se(this,this.$t(),E(t));break;case"Area":this.wn=new qt(this,this.$t());break;case"Baseline":this.wn=new Zt(this,this.$t());break;case"Histogram":this.wn=new oe(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(t,e){const i=[];return Ze(this.Hl,t,e,i),i}}class ni{constructor(t){this.cn=t}Oa(t,e,i){let s=t;if(0===this.cn.mode)return s;const n=i.vn(),r=n.Ct();if(null===r)return s;const o=n.Rt(t,r),h=i.Ba().filter(t=>t instanceof si).reduce((t,s)=>{if(i.vr(s)||!s.yt())return t;const n=s.Dt(),r=s.In();if(n.Ni()||!r.Kr(e))return t;const o=r.Gh(e);if(null===o)return t;const h=z(s.Ct());return t.concat([n.Rt(o.Vt[3],h.Vt)])},[]);if(0===h.length)return s;h.sort((t,e)=>Math.abs(t-o)-Math.abs(e-o));const l=h[0];return s=n.pn(l,r),s}}class ri extends Q{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.zt)return;const n=Math.max(1,Math.floor(i));t.lineWidth=n,function(t,e){t.save(),t.lineWidth%2&&t.translate(.5,.5),e(),t.restore()}(t,()=>{const r=_(this.zt);if(r.Aa){t.strokeStyle=r.Ia,C(t,r.za),t.beginPath();for(const s of r.La){const r=Math.round(s.Ea*i);t.moveTo(r,-n),t.lineTo(r,e.height+n)}t.stroke()}if(r.Na){t.strokeStyle=r.Fa,C(t,r.Wa),t.beginPath();for(const i of r.ja){const r=Math.round(i.Ea*s);t.moveTo(-n,r),t.lineTo(e.width+n,r)}t.stroke()}})}}class oi{constructor(t){this.Wt=new ri,this.ft=!0,this.tn=t}bt(){this.ft=!0}gt(){if(this.ft){const t=this.tn.$t().W().grid,e={Na:t.horzLines.visible,Aa:t.vertLines.visible,Fa:t.horzLines.color,Ia:t.vertLines.color,Wa:t.horzLines.style,za:t.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map(t=>({Ea:t.coord}))};this.Wt.J(e),this.ft=!1}return this.Wt}}class hi{constructor(t){this.wn=new oi(t)}qh(){return this.wn}}const li={$a:4,Ua:1e-4};function ai(t,e){const i=100*(t-e)/e;return e<0?-i:i}function ci(t,e){const i=ai(t.Ph(),e),s=ai(t.Rh(),e);return new $e(i,s)}function ui(t,e){const i=100*(t-e)/e+100;return e<0?-i:i}function di(t,e){const i=ui(t.Ph(),e),s=ui(t.Rh(),e);return new $e(i,s)}function fi(t,e){const i=Math.abs(t);if(i<1e-15)return 0;const s=Math.log10(i+e.Ua)+e.$a;return t<0?-s:s}function mi(t,e){const i=Math.abs(t);if(i<1e-15)return 0;const s=Math.pow(10,i-e.$a)-e.Ua;return t<0?-s:s}function pi(t,e){if(null===t)return null;const i=fi(t.Ph(),e),s=fi(t.Rh(),e);return new $e(i,s)}function gi(t,e){if(null===t)return null;const i=mi(t.Ph(),e),s=mi(t.Rh(),e);return new $e(i,s)}function vi(t){if(null===t)return li;const e=Math.abs(t.Rh()-t.Ph());if(e>=1||e<1e-15)return li;const i=Math.ceil(Math.abs(Math.log10(e))),s=li.$a+i;return{$a:s,Ua:1/Math.pow(10,s)}}class bi{constructor(t,e){if(this.qa=t,this.Ya=e,function(t){if(t<0)return!1;for(let e=t;e>1;e/=10)if(e%10!=0)return!1;return!0}(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let t=this.qa;1!==t;){if(t%2==0)this.Za.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),t/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(t,e,i){const s=0===this.qa?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-e)))),r=0,o=this.Ya[0];for(;;){const t=Lt(n,s,1e-14)&&n>s+1e-14,e=Lt(n,i*o,1e-14),h=Lt(n,1,1e-14);if(!(t&&e&&h))break;n/=o,o=this.Ya[++r%this.Ya.length]}if(n<=s+1e-14&&(n=s),n=Math.max(1,n),this.Za.length>0&&(h=n,Math.abs(h-1)<1e-14))for(r=0,o=this.Za[0];Lt(n,i*o,1e-14)&&n>s+1e-14;)n/=o,o=this.Za[++r%this.Za.length];var h;return n}}class wi{constructor(t,e,i,s){this.Ka=[],this.Li=t,this.qa=e,this.Ga=i,this.Ja=s}Xa(t,e){if(t<e)throw new Error("high < low");const i=this.Li.At(),s=(t-e)*this.Qa()/i,n=new bi(this.qa,[2,2.5,2]),r=new bi(this.qa,[2,2,2.5]),o=new bi(this.qa,[2.5,2,2]),h=[];return h.push(n.Xa(t,e,s),r.Xa(t,e,s),o.Xa(t,e,s)),function(t){if(t.length<1)throw Error("array is empty");let e=t[0];for(let i=1;i<t.length;++i)t[i]<e&&(e=t[i]);return e}(h)}io(){const t=this.Li,e=t.Ct();if(null===e)return void(this.Ka=[]);const i=t.At(),s=this.Ga(i-1,e),n=this.Ga(0,e),r=this.Li.W().entireTextOnly?this.no()/2:0,o=r,h=i-1-r,l=Math.max(s,n),a=Math.min(s,n);if(l===a)return void(this.Ka=[]);let c=this.Xa(l,a),u=l%c;u+=u<0?c:0;const d=l>=a?1:-1;let f=null,m=0;for(let i=l-u;i>a;i-=c){const s=this.Ja(i,e,!0);null!==f&&Math.abs(s-f)<this.Qa()||s<o||s>h||(m<this.Ka.length?(this.Ka[m].Ea=s,this.Ka[m].so=t.eo(i)):this.Ka.push({Ea:s,so:t.eo(i)}),m++,f=s,t.ro()&&(c=this.Xa(i*d,a)))}this.Ka.length=m}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function yi(t){return t.slice().sort((t,e)=>_(t.Xi())-_(e.Xi()))}var Si;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(Si||(Si={}));const Ci=new Ct,Mi=new St(100,1);class xi{constructor(t,e,i,s){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new B,this.vo=new B,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=Mi,this.xo=vi(null),this.So=t,this.cn=e,this.ko=i,this.yo=s,this.Co=new wi(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(t){if(F(this.cn,t),this.Ra(),void 0!==t.mode&&this.Ro({Cr:t.mode}),void 0!==t.scaleMargins){const e=E(t.scaleMargins.top),i=E(t.scaleMargins.bottom);if(e<0||e>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${e}`);if(i<0||i>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${i}`);if(e+i>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${e+i}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return 1===this.cn.mode}Mh(){return 2===this.cn.mode}Oo(){return 3===this.cn.mode}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(t){const e=this.Cr();let i=null;void 0!==t.Wn&&(this.cn.autoScale=t.Wn),void 0!==t.Cr&&(this.cn.mode=t.Cr,2!==t.Cr&&3!==t.Cr||(this.cn.autoScale=!0),this.oo._o=!1),1===e.Cr&&t.Cr!==e.Cr&&(function(t,e){if(null===t)return!1;const i=mi(t.Ph(),e),s=mi(t.Rh(),e);return isFinite(i)&&isFinite(s)}(this.Ih,this.xo)?(i=gi(this.Ih,this.xo),null!==i&&this.Ao(i)):this.cn.autoScale=!0),1===t.Cr&&t.Cr!==e.Cr&&(i=pi(this.Ih,this.xo),null!==i&&this.Ao(i));const s=e.Cr!==this.cn.mode;s&&(2===e.Cr||this.Mh())&&this.Ra(),s&&(3===e.Cr||this.Oo())&&this.Ra(),void 0!==t.Bo&&e.Bo!==t.Bo&&(this.cn.invertScale=t.Bo,this.Io()),this.vo.m(e,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(t){this.ho!==t&&(this.ho=t,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const t=this.At()-this.No()-this.Fo();return this.lo=t,t}Lh(){return this.Wo(),this.Ih}Ao(t,e){const i=this.Ih;(e||null===i&&null!==t||null!==i&&!i.Ch(t))&&(this.bo=null,this.Ih=t)}Ni(){return this.Wo(),0===this.ho||!this.Ih||this.Ih.Ni()}jo(t){return this.Bo()?t:this.At()-1-t}Rt(t,e){return this.Mh()?t=ai(t,e):this.Oo()&&(t=ui(t,e)),this.Po(t,e)}te(t,e,i){this.Wo();const s=this.Fo(),n=_(this.Lh()),r=n.Ph(),o=n.Rh(),h=this.Eo()-1,l=this.Bo(),a=h/(o-r),c=void 0===i?0:i.from,u=void 0===i?t.length:i.to,d=this.Ho();for(let i=c;i<u;i++){const n=t[i],o=n._t;if(isNaN(o))continue;let h=o;null!==d&&(h=d(n._t,e));const c=s+a*(h-r),u=l?c:this.ho-1-c;n.st=u}}be(t,e,i){this.Wo();const s=this.Fo(),n=_(this.Lh()),r=n.Ph(),o=n.Rh(),h=this.Eo()-1,l=this.Bo(),a=h/(o-r),c=void 0===i?0:i.from,u=void 0===i?t.length:i.to,d=this.Ho();for(let i=c;i<u;i++){const n=t[i];let o=n.ge,h=n.Me,c=n.xe,u=n.Se;null!==d&&(o=d(n.ge,e),h=d(n.Me,e),c=d(n.xe,e),u=d(n.Se,e));let f=s+a*(o-r),m=l?f:this.ho-1-f;n.pe=m,f=s+a*(h-r),m=l?f:this.ho-1-f,n.de=m,f=s+a*(c-r),m=l?f:this.ho-1-f,n.fe=m,f=s+a*(u-r),m=l?f:this.ho-1-f,n.me=m}}pn(t,e){const i=this.To(t,e);return this.$o(i,e)}$o(t,e){let i=t;return this.Mh()?i=function(t,e){return e<0&&(t=-t),t/100*e+e}(i,e):this.Oo()&&(i=function(t,e){return t-=100,e<0&&(t=-t),t/100*e+e}(i,e)),i}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let t=[];for(let e=0;e<this.po.length;e++){const i=this.po[e];null===i.Xi()&&i.Ki(e+1),t.push(i)}return t=yi(t),this.mo=t,this.mo}qo(t){-1===this.po.indexOf(t)&&(this.po.push(t),this.Ra(),this.Yo())}Zo(t){const e=this.po.indexOf(t);if(-1===e)throw new Error("source is not attached to scale");this.po.splice(e,1),0===this.po.length&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let t=null;for(const e of this.po){const i=e.Ct();null!==i&&(null===t||i.la<t.la)&&(t=i)}return null===t?null:t.Vt}Bo(){return this.cn.invertScale}Ha(){const t=null===this.Ct();if(null!==this.bo&&(t||this.bo.Xo===t))return this.bo.Ha;this.Co.io();const e=this.Co.Ha();return this.bo={Ha:e,Xo:t},this.fo.m(),e}Ko(){return this.fo}Go(t){this.Mh()||this.Oo()||null===this.wo&&null===this.ao&&(this.Ni()||(this.wo=this.ho-t,this.ao=_(this.Lh()).Th()))}Jo(t){if(this.Mh()||this.Oo())return;if(null===this.wo)return;this.Ro({Wn:!1}),(t=this.ho-t)<0&&(t=0);let e=(this.wo+.2*(this.ho-1))/(t+.2*(this.ho-1));const i=_(this.ao).Th();e=Math.max(e,.1),i.Vh(e),this.Ao(i)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(t){this.Vo()||null===this.Mo&&null===this.ao&&(this.Ni()||(this.Mo=t,this.ao=_(this.Lh()).Th()))}i_(t){if(this.Vo())return;if(null===this.Mo)return;const e=_(this.Lh()).Dh()/(this.Eo()-1);let i=t-this.Mo;this.Bo()&&(i*=-1);const s=i*e,n=_(this.ao).Th();n.Oh(s),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||null!==this.Mo&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(t,e){switch(this.cn.mode){case 2:return this.s_(ai(t,e));case 3:return this.ba().format(ui(t,e));default:return this.Wh(t)}}eo(t){switch(this.cn.mode){case 2:return this.s_(t);case 3:return this.ba().format(t);default:return this.Wh(t)}}Yl(t){return this.Wh(t,_(this.e_()).ba())}Zl(t,e){return t=ai(t,e),this.s_(t,Ci)}r_(){return this.po}h_(t){this.oo={uo:t,_o:!1}}Vn(){this.po.forEach(t=>t.Vn())}Ra(){this.bo=null;const t=this.e_();let e=100;null!==t&&(e=Math.round(1/t.ma())),this.wa=Mi,this.Mh()?(this.wa=Ci,e=100):this.Oo()?(this.wa=new St(100,1),e=100):null!==t&&(this.wa=t.ba()),this.Co=new wi(this,e,this.To.bind(this),this.Po.bind(this)),this.Co.io()}Yo(){this.mo=null}e_(){return this.po[0]||null}No(){return this.Bo()?this.cn.scaleMargins.bottom*this.At()+this.do:this.cn.scaleMargins.top*this.At()+this.co}Fo(){return this.Bo()?this.cn.scaleMargins.top*this.At()+this.co:this.cn.scaleMargins.bottom*this.At()+this.do}Wo(){this.oo._o||(this.oo._o=!0,this.l_())}Do(){this.lo=null}Po(t,e){if(this.Wo(),this.Ni())return 0;t=this.ro()&&t?fi(t,this.xo):t;const i=_(this.Lh()),s=this.Fo()+(this.Eo()-1)*(t-i.Ph())/i.Dh();return this.jo(s)}To(t,e){if(this.Wo(),this.Ni())return 0;const i=this.jo(t),s=_(this.Lh()),n=s.Ph()+s.Dh()*((i-this.Fo())/(this.Eo()-1));return this.ro()?mi(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const t=this.oo.uo;if(null===t)return;let e=null;const i=this.r_();let s=0,n=0;for(const r of i){if(!r.yt())continue;const i=r.Ct();if(null===i)continue;const o=r.Il(t.Os(),t.ui());let h=o&&o.Lh();if(null!==h){switch(this.cn.mode){case 1:h=pi(h,this.xo);break;case 2:h=ci(h,i.Vt);break;case 3:h=di(h,i.Vt)}if(e=null===e?h:e.ts(_(h)),null!==o){const t=o.Eh();null!==t&&(s=Math.max(s,t.above),n=Math.max(n,t.below))}}}if(s===this.co&&n===this.do||(this.co=s,this.do=n,this.bo=null,this.Do()),null!==e){if(e.Ph()===e.Rh()){const t=this.e_(),i=5*(null===t||this.Mh()||this.Oo()?1:t.ma());this.ro()&&(e=gi(e,this.xo)),e=new $e(e.Ph()-i,e.Rh()+i),this.ro()&&(e=pi(e,this.xo))}if(this.ro()){const t=gi(e,this.xo),i=vi(t);if(r=i,o=this.xo,r.$a!==o.$a||r.Ua!==o.Ua){const s=null!==this.ao?gi(this.ao,this.xo):null;this.xo=i,e=pi(t,i),null!==s&&(this.ao=pi(s,i))}}this.Ao(e)}else null===this.Ih&&(this.Ao(new $e(-.5,.5)),this.xo=vi(null));var r,o;this.oo._o=!0}Ho(){return this.Mh()?ai:this.Oo()?ui:this.ro()?t=>fi(t,this.xo):null}a_(t,e,i){return void 0===e?(void 0===i&&(i=this.ba()),i.format(t)):e(t)}Wh(t,e){return this.a_(t,this.yo.priceFormatter,e)}s_(t,e){return this.a_(t,this.yo.percentageFormatter,e)}}class Ei{constructor(t,e){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new B,this.yl=t,this.$i=e,this.d_=new hi(this);const i=e.W();this.f_=this.v_("left",i.leftPriceScale),this.p_=this.v_("right",i.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(i)}b_(t){if(t.leftPriceScale&&this.f_.$h(t.leftPriceScale),t.rightPriceScale&&this.p_.$h(t.rightPriceScale),t.localization&&(this.f_.Ra(),this.p_.Ra()),t.overlayPriceScales){const e=Array.from(this.o_.values());for(const i of e){const e=_(i[0].Dt());e.$h(t.overlayPriceScales),t.localization&&e.Ra()}}}w_(t){switch(t){case"left":return this.f_;case"right":return this.p_}return this.o_.has(t)?E(this.o_.get(t))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach(t=>{t.S&&t.S()}),this.c_.m()}M_(){return this.u_}x_(t){this.u_=t}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(t){this.__=t,this.k_()}Lo(t){this.ho=t,this.f_.Lo(t),this.p_.Lo(t),this.po.forEach(e=>{if(this.vr(e)){const i=e.Dt();null!==i&&i.Lo(t)}}),this.k_()}Ba(){return this.po}vr(t){const e=t.Dt();return null===e||this.f_!==e&&this.p_!==e}qo(t,e,i){const s=void 0!==i?i:this.C_().y_+1;this.T_(t,e,s)}Zo(t){const e=this.po.indexOf(t);x(-1!==e,"removeDataSource: invalid data source"),this.po.splice(e,1);const i=_(t.Dt()).Pa();if(this.o_.has(i)){const e=E(this.o_.get(i)),s=e.indexOf(t);-1!==s&&(e.splice(s,1),0===e.length&&this.o_.delete(i))}const s=t.Dt();s&&s.Ba().indexOf(t)>=0&&s.Zo(t),null!==s&&(s.Yo(),this.P_(s)),this.mo=null}mr(t){return t===this.f_?"left":t===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(t,e){t.Go(e)}O_(t,e){t.Jo(e),this.k_()}B_(t){t.Qo()}A_(t,e){t.t_(e)}I_(t,e){t.i_(e),this.k_()}z_(t){t.n_()}k_(){this.po.forEach(t=>{t.Vn()})}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&0!==this.p_.Ba().length?t=this.p_:this.$i.W().leftPriceScale.visible&&0!==this.f_.Ba().length?t=this.f_:0!==this.po.length&&(t=this.po[0].Dt()),null===t&&(t=this.p_),t}pr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.p_:this.$i.W().leftPriceScale.visible&&(t=this.f_),t}P_(t){null!==t&&t.Vo()&&this.L_(t)}E_(t){const e=this.yl.Xs();t.Ro({Wn:!0}),null!==e&&t.h_(e),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach(t=>{this.vr(t)&&this.P_(t.Dt())}),this.k_(),this.$i.Uh()}Uo(){return null===this.mo&&(this.mo=yi(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(t){const e=t.r_();if(e&&e.length>0&&!this.yl.Ni()){const e=this.yl.Xs();null!==e&&t.h_(e)}t.Vn()}C_(){const t=this.Uo();if(0===t.length)return{H_:0,y_:0};let e=0,i=0;for(let s=0;s<t.length;s++){const n=t[s].Xi();null!==n&&(n<e&&(e=n),n>i&&(i=n))}return{H_:e,y_:i}}T_(t,e,i){let s=this.w_(e);if(null===s&&(s=this.v_(e,this.$i.W().overlayPriceScales)),this.po.push(t),!bt(e)){const i=this.o_.get(e)||[];i.push(t),this.o_.set(e,i)}s.qo(t),t.Gi(s),t.Ki(i),this.P_(s),this.mo=null}m_(t,e,i){e.Cr!==i.Cr&&this.L_(t)}v_(t,e){const i=Object.assign({visible:!0,autoScale:!0},U(e)),s=new xi(t,i,this.$i.W().layout,this.$i.W().localization);return s.Lo(this.At()),s}}class _i{constructor(t,e,i=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=t,this.q_=e,this.ir=i}Y_(t){const e=t.time,i=this.q_.cacheKey(e),s=this.tr.get(i);if(void 0!==s)return s.Z_;if(this.Ke===this.ir){const t=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(E(t)),this.Je++,this.Ke--}const n=this.U_(t);return this.tr.set(i,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,i),this.Ke++,this.Ge++,n}}class zi{constructor(t,e){x(t<=e,"right should be >= left"),this.X_=t,this.K_=e}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}Ch(t){return this.X_===t.Os()&&this.K_===t.ui()}}function ki(t,e){return null===t||null===e?t===e:t.Ch(e)}class Ti{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(t){this.Q_=t,this.tr=null}iu(t,e){this.nu(e),this.tr=null;for(let i=e;i<t.length;++i){const e=t[i];let s=this.J_.get(e.timeWeight);void 0===s&&(s=[],this.J_.set(e.timeWeight,s)),s.push({index:i,time:e.time,weight:e.timeWeight,originalTime:e.originalTime})}}su(t,e){const i=Math.ceil(e/t);return null!==this.tr&&this.tr.eu===i||(this.tr={Ha:this.ru(i),eu:i}),this.tr.Ha}nu(t){if(0===t)return void this.J_.clear();const e=[];this.J_.forEach((i,s)=>{t<=i[0].index?e.push(s):i.splice(At(i,t,e=>e.index<t),1/0)});for(const t of e)this.J_.delete(t)}ru(t){let e=[];for(const i of Array.from(this.J_.keys()).sort((t,e)=>e-t)){if(!this.J_.get(i))continue;const s=e;e=[];const n=s.length;let r=0;const o=E(this.J_.get(i)),h=o.length;let l=1/0,a=-1/0;for(let i=0;i<h;i++){const h=o[i],c=h.index;for(;r<n;){const t=s[r],i=t.index;if(!(i<c)){l=i;break}r++,e.push(t),a=i,l=1/0}if(l-c>=t&&c-a>=t)e.push(h),a=c;else if(this.Q_)return s}for(;r<n;r++)e.push(s[r])}return e}}class Ri{constructor(t){this.hu=t}lu(){return null===this.hu?null:new zi(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Ri(null)}}function Ni(t,e){return t.weight>e.weight?t:e}class Li{constructor(t,e,i,s){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Ti,this.du=new Map,this.fu=Ri.ou(),this.vu=!0,this.pu=new B,this.mu=new B,this.bu=new B,this.wu=null,this.gu=null,this.Mu=[],this.cn=e,this.yo=i,this.xu=e.rightOffset,this.Su=e.barSpacing,this.$i=t,this.q_=s,this.ku(),this.cu.tu(e.uniformDistribution)}W(){return this.cn}yu(t){F(this.yo,t),this.Cu(),this.ku()}$h(t,e){var i;F(this.cn,t),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),void 0!==t.barSpacing&&this.$i.Gn(t.barSpacing),void 0!==t.rightOffset&&this.$i.Jn(t.rightOffset),void 0!==t.minBarSpacing&&this.$i.Gn(null!==(i=t.barSpacing)&&void 0!==i?i:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(t){var e,i;return null!==(i=null===(e=this.uu[t])||void 0===e?void 0:e.time)&&void 0!==i?i:null}Ui(t){var e;return null!==(e=this.uu[t])&&void 0!==e?e:null}Va(t,e){if(this.uu.length<1)return null;if(this.q_.key(t)>this.q_.key(this.uu[this.uu.length-1].time))return e?this.uu.length-1:null;const i=At(this.uu,this.q_.key(t),(t,e)=>this.q_.key(t.time)<e);return this.q_.key(t)<this.q_.key(this.uu[i].time)?e?i:null:i}Ni(){return 0===this.__||0===this.uu.length||null===this._u}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const t=this.Xs();if(null===t)return null;const e={from:t.Os(),to:t.ui()};return this.Ou(e)}Ou(t){const e=Math.round(t.from),i=Math.round(t.to),s=_(this.Bu()),n=_(this.Au());return{from:_(this.Ui(Math.max(s,e))),to:_(this.Ui(Math.min(n,i)))}}Iu(t){return{from:_(this.Va(t.from,!0)),to:_(this.Va(t.to,!0))}}Hi(){return this.__}S_(t){if(!isFinite(t)||t<=0)return;if(this.__===t)return;const e=this.Du(),i=this.__;if(this.__=t,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&0!==i){const e=this.Su*t/i;this.Su=e}if(this.cn.fixLeftEdge&&null!==e&&e.Os()<=0){const e=i-t;this.xu-=Math.round(e/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(t){if(this.Ni()||!W(t))return 0;const e=this.Eu()+this.xu-t;return this.__-(e+.5)*this.Su-1}Qs(t,e){const i=this.Eu(),s=void 0===e?0:e.from,n=void 0===e?t.length:e.to;for(let e=s;e<n;e++){const s=t[e].ot,n=i+this.xu-s,r=this.__-(n+.5)*this.Su-1;t[e].nt=r}}Nu(t){return Math.ceil(this.Fu(t))}Jn(t){this.vu=!0,this.xu=t,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(t){this.ju(t),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(null!==this.gu)return this.gu;const t=this.Su,e=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),i=Math.round(e/t),s=_(this.Xs()),n=Math.max(s.Os(),s.Os()-i),r=Math.max(s.ui(),s.ui()-i),o=this.cu.su(t,e),h=this.Bu()+i,l=this.Au()-i,a=this.$u(),c=this.cn.fixLeftEdge||a,u=this.cn.fixRightEdge||a;let d=0;for(const t of o){if(!(n<=t.index&&t.index<=r))continue;let i;d<this.Mu.length?(i=this.Mu[d],i.coord=this.It(t.index),i.label=this.Uu(t),i.weight=t.weight):(i={needAlignCoordinate:!1,coord:this.It(t.index),label:this.Uu(t),weight:t.weight},this.Mu.push(i)),this.Su>e/2&&!a?i.needAlignCoordinate=!1:i.needAlignCoordinate=c&&t.index<=h||u&&t.index>=l,d++}return this.Mu.length=d,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(t){this.vu=!0,this._u=t,this.Lu(),this.Tu()}Zu(t,e){const i=this.Fu(t),s=this.le(),n=s+e*(s/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(i-this.Fu(t)))}Go(t){this.Mo&&this.n_(),null===this.wo&&null===this.wu&&(this.Ni()||(this.wo=t,this.Xu()))}Jo(t){if(null===this.wu)return;const e=Nt(this.__-t,0,this.__),i=Nt(this.__-_(this.wo),0,this.__);0!==e&&0!==i&&this.Gn(this.wu.le*e/i)}Qo(){null!==this.wo&&(this.wo=null,this.Ku())}t_(t){null===this.Mo&&null===this.wu&&(this.Ni()||(this.Mo=t,this.Xu()))}i_(t){if(null===this.Mo)return;const e=(this.Mo-t)/this.le();this.xu=_(this.wu).Hu+e,this.vu=!0,this.Lu()}n_(){null!==this.Mo&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(t,e=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(e)||e<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const i=this.xu,s=performance.now();this.$i.Zn({Qu:t=>(t-s)/e>=1,tc:n=>{const r=(n-s)/e;return r>=1?t:i+(t-i)*r}})}bt(t,e){this.vu=!0,this.uu=t,this.cu.iu(t,e),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(t){const e=t.G_();this.ju(this.__/e),this.xu=t.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const t=this.Bu(),e=this.Au();null!==t&&null!==e&&this.rc(new zi(t,e+this.cn.rightOffset))}lc(t){const e=new zi(t.from,t.to);this.rc(e)}qi(t){return void 0!==this.yo.timeFormatter?this.yo.timeFormatter(t.originalTime):this.q_.formatHorzItem(t.time)}$u(){const{handleScroll:t,handleScale:e}=this.$i.W();return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||e.axisDoubleClickReset.time||e.axisPressedMouseMove.time||e.mouseWheel||e.pinch)}Bu(){return 0===this.uu.length?null:0}Au(){return 0===this.uu.length?null:this.uu.length-1}ac(t){return(this.__-1-t)/this.Su}Fu(t){const e=this.ac(t),i=this.Eu()+this.xu-e;return Math.round(1e6*i)/1e6}ju(t){const e=this.Su;this.Su=t,this.zu(),e!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Ri.ou());const t=this.Eu(),e=this.__/this.Su,i=this.xu+t,s=new zi(i-e+1,i);this._c(new Ri(s))}zu(){const t=this.uc();if(this.Su<t&&(this.Su=t,this.vu=!0),0!==this.__){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&0!==this.uu.length?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const t=this.cc();null!==t&&this.xu<t&&(this.xu=t,this.vu=!0);const e=this.dc();this.xu>e&&(this.xu=e,this.vu=!0)}cc(){const t=this.Bu(),e=this._u;return null===t||null===e?null:t-e-1+(this.cn.fixLeftEdge?this.__/this.Su:Math.min(2,this.uu.length))}dc(){return this.cn.fixRightEdge?0:this.__/this.Su-Math.min(2,this.uu.length)}Xu(){this.wu={le:this.le(),Hu:this.Hu()}}Ku(){this.wu=null}Uu(t){let e=this.du.get(t.weight);return void 0===e&&(e=new _i(t=>this.fc(t),this.q_),this.du.set(t.weight,e)),e.Y_(t)}fc(t){return this.q_.formatTickmark(t,this.yo)}_c(t){const e=this.fu;this.fu=t,ki(e.lu(),this.fu.lu())||this.pu.m(),ki(e.au(),this.fu.au())||this.mu.m(),this.oc()}oc(){this.gu=null}Cu(){this.oc(),this.du.clear()}ku(){this.q_.updateFormatter(this.yo)}Tu(){if(!this.cn.fixLeftEdge)return;const t=this.Bu();if(null===t)return;const e=this.Xs();if(null===e)return;const i=e.Os()-t;if(i<0){const t=this.xu-i-1;this.Jn(t)}this.zu()}Pu(){this.Lu(),this.zu()}}class Oi{X(t,e,i){t.useMediaCoordinateSpace(t=>this.K(t,e,i))}gl(t,e,i){t.useMediaCoordinateSpace(t=>this.vc(t,e,i))}vc(t,e,i){}}class Pi extends Oi{constructor(t){super(),this.mc=new Map,this.zt=t}K(t){}vc(t){if(!this.zt.yt)return;const{context:e,mediaSize:i}=t;let s=0;for(const t of this.zt.bc){if(0===t.Kt.length)continue;e.font=t.R;const n=this.wc(e,t.Kt);n>i.width?t.Zu=i.width/n:t.Zu=1,s+=t.gc*t.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((i.height-s)/2,0);break;case"bottom":n=Math.max(i.height-s,0)}e.fillStyle=this.zt.V;for(const t of this.zt.bc){e.save();let s=0;switch(this.zt.xc){case"left":e.textAlign="left",s=t.gc/2;break;case"center":e.textAlign="center",s=i.width/2;break;case"right":e.textAlign="right",s=i.width-1-t.gc/2}e.translate(s,n),e.textBaseline="top",e.font=t.R,e.scale(t.Zu,t.Zu),e.fillText(t.Kt,0,t.Sc),e.restore(),n+=t.gc*t.Zu}}wc(t,e){const i=this.kc(t.font);let s=i.get(e);return void 0===s&&(s=t.measureText(e).width,i.set(e,s)),s}kc(t){let e=this.mc.get(t);return void 0===e&&(e=new Map,this.mc.set(t,e)),e}}class $i{constructor(t){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Pi(this.Ft),this.jt=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const t=this.jt.W(),e=this.Ft;e.yt=t.visible,e.yt&&(e.V=t.color,e.xc=t.horzAlign,e.Mc=t.vertAlign,e.bc=[{Kt:t.text,R:X(t.fontSize,t.fontFamily,t.fontStyle),gc:1.2*t.fontSize,Sc:0,Zu:0}])}}class Vi extends pt{constructor(t,e){super(),this.cn=e,this.wn=new $i(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Di,Bi,Fi,Ai,Wi;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(Di||(Di={}));class ji{constructor(t,e,i){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new B,this.Rc=new B,this.Dc=null,this.Vc=t,this.cn=e,this.q_=i,this.Oc=new G(this),this.yl=new Li(this,e.timeScale,this.cn.localization,i),this.vt=new vt(this,e.crosshair),this.Bc=new ni(e.crosshair),this.Ac=new Vi(this,e.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(wt.es())}Uh(){this.Nc(wt.ss())}oa(){this.Nc(new wt(1))}Gl(t){const e=this.Fc(t);this.Nc(e)}Wc(){return this.Tc}jc(t){const e=this.Tc;this.Tc=t,null!==e&&this.Gl(e.Hc),null!==t&&this.Gl(t.Hc)}W(){return this.cn}$h(t){F(this.cn,t),this.yc.forEach(e=>e.b_(t)),void 0!==t.timeScale&&this.yl.$h(t.timeScale),void 0!==t.localization&&this.yl.yu(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(t,e){if("left"===t)return void this.$h({leftPriceScale:e});if("right"===t)return void this.$h({rightPriceScale:e});const i=this.Uc(t);null!==i&&(i.Dt.$h(e),this.Pc.m())}Uc(t){for(const e of this.yc){const i=e.w_(t);if(null!==i)return{Ht:e,Dt:i}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(t,e){t.Lo(e),this.Wu()}S_(t){this.__=t,this.yl.S_(this.__),this.yc.forEach(e=>e.S_(t)),this.Wu()}Ic(t){const e=new Ei(this.yl,this);void 0!==t?this.yc.splice(t,0,e):this.yc.push(e);const i=void 0===t?this.yc.length-1:t,s=wt.es();return s.Nn(i,{Fn:0,Wn:!0}),this.Nc(s),e}V_(t,e,i){t.V_(e,i)}O_(t,e,i){t.O_(e,i),this.Jl(),this.Nc(this.Gc(t,2))}B_(t,e){t.B_(e),this.Nc(this.Gc(t,2))}A_(t,e,i){e.Vo()||t.A_(e,i)}I_(t,e,i){e.Vo()||(t.I_(e,i),this.Jl(),this.Nc(this.Gc(t,2)))}z_(t,e){e.Vo()||(t.z_(e),this.Nc(this.Gc(t,2)))}E_(t,e){t.E_(e),this.Nc(this.Gc(t,2))}Jc(t){this.yl.Go(t)}Qc(t,e){const i=this.St();if(i.Ni()||0===e)return;const s=i.Hi();t=Math.max(1,Math.min(t,s)),i.Zu(t,e),this.Wu()}td(t){this.nd(0),this.sd(t),this.ed()}rd(t){this.yl.Jo(t),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(t){this.yl.t_(t)}sd(t){this.yl.i_(t),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(t,e,i,s,n){this.vt.gn(t,e);let r=NaN,o=this.yl.Nu(t);const h=this.yl.Xs();null!==h&&(o=Math.min(Math.max(h.Os(),o),h.ui()));const l=s.vn(),a=l.Ct();null!==a&&(r=l.pn(e,a)),r=this.Bc.Oa(r,o,s),this.vt.kn(o,r,s),this.oa(),n||this.Rc.m(this.vt.xt(),{x:t,y:e},i)}ad(t,e,i){const s=i.vn(),n=s.Ct(),r=s.Rt(t,_(n)),o=this.yl.Va(e,!0),h=this.yl.It(_(o));this.ld(h,r,null,i,!0)}od(t){this.Zc().Cn(),this.oa(),t||this.Rc.m(null,null,null)}Jl(){const t=this.vt.Ht();if(null!==t){const e=this.vt.xn(),i=this.vt.Sn();this.ld(e,i,null,t)}this.vt.Vn()}_d(t,e,i){const s=this.yl.mn(0);void 0!==e&&void 0!==i&&this.yl.bt(e,i);const n=this.yl.mn(0),r=this.yl.Eu(),o=this.yl.Xs();if(null!==o&&null!==s&&null!==n){const e=o.Kr(r),h=this.q_.key(s)>this.q_.key(n),l=null!==t&&t>r&&!h,a=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,c=e&&(!(void 0===i)||a)&&this.yl.W().shiftVisibleRangeOnNewBar;if(l&&!c){const e=t-r;this.yl.Jn(this.yl.Hu()-e)}}this.yl.Yu(t)}ia(t){null!==t&&t.F_()}dr(t){const e=this.yc.find(e=>e.Uo().includes(t));return void 0===e?null:e}Wu(){this.Ac.Vn(),this.yc.forEach(t=>t.F_()),this.Jl()}S(){this.yc.forEach(t=>t.S()),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(t,e,i){const s=this.yc[0],n=this.fd(e,t,s,i);return this.Cc.push(n),1===this.Cc.length?this.Kl():this.Uh(),n}vd(t){const e=this.dr(t),i=this.Cc.indexOf(t);x(-1!==i,"Series not found"),this.Cc.splice(i,1),_(e).Zo(t),t.S&&t.S()}Xl(t,e){const i=_(this.dr(t));i.Zo(t);const s=this.Uc(e);if(null===s){const s=t.Xi();i.qo(t,e,s)}else{const n=s.Ht===i?t.Xi():void 0;s.Ht.qo(t,e,n)}}hc(){const t=wt.ss();t.$n(),this.Nc(t)}pd(t){const e=wt.ss();e.Yn(t),this.Nc(e)}Kn(){const t=wt.ss();t.Kn(),this.Nc(t)}Gn(t){const e=wt.ss();e.Gn(t),this.Nc(e)}Jn(t){const e=wt.ss();e.Jn(t),this.Nc(e)}Zn(t){const e=wt.ss();e.Zn(t),this.Nc(e)}Un(){const t=wt.ss();t.Un(),this.Nc(t)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(t){const e=this.Ec,i=this.zc;if(e===i)return e;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Dc||this.Dc.Ps!==i||this.Dc.Rs!==e)this.Dc={Ps:i,Rs:e,wd:new Map};else{const e=this.Dc.wd.get(t);if(void 0!==e)return e}const s=function(t,e,i){const[s,n,r,o]=$(t),[h,l,a,c]=$(e),u=[T(s+i*(h-s)),T(n+i*(l-n)),T(r+i*(a-r)),R(o+i*(c-o))];return`rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(i,e,t/100);return this.Dc.wd.set(t,s),s}Gc(t,e){const i=new wt(e);if(null!==t){const s=this.yc.indexOf(t);i.Nn(s,{Fn:e})}return i}Fc(t,e){return void 0===e&&(e=2),this.Gc(this.dr(t),e)}Nc(t){this.Vc&&this.Vc(t),this.yc.forEach(t=>t.j_().qh().bt())}fd(t,e,i,s){const n=new si(this,t,e,i,s),r=void 0!==t.priceScaleId?t.priceScaleId:this.md();return i.qo(n,r),bt(r)||n.$h(t),n}Lc(t){const e=this.cn.layout;return"gradient"===e.background.type?0===t?e.background.topColor:e.background.bottomColor:e.background.color}}function Ii(t){return!A(t)&&!j(t)}function Ui(t){return A(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(Bi||(Bi={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(Fi||(Fi={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(Ai||(Ai={})),function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"}(Wi||(Wi={}));const Hi=t=>t.getUTCFullYear();class Ki{constructor(t="yyyy-MM-dd",e="default"){this.gd=t,this.Md=e}Y_(t){return function(t,e,i){return e.replace(/yyyy/g,(t=>yt(Hi(t),4))(t)).replace(/yy/g,(t=>yt(Hi(t)%100,2))(t)).replace(/MMMM/g,((t,e)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"long"}))(t,i)).replace(/MMM/g,((t,e)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"short"}))(t,i)).replace(/MM/g,(t=>yt((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>yt((t=>t.getUTCDate())(t),2))(t))}(t,this.gd,this.Md)}}class qi{constructor(t){this.xd=t||"%h:%m:%s"}Y_(t){return this.xd.replace("%h",yt(t.getUTCHours(),2)).replace("%m",yt(t.getUTCMinutes(),2)).replace("%s",yt(t.getUTCSeconds(),2))}}const Xi={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class Gi{constructor(t={}){const e=Object.assign(Object.assign({},Xi),t);this.Td=new Ki(e.Sd,e.Cd),this.Pd=new qi(e.kd),this.Rd=e.yd}Y_(t){return`${this.Td.Y_(t)}${this.Rd}${this.Pd.Y_(t)}`}}function Ji(t){return 60*t*60*1e3}function Qi(t){return 60*t*1e3}const Yi=[{Dd:1e3,Vd:10},{Dd:Qi(1),Vd:20},{Dd:Qi(5),Vd:21},{Dd:Qi(30),Vd:22},{Dd:Ji(1),Vd:30},{Dd:Ji(3),Vd:31},{Dd:Ji(6),Vd:32},{Dd:Ji(12),Vd:33}];function Zi(t,e){if(t.getUTCFullYear()!==e.getUTCFullYear())return 70;if(t.getUTCMonth()!==e.getUTCMonth())return 60;if(t.getUTCDate()!==e.getUTCDate())return 50;for(let i=Yi.length-1;i>=0;--i)if(Math.floor(e.getTime()/Yi[i].Dd)!==Math.floor(t.getTime()/Yi[i].Dd))return Yi[i].Vd;return 0}function ts(t){let e=t;if(j(t)&&(e=is(t)),!Ii(e))throw new Error("time must be of type BusinessDay");const i=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(i.getTime()/1e3),Bd:e}}function es(t){if(!Ui(t))throw new Error("time must be of type isUTCTimestamp");return{Od:t}}function is(t){const e=new Date(t);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function ss(t){j(t.time)&&(t.time=is(t.time))}class ns{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(ss)}(t):ss(t)}createConverterToInternalObj(t){return _(function(t){return 0===t.length?null:Ii(t[0].time)||j(t[0].time)?ts:es}(t))}key(t){return"object"==typeof t&&"Od"in t?t.Od:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){const e=t;return void 0===e.Bd?new Date(1e3*e.Od).getTime():new Date(Date.UTC(e.Bd.year,e.Bd.month-1,e.Bd.day)).getTime()}convertHorzItemToInternal(t){return Ui(e=t)?es(e):Ii(e)?ts(e):ts(is(e));var e}updateFormatter(t){if(!this.cn)return;const e=t.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new Gi({Sd:e,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:t.locale}):this.Ad=new Ki(e,t.locale)}formatHorzItem(t){const e=t;return this.Ad.Y_(new Date(1e3*e.Od))}formatTickmark(t,e){const i=function(t,e,i){switch(t){case 0:case 10:return e?i?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return e?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),s=this.cn.timeScale;if(void 0!==s.tickMarkFormatter){const n=s.tickMarkFormatter(t.originalTime,i,e.locale);if(null!==n)return n}return function(t,e,i){const s={};switch(e){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"}const n=void 0===t.Bd?new Date(1e3*t.Od):new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day));return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()).toLocaleString(i,s)}(t.time,i,e.locale)}maxTickMarkWeight(t){let e=t.reduce(Ni,t[0]).weight;return e>30&&e<50&&(e=30),e}fillWeightsForPoints(t,e){!function(t,e=0){if(0===t.length)return;let i=0===e?null:t[e-1].time.Od,s=null!==i?new Date(1e3*i):null,n=0;for(let r=e;r<t.length;++r){const e=t[r],o=new Date(1e3*e.time.Od);null!==s&&(e.timeWeight=Zi(o,s)),n+=e.time.Od-(i||e.time.Od),i=e.time.Od,s=o}if(0===e&&t.length>1){const e=Math.ceil(n/(t.length-1)),i=new Date(1e3*(t[0].time.Od-e));t[0].timeWeight=Zi(new Date(1e3*t[0].time.Od),i)}}(t,e)}static Id(t){return F({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const rs="undefined"!=typeof window;function os(){return!!rs&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function hs(){return!!rs&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function ls(t){return t+t%2}function as(t,e){return t.zd-e.zd}function cs(t,e,i){const s=(t.zd-e.zd)/(t.ot-e.ot);return Math.sign(s)*Math.min(Math.abs(s),i)}class us{constructor(t,e,i,s){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=t,this.Ud=e,this.qd=i,this.rs=s}Yd(t,e){if(null!==this.Ld){if(this.Ld.ot===e)return void(this.Ld.zd=t);if(Math.abs(this.Ld.zd-t)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:e,zd:t}}Vr(t,e){if(null===this.Ld||null===this.Ed)return;if(e-this.Ld.ot>50)return;let i=0;const s=cs(this.Ld,this.Ed,this.Ud),n=as(this.Ld,this.Ed),r=[s],o=[n];if(i+=n,null!==this.Nd){const t=cs(this.Ed,this.Nd,this.Ud);if(Math.sign(t)===Math.sign(s)){const e=as(this.Ed,this.Nd);if(r.push(t),o.push(e),i+=e,null!==this.Fd){const t=cs(this.Nd,this.Fd,this.Ud);if(Math.sign(t)===Math.sign(s)){const e=as(this.Nd,this.Fd);r.push(t),o.push(e),i+=e}}}}let h=0;for(let t=0;t<r.length;++t)h+=o[t]/i*r[t];Math.abs(h)<this.$d||(this.Wd={zd:t,ot:e},this.Hd=h,this.jd=function(t,e){const i=Math.log(e);return Math.log(1*i/-t)/i}(Math.abs(h),this.qd))}tc(t){const e=_(this.Wd),i=t-e.ot;return e.zd+this.Hd*(Math.pow(this.qd,i)-1)/Math.log(this.qd)}Qu(t){return null===this.Wd||this.Zd(t)===this.jd}Zd(t){const e=t-_(this.Wd).ot;return Math.min(e,this.jd)}}class ds{constructor(t,e){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=t,this.Qd=e,this.tf()}bt(){this.tf()}if(){this.Xd&&this.Jd.removeChild(this.Xd),this.Kd&&this.Jd.removeChild(this.Kd),this.Xd=void 0,this.Kd=void 0}nf(){return this.en!==this.sf()||this.Gd!==this.ef()}ef(){return V($(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}tf(){this.nf()&&(this.if(),this.en=this.sf(),this.en&&(this.Gd=this.ef(),this.Kd=document.createElement("style"),this.Kd.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.Xd=document.createElement("a"),this.Xd.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.rf()}`,this.Xd.title="Charting by TradingView",this.Xd.id="tv-attr-logo",this.Xd.target="_blank",this.Xd.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 19" 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.Xd.toggleAttribute("data-dark","dark"===this.Gd),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function fs(t,e){const i=_(t.ownerDocument).createElement("canvas");t.appendChild(i);const s=(n={options:{allowResizeObserver:!1},transform:(t,e)=>({width:Math.max(t.width,e.width),height:Math.max(t.height,e.height)})},new h(i,n.transform,n.options));var n;return s.resizeCanvasElement(e),s}function ms(t){var e;t.width=1,t.height=1,null===(e=t.getContext("2d"))||void 0===e||e.clearRect(0,0,1,1)}function ps(t,e,i,s){t.gl&&t.gl(e,i,s)}function gs(t,e,i,s){t.X(e,i,s)}function vs(t,e,i,s){const n=t(i,s);for(const t of n){const i=t.gt();null!==i&&e(i)}}class bs{constructor(t,e,i){this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.df=null,this.ff=!1,this.vf=null,this.pf=null,this.mf=!1,this.bf=!1,this.wf=!1,this.gf=null,this.Mf=null,this.xf=null,this.Sf=null,this.kf=null,this.yf=null,this.Cf=null,this.Tf=0,this.Pf=!1,this.Rf=!1,this.Df=!1,this.Vf=0,this.Of=null,this.Bf=!hs(),this.Af=t=>{this.If(t)},this.zf=t=>{if(this.Lf(t)){const e=this.Ef(t);if(++this._f,this.uf&&this._f>1){const{Nf:i}=this.Ff(Ss(t),this.cf);i<30&&!this.wf&&this.Wf(e,this.Hf.jf),this.$f()}}else{const e=this.Ef(t);if(++this.hf,this.lf&&this.hf>1){const{Nf:i}=this.Ff(Ss(t),this.af);i<5&&!this.bf&&this.Uf(e,this.Hf.qf),this.Yf()}}},this.Zf=t,this.Hf=e,this.cn=i,this.Xf()}S(){null!==this.gf&&(this.gf(),this.gf=null),null!==this.Mf&&(this.Mf(),this.Mf=null),null!==this.Sf&&(this.Sf(),this.Sf=null),null!==this.kf&&(this.kf(),this.kf=null),null!==this.yf&&(this.yf(),this.yf=null),null!==this.xf&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(t){this.Sf&&this.Sf();const e=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",e)},this.Zf.addEventListener("mousemove",e),this.Lf(t))return;const i=this.Ef(t);this.Uf(i,this.Hf.Qf),this.Bf=!0}Yf(){null!==this.lf&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){null!==this.uf&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(t){if(this.Df||null!==this.pf)return;if(this.Lf(t))return;const e=this.Ef(t);this.Uf(e,this.Hf.tv),this.Bf=!0}iv(t){const e=Ms(t.changedTouches,_(this.Of));if(null===e)return;if(this.Vf=Cs(t),null!==this.Cf)return;if(this.Rf)return;this.Pf=!0;const i=this.Ff(Ss(e),_(this.pf)),{nv:s,sv:n,Nf:r}=i;if(this.mf||!(r<5)){if(!this.mf){const t=.5*s,e=n>=t&&!this.cn.ev(),i=t>n&&!this.cn.rv();e||i||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const i=this.Ef(t,e);this.Wf(i,this.Hf.hv),ys(t)}}}lv(t){if(0!==t.button)return;const e=this.Ff(Ss(t),_(this.vf)),{Nf:i}=e;if(i>=5&&(this.bf=!0,this.Yf()),this.bf){const e=this.Ef(t);this.Uf(e,this.Hf.av)}}Ff(t,e){const i=Math.abs(e.nt-t.nt),s=Math.abs(e.st-t.st);return{nv:i,sv:s,Nf:i+s}}ov(t){let e=Ms(t.changedTouches,_(this.Of));if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null===e)return;this.Of=null,this.Vf=Cs(t),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const i=this.Ef(t,e);if(this.Wf(i,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:t}=this.Ff(Ss(e),this.cf);t<30&&!this.wf&&this.Wf(i,this.Hf.jf),this.$f()}else this.wf||(this.Wf(i,this.Hf.uv),this.Hf.uv&&ys(t));0===this._f&&ys(t),0===t.touches.length&&this.ff&&(this.ff=!1,ys(t))}If(t){if(0!==t.button)return;const e=this.Ef(t);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),os()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(t))if(this.Uf(e,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:i}=this.Ff(Ss(t),this.af);i<5&&!this.bf&&this.Uf(e,this.Hf.qf),this.Yf()}else this.bf||this.Uf(e,this.Hf.dv)}Kf(){null!==this.df&&(clearTimeout(this.df),this.df=null)}fv(t){if(null!==this.Of)return;const e=t.changedTouches[0];this.Of=e.identifier,this.Vf=Cs(t);const i=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=Ss(e),this.yf&&(this.yf(),this.yf=null);{const e=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{i.removeEventListener("touchmove",e),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",e,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,t),240)}const s=this.Ef(t,e);this.Wf(s,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=Ss(e))}mv(t){if(0!==t.button)return;const e=this.Zf.ownerDocument.documentElement;os()&&e.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=Ss(t),this.kf&&(this.kf(),this.kf=null);{const t=this.lv.bind(this),i=this.If.bind(this);this.kf=()=>{e.removeEventListener("mousemove",t),e.removeEventListener("mouseup",i)},e.addEventListener("mousemove",t),e.addEventListener("mouseup",i)}if(this.Df=!0,this.Lf(t))return;const i=this.Ef(t);this.Uf(i,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=Ss(t))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const t=this.Zf.ownerDocument,e=t=>{this.Hf.wv&&(t.composed&&this.Zf.contains(t.composedPath()[0])||t.target&&this.Zf.contains(t.target)||this.Hf.wv())};this.Mf=()=>{t.removeEventListener("touchstart",e)},this.gf=()=>{t.removeEventListener("mousedown",e)},t.addEventListener("mousedown",e),t.addEventListener("touchstart",e,{passive:!0})}hs()&&(this.xf=()=>{this.Zf.removeEventListener("dblclick",this.zf)},this.Zf.addEventListener("dblclick",this.zf)),this.Zf.addEventListener("mouseleave",this.gv.bind(this)),this.Zf.addEventListener("touchstart",this.fv.bind(this),{passive:!0}),function(t){rs&&void 0!==window.chrome&&t.addEventListener("mousedown",t=>{if(1===t.button)return t.preventDefault(),!1})}(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",()=>{},{passive:!1})}Mv(){void 0===this.Hf.xv&&void 0===this.Hf.Sv&&void 0===this.Hf.kv||(this.Zf.addEventListener("touchstart",t=>this.yv(t.touches),{passive:!0}),this.Zf.addEventListener("touchmove",t=>{if(2===t.touches.length&&null!==this.Cf&&void 0!==this.Hf.Sv){const e=ws(t.touches[0],t.touches[1])/this.Tf;this.Hf.Sv(this.Cf,e),ys(t)}},{passive:!1}),this.Zf.addEventListener("touchend",t=>{this.yv(t.touches)}))}yv(t){1===t.length&&(this.Pf=!1),2!==t.length||this.Pf||this.ff?this.Cv():this.Tv(t)}Tv(t){const e=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(t[0].clientX-e.left+(t[1].clientX-e.left))/2,st:(t[0].clientY-e.top+(t[1].clientY-e.top))/2},this.Tf=ws(t[0],t[1]),void 0!==this.Hf.xv&&this.Hf.xv(),this.Kf()}Cv(){null!==this.Cf&&(this.Cf=null,void 0!==this.Hf.kv&&this.Hf.kv())}gv(t){if(this.Sf&&this.Sf(),this.Lf(t))return;if(!this.Bf)return;const e=this.Ef(t);this.Uf(e,this.Hf.Pv),this.Bf=!hs()}vv(t){const e=Ms(t.touches,_(this.Of));if(null===e)return;const i=this.Ef(t,e);this.Wf(i,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:Cs(t)<this.Vf+500}Wf(t,e){e&&e.call(this.Hf,t)}Uf(t,e){e&&e.call(this.Hf,t)}Ef(t,e){const i=e||t,s=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,localX:i.clientX-s.left,localY:i.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,Dv:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,Vv:t.type,Ov:i.target,Bv:t.view,Av:()=>{"touchstart"!==t.type&&ys(t)}}}}function ws(t,e){const i=t.clientX-e.clientX,s=t.clientY-e.clientY;return Math.sqrt(i*i+s*s)}function ys(t){t.cancelable&&t.preventDefault()}function Ss(t){return{nt:t.pageX,st:t.pageY}}function Cs(t){return t.timeStamp||performance.now()}function Ms(t,e){for(let i=0;i<t.length;++i)if(t[i].identifier===e)return t[i];return null}function xs(t){return{Hc:t.Hc,Iv:{gr:t.zv.externalId},Lv:t.zv.cursorStyle}}function Es(t,e,i){for(const s of t){const t=s.gt();if(null!==t&&t.wr){const n=t.wr(e,i);if(null!==n)return{Bv:s,Iv:n}}}return null}function _s(t,e){return i=>{var s,n,r,o;return(null!==(n=null===(s=i.Dt())||void 0===s?void 0:s.Pa())&&void 0!==n?n:"")!==e?[]:null!==(o=null===(r=i.da)||void 0===r?void 0:r.call(i,t))&&void 0!==o?o:[]}}function zs(t,e,i,s){if(!t.length)return;let n=0;const r=i/2,o=t[0].At(s,!0);let h=1===e?r-(t[0].Vi()-o/2):t[0].Vi()-o/2-r;h=Math.max(0,h);for(let r=1;r<t.length;r++){const o=t[r],l=t[r-1],a=l.At(s,!1),c=o.Vi(),u=l.Vi();if(1===e?c>u-a:c<u+a){const s=u-a*e;o.Oi(s);const r=s-e*a/2;if((1===e?r<0:r>i)&&h>0){const s=1===e?-1-r:r-i,o=Math.min(s,h);for(let i=n;i<t.length;i++)t[i].Oi(t[i].Vi()+e*o);h-=o}}else n=r,h=1===e?u-a-c:c-(u+a)}}class ks{constructor(t,e,i,s){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new ae(200),this.Qr=null,this.Wv=0,this.jv=!1,this.Hv=()=>{this.jv||this.tn.$v().$t().Uh()},this.Uv=()=>{this.jv||this.tn.$v().$t().Uh()},this.tn=t,this.cn=e,this.ko=e.layout,this.Oc=i,this.qv="left"===s,this.Yv=_s("normal",s),this.Zv=_s("top",s),this.Xv=_s("bottom",s),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=fs(this.Kv,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=fs(this.Kv,n({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const o=this.Jv.canvasElement;o.style.position="absolute",o.style.zIndex="2",o.style.left="0",o.style.top="0";const h={bv:this.Qv.bind(this),pv:this.Qv.bind(this),av:this.tp.bind(this),hv:this.tp.bind(this),wv:this.ip.bind(this),cv:this.np.bind(this),_v:this.np.bind(this),qf:this.sp.bind(this),jf:this.sp.bind(this),Qf:this.ep.bind(this),Pv:this.rp.bind(this)};this.hp=new bs(this.Jv.canvasElement,h,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),ms(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose(),null!==this.Li&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const t=this.Oc.W();return this.Qr!==t.R&&(this.Fv.nr(),this.Qr=t.R),t}op(){if(null===this.Li)return 0;let t=0;const e=this.ap(),i=_(this.Gv.canvasElement.getContext("2d"));i.save();const s=this.Li.Ha();i.font=this._p(),s.length>0&&(t=Math.max(this.Fv.xi(i,s[0].so),this.Fv.xi(i,s[s.length-1].so)));const n=this.up();for(let e=n.length;e--;){const s=this.Fv.xi(i,n[e].Kt());s>t&&(t=s)}const r=this.Li.Ct();if(null!==r&&null!==this.Ev&&2!==(o=this.cn.crosshair).mode&&o.horzLine.visible&&o.horzLine.labelVisible){const e=this.Li.pn(1,r),s=this.Li.pn(this.Ev.height-2,r);t=Math.max(t,this.Fv.xi(i,this.Li.Fi(Math.floor(Math.min(e,s))+.11111111111111,r)),this.Fv.xi(i,this.Li.Fi(Math.ceil(Math.max(e,s))-.11111111111111,r)))}var o;i.restore();const h=t||34;return ls(Math.ceil(e.C+e.T+e.A+e.I+5+h))}cp(t){null!==this.Ev&&r(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`)}dp(){return _(this.Ev).width}Gi(t){this.Li!==t&&(null!==this.Li&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const t=this.tn.fp();this.tn.$v().$t().E_(t,_(this.Dt()))}vp(t){if(null===this.Ev)return;if(1!==t){this.pp(),this.Gv.applySuggestedBitmapSize();const t=c(this.Gv);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.mp(t),this.Ie(t)}),this.tn.bp(t,this.Xv),this.wp(t),this.tn.bp(t,this.Yv),this.gp(t))}this.Jv.applySuggestedBitmapSize();const e=c(this.Jv);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:e})=>{t.clearRect(0,0,e.width,e.height)}),this.Mp(e),this.tn.bp(e,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}bt(){var t;null===(t=this.Li)||void 0===t||t.Ha()}Qv(t){if(null===this.Li||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!0,e.V_(i,this.Li,t.localY)}tp(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp(),s=this.Li;e.O_(i,s,t.localY)}ip(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),e=this.tn.fp(),i=this.Li;this.Nv&&(this.Nv=!1,t.B_(e,i))}np(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!1,e.B_(i,this.Li)}sp(t){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(t){null!==this.Li&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(t){this.kp(0)}up(){const t=[],e=null===this.Li?void 0:this.Li;return(i=>{for(let s=0;s<i.length;++s){const n=i[s].Rn(this.tn.fp(),e);for(let e=0;e<n.length;e++)t.push(n[e])}})(this.tn.fp().Uo()),t}mp({context:t,bitmapSize:e}){const{width:i,height:s}=e,n=this.tn.fp().$t(),r=n.q(),o=n.bd();r===o?rt(t,0,0,i,s,r):lt(t,0,0,i,s,r,o)}Ie({context:t,bitmapSize:e,horizontalPixelRatio:i}){if(null===this.Ev||null===this.Li||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.ap().C*i));let n;n=this.qv?e.width-s:0,t.fillRect(n,0,s,e.height)}wp(t){if(null===this.Ev||null===this.Li)return;const e=this.Li.Ha(),i=this.Li.W(),s=this.ap(),n=this.qv?this.Ev.width-s.T:0;i.borderVisible&&i.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:r,verticalPixelRatio:o})=>{t.fillStyle=i.borderColor;const h=Math.max(1,Math.floor(o)),l=Math.floor(.5*o),a=Math.round(s.T*r);t.beginPath();for(const i of e)t.rect(Math.floor(n*r),Math.round(i.Ea*o)-l,a,h);t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{var r;t.font=this._p(),t.fillStyle=null!==(r=i.textColor)&&void 0!==r?r:this.ko.textColor,t.textAlign=this.qv?"right":"left",t.textBaseline="middle";const o=this.qv?Math.round(n-s.A):Math.round(n+s.T+s.A),h=e.map(e=>this.Fv.Mi(t,e.so));for(let i=e.length;i--;){const s=e[i];t.fillText(s.so,o,s.Ea+h[i])}})}pp(){if(null===this.Ev||null===this.Li)return;const t=[],e=this.Li.Uo().slice(),i=this.tn.fp(),s=this.ap();this.Li===i.pr()&&this.tn.fp().Uo().forEach(t=>{i.vr(t)&&e.push(t)});const n=this.Li;e.forEach(e=>{e.Rn(i,n).forEach(e=>{e.Oi(null),e.Bi()&&t.push(e)})}),t.forEach(t=>t.Oi(t.ki())),this.Li.W().alignLabels&&this.yp(t,s)}yp(t,e){if(null===this.Ev)return;const i=this.Ev.height/2,s=t.filter(t=>t.ki()<=i),n=t.filter(t=>t.ki()>i);s.sort((t,e)=>e.ki()-t.ki()),n.sort((t,e)=>t.ki()-e.ki());for(const i of t){const t=Math.floor(i.At(e)/2),s=i.ki();s>-t&&s<t&&i.Oi(t),s>this.Ev.height-t&&s<this.Ev.height+t&&i.Oi(this.Ev.height-t)}zs(s,1,this.Ev.height,e),zs(n,-1,this.Ev.height,e)}gp(t){if(null===this.Ev)return;const e=this.up(),i=this.ap(),s=this.qv?"right":"left";e.forEach(e=>{e.Ai()&&e.gt(_(this.Li)).X(t,i,this.Fv,s)})}Mp(t){if(null===this.Ev||null===this.Li)return;const e=this.tn.$v().$t(),i=[],s=this.tn.fp(),n=e.Zc().Rn(s,this.Li);n.length&&i.push(n);const r=this.ap(),o=this.qv?"right":"left";i.forEach(e=>{e.forEach(e=>{e.gt(_(this.Li)).X(t,r,this.Fv,o)})})}kp(t){this.Kv.style.cursor=1===t?"ns-resize":"default"}fo(){const t=this.op();this.Wv<t&&this.tn.$v().$t().Kl(),this.Wv=t}_p(){return X(this.ko.fontSize,this.ko.fontFamily)}}function Ts(t,e){var i,s;return null!==(s=null===(i=t.ua)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}function Rs(t,e){var i,s;return null!==(s=null===(i=t.Pn)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}function Ns(t,e){var i,s;return null!==(s=null===(i=t.Ji)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}function Ls(t,e){var i,s;return null!==(s=null===(i=t.aa)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}class Os{constructor(t,e){this.Ev=n({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new B,this.Op=new B,this.Bp=0,this.Ap=!1,this.Ip=null,this.zp=!1,this.Lp=null,this.Ep=null,this.jv=!1,this.Hv=()=>{this.jv||null===this.Np||this.$i().Uh()},this.Uv=()=>{this.jv||null===this.Np||this.$i().Uh()},this.Qd=t,this.Np=e,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const i=document.createElement("div");i.style.width="100%",i.style.height="100%",i.style.position="relative",i.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(i),this.Gv=fs(i,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const s=this.Gv.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Jv=fs(i,n({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const r=this.Jv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new bs(this.Jv.canvasElement,this,{ev:()=>null===this.Ip&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>null===this.Ip&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){null!==this.Cp&&this.Cp.S(),null!==this.Tp&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),ms(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose(),null!==this.Np&&this.Np.W_().p(this),this.hp.S()}fp(){return _(this.Np)}qp(t){var e,i;null!==this.Np&&this.Np.W_().p(this),this.Np=t,null!==this.Np&&this.Np.W_().l(Os.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=null!==(e=this.Pp)&&void 0!==e?e:new ds(this.Wp,this.Qd),this.Pp.bt()):(null===(i=this.Pp)||void 0===i||i.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(null!==this.Np&&(this.Zp(),0!==this.$i().wt().length)){if(null!==this.Cp){const t=this.Np.R_();this.Cp.Gi(_(t))}if(null!==this.Tp){const t=this.Np.D_();this.Tp.Gi(_(t))}}}Xp(){null!==this.Cp&&this.Cp.bt(),null!==this.Tp&&this.Tp.bt()}M_(){return null!==this.Np?this.Np.M_():0}x_(t){this.Np&&this.Np.x_(t)}Qf(t){if(!this.Np)return;this.Kp();const e=t.localX,i=t.localY;this.Gp(e,i,t)}bv(t){this.Kp(),this.Jp(),this.Gp(t.localX,t.localY,t)}tv(t){var e;if(!this.Np)return;this.Kp();const i=t.localX,s=t.localY;this.Gp(i,s,t);const n=this.wr(i,s);this.Qd.Qp(null!==(e=null==n?void 0:n.Lv)&&void 0!==e?e:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(t){null!==this.Np&&(this.Kp(),this.tm(t))}qf(t){null!==this.Np&&this.im(this.Op,t)}jf(t){this.qf(t)}av(t){this.Kp(),this.nm(t),this.Gp(t.localX,t.localY,t)}cv(t){null!==this.Np&&(this.Kp(),this.Ap=!1,this.sm(t))}uv(t){null!==this.Np&&this.tm(t)}Rv(t){if(this.Ap=!0,null===this.Ip){const e={x:t.localX,y:t.localY};this.rm(e,e,t)}}Pv(t){null!==this.Np&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(t,e){if(!this.Qd.W().handleScale.pinch)return;const i=5*(e-this.Bp);this.Bp=e,this.$i().Qc(t.nt,i)}pv(t){this.Ap=!1,this.zp=null!==this.Ip,this.Jp();const e=this.$i().Zc();null!==this.Ip&&e.yt()&&(this.Lp={x:e.Yt(),y:e.Zt()},this.Ip={x:t.localX,y:t.localY})}hv(t){if(null===this.Np)return;const e=t.localX,i=t.localY;if(null===this.Ip)this.nm(t);else{this.zp=!1;const s=_(this.Lp),n=s.x+(e-this.Ip.x),r=s.y+(i-this.Ip.y);this.Gp(n,r,t)}}_v(t){0===this.$v().W().trackingMode.exitMode&&(this.zp=!0),this.om(),this.sm(t)}wr(t,e){const i=this.Np;return null===i?null:function(t,e,i){const s=t.Uo(),n=function(t,e,i){var s,n;let r,o;for(const a of t){const t=null!==(n=null===(s=a.va)||void 0===s?void 0:s.call(a,e,i))&&void 0!==n?n:[];for(const e of t)h=e.zOrder,(!(l=null==r?void 0:r.zOrder)||"top"===h&&"top"!==l||"normal"===h&&"bottom"===l)&&(r=e,o=a)}var h,l;return r&&o?{zv:r,Hc:o}:null}(s,e,i);if("top"===(null==n?void 0:n.zv.zOrder))return xs(n);for(const r of s){if(n&&n.Hc===r&&"bottom"!==n.zv.zOrder&&!n.zv.isBackground)return xs(n);const s=Es(r.Pn(t),e,i);if(null!==s)return{Hc:r,Bv:s.Bv,Iv:s.Iv};if(n&&n.Hc===r&&"bottom"!==n.zv.zOrder&&n.zv.isBackground)return xs(n)}return(null==n?void 0:n.zv)?xs(n):null}(i,t,e)}_m(t,e){_("left"===e?this.Cp:this.Tp).cp(n({width:t,height:this.Ev.height}))}um(){return this.Ev}cp(t){r(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Wp.style.width=t.width+"px",this.Wp.style.height=t.height+"px")}dm(){const t=_(this.Np);t.P_(t.R_()),t.P_(t.D_());for(const e of t.Ba())if(t.vr(e)){const i=e.Dt();null!==i&&t.P_(i),e.Vn()}}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}vp(t){if(0===t)return;if(null===this.Np)return;if(t>1&&this.dm(),null!==this.Cp&&this.Cp.vp(t),null!==this.Tp&&this.Tp.vp(t),1!==t){this.Gv.applySuggestedBitmapSize();const t=c(this.Gv);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.mp(t)}),this.Np&&(this.fm(t,Ts),this.vm(t),this.pm(t),this.fm(t,Rs),this.fm(t,Ns)))}this.Jv.applySuggestedBitmapSize();const e=c(this.Jv);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:e})=>{t.clearRect(0,0,e.width,e.height)}),this.bm(e),this.fm(e,Ls))}wm(){return this.Cp}gm(){return this.Tp}bp(t,e){this.fm(t,e)}Fp(){null!==this.Np&&this.Np.W_().p(this),this.Np=null}tm(t){this.im(this.Vp,t)}im(t,e){const i=e.localX,s=e.localY;t.M()&&t.m(this.$i().St().Nu(i),{x:i,y:s},e)}mp({context:t,bitmapSize:e}){const{width:i,height:s}=e,n=this.$i(),r=n.q(),o=n.bd();r===o?rt(t,0,0,i,s,o):lt(t,0,0,i,s,r,o)}vm(t){const e=_(this.Np).j_().qh().gt();null!==e&&e.X(t,!1)}pm(t){const e=this.$i().Yc();this.Mm(t,Rs,ps,e),this.Mm(t,Rs,gs,e)}bm(t){this.Mm(t,Rs,gs,this.$i().Zc())}fm(t,e){const i=_(this.Np).Uo();for(const s of i)this.Mm(t,e,ps,s);for(const s of i)this.Mm(t,e,gs,s)}Mm(t,e,i,s){const n=_(this.Np),r=n.$t().Wc(),o=null!==r&&r.Hc===s,h=null!==r&&o&&void 0!==r.Iv?r.Iv.Mr:void 0;vs(e,e=>i(e,t,o,h),s,n)}Zp(){if(null===this.Np)return;const t=this.Qd,e=this.Np.R_().W().visible,i=this.Np.D_().W().visible;e||null===this.Cp||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),i||null===this.Tp||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const s=t.$t().ud();e&&null===this.Cp&&(this.Cp=new ks(this,t.W(),s,"left"),this.jp.appendChild(this.Cp.lp())),i&&null===this.Tp&&(this.Tp=new ks(this,t.W(),s,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(t){return t.Dv&&this.Ap||null!==this.Ip}Sm(t){return Math.max(0,Math.min(t,this.Ev.width-1))}km(t){return Math.max(0,Math.min(t,this.Ev.height-1))}Gp(t,e,i){this.$i().ld(this.Sm(t),this.km(e),i,_(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(t,e,i){this.Ip=t,this.zp=!1,this.Gp(e.x,e.y,i);const s=this.$i().Zc();this.Lp={x:s.Yt(),y:s.Zt()}}$i(){return this.Qd.$t()}sm(t){if(!this.Dp)return;const e=this.$i(),i=this.fp();if(e.z_(i,i.vn()),this.Rp=null,this.Dp=!1,e.ed(),null!==this.Ep){const t=performance.now(),i=e.St();this.Ep.Vr(i.Hu(),t),this.Ep.Qu(t)||e.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)_(document.activeElement).blur();else{const t=document.getSelection();null!==t&&t.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(t){if(null===this.Np)return;const e=this.$i(),i=e.St();if(i.Ni())return;const s=this.Qd.W(),n=s.handleScroll,r=s.kineticScroll;if((!n.pressedMouseMove||t.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!t.Dv))return;const o=this.Np.vn(),h=performance.now();if(null!==this.Rp||this.xm(t)||(this.Rp={x:t.clientX,y:t.clientY,Od:h,ym:t.localX,Cm:t.localY}),null!==this.Rp&&!this.Dp&&(this.Rp.x!==t.clientX||this.Rp.y!==t.clientY)){if(t.Dv&&r.touch||!t.Dv&&r.mouse){const t=i.le();this.Ep=new us(.2/t,7/t,.997,15/t),this.Ep.Yd(i.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||e.A_(this.Np,o,t.localY),e.nd(t.localX),this.Dp=!0}this.Dp&&(o.Ni()||e.I_(this.Np,o,t.localY),e.sd(t.localX),null!==this.Ep&&this.Ep.Yd(i.Hu(),h))}}class Ps{constructor(t,e,i,s,r){this.ft=!0,this.Ev=n({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv="left"===t,this.Oc=i.ud,this.cn=e,this.Tm=s,this.Pm=r,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=fs(this.Kv,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(t){r(this.Ev,t)||(this.Ev=t,this.Gv.resizeCanvasElement(t),this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`,this.ft=!0)}vp(t){if(t<3&&!this.ft)return;if(0===this.Ev.width||0===this.Ev.height)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const e=c(this.Gv);null!==e&&e.useBitmapCoordinateSpace(t=>{this.mp(t),this.Ie(t)})}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}Ie({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(!this.Tm())return;t.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*i),r=Math.floor(this.Oc.W().C*s),o=this.qv?e.width-n:0;t.fillRect(o,0,n,r)}mp({context:t,bitmapSize:e}){rt(t,0,0,e.width,e.height,this.Pm())}}function $s(t){return e=>{var i,s;return null!==(s=null===(i=e.fa)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:[]}}const Vs=$s("normal"),Ds=$s("top"),Bs=$s("bottom");class Fs{constructor(t,e){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=n({width:0,height:0}),this.Om=new B,this.Fv=new ae(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=t,this.q_=e,this.cn=t.W().layout,this.Xd=document.createElement("tr"),this.Bm=document.createElement("td"),this.Bm.style.padding="0",this.Am=document.createElement("td"),this.Am.style.padding="0",this.Kv=document.createElement("td"),this.Kv.style.height="25px",this.Kv.style.padding="0",this.Im=document.createElement("div"),this.Im.style.width="100%",this.Im.style.height="100%",this.Im.style.position="relative",this.Im.style.overflow="hidden",this.Kv.appendChild(this.Im),this.Gv=fs(this.Im,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const i=this.Gv.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jv=fs(this.Im,n({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const s=this.Jv.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.Xd.appendChild(this.Bm),this.Xd.appendChild(this.Kv),this.Xd.appendChild(this.Am),this.zm(),this.Qd.$t().g_().l(this.zm.bind(this),this),this.hp=new bs(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),null!==this.Rm&&this.Rm.S(),null!==this.Dm&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),ms(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(t){if(this.Vm)return;this.Vm=!0;const e=this.Qd.$t();!e.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&e.Jc(t.localX)}pv(t){this.bv(t)}wv(){const t=this.Qd.$t();!t.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&t.hd())}av(t){const e=this.Qd.$t();!e.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&e.rd(t.localX)}hv(t){this.av(t)}cv(){this.Vm=!1;const t=this.Qd.$t();t.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||t.hd()}_v(){this.cv()}qf(){this.Qd.W().handleScale.axisDoubleClickReset.time&&this.Qd.$t().Kn()}jf(){this.qf()}Qf(){this.Qd.$t().W().handleScale.axisPressedMouseMove.time&&this.kp(1)}Pv(){this.kp(0)}um(){return this.Ev}Nm(){return this.Om}Fm(t,e,i){r(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`,this.Om.m(t)),null!==this.Rm&&this.Rm.cp(n({width:e,height:t.height})),null!==this.Dm&&this.Dm.cp(n({width:i,height:t.height}))}Wm(){const t=this.jm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}vp(t){if(0===t)return;if(1!==t){this.Gv.applySuggestedBitmapSize();const e=c(this.Gv);null!==e&&(e.useBitmapCoordinateSpace(t=>{this.mp(t),this.Ie(t),this.$m(e,Bs)}),this.wp(e),this.$m(e,Vs)),null!==this.Rm&&this.Rm.vp(t),null!==this.Dm&&this.Dm.vp(t)}this.Jv.applySuggestedBitmapSize();const e=c(this.Jv);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:e})=>{t.clearRect(0,0,e.width,e.height)}),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],e),this.$m(e,Ds))}$m(t,e){const i=this.Qd.$t().wt();for(const s of i)vs(e,e=>ps(e,t,!1,void 0),s,void 0);for(const s of i)vs(e,e=>gs(e,t,!1,void 0),s,void 0)}mp({context:t,bitmapSize:e}){rt(t,0,0,e.width,e.height,this.Qd.$t().bd())}Ie({context:t,bitmapSize:e,verticalPixelRatio:i}){if(this.Qd.W().timeScale.borderVisible){t.fillStyle=this.qm();const s=Math.max(1,Math.floor(this.jm().C*i));t.fillRect(0,0,e.width,s)}}wp(t){const e=this.Qd.$t().St(),i=e.Ha();if(!i||0===i.length)return;const s=this.q_.maxTickMarkWeight(i),n=this.jm(),r=e.W();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:e,verticalPixelRatio:s})=>{t.strokeStyle=this.qm(),t.fillStyle=this.qm();const r=Math.max(1,Math.floor(e)),o=Math.floor(.5*e);t.beginPath();const h=Math.round(n.T*s);for(let s=i.length;s--;){const n=Math.round(i[s].coord*e);t.rect(n-o,0,r,h)}t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{const e=n.C+n.T+n.L+n.P/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.$(),t.font=this._p();for(const n of i)if(n.weight<s){const i=n.needAlignCoordinate?this.Ym(t,n.coord,n.label):n.coord;t.fillText(n.label,i,e)}this.Qd.W().timeScale.allowBoldLabels&&(t.font=this.Zm());for(const n of i)if(n.weight>=s){const i=n.needAlignCoordinate?this.Ym(t,n.coord,n.label):n.coord;t.fillText(n.label,i,e)}})}Ym(t,e,i){const s=this.Fv.xi(t,i),n=s/2,r=Math.floor(e-n)+.5;return r<0?e+=Math.abs(0-r):r+s>this.Ev.width&&(e-=Math.abs(this.Ev.width-(r+s))),e}Um(t,e){const i=this.jm();for(const s of t)for(const t of s.Qi())t.gt().X(e,i)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return X(this.j(),this.cn.fontFamily)}Zm(){return X(this.j(),this.cn.fontFamily,"bold")}jm(){null===this.k&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new ae,Hm:0});const t=this.k,e=this._p();if(t.R!==e){const i=this.j();t.P=i,t.R=e,t.L=3*i/12,t.B=3*i/12,t.ji=9*i/12,t.N=0,t.Hm=4*i/12,t.Wi.nr()}return this.k}kp(t){this.Kv.style.cursor=1===t?"ew-resize":"default"}zm(){const t=this.Qd.$t(),e=t.W();e.leftPriceScale.visible||null===this.Rm||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),e.rightPriceScale.visible||null===this.Dm||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const i={ud:this.Qd.$t().ud()},s=()=>e.leftPriceScale.borderVisible&&t.St().W().borderVisible,n=()=>t.bd();e.leftPriceScale.visible&&null===this.Rm&&(this.Rm=new Ps("left",e,i,s,n),this.Bm.appendChild(this.Rm.lp())),e.rightPriceScale.visible&&null===this.Dm&&(this.Dm=new Ps("right",e,i,s,n),this.Am.appendChild(this.Dm.lp()))}}const As=!!rs&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!rs&&((null===(Ws=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===Ws?void 0:Ws.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var Ws;class js{constructor(t,e,i){var s;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new B,this.Op=new B,this.Rc=new B,this.ib=null,this.nb=null,this.Jd=t,this.cn=e,this.q_=i,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(s=this.Xd).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Is(this.cn)&&this.hb(!0),this.$i=new ji(this.Vc.bind(this),this.cn,i),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new Fs(this,this.q_),this.sb.appendChild(this.ab.lp());const n=e.autoSize&&this.ob();let r=this.cn.width,o=this.cn.height;if(n||0===r||0===o){const e=t.getBoundingClientRect();r=r||e.width,o=o||e.height}this._b(r,o),this.ub(),t.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),0!==this.Km&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const t of this.Xm)this.sb.removeChild(t.lp()),t.lm().p(this),t.am().p(this),t.S();this.Xm=[],_(this.ab).S(),null!==this.Xd.parentElement&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(t,e,i=!1){if(this.ho===e&&this.__===t)return;const s=function(t){const e=Math.floor(t.width),i=Math.floor(t.height);return n({width:e-e%2,height:i-i%2})}(n({width:t,height:e}));this.ho=s.height,this.__=s.width;const r=this.ho+"px",o=this.__+"px";_(this.Xd).style.height=r,_(this.Xd).style.width=o,this.sb.style.height=r,this.sb.style.width=o,i?this.mb(wt.es(),performance.now()):this.$i.Kl()}vp(t){void 0===t&&(t=wt.es());for(let e=0;e<this.Xm.length;e++)this.Xm[e].vp(t.Hn(e).Fn);this.cn.timeScale.visible&&this.ab.vp(t.jn())}$h(t){const e=Is(this.cn);this.$i.$h(t);const i=Is(this.cn);i!==e&&this.hb(i),this.cb(),this.bb(t)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){null!==this.Qm&&(this.mb(this.Qm,performance.now()),this.Qm=null);const t=this.gb(null),e=document.createElement("canvas");e.width=t.width,e.height=t.height;const i=_(e.getContext("2d"));return this.gb(i),e}Mb(t){return("left"!==t||this.xb())&&("right"!==t||this.Sb())?0===this.Xm.length?0:_("left"===t?this.Xm[0].wm():this.Xm[0].gm()).dp():0}kb(){return this.cn.autoSize&&null!==this.ib}yb(){return this.Xd}Qp(t){this.nb=t,this.nb?this.yb().style.setProperty("cursor",t):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return E(this.Xm[0]).um()}bb(t){(void 0!==t.autoSize||!this.ib||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.ib&&this.ob(),!1===t.autoSize&&null!==this.ib&&this.pb(),t.autoSize||void 0===t.width&&void 0===t.height||this._b(t.width||this.__,t.height||this.ho))}gb(t){let e=0,i=0;const s=this.Xm[0],r=(e,i)=>{let s=0;for(let n=0;n<this.Xm.length;n++){const r=this.Xm[n],o=_("left"===e?r.wm():r.gm()),h=o.xp();null!==t&&o.Sp(t,i,s),s+=h.height}};this.xb()&&(r("left",0),e+=_(s.wm()).xp().width);for(let s=0;s<this.Xm.length;s++){const n=this.Xm[s],r=n.xp();null!==t&&n.Sp(t,e,i),i+=r.height}e+=s.xp().width,this.Sb()&&(r("right",e),e+=_(s.gm()).xp().width);const o=(e,i,s)=>{_("left"===e?this.ab.Lm():this.ab.Em()).Sp(_(t),i,s)};if(this.cn.timeScale.visible){const e=this.ab.xp();if(null!==t){let n=0;this.xb()&&(o("left",n,i),n=_(s.wm()).xp().width),this.ab.Sp(t,n,i),n+=e.width,this.Sb()&&o("right",n,i)}i+=e.height}return n({width:e,height:i})}Pb(){let t=0,e=0,i=0;for(const s of this.Xm)this.xb()&&(e=Math.max(e,_(s.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(i=Math.max(i,_(s.gm()).op(),this.cn.rightPriceScale.minimumWidth)),t+=s.M_();e=ls(e),i=ls(i);const s=this.__,r=this.ho,o=Math.max(s-e-i,0),h=this.cn.timeScale.visible;let l=h?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var a;l=(a=l)+a%2;const c=0+l,u=r<c?0:r-c,d=u/t;let f=0;for(let t=0;t<this.Xm.length;++t){const s=this.Xm[t];s.qp(this.$i.qc()[t]);let r=0,h=0;h=t===this.Xm.length-1?u-f:Math.round(s.M_()*d),r=Math.max(h,2),f+=r,s.cp(n({width:o,height:r})),this.xb()&&s._m(e,"left"),this.Sb()&&s._m(i,"right"),s.fp()&&this.$i.Kc(s.fp(),r)}this.ab.Fm(n({width:h?o:0,height:l}),h?e:0,h?i:0),this.$i.S_(o),this.Gm!==e&&(this.Gm=e),this.Jm!==i&&(this.Jm=i)}hb(t){t?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return As?1/window.devicePixelRatio:1}rb(t){if(!(0!==t.deltaX&&this.cn.handleScroll.mouseWheel||0!==t.deltaY&&this.cn.handleScale.mouseWheel))return;const e=this.Rb(t),i=e*t.deltaX/100,s=-e*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.cn.handleScale.mouseWheel){const e=Math.sign(s)*Math.min(1,Math.abs(s)),i=t.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(i,e)}0!==i&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*i)}mb(t,e){var i;const s=t.jn();3===s&&this.Db(),3!==s&&2!==s||(this.Vb(t),this.Ob(t,e),this.ab.bt(),this.Xm.forEach(t=>{t.Xp()}),3===(null===(i=this.Qm)||void 0===i?void 0:i.jn())&&(this.Qm.ts(t),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,e),t=this.Qm,this.Qm=null)),this.vp(t)}Ob(t,e){for(const i of t.Qn())this.ns(i,e)}Vb(t){const e=this.$i.qc();for(let i=0;i<e.length;i++)t.Hn(i).Wn&&e[i].N_()}ns(t,e){const i=this.$i.St();switch(t.qn){case 0:i.hc();break;case 1:i.lc(t.Vt);break;case 2:i.Gn(t.Vt);break;case 3:i.Jn(t.Vt);break;case 4:i.qu();break;case 5:t.Vt.Qu(e)||i.Jn(t.Vt.tc(e))}}Vc(t){null!==this.Qm?this.Qm.ts(t):this.Qm=t,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame(t=>{if(this.tb=!1,this.Km=0,null!==this.Qm){const e=this.Qm;this.Qm=null,this.mb(e,t);for(const i of e.Qn())if(5===i.qn&&!i.Vt.Qu(t)){this.$t().Zn(i.Vt);break}}}))}Db(){this.ub()}ub(){const t=this.$i.qc(),e=t.length,i=this.Xm.length;for(let t=e;t<i;t++){const t=E(this.Xm.pop());this.sb.removeChild(t.lp()),t.lm().p(this),t.am().p(this),t.S()}for(let s=i;s<e;s++){const e=new Os(this,t[s]);e.lm().l(this.Bb.bind(this),this),e.am().l(this.Ab.bind(this),this),this.Xm.push(e),this.sb.insertBefore(e.lp(),this.ab.lp())}for(let i=0;i<e;i++){const e=t[i],s=this.Xm[i];s.fp()!==e?s.qp(e):s.Up()}this.cb(),this.Pb()}Ib(t,e,i){var s;const n=new Map;let r;if(null!==t&&this.$i.wt().forEach(e=>{const i=e.In().ll(t);null!==i&&n.set(e,i)}),null!==t){const e=null===(s=this.$i.St().Ui(t))||void 0===s?void 0:s.originalTime;void 0!==e&&(r=e)}const o=this.$t().Wc(),h=null!==o&&o.Hc instanceof si?o.Hc:void 0,l=null!==o&&void 0!==o.Iv?o.Iv.gr:void 0;return{zb:r,ee:null!=t?t:void 0,Lb:null!=e?e:void 0,Eb:h,Nb:n,Fb:l,Wb:null!=i?i:void 0}}Bb(t,e,i){this.Vp.m(()=>this.Ib(t,e,i))}Ab(t,e,i){this.Op.m(()=>this.Ib(t,e,i))}lb(t,e,i){this.Rc.m(()=>this.Ib(t,e,i))}cb(){const t=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=t}xb(){return this.Xm[0].fp().R_().W().visible}Sb(){return this.Xm[0].fp().D_().W().visible}ob(){return"ResizeObserver"in window&&(this.ib=new ResizeObserver(t=>{const e=t.find(t=>t.target===this.Jd);e&&this._b(e.contentRect.width,e.contentRect.height)}),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){null!==this.ib&&this.ib.disconnect(),this.ib=null}}function Is(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Us(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i}function Hs(t,e,i,s){const n=i.value,r={ee:e,ot:t,Vt:[n,n,n,n],zb:s};return void 0!==i.color&&(r.V=i.color),r}function Ks(t,e,i,s){const n=i.value,r={ee:e,ot:t,Vt:[n,n,n,n],zb:s};return void 0!==i.lineColor&&(r.lt=i.lineColor),void 0!==i.topColor&&(r.Ps=i.topColor),void 0!==i.bottomColor&&(r.Rs=i.bottomColor),r}function qs(t,e,i,s){const n=i.value,r={ee:e,ot:t,Vt:[n,n,n,n],zb:s};return void 0!==i.topLineColor&&(r.Re=i.topLineColor),void 0!==i.bottomLineColor&&(r.De=i.bottomLineColor),void 0!==i.topFillColor1&&(r.ke=i.topFillColor1),void 0!==i.topFillColor2&&(r.ye=i.topFillColor2),void 0!==i.bottomFillColor1&&(r.Ce=i.bottomFillColor1),void 0!==i.bottomFillColor2&&(r.Te=i.bottomFillColor2),r}function Xs(t,e,i,s){const n={ee:e,ot:t,Vt:[i.open,i.high,i.low,i.close],zb:s};return void 0!==i.color&&(n.V=i.color),n}function Gs(t,e,i,s){const n={ee:e,ot:t,Vt:[i.open,i.high,i.low,i.close],zb:s};return void 0!==i.color&&(n.V=i.color),void 0!==i.borderColor&&(n.Ot=i.borderColor),void 0!==i.wickColor&&(n.Xh=i.wickColor),n}function Js(t,e,i,s,n){const r=E(n)(i),o=Math.max(...r),h=Math.min(...r),l=r[r.length-1],a=[l,o,h,l],c=i,{time:u,color:d}=c;return{ee:e,ot:t,Vt:a,zb:s,$e:Us(c,["time","color"]),V:d}}function Qs(t){return void 0!==t.Vt}function Ys(t,e){return void 0!==e.customValues&&(t.jb=e.customValues),t}function Zs(t){return(e,i,s,n,r,o)=>function(t,e){return e?e(t):void 0===(i=t).open&&void 0===i.value;var i}(s,o)?Ys({ot:e,ee:i,zb:n},s):Ys(t(e,i,s,n,r),s)}function tn(t){return{Candlestick:Zs(Gs),Bar:Zs(Xs),Area:Zs(Ks),Baseline:Zs(qs),Histogram:Zs(Hs),Line:Zs(Hs),Custom:Zs(Js)}[t]}function en(t){return{ee:0,Hb:new Map,la:t}}function sn(t,e){if(void 0!==t&&0!==t.length)return{$b:e.key(t[0].ot),Ub:e.key(t[t.length-1].ot)}}function nn(t){let e;return t.forEach(t=>{void 0===e&&(e=t.zb)}),E(e)}class rn{constructor(t){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=t}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(t,e){let i=0!==this.qb.size,s=!1;const n=this.Yb.get(t);if(void 0!==n)if(1===this.Yb.size)i=!1,s=!0,this.qb.clear();else for(const e of this.Xb)e.pointData.Hb.delete(t)&&(s=!0);let r=[];if(0!==e.length){const i=e.map(t=>t.time),n=this.q_.createConverterToInternalObj(e),o=tn(t.Qh()),h=t.Ca(),l=t.Ta();r=e.map((e,r)=>{const a=n(e.time),c=this.q_.key(a);let u=this.qb.get(c);void 0===u&&(u=en(a),this.qb.set(c,u),s=!0);const d=o(a,u.ee,e,i[r],h,l);return u.Hb.set(t,d),d})}i&&this.Gb(),this.Jb(t,r);let o=-1;if(s){const t=[];this.qb.forEach(e=>{t.push({timeWeight:0,time:e.la,pointData:e,originalTime:nn(e.Hb)})}),t.sort((t,e)=>this.q_.key(t.time)-this.q_.key(e.time)),o=this.Qb(t)}return this.tw(t,o,function(t,e,i){const s=sn(t,i),n=sn(e,i);if(void 0!==s&&void 0!==n)return{ta:s.Ub>=n.Ub&&s.$b>=n.$b}}(this.Yb.get(t),n,this.q_))}vd(t){return this.Kb(t,[])}iw(t,e){const i=e;!function(t){void 0===t.zb&&(t.zb=t.time)}(i),this.q_.preprocessData(e);const s=this.q_.createConverterToInternalObj([e])(e.time),n=this.Zb.get(t);if(void 0!==n&&this.q_.key(s)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${s}`);let r=this.qb.get(this.q_.key(s));const o=void 0===r;void 0===r&&(r=en(s),this.qb.set(this.q_.key(s),r));const h=tn(t.Qh()),l=t.Ca(),a=t.Ta(),c=h(s,r.ee,e,i.zb,l,a);r.Hb.set(t,c),this.nw(t,c);const u={ta:Qs(c)};if(!o)return this.tw(t,-1,u);const d={timeWeight:0,time:r.la,pointData:r,originalTime:nn(r.Hb)},f=At(this.Xb,this.q_.key(d.time),(t,e)=>this.q_.key(t.time)<e);this.Xb.splice(f,0,d);for(let t=f;t<this.Xb.length;++t)on(this.Xb[t].pointData,t);return this.q_.fillWeightsForPoints(this.Xb,f),this.tw(t,f,u)}nw(t,e){let i=this.Yb.get(t);void 0===i&&(i=[],this.Yb.set(t,i));const s=0!==i.length?i[i.length-1]:null;null===s||this.q_.key(e.ot)>this.q_.key(s.ot)?Qs(e)&&i.push(e):Qs(e)?i[i.length-1]=e:i.splice(-1,1),this.Zb.set(t,e.ot)}Jb(t,e){0!==e.length?(this.Yb.set(t,e.filter(Qs)),this.Zb.set(t,e[e.length-1].ot)):(this.Yb.delete(t),this.Zb.delete(t))}Gb(){for(const t of this.Xb)0===t.pointData.Hb.size&&this.qb.delete(this.q_.key(t.time))}Qb(t){let e=-1;for(let i=0;i<this.Xb.length&&i<t.length;++i){const s=this.Xb[i],n=t[i];if(this.q_.key(s.time)!==this.q_.key(n.time)){e=i;break}n.timeWeight=s.timeWeight,on(n.pointData,i)}if(-1===e&&this.Xb.length!==t.length&&(e=Math.min(this.Xb.length,t.length)),-1===e)return-1;for(let i=e;i<t.length;++i)on(t[i].pointData,i);return this.q_.fillWeightsForPoints(t,e),this.Xb=t,e}sw(){if(0===this.Yb.size)return null;let t=0;return this.Yb.forEach(e=>{0!==e.length&&(t=Math.max(t,e[e.length-1].ee))}),t}tw(t,e,i){const s={ew:new Map,St:{Eu:this.sw()}};if(-1!==e)this.Yb.forEach((e,n)=>{s.ew.set(n,{$e:e,rw:n===t?i:void 0})}),this.Yb.has(t)||s.ew.set(t,{$e:[],rw:i}),s.St.hw=this.Xb,s.St.lw=e;else{const e=this.Yb.get(t);s.ew.set(t,{$e:e||[],rw:i})}return s}}function on(t,e){t.ee=e,t.Hb.forEach(t=>{t.ee=e})}function hn(t){const e={value:t.Vt[3],time:t.zb};return void 0!==t.jb&&(e.customValues=t.jb),e}function ln(t){const e=hn(t);return void 0!==t.V&&(e.color=t.V),e}function an(t){const e=hn(t);return void 0!==t.lt&&(e.lineColor=t.lt),void 0!==t.Ps&&(e.topColor=t.Ps),void 0!==t.Rs&&(e.bottomColor=t.Rs),e}function cn(t){const e=hn(t);return void 0!==t.Re&&(e.topLineColor=t.Re),void 0!==t.De&&(e.bottomLineColor=t.De),void 0!==t.ke&&(e.topFillColor1=t.ke),void 0!==t.ye&&(e.topFillColor2=t.ye),void 0!==t.Ce&&(e.bottomFillColor1=t.Ce),void 0!==t.Te&&(e.bottomFillColor2=t.Te),e}function un(t){const e={open:t.Vt[0],high:t.Vt[1],low:t.Vt[2],close:t.Vt[3],time:t.zb};return void 0!==t.jb&&(e.customValues=t.jb),e}function dn(t){const e=un(t);return void 0!==t.V&&(e.color=t.V),e}function fn(t){const e=un(t),{V:i,Ot:s,Xh:n}=t;return void 0!==i&&(e.color=i),void 0!==s&&(e.borderColor=s),void 0!==n&&(e.wickColor=n),e}function mn(t){return{Area:an,Line:ln,Baseline:cn,Histogram:ln,Bar:dn,Candlestick:fn,Custom:pn}[t]}function pn(t){const e=t.zb;return Object.assign(Object.assign({},t.$e),{time:e})}const gn={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},vn={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},bn={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:q,attributionLogo:!0},wn={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},yn={rightOffset:0,barSpacing:6,minBarSpacing:.5,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},Sn={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:q,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Cn(){return{width:0,height:0,autoSize:!1,layout:bn,crosshair:gn,grid:vn,overlayPriceScales:Object.assign({},wn),leftPriceScale:Object.assign(Object.assign({},wn),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},wn),{visible:!0}),timeScale:yn,watermark:Sn,localization:{locale:rs?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 Mn{constructor(t,e){this.aw=t,this.ow=e}applyOptions(t){this.aw.$t().$c(this.ow,t)}options(){return this.Li().W()}width(){return bt(this.ow)?this.aw.Mb(this.ow):0}Li(){return _(this.aw.$t().Uc(this.ow)).Dt}}function xn(t,e,i){const s=Us(t,["time","originalTime"]),n=Object.assign({time:e},s);return void 0!==i&&(n.originalTime=i),n}const En={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class _n{constructor(t){this.Nh=t}applyOptions(t){this.Nh.$h(t)}options(){return this.Nh.W()}_w(){return this.Nh}}class zn{constructor(t,e,i,s,n){this.uw=new B,this.Es=t,this.cw=e,this.dw=i,this.q_=n,this.fw=s}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(t){const e=this.Es.Ct();return null===e?null:this.Es.Dt().Rt(t,e.Vt)}coordinateToPrice(t){const e=this.Es.Ct();return null===e?null:this.Es.Dt().pn(t,e.Vt)}barsInLogicalRange(t){if(null===t)return null;const e=new Ri(new zi(t.from,t.to)).lu(),i=this.Es.In();if(i.Ni())return null;const s=i.ll(e.Os(),1),n=i.ll(e.ui(),-1),r=_(i.el()),o=_(i.An());if(null!==s&&null!==n&&s.ee>n.ee)return{barsBefore:t.from-r,barsAfter:o-t.to};const h={barsBefore:null===s||s.ee===r?t.from-r:s.ee-r,barsAfter:null===n||n.ee===o?o-t.to:o-n.ee};return null!==s&&null!==n&&(h.from=s.zb,h.to=n.zb),h}setData(t){this.q_,this.Es.Qh(),this.cw.pw(this.Es,t),this.mw("full")}update(t){this.Es.Qh(),this.cw.bw(this.Es,t),this.mw("update")}dataByIndex(t,e){const i=this.Es.In().ll(t,e);return null===i?null:mn(this.seriesType())(i)}data(){const t=mn(this.seriesType());return this.Es.In().ne().map(e=>t(e))}subscribeDataChanged(t){this.uw.l(t)}unsubscribeDataChanged(t){this.uw.v(t)}setMarkers(t){this.q_;const e=t.map(t=>xn(t,this.q_.convertHorzItemToInternal(t.time),t.time));this.Es.na(e)}markers(){return this.Es.sa().map(t=>xn(t,t.originalTime,void 0))}applyOptions(t){this.Es.$h(t)}options(){return U(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(t){const e=F(U(En),t),i=this.Es.ea(e);return new _n(i)}removePriceLine(t){this.Es.ra(t._w())}seriesType(){return this.Es.Qh()}attachPrimitive(t){this.Es.ka(t),t.attached&&t.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(t){this.Es.ya(t),t.detached&&t.detached()}mw(t){this.uw.M()&&this.uw.m(t)}}class kn{constructor(t,e,i){this.ww=new B,this.mu=new B,this.Om=new B,this.$i=t,this.yl=t.St(),this.ab=e,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=i}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(t,e){e?this.yl.Ju(t,1e3):this.$i.Jn(t)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const t=this.yl.Vu();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const e={from:this.q_.convertHorzItemToInternal(t.from),to:this.q_.convertHorzItemToInternal(t.to)},i=this.yl.Iu(e);this.$i.pd(i)}getVisibleLogicalRange(){const t=this.yl.Du();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){x(t.from<=t.to,"The from index cannot be after the to index."),this.$i.pd(t)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(t){const e=this.$i.St();return e.Ni()?null:e.It(t)}coordinateToLogical(t){return this.yl.Ni()?null:this.yl.Nu(t)}timeToCoordinate(t){const e=this.q_.convertHorzItemToInternal(t),i=this.yl.Va(e,!1);return null===i?null:this.yl.It(i)}coordinateToTime(t){const e=this.$i.St(),i=e.Nu(t),s=e.Ui(i);return null===s?null:s.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(t){this.ww.l(t)}unsubscribeVisibleTimeRangeChange(t){this.ww.v(t)}subscribeVisibleLogicalRangeChange(t){this.mu.l(t)}unsubscribeVisibleLogicalRangeChange(t){this.mu.v(t)}subscribeSizeChange(t){this.Om.l(t)}unsubscribeSizeChange(t){this.Om.v(t)}applyOptions(t){this.yl.$h(t)}options(){return Object.assign(Object.assign({},U(this.yl.W())),{barSpacing:this.yl.le()})}gw(){this.ww.M()&&this.ww.m(this.getVisibleRange())}Mw(){this.mu.M()&&this.mu.m(this.getVisibleLogicalRange())}xw(t){this.Om.m(t.width,t.height)}}function Tn(t){return function(t){if(I(t.handleScale)){const e=t.handleScale;t.handleScale={axisDoubleClickReset:{time:e,price:e},axisPressedMouseMove:{time:e,price:e},mouseWheel:e,pinch:e}}else if(void 0!==t.handleScale){const{axisPressedMouseMove:e,axisDoubleClickReset:i}=t.handleScale;I(e)&&(t.handleScale.axisPressedMouseMove={time:e,price:e}),I(i)&&(t.handleScale.axisDoubleClickReset={time:i,price:i})}const e=t.handleScroll;I(e)&&(t.handleScroll={horzTouchDrag:e,vertTouchDrag:e,mouseWheel:e,pressedMouseMove:e})}(t),t}class Rn{constructor(t,e,i){this.Sw=new Map,this.kw=new Map,this.yw=new B,this.Cw=new B,this.Tw=new B,this.Pw=new rn(e);const s=void 0===i?U(Cn()):F(U(Cn()),Tn(i));this.q_=e,this.aw=new js(t,s,e),this.aw.lm().l(t=>{this.yw.M()&&this.yw.m(this.Rw(t()))},this),this.aw.am().l(t=>{this.Cw.M()&&this.Cw.m(this.Rw(t()))},this),this.aw.Xc().l(t=>{this.Tw.M()&&this.Tw.m(this.Rw(t()))},this);const n=this.aw.$t();this.Dw=new kn(n,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(t,e,i){this.autoSizeActive()||this.aw._b(t,e,i)}addCustomSeries(t,e){const i=z(t),s=Object.assign(Object.assign({},v),i.defaultOptions());return this.Vw("Custom",s,e,i)}addAreaSeries(t){return this.Vw("Area",m,t)}addBaselineSeries(t){return this.Vw("Baseline",p,t)}addBarSeries(t){return this.Vw("Bar",d,t)}addCandlestickSeries(t={}){return function(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}(t),this.Vw("Candlestick",u,t)}addHistogramSeries(t){return this.Vw("Histogram",g,t)}addLineSeries(t){return this.Vw("Line",f,t)}removeSeries(t){const e=E(this.Sw.get(t)),i=this.Pw.vd(e);this.aw.$t().vd(e),this.Ow(i),this.Sw.delete(t),this.kw.delete(e)}pw(t,e){this.Ow(this.Pw.Kb(t,e))}bw(t,e){this.Ow(this.Pw.iw(t,e))}subscribeClick(t){this.yw.l(t)}unsubscribeClick(t){this.yw.v(t)}subscribeCrosshairMove(t){this.Tw.l(t)}unsubscribeCrosshairMove(t){this.Tw.v(t)}subscribeDblClick(t){this.Cw.l(t)}unsubscribeDblClick(t){this.Cw.v(t)}priceScale(t){return new Mn(this.aw,t)}timeScale(){return this.Dw}applyOptions(t){this.aw.$h(Tn(t))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const t=this.aw.Tb();return{height:t.height,width:t.width}}setCrosshairPosition(t,e,i){const s=this.Sw.get(i);if(void 0===s)return;const n=this.aw.$t().dr(s);null!==n&&this.aw.$t().ad(t,e,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(t,e,i={},s){!function(t){if(void 0===t||"custom"===t.type)return;const e=t;void 0!==e.minMove&&void 0===e.precision&&(e.precision=function(t){if(t>=1)return 0;let e=0;for(;e<8;e++){const i=Math.round(t);if(Math.abs(i-t)<1e-8)return e;t*=10}return e}(e.minMove))}(i.priceFormat);const n=F(U(b),U(e),i),r=this.aw.$t().dd(t,n,s),o=new zn(r,this,this,this,this.q_);return this.Sw.set(o,r),this.kw.set(r,o),o}Ow(t){const e=this.aw.$t();e._d(t.St.Eu,t.St.hw,t.St.lw),t.ew.forEach((t,e)=>e.J(t.$e,t.rw)),e.Wu()}Bw(t){return E(this.kw.get(t))}Rw(t){const e=new Map;t.Nb.forEach((t,i)=>{const s=i.Qh(),n=mn(s)(t);if("Custom"!==s)x(function(t){return function(t){return void 0!==t.open}(t)||function(t){return void 0!==t.value}(t)}(n));else{const t=i.Ta();x(!t||!1===t(n))}e.set(this.Bw(i),n)});const i=void 0!==t.Eb&&this.kw.has(t.Eb)?this.Bw(t.Eb):void 0;return{time:t.zb,logical:t.ee,point:t.Lb,hoveredSeries:i,hoveredObjectId:t.Fb,seriesData:e,sourceEvent:t.Wb}}}function Nn(t,e){return function(t,e,i){let s;if(j(t)){const e=document.getElementById(t);x(null!==e,`Cannot find element in DOM with id=${t}`),s=e}else s=t;const n=new Rn(s,e,i);return e.setOptions(n.options()),n}(t,new ns,ns.Id(e))}Object.assign(Object.assign({},b),v);class Ln{constructor(t,e){this.chart=null,this.series=null,this.container=null,this.container=t,this.options=e}initialize(){if(!this.container)throw new Error("Chart container is not set");this.chart=Nn(this.container,{layout:{background:{color:"#ffffff"},textColor:"#333333"},grid:{vertLines:{color:"#f0f0f0"},horzLines:{color:"#f0f0f0"}},crosshair:{mode:gt.Normal},rightPriceScale:{borderColor:"#cccccc"},timeScale:{borderColor:"#cccccc",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:8,minBarSpacing:4},height:this.options.height||384,localization:{priceFormatter:this.options.formatPrice},watermark:{visible:!0,fontSize:64,horzAlign:"center",vertAlign:"center",color:"rgba(0, 0, 0, 0.03)",text:this.options.ticker?`${this.options.ticker}/SOL`:`${this.options.mint.substring(0,4)}...${this.options.mint.substring(this.options.mint.length-4)}/SOL`}}),this.series=this.chart.addCandlestickSeries({upColor:"#26a69a",downColor:"#ef5350",borderVisible:!0,borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickUpColor:"#26a69a",wickDownColor:"#ef5350"});const t=()=>{this.container&&this.chart&&this.chart.applyOptions({width:this.container.clientWidth})};window.addEventListener("resize",t),t()}updateData(t){if(!this.series)return;const e=t.filter(t=>t&&t.open>0&&t.high>0&&t.low>0&&t.close>0&&isFinite(t.open)&&isFinite(t.high)&&isFinite(t.low)&&isFinite(t.close));e.length>0&&(this.series.setData(e.map(t=>({...t,time:t.time}))),requestAnimationFrame(()=>{this.chart&&this.chart.timeScale().scrollToRealTime()}))}setTimeframe(t){}resize(){this.container&&this.chart&&this.chart.applyOptions({width:this.container.clientWidth})}destroy(){this.chart&&(this.chart.remove(),this.chart=null,this.series=null)}getChart(){return this.chart}getSeries(){return this.series}}function On(t,e){return function(){return t.apply(e,arguments)}}const{toString:Pn}=Object.prototype,{getPrototypeOf:$n}=Object,{iterator:Vn,toStringTag:Dn}=Symbol,Bn=(Fn=Object.create(null),t=>{const e=Pn.call(t);return Fn[e]||(Fn[e]=e.slice(8,-1).toLowerCase())});var Fn;const An=t=>(t=t.toLowerCase(),e=>Bn(e)===t),Wn=t=>e=>typeof e===t,{isArray:jn}=Array,In=Wn("undefined");function Un(t){return null!==t&&!In(t)&&null!==t.constructor&&!In(t.constructor)&&qn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Hn=An("ArrayBuffer");const Kn=Wn("string"),qn=Wn("function"),Xn=Wn("number"),Gn=t=>null!==t&&"object"==typeof t,Jn=t=>{if("object"!==Bn(t))return!1;const e=$n(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Dn in t||Vn in t)},Qn=An("Date"),Yn=An("File"),Zn=An("Blob"),tr=An("FileList"),er=An("URLSearchParams"),[ir,sr,nr,rr]=["ReadableStream","Request","Response","Headers"].map(An);function or(t,e,{allOwnKeys:i=!1}={}){if(null==t)return;let s,n;if("object"!=typeof t&&(t=[t]),jn(t))for(s=0,n=t.length;s<n;s++)e.call(null,t[s],s,t);else{if(Un(t))return;const n=i?Object.getOwnPropertyNames(t):Object.keys(t),r=n.length;let o;for(s=0;s<r;s++)o=n[s],e.call(null,t[o],o,t)}}function hr(t,e){if(Un(t))return null;e=e.toLowerCase();const i=Object.keys(t);let s,n=i.length;for(;n-- >0;)if(s=i[n],e===s.toLowerCase())return s;return null}const lr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ar=t=>!In(t)&&t!==lr;const cr=(ur="undefined"!=typeof Uint8Array&&$n(Uint8Array),t=>ur&&t instanceof ur);var ur;const dr=An("HTMLFormElement"),fr=(({hasOwnProperty:t})=>(e,i)=>t.call(e,i))(Object.prototype),mr=An("RegExp"),pr=(t,e)=>{const i=Object.getOwnPropertyDescriptors(t),s={};or(i,(i,n)=>{let r;!1!==(r=e(i,n,t))&&(s[n]=r||i)}),Object.defineProperties(t,s)};const gr=An("AsyncFunction"),vr=(br="function"==typeof setImmediate,wr=qn(lr.postMessage),br?setImmediate:wr?(yr=`axios@${Math.random()}`,Sr=[],lr.addEventListener("message",({source:t,data:e})=>{t===lr&&e===yr&&Sr.length&&Sr.shift()()},!1),t=>{Sr.push(t),lr.postMessage(yr,"*")}):t=>setTimeout(t));var br,wr,yr,Sr;const Cr="undefined"!=typeof queueMicrotask?queueMicrotask.bind(lr):"undefined"!=typeof process&&process.nextTick||vr;var Mr={isArray:jn,isArrayBuffer:Hn,isBuffer:Un,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||qn(t.append)&&("formdata"===(e=Bn(t))||"object"===e&&qn(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Hn(t.buffer),e},isString:Kn,isNumber:Xn,isBoolean:t=>!0===t||!1===t,isObject:Gn,isPlainObject:Jn,isEmptyObject:t=>{if(!Gn(t)||Un(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:ir,isRequest:sr,isResponse:nr,isHeaders:rr,isUndefined:In,isDate:Qn,isFile:Yn,isBlob:Zn,isRegExp:mr,isFunction:qn,isStream:t=>Gn(t)&&qn(t.pipe),isURLSearchParams:er,isTypedArray:cr,isFileList:tr,forEach:or,merge:function t(){const{caseless:e,skipUndefined:i}=ar(this)&&this||{},s={},n=(n,r)=>{const o=e&&hr(s,r)||r;Jn(s[o])&&Jn(n)?s[o]=t(s[o],n):Jn(n)?s[o]=t({},n):jn(n)?s[o]=n.slice():i&&In(n)||(s[o]=n)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&or(arguments[t],n);return s},extend:(t,e,i,{allOwnKeys:s}={})=>(or(e,(e,s)=>{i&&qn(e)?t[s]=On(e,i):t[s]=e},{allOwnKeys:s}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,i,s)=>{t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),i&&Object.assign(t.prototype,i)},toFlatObject:(t,e,i,s)=>{let n,r,o;const h={};if(e=e||{},null==t)return e;do{for(n=Object.getOwnPropertyNames(t),r=n.length;r-- >0;)o=n[r],s&&!s(o,t,e)||h[o]||(e[o]=t[o],h[o]=!0);t=!1!==i&&$n(t)}while(t&&(!i||i(t,e))&&t!==Object.prototype);return e},kindOf:Bn,kindOfTest:An,endsWith:(t,e,i)=>{t=String(t),(void 0===i||i>t.length)&&(i=t.length),i-=e.length;const s=t.indexOf(e,i);return-1!==s&&s===i},toArray:t=>{if(!t)return null;if(jn(t))return t;let e=t.length;if(!Xn(e))return null;const i=new Array(e);for(;e-- >0;)i[e]=t[e];return i},forEachEntry:(t,e)=>{const i=(t&&t[Vn]).call(t);let s;for(;(s=i.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},matchAll:(t,e)=>{let i;const s=[];for(;null!==(i=t.exec(e));)s.push(i);return s},isHTMLForm:dr,hasOwnProperty:fr,hasOwnProp:fr,reduceDescriptors:pr,freezeMethods:t=>{pr(t,(e,i)=>{if(qn(t)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const s=t[i];qn(s)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))})},toObjectSet:(t,e)=>{const i={},s=t=>{t.forEach(t=>{i[t]=!0})};return jn(t)?s(t):s(String(t).split(e)),i},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,i){return e.toUpperCase()+i}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:hr,global:lr,isContextDefined:ar,isSpecCompliantForm:function(t){return!!(t&&qn(t.append)&&"FormData"===t[Dn]&&t[Vn])},toJSONObject:t=>{const e=new Array(10),i=(t,s)=>{if(Gn(t)){if(e.indexOf(t)>=0)return;if(Un(t))return t;if(!("toJSON"in t)){e[s]=t;const n=jn(t)?[]:{};return or(t,(t,e)=>{const r=i(t,s+1);!In(r)&&(n[e]=r)}),e[s]=void 0,n}}return t};return i(t,0)},isAsyncFn:gr,isThenable:t=>t&&(Gn(t)||qn(t))&&qn(t.then)&&qn(t.catch),setImmediate:vr,asap:Cr,isIterable:t=>null!=t&&qn(t[Vn])};function xr(t,e,i,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),i&&(this.config=i),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}Mr.inherits(xr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Mr.toJSONObject(this.config),code:this.code,status:this.status}}});const Er=xr.prototype,_r={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{_r[t]={value:t}}),Object.defineProperties(xr,_r),Object.defineProperty(Er,"isAxiosError",{value:!0}),xr.from=(t,e,i,s,n,r)=>{const o=Object.create(Er);Mr.toFlatObject(t,o,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t);const h=t&&t.message?t.message:"Error",l=null==e&&t?t.code:e;return xr.call(o,h,l,i,s,n),t&&null==o.cause&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",r&&Object.assign(o,r),o};function zr(t){return Mr.isPlainObject(t)||Mr.isArray(t)}function kr(t){return Mr.endsWith(t,"[]")?t.slice(0,-2):t}function Tr(t,e,i){return t?t.concat(e).map(function(t,e){return t=kr(t),!i&&e?"["+t+"]":t}).join(i?".":""):e}const Rr=Mr.toFlatObject(Mr,{},null,function(t){return/^is[A-Z]/.test(t)});function Nr(t,e,i){if(!Mr.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const s=(i=Mr.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Mr.isUndefined(e[t])})).metaTokens,n=i.visitor||a,r=i.dots,o=i.indexes,h=(i.Blob||"undefined"!=typeof Blob&&Blob)&&Mr.isSpecCompliantForm(e);if(!Mr.isFunction(n))throw new TypeError("visitor must be a function");function l(t){if(null===t)return"";if(Mr.isDate(t))return t.toISOString();if(Mr.isBoolean(t))return t.toString();if(!h&&Mr.isBlob(t))throw new xr("Blob is not supported. Use a Buffer instead.");return Mr.isArrayBuffer(t)||Mr.isTypedArray(t)?h&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function a(t,i,n){let h=t;if(t&&!n&&"object"==typeof t)if(Mr.endsWith(i,"{}"))i=s?i:i.slice(0,-2),t=JSON.stringify(t);else if(Mr.isArray(t)&&function(t){return Mr.isArray(t)&&!t.some(zr)}(t)||(Mr.isFileList(t)||Mr.endsWith(i,"[]"))&&(h=Mr.toArray(t)))return i=kr(i),h.forEach(function(t,s){!Mr.isUndefined(t)&&null!==t&&e.append(!0===o?Tr([i],s,r):null===o?i:i+"[]",l(t))}),!1;return!!zr(t)||(e.append(Tr(n,i,r),l(t)),!1)}const c=[],u=Object.assign(Rr,{defaultVisitor:a,convertValue:l,isVisitable:zr});if(!Mr.isObject(t))throw new TypeError("data must be an object");return function t(i,s){if(!Mr.isUndefined(i)){if(-1!==c.indexOf(i))throw Error("Circular reference detected in "+s.join("."));c.push(i),Mr.forEach(i,function(i,r){!0===(!(Mr.isUndefined(i)||null===i)&&n.call(e,i,Mr.isString(r)?r.trim():r,s,u))&&t(i,s?s.concat(r):[r])}),c.pop()}}(t),e}function Lr(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Or(t,e){this._pairs=[],t&&Nr(t,this,e)}const Pr=Or.prototype;function $r(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vr(t,e,i){if(!e)return t;const s=i&&i.encode||$r;Mr.isFunction(i)&&(i={serialize:i});const n=i&&i.serialize;let r;if(r=n?n(e,i):Mr.isURLSearchParams(e)?e.toString():new Or(e,i).toString(s),r){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t}Pr.append=function(t,e){this._pairs.push([t,e])},Pr.toString=function(t){const e=t?function(e){return t.call(this,e,Lr)}:Lr;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};class Dr{constructor(){this.handlers=[]}use(t,e,i){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Mr.forEach(this.handlers,function(e){null!==e&&t(e)})}}var Br={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Fr={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Or,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Ar="undefined"!=typeof window&&"undefined"!=typeof document,Wr="object"==typeof navigator&&navigator||void 0,jr=Ar&&(!Wr||["ReactNative","NativeScript","NS"].indexOf(Wr.product)<0),Ir="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ur=Ar&&window.location.href||"http://localhost";var Hr={...Object.freeze({__proto__:null,hasBrowserEnv:Ar,hasStandardBrowserEnv:jr,hasStandardBrowserWebWorkerEnv:Ir,navigator:Wr,origin:Ur}),...Fr};function Kr(t){function e(t,i,s,n){let r=t[n++];if("__proto__"===r)return!0;const o=Number.isFinite(+r),h=n>=t.length;if(r=!r&&Mr.isArray(s)?s.length:r,h)return Mr.hasOwnProp(s,r)?s[r]=[s[r],i]:s[r]=i,!o;s[r]&&Mr.isObject(s[r])||(s[r]=[]);return e(t,i,s[r],n)&&Mr.isArray(s[r])&&(s[r]=function(t){const e={},i=Object.keys(t);let s;const n=i.length;let r;for(s=0;s<n;s++)r=i[s],e[r]=t[r];return e}(s[r])),!o}if(Mr.isFormData(t)&&Mr.isFunction(t.entries)){const i={};return Mr.forEachEntry(t,(t,s)=>{e(function(t){return Mr.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),s,i,0)}),i}return null}const qr={transitional:Br,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const i=e.getContentType()||"",s=i.indexOf("application/json")>-1,n=Mr.isObject(t);n&&Mr.isHTMLForm(t)&&(t=new FormData(t));if(Mr.isFormData(t))return s?JSON.stringify(Kr(t)):t;if(Mr.isArrayBuffer(t)||Mr.isBuffer(t)||Mr.isStream(t)||Mr.isFile(t)||Mr.isBlob(t)||Mr.isReadableStream(t))return t;if(Mr.isArrayBufferView(t))return t.buffer;if(Mr.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let r;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Nr(t,new Hr.classes.URLSearchParams,{visitor:function(t,e,i,s){return Hr.isNode&&Mr.isBuffer(t)?(this.append(e,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((r=Mr.isFileList(t))||i.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Nr(r?{"files[]":t}:t,e&&new e,this.formSerializer)}}return n||s?(e.setContentType("application/json",!1),function(t,e,i){if(Mr.isString(t))try{return(e||JSON.parse)(t),Mr.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(i||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||qr.transitional,i=e&&e.forcedJSONParsing,s="json"===this.responseType;if(Mr.isResponse(t)||Mr.isReadableStream(t))return t;if(t&&Mr.isString(t)&&(i&&!this.responseType||s)){const i=!(e&&e.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(t){if(i){if("SyntaxError"===t.name)throw xr.from(t,xr.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hr.classes.FormData,Blob:Hr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Mr.forEach(["delete","get","head","post","put","patch"],t=>{qr.headers[t]={}});const Xr=Mr.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Gr=Symbol("internals");function Jr(t){return t&&String(t).trim().toLowerCase()}function Qr(t){return!1===t||null==t?t:Mr.isArray(t)?t.map(Qr):String(t)}function Yr(t,e,i,s,n){return Mr.isFunction(s)?s.call(this,e,i):(n&&(e=i),Mr.isString(e)?Mr.isString(s)?-1!==e.indexOf(s):Mr.isRegExp(s)?s.test(e):void 0:void 0)}let Zr=class{constructor(t){t&&this.set(t)}set(t,e,i){const s=this;function n(t,e,i){const n=Jr(e);if(!n)throw new Error("header name must be a non-empty string");const r=Mr.findKey(s,n);(!r||void 0===s[r]||!0===i||void 0===i&&!1!==s[r])&&(s[r||e]=Qr(t))}const r=(t,e)=>Mr.forEach(t,(t,i)=>n(t,i,e));if(Mr.isPlainObject(t)||t instanceof this.constructor)r(t,e);else if(Mr.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))r((t=>{const e={};let i,s,n;return t&&t.split("\n").forEach(function(t){n=t.indexOf(":"),i=t.substring(0,n).trim().toLowerCase(),s=t.substring(n+1).trim(),!i||e[i]&&Xr[i]||("set-cookie"===i?e[i]?e[i].push(s):e[i]=[s]:e[i]=e[i]?e[i]+", "+s:s)}),e})(t),e);else if(Mr.isObject(t)&&Mr.isIterable(t)){let i,s,n={};for(const e of t){if(!Mr.isArray(e))throw TypeError("Object iterator must return a key-value pair");n[s=e[0]]=(i=n[s])?Mr.isArray(i)?[...i,e[1]]:[i,e[1]]:e[1]}r(n,e)}else null!=t&&n(e,t,i);return this}get(t,e){if(t=Jr(t)){const i=Mr.findKey(this,t);if(i){const t=this[i];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(t);)e[s[1]]=s[2];return e}(t);if(Mr.isFunction(e))return e.call(this,t,i);if(Mr.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Jr(t)){const i=Mr.findKey(this,t);return!(!i||void 0===this[i]||e&&!Yr(0,this[i],i,e))}return!1}delete(t,e){const i=this;let s=!1;function n(t){if(t=Jr(t)){const n=Mr.findKey(i,t);!n||e&&!Yr(0,i[n],n,e)||(delete i[n],s=!0)}}return Mr.isArray(t)?t.forEach(n):n(t),s}clear(t){const e=Object.keys(this);let i=e.length,s=!1;for(;i--;){const n=e[i];t&&!Yr(0,this[n],n,t,!0)||(delete this[n],s=!0)}return s}normalize(t){const e=this,i={};return Mr.forEach(this,(s,n)=>{const r=Mr.findKey(i,n);if(r)return e[r]=Qr(s),void delete e[n];const o=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,i)=>e.toUpperCase()+i)}(n):String(n).trim();o!==n&&delete e[n],e[o]=Qr(s),i[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Mr.forEach(this,(i,s)=>{null!=i&&!1!==i&&(e[s]=t&&Mr.isArray(i)?i.join(", "):i)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const i=new this(t);return e.forEach(t=>i.set(t)),i}static accessor(t){const e=(this[Gr]=this[Gr]={accessors:{}}).accessors,i=this.prototype;function s(t){const s=Jr(t);e[s]||(!function(t,e){const i=Mr.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+i,{value:function(t,i,n){return this[s].call(this,e,t,i,n)},configurable:!0})})}(i,t),e[s]=!0)}return Mr.isArray(t)?t.forEach(s):s(t),this}};function to(t,e){const i=this||qr,s=e||i,n=Zr.from(s.headers);let r=s.data;return Mr.forEach(t,function(t){r=t.call(i,r,n.normalize(),e?e.status:void 0)}),n.normalize(),r}function eo(t){return!(!t||!t.__CANCEL__)}function io(t,e,i){xr.call(this,null==t?"canceled":t,xr.ERR_CANCELED,e,i),this.name="CanceledError"}function so(t,e,i){const s=i.config.validateStatus;i.status&&s&&!s(i.status)?e(new xr("Request failed with status code "+i.status,[xr.ERR_BAD_REQUEST,xr.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):t(i)}Zr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Mr.reduceDescriptors(Zr.prototype,({value:t},e)=>{let i=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[i]=t}}}),Mr.freezeMethods(Zr),Mr.inherits(io,xr,{__CANCEL__:!0});const no=(t,e,i=3)=>{let s=0;const n=function(t,e){t=t||10;const i=new Array(t),s=new Array(t);let n,r=0,o=0;return e=void 0!==e?e:1e3,function(h){const l=Date.now(),a=s[o];n||(n=l),i[r]=h,s[r]=l;let c=o,u=0;for(;c!==r;)u+=i[c++],c%=t;if(r=(r+1)%t,r===o&&(o=(o+1)%t),l-n<e)return;const d=a&&l-a;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(t,e){let i,s,n=0,r=1e3/e;const o=(e,r=Date.now())=>{n=r,i=null,s&&(clearTimeout(s),s=null),t(...e)};return[(...t)=>{const e=Date.now(),h=e-n;h>=r?o(t,e):(i=t,s||(s=setTimeout(()=>{s=null,o(i)},r-h)))},()=>i&&o(i)]}(i=>{const r=i.loaded,o=i.lengthComputable?i.total:void 0,h=r-s,l=n(h);s=r;t({loaded:r,total:o,progress:o?r/o:void 0,bytes:h,rate:l||void 0,estimated:l&&o&&r<=o?(o-r)/l:void 0,event:i,lengthComputable:null!=o,[e?"download":"upload"]:!0})},i)},ro=(t,e)=>{const i=null!=t;return[s=>e[0]({lengthComputable:i,total:t,loaded:s}),e[1]]},oo=t=>(...e)=>Mr.asap(()=>t(...e));var ho=Hr.hasStandardBrowserEnv?((t,e)=>i=>(i=new URL(i,Hr.origin),t.protocol===i.protocol&&t.host===i.host&&(e||t.port===i.port)))(new URL(Hr.origin),Hr.navigator&&/(msie|trident)/i.test(Hr.navigator.userAgent)):()=>!0,lo=Hr.hasStandardBrowserEnv?{write(t,e,i,s,n,r){const o=[t+"="+encodeURIComponent(e)];Mr.isNumber(i)&&o.push("expires="+new Date(i).toGMTString()),Mr.isString(s)&&o.push("path="+s),Mr.isString(n)&&o.push("domain="+n),!0===r&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function ao(t,e,i){let s=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(s||0==i)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const co=t=>t instanceof Zr?{...t}:t;function uo(t,e){e=e||{};const i={};function s(t,e,i,s){return Mr.isPlainObject(t)&&Mr.isPlainObject(e)?Mr.merge.call({caseless:s},t,e):Mr.isPlainObject(e)?Mr.merge({},e):Mr.isArray(e)?e.slice():e}function n(t,e,i,n){return Mr.isUndefined(e)?Mr.isUndefined(t)?void 0:s(void 0,t,0,n):s(t,e,0,n)}function r(t,e){if(!Mr.isUndefined(e))return s(void 0,e)}function o(t,e){return Mr.isUndefined(e)?Mr.isUndefined(t)?void 0:s(void 0,t):s(void 0,e)}function h(i,n,r){return r in e?s(i,n):r in t?s(void 0,i):void 0}const l={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:h,headers:(t,e,i)=>n(co(t),co(e),0,!0)};return Mr.forEach(Object.keys({...t,...e}),function(s){const r=l[s]||n,o=r(t[s],e[s],s);Mr.isUndefined(o)&&r!==h||(i[s]=o)}),i}var fo=t=>{const e=uo({},t);let{data:i,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:r,headers:o,auth:h}=e;if(e.headers=o=Zr.from(o),e.url=Vr(ao(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),h&&o.set("Authorization","Basic "+btoa((h.username||"")+":"+(h.password?unescape(encodeURIComponent(h.password)):""))),Mr.isFormData(i))if(Hr.hasStandardBrowserEnv||Hr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Mr.isFunction(i.getHeaders)){const t=i.getHeaders(),e=["content-type","content-length"];Object.entries(t).forEach(([t,i])=>{e.includes(t.toLowerCase())&&o.set(t,i)})}if(Hr.hasStandardBrowserEnv&&(s&&Mr.isFunction(s)&&(s=s(e)),s||!1!==s&&ho(e.url))){const t=n&&r&&lo.read(r);t&&o.set(n,t)}return e};var mo="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,i){const s=fo(t);let n=s.data;const r=Zr.from(s.headers).normalize();let o,h,l,a,c,{responseType:u,onUploadProgress:d,onDownloadProgress:f}=s;function m(){a&&a(),c&&c(),s.cancelToken&&s.cancelToken.unsubscribe(o),s.signal&&s.signal.removeEventListener("abort",o)}let p=new XMLHttpRequest;function g(){if(!p)return;const s=Zr.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());so(function(t){e(t),m()},function(t){i(t),m()},{data:u&&"text"!==u&&"json"!==u?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:s,config:t,request:p}),p=null}p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(i(new xr("Request aborted",xr.ECONNABORTED,t,p)),p=null)},p.onerror=function(e){const s=new xr(e&&e.message?e.message:"Network Error",xr.ERR_NETWORK,t,p);s.event=e||null,i(s),p=null},p.ontimeout=function(){let e=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const n=s.transitional||Br;s.timeoutErrorMessage&&(e=s.timeoutErrorMessage),i(new xr(e,n.clarifyTimeoutError?xr.ETIMEDOUT:xr.ECONNABORTED,t,p)),p=null},void 0===n&&r.setContentType(null),"setRequestHeader"in p&&Mr.forEach(r.toJSON(),function(t,e){p.setRequestHeader(e,t)}),Mr.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),u&&"json"!==u&&(p.responseType=s.responseType),f&&([l,c]=no(f,!0),p.addEventListener("progress",l)),d&&p.upload&&([h,a]=no(d),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",a)),(s.cancelToken||s.signal)&&(o=e=>{p&&(i(!e||e.type?new io(null,t,p):e),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(o),s.signal&&(s.signal.aborted?o():s.signal.addEventListener("abort",o)));const v=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(s.url);v&&-1===Hr.protocols.indexOf(v)?i(new xr("Unsupported protocol "+v+":",xr.ERR_BAD_REQUEST,t)):p.send(n||null)})};const po=(t,e)=>{const{length:i}=t=t?t.filter(Boolean):[];if(e||i){let i,s=new AbortController;const n=function(t){if(!i){i=!0,o();const e=t instanceof Error?t:this.reason;s.abort(e instanceof xr?e:new io(e instanceof Error?e.message:e))}};let r=e&&setTimeout(()=>{r=null,n(new xr(`timeout ${e} of ms exceeded`,xr.ETIMEDOUT))},e);const o=()=>{t&&(r&&clearTimeout(r),r=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(n):t.removeEventListener("abort",n)}),t=null)};t.forEach(t=>t.addEventListener("abort",n));const{signal:h}=s;return h.unsubscribe=()=>Mr.asap(o),h}},go=function*(t,e){let i=t.byteLength;if(i<e)return void(yield t);let s,n=0;for(;n<i;)s=n+e,yield t.slice(n,s),n=s},vo=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:i}=await e.read();if(t)break;yield i}}finally{await e.cancel()}},bo=(t,e,i,s)=>{const n=async function*(t,e){for await(const i of vo(t))yield*go(i,e)}(t,e);let r,o=0,h=t=>{r||(r=!0,s&&s(t))};return new ReadableStream({async pull(t){try{const{done:e,value:s}=await n.next();if(e)return h(),void t.close();let r=s.byteLength;if(i){let t=o+=r;i(t)}t.enqueue(new Uint8Array(s))}catch(t){throw h(t),t}},cancel:t=>(h(t),n.return())},{highWaterMark:2})},{isFunction:wo}=Mr,yo=(({Request:t,Response:e})=>({Request:t,Response:e}))(Mr.global),{ReadableStream:So,TextEncoder:Co}=Mr.global,Mo=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},xo=t=>{t=Mr.merge.call({skipUndefined:!0},yo,t);const{fetch:e,Request:i,Response:s}=t,n=e?wo(e):"function"==typeof fetch,r=wo(i),o=wo(s);if(!n)return!1;const h=n&&wo(So),l=n&&("function"==typeof Co?(a=new Co,t=>a.encode(t)):async t=>new Uint8Array(await new i(t).arrayBuffer()));var a;const c=r&&h&&Mo(()=>{let t=!1;const e=new i(Hr.origin,{body:new So,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),u=o&&h&&Mo(()=>Mr.isReadableStream(new s("").body)),d={stream:u&&(t=>t.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!d[t]&&(d[t]=(e,i)=>{let s=e&&e[t];if(s)return s.call(e);throw new xr(`Response type '${t}' is not supported`,xr.ERR_NOT_SUPPORT,i)})});const f=async(t,e)=>{const s=Mr.toFiniteNumber(t.getContentLength());return null==s?(async t=>{if(null==t)return 0;if(Mr.isBlob(t))return t.size;if(Mr.isSpecCompliantForm(t)){const e=new i(Hr.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Mr.isArrayBufferView(t)||Mr.isArrayBuffer(t)?t.byteLength:(Mr.isURLSearchParams(t)&&(t+=""),Mr.isString(t)?(await l(t)).byteLength:void 0)})(e):s};return async t=>{let{url:n,method:o,data:h,signal:l,cancelToken:a,timeout:m,onDownloadProgress:p,onUploadProgress:g,responseType:v,headers:b,withCredentials:w="same-origin",fetchOptions:y}=fo(t),S=e||fetch;v=v?(v+"").toLowerCase():"text";let C=po([l,a&&a.toAbortSignal()],m),M=null;const x=C&&C.unsubscribe&&(()=>{C.unsubscribe()});let E;try{if(g&&c&&"get"!==o&&"head"!==o&&0!==(E=await f(b,h))){let t,e=new i(n,{method:"POST",body:h,duplex:"half"});if(Mr.isFormData(h)&&(t=e.headers.get("content-type"))&&b.setContentType(t),e.body){const[t,i]=ro(E,no(oo(g)));h=bo(e.body,65536,t,i)}}Mr.isString(w)||(w=w?"include":"omit");const e=r&&"credentials"in i.prototype,l={...y,signal:C,method:o.toUpperCase(),headers:b.normalize().toJSON(),body:h,duplex:"half",credentials:e?w:void 0};M=r&&new i(n,l);let a=await(r?S(M,y):S(n,l));const m=u&&("stream"===v||"response"===v);if(u&&(p||m&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=a[e]});const e=Mr.toFiniteNumber(a.headers.get("content-length")),[i,n]=p&&ro(e,no(oo(p),!0))||[];a=new s(bo(a.body,65536,i,()=>{n&&n(),x&&x()}),t)}v=v||"text";let _=await d[Mr.findKey(d,v)||"text"](a,t);return!m&&x&&x(),await new Promise((e,i)=>{so(e,i,{data:_,headers:Zr.from(a.headers),status:a.status,statusText:a.statusText,config:t,request:M})})}catch(e){if(x&&x(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new xr("Network Error",xr.ERR_NETWORK,t,M),{cause:e.cause||e});throw xr.from(e,e&&e.code,t,M)}}},Eo=new Map,_o=t=>{let e=t?t.env:{};const{fetch:i,Request:s,Response:n}=e,r=[s,n,i];let o,h,l=r.length,a=Eo;for(;l--;)o=r[l],h=a.get(o),void 0===h&&a.set(o,h=l?new Map:xo(e)),a=h;return h};_o();const zo={http:null,xhr:mo,fetch:{get:_o}};Mr.forEach(zo,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const ko=t=>`- ${t}`,To=t=>Mr.isFunction(t)||null===t||!1===t;var Ro=(t,e)=>{t=Mr.isArray(t)?t:[t];const{length:i}=t;let s,n;const r={};for(let o=0;o<i;o++){let i;if(s=t[o],n=s,!To(s)&&(n=zo[(i=String(s)).toLowerCase()],void 0===n))throw new xr(`Unknown adapter '${i}'`);if(n&&(Mr.isFunction(n)||(n=n.get(e))))break;r[i||"#"+o]=n}if(!n){const t=Object.entries(r).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));throw new xr("There is no suitable adapter to dispatch the request "+(i?t.length>1?"since :\n"+t.map(ko).join("\n"):" "+ko(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function No(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new io(null,t)}function Lo(t){No(t),t.headers=Zr.from(t.headers),t.data=to.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Ro(t.adapter||qr.adapter,t)(t).then(function(e){return No(t),e.data=to.call(t,t.transformResponse,e),e.headers=Zr.from(e.headers),e},function(e){return eo(e)||(No(t),e&&e.response&&(e.response.data=to.call(t,t.transformResponse,e.response),e.response.headers=Zr.from(e.response.headers))),Promise.reject(e)})}const Oo="1.12.2",Po={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Po[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const $o={};Po.transitional=function(t,e,i){function s(t,e){return"[Axios v"+Oo+"] Transitional option '"+t+"'"+e+(i?". "+i:"")}return(i,n,r)=>{if(!1===t)throw new xr(s(n," has been removed"+(e?" in "+e:"")),xr.ERR_DEPRECATED);return e&&!$o[n]&&($o[n]=!0,console.warn(s(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(i,n,r)}},Po.spelling=function(t){return(e,i)=>(console.warn(`${i} is likely a misspelling of ${t}`),!0)};var Vo={assertOptions:function(t,e,i){if("object"!=typeof t)throw new xr("options must be an object",xr.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let n=s.length;for(;n-- >0;){const r=s[n],o=e[r];if(o){const e=t[r],i=void 0===e||o(e,r,t);if(!0!==i)throw new xr("option "+r+" must be "+i,xr.ERR_BAD_OPTION_VALUE);continue}if(!0!==i)throw new xr("Unknown option "+r,xr.ERR_BAD_OPTION)}},validators:Po};const Do=Vo.validators;let Bo=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Dr,response:new Dr}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const i=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?i&&!String(t.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+i):t.stack=i}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=uo(this.defaults,e);const{transitional:i,paramsSerializer:s,headers:n}=e;void 0!==i&&Vo.assertOptions(i,{silentJSONParsing:Do.transitional(Do.boolean),forcedJSONParsing:Do.transitional(Do.boolean),clarifyTimeoutError:Do.transitional(Do.boolean)},!1),null!=s&&(Mr.isFunction(s)?e.paramsSerializer={serialize:s}:Vo.assertOptions(s,{encode:Do.function,serialize:Do.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Vo.assertOptions(e,{baseUrl:Do.spelling("baseURL"),withXsrfToken:Do.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let r=n&&Mr.merge(n.common,n[e.method]);n&&Mr.forEach(["delete","get","head","post","put","patch","common"],t=>{delete n[t]}),e.headers=Zr.concat(r,n);const o=[];let h=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(h=h&&t.synchronous,o.unshift(t.fulfilled,t.rejected))});const l=[];let a;this.interceptors.response.forEach(function(t){l.push(t.fulfilled,t.rejected)});let c,u=0;if(!h){const t=[Lo.bind(this),void 0];for(t.unshift(...o),t.push(...l),c=t.length,a=Promise.resolve(e);u<c;)a=a.then(t[u++],t[u++]);return a}c=o.length;let d=e;for(;u<c;){const t=o[u++],e=o[u++];try{d=t(d)}catch(t){e.call(this,t);break}}try{a=Lo.call(this,d)}catch(t){return Promise.reject(t)}for(u=0,c=l.length;u<c;)a=a.then(l[u++],l[u++]);return a}getUri(t){return Vr(ao((t=uo(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}};Mr.forEach(["delete","get","head","options"],function(t){Bo.prototype[t]=function(e,i){return this.request(uo(i||{},{method:t,url:e,data:(i||{}).data}))}}),Mr.forEach(["post","put","patch"],function(t){function e(e){return function(i,s,n){return this.request(uo(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}Bo.prototype[t]=e(),Bo.prototype[t+"Form"]=e(!0)});const Fo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Fo).forEach(([t,e])=>{Fo[e]=t});const Ao=function t(e){const i=new Bo(e),s=On(Bo.prototype.request,i);return Mr.extend(s,Bo.prototype,i,{allOwnKeys:!0}),Mr.extend(s,i,null,{allOwnKeys:!0}),s.create=function(i){return t(uo(e,i))},s}(qr);Ao.Axios=Bo,Ao.CanceledError=io,Ao.CancelToken=class t{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(t){e=t});const i=this;this.promise.then(t=>{if(!i._listeners)return;let e=i._listeners.length;for(;e-- >0;)i._listeners[e](t);i._listeners=null}),this.promise.then=t=>{let e;const s=new Promise(t=>{i.subscribe(t),e=t}).then(t);return s.cancel=function(){i.unsubscribe(e)},s},t(function(t,s,n){i.reason||(i.reason=new io(t,s,n),e(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let e;const i=new t(function(t){e=t});return{token:i,cancel:e}}},Ao.isCancel=eo,Ao.VERSION=Oo,Ao.toFormData=Nr,Ao.AxiosError=xr,Ao.Cancel=Ao.CanceledError,Ao.all=function(t){return Promise.all(t)},Ao.spread=function(t){return function(e){return t.apply(null,e)}},Ao.isAxiosError=function(t){return Mr.isObject(t)&&!0===t.isAxiosError},Ao.mergeConfig=uo,Ao.AxiosHeaders=Zr,Ao.formToJSON=t=>Kr(Mr.isHTMLForm(t)?new FormData(t):t),Ao.getAdapter=Ro,Ao.HttpStatusCode=Fo,Ao.default=Ao;const{Axios:Wo,AxiosError:jo,CanceledError:Io,isCancel:Uo,CancelToken:Ho,VERSION:Ko,all:qo,Cancel:Xo,isAxiosError:Go,spread:Jo,toFormData:Qo,AxiosHeaders:Yo,HttpStatusCode:Zo,formToJSON:th,getAdapter:eh,mergeConfig:ih}=Ao,sh={BASE_URL:"undefined"!=typeof window&&window.FUNHI_CHART_API_URL?window.FUNHI_CHART_API_URL:process.env.NEXT_PUBLIC_BACKEND_URL||"",TIMEOUT:1e4,MAX_RETRIES:3,RETRY_DELAY:1e3};const nh=new class{constructor(){this.baseURL=`${sh.BASE_URL}/api/ohlcv`,this.savingQueue=new Map,this.BATCH_DELAY=5e3,this.BATCH_SIZE=50}async saveCandles(t){try{const{mint:e,candles:i,timeFrame:s=60}=t;if(!e||!i||0===i.length)return console.warn("⚠️ [CandleStorage] Invalid save request:",t),!1;return!!(await Ao.post(`${this.baseURL}/candles/save`,{mint:e,candles:i,timeFrame:s})).data.success&&(console.log(`💾 [CandleStorage] Saved ${i.length} candles for ${e}`),!0)}catch(t){return console.error("❌ [CandleStorage] Error saving candles:",t),!1}}async saveCandle(t){try{const{mint:e,candle:i,timeFrame:s=60}=t;if(!e||!i)return console.warn("⚠️ [CandleStorage] Invalid save request:",t),!1;const n=`${e}_${s}`,r=this.savingQueue.get(n);if(r)clearTimeout(r.timeout),r.candles.push(i),r.candles.length>=this.BATCH_SIZE?await this.flushQueue(n,e,s):r.timeout=setTimeout(()=>{this.flushQueue(n,e,s)},this.BATCH_DELAY);else{const t=setTimeout(()=>{this.flushQueue(n,e,s)},this.BATCH_DELAY);this.savingQueue.set(n,{candles:[i],timeout:t})}return!0}catch(t){return console.error("❌ [CandleStorage] Error queuing candle:",t),!1}}async flushQueue(t,e,i){const s=this.savingQueue.get(t);s&&0!==s.candles.length&&(this.savingQueue.delete(t),await this.saveCandles({mint:e,candles:s.candles,timeFrame:i}))}async getCandles(t){try{const{mint:e,timeFrame:i=60,limit:s=5e4}=t;if(!e)return console.warn("⚠️ [CandleStorage] Invalid get request:",t),[];const n=await Ao.get(`${this.baseURL}/candles/${e}`,{params:{timeFrame:i,limit:s},timeout:8e3,validateStatus:t=>t>=200&&t<500});if(n.data.success&&n.data.data&&n.data.data.candles){const t=n.data.data.candles.length;return t>0?console.log(`✅ [CandleStorage] Retrieved ${t} candles for ${e}`):console.log(`ℹ️ [CandleStorage] No candles found for ${e} in database`),n.data.data.candles}return n.data.warning&&console.warn(`⚠️ [CandleStorage] ${n.data.warning}`),[]}catch(e){return"ECONNABORTED"===e.code?console.error("❌ [CandleStorage] Request timeout getting candles for",t.mint):e.response?console.error("❌ [CandleStorage] Server error getting candles:",e.response.status,e.response.data):e.request?console.error("❌ [CandleStorage] Network error getting candles - no response received"):console.error("❌ [CandleStorage] Error getting candles:",e.message),[]}}async flushAll(){const t=[];for(const[e,i]of this.savingQueue.entries()){clearTimeout(i.timeout);const[s,n]=e.split("_"),r=parseInt(n);t.push(this.flushQueue(e,s,r))}await Promise.all(t)}};class rh{async loadCandles(t,e,i){try{const s=i??Number.MAX_SAFE_INTEGER,n=(await nh.getCandles({mint:t,timeFrame:e,limit:s})).reduce((t,e)=>{const i=t.findIndex(t=>t.time===e.time);return i>=0?t[i]=e:t.push(e),t},[]);return n.sort((t,e)=>t.time-e.time)}catch(t){return console.error("❌ [CandleStorageAdapter] Error loading candles:",t),[]}}async saveCandles(t,e,i){try{await nh.saveCandles({mint:t,timeFrame:e,candles:i})}catch(t){console.error("❌ [CandleStorageAdapter] Error saving candles:",t)}}}class oh{constructor(t){this.debounceMs=50,this.lastUpdate=0,this.timeframeManager=t}handlePriceUpdate(t,e){this.debounce(e)&&this.timeframeManager.updateAll(t,e)}handleSocketUpdate(t,e){t.mint===e&&t.candles&&Object.entries(t.candles).forEach(([t,e])=>{const i=this.getTimeframeSeconds(t);if(i){const t=Math.floor(Date.now()/1e3),s=Math.floor(t/i)*i;if(e.time===s){const t={time:e.time,open:e.open,high:e.high||e.open,low:e.low||e.open,close:e.close,volume:e.volume||0};this.timeframeManager.updateFromExternal(i,t,s)}}})}debounce(t){const e=Date.now();return!(this.lastUpdate&&e-this.lastUpdate<this.debounceMs)&&(this.lastUpdate=e,!0)}getTimeframeSeconds(t){return{"1m":60,"5m":300,"15m":900,"1h":3600,"4h":14400,"1d":86400}[t]||null}}class hh{constructor(t){this.gapCheckInterval=null,this.GAP_CHECK_INTERVAL_MS=3e4,this.config=t,this.currentTimeframe=t.timeframes[0],this.timeframeManager=new s(t.timeframes),this.storageAdapter=new rh,this.updateHandler=new oh(this.timeframeManager);const e={mint:t.mint,ticker:t.ticker,formatPrice:t.formatPrice};this.chartRenderer=new Ln(t.container,e)}async initialize(){this.chartRenderer.initialize(),await this.loadTimeframeData(this.currentTimeframe.seconds);const t=this.getCurrentCandles();t.length>0&&this.chartRenderer.updateData(t),this.startGapChecking()}async loadTimeframeData(t){const e=this.timeframeManager.getCandles(t).length,i=await this.storageAdapter.loadCandles(this.config.mint,t);if(i.length>0){this.timeframeManager.loadCandles(t,i);const s=this.timeframeManager.getCandles(t).length;e>0&&s<e?console.warn(`⚠️ [FunhiChartController] Candle count decreased after load: ${e} -> ${s}. This might indicate data loss. Database returned ${i.length} candles.`):s>e&&console.log(`✅ [FunhiChartController] Loaded ${i.length} candles from database. Total candles: ${e} -> ${s} (merged)`)}else 0===e&&console.warn(`⚠️ [FunhiChartController] No candles loaded from database for timeframe ${t}s`)}updatePrice(t){const e=Date.now();this.updateHandler.handlePriceUpdate(t,e);const i=this.getCurrentCandles();i.length>0&&this.chartRenderer.updateData(i),this.checkAndFillGaps()}handleSocketUpdate(t){this.updateHandler.handleSocketUpdate(t,this.config.mint);const e=this.getCurrentCandles();e.length>0&&this.chartRenderer.updateData(e)}async switchTimeframe(t){const e=this.config.timeframes.find(e=>e.seconds===t);if(!e)return void console.warn(`⚠️ [FunhiChartController] Timeframe ${t}s not found`);const i=this.timeframeManager.getCandles(t);0===i.length?(console.log(`🔄 [FunhiChartController] Loading candles for timeframe ${t}s`),await this.loadTimeframeData(t)):console.log(`✅ [FunhiChartController] Using existing ${i.length} candles for timeframe ${t}s`),this.currentTimeframe=e;const s=this.getCurrentCandles();s.length>0?(this.chartRenderer.updateData(s),console.log(`📊 [FunhiChartController] Updated chart with ${s.length} candles for ${e.label}`)):console.warn(`⚠️ [FunhiChartController] No candles available to display for timeframe ${e.label}`)}getCurrentCandles(){return this.timeframeManager.getCandles(this.currentTimeframe.seconds)}getCurrentTimeframe(){return this.currentTimeframe}getCurrentCandle(t){return this.timeframeManager.getCurrentCandle(t)}resize(){this.chartRenderer.resize()}async checkAndFillGaps(){const t=this.timeframeManager.getManager(this.currentTimeframe.seconds);if(!t)return;const e=t.detectGaps();if(0===e.length)return;const i=e.reduce((t,e)=>t+e.missingCount,0);if(i>0){console.log(`🔍 [FunhiChartController] Detected ${e.length} gap(s) with ${i} missing candles. Reloading from database to fill gaps...`),await this.loadTimeframeData(this.currentTimeframe.seconds);const t=this.getCurrentCandles();t.length>0&&this.chartRenderer.updateData(t)}}startGapChecking(){this.gapCheckInterval&&clearInterval(this.gapCheckInterval),this.gapCheckInterval=setInterval(()=>{this.checkAndFillGaps()},this.GAP_CHECK_INTERVAL_MS)}stopGapChecking(){this.gapCheckInterval&&(clearInterval(this.gapCheckInterval),this.gapCheckInterval=null)}destroy(){this.stopGapChecking(),this.chartRenderer.destroy(),this.timeframeManager.reset()}}const lh=e=>{const[i]=t.useState(e||null),[s,n]=t.useState(!1),[r,o]=t.useState(!1);t.useEffect(()=>{if(!i)return n(!1),void o(!1);o(!0);const t=()=>{console.log("✅ [useSocket] Connected to Socket.IO server"),n(!0),o(!1)},e=()=>{console.log("🔌 [useSocket] Disconnected from Socket.IO server"),n(!1),o(!1)},s=t=>{console.error("❌ [useSocket] Connection error:",t),o(!1)};return i.connected&&(n(!0),o(!1)),i.on("connect",t),i.on("disconnect",e),i.on("connect_error",s),()=>{i.off("connect",t),i.off("disconnect",e),i.off("connect_error",s)}},[i]);const h=t.useCallback(()=>{console.log("🔍 [useSocket] Connect called - connection managed by provider")},[]),l=t.useCallback(()=>{console.log("🔍 [useSocket] Disconnect called - connection managed by provider")},[]),a=t.useCallback((t,e=60,s,n,r)=>{if(!i?.connected)return console.warn("⚠️ [useSocket] Socket not connected, cannot subscribe"),!1;try{return i.emit("ohlcv:subscribe",{mint:t,timeFrame:e}),s&&i.on("ohlcv:initial",s),n&&i.on("ohlcv:update",n),r&&i.on("ohlcv:newCandle",r),console.log(`📊 [useSocket] Subscribed to OHLCV updates for ${t} (${e}s)`),!0}catch(t){return console.error("❌ [useSocket] Failed to subscribe to OHLCV:",t),!1}},[i]),c=t.useCallback((t,e=60,s,n,r)=>{if(!i?.connected)return!1;try{return i.emit("ohlcv:unsubscribe",{mint:t,timeFrame:e}),s&&i.off("ohlcv:initial",s),n&&i.off("ohlcv:update",n),r&&i.off("ohlcv:newCandle",r),console.log(`📊 [useSocket] Unsubscribed from OHLCV updates for ${t} (${e}s)`),!0}catch(t){return console.error("❌ [useSocket] Failed to unsubscribe from OHLCV:",t),!1}},[i]),u=t.useCallback((t,e)=>{if(!i?.connected)return console.warn("⚠️ [useSocket] Socket not connected, cannot subscribe"),!1;try{return i.emit("price:subscribe",{mint:t}),e&&i.on("price:update",e),console.log(`💰 [useSocket] Subscribed to price updates for ${t}`),!0}catch(t){return console.error("❌ [useSocket] Failed to subscribe to price:",t),!1}},[i]),d=t.useCallback((t,e)=>{if(!i?.connected)return!1;try{return i.emit("price:unsubscribe",{mint:t}),e&&i.off("price:update",e),console.log(`💰 [useSocket] Unsubscribed from price updates for ${t}`),!0}catch(t){return console.error("❌ [useSocket] Failed to unsubscribe from price:",t),!1}},[i]),f=t.useCallback(t=>{if(!i?.connected)return console.warn("⚠️ [useSocket] Socket not connected, cannot send test message"),!1;try{return i.emit("test-message",{message:t,timestamp:Date.now()}),i.once("test-response",t=>{console.log("🧪 [useSocket] Test response received:",t)}),!0}catch(t){return console.error("❌ [useSocket] Failed to send test message:",t),!1}},[i]);return{socket:i,isConnected:s,isConnecting:r,connect:h,disconnect:l,subscribeToOHLCV:a,unsubscribeFromOHLCV:c,subscribeToPrice:u,unsubscribeFromPrice:d,testConnection:f}};function ah(e,i){const[s,n]=t.useState(null),[r,o]=t.useState(!1),[h,l]=t.useState(null),[a,c]=t.useState(null),[u,d]=t.useState(!1);t.useEffect(()=>{i&&(n(i),c(Date.now()),d(!0),o(!1))},[i]);const f=t.useMemo(()=>{if(!s||!s.market)return{currentPrice:0,currentMarketCap:0,currentVolume:0,performance24h:{value:"0.00%",isPositive:!1,raw:0},performance7d:{value:"0.00%",isPositive:!1,raw:0},performance1m:{value:"0.00%",isPositive:!1,raw:0},performanceAllTime:{value:"0.00%",isPositive:!1,raw:0},high24h:0,low24h:0,volume24h:0,return24h:0};const t=parseFloat(s.market?.price||"0")||0,e=parseFloat(s.market?.marketCap||"0")||0;let i=parseFloat(s.volume?.current||"0")||0;i<=.01&&(i=parseFloat(s.blockchain?.currentRealSol||"0")||0);const n={value:s.performance?.["24H"]?.percentage||"0.00%",isPositive:s.performance?.["24H"]?.isPositive||!1,raw:s.performance?.["24H"]?.gain||0},r={value:s.performance?.["7D"]?.percentage||"0.00%",isPositive:s.performance?.["7D"]?.isPositive||!1,raw:s.performance?.["7D"]?.gain||0},o={value:s.performance?.["1M"]?.percentage||"0.00%",isPositive:s.performance?.["1M"]?.isPositive||!1,raw:s.performance?.["1M"]?.gain||0},h={value:s.performance?.["All Time"]?.percentage||"0.00%",isPositive:s.performance?.["All Time"]?.isPositive||!1,raw:s.performance?.["All Time"]?.gain||0},l=parseFloat(s["24H"]?.high||"0")||0,a=parseFloat(s["24H"]?.low||"0")||0;let c=parseFloat(s.volume?.["24h"]||"0")||0;c<=.01&&(c=parseFloat(s.blockchain?.currentRealSol||"0")||0);return{currentPrice:t,currentMarketCap:e,currentVolume:i,performance24h:n,performance7d:r,performance1m:o,performanceAllTime:h,high24h:l,low24h:a,volume24h:c,return24h:parseFloat(s["24H"]?.return||"0")||0}},[s]),m=t.useCallback(t=>t>.01,[]);return{analytics:s,...f,isRealVolume:m,loading:r,error:h,connected:u,lastUpdate:a}}const ch=new class{constructor(){this.timeframes={"1m":60,"5m":300,"15m":900,"30m":1800,"1h":3600,"4h":14400,"1d":86400}}aggregateCandles(t,e){try{if(60===e)return t;if(!Array.isArray(t)||0===t.length)return console.warn("⚠️ [CandleAggregation] No candles to aggregate"),[];const i=[...t].sort((t,e)=>t.time-e.time),s=[];let n=[],r=null;for(const t of i){const i=Math.floor(t.time/e)*e;if(null===r&&(r=i),i===r)n.push(t);else{if(n.length>0){const t=this.aggregateGroup(n,r);s.push(t)}n=[t],r=i}}if(n.length>0&&null!==r){const t=this.aggregateGroup(n,r);s.push(t)}return console.log(`📊 [CandleAggregation] Aggregated ${t.length} 1m candles into ${s.length} ${this.getTimeframeLabel(e)} candles`),s}catch(t){return console.error("❌ [CandleAggregation] Error aggregating candles:",t),[]}}aggregateGroup(t,e){const i=[...t].sort((t,e)=>t.time-e.time),s=i[0].open,n=i[i.length-1].close,r=Math.max(...i.map(t=>t.high)),o=Math.min(...i.map(t=>t.low)),h=i.reduce((t,e)=>t+(e.volume||0),0);return{time:e,open:s,high:r,low:o,close:n,volume:h}}getTimeframeLabel(t){for(const[e,i]of Object.entries(this.timeframes))if(i===t)return e;return`${t}s`}getTimeframeSeconds(t){return this.timeframes[t]||60}fillGaps(t,e){try{if(!Array.isArray(t)||t.length<2)return t;const i=[...t].sort((t,e)=>t.time-e.time),s=[];for(let t=0;t<i.length-1;t++){const n=i[t],r=i[t+1];s.push(n);let o=n.time+e;for(;o<r.time;)s.push({time:o,open:n.close,high:n.close,low:n.close,close:n.close,volume:0}),o+=e}return s.push(i[i.length-1]),s.length>i.length&&console.log(`🔧 [CandleAggregation] Filled ${s.length-i.length} gaps in ${this.getTimeframeLabel(e)} candles`),s}catch(e){return console.error("❌ [CandleAggregation] Error filling gaps:",e),t}}getCurrentCandle(t,e){try{if(!Array.isArray(t)||0===t.length)return null;const i=Math.floor(Date.now()/1e3),s=Math.floor(i/e)*e,n=t.filter(t=>Math.floor(t.time/e)*e===s);return 0===n.length?null:this.aggregateGroup(n,s)}catch(t){return console.error("❌ [CandleAggregation] Error getting current candle:",t),null}}updateRealtimeCandle(t,e,i){try{if(!e)return t;const s=Math.floor(e.time/i)*i,n=t.findIndex(t=>t.time===s);if(n>=0){const i=t[n],r={time:s,open:i.open,high:Math.max(i.high,e.high),low:Math.min(i.low,e.low),close:e.close,volume:i.volume+(e.volume||0)},o=[...t];return o[n]=r,o}{const i={time:s,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume||0};return[...t,i].sort((t,e)=>t.time-e.time)}}catch(e){return console.error("❌ [CandleAggregation] Error updating realtime candle:",e),t}}isValidCandle(t){return t&&"number"==typeof t.time&&"number"==typeof t.open&&"number"==typeof t.high&&"number"==typeof t.low&&"number"==typeof t.close&&t.high>=t.low&&t.high>=t.open&&t.high>=t.close&&t.low<=t.open&&t.low<=t.close}cleanCandles(t){if(!Array.isArray(t))return[];const e=t.filter(t=>this.isValidCandle(t));return e.length<t.length&&console.warn(`⚠️ [CandleAggregation] Removed ${t.length-e.length} invalid candles`),e}getRequiredOneMinuteCandles(t,e=200){const i=t/60;return Math.ceil(e*i)}};exports.API_CONFIG=sh,exports.FunhiChart=({mint:e,ticker:i,tokenName:s,socket:n,isConnected:r,currentMarketCap:o,analyticsConnected:h,analyticsLoading:l})=>{const a=t.useRef(null),c=t.useRef(null),[u,d]=t.useState(!0),[f,m]=t.useState(!1),[p,g]=t.useState(null),[v,b]=t.useState(null),[w,y]=t.useState(null),S=lh(),C=n||S.socket,M=void 0!==r?r:S.isConnected,x=ah(),E=void 0!==o?o:x.currentMarketCap,_=void 0!==h?h:x.connected,z=void 0!==l?l:x.loading,k=t.useMemo(()=>[{label:"1m",value:"1m",seconds:60},{label:"5m",value:"5m",seconds:300},{label:"15m",value:"15m",seconds:900},{label:"1h",value:"1h",seconds:3600},{label:"4h",value:"4h",seconds:14400},{label:"1d",value:"1d",seconds:86400}],[]),T=t.useCallback(t=>t>=1e9?`$${(t/1e9).toFixed(t>=1e10?2:3)}B`:t>=1e6?`$${(t/1e6).toFixed(t>=1e7?2:3)}M`:t>=1e4?`$${(t/1e3).toFixed(t>=1e5?1:2)}K`:t>=1e3?`$${(t/1e3).toFixed(2)}K`:t>=1?`$${t.toFixed(2)}`:`$${t.toFixed(4)}`,[]);t.useEffect(()=>{if(a.current&&e)try{const t={mint:e,ticker:i,tokenName:s,timeframes:k,container:a.current,formatPrice:T},n=new hh(t);return c.current=n,n.initialize().then(()=>{y(n.getCurrentTimeframe()),d(!1)}).catch(t=>{console.error("❌ [FunhiChart] Initialization error:",t),b(t.message||"Failed to initialize chart"),d(!1)}),()=>{n.destroy(),c.current=null}}catch(t){console.error("❌ [FunhiChart] Controller creation error:",t),b(t.message||"Failed to create chart controller"),d(!1)}},[e,i,s,k,T]),t.useEffect(()=>{!c.current||E<=0||(!isFinite(E)||E<=0?console.warn(`⚠️ [FunhiChart] Invalid market cap data: ${E}`):c.current.updatePrice(E))},[E]),t.useEffect(()=>{if(!(C&&M&&e&&c.current))return;const t=t=>{t.mint===e&&c.current?.handleSocketUpdate(t)};return C.on("multiTimeframeCandleUpdate",t),()=>{C.off("multiTimeframeCandleUpdate",t)}},[C,M,e]);const R=t.useCallback(async t=>{if(!c.current)return;const e=k.find(e=>e.value===t);if(e&&e.value!==w?.value)if(f)console.log("⚠️ [FunhiChart] Timeframe switch already in progress");else{console.log(`🔄 [FunhiChart] Switching to ${e.label}`),m(!0),g(e.label),d(!0);try{await c.current.switchTimeframe(e.seconds),y(e),d(!1),m(!1),g(null),console.log(`✅ [FunhiChart] Switched to ${e.label}`)}catch(t){console.error("❌ [FunhiChart] Switch error:",t),d(!1),m(!1),g(null)}}},[k,w,f]);if(t.useEffect(()=>{const t=()=>{c.current?.resize()};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),t.useEffect(()=>{if((u||z)&&c.current){if(0===c.current.getCurrentCandles().length){const t=setTimeout(()=>d(!1),1e4);return()=>clearTimeout(t)}}},[u,z]),v)return t.createElement("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg"},t.createElement("div",{className:"text-red-800 font-medium"},"Chart Error"),t.createElement("div",{className:"text-red-600 text-sm"},v),t.createElement("button",{onClick:()=>b(null),className:"mt-2 px-3 py-1 bg-red-100 text-red-700 rounded text-sm hover:bg-red-200"},"Dismiss"));const N=c.current?.getCurrentCandles()||[],L=E||0;return t.createElement("div",{className:"w-full"},t.createElement("div",{className:"mb-4 flex flex-wrap gap-2 items-center"},t.createElement("div",{className:"flex flex-wrap gap-2"},k.map(e=>{const i=w?.value===e.value,s=f&&p===e.label,n=f;return t.createElement("button",{key:e.value,onClick:()=>R(e.value),disabled:n,className:`\n px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200 relative\n ${i?"bg-blue-600 text-white":n?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-100 text-gray-700 hover:bg-gray-200"}\n ${s?"animate-pulse":""}\n `},s&&t.createElement("div",{className:"absolute inset-0 flex items-center justify-center"},t.createElement("div",{className:"flex space-x-1"},t.createElement("div",{className:"w-1 h-1 bg-white rounded-full animate-pulse"}),t.createElement("div",{className:"w-1 h-1 bg-white rounded-full animate-pulse",style:{animationDelay:"0.1s"}}),t.createElement("div",{className:"w-1 h-1 bg-white rounded-full animate-pulse",style:{animationDelay:"0.2s"}}))),t.createElement("span",{className:s?"opacity-0":"opacity-100"},e.label))})),t.createElement("div",{className:"ml-auto flex items-center gap-2 text-sm"},t.createElement("div",{className:"w-2 h-2 rounded-full "+(_?"bg-green-500":"bg-red-500")}),t.createElement("span",{className:_?"text-green-600":"text-red-600"},_?"Connected":"Disconnected"),f&&p&&t.createElement("span",{className:"text-blue-600"},"• Switching to ",p,"..."),!f&&u&&!z&&t.createElement("span",{className:"text-blue-600"},"• Loading candles..."),z&&t.createElement("span",{className:"text-blue-600"},"• Connecting to analytics..."),!f&&!u&&!z&&N.length>0&&t.createElement("span",{className:"text-green-600"},"• ",N.length," ",w?.label," candles • ",T(L)))),t.createElement("div",{ref:a,className:"relative w-full h-96 transition-all duration-300 "+(f?"opacity-75 scale-[0.98]":"opacity-100 scale-100")},(f||u&&!z)&&t.createElement("div",{className:"absolute inset-0 bg-gradient-to-br from-white via-blue-50 to-white bg-opacity-90 flex items-center justify-center rounded-lg z-10 backdrop-blur-sm"},t.createElement("div",{className:"text-center"},t.createElement("div",{className:"flex justify-center items-center mb-4"},t.createElement("div",{className:"relative"},t.createElement("div",{className:"w-12 h-12 border-4 border-blue-200 rounded-full"}),t.createElement("div",{className:"absolute top-0 left-0 w-12 h-12 border-4 border-blue-600 rounded-full border-t-transparent animate-spin"}))),t.createElement("div",{className:"text-gray-700 font-medium text-lg"},f&&p?`Switching to ${p} timeframe...`:"Loading real-time data..."),t.createElement("div",{className:"mt-3 flex justify-center space-x-1"},t.createElement("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce"}),t.createElement("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),t.createElement("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})))),!f&&!u&&!z&&0===N.length&&t.createElement("div",{className:"absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center rounded-lg z-10"},t.createElement("div",{className:"text-center"},t.createElement("div",{className:"text-gray-600 mb-2"},"No ",w?.label," market data available"),t.createElement("div",{className:"text-sm text-gray-500"},"Waiting for real-time data...")))))},exports.candleAggregation=ch,exports.candleStorageService=nh,exports.useOptimizedTokenAnalytics=ah,exports.useSocket=lh;
|
|
7
|
+
*/const u={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},d={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},f={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},m={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},p={baseValue:{type:"price",price:0},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},g={color:"#26a69a",base:0},v={color:"#2196f3"},b={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}};var w,y,S;function C(t,e){const i={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]}[e];t.setLineDash(i)}function M(t,e,i,s){t.beginPath();const n=t.lineWidth%2?.5:0;t.moveTo(i,e+n),t.lineTo(s,e+n),t.stroke()}function E(t,e){if(!t)throw new Error("Assertion failed"+(e?": "+e:""))}function x(t){if(void 0===t)throw new Error("Value is undefined");return t}function _(t){if(null===t)throw new Error("Value is null");return t}function z(t){return _(x(t))}(S=w||(w={}))[S.Simple=0]="Simple",S[S.WithSteps=1]="WithSteps",S[S.Curved=2]="Curved",function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(y||(y={}));const k={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function T(t){return t<0?0:t>255?255:Math.round(t)||0}function R(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const N=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,L=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,O=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,P=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function $(t){(t=t.toLowerCase())in k&&(t=k[t]);{const e=P.exec(t)||O.exec(t);if(e)return[T(parseInt(e[1],10)),T(parseInt(e[2],10)),T(parseInt(e[3],10)),R(e.length<5?1:parseFloat(e[4]))]}{const e=L.exec(t);if(e)return[T(parseInt(e[1],16)),T(parseInt(e[2],16)),T(parseInt(e[3],16)),1]}{const e=N.exec(t);if(e)return[T(17*parseInt(e[1],16)),T(17*parseInt(e[2],16)),T(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function V(t){return.199*t[0]+.687*t[1]+.114*t[2]}function F(t){const e=$(t);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:V(e)>160?"black":"white"}}class D{constructor(){this.h=[]}l(t,e,i){const s={o:t,_:e,u:!0===i};this.h.push(s)}v(t){const e=this.h.findIndex(e=>t===e.o);e>-1&&this.h.splice(e,1)}p(t){this.h=this.h.filter(e=>e._!==t)}m(t,e,i){const s=[...this.h];this.h=this.h.filter(t=>!t.u),s.forEach(s=>s.o(t,e,i))}M(){return this.h.length>0}S(){this.h=[]}}function A(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&Object.prototype.hasOwnProperty.call(i,e)&&!["__proto__","constructor","prototype"].includes(e)&&("object"!=typeof i[e]||void 0===t[e]||Array.isArray(i[e])?t[e]=i[e]:A(t[e],i[e]));return t}function B(t){return"number"==typeof t&&isFinite(t)}function W(t){return"number"==typeof t&&t%1==0}function j(t){return"string"==typeof t}function I(t){return"boolean"==typeof t}function U(t){const e=t;if(!e||"object"!=typeof e)return e;let i,s,n;for(s in i=Array.isArray(e)?[]:{},e)e.hasOwnProperty(s)&&(n=e[s],i[s]=n&&"object"==typeof n?U(n):n);return i}function H(t){return null!==t}function K(t){return null===t?void 0:t}const q="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function X(t,e,i){return void 0===e&&(e=q),`${i=void 0!==i?`${i} `:""}${t}px ${e}`}class G{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=t}W(){const t=this.k,e=this.j(),i=this.H();return t.P===e&&t.D===i||(t.P=e,t.D=i,t.R=X(e,i),t.L=2.5/12*e,t.B=t.L,t.A=e/12*t.T,t.I=e/12*t.T,t.N=0),t.V=this.$(),t.O=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class J{constructor(){this.Y=[]}Z(t){this.Y=t}X(t,e,i){this.Y.forEach(s=>{s.X(t,e,i)})}}class Q{X(t,e,i){t.useBitmapCoordinateSpace(t=>this.K(t,e,i))}}class Y extends Q{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(null===this.G||null===this.G.tt)return;const s=this.G.tt,n=this.G,r=Math.max(1,Math.floor(e))%2/2,o=o=>{t.beginPath();for(let h=s.to-1;h>=s.from;--h){const s=n.it[h],l=Math.round(s.nt*e)+r,a=s.st*i,c=o*i+r;t.moveTo(l,a),t.arc(l,a,c,0,2*Math.PI)}t.fill()};n.et>0&&(t.fillStyle=n.rt,o(n.ht+n.et)),t.fillStyle=n.lt,o(n.ht)}}function Z(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const tt={from:0,to:1};class et{constructor(t,e){this.ut=new J,this.ct=[],this.dt=[],this.ft=!0,this.F=t,this.vt=e,this.ut.Z(this.ct)}bt(t){const e=this.F.wt();e.length!==this.ct.length&&(this.dt=e.map(Z),this.ct=this.dt.map(t=>{const e=new Y;return e.J(t),e}),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const t=2===this.vt.W().mode,e=this.F.wt(),i=this.vt.xt(),s=this.F.St();e.forEach((e,n)=>{var r;const o=this.dt[n],h=e.kt(i);if(t||null===h||!e.yt())return void(o.tt=null);const l=_(e.Ct());o.lt=h.Tt,o.ht=h.ht,o.et=h.Pt,o.it[0]._t=h._t,o.it[0].st=e.Dt().Rt(h._t,l.Vt),o.rt=null!==(r=h.Ot)&&void 0!==r?r:this.F.Bt(o.it[0].st/e.Dt().At()),o.it[0].ot=i,o.it[0].nt=s.It(i),o.tt=tt})}}class it extends Q{constructor(t){super(),this.zt=t}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.zt)return;const n=this.zt.Lt.yt,r=this.zt.Et.yt;if(!n&&!r)return;const o=Math.round(this.zt.nt*i),h=Math.round(this.zt.st*s);t.lineCap="butt",n&&o>=0&&(t.lineWidth=Math.floor(this.zt.Lt.et*i),t.strokeStyle=this.zt.Lt.V,t.fillStyle=this.zt.Lt.V,C(t,this.zt.Lt.Nt),function(t,e,i,s){t.beginPath();const n=t.lineWidth%2?.5:0;t.moveTo(e+n,0),t.lineTo(e+n,s),t.stroke()}(t,o,0,e.height)),r&&h>=0&&(t.lineWidth=Math.floor(this.zt.Et.et*s),t.strokeStyle=this.zt.Et.V,t.fillStyle=this.zt.Et.V,C(t,this.zt.Et.Nt),M(t,h,0,e.width))}}class st{constructor(t){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,V:"",yt:!1},Et:{et:1,Nt:0,V:"",yt:!1},nt:0,st:0},this.Wt=new it(this.Ft),this.jt=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const t=this.jt.yt(),e=_(this.jt.Ht()),i=e.$t().W().crosshair,s=this.Ft;if(2===i.mode)return s.Et.yt=!1,void(s.Lt.yt=!1);s.Et.yt=t&&this.jt.Ut(e),s.Lt.yt=t&&this.jt.qt(),s.Et.et=i.horzLine.width,s.Et.Nt=i.horzLine.style,s.Et.V=i.horzLine.color,s.Lt.et=i.vertLine.width,s.Lt.Nt=i.vertLine.style,s.Lt.V=i.vertLine.color,s.nt=this.jt.Yt(),s.st=this.jt.Zt()}}function nt(t,e,i,s,n,r){t.fillRect(e+r,i,s-2*r,r),t.fillRect(e+r,i+n-r,s-2*r,r),t.fillRect(e,i,r,n),t.fillRect(e+s-r,i,r,n)}function rt(t,e,i,s,n,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(e,i,s,n),t.restore()}function ot(t,e,i,s,n,r){t.beginPath(),t.roundRect?t.roundRect(e,i,s,n,r):(t.lineTo(e+s-r[1],i),0!==r[1]&&t.arcTo(e+s,i,e+s,i+r[1],r[1]),t.lineTo(e+s,i+n-r[2]),0!==r[2]&&t.arcTo(e+s,i+n,e+s-r[2],i+n,r[2]),t.lineTo(e+r[3],i+n),0!==r[3]&&t.arcTo(e,i+n,e,i+n-r[3],r[3]),t.lineTo(e,i+r[0]),0!==r[0]&&t.arcTo(e,i,e+r[0],i,r[0]))}function ht(t,e,i,s,n,r,o=0,h=[0,0,0,0],l=""){if(t.save(),!o||!l||l===r)return ot(t,e,i,s,n,h),t.fillStyle=r,t.fill(),void t.restore();const a=o/2;var c;ot(t,e+a,i+a,s-o,n-o,(c=-a,h.map(t=>0===t?t:t+c))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==l&&(t.lineWidth=o,t.strokeStyle=l,t.closePath(),t.stroke()),t.restore()}function lt(t,e,i,s,n,r,o){t.save(),t.globalCompositeOperation="copy";const h=t.createLinearGradient(0,0,0,n);h.addColorStop(0,r),h.addColorStop(1,o),t.fillStyle=h,t.fillRect(e,i,s,n),t.restore()}class at{constructor(t,e){this.J(t,e)}J(t,e){this.zt=t,this.Xt=e}At(t,e){return this.zt.yt?t.P+t.L+t.B:0}X(t,e,i,s){if(!this.zt.yt||0===this.zt.Kt.length)return;const n=this.zt.V,r=this.Xt.t,o=t.useBitmapCoordinateSpace(t=>{const o=t.context;o.font=e.R;const h=this.Gt(t,e,i,s),l=h.Jt;return h.Qt?ht(o,l.ti,l.ii,l.ni,l.si,r,l.ei,[l.ht,0,0,l.ht],r):ht(o,l.ri,l.ii,l.ni,l.si,r,l.ei,[0,l.ht,l.ht,0],r),this.zt.hi&&(o.fillStyle=n,o.fillRect(l.ri,l.li,l.ai-l.ri,l.oi)),this.zt._i&&(o.fillStyle=e.O,o.fillRect(h.Qt?l.ui-l.ei:0,l.ii,l.ei,l.ci-l.ii)),h});t.useMediaCoordinateSpace(({context:t})=>{const i=o.di;t.font=e.R,t.textAlign=o.Qt?"right":"left",t.textBaseline="middle",t.fillStyle=n,t.fillText(this.zt.Kt,i.fi,(i.ii+i.ci)/2+i.pi)})}Gt(t,e,i,s){var n;const{context:r,bitmapSize:o,mediaSize:h,horizontalPixelRatio:l,verticalPixelRatio:a}=t,c=this.zt.hi||!this.zt.mi?e.T:0,u=this.zt.bi?e.C:0,d=e.L+this.Xt.wi,f=e.B+this.Xt.gi,m=e.A,p=e.I,g=this.zt.Kt,v=e.P,b=i.Mi(r,g),w=Math.ceil(i.xi(r,g)),y=v+d+f,S=e.C+m+p+w+c,C=Math.max(1,Math.floor(a));let M=Math.round(y*a);M%2!=C%2&&(M+=1);const E=u>0?Math.max(1,Math.floor(u*l)):0,x=Math.round(S*l),_=Math.round(c*l),z=null!==(n=this.Xt.Si)&&void 0!==n?n:this.Xt.ki,k=Math.round(z*a)-Math.floor(.5*a),T=Math.floor(k+C/2-M/2),R=T+M,N="right"===s,L=N?h.width-u:u,O=N?o.width-E:E;let P,$,V;return N?(P=O-x,$=O-_,V=L-c-m-u):(P=O+x,$=O+_,V=L+c+m),{Qt:N,Jt:{ii:T,li:k,ci:R,ni:x,si:M,ht:2*l,ei:E,ti:P,ri:O,ai:$,oi:C,ui:o.width},di:{ii:T/a,ci:R/a,fi:V,pi:b}}}}class ct{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Kt:"",yt:!1,hi:!0,mi:!1,Ot:"",V:"#FFF",_i:!1,bi:!1},this.Ti={Kt:"",yt:!1,hi:!1,mi:!0,Ot:"",V:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(t||at)(this.Ci,this.yi),this.Ri=new(t||at)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(t,e=!1){return Math.max(this.Pi.At(t,e),this.Ri.At(t,e))}Vi(){return this.yi.Si||0}Oi(t){this.yi.Si=t}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(t){return this.Di(),this.Ci.hi=this.Ci.hi&&t.W().ticksVisible,this.Ti.hi=this.Ti.hi&&t.W().ticksVisible,this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Pi}Ii(){return this.Di(),this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Ri}Di(){this.ft&&(this.Ci.hi=!0,this.Ti.hi=!1,this.zi(this.Ci,this.Ti,this.yi))}}class ut extends ct{constructor(t,e,i){super(),this.jt=t,this.Li=e,this.Ei=i}zi(t,e,i){if(t.yt=!1,2===this.jt.W().mode)return;const s=this.jt.W().horzLine;if(!s.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||null===n)return;const r=F(s.labelBackgroundColor);i.t=r.t,t.V=r.i;const o=2/12*this.Li.P();i.wi=o,i.gi=o;const h=this.Ei(this.Li);i.ki=h.ki,t.Kt=this.Li.Fi(h._t,n),t.yt=!0}}const dt=/[1-9]/g;class ft{constructor(){this.zt=null}J(t){this.zt=t}X(t,e){if(null===this.zt||!1===this.zt.yt||0===this.zt.Kt.length)return;const i=t.useMediaCoordinateSpace(({context:t})=>(t.font=e.R,Math.round(e.Wi.xi(t,_(this.zt).Kt,dt))));if(i<=0)return;const s=e.ji,n=i+2*s,r=n/2,o=this.zt.Hi;let h=this.zt.ki,l=Math.floor(h-r)+.5;l<0?(h+=Math.abs(0-l),l=Math.floor(h-r)+.5):l+n>o&&(h-=Math.abs(o-(l+n)),l=Math.floor(h-r)+.5);const a=l+n,c=Math.ceil(0+e.C+e.T+e.L+e.P+e.B);t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{const n=_(this.zt);t.fillStyle=n.t;const r=Math.round(l*i),o=Math.round(0*s),h=Math.round(a*i),u=Math.round(c*s),d=Math.round(2*i);if(t.beginPath(),t.moveTo(r,o),t.lineTo(r,u-d),t.arcTo(r,u,r+d,u,d),t.lineTo(h-d,u),t.arcTo(h,u,h,u-d,d),t.lineTo(h,o),t.fill(),n.hi){const r=Math.round(n.ki*i),h=o,l=Math.round((h+e.T)*s);t.fillStyle=n.V;const a=Math.max(1,Math.floor(i)),c=Math.floor(.5*i);t.fillRect(r-c,h,a,l-h)}}),t.useMediaCoordinateSpace(({context:t})=>{const i=_(this.zt),n=0+e.C+e.T+e.L+e.P/2;t.font=e.R,t.textAlign="left",t.textBaseline="middle",t.fillStyle=i.V;const r=e.Wi.Mi(t,"Apr0");t.translate(l+s,n+r),t.fillText(i.Kt,0,0)})}}class mt{constructor(t,e,i){this.ft=!0,this.Wt=new ft,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=t,this.$i=e,this.Ei=i}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const t=this.Ft;if(t.yt=!1,2===this.vt.W().mode)return;const e=this.vt.W().vertLine;if(!e.labelVisible)return;const i=this.$i.St();if(i.Ni())return;t.Hi=i.Hi();const s=this.Ei();if(null===s)return;t.ki=s.ki;const n=i.Ui(this.vt.xt());t.Kt=i.qi(_(n)),t.yt=!0;const r=F(e.labelBackgroundColor);t.t=r.t,t.V=r.i,t.hi=i.W().ticksVisible}}class pt{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(t){this.Zi=t}Dt(){return this.Yi}Gi(t){this.Yi=t}Ji(t){return[]}Qi(){return[]}yt(){return!0}}var gt;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden"}(gt||(gt={}));class vt extends pt{constructor(t,e){super(),this.tn=null,this.nn=NaN,this.sn=0,this.en=!0,this.rn=new Map,this.hn=!1,this.ln=NaN,this.an=NaN,this._n=NaN,this.un=NaN,this.$i=t,this.cn=e,this.dn=new et(t,this),this.fn=((t,e)=>i=>{const s=e(),n=t();if(i===_(this.tn).vn())return{_t:n,ki:s};{const t=_(i.Ct());return{_t:i.pn(s,t),ki:s}}})(()=>this.nn,()=>this.an);const i=((t,e)=>()=>{const i=this.$i.St().mn(t()),s=e();return i&&Number.isFinite(s)?{ot:i,ki:s}:null})(()=>this.sn,()=>this.Yt());this.bn=new mt(this,t,i),this.wn=new st(this)}W(){return this.cn}gn(t,e){this._n=t,this.un=e}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(t,e,i){this.hn||(this.hn=!0),this.en=!0,this.yn(t,e,i)}xt(){return this.sn}Yt(){return this.ln}Zt(){return this.an}yt(){return this.en}Cn(){this.en=!1,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn()}Pn(t){return null!==this.tn?[this.wn,this.dn]:[]}Ut(t){return t===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(t,e){this.en&&this.tn===t||this.rn.clear();const i=[];return this.tn===t&&i.push(this.Dn(this.rn,e,this.fn)),i}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach(t=>t.bt()),this.bn.bt(),this.dn.bt()}On(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,e,i){this.Bn(t,e,i)&&this.Vn()}Bn(t,e,i){const s=this.ln,n=this.an,r=this.nn,o=this.sn,h=this.tn,l=this.On(i);this.sn=t,this.ln=isNaN(t)?NaN:this.$i.St().It(t),this.tn=i;const a=null!==l?l.Ct():null;return null!==l&&null!==a?(this.nn=e,this.an=l.Rt(e,a)):(this.nn=NaN,this.an=NaN),s!==this.ln||n!==this.an||o!==this.sn||r!==this.nn||h!==this.tn}Tn(){const t=this.$i.wt().map(t=>t.In().An()).filter(H),e=0===t.length?null:Math.max(...t);this.sn=null!==e?e:NaN}Dn(t,e,i){let s=t.get(e);return void 0===s&&(s=new ut(this,e,i),t.set(e,s)),s}}function bt(t){return"left"===t||"right"===t}class wt{constructor(t){this.zn=new Map,this.Ln=[],this.En=t}Nn(t,e){const i=function(t,e){return void 0===t?e:{Fn:Math.max(t.Fn,e.Fn),Wn:t.Wn||e.Wn}}(this.zn.get(t),e);this.zn.set(t,i)}jn(){return this.En}Hn(t){const e=this.zn.get(t);return void 0===e?{Fn:this.En}:{Fn:Math.max(this.En,e.Fn),Wn:e.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(t){this.Un(),this.Ln=[{qn:1,Vt:t}]}Zn(t){this.Xn(),this.Ln.push({qn:5,Vt:t})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(t){this.Un(),this.Ln.push({qn:2,Vt:t})}Jn(t){this.Un(),this.Ln.push({qn:3,Vt:t})}Qn(){return this.Ln}ts(t){for(const e of t.Ln)this.ns(e);this.En=Math.max(this.En,t.En),t.zn.forEach((t,e)=>{this.Nn(e,t)})}static ss(){return new wt(2)}static es(){return new wt(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Vt);break;case 2:this.Gn(t.Vt);break;case 3:this.Jn(t.Vt);break;case 4:this.Kn();break;case 5:this.Zn(t.Vt);break;case 6:this.Xn()}}Xn(){const t=this.Ln.findIndex(t=>5===t.qn);-1!==t&&this.Ln.splice(t,1)}}function yt(t,e){if(!B(t))return"n/a";if(!W(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return 0===e?t.toString():("0000000000000000"+t.toString()).slice(-e)}class St{constructor(t,e){if(e||(e=1),B(t)&&W(t)||(t=100),t<0)throw new TypeError("invalid base");this.Li=t,this.rs=e,this.hs()}format(t){const e=t<0?"−":"";return t=Math.abs(t),e+this.ls(t)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this._s++}}ls(t){const e=this.Li/this.rs;let i=Math.floor(t),s="";const n=void 0!==this._s?this._s:NaN;if(e>1){let r=+(Math.round(t*e)-i*e).toFixed(this._s);r>=e&&(r-=e,i+=1),s="."+yt(+r.toFixed(this._s)*this.rs,n)}else i=Math.round(i*e)/e,n>0&&(s="."+yt(0,n));return i.toFixed(0)+s}}class Ct extends St{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class Mt{constructor(t){this.us=t}format(t){let e="";return t<0&&(e="-",t=-t),t<995?e+this.cs(t):t<999995?e+this.cs(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),e+this.cs(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),e+this.cs(t/1e9)+"B")}cs(t){let e;const i=Math.pow(10,this.us);return e=(t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.us).replace(/\.?0+$/,""):String(t),e.replace(/(\.[1-9]*)0+$/,(t,e)=>e)}}function Et(t,e,i,s,n,r,o){if(0===e.length||s.from>=e.length||s.to<=0)return;const{context:h,horizontalPixelRatio:l,verticalPixelRatio:a}=t,c=e[s.from];let u=r(t,c),d=c;if(s.to-s.from<2){const e=n/2;h.beginPath();const i={nt:c.nt-e,st:c.st},s={nt:c.nt+e,st:c.st};h.moveTo(i.nt*l,i.st*a),h.lineTo(s.nt*l,s.st*a),o(t,u,i,s)}else{const n=(e,i)=>{o(t,u,d,i),h.beginPath(),u=e,d=i};let f=d;h.beginPath(),h.moveTo(c.nt*l,c.st*a);for(let o=s.from+1;o<s.to;++o){f=e[o];const s=r(t,f);switch(i){case 0:h.lineTo(f.nt*l,f.st*a);break;case 1:h.lineTo(f.nt*l,e[o-1].st*a),s!==u&&(n(s,f),h.lineTo(f.nt*l,e[o-1].st*a)),h.lineTo(f.nt*l,f.st*a);break;case 2:{const[t,i]=kt(e,o-1,o);h.bezierCurveTo(t.nt*l,t.st*a,i.nt*l,i.st*a,f.nt*l,f.st*a);break}}1!==i&&s!==u&&(n(s,f),h.moveTo(f.nt*l,f.st*a))}(d!==f||d===f&&1===i)&&o(t,u,d,f)}}const xt=6;function _t(t,e){return{nt:t.nt-e.nt,st:t.st-e.st}}function zt(t,e){return{nt:t.nt/e,st:t.st/e}}function kt(t,e,i){const s=Math.max(0,e-1),n=Math.min(t.length-1,i+1);var r,o;return[(r=t[e],o=zt(_t(t[i],t[s]),xt),{nt:r.nt+o.nt,st:r.st+o.st}),_t(t[i],zt(_t(t[n],t[e]),xt))]}function Tt(t,e,i,s,n){const{context:r,horizontalPixelRatio:o,verticalPixelRatio:h}=e;r.lineTo(n.nt*o,t*h),r.lineTo(s.nt*o,t*h),r.closePath(),r.fillStyle=i,r.fill()}class Rt extends Q{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){var e;if(null===this.G)return;const{it:i,tt:s,ds:n,et:r,Nt:o,fs:h}=this.G,l=null!==(e=this.G.vs)&&void 0!==e?e:this.G.ps?0:t.mediaSize.height;if(null===s)return;const a=t.context;a.lineCap="butt",a.lineJoin="round",a.lineWidth=r,C(a,o),a.lineWidth=1,Et(t,i,h,s,n,this.bs.bind(this),Tt.bind(null,l))}}function Nt(t,e,i){return Math.min(Math.max(t,e),i)}function Lt(t,e,i){return e-t<=i}function Ot(t){const e=Math.ceil(t);return e%2==0?e-1:e}class Pt{ws(t,e){const i=this.gs,{Ms:s,xs:n,Ss:r,ks:o,ys:h,vs:l}=e;if(void 0===this.Cs||void 0===i||i.Ms!==s||i.xs!==n||i.Ss!==r||i.ks!==o||i.vs!==l||i.ys!==h){const i=t.context.createLinearGradient(0,0,0,h);if(i.addColorStop(0,s),null!=l){const e=Nt(l*t.verticalPixelRatio/h,0,1);i.addColorStop(e,n),i.addColorStop(e,r)}i.addColorStop(1,o),this.Cs=i,this.gs=e}return this.Cs}}class $t extends Rt{constructor(){super(...arguments),this.Ts=new Pt}bs(t,e){return this.Ts.ws(t,{Ms:e.Ps,xs:"",Ss:"",ks:e.Rs,ys:t.bitmapSize.height})}}function Vt(t,e){const i=t.context;i.strokeStyle=e,i.stroke()}class Ft extends Q{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){if(null===this.G)return;const{it:e,tt:i,ds:s,fs:n,et:r,Nt:o,Ds:h}=this.G;if(null===i)return;const l=t.context;l.lineCap="butt",l.lineWidth=r*t.verticalPixelRatio,C(l,o),l.lineJoin="round";const a=this.Vs.bind(this);void 0!==n&&Et(t,e,n,i,s,a,Vt),h&&function(t,e,i,s,n){const{horizontalPixelRatio:r,verticalPixelRatio:o,context:h}=t;let l=null;const a=Math.max(1,Math.floor(r))%2/2,c=i*o+a;for(let i=s.to-1;i>=s.from;--i){const s=e[i];if(s){const e=n(t,s);e!==l&&(h.beginPath(),null!==l&&h.fill(),h.fillStyle=e,l=e);const i=Math.round(s.nt*r)+a,u=s.st*o;h.moveTo(i,u),h.arc(i,u,c,0,2*Math.PI)}}h.fill()}(t,e,h,i,a)}}class Dt extends Ft{Vs(t,e){return e.lt}}function At(t,e,i,s,n=0,r=e.length){let o=r-n;for(;0<o;){const r=o>>1,h=n+r;s(e[h],i)===t?(n=h+1,o-=r+1):o=r}return n}const Bt=At.bind(null,!0),Wt=At.bind(null,!1);function jt(t,e){return t.ot<e}function It(t,e){return e<t.ot}function Ut(t,e,i){const s=e.Os(),n=e.ui(),r=Bt(t,s,jt),o=Wt(t,n,It);if(!i)return{from:r,to:o};let h=r,l=o;return r>0&&r<t.length&&t[r].ot>=s&&(h=r-1),o>0&&o<t.length&&t[o-1].ot<=n&&(l=o+1),{from:h,to:l}}class Ht{constructor(t,e,i){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=t,this.Ns=e,this.Fs=i}bt(t){this.Bs=!0,"data"===t&&(this.As=!0),"options"===t&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),null===this.Ls?null:this.js):null}Hs(){this.zs=this.zs.map(t=>Object.assign(Object.assign({},t),this.Es.Us().$s(t.ot)))}qs(){this.Ls=null}Ws(){this.As&&(this.Ys(),this.As=!1),this.Is&&(this.Hs(),this.Is=!1),this.Bs&&(this.Zs(),this.Bs=!1)}Zs(){const t=this.Es.Dt(),e=this.Ns.St();if(this.qs(),e.Ni()||t.Ni())return;const i=e.Xs();if(null===i)return;if(0===this.Es.In().Ks())return;const s=this.Es.Ct();null!==s&&(this.Ls=Ut(this.zs,i,this.Fs),this.Gs(t,e,s.Vt),this.Js())}}class Kt extends Ht{constructor(t,e){super(t,e,!0)}Gs(t,e,i){e.Qs(this.zs,K(this.Ls)),t.te(this.zs,i,K(this.Ls))}ie(t,e){return{ot:t,_t:e,nt:NaN,st:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map(e=>{const i=e.Vt[3];return this.se(e.ee,i,t)})}}class qt extends Kt{constructor(t,e){super(t,e),this.js=new J,this.re=new $t,this.he=new Dt,this.js.Z([this.re,this.he])}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.W();this.re.J({fs:t.lineType,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,vs:null,ps:t.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:t.lineVisible?t.lineType:void 0,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0})}}class Xt extends Q{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(t){this.zt=t}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;this.ae=this._e(e),this.ae>=2&&Math.max(1,Math.floor(e))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(e)):this.ae;let s=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*e);for(let r=this.zt.tt.from;r<this.zt.tt.to;++r){const o=this.zt.In[r];s!==o.ce&&(t.fillStyle=o.ce,s=o.ce);const h=Math.floor(.5*this.oe),l=Math.round(o.nt*e),a=l-h,c=this.oe,u=a+c-1,d=Math.min(o.de,o.fe),f=Math.max(o.de,o.fe),m=Math.round(d*i)-h,p=Math.round(f*i)+h,g=Math.max(p-m,this.oe);t.fillRect(a,m,c,g);const v=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const e=l-v;let s=Math.max(m,Math.round(o.pe*i)-h),n=s+c-1;n>m+g-1&&(n=m+g-1,s=n-c+1),t.fillRect(e,s,a-e,n-s+1)}const e=l+v;let s=Math.max(m,Math.round(o.me*i)-h),n=s+c-1;n>m+g-1&&(n=m+g-1,s=n-c+1),t.fillRect(u+1,s,e-u,n-s+1)}}}_e(t){const e=Math.floor(t);return Math.max(e,Math.floor(function(t,e){return Math.floor(.3*t*e)}(_(this.zt).le,t)))}}class Gt extends Ht{constructor(t,e){super(t,e,!1)}Gs(t,e,i){e.Qs(this.zs,K(this.Ls)),t.be(this.zs,i,K(this.Ls))}we(t,e,i){return{ot:t,ge:e.Vt[0],Me:e.Vt[1],xe:e.Vt[2],Se:e.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map(e=>this.se(e.ee,e,t))}}class Jt extends Gt{constructor(){super(...arguments),this.js=new Xt}se(t,e,i){return Object.assign(Object.assign({},this.we(t,e,i)),i.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:t.openVisible,ue:t.thinBars,tt:this.Ls})}}class Qt extends Rt{constructor(){super(...arguments),this.Ts=new Pt}bs(t,e){const i=this.G;return this.Ts.ws(t,{Ms:e.ke,xs:e.ye,Ss:e.Ce,ks:e.Te,ys:t.bitmapSize.height,vs:i.vs})}}class Yt extends Ft{constructor(){super(...arguments),this.Pe=new Pt}Vs(t,e){const i=this.G;return this.Pe.ws(t,{Ms:e.Re,xs:e.Re,Ss:e.De,ks:e.De,ys:t.bitmapSize.height,vs:i.vs})}}class Zt extends Kt{constructor(t,e){super(t,e),this.js=new J,this.Ve=new Qt,this.Oe=new Yt,this.js.Z([this.Ve,this.Oe])}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.Ct();if(null===t)return;const e=this.Es.W(),i=this.Es.Dt().Rt(e.baseValue.price,t.Vt),s=this.Ns.St().le();this.Ve.J({it:this.zs,et:e.lineWidth,Nt:e.lineStyle,fs:e.lineType,vs:i,ps:!1,tt:this.Ls,ds:s}),this.Oe.J({it:this.zs,et:e.lineWidth,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,vs:i,tt:this.Ls,ds:s})}}class te extends Q{constructor(){super(...arguments),this.zt=null,this.ae=0}J(t){this.zt=t}K(t){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;const{horizontalPixelRatio:e}=t;this.ae=function(t,e){if(t>=2.5&&t<=4)return Math.floor(3*e);const i=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.floor(t*i*e),n=Math.floor(t*e),r=Math.min(s,n);return Math.max(Math.floor(e),r)}(this.zt.le,e),this.ae>=2&&Math.floor(e)%2!=this.ae%2&&this.ae--;const i=this.zt.In;this.zt.Be&&this.Ae(t,i,this.zt.tt),this.zt._i&&this.Ie(t,i,this.zt.tt);const s=this.ze(e);(!this.zt._i||this.ae>2*s)&&this.Le(t,i,this.zt.tt)}Ae(t,e,i){if(null===this.zt)return;const{context:s,horizontalPixelRatio:n,verticalPixelRatio:r}=t;let o="",h=Math.min(Math.floor(n),Math.floor(this.zt.le*n));h=Math.max(Math.floor(n),Math.min(h,this.ae));const l=Math.floor(.5*h);let a=null;for(let t=i.from;t<i.to;t++){const i=e[t];i.Ee!==o&&(s.fillStyle=i.Ee,o=i.Ee);const c=Math.round(Math.min(i.pe,i.me)*r),u=Math.round(Math.max(i.pe,i.me)*r),d=Math.round(i.de*r),f=Math.round(i.fe*r);let m=Math.round(n*i.nt)-l;const p=m+h-1;null!==a&&(m=Math.max(a+1,m),m=Math.min(m,p));const g=p-m+1;s.fillRect(m,d,g,c-d),s.fillRect(m,u+1,g,f-u),a=p}}ze(t){let e=Math.floor(1*t);this.ae<=2*e&&(e=Math.floor(.5*(this.ae-1)));const i=Math.max(Math.floor(t),e);return this.ae<=2*i?Math.max(Math.floor(t),Math.floor(1*t)):i}Ie(t,e,i){if(null===this.zt)return;const{context:s,horizontalPixelRatio:n,verticalPixelRatio:r}=t;let o="";const h=this.ze(n);let l=null;for(let t=i.from;t<i.to;t++){const i=e[t];i.Ne!==o&&(s.fillStyle=i.Ne,o=i.Ne);let a=Math.round(i.nt*n)-Math.floor(.5*this.ae);const c=a+this.ae-1,u=Math.round(Math.min(i.pe,i.me)*r),d=Math.round(Math.max(i.pe,i.me)*r);if(null!==l&&(a=Math.max(l+1,a),a=Math.min(a,c)),this.zt.le*n>2*h)nt(s,a,u,c-a+1,d-u+1,h);else{const t=c-a+1;s.fillRect(a,u,t,d-u+1)}l=c}}Le(t,e,i){if(null===this.zt)return;const{context:s,horizontalPixelRatio:n,verticalPixelRatio:r}=t;let o="";const h=this.ze(n);for(let t=i.from;t<i.to;t++){const i=e[t];let l=Math.round(Math.min(i.pe,i.me)*r),a=Math.round(Math.max(i.pe,i.me)*r),c=Math.round(i.nt*n)-Math.floor(.5*this.ae),u=c+this.ae-1;if(i.ce!==o){const t=i.ce;s.fillStyle=t,o=t}this.zt._i&&(c+=h,l+=h,u-=h,a-=h),l>a||s.fillRect(c,l,u-c+1,a-l+1)}}}class ee extends Gt{constructor(){super(...arguments),this.js=new te}se(t,e,i){return Object.assign(Object.assign({},this.we(t,e,i)),i.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:t.wickVisible,_i:t.borderVisible,tt:this.Ls})}}class ie{constructor(t,e){this.Fe=t,this.Li=e}X(t,e,i){this.Fe.draw(t,this.Li,e,i)}}class se extends Ht{constructor(t,e,i){super(t,e,!1),this.wn=i,this.js=new ie(this.wn.renderer(),e=>{const i=t.Ct();return null===i?null:t.Dt().Rt(e,i.Vt)})}We(t){return this.wn.priceValueBuilder(t)}je(t){return this.wn.isWhitespace(t)}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map(e=>Object.assign(Object.assign({ot:e.ee,nt:NaN},t.$s(e.ee)),{He:e.$e}))}Gs(t,e){e.Qs(this.zs,K(this.Ls))}Js(){this.wn.update({bars:this.zs.map(ne),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function ne(t){return{x:t.nt,time:t.ot,originalData:t.He,barColor:t.ce}}class re extends Q{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(t){this.zt=t,this.Ue=[]}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.Ue.length||this.qe(e);const s=Math.max(1,Math.floor(i)),n=Math.round(this.zt.Ye*i)-Math.floor(s/2),r=n+s;for(let e=this.zt.tt.from;e<this.zt.tt.to;e++){const o=this.zt.it[e],h=this.Ue[e-this.zt.tt.from],l=Math.round(o.st*i);let a,c;t.fillStyle=o.ce,l<=n?(a=l,c=r):(a=n,c=l-Math.floor(s/2)+s),t.fillRect(h.Os,a,h.ui-h.Os+1,c-a)}}qe(t){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return void(this.Ue=[]);const e=Math.ceil(this.zt.le*t)<=1?0:Math.max(1,Math.floor(t)),i=Math.round(this.zt.le*t)-e;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let e=this.zt.tt.from;e<this.zt.tt.to;e++){const s=this.zt.it[e],n=Math.round(s.nt*t);let r,o;if(i%2){const t=(i-1)/2;r=n-t,o=n+t}else{const t=i/2;r=n-t,o=n+t-1}this.Ue[e-this.zt.tt.from]={Os:r,ui:o,Ze:n,Xe:s.nt*t,ot:s.ot}}for(let t=this.zt.tt.from+1;t<this.zt.tt.to;t++){const i=this.Ue[t-this.zt.tt.from],s=this.Ue[t-this.zt.tt.from-1];i.ot===s.ot+1&&i.Os-s.ui!==e+1&&(s.Ze>s.Xe?s.ui=i.Os-e-1:i.Os=s.ui+e+1)}let s=Math.ceil(this.zt.le*t);for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const e=this.Ue[t-this.zt.tt.from];e.ui<e.Os&&(e.ui=e.Os);const i=e.ui-e.Os+1;s=Math.min(i,s)}if(e>0&&s<4)for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const e=this.Ue[t-this.zt.tt.from];e.ui-e.Os+1>s&&(e.Ze>e.Xe?e.ui-=1:e.Os+=1)}}}class oe extends Kt{constructor(){super(...arguments),this.js=new re}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,_(this.Es.Ct()).Vt)};this.js.J(t)}}class he extends Kt{constructor(){super(...arguments),this.js=new Dt}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.W(),e={it:this.zs,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(e)}}const le=/[2-9]/g;class ae{constructor(t=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=t}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(t,e,i){return this.sr(t,e,i).width}Mi(t,e,i){const s=this.sr(t,e,i);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}sr(t,e,i){const s=i||le,n=String(e).replace(s,"0");if(this.tr.has(n))return x(this.tr.get(n)).er;if(this.Ke===this.ir){const t=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(t),this.Je++,this.Ke--}t.save(),t.textBaseline="middle";const r=t.measureText(n);return t.restore(),0===r.width&&e.length||(this.tr.set(n,{er:r,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),r}}class ce{constructor(t){this.hr=null,this.k=null,this.lr="right",this.ar=t}_r(t,e,i){this.hr=t,this.k=e,this.lr=i}X(t){null!==this.k&&null!==this.hr&&this.hr.X(t,this.k,this.ar,this.lr)}}class ue{constructor(t,e,i){this.ur=t,this.ar=new ae(50),this.cr=e,this.F=i,this.j=-1,this.Wt=new ce(this.ar)}gt(){const t=this.F.dr(this.cr);if(null===t)return null;const e=t.vr(this.cr)?t.pr():this.cr.Dt();if(null===e)return null;const i=t.mr(e);if("overlay"===i)return null;const s=this.F.br();return s.P!==this.j&&(this.j=s.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),s,i),this.Wt}}class de extends Q{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}wr(t,e){var i;if(!(null===(i=this.zt)||void 0===i?void 0:i.yt))return null;const{st:s,et:n,gr:r}=this.zt;return e>=s-n-7&&e<=s+n+7?{Mr:this.zt,gr:r}:null}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.zt)return;if(!1===this.zt.yt)return;const n=Math.round(this.zt.st*s);n<0||n>e.height||(t.lineCap="butt",t.strokeStyle=this.zt.V,t.lineWidth=Math.floor(this.zt.et*i),C(t,this.zt.Nt),M(t,n,0,e.width))}}class fe{constructor(t){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new de,this.ft=!0,this.Es=t,this.Ns=t.$t(),this.kr.J(this.Sr)}bt(){this.ft=!0}gt(){return this.Es.yt()?(this.ft&&(this.yr(),this.ft=!1),this.kr):null}}class me extends fe{constructor(t){super(t)}yr(){this.Sr.yt=!1;const t=this.Es.Dt(),e=t.Cr().Cr;if(2!==e&&3!==e)return;const i=this.Es.W();if(!i.baseLineVisible||!this.Es.yt())return;const s=this.Es.Ct();null!==s&&(this.Sr.yt=!0,this.Sr.st=t.Rt(s.Vt,s.Vt),this.Sr.V=i.baseLineColor,this.Sr.et=i.baseLineWidth,this.Sr.Nt=i.baseLineStyle)}}class pe extends Q{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}$e(){return this.zt}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){const s=this.zt;if(null===s)return;const n=Math.max(1,Math.floor(e)),r=n%2/2,o=Math.round(s.Xe.x*e)+r,h=s.Xe.y*i;t.fillStyle=s.Tr,t.beginPath();const l=Math.max(2,1.5*s.Pr)*e;t.arc(o,h,l,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.Rr,t.beginPath(),t.arc(o,h,s.ht*e,0,2*Math.PI,!1),t.fill(),t.lineWidth=n,t.strokeStyle=s.Dr,t.beginPath(),t.arc(o,h,s.ht*e+n/2,0,2*Math.PI,!1),t.stroke()}}const ge=[{Vr:0,Or:.25,Br:4,Ar:10,Ir:.25,zr:0,Lr:.4,Er:.8},{Vr:.25,Or:.525,Br:10,Ar:14,Ir:0,zr:0,Lr:.8,Er:0},{Vr:.525,Or:1,Br:14,Ar:14,Ir:0,zr:0,Lr:0,Er:0}];function ve(t,e,i,s){return function(t,e){if("transparent"===t)return t;const i=$(t),s=i[3];return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${e*s})`}(t,i+(s-i)*e)}function be(t,e){const i=t%2600/2600;let s;for(const t of ge)if(i>=t.Vr&&i<=t.Or){s=t;break}E(void 0!==s,"Last price animation internal logic error");const n=(i-s.Vr)/(s.Or-s.Vr);return{Rr:ve(e,n,s.Ir,s.zr),Dr:ve(e,n,s.Lr,s.Er),ht:(r=n,o=s.Br,h=s.Ar,o+(h-o)*r)};var r,o,h}class we{constructor(t){this.Wt=new pe,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=t}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),2===this.jr.W().lastPriceAnimation){const t=performance.now(),e=this.Wr-t;if(e>0)return void(e<650&&(this.Wr+=2600));this.Fr=t,this.Wr=t+2600}}bt(){this.ft=!0}Ur(){this.Nr=!0}yt(){return 0!==this.jr.W().lastPriceAnimation}qr(){switch(this.jr.W().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.Wr}}gt(){return this.ft?(this.Mt(),this.ft=!1,this.Nr=!1):this.Nr&&(this.Yr(),this.Nr=!1),this.Wt}Mt(){this.Wt.J(null);const t=this.jr.$t().St(),e=t.Xs(),i=this.jr.Ct();if(null===e||null===i)return;const s=this.jr.Zr(!0);if(s.Xr||!e.Kr(s.ee))return;const n={x:t.It(s.ee),y:this.jr.Dt().Rt(s._t,i.Vt)},r=s.V,o=this.jr.W().lineWidth,h=be(this.Gr(),r);this.Wt.J({Tr:r,Pr:o,Rr:h.Rr,Dr:h.Dr,ht:h.ht,Xe:n})}Yr(){const t=this.Wt.$e();if(null!==t){const e=be(this.Gr(),t.Tr);t.Rr=e.Rr,t.Dr=e.Dr,t.ht=e.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function ye(t,e){return Ot(Math.min(Math.max(t,12),30)*e)}function Se(t,e){switch(t){case"arrowDown":case"arrowUp":return ye(e,1);case"circle":return ye(e,.8);case"square":return ye(e,.7)}}function Ce(t){return function(t){const e=Math.ceil(t);return e%2!=0?e-1:e}(ye(t,1))}function Me(t){return Math.max(ye(t,.1),3)}function Ee(t,e,i){return e?t:i?Math.ceil(t/2):0}function xe(t,e,i,s,n){const r=Se("square",i),o=(r-1)/2,h=t-o,l=e-o;return s>=h&&s<=h+r&&n>=l&&n<=l+r}function _e(t,e,i,s){const n=(Se("arrowUp",s)-1)/2*i.Jr,r=(Ot(s/2)-1)/2*i.Jr;e.beginPath(),t?(e.moveTo(i.nt-n,i.st),e.lineTo(i.nt,i.st-n),e.lineTo(i.nt+n,i.st),e.lineTo(i.nt+r,i.st),e.lineTo(i.nt+r,i.st+n),e.lineTo(i.nt-r,i.st+n),e.lineTo(i.nt-r,i.st)):(e.moveTo(i.nt-n,i.st),e.lineTo(i.nt,i.st+n),e.lineTo(i.nt+n,i.st),e.lineTo(i.nt+r,i.st),e.lineTo(i.nt+r,i.st-n),e.lineTo(i.nt-r,i.st-n),e.lineTo(i.nt-r,i.st)),e.fill()}class ze extends Q{constructor(){super(...arguments),this.zt=null,this.ar=new ae,this.j=-1,this.H="",this.Qr=""}J(t){this.zt=t}_r(t,e){this.j===t&&this.H===e||(this.j=t,this.H=e,this.Qr=X(t,e),this.ar.nr())}wr(t,e){if(null===this.zt||null===this.zt.tt)return null;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const s=this.zt.it[i];if(Te(s,t,e))return{Mr:s.th,gr:s.gr}}return null}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i},s,n){if(null!==this.zt&&null!==this.zt.tt){t.textBaseline="middle",t.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const n=this.zt.it[s];void 0!==n.Kt&&(n.Kt.Hi=this.ar.xi(t,n.Kt.ih),n.Kt.At=this.j,n.Kt.nt=n.nt-n.Kt.Hi/2),ke(n,t,e,i)}}}}function ke(t,e,i,s){e.fillStyle=t.V,void 0!==t.Kt&&function(t,e,i,s,n,r){t.save(),t.scale(n,r),t.fillText(e,i,s),t.restore()}(e,t.Kt.ih,t.Kt.nt,t.Kt.st,i,s),function(t,e,i){if(0!==t.Ks){switch(t.nh){case"arrowDown":return void _e(!1,e,i,t.Ks);case"arrowUp":return void _e(!0,e,i,t.Ks);case"circle":return void function(t,e,i){const s=(Se("circle",i)-1)/2;t.beginPath(),t.arc(e.nt,e.st,s*e.Jr,0,2*Math.PI,!1),t.fill()}(e,i,t.Ks);case"square":return void function(t,e,i){const s=Se("square",i),n=(s-1)*e.Jr/2,r=e.nt-n,o=e.st-n;t.fillRect(r,o,s*e.Jr,s*e.Jr)}(e,i,t.Ks)}t.nh}}(t,e,function(t,e,i){const s=Math.max(1,Math.floor(e))%2/2;return{nt:Math.round(t.nt*e)+s,st:t.st*i,Jr:e}}(t,i,s))}function Te(t,e,i){return!(void 0===t.Kt||!function(t,e,i,s,n,r){const o=s/2;return n>=t&&n<=t+i&&r>=e-o&&r<=e+o}(t.Kt.nt,t.Kt.st,t.Kt.Hi,t.Kt.At,e,i))||function(t,e,i){if(0===t.Ks)return!1;switch(t.nh){case"arrowDown":case"arrowUp":return function(t,e,i,s,n,r){return xe(e,i,s,n,r)}(0,t.nt,t.st,t.Ks,e,i);case"circle":return function(t,e,i,s,n){const r=2+Se("circle",i)/2,o=t-s,h=e-n;return Math.sqrt(o*o+h*h)<=r}(t.nt,t.st,t.Ks,e,i);case"square":return xe(t.nt,t.st,t.Ks,e,i)}}(t,e,i)}function Re(t,e,i,s,n,r,o,h,l){const a=B(i)?i:i.Se,c=B(i)?i:i.Me,u=B(i)?i:i.xe,d=B(e.size)?Math.max(e.size,0):1,f=Ce(h.le())*d,m=f/2;switch(t.Ks=f,e.position){case"inBar":return t.st=o.Rt(a,l),void(void 0!==t.Kt&&(t.Kt.st=t.st+m+r+.6*n));case"aboveBar":return t.st=o.Rt(c,l)-m-s.sh,void 0!==t.Kt&&(t.Kt.st=t.st-m-.6*n,s.sh+=1.2*n),void(s.sh+=f+r);case"belowBar":return t.st=o.Rt(u,l)+m+s.eh,void 0!==t.Kt&&(t.Kt.st=t.st+m+r+.6*n,s.eh+=1.2*n),void(s.eh+=f+r)}e.position}class Ne{constructor(t,e){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new ze,this.jr=t,this.$i=e,this.zt={it:[],tt:null}}bt(t){this.ft=!0,this.hh=!0,"data"===t&&(this.rh=!0,this.oh=null)}gt(t){if(!this.jr.yt())return null;this.ft&&this._h();const e=this.$i.W().layout;return this.Wt._r(e.fontSize,e.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const t=this.$i.St().le(),e=Me(t),i=1.5*Ce(t)+2*e,s=this.fh();this.ah={above:Ee(i,s.aboveBar,s.inBar),below:Ee(i,s.belowBar,s.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return null===this.oh&&(this.oh=this.jr.dh().reduce((t,e)=>(t[e.position]||(t[e.position]=!0),t),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const t=this.jr.Dt(),e=this.$i.St(),i=this.jr.dh();this.rh&&(this.zt.it=i.map(t=>({ot:t.time,nt:0,st:0,Ks:0,nh:t.shape,V:t.color,th:t.th,gr:t.id,Kt:void 0})),this.rh=!1);const s=this.$i.W().layout;this.zt.tt=null;const n=e.Xs();if(null===n)return;const r=this.jr.Ct();if(null===r)return;if(0===this.zt.it.length)return;let o=NaN;const h=Me(e.le()),l={sh:h,eh:h};this.zt.tt=Ut(this.zt.it,n,!0);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const a=i[n];a.time!==o&&(l.sh=h,l.eh=h,o=a.time);const c=this.zt.it[n];c.nt=e.It(a.time),void 0!==a.text&&a.text.length>0&&(c.Kt={ih:a.text,nt:0,st:0,Hi:0,At:0});const u=this.jr.ph(a.time);null!==u&&Re(c,a,u,l,s.fontSize,h,t,e,r.Vt)}this.ft=!1}}class Le extends fe{constructor(t){super(t)}yr(){const t=this.Sr;t.yt=!1;const e=this.Es.W();if(!e.priceLineVisible||!this.Es.yt())return;const i=this.Es.Zr(0===e.priceLineSource);i.Xr||(t.yt=!0,t.st=i.ki,t.V=this.Es.mh(i.V),t.et=e.priceLineWidth,t.Nt=e.priceLineStyle)}}class Oe extends ct{constructor(t){super(),this.jt=t}zi(t,e,i){t.yt=!1,e.yt=!1;const s=this.jt;if(!s.yt())return;const n=s.W(),r=n.lastValueVisible,o=""!==s.bh(),h=0===n.seriesLastValueMode,l=s.Zr(!1);if(l.Xr)return;r&&(t.Kt=this.wh(l,r,h),t.yt=0!==t.Kt.length),(o||h)&&(e.Kt=this.gh(l,r,o,h),e.yt=e.Kt.length>0);const a=s.mh(l.V),c=F(a);i.t=c.t,i.ki=l.ki,e.Ot=s.$t().Bt(l.ki/s.Dt().At()),t.Ot=a,t.V=c.i,e.V=c.i}gh(t,e,i,s){let n="";const r=this.jt.bh();return i&&0!==r.length&&(n+=`${r} `),e&&s&&(n+=this.jt.Dt().Mh()?t.xh:t.Sh),n.trim()}wh(t,e,i){return e?i?this.jt.Dt().Mh()?t.Sh:t.xh:t.Kt:""}}function Pe(t,e,i,s){const n=Number.isFinite(e),r=Number.isFinite(i);return n&&r?t(e,i):n||r?n?e:i:s}class $e{constructor(t,e){this.kh=t,this.yh=e}Ch(t){return null!==t&&this.kh===t.kh&&this.yh===t.yh}Th(){return new $e(this.kh,this.yh)}Ph(){return this.kh}Rh(){return this.yh}Dh(){return this.yh-this.kh}Ni(){return this.yh===this.kh||Number.isNaN(this.yh)||Number.isNaN(this.kh)}ts(t){return null===t?this:new $e(Pe(Math.min,this.Ph(),t.Ph(),-1/0),Pe(Math.max,this.Rh(),t.Rh(),1/0))}Vh(t){if(!B(t))return;if(0===this.yh-this.kh)return;const e=.5*(this.yh+this.kh);let i=this.yh-e,s=this.kh-e;i*=t,s*=t,this.yh=e+i,this.kh=e+s}Oh(t){B(t)&&(this.yh+=t,this.kh+=t)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(t){return null===t?null:new $e(t.minValue,t.maxValue)}}class Ve{constructor(t,e){this.Ih=t,this.zh=e||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return null===this.Ih?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(t){return null===t?null:new Ve($e.Ah(t.priceRange),t.margins)}}class Fe extends fe{constructor(t,e){super(t),this.Nh=e}yr(){const t=this.Sr;t.yt=!1;const e=this.Nh.W();if(!this.Es.yt()||!e.lineVisible)return;const i=this.Nh.Fh();null!==i&&(t.yt=!0,t.st=i,t.V=e.color,t.et=e.lineWidth,t.Nt=e.lineStyle,t.gr=this.Nh.W().id)}}class De extends ct{constructor(t,e){super(),this.jr=t,this.Nh=e}zi(t,e,i){t.yt=!1,e.yt=!1;const s=this.Nh.W(),n=s.axisLabelVisible,r=""!==s.title,o=this.jr;if(!n||!o.yt())return;const h=this.Nh.Fh();if(null===h)return;r&&(e.Kt=s.title,e.yt=!0),e.Ot=o.$t().Bt(h/o.Dt().At()),t.Kt=this.Wh(s.price),t.yt=!0;const l=F(s.axisLabelColor||s.color);i.t=l.t;const a=s.axisLabelTextColor||l.i;t.V=a,e.V=a,i.ki=h}Wh(t){const e=this.jr.Ct();return null===e?"":this.jr.Dt().Fi(t,e.Vt)}}class Ae{constructor(t,e){this.jr=t,this.cn=e,this.jh=new Fe(t,this),this.ur=new De(t,this),this.Hh=new ue(this.ur,t,t.$t())}$h(t){A(this.cn,t),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const t=this.jr,e=t.Dt();if(t.$t().St().Ni()||e.Ni())return null;const i=t.Ct();return null===i?null:e.Rt(this.cn.price,i.Vt)}}class Be extends pt{constructor(t){super(),this.$i=t}$t(){return this.$i}}const We={Bar:(t,e,i,s)=>{var n;const r=e.upColor,o=e.downColor,h=_(t(i,s)),l=z(h.Vt[0])<=z(h.Vt[3]);return{ce:null!==(n=h.V)&&void 0!==n?n:l?r:o}},Candlestick:(t,e,i,s)=>{var n,r,o;const h=e.upColor,l=e.downColor,a=e.borderUpColor,c=e.borderDownColor,u=e.wickUpColor,d=e.wickDownColor,f=_(t(i,s)),m=z(f.Vt[0])<=z(f.Vt[3]);return{ce:null!==(n=f.V)&&void 0!==n?n:m?h:l,Ne:null!==(r=f.Ot)&&void 0!==r?r:m?a:c,Ee:null!==(o=f.Xh)&&void 0!==o?o:m?u:d}},Custom:(t,e,i,s)=>{var n;return{ce:null!==(n=_(t(i,s)).V)&&void 0!==n?n:e.color}},Area:(t,e,i,s)=>{var n,r,o,h;const l=_(t(i,s));return{ce:null!==(n=l.lt)&&void 0!==n?n:e.lineColor,lt:null!==(r=l.lt)&&void 0!==r?r:e.lineColor,Ps:null!==(o=l.Ps)&&void 0!==o?o:e.topColor,Rs:null!==(h=l.Rs)&&void 0!==h?h:e.bottomColor}},Baseline:(t,e,i,s)=>{var n,r,o,h,l,a;const c=_(t(i,s));return{ce:c.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:null!==(n=c.Re)&&void 0!==n?n:e.topLineColor,De:null!==(r=c.De)&&void 0!==r?r:e.bottomLineColor,ke:null!==(o=c.ke)&&void 0!==o?o:e.topFillColor1,ye:null!==(h=c.ye)&&void 0!==h?h:e.topFillColor2,Ce:null!==(l=c.Ce)&&void 0!==l?l:e.bottomFillColor1,Te:null!==(a=c.Te)&&void 0!==a?a:e.bottomFillColor2}},Line:(t,e,i,s)=>{var n,r;const o=_(t(i,s));return{ce:null!==(n=o.V)&&void 0!==n?n:e.color,lt:null!==(r=o.V)&&void 0!==r?r:e.color}},Histogram:(t,e,i,s)=>{var n;return{ce:null!==(n=_(t(i,s)).V)&&void 0!==n?n:e.color}}};class je{constructor(t){this.Kh=(t,e)=>void 0!==e?e.Vt:this.jr.In().Gh(t),this.jr=t,this.Jh=We[t.Qh()]}$s(t,e){return this.Jh(this.Kh,this.jr.W(),t,e)}}var Ie;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"}(Ie||(Ie={}));const Ue=30;class He{constructor(){this.tl=[],this.il=new Map,this.nl=new Map}sl(){return this.Ks()>0?this.tl[this.tl.length-1]:null}el(){return this.Ks()>0?this.rl(0):null}An(){return this.Ks()>0?this.rl(this.tl.length-1):null}Ks(){return this.tl.length}Ni(){return 0===this.Ks()}Kr(t){return null!==this.hl(t,0)}Gh(t){return this.ll(t)}ll(t,e=0){const i=this.hl(t,e);return null===i?null:Object.assign(Object.assign({},this.al(i)),{ee:this.rl(i)})}ne(){return this.tl}ol(t,e,i){if(this.Ni())return null;let s=null;for(const n of i)s=Ke(s,this._l(t,e,n));return s}J(t){this.nl.clear(),this.il.clear(),this.tl=t}rl(t){return this.tl[t].ee}al(t){return this.tl[t]}hl(t,e){const i=this.ul(t);if(null===i&&0!==e)switch(e){case-1:return this.cl(t);case 1:return this.dl(t);default:throw new TypeError("Unknown search mode")}return i}cl(t){let e=this.fl(t);return e>0&&(e-=1),e!==this.tl.length&&this.rl(e)<t?e:null}dl(t){const e=this.vl(t);return e!==this.tl.length&&t<this.rl(e)?e:null}ul(t){const e=this.fl(t);return e===this.tl.length||t<this.tl[e].ee?null:e}fl(t){return Bt(this.tl,t,(t,e)=>t.ee<e)}vl(t){return Wt(this.tl,t,(t,e)=>t.ee>e)}pl(t,e,i){let s=null;for(let n=t;n<e;n++){const t=this.tl[n].Vt[i];Number.isNaN(t)||(null===s?s={ml:t,bl:t}:(t<s.ml&&(s.ml=t),t>s.bl&&(s.bl=t)))}return s}_l(t,e,i){if(this.Ni())return null;let s=null;const n=_(this.el()),r=_(this.An()),o=Math.max(t,n),h=Math.min(e,r),l=Math.ceil(o/Ue)*Ue,a=Math.max(l,Math.floor(h/Ue)*Ue);{const t=this.fl(o),n=this.vl(Math.min(h,l,e));s=Ke(s,this.pl(t,n,i))}let c=this.il.get(i);void 0===c&&(c=new Map,this.il.set(i,c));for(let t=Math.max(l+1,o);t<a;t+=Ue){const e=Math.floor(t/Ue);let n=c.get(e);if(void 0===n){const t=this.fl(e*Ue),s=this.vl((e+1)*Ue-1);n=this.pl(t,s,i),c.set(e,n)}s=Ke(s,n)}{const t=this.fl(a),e=this.vl(h);s=Ke(s,this.pl(t,e,i))}return s}}function Ke(t,e){return null===t?e:null===e?t:{ml:Math.min(t.ml,e.ml),bl:Math.max(t.bl,e.bl)}}class qe{constructor(t){this.wl=t}X(t,e,i){this.wl.draw(t)}gl(t,e,i){var s,n;null===(n=(s=this.wl).drawBackground)||void 0===n||n.call(s,t)}}class Xe{constructor(t){this.tr=null,this.wn=t}gt(){var t;const e=this.wn.renderer();if(null===e)return null;if((null===(t=this.tr)||void 0===t?void 0:t.Ml)===e)return this.tr.xl;const i=new qe(e);return this.tr={Ml:e,xl:i},i}Sl(){var t,e,i;return null!==(i=null===(e=(t=this.wn).zOrder)||void 0===e?void 0:e.call(t))&&void 0!==i?i:"normal"}}function Ge(t){var e,i,s,n,r;return{Kt:t.text(),ki:t.coordinate(),Si:null===(e=t.fixedCoordinate)||void 0===e?void 0:e.call(t),V:t.textColor(),t:t.backColor(),yt:null===(s=null===(i=t.visible)||void 0===i?void 0:i.call(t))||void 0===s||s,hi:null===(r=null===(n=t.tickVisible)||void 0===n?void 0:n.call(t))||void 0===r||r}}class Je{constructor(t,e){this.Wt=new ft,this.kl=t,this.yl=e}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Ge(this.kl))),this.Wt}}class Qe extends ct{constructor(t,e){super(),this.kl=t,this.Li=e}zi(t,e,i){const s=Ge(this.kl);i.t=s.t,t.V=s.V;const n=2/12*this.Li.P();i.wi=n,i.gi=n,i.ki=s.ki,i.Si=s.Si,t.Kt=s.Kt,t.yt=s.yt,t.hi=s.hi}}class Ye{constructor(t,e){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=t,this.jr=e}Ol(){return this.Vl}Vn(){var t,e;null===(e=(t=this.Vl).updateAllViews)||void 0===e||e.call(t)}Pn(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).paneViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Cl)||void 0===s?void 0:s.Ml)===n)return this.Cl.xl;const r=n.map(t=>new Xe(t));return this.Cl={Ml:n,xl:r},r}Qi(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).timeAxisViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Tl)||void 0===s?void 0:s.Ml)===n)return this.Tl.xl;const r=this.jr.$t().St(),o=n.map(t=>new Je(t,r));return this.Tl={Ml:n,xl:o},o}Rn(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).priceAxisViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Pl)||void 0===s?void 0:s.Ml)===n)return this.Pl.xl;const r=this.jr.Dt(),o=n.map(t=>new Qe(t,r));return this.Pl={Ml:n,xl:o},o}Bl(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).priceAxisPaneViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Rl)||void 0===s?void 0:s.Ml)===n)return this.Rl.xl;const r=n.map(t=>new Xe(t));return this.Rl={Ml:n,xl:r},r}Al(){var t,e,i,s;const n=null!==(i=null===(e=(t=this.Vl).timeAxisPaneViews)||void 0===e?void 0:e.call(t))&&void 0!==i?i:[];if((null===(s=this.Dl)||void 0===s?void 0:s.Ml)===n)return this.Dl.xl;const r=n.map(t=>new Xe(t));return this.Dl={Ml:n,xl:r},r}Il(t,e){var i,s,n;return null!==(n=null===(s=(i=this.Vl).autoscaleInfo)||void 0===s?void 0:s.call(i,t,e))&&void 0!==n?n:null}wr(t,e){var i,s,n;return null!==(n=null===(s=(i=this.Vl).hitTest)||void 0===s?void 0:s.call(i,t,e))&&void 0!==n?n:null}}function Ze(t,e,i,s){t.forEach(t=>{e(t).forEach(t=>{t.Sl()===i&&s.push(t)})})}function ti(t){return t.Pn()}function ei(t){return t.Bl()}function ii(t){return t.Al()}class si extends Be{constructor(t,e,i,s,n){super(t),this.zt=new He,this.jh=new Le(this),this.zl=[],this.Ll=new me(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=e,this.$l=i;const r=new Oe(this);this.rn=[r],this.Hh=new ue(r,this,t),"Area"!==i&&"Line"!==i&&"Baseline"!==i||(this.El=new we(this)),this.Ul(),this.ql(n)}S(){null!==this.jl&&clearTimeout(this.jl)}mh(t){return this.cn.priceLineColor||t}Zr(t){const e={Xr:!0},i=this.Dt();if(this.$t().St().Ni()||i.Ni()||this.zt.Ni())return e;const s=this.$t().St().Xs(),n=this.Ct();if(null===s||null===n)return e;let r,o;if(t){const t=this.zt.sl();if(null===t)return e;r=t,o=t.ee}else{const t=this.zt.ll(s.ui(),-1);if(null===t)return e;if(r=this.zt.Gh(t.ee),null===r)return e;o=t.ee}const h=r.Vt[3],l=this.Us().$s(o,{Vt:r}),a=i.Rt(h,n.Vt);return{Xr:!1,_t:h,Kt:i.Fi(h,n.Vt),xh:i.Yl(h),Sh:i.Zl(h,n.Vt),V:l.ce,ki:a,ee:o}}Us(){return null!==this.Nl||(this.Nl=new je(this)),this.Nl}W(){return this.cn}$h(t){const e=t.priceScaleId;void 0!==e&&e!==this.cn.priceScaleId&&this.$t().Xl(this,e),A(this.cn,t),void 0!==t.priceFormat&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(t,e){this.zt.J(t),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),null!==this.El&&(e&&e.ta?this.El.$r():0===t.length&&this.El.Hr());const i=this.$t().dr(this);this.$t().ia(i),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(t){this.Fl=t,this.Ql();const e=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(e),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(t){const e=new Ae(this,t);return this.zl.push(e),this.$t().Gl(this),e}ra(t){const e=this.zl.indexOf(t);-1!==e&&this.zl.splice(e,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const t=this.ha();return null===t?null:{Vt:t.Vt[3],la:t.ot}}ha(){const t=this.$t().St().Xs();if(null===t)return null;const e=t.Os();return this.zt.ll(e,1)}In(){return this.zt}ph(t){const e=this.zt.Gh(t);return null===e?null:"Bar"===this.$l||"Candlestick"===this.$l||"Custom"===this.$l?{ge:e.Vt[0],Me:e.Vt[1],xe:e.Vt[2],Se:e.Vt[3]}:e.Vt[3]}aa(t){const e=[];Ze(this.Hl,ti,"top",e);const i=this.El;return null!==i&&i.yt()?(null===this.jl&&i.qr()&&(this.jl=setTimeout(()=>{this.jl=null,this.$t().oa()},0)),i.Ur(),e.unshift(i),e):e}Pn(){const t=[];this._a()||t.push(this.Ll),t.push(this.wn,this.jh,this.dn);const e=this.zl.map(t=>t.qh());return t.push(...e),Ze(this.Hl,ti,"normal",t),t}ua(){return this.ca(ti,"bottom")}da(t){return this.ca(ei,t)}fa(t){return this.ca(ii,t)}va(t,e){return this.Hl.map(i=>i.wr(t,e)).filter(t=>null!==t)}Ji(t){return[this.Hh,...this.zl.map(t=>t.Yh())]}Rn(t,e){if(e!==this.Yi&&!this._a())return[];const i=[...this.rn];for(const t of this.zl)i.push(t.Zh());return this.Hl.forEach(t=>{i.push(...t.Rn())}),i}Qi(){const t=[];return this.Hl.forEach(e=>{t.push(...e.Qi())}),t}Il(t,e){if(void 0!==this.cn.autoscaleInfoProvider){const i=this.cn.autoscaleInfoProvider(()=>{const i=this.pa(t,e);return null===i?null:i.Bh()});return Ve.Ah(i)}return this.pa(t,e)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var t;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),null===(t=this.El)||void 0===t||t.bt(),this.Hl.forEach(t=>t.Vn())}Dt(){return _(super.Dt())}kt(t){if("Line"!==this.$l&&"Area"!==this.$l&&"Baseline"!==this.$l||!this.cn.crosshairMarkerVisible)return null;const e=this.zt.Gh(t);return null===e?null:{_t:e.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(t)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(t){this.Hl.push(new Ye(t,this))}ya(t){this.Hl=this.Hl.filter(e=>e.Ol()!==t)}Ca(){if(this.wn instanceof se!=0)return t=>this.wn.We(t)}Ta(){if(this.wn instanceof se!=0)return t=>this.wn.je(t)}_a(){return!bt(this.Dt().Pa())}pa(t,e){if(!W(t)||!W(e)||this.zt.Ni())return null;const i="Line"===this.$l||"Area"===this.$l||"Baseline"===this.$l||"Histogram"===this.$l?[3]:[2,1],s=this.zt.ol(t,e,i);let n=null!==s?new $e(s.ml,s.bl):null;if("Histogram"===this.Qh()){const t=this.cn.base,e=new $e(t,t);n=null!==n?n.ts(e):e}let r=this.dn.uh();return this.Hl.forEach(i=>{const s=i.Il(t,e);if(null==s?void 0:s.priceRange){const t=new $e(s.priceRange.minValue,s.priceRange.maxValue);n=null!==n?n.ts(t):t}var o,h,l,a;(null==s?void 0:s.margins)&&(o=r,h=s.margins,r={above:Math.max(null!==(l=null==o?void 0:o.above)&&void 0!==l?l:0,h.above),below:Math.max(null!==(a=null==o?void 0:o.below)&&void 0!==a?a:0,h.below)})}),new Ve(n,r)}ga(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}Ma(){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(t){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.Us().$s(t).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new Mt(this.cn.priceFormat.precision);break;case"percent":this.wa=new Ct(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.wa=new St(t,this.cn.priceFormat.minMove*t)}}null!==this.Yi&&this.Yi.Ra()}Ql(){const t=this.$t().St();if(!t.Da()||this.zt.Ni())return void(this.Wl=[]);const e=_(this.zt.el());this.Wl=this.Fl.map((i,s)=>{const n=_(t.Va(i.time,!0)),r=n<e?1:-1;return{time:_(this.zt.ll(n,r)).ee,position:i.position,shape:i.shape,color:i.color,id:i.id,th:s,text:i.text,size:i.size,originalTime:i.originalTime}})}ql(t){switch(this.dn=new Ne(this,this.$t()),this.$l){case"Bar":this.wn=new Jt(this,this.$t());break;case"Candlestick":this.wn=new ee(this,this.$t());break;case"Line":this.wn=new he(this,this.$t());break;case"Custom":this.wn=new se(this,this.$t(),x(t));break;case"Area":this.wn=new qt(this,this.$t());break;case"Baseline":this.wn=new Zt(this,this.$t());break;case"Histogram":this.wn=new oe(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(t,e){const i=[];return Ze(this.Hl,t,e,i),i}}class ni{constructor(t){this.cn=t}Oa(t,e,i){let s=t;if(0===this.cn.mode)return s;const n=i.vn(),r=n.Ct();if(null===r)return s;const o=n.Rt(t,r),h=i.Ba().filter(t=>t instanceof si).reduce((t,s)=>{if(i.vr(s)||!s.yt())return t;const n=s.Dt(),r=s.In();if(n.Ni()||!r.Kr(e))return t;const o=r.Gh(e);if(null===o)return t;const h=z(s.Ct());return t.concat([n.Rt(o.Vt[3],h.Vt)])},[]);if(0===h.length)return s;h.sort((t,e)=>Math.abs(t-o)-Math.abs(e-o));const l=h[0];return s=n.pn(l,r),s}}class ri extends Q{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.zt)return;const n=Math.max(1,Math.floor(i));t.lineWidth=n,function(t,e){t.save(),t.lineWidth%2&&t.translate(.5,.5),e(),t.restore()}(t,()=>{const r=_(this.zt);if(r.Aa){t.strokeStyle=r.Ia,C(t,r.za),t.beginPath();for(const s of r.La){const r=Math.round(s.Ea*i);t.moveTo(r,-n),t.lineTo(r,e.height+n)}t.stroke()}if(r.Na){t.strokeStyle=r.Fa,C(t,r.Wa),t.beginPath();for(const i of r.ja){const r=Math.round(i.Ea*s);t.moveTo(-n,r),t.lineTo(e.width+n,r)}t.stroke()}})}}class oi{constructor(t){this.Wt=new ri,this.ft=!0,this.tn=t}bt(){this.ft=!0}gt(){if(this.ft){const t=this.tn.$t().W().grid,e={Na:t.horzLines.visible,Aa:t.vertLines.visible,Fa:t.horzLines.color,Ia:t.vertLines.color,Wa:t.horzLines.style,za:t.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map(t=>({Ea:t.coord}))};this.Wt.J(e),this.ft=!1}return this.Wt}}class hi{constructor(t){this.wn=new oi(t)}qh(){return this.wn}}const li={$a:4,Ua:1e-4};function ai(t,e){const i=100*(t-e)/e;return e<0?-i:i}function ci(t,e){const i=ai(t.Ph(),e),s=ai(t.Rh(),e);return new $e(i,s)}function ui(t,e){const i=100*(t-e)/e+100;return e<0?-i:i}function di(t,e){const i=ui(t.Ph(),e),s=ui(t.Rh(),e);return new $e(i,s)}function fi(t,e){const i=Math.abs(t);if(i<1e-15)return 0;const s=Math.log10(i+e.Ua)+e.$a;return t<0?-s:s}function mi(t,e){const i=Math.abs(t);if(i<1e-15)return 0;const s=Math.pow(10,i-e.$a)-e.Ua;return t<0?-s:s}function pi(t,e){if(null===t)return null;const i=fi(t.Ph(),e),s=fi(t.Rh(),e);return new $e(i,s)}function gi(t,e){if(null===t)return null;const i=mi(t.Ph(),e),s=mi(t.Rh(),e);return new $e(i,s)}function vi(t){if(null===t)return li;const e=Math.abs(t.Rh()-t.Ph());if(e>=1||e<1e-15)return li;const i=Math.ceil(Math.abs(Math.log10(e))),s=li.$a+i;return{$a:s,Ua:1/Math.pow(10,s)}}class bi{constructor(t,e){if(this.qa=t,this.Ya=e,function(t){if(t<0)return!1;for(let e=t;e>1;e/=10)if(e%10!=0)return!1;return!0}(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let t=this.qa;1!==t;){if(t%2==0)this.Za.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),t/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(t,e,i){const s=0===this.qa?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-e)))),r=0,o=this.Ya[0];for(;;){const t=Lt(n,s,1e-14)&&n>s+1e-14,e=Lt(n,i*o,1e-14),h=Lt(n,1,1e-14);if(!(t&&e&&h))break;n/=o,o=this.Ya[++r%this.Ya.length]}if(n<=s+1e-14&&(n=s),n=Math.max(1,n),this.Za.length>0&&(h=n,Math.abs(h-1)<1e-14))for(r=0,o=this.Za[0];Lt(n,i*o,1e-14)&&n>s+1e-14;)n/=o,o=this.Za[++r%this.Za.length];var h;return n}}class wi{constructor(t,e,i,s){this.Ka=[],this.Li=t,this.qa=e,this.Ga=i,this.Ja=s}Xa(t,e){if(t<e)throw new Error("high < low");const i=this.Li.At(),s=(t-e)*this.Qa()/i,n=new bi(this.qa,[2,2.5,2]),r=new bi(this.qa,[2,2,2.5]),o=new bi(this.qa,[2.5,2,2]),h=[];return h.push(n.Xa(t,e,s),r.Xa(t,e,s),o.Xa(t,e,s)),function(t){if(t.length<1)throw Error("array is empty");let e=t[0];for(let i=1;i<t.length;++i)t[i]<e&&(e=t[i]);return e}(h)}io(){const t=this.Li,e=t.Ct();if(null===e)return void(this.Ka=[]);const i=t.At(),s=this.Ga(i-1,e),n=this.Ga(0,e),r=this.Li.W().entireTextOnly?this.no()/2:0,o=r,h=i-1-r,l=Math.max(s,n),a=Math.min(s,n);if(l===a)return void(this.Ka=[]);let c=this.Xa(l,a),u=l%c;u+=u<0?c:0;const d=l>=a?1:-1;let f=null,m=0;for(let i=l-u;i>a;i-=c){const s=this.Ja(i,e,!0);null!==f&&Math.abs(s-f)<this.Qa()||s<o||s>h||(m<this.Ka.length?(this.Ka[m].Ea=s,this.Ka[m].so=t.eo(i)):this.Ka.push({Ea:s,so:t.eo(i)}),m++,f=s,t.ro()&&(c=this.Xa(i*d,a)))}this.Ka.length=m}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function yi(t){return t.slice().sort((t,e)=>_(t.Xi())-_(e.Xi()))}var Si;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(Si||(Si={}));const Ci=new Ct,Mi=new St(100,1);class Ei{constructor(t,e,i,s){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new D,this.vo=new D,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=Mi,this.xo=vi(null),this.So=t,this.cn=e,this.ko=i,this.yo=s,this.Co=new wi(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(t){if(A(this.cn,t),this.Ra(),void 0!==t.mode&&this.Ro({Cr:t.mode}),void 0!==t.scaleMargins){const e=x(t.scaleMargins.top),i=x(t.scaleMargins.bottom);if(e<0||e>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${e}`);if(i<0||i>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${i}`);if(e+i>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${e+i}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return 1===this.cn.mode}Mh(){return 2===this.cn.mode}Oo(){return 3===this.cn.mode}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(t){const e=this.Cr();let i=null;void 0!==t.Wn&&(this.cn.autoScale=t.Wn),void 0!==t.Cr&&(this.cn.mode=t.Cr,2!==t.Cr&&3!==t.Cr||(this.cn.autoScale=!0),this.oo._o=!1),1===e.Cr&&t.Cr!==e.Cr&&(function(t,e){if(null===t)return!1;const i=mi(t.Ph(),e),s=mi(t.Rh(),e);return isFinite(i)&&isFinite(s)}(this.Ih,this.xo)?(i=gi(this.Ih,this.xo),null!==i&&this.Ao(i)):this.cn.autoScale=!0),1===t.Cr&&t.Cr!==e.Cr&&(i=pi(this.Ih,this.xo),null!==i&&this.Ao(i));const s=e.Cr!==this.cn.mode;s&&(2===e.Cr||this.Mh())&&this.Ra(),s&&(3===e.Cr||this.Oo())&&this.Ra(),void 0!==t.Bo&&e.Bo!==t.Bo&&(this.cn.invertScale=t.Bo,this.Io()),this.vo.m(e,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(t){this.ho!==t&&(this.ho=t,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const t=this.At()-this.No()-this.Fo();return this.lo=t,t}Lh(){return this.Wo(),this.Ih}Ao(t,e){const i=this.Ih;(e||null===i&&null!==t||null!==i&&!i.Ch(t))&&(this.bo=null,this.Ih=t)}Ni(){return this.Wo(),0===this.ho||!this.Ih||this.Ih.Ni()}jo(t){return this.Bo()?t:this.At()-1-t}Rt(t,e){return this.Mh()?t=ai(t,e):this.Oo()&&(t=ui(t,e)),this.Po(t,e)}te(t,e,i){this.Wo();const s=this.Fo(),n=_(this.Lh()),r=n.Ph(),o=n.Rh(),h=this.Eo()-1,l=this.Bo(),a=h/(o-r),c=void 0===i?0:i.from,u=void 0===i?t.length:i.to,d=this.Ho();for(let i=c;i<u;i++){const n=t[i],o=n._t;if(isNaN(o))continue;let h=o;null!==d&&(h=d(n._t,e));const c=s+a*(h-r),u=l?c:this.ho-1-c;n.st=u}}be(t,e,i){this.Wo();const s=this.Fo(),n=_(this.Lh()),r=n.Ph(),o=n.Rh(),h=this.Eo()-1,l=this.Bo(),a=h/(o-r),c=void 0===i?0:i.from,u=void 0===i?t.length:i.to,d=this.Ho();for(let i=c;i<u;i++){const n=t[i];let o=n.ge,h=n.Me,c=n.xe,u=n.Se;null!==d&&(o=d(n.ge,e),h=d(n.Me,e),c=d(n.xe,e),u=d(n.Se,e));let f=s+a*(o-r),m=l?f:this.ho-1-f;n.pe=m,f=s+a*(h-r),m=l?f:this.ho-1-f,n.de=m,f=s+a*(c-r),m=l?f:this.ho-1-f,n.fe=m,f=s+a*(u-r),m=l?f:this.ho-1-f,n.me=m}}pn(t,e){const i=this.To(t,e);return this.$o(i,e)}$o(t,e){let i=t;return this.Mh()?i=function(t,e){return e<0&&(t=-t),t/100*e+e}(i,e):this.Oo()&&(i=function(t,e){return t-=100,e<0&&(t=-t),t/100*e+e}(i,e)),i}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let t=[];for(let e=0;e<this.po.length;e++){const i=this.po[e];null===i.Xi()&&i.Ki(e+1),t.push(i)}return t=yi(t),this.mo=t,this.mo}qo(t){-1===this.po.indexOf(t)&&(this.po.push(t),this.Ra(),this.Yo())}Zo(t){const e=this.po.indexOf(t);if(-1===e)throw new Error("source is not attached to scale");this.po.splice(e,1),0===this.po.length&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let t=null;for(const e of this.po){const i=e.Ct();null!==i&&(null===t||i.la<t.la)&&(t=i)}return null===t?null:t.Vt}Bo(){return this.cn.invertScale}Ha(){const t=null===this.Ct();if(null!==this.bo&&(t||this.bo.Xo===t))return this.bo.Ha;this.Co.io();const e=this.Co.Ha();return this.bo={Ha:e,Xo:t},this.fo.m(),e}Ko(){return this.fo}Go(t){this.Mh()||this.Oo()||null===this.wo&&null===this.ao&&(this.Ni()||(this.wo=this.ho-t,this.ao=_(this.Lh()).Th()))}Jo(t){if(this.Mh()||this.Oo())return;if(null===this.wo)return;this.Ro({Wn:!1}),(t=this.ho-t)<0&&(t=0);let e=(this.wo+.2*(this.ho-1))/(t+.2*(this.ho-1));const i=_(this.ao).Th();e=Math.max(e,.1),i.Vh(e),this.Ao(i)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(t){this.Vo()||null===this.Mo&&null===this.ao&&(this.Ni()||(this.Mo=t,this.ao=_(this.Lh()).Th()))}i_(t){if(this.Vo())return;if(null===this.Mo)return;const e=_(this.Lh()).Dh()/(this.Eo()-1);let i=t-this.Mo;this.Bo()&&(i*=-1);const s=i*e,n=_(this.ao).Th();n.Oh(s),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||null!==this.Mo&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(t,e){switch(this.cn.mode){case 2:return this.s_(ai(t,e));case 3:return this.ba().format(ui(t,e));default:return this.Wh(t)}}eo(t){switch(this.cn.mode){case 2:return this.s_(t);case 3:return this.ba().format(t);default:return this.Wh(t)}}Yl(t){return this.Wh(t,_(this.e_()).ba())}Zl(t,e){return t=ai(t,e),this.s_(t,Ci)}r_(){return this.po}h_(t){this.oo={uo:t,_o:!1}}Vn(){this.po.forEach(t=>t.Vn())}Ra(){this.bo=null;const t=this.e_();let e=100;null!==t&&(e=Math.round(1/t.ma())),this.wa=Mi,this.Mh()?(this.wa=Ci,e=100):this.Oo()?(this.wa=new St(100,1),e=100):null!==t&&(this.wa=t.ba()),this.Co=new wi(this,e,this.To.bind(this),this.Po.bind(this)),this.Co.io()}Yo(){this.mo=null}e_(){return this.po[0]||null}No(){return this.Bo()?this.cn.scaleMargins.bottom*this.At()+this.do:this.cn.scaleMargins.top*this.At()+this.co}Fo(){return this.Bo()?this.cn.scaleMargins.top*this.At()+this.co:this.cn.scaleMargins.bottom*this.At()+this.do}Wo(){this.oo._o||(this.oo._o=!0,this.l_())}Do(){this.lo=null}Po(t,e){if(this.Wo(),this.Ni())return 0;t=this.ro()&&t?fi(t,this.xo):t;const i=_(this.Lh()),s=this.Fo()+(this.Eo()-1)*(t-i.Ph())/i.Dh();return this.jo(s)}To(t,e){if(this.Wo(),this.Ni())return 0;const i=this.jo(t),s=_(this.Lh()),n=s.Ph()+s.Dh()*((i-this.Fo())/(this.Eo()-1));return this.ro()?mi(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const t=this.oo.uo;if(null===t)return;let e=null;const i=this.r_();let s=0,n=0;for(const r of i){if(!r.yt())continue;const i=r.Ct();if(null===i)continue;const o=r.Il(t.Os(),t.ui());let h=o&&o.Lh();if(null!==h){switch(this.cn.mode){case 1:h=pi(h,this.xo);break;case 2:h=ci(h,i.Vt);break;case 3:h=di(h,i.Vt)}if(e=null===e?h:e.ts(_(h)),null!==o){const t=o.Eh();null!==t&&(s=Math.max(s,t.above),n=Math.max(n,t.below))}}}if(s===this.co&&n===this.do||(this.co=s,this.do=n,this.bo=null,this.Do()),null!==e){if(e.Ph()===e.Rh()){const t=this.e_(),i=5*(null===t||this.Mh()||this.Oo()?1:t.ma());this.ro()&&(e=gi(e,this.xo)),e=new $e(e.Ph()-i,e.Rh()+i),this.ro()&&(e=pi(e,this.xo))}if(this.ro()){const t=gi(e,this.xo),i=vi(t);if(r=i,o=this.xo,r.$a!==o.$a||r.Ua!==o.Ua){const s=null!==this.ao?gi(this.ao,this.xo):null;this.xo=i,e=pi(t,i),null!==s&&(this.ao=pi(s,i))}}this.Ao(e)}else null===this.Ih&&(this.Ao(new $e(-.5,.5)),this.xo=vi(null));var r,o;this.oo._o=!0}Ho(){return this.Mh()?ai:this.Oo()?ui:this.ro()?t=>fi(t,this.xo):null}a_(t,e,i){return void 0===e?(void 0===i&&(i=this.ba()),i.format(t)):e(t)}Wh(t,e){return this.a_(t,this.yo.priceFormatter,e)}s_(t,e){return this.a_(t,this.yo.percentageFormatter,e)}}class xi{constructor(t,e){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new D,this.yl=t,this.$i=e,this.d_=new hi(this);const i=e.W();this.f_=this.v_("left",i.leftPriceScale),this.p_=this.v_("right",i.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(i)}b_(t){if(t.leftPriceScale&&this.f_.$h(t.leftPriceScale),t.rightPriceScale&&this.p_.$h(t.rightPriceScale),t.localization&&(this.f_.Ra(),this.p_.Ra()),t.overlayPriceScales){const e=Array.from(this.o_.values());for(const i of e){const e=_(i[0].Dt());e.$h(t.overlayPriceScales),t.localization&&e.Ra()}}}w_(t){switch(t){case"left":return this.f_;case"right":return this.p_}return this.o_.has(t)?x(this.o_.get(t))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach(t=>{t.S&&t.S()}),this.c_.m()}M_(){return this.u_}x_(t){this.u_=t}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(t){this.__=t,this.k_()}Lo(t){this.ho=t,this.f_.Lo(t),this.p_.Lo(t),this.po.forEach(e=>{if(this.vr(e)){const i=e.Dt();null!==i&&i.Lo(t)}}),this.k_()}Ba(){return this.po}vr(t){const e=t.Dt();return null===e||this.f_!==e&&this.p_!==e}qo(t,e,i){const s=void 0!==i?i:this.C_().y_+1;this.T_(t,e,s)}Zo(t){const e=this.po.indexOf(t);E(-1!==e,"removeDataSource: invalid data source"),this.po.splice(e,1);const i=_(t.Dt()).Pa();if(this.o_.has(i)){const e=x(this.o_.get(i)),s=e.indexOf(t);-1!==s&&(e.splice(s,1),0===e.length&&this.o_.delete(i))}const s=t.Dt();s&&s.Ba().indexOf(t)>=0&&s.Zo(t),null!==s&&(s.Yo(),this.P_(s)),this.mo=null}mr(t){return t===this.f_?"left":t===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(t,e){t.Go(e)}O_(t,e){t.Jo(e),this.k_()}B_(t){t.Qo()}A_(t,e){t.t_(e)}I_(t,e){t.i_(e),this.k_()}z_(t){t.n_()}k_(){this.po.forEach(t=>{t.Vn()})}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&0!==this.p_.Ba().length?t=this.p_:this.$i.W().leftPriceScale.visible&&0!==this.f_.Ba().length?t=this.f_:0!==this.po.length&&(t=this.po[0].Dt()),null===t&&(t=this.p_),t}pr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.p_:this.$i.W().leftPriceScale.visible&&(t=this.f_),t}P_(t){null!==t&&t.Vo()&&this.L_(t)}E_(t){const e=this.yl.Xs();t.Ro({Wn:!0}),null!==e&&t.h_(e),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach(t=>{this.vr(t)&&this.P_(t.Dt())}),this.k_(),this.$i.Uh()}Uo(){return null===this.mo&&(this.mo=yi(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(t){const e=t.r_();if(e&&e.length>0&&!this.yl.Ni()){const e=this.yl.Xs();null!==e&&t.h_(e)}t.Vn()}C_(){const t=this.Uo();if(0===t.length)return{H_:0,y_:0};let e=0,i=0;for(let s=0;s<t.length;s++){const n=t[s].Xi();null!==n&&(n<e&&(e=n),n>i&&(i=n))}return{H_:e,y_:i}}T_(t,e,i){let s=this.w_(e);if(null===s&&(s=this.v_(e,this.$i.W().overlayPriceScales)),this.po.push(t),!bt(e)){const i=this.o_.get(e)||[];i.push(t),this.o_.set(e,i)}s.qo(t),t.Gi(s),t.Ki(i),this.P_(s),this.mo=null}m_(t,e,i){e.Cr!==i.Cr&&this.L_(t)}v_(t,e){const i=Object.assign({visible:!0,autoScale:!0},U(e)),s=new Ei(t,i,this.$i.W().layout,this.$i.W().localization);return s.Lo(this.At()),s}}class _i{constructor(t,e,i=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=t,this.q_=e,this.ir=i}Y_(t){const e=t.time,i=this.q_.cacheKey(e),s=this.tr.get(i);if(void 0!==s)return s.Z_;if(this.Ke===this.ir){const t=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(x(t)),this.Je++,this.Ke--}const n=this.U_(t);return this.tr.set(i,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,i),this.Ke++,this.Ge++,n}}class zi{constructor(t,e){E(t<=e,"right should be >= left"),this.X_=t,this.K_=e}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}Ch(t){return this.X_===t.Os()&&this.K_===t.ui()}}function ki(t,e){return null===t||null===e?t===e:t.Ch(e)}class Ti{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(t){this.Q_=t,this.tr=null}iu(t,e){this.nu(e),this.tr=null;for(let i=e;i<t.length;++i){const e=t[i];let s=this.J_.get(e.timeWeight);void 0===s&&(s=[],this.J_.set(e.timeWeight,s)),s.push({index:i,time:e.time,weight:e.timeWeight,originalTime:e.originalTime})}}su(t,e){const i=Math.ceil(e/t);return null!==this.tr&&this.tr.eu===i||(this.tr={Ha:this.ru(i),eu:i}),this.tr.Ha}nu(t){if(0===t)return void this.J_.clear();const e=[];this.J_.forEach((i,s)=>{t<=i[0].index?e.push(s):i.splice(Bt(i,t,e=>e.index<t),1/0)});for(const t of e)this.J_.delete(t)}ru(t){let e=[];for(const i of Array.from(this.J_.keys()).sort((t,e)=>e-t)){if(!this.J_.get(i))continue;const s=e;e=[];const n=s.length;let r=0;const o=x(this.J_.get(i)),h=o.length;let l=1/0,a=-1/0;for(let i=0;i<h;i++){const h=o[i],c=h.index;for(;r<n;){const t=s[r],i=t.index;if(!(i<c)){l=i;break}r++,e.push(t),a=i,l=1/0}if(l-c>=t&&c-a>=t)e.push(h),a=c;else if(this.Q_)return s}for(;r<n;r++)e.push(s[r])}return e}}class Ri{constructor(t){this.hu=t}lu(){return null===this.hu?null:new zi(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Ri(null)}}function Ni(t,e){return t.weight>e.weight?t:e}class Li{constructor(t,e,i,s){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Ti,this.du=new Map,this.fu=Ri.ou(),this.vu=!0,this.pu=new D,this.mu=new D,this.bu=new D,this.wu=null,this.gu=null,this.Mu=[],this.cn=e,this.yo=i,this.xu=e.rightOffset,this.Su=e.barSpacing,this.$i=t,this.q_=s,this.ku(),this.cu.tu(e.uniformDistribution)}W(){return this.cn}yu(t){A(this.yo,t),this.Cu(),this.ku()}$h(t,e){var i;A(this.cn,t),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),void 0!==t.barSpacing&&this.$i.Gn(t.barSpacing),void 0!==t.rightOffset&&this.$i.Jn(t.rightOffset),void 0!==t.minBarSpacing&&this.$i.Gn(null!==(i=t.barSpacing)&&void 0!==i?i:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(t){var e,i;return null!==(i=null===(e=this.uu[t])||void 0===e?void 0:e.time)&&void 0!==i?i:null}Ui(t){var e;return null!==(e=this.uu[t])&&void 0!==e?e:null}Va(t,e){if(this.uu.length<1)return null;if(this.q_.key(t)>this.q_.key(this.uu[this.uu.length-1].time))return e?this.uu.length-1:null;const i=Bt(this.uu,this.q_.key(t),(t,e)=>this.q_.key(t.time)<e);return this.q_.key(t)<this.q_.key(this.uu[i].time)?e?i:null:i}Ni(){return 0===this.__||0===this.uu.length||null===this._u}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const t=this.Xs();if(null===t)return null;const e={from:t.Os(),to:t.ui()};return this.Ou(e)}Ou(t){const e=Math.round(t.from),i=Math.round(t.to),s=_(this.Bu()),n=_(this.Au());return{from:_(this.Ui(Math.max(s,e))),to:_(this.Ui(Math.min(n,i)))}}Iu(t){return{from:_(this.Va(t.from,!0)),to:_(this.Va(t.to,!0))}}Hi(){return this.__}S_(t){if(!isFinite(t)||t<=0)return;if(this.__===t)return;const e=this.Du(),i=this.__;if(this.__=t,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&0!==i){const e=this.Su*t/i;this.Su=e}if(this.cn.fixLeftEdge&&null!==e&&e.Os()<=0){const e=i-t;this.xu-=Math.round(e/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(t){if(this.Ni()||!W(t))return 0;const e=this.Eu()+this.xu-t;return this.__-(e+.5)*this.Su-1}Qs(t,e){const i=this.Eu(),s=void 0===e?0:e.from,n=void 0===e?t.length:e.to;for(let e=s;e<n;e++){const s=t[e].ot,n=i+this.xu-s,r=this.__-(n+.5)*this.Su-1;t[e].nt=r}}Nu(t){return Math.ceil(this.Fu(t))}Jn(t){this.vu=!0,this.xu=t,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(t){this.ju(t),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(null!==this.gu)return this.gu;const t=this.Su,e=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),i=Math.round(e/t),s=_(this.Xs()),n=Math.max(s.Os(),s.Os()-i),r=Math.max(s.ui(),s.ui()-i),o=this.cu.su(t,e),h=this.Bu()+i,l=this.Au()-i,a=this.$u(),c=this.cn.fixLeftEdge||a,u=this.cn.fixRightEdge||a;let d=0;for(const t of o){if(!(n<=t.index&&t.index<=r))continue;let i;d<this.Mu.length?(i=this.Mu[d],i.coord=this.It(t.index),i.label=this.Uu(t),i.weight=t.weight):(i={needAlignCoordinate:!1,coord:this.It(t.index),label:this.Uu(t),weight:t.weight},this.Mu.push(i)),this.Su>e/2&&!a?i.needAlignCoordinate=!1:i.needAlignCoordinate=c&&t.index<=h||u&&t.index>=l,d++}return this.Mu.length=d,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(t){this.vu=!0,this._u=t,this.Lu(),this.Tu()}Zu(t,e){const i=this.Fu(t),s=this.le(),n=s+e*(s/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(i-this.Fu(t)))}Go(t){this.Mo&&this.n_(),null===this.wo&&null===this.wu&&(this.Ni()||(this.wo=t,this.Xu()))}Jo(t){if(null===this.wu)return;const e=Nt(this.__-t,0,this.__),i=Nt(this.__-_(this.wo),0,this.__);0!==e&&0!==i&&this.Gn(this.wu.le*e/i)}Qo(){null!==this.wo&&(this.wo=null,this.Ku())}t_(t){null===this.Mo&&null===this.wu&&(this.Ni()||(this.Mo=t,this.Xu()))}i_(t){if(null===this.Mo)return;const e=(this.Mo-t)/this.le();this.xu=_(this.wu).Hu+e,this.vu=!0,this.Lu()}n_(){null!==this.Mo&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(t,e=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(e)||e<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const i=this.xu,s=performance.now();this.$i.Zn({Qu:t=>(t-s)/e>=1,tc:n=>{const r=(n-s)/e;return r>=1?t:i+(t-i)*r}})}bt(t,e){this.vu=!0,this.uu=t,this.cu.iu(t,e),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(t){const e=t.G_();this.ju(this.__/e),this.xu=t.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const t=this.Bu(),e=this.Au();null!==t&&null!==e&&this.rc(new zi(t,e+this.cn.rightOffset))}lc(t){const e=new zi(t.from,t.to);this.rc(e)}qi(t){return void 0!==this.yo.timeFormatter?this.yo.timeFormatter(t.originalTime):this.q_.formatHorzItem(t.time)}$u(){const{handleScroll:t,handleScale:e}=this.$i.W();return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||e.axisDoubleClickReset.time||e.axisPressedMouseMove.time||e.mouseWheel||e.pinch)}Bu(){return 0===this.uu.length?null:0}Au(){return 0===this.uu.length?null:this.uu.length-1}ac(t){return(this.__-1-t)/this.Su}Fu(t){const e=this.ac(t),i=this.Eu()+this.xu-e;return Math.round(1e6*i)/1e6}ju(t){const e=this.Su;this.Su=t,this.zu(),e!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Ri.ou());const t=this.Eu(),e=this.__/this.Su,i=this.xu+t,s=new zi(i-e+1,i);this._c(new Ri(s))}zu(){const t=this.uc();if(this.Su<t&&(this.Su=t,this.vu=!0),0!==this.__){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&0!==this.uu.length?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const t=this.cc();null!==t&&this.xu<t&&(this.xu=t,this.vu=!0);const e=this.dc();this.xu>e&&(this.xu=e,this.vu=!0)}cc(){const t=this.Bu(),e=this._u;return null===t||null===e?null:t-e-1+(this.cn.fixLeftEdge?this.__/this.Su:Math.min(2,this.uu.length))}dc(){return this.cn.fixRightEdge?0:this.__/this.Su-Math.min(2,this.uu.length)}Xu(){this.wu={le:this.le(),Hu:this.Hu()}}Ku(){this.wu=null}Uu(t){let e=this.du.get(t.weight);return void 0===e&&(e=new _i(t=>this.fc(t),this.q_),this.du.set(t.weight,e)),e.Y_(t)}fc(t){return this.q_.formatTickmark(t,this.yo)}_c(t){const e=this.fu;this.fu=t,ki(e.lu(),this.fu.lu())||this.pu.m(),ki(e.au(),this.fu.au())||this.mu.m(),this.oc()}oc(){this.gu=null}Cu(){this.oc(),this.du.clear()}ku(){this.q_.updateFormatter(this.yo)}Tu(){if(!this.cn.fixLeftEdge)return;const t=this.Bu();if(null===t)return;const e=this.Xs();if(null===e)return;const i=e.Os()-t;if(i<0){const t=this.xu-i-1;this.Jn(t)}this.zu()}Pu(){this.Lu(),this.zu()}}class Oi{X(t,e,i){t.useMediaCoordinateSpace(t=>this.K(t,e,i))}gl(t,e,i){t.useMediaCoordinateSpace(t=>this.vc(t,e,i))}vc(t,e,i){}}class Pi extends Oi{constructor(t){super(),this.mc=new Map,this.zt=t}K(t){}vc(t){if(!this.zt.yt)return;const{context:e,mediaSize:i}=t;let s=0;for(const t of this.zt.bc){if(0===t.Kt.length)continue;e.font=t.R;const n=this.wc(e,t.Kt);n>i.width?t.Zu=i.width/n:t.Zu=1,s+=t.gc*t.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((i.height-s)/2,0);break;case"bottom":n=Math.max(i.height-s,0)}e.fillStyle=this.zt.V;for(const t of this.zt.bc){e.save();let s=0;switch(this.zt.xc){case"left":e.textAlign="left",s=t.gc/2;break;case"center":e.textAlign="center",s=i.width/2;break;case"right":e.textAlign="right",s=i.width-1-t.gc/2}e.translate(s,n),e.textBaseline="top",e.font=t.R,e.scale(t.Zu,t.Zu),e.fillText(t.Kt,0,t.Sc),e.restore(),n+=t.gc*t.Zu}}wc(t,e){const i=this.kc(t.font);let s=i.get(e);return void 0===s&&(s=t.measureText(e).width,i.set(e,s)),s}kc(t){let e=this.mc.get(t);return void 0===e&&(e=new Map,this.mc.set(t,e)),e}}class $i{constructor(t){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Pi(this.Ft),this.jt=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const t=this.jt.W(),e=this.Ft;e.yt=t.visible,e.yt&&(e.V=t.color,e.xc=t.horzAlign,e.Mc=t.vertAlign,e.bc=[{Kt:t.text,R:X(t.fontSize,t.fontFamily,t.fontStyle),gc:1.2*t.fontSize,Sc:0,Zu:0}])}}class Vi extends pt{constructor(t,e){super(),this.cn=e,this.wn=new $i(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Fi,Di,Ai,Bi,Wi;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(Fi||(Fi={}));class ji{constructor(t,e,i){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new D,this.Rc=new D,this.Dc=null,this.Vc=t,this.cn=e,this.q_=i,this.Oc=new G(this),this.yl=new Li(this,e.timeScale,this.cn.localization,i),this.vt=new vt(this,e.crosshair),this.Bc=new ni(e.crosshair),this.Ac=new Vi(this,e.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(wt.es())}Uh(){this.Nc(wt.ss())}oa(){this.Nc(new wt(1))}Gl(t){const e=this.Fc(t);this.Nc(e)}Wc(){return this.Tc}jc(t){const e=this.Tc;this.Tc=t,null!==e&&this.Gl(e.Hc),null!==t&&this.Gl(t.Hc)}W(){return this.cn}$h(t){A(this.cn,t),this.yc.forEach(e=>e.b_(t)),void 0!==t.timeScale&&this.yl.$h(t.timeScale),void 0!==t.localization&&this.yl.yu(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(t,e){if("left"===t)return void this.$h({leftPriceScale:e});if("right"===t)return void this.$h({rightPriceScale:e});const i=this.Uc(t);null!==i&&(i.Dt.$h(e),this.Pc.m())}Uc(t){for(const e of this.yc){const i=e.w_(t);if(null!==i)return{Ht:e,Dt:i}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(t,e){t.Lo(e),this.Wu()}S_(t){this.__=t,this.yl.S_(this.__),this.yc.forEach(e=>e.S_(t)),this.Wu()}Ic(t){const e=new xi(this.yl,this);void 0!==t?this.yc.splice(t,0,e):this.yc.push(e);const i=void 0===t?this.yc.length-1:t,s=wt.es();return s.Nn(i,{Fn:0,Wn:!0}),this.Nc(s),e}V_(t,e,i){t.V_(e,i)}O_(t,e,i){t.O_(e,i),this.Jl(),this.Nc(this.Gc(t,2))}B_(t,e){t.B_(e),this.Nc(this.Gc(t,2))}A_(t,e,i){e.Vo()||t.A_(e,i)}I_(t,e,i){e.Vo()||(t.I_(e,i),this.Jl(),this.Nc(this.Gc(t,2)))}z_(t,e){e.Vo()||(t.z_(e),this.Nc(this.Gc(t,2)))}E_(t,e){t.E_(e),this.Nc(this.Gc(t,2))}Jc(t){this.yl.Go(t)}Qc(t,e){const i=this.St();if(i.Ni()||0===e)return;const s=i.Hi();t=Math.max(1,Math.min(t,s)),i.Zu(t,e),this.Wu()}td(t){this.nd(0),this.sd(t),this.ed()}rd(t){this.yl.Jo(t),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(t){this.yl.t_(t)}sd(t){this.yl.i_(t),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(t,e,i,s,n){this.vt.gn(t,e);let r=NaN,o=this.yl.Nu(t);const h=this.yl.Xs();null!==h&&(o=Math.min(Math.max(h.Os(),o),h.ui()));const l=s.vn(),a=l.Ct();null!==a&&(r=l.pn(e,a)),r=this.Bc.Oa(r,o,s),this.vt.kn(o,r,s),this.oa(),n||this.Rc.m(this.vt.xt(),{x:t,y:e},i)}ad(t,e,i){const s=i.vn(),n=s.Ct(),r=s.Rt(t,_(n)),o=this.yl.Va(e,!0),h=this.yl.It(_(o));this.ld(h,r,null,i,!0)}od(t){this.Zc().Cn(),this.oa(),t||this.Rc.m(null,null,null)}Jl(){const t=this.vt.Ht();if(null!==t){const e=this.vt.xn(),i=this.vt.Sn();this.ld(e,i,null,t)}this.vt.Vn()}_d(t,e,i){const s=this.yl.mn(0);void 0!==e&&void 0!==i&&this.yl.bt(e,i);const n=this.yl.mn(0),r=this.yl.Eu(),o=this.yl.Xs();if(null!==o&&null!==s&&null!==n){const e=o.Kr(r),h=this.q_.key(s)>this.q_.key(n),l=null!==t&&t>r&&!h,a=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,c=e&&(!(void 0===i)||a)&&this.yl.W().shiftVisibleRangeOnNewBar;if(l&&!c){const e=t-r;this.yl.Jn(this.yl.Hu()-e)}}this.yl.Yu(t)}ia(t){null!==t&&t.F_()}dr(t){const e=this.yc.find(e=>e.Uo().includes(t));return void 0===e?null:e}Wu(){this.Ac.Vn(),this.yc.forEach(t=>t.F_()),this.Jl()}S(){this.yc.forEach(t=>t.S()),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(t,e,i){const s=this.yc[0],n=this.fd(e,t,s,i);return this.Cc.push(n),1===this.Cc.length?this.Kl():this.Uh(),n}vd(t){const e=this.dr(t),i=this.Cc.indexOf(t);E(-1!==i,"Series not found"),this.Cc.splice(i,1),_(e).Zo(t),t.S&&t.S()}Xl(t,e){const i=_(this.dr(t));i.Zo(t);const s=this.Uc(e);if(null===s){const s=t.Xi();i.qo(t,e,s)}else{const n=s.Ht===i?t.Xi():void 0;s.Ht.qo(t,e,n)}}hc(){const t=wt.ss();t.$n(),this.Nc(t)}pd(t){const e=wt.ss();e.Yn(t),this.Nc(e)}Kn(){const t=wt.ss();t.Kn(),this.Nc(t)}Gn(t){const e=wt.ss();e.Gn(t),this.Nc(e)}Jn(t){const e=wt.ss();e.Jn(t),this.Nc(e)}Zn(t){const e=wt.ss();e.Zn(t),this.Nc(e)}Un(){const t=wt.ss();t.Un(),this.Nc(t)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(t){const e=this.Ec,i=this.zc;if(e===i)return e;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Dc||this.Dc.Ps!==i||this.Dc.Rs!==e)this.Dc={Ps:i,Rs:e,wd:new Map};else{const e=this.Dc.wd.get(t);if(void 0!==e)return e}const s=function(t,e,i){const[s,n,r,o]=$(t),[h,l,a,c]=$(e),u=[T(s+i*(h-s)),T(n+i*(l-n)),T(r+i*(a-r)),R(o+i*(c-o))];return`rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(i,e,t/100);return this.Dc.wd.set(t,s),s}Gc(t,e){const i=new wt(e);if(null!==t){const s=this.yc.indexOf(t);i.Nn(s,{Fn:e})}return i}Fc(t,e){return void 0===e&&(e=2),this.Gc(this.dr(t),e)}Nc(t){this.Vc&&this.Vc(t),this.yc.forEach(t=>t.j_().qh().bt())}fd(t,e,i,s){const n=new si(this,t,e,i,s),r=void 0!==t.priceScaleId?t.priceScaleId:this.md();return i.qo(n,r),bt(r)||n.$h(t),n}Lc(t){const e=this.cn.layout;return"gradient"===e.background.type?0===t?e.background.topColor:e.background.bottomColor:e.background.color}}function Ii(t){return!B(t)&&!j(t)}function Ui(t){return B(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(Di||(Di={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(Ai||(Ai={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(Bi||(Bi={})),function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"}(Wi||(Wi={}));const Hi=t=>t.getUTCFullYear();class Ki{constructor(t="yyyy-MM-dd",e="default"){this.gd=t,this.Md=e}Y_(t){return function(t,e,i){return e.replace(/yyyy/g,(t=>yt(Hi(t),4))(t)).replace(/yy/g,(t=>yt(Hi(t)%100,2))(t)).replace(/MMMM/g,((t,e)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"long"}))(t,i)).replace(/MMM/g,((t,e)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"short"}))(t,i)).replace(/MM/g,(t=>yt((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>yt((t=>t.getUTCDate())(t),2))(t))}(t,this.gd,this.Md)}}class qi{constructor(t){this.xd=t||"%h:%m:%s"}Y_(t){return this.xd.replace("%h",yt(t.getUTCHours(),2)).replace("%m",yt(t.getUTCMinutes(),2)).replace("%s",yt(t.getUTCSeconds(),2))}}const Xi={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class Gi{constructor(t={}){const e=Object.assign(Object.assign({},Xi),t);this.Td=new Ki(e.Sd,e.Cd),this.Pd=new qi(e.kd),this.Rd=e.yd}Y_(t){return`${this.Td.Y_(t)}${this.Rd}${this.Pd.Y_(t)}`}}function Ji(t){return 60*t*60*1e3}function Qi(t){return 60*t*1e3}const Yi=[{Dd:1e3,Vd:10},{Dd:Qi(1),Vd:20},{Dd:Qi(5),Vd:21},{Dd:Qi(30),Vd:22},{Dd:Ji(1),Vd:30},{Dd:Ji(3),Vd:31},{Dd:Ji(6),Vd:32},{Dd:Ji(12),Vd:33}];function Zi(t,e){if(t.getUTCFullYear()!==e.getUTCFullYear())return 70;if(t.getUTCMonth()!==e.getUTCMonth())return 60;if(t.getUTCDate()!==e.getUTCDate())return 50;for(let i=Yi.length-1;i>=0;--i)if(Math.floor(e.getTime()/Yi[i].Dd)!==Math.floor(t.getTime()/Yi[i].Dd))return Yi[i].Vd;return 0}function ts(t){let e=t;if(j(t)&&(e=is(t)),!Ii(e))throw new Error("time must be of type BusinessDay");const i=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(i.getTime()/1e3),Bd:e}}function es(t){if(!Ui(t))throw new Error("time must be of type isUTCTimestamp");return{Od:t}}function is(t){const e=new Date(t);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function ss(t){j(t.time)&&(t.time=is(t.time))}class ns{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(ss)}(t):ss(t)}createConverterToInternalObj(t){return _(function(t){return 0===t.length?null:Ii(t[0].time)||j(t[0].time)?ts:es}(t))}key(t){return"object"==typeof t&&"Od"in t?t.Od:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){const e=t;return void 0===e.Bd?new Date(1e3*e.Od).getTime():new Date(Date.UTC(e.Bd.year,e.Bd.month-1,e.Bd.day)).getTime()}convertHorzItemToInternal(t){return Ui(e=t)?es(e):Ii(e)?ts(e):ts(is(e));var e}updateFormatter(t){if(!this.cn)return;const e=t.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new Gi({Sd:e,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:t.locale}):this.Ad=new Ki(e,t.locale)}formatHorzItem(t){const e=t;return this.Ad.Y_(new Date(1e3*e.Od))}formatTickmark(t,e){const i=function(t,e,i){switch(t){case 0:case 10:return e?i?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return e?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),s=this.cn.timeScale;if(void 0!==s.tickMarkFormatter){const n=s.tickMarkFormatter(t.originalTime,i,e.locale);if(null!==n)return n}return function(t,e,i){const s={};switch(e){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"}const n=void 0===t.Bd?new Date(1e3*t.Od):new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day));return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()).toLocaleString(i,s)}(t.time,i,e.locale)}maxTickMarkWeight(t){let e=t.reduce(Ni,t[0]).weight;return e>30&&e<50&&(e=30),e}fillWeightsForPoints(t,e){!function(t,e=0){if(0===t.length)return;let i=0===e?null:t[e-1].time.Od,s=null!==i?new Date(1e3*i):null,n=0;for(let r=e;r<t.length;++r){const e=t[r],o=new Date(1e3*e.time.Od);null!==s&&(e.timeWeight=Zi(o,s)),n+=e.time.Od-(i||e.time.Od),i=e.time.Od,s=o}if(0===e&&t.length>1){const e=Math.ceil(n/(t.length-1)),i=new Date(1e3*(t[0].time.Od-e));t[0].timeWeight=Zi(new Date(1e3*t[0].time.Od),i)}}(t,e)}static Id(t){return A({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const rs="undefined"!=typeof window;function os(){return!!rs&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function hs(){return!!rs&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function ls(t){return t+t%2}function as(t,e){return t.zd-e.zd}function cs(t,e,i){const s=(t.zd-e.zd)/(t.ot-e.ot);return Math.sign(s)*Math.min(Math.abs(s),i)}class us{constructor(t,e,i,s){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=t,this.Ud=e,this.qd=i,this.rs=s}Yd(t,e){if(null!==this.Ld){if(this.Ld.ot===e)return void(this.Ld.zd=t);if(Math.abs(this.Ld.zd-t)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:e,zd:t}}Vr(t,e){if(null===this.Ld||null===this.Ed)return;if(e-this.Ld.ot>50)return;let i=0;const s=cs(this.Ld,this.Ed,this.Ud),n=as(this.Ld,this.Ed),r=[s],o=[n];if(i+=n,null!==this.Nd){const t=cs(this.Ed,this.Nd,this.Ud);if(Math.sign(t)===Math.sign(s)){const e=as(this.Ed,this.Nd);if(r.push(t),o.push(e),i+=e,null!==this.Fd){const t=cs(this.Nd,this.Fd,this.Ud);if(Math.sign(t)===Math.sign(s)){const e=as(this.Nd,this.Fd);r.push(t),o.push(e),i+=e}}}}let h=0;for(let t=0;t<r.length;++t)h+=o[t]/i*r[t];Math.abs(h)<this.$d||(this.Wd={zd:t,ot:e},this.Hd=h,this.jd=function(t,e){const i=Math.log(e);return Math.log(1*i/-t)/i}(Math.abs(h),this.qd))}tc(t){const e=_(this.Wd),i=t-e.ot;return e.zd+this.Hd*(Math.pow(this.qd,i)-1)/Math.log(this.qd)}Qu(t){return null===this.Wd||this.Zd(t)===this.jd}Zd(t){const e=t-_(this.Wd).ot;return Math.min(e,this.jd)}}class ds{constructor(t,e){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=t,this.Qd=e,this.tf()}bt(){this.tf()}if(){this.Xd&&this.Jd.removeChild(this.Xd),this.Kd&&this.Jd.removeChild(this.Kd),this.Xd=void 0,this.Kd=void 0}nf(){return this.en!==this.sf()||this.Gd!==this.ef()}ef(){return V($(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}tf(){this.nf()&&(this.if(),this.en=this.sf(),this.en&&(this.Gd=this.ef(),this.Kd=document.createElement("style"),this.Kd.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.Xd=document.createElement("a"),this.Xd.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.rf()}`,this.Xd.title="Charting by TradingView",this.Xd.id="tv-attr-logo",this.Xd.target="_blank",this.Xd.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 19" 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.Xd.toggleAttribute("data-dark","dark"===this.Gd),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function fs(t,e){const i=_(t.ownerDocument).createElement("canvas");t.appendChild(i);const s=(n={options:{allowResizeObserver:!1},transform:(t,e)=>({width:Math.max(t.width,e.width),height:Math.max(t.height,e.height)})},new h(i,n.transform,n.options));var n;return s.resizeCanvasElement(e),s}function ms(t){var e;t.width=1,t.height=1,null===(e=t.getContext("2d"))||void 0===e||e.clearRect(0,0,1,1)}function ps(t,e,i,s){t.gl&&t.gl(e,i,s)}function gs(t,e,i,s){t.X(e,i,s)}function vs(t,e,i,s){const n=t(i,s);for(const t of n){const i=t.gt();null!==i&&e(i)}}class bs{constructor(t,e,i){this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.df=null,this.ff=!1,this.vf=null,this.pf=null,this.mf=!1,this.bf=!1,this.wf=!1,this.gf=null,this.Mf=null,this.xf=null,this.Sf=null,this.kf=null,this.yf=null,this.Cf=null,this.Tf=0,this.Pf=!1,this.Rf=!1,this.Df=!1,this.Vf=0,this.Of=null,this.Bf=!hs(),this.Af=t=>{this.If(t)},this.zf=t=>{if(this.Lf(t)){const e=this.Ef(t);if(++this._f,this.uf&&this._f>1){const{Nf:i}=this.Ff(Ss(t),this.cf);i<30&&!this.wf&&this.Wf(e,this.Hf.jf),this.$f()}}else{const e=this.Ef(t);if(++this.hf,this.lf&&this.hf>1){const{Nf:i}=this.Ff(Ss(t),this.af);i<5&&!this.bf&&this.Uf(e,this.Hf.qf),this.Yf()}}},this.Zf=t,this.Hf=e,this.cn=i,this.Xf()}S(){null!==this.gf&&(this.gf(),this.gf=null),null!==this.Mf&&(this.Mf(),this.Mf=null),null!==this.Sf&&(this.Sf(),this.Sf=null),null!==this.kf&&(this.kf(),this.kf=null),null!==this.yf&&(this.yf(),this.yf=null),null!==this.xf&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(t){this.Sf&&this.Sf();const e=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",e)},this.Zf.addEventListener("mousemove",e),this.Lf(t))return;const i=this.Ef(t);this.Uf(i,this.Hf.Qf),this.Bf=!0}Yf(){null!==this.lf&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){null!==this.uf&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(t){if(this.Df||null!==this.pf)return;if(this.Lf(t))return;const e=this.Ef(t);this.Uf(e,this.Hf.tv),this.Bf=!0}iv(t){const e=Ms(t.changedTouches,_(this.Of));if(null===e)return;if(this.Vf=Cs(t),null!==this.Cf)return;if(this.Rf)return;this.Pf=!0;const i=this.Ff(Ss(e),_(this.pf)),{nv:s,sv:n,Nf:r}=i;if(this.mf||!(r<5)){if(!this.mf){const t=.5*s,e=n>=t&&!this.cn.ev(),i=t>n&&!this.cn.rv();e||i||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const i=this.Ef(t,e);this.Wf(i,this.Hf.hv),ys(t)}}}lv(t){if(0!==t.button)return;const e=this.Ff(Ss(t),_(this.vf)),{Nf:i}=e;if(i>=5&&(this.bf=!0,this.Yf()),this.bf){const e=this.Ef(t);this.Uf(e,this.Hf.av)}}Ff(t,e){const i=Math.abs(e.nt-t.nt),s=Math.abs(e.st-t.st);return{nv:i,sv:s,Nf:i+s}}ov(t){let e=Ms(t.changedTouches,_(this.Of));if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null===e)return;this.Of=null,this.Vf=Cs(t),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const i=this.Ef(t,e);if(this.Wf(i,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:t}=this.Ff(Ss(e),this.cf);t<30&&!this.wf&&this.Wf(i,this.Hf.jf),this.$f()}else this.wf||(this.Wf(i,this.Hf.uv),this.Hf.uv&&ys(t));0===this._f&&ys(t),0===t.touches.length&&this.ff&&(this.ff=!1,ys(t))}If(t){if(0!==t.button)return;const e=this.Ef(t);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),os()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(t))if(this.Uf(e,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:i}=this.Ff(Ss(t),this.af);i<5&&!this.bf&&this.Uf(e,this.Hf.qf),this.Yf()}else this.bf||this.Uf(e,this.Hf.dv)}Kf(){null!==this.df&&(clearTimeout(this.df),this.df=null)}fv(t){if(null!==this.Of)return;const e=t.changedTouches[0];this.Of=e.identifier,this.Vf=Cs(t);const i=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=Ss(e),this.yf&&(this.yf(),this.yf=null);{const e=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{i.removeEventListener("touchmove",e),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",e,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,t),240)}const s=this.Ef(t,e);this.Wf(s,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=Ss(e))}mv(t){if(0!==t.button)return;const e=this.Zf.ownerDocument.documentElement;os()&&e.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=Ss(t),this.kf&&(this.kf(),this.kf=null);{const t=this.lv.bind(this),i=this.If.bind(this);this.kf=()=>{e.removeEventListener("mousemove",t),e.removeEventListener("mouseup",i)},e.addEventListener("mousemove",t),e.addEventListener("mouseup",i)}if(this.Df=!0,this.Lf(t))return;const i=this.Ef(t);this.Uf(i,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=Ss(t))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const t=this.Zf.ownerDocument,e=t=>{this.Hf.wv&&(t.composed&&this.Zf.contains(t.composedPath()[0])||t.target&&this.Zf.contains(t.target)||this.Hf.wv())};this.Mf=()=>{t.removeEventListener("touchstart",e)},this.gf=()=>{t.removeEventListener("mousedown",e)},t.addEventListener("mousedown",e),t.addEventListener("touchstart",e,{passive:!0})}hs()&&(this.xf=()=>{this.Zf.removeEventListener("dblclick",this.zf)},this.Zf.addEventListener("dblclick",this.zf)),this.Zf.addEventListener("mouseleave",this.gv.bind(this)),this.Zf.addEventListener("touchstart",this.fv.bind(this),{passive:!0}),function(t){rs&&void 0!==window.chrome&&t.addEventListener("mousedown",t=>{if(1===t.button)return t.preventDefault(),!1})}(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",()=>{},{passive:!1})}Mv(){void 0===this.Hf.xv&&void 0===this.Hf.Sv&&void 0===this.Hf.kv||(this.Zf.addEventListener("touchstart",t=>this.yv(t.touches),{passive:!0}),this.Zf.addEventListener("touchmove",t=>{if(2===t.touches.length&&null!==this.Cf&&void 0!==this.Hf.Sv){const e=ws(t.touches[0],t.touches[1])/this.Tf;this.Hf.Sv(this.Cf,e),ys(t)}},{passive:!1}),this.Zf.addEventListener("touchend",t=>{this.yv(t.touches)}))}yv(t){1===t.length&&(this.Pf=!1),2!==t.length||this.Pf||this.ff?this.Cv():this.Tv(t)}Tv(t){const e=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(t[0].clientX-e.left+(t[1].clientX-e.left))/2,st:(t[0].clientY-e.top+(t[1].clientY-e.top))/2},this.Tf=ws(t[0],t[1]),void 0!==this.Hf.xv&&this.Hf.xv(),this.Kf()}Cv(){null!==this.Cf&&(this.Cf=null,void 0!==this.Hf.kv&&this.Hf.kv())}gv(t){if(this.Sf&&this.Sf(),this.Lf(t))return;if(!this.Bf)return;const e=this.Ef(t);this.Uf(e,this.Hf.Pv),this.Bf=!hs()}vv(t){const e=Ms(t.touches,_(this.Of));if(null===e)return;const i=this.Ef(t,e);this.Wf(i,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:Cs(t)<this.Vf+500}Wf(t,e){e&&e.call(this.Hf,t)}Uf(t,e){e&&e.call(this.Hf,t)}Ef(t,e){const i=e||t,s=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,localX:i.clientX-s.left,localY:i.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,Dv:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,Vv:t.type,Ov:i.target,Bv:t.view,Av:()=>{"touchstart"!==t.type&&ys(t)}}}}function ws(t,e){const i=t.clientX-e.clientX,s=t.clientY-e.clientY;return Math.sqrt(i*i+s*s)}function ys(t){t.cancelable&&t.preventDefault()}function Ss(t){return{nt:t.pageX,st:t.pageY}}function Cs(t){return t.timeStamp||performance.now()}function Ms(t,e){for(let i=0;i<t.length;++i)if(t[i].identifier===e)return t[i];return null}function Es(t){return{Hc:t.Hc,Iv:{gr:t.zv.externalId},Lv:t.zv.cursorStyle}}function xs(t,e,i){for(const s of t){const t=s.gt();if(null!==t&&t.wr){const n=t.wr(e,i);if(null!==n)return{Bv:s,Iv:n}}}return null}function _s(t,e){return i=>{var s,n,r,o;return(null!==(n=null===(s=i.Dt())||void 0===s?void 0:s.Pa())&&void 0!==n?n:"")!==e?[]:null!==(o=null===(r=i.da)||void 0===r?void 0:r.call(i,t))&&void 0!==o?o:[]}}function zs(t,e,i,s){if(!t.length)return;let n=0;const r=i/2,o=t[0].At(s,!0);let h=1===e?r-(t[0].Vi()-o/2):t[0].Vi()-o/2-r;h=Math.max(0,h);for(let r=1;r<t.length;r++){const o=t[r],l=t[r-1],a=l.At(s,!1),c=o.Vi(),u=l.Vi();if(1===e?c>u-a:c<u+a){const s=u-a*e;o.Oi(s);const r=s-e*a/2;if((1===e?r<0:r>i)&&h>0){const s=1===e?-1-r:r-i,o=Math.min(s,h);for(let i=n;i<t.length;i++)t[i].Oi(t[i].Vi()+e*o);h-=o}}else n=r,h=1===e?u-a-c:c-(u+a)}}class ks{constructor(t,e,i,s){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new ae(200),this.Qr=null,this.Wv=0,this.jv=!1,this.Hv=()=>{this.jv||this.tn.$v().$t().Uh()},this.Uv=()=>{this.jv||this.tn.$v().$t().Uh()},this.tn=t,this.cn=e,this.ko=e.layout,this.Oc=i,this.qv="left"===s,this.Yv=_s("normal",s),this.Zv=_s("top",s),this.Xv=_s("bottom",s),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=fs(this.Kv,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=fs(this.Kv,n({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const o=this.Jv.canvasElement;o.style.position="absolute",o.style.zIndex="2",o.style.left="0",o.style.top="0";const h={bv:this.Qv.bind(this),pv:this.Qv.bind(this),av:this.tp.bind(this),hv:this.tp.bind(this),wv:this.ip.bind(this),cv:this.np.bind(this),_v:this.np.bind(this),qf:this.sp.bind(this),jf:this.sp.bind(this),Qf:this.ep.bind(this),Pv:this.rp.bind(this)};this.hp=new bs(this.Jv.canvasElement,h,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),ms(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose(),null!==this.Li&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const t=this.Oc.W();return this.Qr!==t.R&&(this.Fv.nr(),this.Qr=t.R),t}op(){if(null===this.Li)return 0;let t=0;const e=this.ap(),i=_(this.Gv.canvasElement.getContext("2d"));i.save();const s=this.Li.Ha();i.font=this._p(),s.length>0&&(t=Math.max(this.Fv.xi(i,s[0].so),this.Fv.xi(i,s[s.length-1].so)));const n=this.up();for(let e=n.length;e--;){const s=this.Fv.xi(i,n[e].Kt());s>t&&(t=s)}const r=this.Li.Ct();if(null!==r&&null!==this.Ev&&2!==(o=this.cn.crosshair).mode&&o.horzLine.visible&&o.horzLine.labelVisible){const e=this.Li.pn(1,r),s=this.Li.pn(this.Ev.height-2,r);t=Math.max(t,this.Fv.xi(i,this.Li.Fi(Math.floor(Math.min(e,s))+.11111111111111,r)),this.Fv.xi(i,this.Li.Fi(Math.ceil(Math.max(e,s))-.11111111111111,r)))}var o;i.restore();const h=t||34;return ls(Math.ceil(e.C+e.T+e.A+e.I+5+h))}cp(t){null!==this.Ev&&r(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`)}dp(){return _(this.Ev).width}Gi(t){this.Li!==t&&(null!==this.Li&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const t=this.tn.fp();this.tn.$v().$t().E_(t,_(this.Dt()))}vp(t){if(null===this.Ev)return;if(1!==t){this.pp(),this.Gv.applySuggestedBitmapSize();const t=c(this.Gv);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.mp(t),this.Ie(t)}),this.tn.bp(t,this.Xv),this.wp(t),this.tn.bp(t,this.Yv),this.gp(t))}this.Jv.applySuggestedBitmapSize();const e=c(this.Jv);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:e})=>{t.clearRect(0,0,e.width,e.height)}),this.Mp(e),this.tn.bp(e,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}bt(){var t;null===(t=this.Li)||void 0===t||t.Ha()}Qv(t){if(null===this.Li||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!0,e.V_(i,this.Li,t.localY)}tp(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp(),s=this.Li;e.O_(i,s,t.localY)}ip(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),e=this.tn.fp(),i=this.Li;this.Nv&&(this.Nv=!1,t.B_(e,i))}np(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!1,e.B_(i,this.Li)}sp(t){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(t){null!==this.Li&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(t){this.kp(0)}up(){const t=[],e=null===this.Li?void 0:this.Li;return(i=>{for(let s=0;s<i.length;++s){const n=i[s].Rn(this.tn.fp(),e);for(let e=0;e<n.length;e++)t.push(n[e])}})(this.tn.fp().Uo()),t}mp({context:t,bitmapSize:e}){const{width:i,height:s}=e,n=this.tn.fp().$t(),r=n.q(),o=n.bd();r===o?rt(t,0,0,i,s,r):lt(t,0,0,i,s,r,o)}Ie({context:t,bitmapSize:e,horizontalPixelRatio:i}){if(null===this.Ev||null===this.Li||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.ap().C*i));let n;n=this.qv?e.width-s:0,t.fillRect(n,0,s,e.height)}wp(t){if(null===this.Ev||null===this.Li)return;const e=this.Li.Ha(),i=this.Li.W(),s=this.ap(),n=this.qv?this.Ev.width-s.T:0;i.borderVisible&&i.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:r,verticalPixelRatio:o})=>{t.fillStyle=i.borderColor;const h=Math.max(1,Math.floor(o)),l=Math.floor(.5*o),a=Math.round(s.T*r);t.beginPath();for(const i of e)t.rect(Math.floor(n*r),Math.round(i.Ea*o)-l,a,h);t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{var r;t.font=this._p(),t.fillStyle=null!==(r=i.textColor)&&void 0!==r?r:this.ko.textColor,t.textAlign=this.qv?"right":"left",t.textBaseline="middle";const o=this.qv?Math.round(n-s.A):Math.round(n+s.T+s.A),h=e.map(e=>this.Fv.Mi(t,e.so));for(let i=e.length;i--;){const s=e[i];t.fillText(s.so,o,s.Ea+h[i])}})}pp(){if(null===this.Ev||null===this.Li)return;const t=[],e=this.Li.Uo().slice(),i=this.tn.fp(),s=this.ap();this.Li===i.pr()&&this.tn.fp().Uo().forEach(t=>{i.vr(t)&&e.push(t)});const n=this.Li;e.forEach(e=>{e.Rn(i,n).forEach(e=>{e.Oi(null),e.Bi()&&t.push(e)})}),t.forEach(t=>t.Oi(t.ki())),this.Li.W().alignLabels&&this.yp(t,s)}yp(t,e){if(null===this.Ev)return;const i=this.Ev.height/2,s=t.filter(t=>t.ki()<=i),n=t.filter(t=>t.ki()>i);s.sort((t,e)=>e.ki()-t.ki()),n.sort((t,e)=>t.ki()-e.ki());for(const i of t){const t=Math.floor(i.At(e)/2),s=i.ki();s>-t&&s<t&&i.Oi(t),s>this.Ev.height-t&&s<this.Ev.height+t&&i.Oi(this.Ev.height-t)}zs(s,1,this.Ev.height,e),zs(n,-1,this.Ev.height,e)}gp(t){if(null===this.Ev)return;const e=this.up(),i=this.ap(),s=this.qv?"right":"left";e.forEach(e=>{e.Ai()&&e.gt(_(this.Li)).X(t,i,this.Fv,s)})}Mp(t){if(null===this.Ev||null===this.Li)return;const e=this.tn.$v().$t(),i=[],s=this.tn.fp(),n=e.Zc().Rn(s,this.Li);n.length&&i.push(n);const r=this.ap(),o=this.qv?"right":"left";i.forEach(e=>{e.forEach(e=>{e.gt(_(this.Li)).X(t,r,this.Fv,o)})})}kp(t){this.Kv.style.cursor=1===t?"ns-resize":"default"}fo(){const t=this.op();this.Wv<t&&this.tn.$v().$t().Kl(),this.Wv=t}_p(){return X(this.ko.fontSize,this.ko.fontFamily)}}function Ts(t,e){var i,s;return null!==(s=null===(i=t.ua)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}function Rs(t,e){var i,s;return null!==(s=null===(i=t.Pn)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}function Ns(t,e){var i,s;return null!==(s=null===(i=t.Ji)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}function Ls(t,e){var i,s;return null!==(s=null===(i=t.aa)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:[]}class Os{constructor(t,e){this.Ev=n({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new D,this.Op=new D,this.Bp=0,this.Ap=!1,this.Ip=null,this.zp=!1,this.Lp=null,this.Ep=null,this.jv=!1,this.Hv=()=>{this.jv||null===this.Np||this.$i().Uh()},this.Uv=()=>{this.jv||null===this.Np||this.$i().Uh()},this.Qd=t,this.Np=e,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const i=document.createElement("div");i.style.width="100%",i.style.height="100%",i.style.position="relative",i.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(i),this.Gv=fs(i,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const s=this.Gv.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Jv=fs(i,n({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const r=this.Jv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new bs(this.Jv.canvasElement,this,{ev:()=>null===this.Ip&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>null===this.Ip&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){null!==this.Cp&&this.Cp.S(),null!==this.Tp&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),ms(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose(),null!==this.Np&&this.Np.W_().p(this),this.hp.S()}fp(){return _(this.Np)}qp(t){var e,i;null!==this.Np&&this.Np.W_().p(this),this.Np=t,null!==this.Np&&this.Np.W_().l(Os.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=null!==(e=this.Pp)&&void 0!==e?e:new ds(this.Wp,this.Qd),this.Pp.bt()):(null===(i=this.Pp)||void 0===i||i.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(null!==this.Np&&(this.Zp(),0!==this.$i().wt().length)){if(null!==this.Cp){const t=this.Np.R_();this.Cp.Gi(_(t))}if(null!==this.Tp){const t=this.Np.D_();this.Tp.Gi(_(t))}}}Xp(){null!==this.Cp&&this.Cp.bt(),null!==this.Tp&&this.Tp.bt()}M_(){return null!==this.Np?this.Np.M_():0}x_(t){this.Np&&this.Np.x_(t)}Qf(t){if(!this.Np)return;this.Kp();const e=t.localX,i=t.localY;this.Gp(e,i,t)}bv(t){this.Kp(),this.Jp(),this.Gp(t.localX,t.localY,t)}tv(t){var e;if(!this.Np)return;this.Kp();const i=t.localX,s=t.localY;this.Gp(i,s,t);const n=this.wr(i,s);this.Qd.Qp(null!==(e=null==n?void 0:n.Lv)&&void 0!==e?e:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(t){null!==this.Np&&(this.Kp(),this.tm(t))}qf(t){null!==this.Np&&this.im(this.Op,t)}jf(t){this.qf(t)}av(t){this.Kp(),this.nm(t),this.Gp(t.localX,t.localY,t)}cv(t){null!==this.Np&&(this.Kp(),this.Ap=!1,this.sm(t))}uv(t){null!==this.Np&&this.tm(t)}Rv(t){if(this.Ap=!0,null===this.Ip){const e={x:t.localX,y:t.localY};this.rm(e,e,t)}}Pv(t){null!==this.Np&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(t,e){if(!this.Qd.W().handleScale.pinch)return;const i=5*(e-this.Bp);this.Bp=e,this.$i().Qc(t.nt,i)}pv(t){this.Ap=!1,this.zp=null!==this.Ip,this.Jp();const e=this.$i().Zc();null!==this.Ip&&e.yt()&&(this.Lp={x:e.Yt(),y:e.Zt()},this.Ip={x:t.localX,y:t.localY})}hv(t){if(null===this.Np)return;const e=t.localX,i=t.localY;if(null===this.Ip)this.nm(t);else{this.zp=!1;const s=_(this.Lp),n=s.x+(e-this.Ip.x),r=s.y+(i-this.Ip.y);this.Gp(n,r,t)}}_v(t){0===this.$v().W().trackingMode.exitMode&&(this.zp=!0),this.om(),this.sm(t)}wr(t,e){const i=this.Np;return null===i?null:function(t,e,i){const s=t.Uo(),n=function(t,e,i){var s,n;let r,o;for(const a of t){const t=null!==(n=null===(s=a.va)||void 0===s?void 0:s.call(a,e,i))&&void 0!==n?n:[];for(const e of t)h=e.zOrder,(!(l=null==r?void 0:r.zOrder)||"top"===h&&"top"!==l||"normal"===h&&"bottom"===l)&&(r=e,o=a)}var h,l;return r&&o?{zv:r,Hc:o}:null}(s,e,i);if("top"===(null==n?void 0:n.zv.zOrder))return Es(n);for(const r of s){if(n&&n.Hc===r&&"bottom"!==n.zv.zOrder&&!n.zv.isBackground)return Es(n);const s=xs(r.Pn(t),e,i);if(null!==s)return{Hc:r,Bv:s.Bv,Iv:s.Iv};if(n&&n.Hc===r&&"bottom"!==n.zv.zOrder&&n.zv.isBackground)return Es(n)}return(null==n?void 0:n.zv)?Es(n):null}(i,t,e)}_m(t,e){_("left"===e?this.Cp:this.Tp).cp(n({width:t,height:this.Ev.height}))}um(){return this.Ev}cp(t){r(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Wp.style.width=t.width+"px",this.Wp.style.height=t.height+"px")}dm(){const t=_(this.Np);t.P_(t.R_()),t.P_(t.D_());for(const e of t.Ba())if(t.vr(e)){const i=e.Dt();null!==i&&t.P_(i),e.Vn()}}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}vp(t){if(0===t)return;if(null===this.Np)return;if(t>1&&this.dm(),null!==this.Cp&&this.Cp.vp(t),null!==this.Tp&&this.Tp.vp(t),1!==t){this.Gv.applySuggestedBitmapSize();const t=c(this.Gv);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.mp(t)}),this.Np&&(this.fm(t,Ts),this.vm(t),this.pm(t),this.fm(t,Rs),this.fm(t,Ns)))}this.Jv.applySuggestedBitmapSize();const e=c(this.Jv);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:e})=>{t.clearRect(0,0,e.width,e.height)}),this.bm(e),this.fm(e,Ls))}wm(){return this.Cp}gm(){return this.Tp}bp(t,e){this.fm(t,e)}Fp(){null!==this.Np&&this.Np.W_().p(this),this.Np=null}tm(t){this.im(this.Vp,t)}im(t,e){const i=e.localX,s=e.localY;t.M()&&t.m(this.$i().St().Nu(i),{x:i,y:s},e)}mp({context:t,bitmapSize:e}){const{width:i,height:s}=e,n=this.$i(),r=n.q(),o=n.bd();r===o?rt(t,0,0,i,s,o):lt(t,0,0,i,s,r,o)}vm(t){const e=_(this.Np).j_().qh().gt();null!==e&&e.X(t,!1)}pm(t){const e=this.$i().Yc();this.Mm(t,Rs,ps,e),this.Mm(t,Rs,gs,e)}bm(t){this.Mm(t,Rs,gs,this.$i().Zc())}fm(t,e){const i=_(this.Np).Uo();for(const s of i)this.Mm(t,e,ps,s);for(const s of i)this.Mm(t,e,gs,s)}Mm(t,e,i,s){const n=_(this.Np),r=n.$t().Wc(),o=null!==r&&r.Hc===s,h=null!==r&&o&&void 0!==r.Iv?r.Iv.Mr:void 0;vs(e,e=>i(e,t,o,h),s,n)}Zp(){if(null===this.Np)return;const t=this.Qd,e=this.Np.R_().W().visible,i=this.Np.D_().W().visible;e||null===this.Cp||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),i||null===this.Tp||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const s=t.$t().ud();e&&null===this.Cp&&(this.Cp=new ks(this,t.W(),s,"left"),this.jp.appendChild(this.Cp.lp())),i&&null===this.Tp&&(this.Tp=new ks(this,t.W(),s,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(t){return t.Dv&&this.Ap||null!==this.Ip}Sm(t){return Math.max(0,Math.min(t,this.Ev.width-1))}km(t){return Math.max(0,Math.min(t,this.Ev.height-1))}Gp(t,e,i){this.$i().ld(this.Sm(t),this.km(e),i,_(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(t,e,i){this.Ip=t,this.zp=!1,this.Gp(e.x,e.y,i);const s=this.$i().Zc();this.Lp={x:s.Yt(),y:s.Zt()}}$i(){return this.Qd.$t()}sm(t){if(!this.Dp)return;const e=this.$i(),i=this.fp();if(e.z_(i,i.vn()),this.Rp=null,this.Dp=!1,e.ed(),null!==this.Ep){const t=performance.now(),i=e.St();this.Ep.Vr(i.Hu(),t),this.Ep.Qu(t)||e.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)_(document.activeElement).blur();else{const t=document.getSelection();null!==t&&t.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(t){if(null===this.Np)return;const e=this.$i(),i=e.St();if(i.Ni())return;const s=this.Qd.W(),n=s.handleScroll,r=s.kineticScroll;if((!n.pressedMouseMove||t.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!t.Dv))return;const o=this.Np.vn(),h=performance.now();if(null!==this.Rp||this.xm(t)||(this.Rp={x:t.clientX,y:t.clientY,Od:h,ym:t.localX,Cm:t.localY}),null!==this.Rp&&!this.Dp&&(this.Rp.x!==t.clientX||this.Rp.y!==t.clientY)){if(t.Dv&&r.touch||!t.Dv&&r.mouse){const t=i.le();this.Ep=new us(.2/t,7/t,.997,15/t),this.Ep.Yd(i.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||e.A_(this.Np,o,t.localY),e.nd(t.localX),this.Dp=!0}this.Dp&&(o.Ni()||e.I_(this.Np,o,t.localY),e.sd(t.localX),null!==this.Ep&&this.Ep.Yd(i.Hu(),h))}}class Ps{constructor(t,e,i,s,r){this.ft=!0,this.Ev=n({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv="left"===t,this.Oc=i.ud,this.cn=e,this.Tm=s,this.Pm=r,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=fs(this.Kv,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(t){r(this.Ev,t)||(this.Ev=t,this.Gv.resizeCanvasElement(t),this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`,this.ft=!0)}vp(t){if(t<3&&!this.ft)return;if(0===this.Ev.width||0===this.Ev.height)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const e=c(this.Gv);null!==e&&e.useBitmapCoordinateSpace(t=>{this.mp(t),this.Ie(t)})}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}Ie({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:s}){if(!this.Tm())return;t.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*i),r=Math.floor(this.Oc.W().C*s),o=this.qv?e.width-n:0;t.fillRect(o,0,n,r)}mp({context:t,bitmapSize:e}){rt(t,0,0,e.width,e.height,this.Pm())}}function $s(t){return e=>{var i,s;return null!==(s=null===(i=e.fa)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:[]}}const Vs=$s("normal"),Fs=$s("top"),Ds=$s("bottom");class As{constructor(t,e){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=n({width:0,height:0}),this.Om=new D,this.Fv=new ae(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=t,this.q_=e,this.cn=t.W().layout,this.Xd=document.createElement("tr"),this.Bm=document.createElement("td"),this.Bm.style.padding="0",this.Am=document.createElement("td"),this.Am.style.padding="0",this.Kv=document.createElement("td"),this.Kv.style.height="25px",this.Kv.style.padding="0",this.Im=document.createElement("div"),this.Im.style.width="100%",this.Im.style.height="100%",this.Im.style.position="relative",this.Im.style.overflow="hidden",this.Kv.appendChild(this.Im),this.Gv=fs(this.Im,n({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const i=this.Gv.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jv=fs(this.Im,n({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const s=this.Jv.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.Xd.appendChild(this.Bm),this.Xd.appendChild(this.Kv),this.Xd.appendChild(this.Am),this.zm(),this.Qd.$t().g_().l(this.zm.bind(this),this),this.hp=new bs(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),null!==this.Rm&&this.Rm.S(),null!==this.Dm&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),ms(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ms(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(t){if(this.Vm)return;this.Vm=!0;const e=this.Qd.$t();!e.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&e.Jc(t.localX)}pv(t){this.bv(t)}wv(){const t=this.Qd.$t();!t.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&t.hd())}av(t){const e=this.Qd.$t();!e.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&e.rd(t.localX)}hv(t){this.av(t)}cv(){this.Vm=!1;const t=this.Qd.$t();t.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||t.hd()}_v(){this.cv()}qf(){this.Qd.W().handleScale.axisDoubleClickReset.time&&this.Qd.$t().Kn()}jf(){this.qf()}Qf(){this.Qd.$t().W().handleScale.axisPressedMouseMove.time&&this.kp(1)}Pv(){this.kp(0)}um(){return this.Ev}Nm(){return this.Om}Fm(t,e,i){r(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`,this.Om.m(t)),null!==this.Rm&&this.Rm.cp(n({width:e,height:t.height})),null!==this.Dm&&this.Dm.cp(n({width:i,height:t.height}))}Wm(){const t=this.jm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}vp(t){if(0===t)return;if(1!==t){this.Gv.applySuggestedBitmapSize();const e=c(this.Gv);null!==e&&(e.useBitmapCoordinateSpace(t=>{this.mp(t),this.Ie(t),this.$m(e,Ds)}),this.wp(e),this.$m(e,Vs)),null!==this.Rm&&this.Rm.vp(t),null!==this.Dm&&this.Dm.vp(t)}this.Jv.applySuggestedBitmapSize();const e=c(this.Jv);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:e})=>{t.clearRect(0,0,e.width,e.height)}),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],e),this.$m(e,Fs))}$m(t,e){const i=this.Qd.$t().wt();for(const s of i)vs(e,e=>ps(e,t,!1,void 0),s,void 0);for(const s of i)vs(e,e=>gs(e,t,!1,void 0),s,void 0)}mp({context:t,bitmapSize:e}){rt(t,0,0,e.width,e.height,this.Qd.$t().bd())}Ie({context:t,bitmapSize:e,verticalPixelRatio:i}){if(this.Qd.W().timeScale.borderVisible){t.fillStyle=this.qm();const s=Math.max(1,Math.floor(this.jm().C*i));t.fillRect(0,0,e.width,s)}}wp(t){const e=this.Qd.$t().St(),i=e.Ha();if(!i||0===i.length)return;const s=this.q_.maxTickMarkWeight(i),n=this.jm(),r=e.W();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:e,verticalPixelRatio:s})=>{t.strokeStyle=this.qm(),t.fillStyle=this.qm();const r=Math.max(1,Math.floor(e)),o=Math.floor(.5*e);t.beginPath();const h=Math.round(n.T*s);for(let s=i.length;s--;){const n=Math.round(i[s].coord*e);t.rect(n-o,0,r,h)}t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{const e=n.C+n.T+n.L+n.P/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.$(),t.font=this._p();for(const n of i)if(n.weight<s){const i=n.needAlignCoordinate?this.Ym(t,n.coord,n.label):n.coord;t.fillText(n.label,i,e)}this.Qd.W().timeScale.allowBoldLabels&&(t.font=this.Zm());for(const n of i)if(n.weight>=s){const i=n.needAlignCoordinate?this.Ym(t,n.coord,n.label):n.coord;t.fillText(n.label,i,e)}})}Ym(t,e,i){const s=this.Fv.xi(t,i),n=s/2,r=Math.floor(e-n)+.5;return r<0?e+=Math.abs(0-r):r+s>this.Ev.width&&(e-=Math.abs(this.Ev.width-(r+s))),e}Um(t,e){const i=this.jm();for(const s of t)for(const t of s.Qi())t.gt().X(e,i)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return X(this.j(),this.cn.fontFamily)}Zm(){return X(this.j(),this.cn.fontFamily,"bold")}jm(){null===this.k&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new ae,Hm:0});const t=this.k,e=this._p();if(t.R!==e){const i=this.j();t.P=i,t.R=e,t.L=3*i/12,t.B=3*i/12,t.ji=9*i/12,t.N=0,t.Hm=4*i/12,t.Wi.nr()}return this.k}kp(t){this.Kv.style.cursor=1===t?"ew-resize":"default"}zm(){const t=this.Qd.$t(),e=t.W();e.leftPriceScale.visible||null===this.Rm||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),e.rightPriceScale.visible||null===this.Dm||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const i={ud:this.Qd.$t().ud()},s=()=>e.leftPriceScale.borderVisible&&t.St().W().borderVisible,n=()=>t.bd();e.leftPriceScale.visible&&null===this.Rm&&(this.Rm=new Ps("left",e,i,s,n),this.Bm.appendChild(this.Rm.lp())),e.rightPriceScale.visible&&null===this.Dm&&(this.Dm=new Ps("right",e,i,s,n),this.Am.appendChild(this.Dm.lp()))}}const Bs=!!rs&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!rs&&((null===(Ws=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===Ws?void 0:Ws.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var Ws;class js{constructor(t,e,i){var s;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new D,this.Op=new D,this.Rc=new D,this.ib=null,this.nb=null,this.Jd=t,this.cn=e,this.q_=i,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(s=this.Xd).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Is(this.cn)&&this.hb(!0),this.$i=new ji(this.Vc.bind(this),this.cn,i),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new As(this,this.q_),this.sb.appendChild(this.ab.lp());const n=e.autoSize&&this.ob();let r=this.cn.width,o=this.cn.height;if(n||0===r||0===o){const e=t.getBoundingClientRect();r=r||e.width,o=o||e.height}this._b(r,o),this.ub(),t.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),0!==this.Km&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const t of this.Xm)this.sb.removeChild(t.lp()),t.lm().p(this),t.am().p(this),t.S();this.Xm=[],_(this.ab).S(),null!==this.Xd.parentElement&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(t,e,i=!1){if(this.ho===e&&this.__===t)return;const s=function(t){const e=Math.floor(t.width),i=Math.floor(t.height);return n({width:e-e%2,height:i-i%2})}(n({width:t,height:e}));this.ho=s.height,this.__=s.width;const r=this.ho+"px",o=this.__+"px";_(this.Xd).style.height=r,_(this.Xd).style.width=o,this.sb.style.height=r,this.sb.style.width=o,i?this.mb(wt.es(),performance.now()):this.$i.Kl()}vp(t){void 0===t&&(t=wt.es());for(let e=0;e<this.Xm.length;e++)this.Xm[e].vp(t.Hn(e).Fn);this.cn.timeScale.visible&&this.ab.vp(t.jn())}$h(t){const e=Is(this.cn);this.$i.$h(t);const i=Is(this.cn);i!==e&&this.hb(i),this.cb(),this.bb(t)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){null!==this.Qm&&(this.mb(this.Qm,performance.now()),this.Qm=null);const t=this.gb(null),e=document.createElement("canvas");e.width=t.width,e.height=t.height;const i=_(e.getContext("2d"));return this.gb(i),e}Mb(t){return("left"!==t||this.xb())&&("right"!==t||this.Sb())?0===this.Xm.length?0:_("left"===t?this.Xm[0].wm():this.Xm[0].gm()).dp():0}kb(){return this.cn.autoSize&&null!==this.ib}yb(){return this.Xd}Qp(t){this.nb=t,this.nb?this.yb().style.setProperty("cursor",t):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return x(this.Xm[0]).um()}bb(t){(void 0!==t.autoSize||!this.ib||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.ib&&this.ob(),!1===t.autoSize&&null!==this.ib&&this.pb(),t.autoSize||void 0===t.width&&void 0===t.height||this._b(t.width||this.__,t.height||this.ho))}gb(t){let e=0,i=0;const s=this.Xm[0],r=(e,i)=>{let s=0;for(let n=0;n<this.Xm.length;n++){const r=this.Xm[n],o=_("left"===e?r.wm():r.gm()),h=o.xp();null!==t&&o.Sp(t,i,s),s+=h.height}};this.xb()&&(r("left",0),e+=_(s.wm()).xp().width);for(let s=0;s<this.Xm.length;s++){const n=this.Xm[s],r=n.xp();null!==t&&n.Sp(t,e,i),i+=r.height}e+=s.xp().width,this.Sb()&&(r("right",e),e+=_(s.gm()).xp().width);const o=(e,i,s)=>{_("left"===e?this.ab.Lm():this.ab.Em()).Sp(_(t),i,s)};if(this.cn.timeScale.visible){const e=this.ab.xp();if(null!==t){let n=0;this.xb()&&(o("left",n,i),n=_(s.wm()).xp().width),this.ab.Sp(t,n,i),n+=e.width,this.Sb()&&o("right",n,i)}i+=e.height}return n({width:e,height:i})}Pb(){let t=0,e=0,i=0;for(const s of this.Xm)this.xb()&&(e=Math.max(e,_(s.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(i=Math.max(i,_(s.gm()).op(),this.cn.rightPriceScale.minimumWidth)),t+=s.M_();e=ls(e),i=ls(i);const s=this.__,r=this.ho,o=Math.max(s-e-i,0),h=this.cn.timeScale.visible;let l=h?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var a;l=(a=l)+a%2;const c=0+l,u=r<c?0:r-c,d=u/t;let f=0;for(let t=0;t<this.Xm.length;++t){const s=this.Xm[t];s.qp(this.$i.qc()[t]);let r=0,h=0;h=t===this.Xm.length-1?u-f:Math.round(s.M_()*d),r=Math.max(h,2),f+=r,s.cp(n({width:o,height:r})),this.xb()&&s._m(e,"left"),this.Sb()&&s._m(i,"right"),s.fp()&&this.$i.Kc(s.fp(),r)}this.ab.Fm(n({width:h?o:0,height:l}),h?e:0,h?i:0),this.$i.S_(o),this.Gm!==e&&(this.Gm=e),this.Jm!==i&&(this.Jm=i)}hb(t){t?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return Bs?1/window.devicePixelRatio:1}rb(t){if(!(0!==t.deltaX&&this.cn.handleScroll.mouseWheel||0!==t.deltaY&&this.cn.handleScale.mouseWheel))return;const e=this.Rb(t),i=e*t.deltaX/100,s=-e*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.cn.handleScale.mouseWheel){const e=Math.sign(s)*Math.min(1,Math.abs(s)),i=t.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(i,e)}0!==i&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*i)}mb(t,e){var i;const s=t.jn();3===s&&this.Db(),3!==s&&2!==s||(this.Vb(t),this.Ob(t,e),this.ab.bt(),this.Xm.forEach(t=>{t.Xp()}),3===(null===(i=this.Qm)||void 0===i?void 0:i.jn())&&(this.Qm.ts(t),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,e),t=this.Qm,this.Qm=null)),this.vp(t)}Ob(t,e){for(const i of t.Qn())this.ns(i,e)}Vb(t){const e=this.$i.qc();for(let i=0;i<e.length;i++)t.Hn(i).Wn&&e[i].N_()}ns(t,e){const i=this.$i.St();switch(t.qn){case 0:i.hc();break;case 1:i.lc(t.Vt);break;case 2:i.Gn(t.Vt);break;case 3:i.Jn(t.Vt);break;case 4:i.qu();break;case 5:t.Vt.Qu(e)||i.Jn(t.Vt.tc(e))}}Vc(t){null!==this.Qm?this.Qm.ts(t):this.Qm=t,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame(t=>{if(this.tb=!1,this.Km=0,null!==this.Qm){const e=this.Qm;this.Qm=null,this.mb(e,t);for(const i of e.Qn())if(5===i.qn&&!i.Vt.Qu(t)){this.$t().Zn(i.Vt);break}}}))}Db(){this.ub()}ub(){const t=this.$i.qc(),e=t.length,i=this.Xm.length;for(let t=e;t<i;t++){const t=x(this.Xm.pop());this.sb.removeChild(t.lp()),t.lm().p(this),t.am().p(this),t.S()}for(let s=i;s<e;s++){const e=new Os(this,t[s]);e.lm().l(this.Bb.bind(this),this),e.am().l(this.Ab.bind(this),this),this.Xm.push(e),this.sb.insertBefore(e.lp(),this.ab.lp())}for(let i=0;i<e;i++){const e=t[i],s=this.Xm[i];s.fp()!==e?s.qp(e):s.Up()}this.cb(),this.Pb()}Ib(t,e,i){var s;const n=new Map;let r;if(null!==t&&this.$i.wt().forEach(e=>{const i=e.In().ll(t);null!==i&&n.set(e,i)}),null!==t){const e=null===(s=this.$i.St().Ui(t))||void 0===s?void 0:s.originalTime;void 0!==e&&(r=e)}const o=this.$t().Wc(),h=null!==o&&o.Hc instanceof si?o.Hc:void 0,l=null!==o&&void 0!==o.Iv?o.Iv.gr:void 0;return{zb:r,ee:null!=t?t:void 0,Lb:null!=e?e:void 0,Eb:h,Nb:n,Fb:l,Wb:null!=i?i:void 0}}Bb(t,e,i){this.Vp.m(()=>this.Ib(t,e,i))}Ab(t,e,i){this.Op.m(()=>this.Ib(t,e,i))}lb(t,e,i){this.Rc.m(()=>this.Ib(t,e,i))}cb(){const t=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=t}xb(){return this.Xm[0].fp().R_().W().visible}Sb(){return this.Xm[0].fp().D_().W().visible}ob(){return"ResizeObserver"in window&&(this.ib=new ResizeObserver(t=>{const e=t.find(t=>t.target===this.Jd);e&&this._b(e.contentRect.width,e.contentRect.height)}),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){null!==this.ib&&this.ib.disconnect(),this.ib=null}}function Is(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Us(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i}function Hs(t,e,i,s){const n=i.value,r={ee:e,ot:t,Vt:[n,n,n,n],zb:s};return void 0!==i.color&&(r.V=i.color),r}function Ks(t,e,i,s){const n=i.value,r={ee:e,ot:t,Vt:[n,n,n,n],zb:s};return void 0!==i.lineColor&&(r.lt=i.lineColor),void 0!==i.topColor&&(r.Ps=i.topColor),void 0!==i.bottomColor&&(r.Rs=i.bottomColor),r}function qs(t,e,i,s){const n=i.value,r={ee:e,ot:t,Vt:[n,n,n,n],zb:s};return void 0!==i.topLineColor&&(r.Re=i.topLineColor),void 0!==i.bottomLineColor&&(r.De=i.bottomLineColor),void 0!==i.topFillColor1&&(r.ke=i.topFillColor1),void 0!==i.topFillColor2&&(r.ye=i.topFillColor2),void 0!==i.bottomFillColor1&&(r.Ce=i.bottomFillColor1),void 0!==i.bottomFillColor2&&(r.Te=i.bottomFillColor2),r}function Xs(t,e,i,s){const n={ee:e,ot:t,Vt:[i.open,i.high,i.low,i.close],zb:s};return void 0!==i.color&&(n.V=i.color),n}function Gs(t,e,i,s){const n={ee:e,ot:t,Vt:[i.open,i.high,i.low,i.close],zb:s};return void 0!==i.color&&(n.V=i.color),void 0!==i.borderColor&&(n.Ot=i.borderColor),void 0!==i.wickColor&&(n.Xh=i.wickColor),n}function Js(t,e,i,s,n){const r=x(n)(i),o=Math.max(...r),h=Math.min(...r),l=r[r.length-1],a=[l,o,h,l],c=i,{time:u,color:d}=c;return{ee:e,ot:t,Vt:a,zb:s,$e:Us(c,["time","color"]),V:d}}function Qs(t){return void 0!==t.Vt}function Ys(t,e){return void 0!==e.customValues&&(t.jb=e.customValues),t}function Zs(t){return(e,i,s,n,r,o)=>function(t,e){return e?e(t):void 0===(i=t).open&&void 0===i.value;var i}(s,o)?Ys({ot:e,ee:i,zb:n},s):Ys(t(e,i,s,n,r),s)}function tn(t){return{Candlestick:Zs(Gs),Bar:Zs(Xs),Area:Zs(Ks),Baseline:Zs(qs),Histogram:Zs(Hs),Line:Zs(Hs),Custom:Zs(Js)}[t]}function en(t){return{ee:0,Hb:new Map,la:t}}function sn(t,e){if(void 0!==t&&0!==t.length)return{$b:e.key(t[0].ot),Ub:e.key(t[t.length-1].ot)}}function nn(t){let e;return t.forEach(t=>{void 0===e&&(e=t.zb)}),x(e)}class rn{constructor(t){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=t}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(t,e){let i=0!==this.qb.size,s=!1;const n=this.Yb.get(t);if(void 0!==n)if(1===this.Yb.size)i=!1,s=!0,this.qb.clear();else for(const e of this.Xb)e.pointData.Hb.delete(t)&&(s=!0);let r=[];if(0!==e.length){const i=e.map(t=>t.time),n=this.q_.createConverterToInternalObj(e),o=tn(t.Qh()),h=t.Ca(),l=t.Ta();r=e.map((e,r)=>{const a=n(e.time),c=this.q_.key(a);let u=this.qb.get(c);void 0===u&&(u=en(a),this.qb.set(c,u),s=!0);const d=o(a,u.ee,e,i[r],h,l);return u.Hb.set(t,d),d})}i&&this.Gb(),this.Jb(t,r);let o=-1;if(s){const t=[];this.qb.forEach(e=>{t.push({timeWeight:0,time:e.la,pointData:e,originalTime:nn(e.Hb)})}),t.sort((t,e)=>this.q_.key(t.time)-this.q_.key(e.time)),o=this.Qb(t)}return this.tw(t,o,function(t,e,i){const s=sn(t,i),n=sn(e,i);if(void 0!==s&&void 0!==n)return{ta:s.Ub>=n.Ub&&s.$b>=n.$b}}(this.Yb.get(t),n,this.q_))}vd(t){return this.Kb(t,[])}iw(t,e){const i=e;!function(t){void 0===t.zb&&(t.zb=t.time)}(i),this.q_.preprocessData(e);const s=this.q_.createConverterToInternalObj([e])(e.time),n=this.Zb.get(t);if(void 0!==n&&this.q_.key(s)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${s}`);let r=this.qb.get(this.q_.key(s));const o=void 0===r;void 0===r&&(r=en(s),this.qb.set(this.q_.key(s),r));const h=tn(t.Qh()),l=t.Ca(),a=t.Ta(),c=h(s,r.ee,e,i.zb,l,a);r.Hb.set(t,c),this.nw(t,c);const u={ta:Qs(c)};if(!o)return this.tw(t,-1,u);const d={timeWeight:0,time:r.la,pointData:r,originalTime:nn(r.Hb)},f=Bt(this.Xb,this.q_.key(d.time),(t,e)=>this.q_.key(t.time)<e);this.Xb.splice(f,0,d);for(let t=f;t<this.Xb.length;++t)on(this.Xb[t].pointData,t);return this.q_.fillWeightsForPoints(this.Xb,f),this.tw(t,f,u)}nw(t,e){let i=this.Yb.get(t);void 0===i&&(i=[],this.Yb.set(t,i));const s=0!==i.length?i[i.length-1]:null;null===s||this.q_.key(e.ot)>this.q_.key(s.ot)?Qs(e)&&i.push(e):Qs(e)?i[i.length-1]=e:i.splice(-1,1),this.Zb.set(t,e.ot)}Jb(t,e){0!==e.length?(this.Yb.set(t,e.filter(Qs)),this.Zb.set(t,e[e.length-1].ot)):(this.Yb.delete(t),this.Zb.delete(t))}Gb(){for(const t of this.Xb)0===t.pointData.Hb.size&&this.qb.delete(this.q_.key(t.time))}Qb(t){let e=-1;for(let i=0;i<this.Xb.length&&i<t.length;++i){const s=this.Xb[i],n=t[i];if(this.q_.key(s.time)!==this.q_.key(n.time)){e=i;break}n.timeWeight=s.timeWeight,on(n.pointData,i)}if(-1===e&&this.Xb.length!==t.length&&(e=Math.min(this.Xb.length,t.length)),-1===e)return-1;for(let i=e;i<t.length;++i)on(t[i].pointData,i);return this.q_.fillWeightsForPoints(t,e),this.Xb=t,e}sw(){if(0===this.Yb.size)return null;let t=0;return this.Yb.forEach(e=>{0!==e.length&&(t=Math.max(t,e[e.length-1].ee))}),t}tw(t,e,i){const s={ew:new Map,St:{Eu:this.sw()}};if(-1!==e)this.Yb.forEach((e,n)=>{s.ew.set(n,{$e:e,rw:n===t?i:void 0})}),this.Yb.has(t)||s.ew.set(t,{$e:[],rw:i}),s.St.hw=this.Xb,s.St.lw=e;else{const e=this.Yb.get(t);s.ew.set(t,{$e:e||[],rw:i})}return s}}function on(t,e){t.ee=e,t.Hb.forEach(t=>{t.ee=e})}function hn(t){const e={value:t.Vt[3],time:t.zb};return void 0!==t.jb&&(e.customValues=t.jb),e}function ln(t){const e=hn(t);return void 0!==t.V&&(e.color=t.V),e}function an(t){const e=hn(t);return void 0!==t.lt&&(e.lineColor=t.lt),void 0!==t.Ps&&(e.topColor=t.Ps),void 0!==t.Rs&&(e.bottomColor=t.Rs),e}function cn(t){const e=hn(t);return void 0!==t.Re&&(e.topLineColor=t.Re),void 0!==t.De&&(e.bottomLineColor=t.De),void 0!==t.ke&&(e.topFillColor1=t.ke),void 0!==t.ye&&(e.topFillColor2=t.ye),void 0!==t.Ce&&(e.bottomFillColor1=t.Ce),void 0!==t.Te&&(e.bottomFillColor2=t.Te),e}function un(t){const e={open:t.Vt[0],high:t.Vt[1],low:t.Vt[2],close:t.Vt[3],time:t.zb};return void 0!==t.jb&&(e.customValues=t.jb),e}function dn(t){const e=un(t);return void 0!==t.V&&(e.color=t.V),e}function fn(t){const e=un(t),{V:i,Ot:s,Xh:n}=t;return void 0!==i&&(e.color=i),void 0!==s&&(e.borderColor=s),void 0!==n&&(e.wickColor=n),e}function mn(t){return{Area:an,Line:ln,Baseline:cn,Histogram:ln,Bar:dn,Candlestick:fn,Custom:pn}[t]}function pn(t){const e=t.zb;return Object.assign(Object.assign({},t.$e),{time:e})}const gn={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},vn={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},bn={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:q,attributionLogo:!0},wn={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},yn={rightOffset:0,barSpacing:6,minBarSpacing:.5,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},Sn={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:q,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Cn(){return{width:0,height:0,autoSize:!1,layout:bn,crosshair:gn,grid:vn,overlayPriceScales:Object.assign({},wn),leftPriceScale:Object.assign(Object.assign({},wn),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},wn),{visible:!0}),timeScale:yn,watermark:Sn,localization:{locale:rs?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 Mn{constructor(t,e){this.aw=t,this.ow=e}applyOptions(t){this.aw.$t().$c(this.ow,t)}options(){return this.Li().W()}width(){return bt(this.ow)?this.aw.Mb(this.ow):0}Li(){return _(this.aw.$t().Uc(this.ow)).Dt}}function En(t,e,i){const s=Us(t,["time","originalTime"]),n=Object.assign({time:e},s);return void 0!==i&&(n.originalTime=i),n}const xn={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class _n{constructor(t){this.Nh=t}applyOptions(t){this.Nh.$h(t)}options(){return this.Nh.W()}_w(){return this.Nh}}class zn{constructor(t,e,i,s,n){this.uw=new D,this.Es=t,this.cw=e,this.dw=i,this.q_=n,this.fw=s}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(t){const e=this.Es.Ct();return null===e?null:this.Es.Dt().Rt(t,e.Vt)}coordinateToPrice(t){const e=this.Es.Ct();return null===e?null:this.Es.Dt().pn(t,e.Vt)}barsInLogicalRange(t){if(null===t)return null;const e=new Ri(new zi(t.from,t.to)).lu(),i=this.Es.In();if(i.Ni())return null;const s=i.ll(e.Os(),1),n=i.ll(e.ui(),-1),r=_(i.el()),o=_(i.An());if(null!==s&&null!==n&&s.ee>n.ee)return{barsBefore:t.from-r,barsAfter:o-t.to};const h={barsBefore:null===s||s.ee===r?t.from-r:s.ee-r,barsAfter:null===n||n.ee===o?o-t.to:o-n.ee};return null!==s&&null!==n&&(h.from=s.zb,h.to=n.zb),h}setData(t){this.q_,this.Es.Qh(),this.cw.pw(this.Es,t),this.mw("full")}update(t){this.Es.Qh(),this.cw.bw(this.Es,t),this.mw("update")}dataByIndex(t,e){const i=this.Es.In().ll(t,e);return null===i?null:mn(this.seriesType())(i)}data(){const t=mn(this.seriesType());return this.Es.In().ne().map(e=>t(e))}subscribeDataChanged(t){this.uw.l(t)}unsubscribeDataChanged(t){this.uw.v(t)}setMarkers(t){this.q_;const e=t.map(t=>En(t,this.q_.convertHorzItemToInternal(t.time),t.time));this.Es.na(e)}markers(){return this.Es.sa().map(t=>En(t,t.originalTime,void 0))}applyOptions(t){this.Es.$h(t)}options(){return U(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(t){const e=A(U(xn),t),i=this.Es.ea(e);return new _n(i)}removePriceLine(t){this.Es.ra(t._w())}seriesType(){return this.Es.Qh()}attachPrimitive(t){this.Es.ka(t),t.attached&&t.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(t){this.Es.ya(t),t.detached&&t.detached()}mw(t){this.uw.M()&&this.uw.m(t)}}class kn{constructor(t,e,i){this.ww=new D,this.mu=new D,this.Om=new D,this.$i=t,this.yl=t.St(),this.ab=e,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=i}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(t,e){e?this.yl.Ju(t,1e3):this.$i.Jn(t)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const t=this.yl.Vu();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const e={from:this.q_.convertHorzItemToInternal(t.from),to:this.q_.convertHorzItemToInternal(t.to)},i=this.yl.Iu(e);this.$i.pd(i)}getVisibleLogicalRange(){const t=this.yl.Du();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){E(t.from<=t.to,"The from index cannot be after the to index."),this.$i.pd(t)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(t){const e=this.$i.St();return e.Ni()?null:e.It(t)}coordinateToLogical(t){return this.yl.Ni()?null:this.yl.Nu(t)}timeToCoordinate(t){const e=this.q_.convertHorzItemToInternal(t),i=this.yl.Va(e,!1);return null===i?null:this.yl.It(i)}coordinateToTime(t){const e=this.$i.St(),i=e.Nu(t),s=e.Ui(i);return null===s?null:s.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(t){this.ww.l(t)}unsubscribeVisibleTimeRangeChange(t){this.ww.v(t)}subscribeVisibleLogicalRangeChange(t){this.mu.l(t)}unsubscribeVisibleLogicalRangeChange(t){this.mu.v(t)}subscribeSizeChange(t){this.Om.l(t)}unsubscribeSizeChange(t){this.Om.v(t)}applyOptions(t){this.yl.$h(t)}options(){return Object.assign(Object.assign({},U(this.yl.W())),{barSpacing:this.yl.le()})}gw(){this.ww.M()&&this.ww.m(this.getVisibleRange())}Mw(){this.mu.M()&&this.mu.m(this.getVisibleLogicalRange())}xw(t){this.Om.m(t.width,t.height)}}function Tn(t){return function(t){if(I(t.handleScale)){const e=t.handleScale;t.handleScale={axisDoubleClickReset:{time:e,price:e},axisPressedMouseMove:{time:e,price:e},mouseWheel:e,pinch:e}}else if(void 0!==t.handleScale){const{axisPressedMouseMove:e,axisDoubleClickReset:i}=t.handleScale;I(e)&&(t.handleScale.axisPressedMouseMove={time:e,price:e}),I(i)&&(t.handleScale.axisDoubleClickReset={time:i,price:i})}const e=t.handleScroll;I(e)&&(t.handleScroll={horzTouchDrag:e,vertTouchDrag:e,mouseWheel:e,pressedMouseMove:e})}(t),t}class Rn{constructor(t,e,i){this.Sw=new Map,this.kw=new Map,this.yw=new D,this.Cw=new D,this.Tw=new D,this.Pw=new rn(e);const s=void 0===i?U(Cn()):A(U(Cn()),Tn(i));this.q_=e,this.aw=new js(t,s,e),this.aw.lm().l(t=>{this.yw.M()&&this.yw.m(this.Rw(t()))},this),this.aw.am().l(t=>{this.Cw.M()&&this.Cw.m(this.Rw(t()))},this),this.aw.Xc().l(t=>{this.Tw.M()&&this.Tw.m(this.Rw(t()))},this);const n=this.aw.$t();this.Dw=new kn(n,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(t,e,i){this.autoSizeActive()||this.aw._b(t,e,i)}addCustomSeries(t,e){const i=z(t),s=Object.assign(Object.assign({},v),i.defaultOptions());return this.Vw("Custom",s,e,i)}addAreaSeries(t){return this.Vw("Area",m,t)}addBaselineSeries(t){return this.Vw("Baseline",p,t)}addBarSeries(t){return this.Vw("Bar",d,t)}addCandlestickSeries(t={}){return function(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}(t),this.Vw("Candlestick",u,t)}addHistogramSeries(t){return this.Vw("Histogram",g,t)}addLineSeries(t){return this.Vw("Line",f,t)}removeSeries(t){const e=x(this.Sw.get(t)),i=this.Pw.vd(e);this.aw.$t().vd(e),this.Ow(i),this.Sw.delete(t),this.kw.delete(e)}pw(t,e){this.Ow(this.Pw.Kb(t,e))}bw(t,e){this.Ow(this.Pw.iw(t,e))}subscribeClick(t){this.yw.l(t)}unsubscribeClick(t){this.yw.v(t)}subscribeCrosshairMove(t){this.Tw.l(t)}unsubscribeCrosshairMove(t){this.Tw.v(t)}subscribeDblClick(t){this.Cw.l(t)}unsubscribeDblClick(t){this.Cw.v(t)}priceScale(t){return new Mn(this.aw,t)}timeScale(){return this.Dw}applyOptions(t){this.aw.$h(Tn(t))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const t=this.aw.Tb();return{height:t.height,width:t.width}}setCrosshairPosition(t,e,i){const s=this.Sw.get(i);if(void 0===s)return;const n=this.aw.$t().dr(s);null!==n&&this.aw.$t().ad(t,e,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(t,e,i={},s){!function(t){if(void 0===t||"custom"===t.type)return;const e=t;void 0!==e.minMove&&void 0===e.precision&&(e.precision=function(t){if(t>=1)return 0;let e=0;for(;e<8;e++){const i=Math.round(t);if(Math.abs(i-t)<1e-8)return e;t*=10}return e}(e.minMove))}(i.priceFormat);const n=A(U(b),U(e),i),r=this.aw.$t().dd(t,n,s),o=new zn(r,this,this,this,this.q_);return this.Sw.set(o,r),this.kw.set(r,o),o}Ow(t){const e=this.aw.$t();e._d(t.St.Eu,t.St.hw,t.St.lw),t.ew.forEach((t,e)=>e.J(t.$e,t.rw)),e.Wu()}Bw(t){return x(this.kw.get(t))}Rw(t){const e=new Map;t.Nb.forEach((t,i)=>{const s=i.Qh(),n=mn(s)(t);if("Custom"!==s)E(function(t){return function(t){return void 0!==t.open}(t)||function(t){return void 0!==t.value}(t)}(n));else{const t=i.Ta();E(!t||!1===t(n))}e.set(this.Bw(i),n)});const i=void 0!==t.Eb&&this.kw.has(t.Eb)?this.Bw(t.Eb):void 0;return{time:t.zb,logical:t.ee,point:t.Lb,hoveredSeries:i,hoveredObjectId:t.Fb,seriesData:e,sourceEvent:t.Wb}}}function Nn(t,e){return function(t,e,i){let s;if(j(t)){const e=document.getElementById(t);E(null!==e,`Cannot find element in DOM with id=${t}`),s=e}else s=t;const n=new Rn(s,e,i);return e.setOptions(n.options()),n}(t,new ns,ns.Id(e))}Object.assign(Object.assign({},b),v);class Ln{constructor(t,e){this.chart=null,this.series=null,this.container=null,this.container=t,this.options=e}initialize(){if(!this.container)throw new Error("Chart container is not set");this.chart=Nn(this.container,{layout:{background:{color:"#ffffff"},textColor:"#333333"},grid:{vertLines:{color:"#f0f0f0"},horzLines:{color:"#f0f0f0"}},crosshair:{mode:gt.Normal},rightPriceScale:{borderColor:"#cccccc"},timeScale:{borderColor:"#cccccc",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:8,minBarSpacing:4},height:this.options.height||384,localization:{priceFormatter:this.options.formatPrice},watermark:{visible:!0,fontSize:64,horzAlign:"center",vertAlign:"center",color:"rgba(0, 0, 0, 0.03)",text:this.options.ticker?`${this.options.ticker}/SOL`:`${this.options.mint.substring(0,4)}...${this.options.mint.substring(this.options.mint.length-4)}/SOL`}}),this.series=this.chart.addCandlestickSeries({upColor:"#26a69a",downColor:"#ef5350",borderVisible:!0,borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickUpColor:"#26a69a",wickDownColor:"#ef5350"});const t=()=>{this.container&&this.chart&&this.chart.applyOptions({width:this.container.clientWidth})};window.addEventListener("resize",t),t()}updateData(t){if(!this.series)return;const e=t.filter(t=>t&&t.open>0&&t.high>0&&t.low>0&&t.close>0&&isFinite(t.open)&&isFinite(t.high)&&isFinite(t.low)&&isFinite(t.close));e.length>0&&(this.series.setData(e.map(t=>({...t,time:t.time}))),requestAnimationFrame(()=>{this.chart&&this.chart.timeScale().scrollToRealTime()}))}setTimeframe(t){}resize(){this.container&&this.chart&&this.chart.applyOptions({width:this.container.clientWidth})}destroy(){this.chart&&(this.chart.remove(),this.chart=null,this.series=null)}getChart(){return this.chart}getSeries(){return this.series}}function On(t,e){return function(){return t.apply(e,arguments)}}const{toString:Pn}=Object.prototype,{getPrototypeOf:$n}=Object,{iterator:Vn,toStringTag:Fn}=Symbol,Dn=(An=Object.create(null),t=>{const e=Pn.call(t);return An[e]||(An[e]=e.slice(8,-1).toLowerCase())});var An;const Bn=t=>(t=t.toLowerCase(),e=>Dn(e)===t),Wn=t=>e=>typeof e===t,{isArray:jn}=Array,In=Wn("undefined");function Un(t){return null!==t&&!In(t)&&null!==t.constructor&&!In(t.constructor)&&qn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Hn=Bn("ArrayBuffer");const Kn=Wn("string"),qn=Wn("function"),Xn=Wn("number"),Gn=t=>null!==t&&"object"==typeof t,Jn=t=>{if("object"!==Dn(t))return!1;const e=$n(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Fn in t||Vn in t)},Qn=Bn("Date"),Yn=Bn("File"),Zn=Bn("Blob"),tr=Bn("FileList"),er=Bn("URLSearchParams"),[ir,sr,nr,rr]=["ReadableStream","Request","Response","Headers"].map(Bn);function or(t,e,{allOwnKeys:i=!1}={}){if(null==t)return;let s,n;if("object"!=typeof t&&(t=[t]),jn(t))for(s=0,n=t.length;s<n;s++)e.call(null,t[s],s,t);else{if(Un(t))return;const n=i?Object.getOwnPropertyNames(t):Object.keys(t),r=n.length;let o;for(s=0;s<r;s++)o=n[s],e.call(null,t[o],o,t)}}function hr(t,e){if(Un(t))return null;e=e.toLowerCase();const i=Object.keys(t);let s,n=i.length;for(;n-- >0;)if(s=i[n],e===s.toLowerCase())return s;return null}const lr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ar=t=>!In(t)&&t!==lr;const cr=(ur="undefined"!=typeof Uint8Array&&$n(Uint8Array),t=>ur&&t instanceof ur);var ur;const dr=Bn("HTMLFormElement"),fr=(({hasOwnProperty:t})=>(e,i)=>t.call(e,i))(Object.prototype),mr=Bn("RegExp"),pr=(t,e)=>{const i=Object.getOwnPropertyDescriptors(t),s={};or(i,(i,n)=>{let r;!1!==(r=e(i,n,t))&&(s[n]=r||i)}),Object.defineProperties(t,s)};const gr=Bn("AsyncFunction"),vr=(br="function"==typeof setImmediate,wr=qn(lr.postMessage),br?setImmediate:wr?(yr=`axios@${Math.random()}`,Sr=[],lr.addEventListener("message",({source:t,data:e})=>{t===lr&&e===yr&&Sr.length&&Sr.shift()()},!1),t=>{Sr.push(t),lr.postMessage(yr,"*")}):t=>setTimeout(t));var br,wr,yr,Sr;const Cr="undefined"!=typeof queueMicrotask?queueMicrotask.bind(lr):"undefined"!=typeof process&&process.nextTick||vr;var Mr={isArray:jn,isArrayBuffer:Hn,isBuffer:Un,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||qn(t.append)&&("formdata"===(e=Dn(t))||"object"===e&&qn(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Hn(t.buffer),e},isString:Kn,isNumber:Xn,isBoolean:t=>!0===t||!1===t,isObject:Gn,isPlainObject:Jn,isEmptyObject:t=>{if(!Gn(t)||Un(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:ir,isRequest:sr,isResponse:nr,isHeaders:rr,isUndefined:In,isDate:Qn,isFile:Yn,isBlob:Zn,isRegExp:mr,isFunction:qn,isStream:t=>Gn(t)&&qn(t.pipe),isURLSearchParams:er,isTypedArray:cr,isFileList:tr,forEach:or,merge:function t(){const{caseless:e,skipUndefined:i}=ar(this)&&this||{},s={},n=(n,r)=>{const o=e&&hr(s,r)||r;Jn(s[o])&&Jn(n)?s[o]=t(s[o],n):Jn(n)?s[o]=t({},n):jn(n)?s[o]=n.slice():i&&In(n)||(s[o]=n)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&or(arguments[t],n);return s},extend:(t,e,i,{allOwnKeys:s}={})=>(or(e,(e,s)=>{i&&qn(e)?t[s]=On(e,i):t[s]=e},{allOwnKeys:s}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,i,s)=>{t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),i&&Object.assign(t.prototype,i)},toFlatObject:(t,e,i,s)=>{let n,r,o;const h={};if(e=e||{},null==t)return e;do{for(n=Object.getOwnPropertyNames(t),r=n.length;r-- >0;)o=n[r],s&&!s(o,t,e)||h[o]||(e[o]=t[o],h[o]=!0);t=!1!==i&&$n(t)}while(t&&(!i||i(t,e))&&t!==Object.prototype);return e},kindOf:Dn,kindOfTest:Bn,endsWith:(t,e,i)=>{t=String(t),(void 0===i||i>t.length)&&(i=t.length),i-=e.length;const s=t.indexOf(e,i);return-1!==s&&s===i},toArray:t=>{if(!t)return null;if(jn(t))return t;let e=t.length;if(!Xn(e))return null;const i=new Array(e);for(;e-- >0;)i[e]=t[e];return i},forEachEntry:(t,e)=>{const i=(t&&t[Vn]).call(t);let s;for(;(s=i.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},matchAll:(t,e)=>{let i;const s=[];for(;null!==(i=t.exec(e));)s.push(i);return s},isHTMLForm:dr,hasOwnProperty:fr,hasOwnProp:fr,reduceDescriptors:pr,freezeMethods:t=>{pr(t,(e,i)=>{if(qn(t)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const s=t[i];qn(s)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))})},toObjectSet:(t,e)=>{const i={},s=t=>{t.forEach(t=>{i[t]=!0})};return jn(t)?s(t):s(String(t).split(e)),i},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,i){return e.toUpperCase()+i}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:hr,global:lr,isContextDefined:ar,isSpecCompliantForm:function(t){return!!(t&&qn(t.append)&&"FormData"===t[Fn]&&t[Vn])},toJSONObject:t=>{const e=new Array(10),i=(t,s)=>{if(Gn(t)){if(e.indexOf(t)>=0)return;if(Un(t))return t;if(!("toJSON"in t)){e[s]=t;const n=jn(t)?[]:{};return or(t,(t,e)=>{const r=i(t,s+1);!In(r)&&(n[e]=r)}),e[s]=void 0,n}}return t};return i(t,0)},isAsyncFn:gr,isThenable:t=>t&&(Gn(t)||qn(t))&&qn(t.then)&&qn(t.catch),setImmediate:vr,asap:Cr,isIterable:t=>null!=t&&qn(t[Vn])};function Er(t,e,i,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),i&&(this.config=i),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}Mr.inherits(Er,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Mr.toJSONObject(this.config),code:this.code,status:this.status}}});const xr=Er.prototype,_r={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{_r[t]={value:t}}),Object.defineProperties(Er,_r),Object.defineProperty(xr,"isAxiosError",{value:!0}),Er.from=(t,e,i,s,n,r)=>{const o=Object.create(xr);Mr.toFlatObject(t,o,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t);const h=t&&t.message?t.message:"Error",l=null==e&&t?t.code:e;return Er.call(o,h,l,i,s,n),t&&null==o.cause&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",r&&Object.assign(o,r),o};function zr(t){return Mr.isPlainObject(t)||Mr.isArray(t)}function kr(t){return Mr.endsWith(t,"[]")?t.slice(0,-2):t}function Tr(t,e,i){return t?t.concat(e).map(function(t,e){return t=kr(t),!i&&e?"["+t+"]":t}).join(i?".":""):e}const Rr=Mr.toFlatObject(Mr,{},null,function(t){return/^is[A-Z]/.test(t)});function Nr(t,e,i){if(!Mr.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const s=(i=Mr.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Mr.isUndefined(e[t])})).metaTokens,n=i.visitor||a,r=i.dots,o=i.indexes,h=(i.Blob||"undefined"!=typeof Blob&&Blob)&&Mr.isSpecCompliantForm(e);if(!Mr.isFunction(n))throw new TypeError("visitor must be a function");function l(t){if(null===t)return"";if(Mr.isDate(t))return t.toISOString();if(Mr.isBoolean(t))return t.toString();if(!h&&Mr.isBlob(t))throw new Er("Blob is not supported. Use a Buffer instead.");return Mr.isArrayBuffer(t)||Mr.isTypedArray(t)?h&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function a(t,i,n){let h=t;if(t&&!n&&"object"==typeof t)if(Mr.endsWith(i,"{}"))i=s?i:i.slice(0,-2),t=JSON.stringify(t);else if(Mr.isArray(t)&&function(t){return Mr.isArray(t)&&!t.some(zr)}(t)||(Mr.isFileList(t)||Mr.endsWith(i,"[]"))&&(h=Mr.toArray(t)))return i=kr(i),h.forEach(function(t,s){!Mr.isUndefined(t)&&null!==t&&e.append(!0===o?Tr([i],s,r):null===o?i:i+"[]",l(t))}),!1;return!!zr(t)||(e.append(Tr(n,i,r),l(t)),!1)}const c=[],u=Object.assign(Rr,{defaultVisitor:a,convertValue:l,isVisitable:zr});if(!Mr.isObject(t))throw new TypeError("data must be an object");return function t(i,s){if(!Mr.isUndefined(i)){if(-1!==c.indexOf(i))throw Error("Circular reference detected in "+s.join("."));c.push(i),Mr.forEach(i,function(i,r){!0===(!(Mr.isUndefined(i)||null===i)&&n.call(e,i,Mr.isString(r)?r.trim():r,s,u))&&t(i,s?s.concat(r):[r])}),c.pop()}}(t),e}function Lr(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Or(t,e){this._pairs=[],t&&Nr(t,this,e)}const Pr=Or.prototype;function $r(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vr(t,e,i){if(!e)return t;const s=i&&i.encode||$r;Mr.isFunction(i)&&(i={serialize:i});const n=i&&i.serialize;let r;if(r=n?n(e,i):Mr.isURLSearchParams(e)?e.toString():new Or(e,i).toString(s),r){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t}Pr.append=function(t,e){this._pairs.push([t,e])},Pr.toString=function(t){const e=t?function(e){return t.call(this,e,Lr)}:Lr;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};class Fr{constructor(){this.handlers=[]}use(t,e,i){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Mr.forEach(this.handlers,function(e){null!==e&&t(e)})}}var Dr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ar={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Or,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Br="undefined"!=typeof window&&"undefined"!=typeof document,Wr="object"==typeof navigator&&navigator||void 0,jr=Br&&(!Wr||["ReactNative","NativeScript","NS"].indexOf(Wr.product)<0),Ir="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ur=Br&&window.location.href||"http://localhost";var Hr={...Object.freeze({__proto__:null,hasBrowserEnv:Br,hasStandardBrowserEnv:jr,hasStandardBrowserWebWorkerEnv:Ir,navigator:Wr,origin:Ur}),...Ar};function Kr(t){function e(t,i,s,n){let r=t[n++];if("__proto__"===r)return!0;const o=Number.isFinite(+r),h=n>=t.length;if(r=!r&&Mr.isArray(s)?s.length:r,h)return Mr.hasOwnProp(s,r)?s[r]=[s[r],i]:s[r]=i,!o;s[r]&&Mr.isObject(s[r])||(s[r]=[]);return e(t,i,s[r],n)&&Mr.isArray(s[r])&&(s[r]=function(t){const e={},i=Object.keys(t);let s;const n=i.length;let r;for(s=0;s<n;s++)r=i[s],e[r]=t[r];return e}(s[r])),!o}if(Mr.isFormData(t)&&Mr.isFunction(t.entries)){const i={};return Mr.forEachEntry(t,(t,s)=>{e(function(t){return Mr.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),s,i,0)}),i}return null}const qr={transitional:Dr,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const i=e.getContentType()||"",s=i.indexOf("application/json")>-1,n=Mr.isObject(t);n&&Mr.isHTMLForm(t)&&(t=new FormData(t));if(Mr.isFormData(t))return s?JSON.stringify(Kr(t)):t;if(Mr.isArrayBuffer(t)||Mr.isBuffer(t)||Mr.isStream(t)||Mr.isFile(t)||Mr.isBlob(t)||Mr.isReadableStream(t))return t;if(Mr.isArrayBufferView(t))return t.buffer;if(Mr.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let r;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Nr(t,new Hr.classes.URLSearchParams,{visitor:function(t,e,i,s){return Hr.isNode&&Mr.isBuffer(t)?(this.append(e,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((r=Mr.isFileList(t))||i.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Nr(r?{"files[]":t}:t,e&&new e,this.formSerializer)}}return n||s?(e.setContentType("application/json",!1),function(t,e,i){if(Mr.isString(t))try{return(e||JSON.parse)(t),Mr.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(i||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||qr.transitional,i=e&&e.forcedJSONParsing,s="json"===this.responseType;if(Mr.isResponse(t)||Mr.isReadableStream(t))return t;if(t&&Mr.isString(t)&&(i&&!this.responseType||s)){const i=!(e&&e.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(t){if(i){if("SyntaxError"===t.name)throw Er.from(t,Er.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hr.classes.FormData,Blob:Hr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Mr.forEach(["delete","get","head","post","put","patch"],t=>{qr.headers[t]={}});const Xr=Mr.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Gr=Symbol("internals");function Jr(t){return t&&String(t).trim().toLowerCase()}function Qr(t){return!1===t||null==t?t:Mr.isArray(t)?t.map(Qr):String(t)}function Yr(t,e,i,s,n){return Mr.isFunction(s)?s.call(this,e,i):(n&&(e=i),Mr.isString(e)?Mr.isString(s)?-1!==e.indexOf(s):Mr.isRegExp(s)?s.test(e):void 0:void 0)}let Zr=class{constructor(t){t&&this.set(t)}set(t,e,i){const s=this;function n(t,e,i){const n=Jr(e);if(!n)throw new Error("header name must be a non-empty string");const r=Mr.findKey(s,n);(!r||void 0===s[r]||!0===i||void 0===i&&!1!==s[r])&&(s[r||e]=Qr(t))}const r=(t,e)=>Mr.forEach(t,(t,i)=>n(t,i,e));if(Mr.isPlainObject(t)||t instanceof this.constructor)r(t,e);else if(Mr.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))r((t=>{const e={};let i,s,n;return t&&t.split("\n").forEach(function(t){n=t.indexOf(":"),i=t.substring(0,n).trim().toLowerCase(),s=t.substring(n+1).trim(),!i||e[i]&&Xr[i]||("set-cookie"===i?e[i]?e[i].push(s):e[i]=[s]:e[i]=e[i]?e[i]+", "+s:s)}),e})(t),e);else if(Mr.isObject(t)&&Mr.isIterable(t)){let i,s,n={};for(const e of t){if(!Mr.isArray(e))throw TypeError("Object iterator must return a key-value pair");n[s=e[0]]=(i=n[s])?Mr.isArray(i)?[...i,e[1]]:[i,e[1]]:e[1]}r(n,e)}else null!=t&&n(e,t,i);return this}get(t,e){if(t=Jr(t)){const i=Mr.findKey(this,t);if(i){const t=this[i];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(t);)e[s[1]]=s[2];return e}(t);if(Mr.isFunction(e))return e.call(this,t,i);if(Mr.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Jr(t)){const i=Mr.findKey(this,t);return!(!i||void 0===this[i]||e&&!Yr(0,this[i],i,e))}return!1}delete(t,e){const i=this;let s=!1;function n(t){if(t=Jr(t)){const n=Mr.findKey(i,t);!n||e&&!Yr(0,i[n],n,e)||(delete i[n],s=!0)}}return Mr.isArray(t)?t.forEach(n):n(t),s}clear(t){const e=Object.keys(this);let i=e.length,s=!1;for(;i--;){const n=e[i];t&&!Yr(0,this[n],n,t,!0)||(delete this[n],s=!0)}return s}normalize(t){const e=this,i={};return Mr.forEach(this,(s,n)=>{const r=Mr.findKey(i,n);if(r)return e[r]=Qr(s),void delete e[n];const o=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,i)=>e.toUpperCase()+i)}(n):String(n).trim();o!==n&&delete e[n],e[o]=Qr(s),i[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Mr.forEach(this,(i,s)=>{null!=i&&!1!==i&&(e[s]=t&&Mr.isArray(i)?i.join(", "):i)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const i=new this(t);return e.forEach(t=>i.set(t)),i}static accessor(t){const e=(this[Gr]=this[Gr]={accessors:{}}).accessors,i=this.prototype;function s(t){const s=Jr(t);e[s]||(!function(t,e){const i=Mr.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+i,{value:function(t,i,n){return this[s].call(this,e,t,i,n)},configurable:!0})})}(i,t),e[s]=!0)}return Mr.isArray(t)?t.forEach(s):s(t),this}};function to(t,e){const i=this||qr,s=e||i,n=Zr.from(s.headers);let r=s.data;return Mr.forEach(t,function(t){r=t.call(i,r,n.normalize(),e?e.status:void 0)}),n.normalize(),r}function eo(t){return!(!t||!t.__CANCEL__)}function io(t,e,i){Er.call(this,null==t?"canceled":t,Er.ERR_CANCELED,e,i),this.name="CanceledError"}function so(t,e,i){const s=i.config.validateStatus;i.status&&s&&!s(i.status)?e(new Er("Request failed with status code "+i.status,[Er.ERR_BAD_REQUEST,Er.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):t(i)}Zr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Mr.reduceDescriptors(Zr.prototype,({value:t},e)=>{let i=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[i]=t}}}),Mr.freezeMethods(Zr),Mr.inherits(io,Er,{__CANCEL__:!0});const no=(t,e,i=3)=>{let s=0;const n=function(t,e){t=t||10;const i=new Array(t),s=new Array(t);let n,r=0,o=0;return e=void 0!==e?e:1e3,function(h){const l=Date.now(),a=s[o];n||(n=l),i[r]=h,s[r]=l;let c=o,u=0;for(;c!==r;)u+=i[c++],c%=t;if(r=(r+1)%t,r===o&&(o=(o+1)%t),l-n<e)return;const d=a&&l-a;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(t,e){let i,s,n=0,r=1e3/e;const o=(e,r=Date.now())=>{n=r,i=null,s&&(clearTimeout(s),s=null),t(...e)};return[(...t)=>{const e=Date.now(),h=e-n;h>=r?o(t,e):(i=t,s||(s=setTimeout(()=>{s=null,o(i)},r-h)))},()=>i&&o(i)]}(i=>{const r=i.loaded,o=i.lengthComputable?i.total:void 0,h=r-s,l=n(h);s=r;t({loaded:r,total:o,progress:o?r/o:void 0,bytes:h,rate:l||void 0,estimated:l&&o&&r<=o?(o-r)/l:void 0,event:i,lengthComputable:null!=o,[e?"download":"upload"]:!0})},i)},ro=(t,e)=>{const i=null!=t;return[s=>e[0]({lengthComputable:i,total:t,loaded:s}),e[1]]},oo=t=>(...e)=>Mr.asap(()=>t(...e));var ho=Hr.hasStandardBrowserEnv?((t,e)=>i=>(i=new URL(i,Hr.origin),t.protocol===i.protocol&&t.host===i.host&&(e||t.port===i.port)))(new URL(Hr.origin),Hr.navigator&&/(msie|trident)/i.test(Hr.navigator.userAgent)):()=>!0,lo=Hr.hasStandardBrowserEnv?{write(t,e,i,s,n,r){const o=[t+"="+encodeURIComponent(e)];Mr.isNumber(i)&&o.push("expires="+new Date(i).toGMTString()),Mr.isString(s)&&o.push("path="+s),Mr.isString(n)&&o.push("domain="+n),!0===r&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function ao(t,e,i){let s=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(s||0==i)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const co=t=>t instanceof Zr?{...t}:t;function uo(t,e){e=e||{};const i={};function s(t,e,i,s){return Mr.isPlainObject(t)&&Mr.isPlainObject(e)?Mr.merge.call({caseless:s},t,e):Mr.isPlainObject(e)?Mr.merge({},e):Mr.isArray(e)?e.slice():e}function n(t,e,i,n){return Mr.isUndefined(e)?Mr.isUndefined(t)?void 0:s(void 0,t,0,n):s(t,e,0,n)}function r(t,e){if(!Mr.isUndefined(e))return s(void 0,e)}function o(t,e){return Mr.isUndefined(e)?Mr.isUndefined(t)?void 0:s(void 0,t):s(void 0,e)}function h(i,n,r){return r in e?s(i,n):r in t?s(void 0,i):void 0}const l={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:h,headers:(t,e,i)=>n(co(t),co(e),0,!0)};return Mr.forEach(Object.keys({...t,...e}),function(s){const r=l[s]||n,o=r(t[s],e[s],s);Mr.isUndefined(o)&&r!==h||(i[s]=o)}),i}var fo=t=>{const e=uo({},t);let{data:i,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:r,headers:o,auth:h}=e;if(e.headers=o=Zr.from(o),e.url=Vr(ao(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),h&&o.set("Authorization","Basic "+btoa((h.username||"")+":"+(h.password?unescape(encodeURIComponent(h.password)):""))),Mr.isFormData(i))if(Hr.hasStandardBrowserEnv||Hr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Mr.isFunction(i.getHeaders)){const t=i.getHeaders(),e=["content-type","content-length"];Object.entries(t).forEach(([t,i])=>{e.includes(t.toLowerCase())&&o.set(t,i)})}if(Hr.hasStandardBrowserEnv&&(s&&Mr.isFunction(s)&&(s=s(e)),s||!1!==s&&ho(e.url))){const t=n&&r&&lo.read(r);t&&o.set(n,t)}return e};var mo="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,i){const s=fo(t);let n=s.data;const r=Zr.from(s.headers).normalize();let o,h,l,a,c,{responseType:u,onUploadProgress:d,onDownloadProgress:f}=s;function m(){a&&a(),c&&c(),s.cancelToken&&s.cancelToken.unsubscribe(o),s.signal&&s.signal.removeEventListener("abort",o)}let p=new XMLHttpRequest;function g(){if(!p)return;const s=Zr.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());so(function(t){e(t),m()},function(t){i(t),m()},{data:u&&"text"!==u&&"json"!==u?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:s,config:t,request:p}),p=null}p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(i(new Er("Request aborted",Er.ECONNABORTED,t,p)),p=null)},p.onerror=function(e){const s=new Er(e&&e.message?e.message:"Network Error",Er.ERR_NETWORK,t,p);s.event=e||null,i(s),p=null},p.ontimeout=function(){let e=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const n=s.transitional||Dr;s.timeoutErrorMessage&&(e=s.timeoutErrorMessage),i(new Er(e,n.clarifyTimeoutError?Er.ETIMEDOUT:Er.ECONNABORTED,t,p)),p=null},void 0===n&&r.setContentType(null),"setRequestHeader"in p&&Mr.forEach(r.toJSON(),function(t,e){p.setRequestHeader(e,t)}),Mr.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),u&&"json"!==u&&(p.responseType=s.responseType),f&&([l,c]=no(f,!0),p.addEventListener("progress",l)),d&&p.upload&&([h,a]=no(d),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",a)),(s.cancelToken||s.signal)&&(o=e=>{p&&(i(!e||e.type?new io(null,t,p):e),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(o),s.signal&&(s.signal.aborted?o():s.signal.addEventListener("abort",o)));const v=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(s.url);v&&-1===Hr.protocols.indexOf(v)?i(new Er("Unsupported protocol "+v+":",Er.ERR_BAD_REQUEST,t)):p.send(n||null)})};const po=(t,e)=>{const{length:i}=t=t?t.filter(Boolean):[];if(e||i){let i,s=new AbortController;const n=function(t){if(!i){i=!0,o();const e=t instanceof Error?t:this.reason;s.abort(e instanceof Er?e:new io(e instanceof Error?e.message:e))}};let r=e&&setTimeout(()=>{r=null,n(new Er(`timeout ${e} of ms exceeded`,Er.ETIMEDOUT))},e);const o=()=>{t&&(r&&clearTimeout(r),r=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(n):t.removeEventListener("abort",n)}),t=null)};t.forEach(t=>t.addEventListener("abort",n));const{signal:h}=s;return h.unsubscribe=()=>Mr.asap(o),h}},go=function*(t,e){let i=t.byteLength;if(i<e)return void(yield t);let s,n=0;for(;n<i;)s=n+e,yield t.slice(n,s),n=s},vo=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:i}=await e.read();if(t)break;yield i}}finally{await e.cancel()}},bo=(t,e,i,s)=>{const n=async function*(t,e){for await(const i of vo(t))yield*go(i,e)}(t,e);let r,o=0,h=t=>{r||(r=!0,s&&s(t))};return new ReadableStream({async pull(t){try{const{done:e,value:s}=await n.next();if(e)return h(),void t.close();let r=s.byteLength;if(i){let t=o+=r;i(t)}t.enqueue(new Uint8Array(s))}catch(t){throw h(t),t}},cancel:t=>(h(t),n.return())},{highWaterMark:2})},{isFunction:wo}=Mr,yo=(({Request:t,Response:e})=>({Request:t,Response:e}))(Mr.global),{ReadableStream:So,TextEncoder:Co}=Mr.global,Mo=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Eo=t=>{t=Mr.merge.call({skipUndefined:!0},yo,t);const{fetch:e,Request:i,Response:s}=t,n=e?wo(e):"function"==typeof fetch,r=wo(i),o=wo(s);if(!n)return!1;const h=n&&wo(So),l=n&&("function"==typeof Co?(a=new Co,t=>a.encode(t)):async t=>new Uint8Array(await new i(t).arrayBuffer()));var a;const c=r&&h&&Mo(()=>{let t=!1;const e=new i(Hr.origin,{body:new So,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),u=o&&h&&Mo(()=>Mr.isReadableStream(new s("").body)),d={stream:u&&(t=>t.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!d[t]&&(d[t]=(e,i)=>{let s=e&&e[t];if(s)return s.call(e);throw new Er(`Response type '${t}' is not supported`,Er.ERR_NOT_SUPPORT,i)})});const f=async(t,e)=>{const s=Mr.toFiniteNumber(t.getContentLength());return null==s?(async t=>{if(null==t)return 0;if(Mr.isBlob(t))return t.size;if(Mr.isSpecCompliantForm(t)){const e=new i(Hr.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Mr.isArrayBufferView(t)||Mr.isArrayBuffer(t)?t.byteLength:(Mr.isURLSearchParams(t)&&(t+=""),Mr.isString(t)?(await l(t)).byteLength:void 0)})(e):s};return async t=>{let{url:n,method:o,data:h,signal:l,cancelToken:a,timeout:m,onDownloadProgress:p,onUploadProgress:g,responseType:v,headers:b,withCredentials:w="same-origin",fetchOptions:y}=fo(t),S=e||fetch;v=v?(v+"").toLowerCase():"text";let C=po([l,a&&a.toAbortSignal()],m),M=null;const E=C&&C.unsubscribe&&(()=>{C.unsubscribe()});let x;try{if(g&&c&&"get"!==o&&"head"!==o&&0!==(x=await f(b,h))){let t,e=new i(n,{method:"POST",body:h,duplex:"half"});if(Mr.isFormData(h)&&(t=e.headers.get("content-type"))&&b.setContentType(t),e.body){const[t,i]=ro(x,no(oo(g)));h=bo(e.body,65536,t,i)}}Mr.isString(w)||(w=w?"include":"omit");const e=r&&"credentials"in i.prototype,l={...y,signal:C,method:o.toUpperCase(),headers:b.normalize().toJSON(),body:h,duplex:"half",credentials:e?w:void 0};M=r&&new i(n,l);let a=await(r?S(M,y):S(n,l));const m=u&&("stream"===v||"response"===v);if(u&&(p||m&&E)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=a[e]});const e=Mr.toFiniteNumber(a.headers.get("content-length")),[i,n]=p&&ro(e,no(oo(p),!0))||[];a=new s(bo(a.body,65536,i,()=>{n&&n(),E&&E()}),t)}v=v||"text";let _=await d[Mr.findKey(d,v)||"text"](a,t);return!m&&E&&E(),await new Promise((e,i)=>{so(e,i,{data:_,headers:Zr.from(a.headers),status:a.status,statusText:a.statusText,config:t,request:M})})}catch(e){if(E&&E(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new Er("Network Error",Er.ERR_NETWORK,t,M),{cause:e.cause||e});throw Er.from(e,e&&e.code,t,M)}}},xo=new Map,_o=t=>{let e=t?t.env:{};const{fetch:i,Request:s,Response:n}=e,r=[s,n,i];let o,h,l=r.length,a=xo;for(;l--;)o=r[l],h=a.get(o),void 0===h&&a.set(o,h=l?new Map:Eo(e)),a=h;return h};_o();const zo={http:null,xhr:mo,fetch:{get:_o}};Mr.forEach(zo,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const ko=t=>`- ${t}`,To=t=>Mr.isFunction(t)||null===t||!1===t;var Ro=(t,e)=>{t=Mr.isArray(t)?t:[t];const{length:i}=t;let s,n;const r={};for(let o=0;o<i;o++){let i;if(s=t[o],n=s,!To(s)&&(n=zo[(i=String(s)).toLowerCase()],void 0===n))throw new Er(`Unknown adapter '${i}'`);if(n&&(Mr.isFunction(n)||(n=n.get(e))))break;r[i||"#"+o]=n}if(!n){const t=Object.entries(r).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));throw new Er("There is no suitable adapter to dispatch the request "+(i?t.length>1?"since :\n"+t.map(ko).join("\n"):" "+ko(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function No(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new io(null,t)}function Lo(t){No(t),t.headers=Zr.from(t.headers),t.data=to.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Ro(t.adapter||qr.adapter,t)(t).then(function(e){return No(t),e.data=to.call(t,t.transformResponse,e),e.headers=Zr.from(e.headers),e},function(e){return eo(e)||(No(t),e&&e.response&&(e.response.data=to.call(t,t.transformResponse,e.response),e.response.headers=Zr.from(e.response.headers))),Promise.reject(e)})}const Oo="1.12.2",Po={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Po[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const $o={};Po.transitional=function(t,e,i){function s(t,e){return"[Axios v"+Oo+"] Transitional option '"+t+"'"+e+(i?". "+i:"")}return(i,n,r)=>{if(!1===t)throw new Er(s(n," has been removed"+(e?" in "+e:"")),Er.ERR_DEPRECATED);return e&&!$o[n]&&($o[n]=!0,console.warn(s(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(i,n,r)}},Po.spelling=function(t){return(e,i)=>(console.warn(`${i} is likely a misspelling of ${t}`),!0)};var Vo={assertOptions:function(t,e,i){if("object"!=typeof t)throw new Er("options must be an object",Er.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let n=s.length;for(;n-- >0;){const r=s[n],o=e[r];if(o){const e=t[r],i=void 0===e||o(e,r,t);if(!0!==i)throw new Er("option "+r+" must be "+i,Er.ERR_BAD_OPTION_VALUE);continue}if(!0!==i)throw new Er("Unknown option "+r,Er.ERR_BAD_OPTION)}},validators:Po};const Fo=Vo.validators;let Do=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Fr,response:new Fr}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const i=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?i&&!String(t.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+i):t.stack=i}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=uo(this.defaults,e);const{transitional:i,paramsSerializer:s,headers:n}=e;void 0!==i&&Vo.assertOptions(i,{silentJSONParsing:Fo.transitional(Fo.boolean),forcedJSONParsing:Fo.transitional(Fo.boolean),clarifyTimeoutError:Fo.transitional(Fo.boolean)},!1),null!=s&&(Mr.isFunction(s)?e.paramsSerializer={serialize:s}:Vo.assertOptions(s,{encode:Fo.function,serialize:Fo.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Vo.assertOptions(e,{baseUrl:Fo.spelling("baseURL"),withXsrfToken:Fo.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let r=n&&Mr.merge(n.common,n[e.method]);n&&Mr.forEach(["delete","get","head","post","put","patch","common"],t=>{delete n[t]}),e.headers=Zr.concat(r,n);const o=[];let h=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(h=h&&t.synchronous,o.unshift(t.fulfilled,t.rejected))});const l=[];let a;this.interceptors.response.forEach(function(t){l.push(t.fulfilled,t.rejected)});let c,u=0;if(!h){const t=[Lo.bind(this),void 0];for(t.unshift(...o),t.push(...l),c=t.length,a=Promise.resolve(e);u<c;)a=a.then(t[u++],t[u++]);return a}c=o.length;let d=e;for(;u<c;){const t=o[u++],e=o[u++];try{d=t(d)}catch(t){e.call(this,t);break}}try{a=Lo.call(this,d)}catch(t){return Promise.reject(t)}for(u=0,c=l.length;u<c;)a=a.then(l[u++],l[u++]);return a}getUri(t){return Vr(ao((t=uo(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}};Mr.forEach(["delete","get","head","options"],function(t){Do.prototype[t]=function(e,i){return this.request(uo(i||{},{method:t,url:e,data:(i||{}).data}))}}),Mr.forEach(["post","put","patch"],function(t){function e(e){return function(i,s,n){return this.request(uo(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}Do.prototype[t]=e(),Do.prototype[t+"Form"]=e(!0)});const Ao={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ao).forEach(([t,e])=>{Ao[e]=t});const Bo=function t(e){const i=new Do(e),s=On(Do.prototype.request,i);return Mr.extend(s,Do.prototype,i,{allOwnKeys:!0}),Mr.extend(s,i,null,{allOwnKeys:!0}),s.create=function(i){return t(uo(e,i))},s}(qr);Bo.Axios=Do,Bo.CanceledError=io,Bo.CancelToken=class t{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(t){e=t});const i=this;this.promise.then(t=>{if(!i._listeners)return;let e=i._listeners.length;for(;e-- >0;)i._listeners[e](t);i._listeners=null}),this.promise.then=t=>{let e;const s=new Promise(t=>{i.subscribe(t),e=t}).then(t);return s.cancel=function(){i.unsubscribe(e)},s},t(function(t,s,n){i.reason||(i.reason=new io(t,s,n),e(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let e;const i=new t(function(t){e=t});return{token:i,cancel:e}}},Bo.isCancel=eo,Bo.VERSION=Oo,Bo.toFormData=Nr,Bo.AxiosError=Er,Bo.Cancel=Bo.CanceledError,Bo.all=function(t){return Promise.all(t)},Bo.spread=function(t){return function(e){return t.apply(null,e)}},Bo.isAxiosError=function(t){return Mr.isObject(t)&&!0===t.isAxiosError},Bo.mergeConfig=uo,Bo.AxiosHeaders=Zr,Bo.formToJSON=t=>Kr(Mr.isHTMLForm(t)?new FormData(t):t),Bo.getAdapter=Ro,Bo.HttpStatusCode=Ao,Bo.default=Bo;const{Axios:Wo,AxiosError:jo,CanceledError:Io,isCancel:Uo,CancelToken:Ho,VERSION:Ko,all:qo,Cancel:Xo,isAxiosError:Go,spread:Jo,toFormData:Qo,AxiosHeaders:Yo,HttpStatusCode:Zo,formToJSON:th,getAdapter:eh,mergeConfig:ih}=Bo,sh={BASE_URL:"undefined"!=typeof window&&window.FUNHI_CHART_API_URL?window.FUNHI_CHART_API_URL:process.env.NEXT_PUBLIC_BACKEND_URL||"",TIMEOUT:1e4,MAX_RETRIES:3,RETRY_DELAY:1e3};const nh=new class{constructor(){this.baseURL=`${sh.BASE_URL}/api/ohlcv`,this.savingQueue=new Map,this.BATCH_DELAY=5e3,this.BATCH_SIZE=50}async saveCandles(t){try{const{mint:e,candles:i,timeFrame:s=60}=t;if(!e||!i||0===i.length)return console.warn("⚠️ [CandleStorage] Invalid save request:",t),!1;return!!(await Bo.post(`${this.baseURL}/candles/save`,{mint:e,candles:i,timeFrame:s})).data.success&&(console.log(`💾 [CandleStorage] Saved ${i.length} candles for ${e}`),!0)}catch(t){return console.error("❌ [CandleStorage] Error saving candles:",t),!1}}async saveCandle(t){try{const{mint:e,candle:i,timeFrame:s=60}=t;if(!e||!i)return console.warn("⚠️ [CandleStorage] Invalid save request:",t),!1;const n=`${e}_${s}`,r=this.savingQueue.get(n);if(r)clearTimeout(r.timeout),r.candles.push(i),r.candles.length>=this.BATCH_SIZE?await this.flushQueue(n,e,s):r.timeout=setTimeout(()=>{this.flushQueue(n,e,s)},this.BATCH_DELAY);else{const t=setTimeout(()=>{this.flushQueue(n,e,s)},this.BATCH_DELAY);this.savingQueue.set(n,{candles:[i],timeout:t})}return!0}catch(t){return console.error("❌ [CandleStorage] Error queuing candle:",t),!1}}async flushQueue(t,e,i){const s=this.savingQueue.get(t);s&&0!==s.candles.length&&(this.savingQueue.delete(t),await this.saveCandles({mint:e,candles:s.candles,timeFrame:i}))}async getCandles(t){try{const{mint:e,timeFrame:i=60,limit:s=5e4}=t;if(!e)return console.warn("⚠️ [CandleStorage] Invalid get request:",t),[];const n=await Bo.get(`${this.baseURL}/candles/${e}`,{params:{timeFrame:i,limit:s},timeout:8e3,validateStatus:t=>t>=200&&t<500});if(n.data.success&&n.data.data&&n.data.data.candles){const t=n.data.data.candles.length;return t>0?console.log(`✅ [CandleStorage] Retrieved ${t} candles for ${e}`):console.log(`ℹ️ [CandleStorage] No candles found for ${e} in database`),n.data.data.candles}return n.data.warning&&console.warn(`⚠️ [CandleStorage] ${n.data.warning}`),[]}catch(e){return"ECONNABORTED"===e.code?console.error("❌ [CandleStorage] Request timeout getting candles for",t.mint):e.response?console.error("❌ [CandleStorage] Server error getting candles:",e.response.status,e.response.data):e.request?console.error("❌ [CandleStorage] Network error getting candles - no response received"):console.error("❌ [CandleStorage] Error getting candles:",e.message),[]}}async flushAll(){const t=[];for(const[e,i]of this.savingQueue.entries()){clearTimeout(i.timeout);const[s,n]=e.split("_"),r=parseInt(n);t.push(this.flushQueue(e,s,r))}await Promise.all(t)}};class rh{async loadCandles(t,e,i){try{const s=i??Number.MAX_SAFE_INTEGER,n=(await nh.getCandles({mint:t,timeFrame:e,limit:s})).reduce((t,e)=>{const i=t.findIndex(t=>t.time===e.time);return i>=0?t[i]=e:t.push(e),t},[]);return n.sort((t,e)=>t.time-e.time)}catch(t){return console.error("❌ [CandleStorageAdapter] Error loading candles:",t),[]}}async saveCandles(t,e,i){try{await nh.saveCandles({mint:t,timeFrame:e,candles:i})}catch(t){console.error("❌ [CandleStorageAdapter] Error saving candles:",t)}}}class oh{constructor(t){this.debounceMs=50,this.lastUpdate=0,this.timeframeManager=t}handlePriceUpdate(t,e){this.debounce(e)&&this.timeframeManager.updateAll(t,e)}handleSocketUpdate(t,e){t.mint===e&&t.candles&&Object.entries(t.candles).forEach(([t,e])=>{const i=this.getTimeframeSeconds(t);if(i){const t=Math.floor(Date.now()/1e3),s=Math.floor(t/i)*i;if(e.time===s){const t={time:e.time,open:e.open,high:e.high||e.open,low:e.low||e.open,close:e.close,volume:e.volume||0};this.timeframeManager.updateFromExternal(i,t,s)}}})}debounce(t){const e=Date.now();return!(this.lastUpdate&&e-this.lastUpdate<this.debounceMs)&&(this.lastUpdate=e,!0)}getTimeframeSeconds(t){return{"1m":60,"5m":300,"15m":900,"1h":3600,"4h":14400,"1d":86400}[t]||null}}class hh{constructor(t){this.gapCheckInterval=null,this.GAP_CHECK_INTERVAL_MS=3e4,this.config=t,this.currentTimeframe=t.timeframes[0],this.timeframeManager=new s(t.timeframes),this.storageAdapter=new rh,this.updateHandler=new oh(this.timeframeManager);const e={mint:t.mint,ticker:t.ticker,formatPrice:t.formatPrice};this.chartRenderer=new Ln(t.container,e)}async initialize(){this.chartRenderer.initialize(),console.log("🔄 [FunhiChartController] Loading candles for all timeframes...");for(const t of this.config.timeframes)await this.loadTimeframeData(t.seconds);const t=this.getCurrentCandles();t.length>0&&this.chartRenderer.updateData(t),this.startGapChecking()}async loadTimeframeData(t){const e=this.timeframeManager.getCandles(t).length,i=await this.storageAdapter.loadCandles(this.config.mint,t);if(i.length>0){this.timeframeManager.loadCandles(t,i);const s=this.timeframeManager.getCandles(t).length;e>0&&s<e?console.warn(`⚠️ [FunhiChartController] Candle count decreased after load: ${e} -> ${s}. This might indicate data loss. Database returned ${i.length} candles.`):s>e&&console.log(`✅ [FunhiChartController] Loaded ${i.length} candles from database. Total candles: ${e} -> ${s} (merged)`)}else 0===e&&console.warn(`⚠️ [FunhiChartController] No candles loaded from database for timeframe ${t}s`)}updatePrice(t){const e=Date.now();this.updateHandler.handlePriceUpdate(t,e);const i=this.getCurrentCandles();i.length>0&&this.chartRenderer.updateData(i),this.checkAndFillGaps()}handleSocketUpdate(t){this.updateHandler.handleSocketUpdate(t,this.config.mint);const e=this.getCurrentCandles();e.length>0&&this.chartRenderer.updateData(e)}async switchTimeframe(t){const e=this.config.timeframes.find(e=>e.seconds===t);if(!e)return void console.warn(`⚠️ [FunhiChartController] Timeframe ${t}s not found`);console.log(`🔄 [FunhiChartController] Loading candles for timeframe ${t}s`),await this.loadTimeframeData(t),await this.checkAndFillGapsForTimeframe(t),this.currentTimeframe=e;const i=this.getCurrentCandles();i.length>0?(this.chartRenderer.updateData(i),console.log(`📊 [FunhiChartController] Updated chart with ${i.length} candles for ${e.label}`)):console.warn(`⚠️ [FunhiChartController] No candles available to display for timeframe ${e.label}`)}getCurrentCandles(){return this.timeframeManager.getCandles(this.currentTimeframe.seconds)}getCurrentTimeframe(){return this.currentTimeframe}getCurrentCandle(t){return this.timeframeManager.getCurrentCandle(t)}resize(){this.chartRenderer.resize()}async checkAndFillGaps(){await this.checkAndFillGapsForTimeframe(this.currentTimeframe.seconds)}async checkAndFillGapsForTimeframe(t){const e=this.timeframeManager.getManager(t);if(!e)return;const i=e.detectGaps();if(0===i.length)return;const s=i.reduce((t,e)=>t+e.missingCount,0);if(s>0&&(console.log(`🔍 [FunhiChartController] Detected ${i.length} gap(s) with ${s} missing candles for ${t}s timeframe. Reloading from database to fill gaps...`),await this.loadTimeframeData(t),t===this.currentTimeframe.seconds)){const t=this.getCurrentCandles();t.length>0&&this.chartRenderer.updateData(t)}}async checkAndFillGapsForAllTimeframes(){for(const t of this.config.timeframes)await this.checkAndFillGapsForTimeframe(t.seconds)}startGapChecking(){this.gapCheckInterval&&clearInterval(this.gapCheckInterval),this.gapCheckInterval=setInterval(()=>{this.checkAndFillGapsForAllTimeframes()},this.GAP_CHECK_INTERVAL_MS)}stopGapChecking(){this.gapCheckInterval&&(clearInterval(this.gapCheckInterval),this.gapCheckInterval=null)}destroy(){this.stopGapChecking(),this.chartRenderer.destroy(),this.timeframeManager.reset()}}const lh=e=>{const[i]=t.useState(e||null),[s,n]=t.useState(!1),[r,o]=t.useState(!1);t.useEffect(()=>{if(!i)return n(!1),void o(!1);o(!0);const t=()=>{console.log("✅ [useSocket] Connected to Socket.IO server"),n(!0),o(!1)},e=()=>{console.log("🔌 [useSocket] Disconnected from Socket.IO server"),n(!1),o(!1)},s=t=>{console.error("❌ [useSocket] Connection error:",t),o(!1)};return i.connected&&(n(!0),o(!1)),i.on("connect",t),i.on("disconnect",e),i.on("connect_error",s),()=>{i.off("connect",t),i.off("disconnect",e),i.off("connect_error",s)}},[i]);const h=t.useCallback(()=>{console.log("🔍 [useSocket] Connect called - connection managed by provider")},[]),l=t.useCallback(()=>{console.log("🔍 [useSocket] Disconnect called - connection managed by provider")},[]),a=t.useCallback((t,e=60,s,n,r)=>{if(!i?.connected)return console.warn("⚠️ [useSocket] Socket not connected, cannot subscribe"),!1;try{return i.emit("ohlcv:subscribe",{mint:t,timeFrame:e}),s&&i.on("ohlcv:initial",s),n&&i.on("ohlcv:update",n),r&&i.on("ohlcv:newCandle",r),console.log(`📊 [useSocket] Subscribed to OHLCV updates for ${t} (${e}s)`),!0}catch(t){return console.error("❌ [useSocket] Failed to subscribe to OHLCV:",t),!1}},[i]),c=t.useCallback((t,e=60,s,n,r)=>{if(!i?.connected)return!1;try{return i.emit("ohlcv:unsubscribe",{mint:t,timeFrame:e}),s&&i.off("ohlcv:initial",s),n&&i.off("ohlcv:update",n),r&&i.off("ohlcv:newCandle",r),console.log(`📊 [useSocket] Unsubscribed from OHLCV updates for ${t} (${e}s)`),!0}catch(t){return console.error("❌ [useSocket] Failed to unsubscribe from OHLCV:",t),!1}},[i]),u=t.useCallback((t,e)=>{if(!i?.connected)return console.warn("⚠️ [useSocket] Socket not connected, cannot subscribe"),!1;try{return i.emit("price:subscribe",{mint:t}),e&&i.on("price:update",e),console.log(`💰 [useSocket] Subscribed to price updates for ${t}`),!0}catch(t){return console.error("❌ [useSocket] Failed to subscribe to price:",t),!1}},[i]),d=t.useCallback((t,e)=>{if(!i?.connected)return!1;try{return i.emit("price:unsubscribe",{mint:t}),e&&i.off("price:update",e),console.log(`💰 [useSocket] Unsubscribed from price updates for ${t}`),!0}catch(t){return console.error("❌ [useSocket] Failed to unsubscribe from price:",t),!1}},[i]),f=t.useCallback(t=>{if(!i?.connected)return console.warn("⚠️ [useSocket] Socket not connected, cannot send test message"),!1;try{return i.emit("test-message",{message:t,timestamp:Date.now()}),i.once("test-response",t=>{console.log("🧪 [useSocket] Test response received:",t)}),!0}catch(t){return console.error("❌ [useSocket] Failed to send test message:",t),!1}},[i]);return{socket:i,isConnected:s,isConnecting:r,connect:h,disconnect:l,subscribeToOHLCV:a,unsubscribeFromOHLCV:c,subscribeToPrice:u,unsubscribeFromPrice:d,testConnection:f}};function ah(e,i){const[s,n]=t.useState(null),[r,o]=t.useState(!1),[h,l]=t.useState(null),[a,c]=t.useState(null),[u,d]=t.useState(!1);t.useEffect(()=>{i&&(n(i),c(Date.now()),d(!0),o(!1))},[i]);const f=t.useMemo(()=>{if(!s||!s.market)return{currentPrice:0,currentMarketCap:0,currentVolume:0,performance24h:{value:"0.00%",isPositive:!1,raw:0},performance7d:{value:"0.00%",isPositive:!1,raw:0},performance1m:{value:"0.00%",isPositive:!1,raw:0},performanceAllTime:{value:"0.00%",isPositive:!1,raw:0},high24h:0,low24h:0,volume24h:0,return24h:0};const t=parseFloat(s.market?.price||"0")||0,e=parseFloat(s.market?.marketCap||"0")||0;let i=parseFloat(s.volume?.current||"0")||0;i<=.01&&(i=parseFloat(s.blockchain?.currentRealSol||"0")||0);const n={value:s.performance?.["24H"]?.percentage||"0.00%",isPositive:s.performance?.["24H"]?.isPositive||!1,raw:s.performance?.["24H"]?.gain||0},r={value:s.performance?.["7D"]?.percentage||"0.00%",isPositive:s.performance?.["7D"]?.isPositive||!1,raw:s.performance?.["7D"]?.gain||0},o={value:s.performance?.["1M"]?.percentage||"0.00%",isPositive:s.performance?.["1M"]?.isPositive||!1,raw:s.performance?.["1M"]?.gain||0},h={value:s.performance?.["All Time"]?.percentage||"0.00%",isPositive:s.performance?.["All Time"]?.isPositive||!1,raw:s.performance?.["All Time"]?.gain||0},l=parseFloat(s["24H"]?.high||"0")||0,a=parseFloat(s["24H"]?.low||"0")||0;let c=parseFloat(s.volume?.["24h"]||"0")||0;c<=.01&&(c=parseFloat(s.blockchain?.currentRealSol||"0")||0);return{currentPrice:t,currentMarketCap:e,currentVolume:i,performance24h:n,performance7d:r,performance1m:o,performanceAllTime:h,high24h:l,low24h:a,volume24h:c,return24h:parseFloat(s["24H"]?.return||"0")||0}},[s]),m=t.useCallback(t=>t>.01,[]);return{analytics:s,...f,isRealVolume:m,loading:r,error:h,connected:u,lastUpdate:a}}const ch=new class{constructor(){this.timeframes={"1m":60,"5m":300,"15m":900,"30m":1800,"1h":3600,"4h":14400,"1d":86400}}aggregateCandles(t,e){try{if(60===e)return t;if(!Array.isArray(t)||0===t.length)return console.warn("⚠️ [CandleAggregation] No candles to aggregate"),[];const i=[...t].sort((t,e)=>t.time-e.time),s=[];let n=[],r=null;for(const t of i){const i=Math.floor(t.time/e)*e;if(null===r&&(r=i),i===r)n.push(t);else{if(n.length>0){const t=this.aggregateGroup(n,r);s.push(t)}n=[t],r=i}}if(n.length>0&&null!==r){const t=this.aggregateGroup(n,r);s.push(t)}return console.log(`📊 [CandleAggregation] Aggregated ${t.length} 1m candles into ${s.length} ${this.getTimeframeLabel(e)} candles`),s}catch(t){return console.error("❌ [CandleAggregation] Error aggregating candles:",t),[]}}aggregateGroup(t,e){const i=[...t].sort((t,e)=>t.time-e.time),s=i[0].open,n=i[i.length-1].close,r=Math.max(...i.map(t=>t.high)),o=Math.min(...i.map(t=>t.low)),h=i.reduce((t,e)=>t+(e.volume||0),0);return{time:e,open:s,high:r,low:o,close:n,volume:h}}getTimeframeLabel(t){for(const[e,i]of Object.entries(this.timeframes))if(i===t)return e;return`${t}s`}getTimeframeSeconds(t){return this.timeframes[t]||60}fillGaps(t,e){try{if(!Array.isArray(t)||t.length<2)return t;const i=[...t].sort((t,e)=>t.time-e.time),s=[];for(let t=0;t<i.length-1;t++){const n=i[t],r=i[t+1];s.push(n);let o=n.time+e;for(;o<r.time;)s.push({time:o,open:n.close,high:n.close,low:n.close,close:n.close,volume:0}),o+=e}return s.push(i[i.length-1]),s.length>i.length&&console.log(`🔧 [CandleAggregation] Filled ${s.length-i.length} gaps in ${this.getTimeframeLabel(e)} candles`),s}catch(e){return console.error("❌ [CandleAggregation] Error filling gaps:",e),t}}getCurrentCandle(t,e){try{if(!Array.isArray(t)||0===t.length)return null;const i=Math.floor(Date.now()/1e3),s=Math.floor(i/e)*e,n=t.filter(t=>Math.floor(t.time/e)*e===s);return 0===n.length?null:this.aggregateGroup(n,s)}catch(t){return console.error("❌ [CandleAggregation] Error getting current candle:",t),null}}updateRealtimeCandle(t,e,i){try{if(!e)return t;const s=Math.floor(e.time/i)*i,n=t.findIndex(t=>t.time===s);if(n>=0){const i=t[n],r={time:s,open:i.open,high:Math.max(i.high,e.high),low:Math.min(i.low,e.low),close:e.close,volume:i.volume+(e.volume||0)},o=[...t];return o[n]=r,o}{const i={time:s,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume||0};return[...t,i].sort((t,e)=>t.time-e.time)}}catch(e){return console.error("❌ [CandleAggregation] Error updating realtime candle:",e),t}}isValidCandle(t){return t&&"number"==typeof t.time&&"number"==typeof t.open&&"number"==typeof t.high&&"number"==typeof t.low&&"number"==typeof t.close&&t.high>=t.low&&t.high>=t.open&&t.high>=t.close&&t.low<=t.open&&t.low<=t.close}cleanCandles(t){if(!Array.isArray(t))return[];const e=t.filter(t=>this.isValidCandle(t));return e.length<t.length&&console.warn(`⚠️ [CandleAggregation] Removed ${t.length-e.length} invalid candles`),e}getRequiredOneMinuteCandles(t,e=200){const i=t/60;return Math.ceil(e*i)}};exports.API_CONFIG=sh,exports.FunhiChart=({mint:e,ticker:i,tokenName:s,socket:n,isConnected:r,currentMarketCap:o,analyticsConnected:h,analyticsLoading:l})=>{const a=t.useRef(null),c=t.useRef(null),[u,d]=t.useState(!0),[f,m]=t.useState(!1),[p,g]=t.useState(null),[v,b]=t.useState(null),[w,y]=t.useState(null),S=lh(),C=n||S.socket,M=void 0!==r?r:S.isConnected,E=ah(),x=void 0!==o?o:E.currentMarketCap,_=void 0!==h?h:E.connected,z=void 0!==l?l:E.loading,k=t.useMemo(()=>[{label:"1m",value:"1m",seconds:60},{label:"5m",value:"5m",seconds:300},{label:"15m",value:"15m",seconds:900},{label:"1h",value:"1h",seconds:3600},{label:"4h",value:"4h",seconds:14400},{label:"1d",value:"1d",seconds:86400}],[]),T=t.useCallback(t=>t>=1e9?`$${(t/1e9).toFixed(t>=1e10?2:3)}B`:t>=1e6?`$${(t/1e6).toFixed(t>=1e7?2:3)}M`:t>=1e4?`$${(t/1e3).toFixed(t>=1e5?1:2)}K`:t>=1e3?`$${(t/1e3).toFixed(2)}K`:t>=1?`$${t.toFixed(2)}`:`$${t.toFixed(4)}`,[]);t.useEffect(()=>{if(a.current&&e)try{const t={mint:e,ticker:i,tokenName:s,timeframes:k,container:a.current,formatPrice:T},n=new hh(t);return c.current=n,n.initialize().then(()=>{y(n.getCurrentTimeframe()),d(!1)}).catch(t=>{console.error("❌ [FunhiChart] Initialization error:",t),b(t.message||"Failed to initialize chart"),d(!1)}),()=>{n.destroy(),c.current=null}}catch(t){console.error("❌ [FunhiChart] Controller creation error:",t),b(t.message||"Failed to create chart controller"),d(!1)}},[e,i,s,k,T]),t.useEffect(()=>{!c.current||x<=0||(!isFinite(x)||x<=0?console.warn(`⚠️ [FunhiChart] Invalid market cap data: ${x}`):c.current.updatePrice(x))},[x]),t.useEffect(()=>{if(!(C&&M&&e&&c.current))return;const t=t=>{t.mint===e&&c.current?.handleSocketUpdate(t)};return C.on("multiTimeframeCandleUpdate",t),()=>{C.off("multiTimeframeCandleUpdate",t)}},[C,M,e]);const R=t.useCallback(async t=>{if(!c.current)return;const e=k.find(e=>e.value===t);if(e&&e.value!==w?.value)if(f)console.log("⚠️ [FunhiChart] Timeframe switch already in progress");else{console.log(`🔄 [FunhiChart] Switching to ${e.label}`),m(!0),g(e.label),d(!0);try{await c.current.switchTimeframe(e.seconds),y(e),d(!1),m(!1),g(null),console.log(`✅ [FunhiChart] Switched to ${e.label}`)}catch(t){console.error("❌ [FunhiChart] Switch error:",t),d(!1),m(!1),g(null)}}},[k,w,f]);if(t.useEffect(()=>{const t=()=>{c.current?.resize()};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),t.useEffect(()=>{if((u||z)&&c.current){if(0===c.current.getCurrentCandles().length){const t=setTimeout(()=>d(!1),1e4);return()=>clearTimeout(t)}}},[u,z]),v)return t.createElement("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg"},t.createElement("div",{className:"text-red-800 font-medium"},"Chart Error"),t.createElement("div",{className:"text-red-600 text-sm"},v),t.createElement("button",{onClick:()=>b(null),className:"mt-2 px-3 py-1 bg-red-100 text-red-700 rounded text-sm hover:bg-red-200"},"Dismiss"));const N=c.current?.getCurrentCandles()||[],L=x||0;return t.createElement("div",{className:"w-full"},t.createElement("div",{className:"mb-4 flex flex-wrap gap-2 items-center"},t.createElement("div",{className:"flex flex-wrap gap-2"},k.map(e=>{const i=w?.value===e.value,s=f&&p===e.label,n=f;return t.createElement("button",{key:e.value,onClick:()=>R(e.value),disabled:n,className:`\n px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200 relative\n ${i?"bg-blue-600 text-white":n?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-100 text-gray-700 hover:bg-gray-200"}\n ${s?"animate-pulse":""}\n `},s&&t.createElement("div",{className:"absolute inset-0 flex items-center justify-center"},t.createElement("div",{className:"flex space-x-1"},t.createElement("div",{className:"w-1 h-1 bg-white rounded-full animate-pulse"}),t.createElement("div",{className:"w-1 h-1 bg-white rounded-full animate-pulse",style:{animationDelay:"0.1s"}}),t.createElement("div",{className:"w-1 h-1 bg-white rounded-full animate-pulse",style:{animationDelay:"0.2s"}}))),t.createElement("span",{className:s?"opacity-0":"opacity-100"},e.label))})),t.createElement("div",{className:"ml-auto flex items-center gap-2 text-sm"},t.createElement("div",{className:"w-2 h-2 rounded-full "+(_?"bg-green-500":"bg-red-500")}),t.createElement("span",{className:_?"text-green-600":"text-red-600"},_?"Connected":"Disconnected"),f&&p&&t.createElement("span",{className:"text-blue-600"},"• Switching to ",p,"..."),!f&&u&&!z&&t.createElement("span",{className:"text-blue-600"},"• Loading candles..."),z&&t.createElement("span",{className:"text-blue-600"},"• Connecting to analytics..."),!f&&!u&&!z&&N.length>0&&t.createElement("span",{className:"text-green-600"},"• ",N.length," ",w?.label," candles • ",T(L)))),t.createElement("div",{ref:a,className:"relative w-full h-96 transition-all duration-300 "+(f?"opacity-75 scale-[0.98]":"opacity-100 scale-100")},(f||u&&!z)&&t.createElement("div",{className:"absolute inset-0 bg-gradient-to-br from-white via-blue-50 to-white bg-opacity-90 flex items-center justify-center rounded-lg z-10 backdrop-blur-sm"},t.createElement("div",{className:"text-center"},t.createElement("div",{className:"flex justify-center items-center mb-4"},t.createElement("div",{className:"relative"},t.createElement("div",{className:"w-12 h-12 border-4 border-blue-200 rounded-full"}),t.createElement("div",{className:"absolute top-0 left-0 w-12 h-12 border-4 border-blue-600 rounded-full border-t-transparent animate-spin"}))),t.createElement("div",{className:"text-gray-700 font-medium text-lg"},f&&p?`Switching to ${p} timeframe...`:"Loading real-time data..."),t.createElement("div",{className:"mt-3 flex justify-center space-x-1"},t.createElement("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce"}),t.createElement("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),t.createElement("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})))),!f&&!u&&!z&&0===N.length&&t.createElement("div",{className:"absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center rounded-lg z-10"},t.createElement("div",{className:"text-center"},t.createElement("div",{className:"text-gray-600 mb-2"},"No ",w?.label," market data available"),t.createElement("div",{className:"text-sm text-gray-500"},"Waiting for real-time data...")))))},exports.candleAggregation=ch,exports.candleStorageService=nh,exports.useOptimizedTokenAnalytics=ah,exports.useSocket=lh;
|
|
8
8
|
//# sourceMappingURL=index.js.map
|