@nabeeltahirdeveloper/chart-sdk 2.3.16-beta → 2.3.19-beta
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/chart-sdk.es.js +8666 -8470
- package/dist/chart-sdk.umd.js +21 -21
- package/package.json +1 -1
package/dist/chart-sdk.umd.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
(function(je,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(je=typeof globalThis<"u"?globalThis:je||self,a(je.ChartSDK={},je.jsxRuntime,je.React))})(this,(function(je,a,q){"use strict";var Ks=typeof document<"u"?document.currentScript:null;const Gt="17:00-17:00",$t="America/New_York",IA="24x7",DA="UTC",rl={EURUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},BTCUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},ETHUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},BNBUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},SOLUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},ADAUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},XRPUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},DOTUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},MATICUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},LINKUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"}},nl={type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"};function nr(i){return i&&rl[i.toUpperCase()]||nl}function en(i){return nr(i).type==="forex"}function tn(i){return nr(i).type==="crypto"}function xp(i){return nr(i).session==="24x7"}function j(i){if(i==null)return null;if(typeof i=="number"){if(Number.isNaN(i)||!Number.isFinite(i))return null;let e;i>1e10?e=i/1e3:(i<1e9,e=i);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof i=="string"){const e=Date.parse(i);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof i=="object"&&"year"in i&&"month"in i&&"day"in i){const t=new Date(Date.UTC(i.year,i.month-1,i.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function bp(i,e){if(!i||i.length<2)return[];const t=[],A=2;for(let r=1;r<i.length;r++){const n=i[r-1].time,s=i[r].time,o=s-n;o>e*A&&t.push({from:n,to:s,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(n*1e3).toISOString(),toDate:new Date(s*1e3).toISOString()})}return t}function Qp(i,e="America/New_York"){const t=new Date(i*1e3),A=new Date(t.toLocaleString("en-US",{timeZone:e})),r=A.getDay();return!(r===0||r===6||r===5&&A.getHours()>=17)}function sl(i){return Array.isArray(i)?i.map(e=>({...e,time:j(e.time)})).filter(e=>e.time!=null):[]}function Fp(i){if(!i||i.length<2)return!0;for(let e=1;e<i.length;e++)if(i[e].time<=i[e-1].time)return!1;return!0}function Oe(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function ol(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(j(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof A!="number"||!Number.isFinite(A)||typeof r!="number"||!Number.isFinite(r)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||A<t||A<n||A<r||r>t||r>n||r>A||t<=0||A<=0||r<=0||n<=0)}function al(i){const e=s=>Math.round(s*1e5)/1e5;let t=e(i.open),A=e(i.high),r=e(i.low),n=e(i.close);return A=Math.max(A,t,n,r),r=Math.min(r,t,n,A),{...i,open:t,high:A,low:r,close:n,volume:i.volume!=null?Math.round(i.volume):i.volume}}function ll(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=j(t.time);if(A!=null)if(e.has(A)){const r=e.get(A);e.set(A,{...t,time:A,open:t.open,high:Math.max(r.high,t.high),low:Math.min(r.low,t.low),close:t.close,volume:(r.volume||0)+(t.volume||0)})}else e.set(A,{...t,time:A})}),Array.from(e.values())}function Up(i,e="percentile"){if(!Array.isArray(i)||i.length<3)return i;const t=i.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return i;const A=[...t].sort((s,o)=>s-o);let r,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),l=A[s],c=A[o],u=c-l;r=l-1.5*u,n=c+1.5*u}else{const s=t.reduce((c,u)=>c+u,0)/t.length,o=t.reduce((c,u)=>c+Math.pow(u-s,2),0)/t.length,l=Math.sqrt(o);if(l===0)return i;r=s-3*l,n=s+3*l}return i.map((s,o)=>{const l=s.close;if(l<r||l>n){if(o===0)return s;const c=i[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function Sp(i,e){if(!Array.isArray(i)||i.length===0)return i;const t=[],A=Math.max(e*10080,604800),r=1e4;for(let o=0;o<i.length;o++)if(t.push(i[o]),o<i.length-1){const l=i[o].time,c=i[o+1].time,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const m=i[o];let y=l+e,v=0;for(y=Oe(y,e);y<c&&v<r;){const T=Oe(y,e);t.some(U=>U.time===T)||(t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),v++),y+=e}if(y<c&&v>=r){const T=Oe(c-e,e);t.some(U=>U.time===T)||t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function uA(i){if(!i||typeof i!="string")return 60;const e=i.toUpperCase();if(e==="MN")return 2592e3;let t=e.match(/^([MHDW])(\d+)$/);if(t){const A=t[1];return parseInt(t[2],10)*({M:60,H:3600,D:86400,W:604800}[A]||60)}if(t=i.match(/^(\d+)([mhdwy])$/i),t){const A=parseInt(t[1],10),r=t[2].toLowerCase();return A*({m:60,h:3600,d:86400,w:604800,y:31536e3}[r]||60)}return 60}function cl(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=nr(e),r=uA(t),o=sl(i).map(E=>({...E,time:Oe(E.time,r)})).filter(E=>ol(E)).map(E=>al(E)),l=ll(o);l.sort((E,N)=>E.time-N.time);const c=Math.floor(Date.now()/1e3),u=l.filter(E=>E.time<=c),m=u.filter((E,N)=>N===0?!0:E.time>u[N-1].time),y=m.length>10?Up(m,"percentile"):m,v=ll(y);v.sort((E,N)=>E.time-N.time);const T=Sp(v,r),C=[];for(let E=1;E<T.length;E++){const N=T[E].time-T[E-1].time;N>r*2&&C.push({from:T[E-1].time,to:T[E].time,gapSeconds:N,gapMinutes:Math.round(N/60),fromDate:new Date(T[E-1].time*1e3).toISOString(),toDate:new Date(T[E].time*1e3).toISOString()})}const U=y.filter((E,N)=>N===0?!1:E.close===y[N-1].close&&E.open===y[N-1].close).length,F={original:i.length,processed:T.length,duplicates:i.length-l.length,outliers:U,gaps:C,filledGaps:T.length-v.length,symbolConfig:A};return{candles:T,stats:F}}function hl(i,e,t="1m"){if(!i||!e||!ol(i))return null;const A=j(i.time);if(A==null)return null;const r=uA(t),n=Oe(A,r);return al({...i,time:n})}function xt(i){var e=i.width,t=i.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(t<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:t}}function mi(i,e){return i.width===e.width&&i.height===e.height}var Ep=(function(){function i(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return i.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(i.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),i.prototype.subscribe=function(e){var t=this,A={next:e};return this._observers.push(A),{unsubscribe:function(){t._observers=t._observers.filter(function(r){return r!==A})}}},i.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},i.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},i.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},i.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},i})();function Lp(i){return new Ep(i)}var Mp=(function(){function i(e,t,A){var r;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=xt({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(r=A?.allowResizeObserver)!==null&&r!==void 0?r:!0,this._chooseAndInitObserver()}return i.prototype.dispose=function(){var e,t;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(t=this._devicePixelRatioObservable)===null||t===void 0||t.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(i.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"bitmapSize",{get:function(){return xt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=xt(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},i.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(i.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),i.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},i.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},i.prototype._resizeBitmap=function(e){var t=this.bitmapSize;mi(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},i.prototype._emitBitmapSizeChanged=function(e,t){var A=this;this._bitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,A=xt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=mi(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&mi(t,r)||(this._suggestedBitmapSize=r,this._emitSuggestedBitmapSizeChanged(t,r))},i.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var A=this;this._suggestedBitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}Ip().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=ul(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Lp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=ul(this._canvasElement);if(A!==null){var r=(t=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:A.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?Dp(n[0],r):xt({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(s)}}},i.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var A=t.find(function(s){return s.target===e._canvasElement});if(!(!A||!A.devicePixelContentBoxSize||!A.devicePixelContentBoxSize[0])){var r=A.devicePixelContentBoxSize[0],n=xt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function Hp(i,e){return new Mp(i,e.transform,e.options)}function ul(i){return i.ownerDocument.defaultView}function Ip(){return new Promise(function(i){var e=new ResizeObserver(function(t){i(t.every(function(A){return"devicePixelContentBoxSize"in A})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function Dp(i,e){return xt({width:Math.round(i.left*e+i.width*e)-Math.round(i.left*e),height:Math.round(i.top*e+i.height*e)-Math.round(i.top*e)})}var _p=(function(){function i(e,t,A){if(t.width===0||t.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,A.width===0||A.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=A,this._context=e}return i.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},i.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(i.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),i})();function wi(i,e){var t=i.canvasElementClientSize;if(t.width===0||t.height===0)return null;var A=i.bitmapSize;if(A.width===0||A.height===0)return null;var r=i.canvasElement.getContext("2d",e);return r===null?null:new _p(r,t,A)}const Pp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},kp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Np={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Op={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},Kp={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},Vp={color:"#26a69a",base:0},dl={color:"#2196f3"},pl={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 fl,gl;function Bi(i,e){const t={0:[],1:[i.lineWidth,i.lineWidth],2:[2*i.lineWidth,2*i.lineWidth],3:[6*i.lineWidth,6*i.lineWidth],4:[i.lineWidth,4*i.lineWidth]}[e];i.setLineDash(t)}function ml(i,e,t,A){i.beginPath();const r=i.lineWidth%2?.5:0;i.moveTo(t,e+r),i.lineTo(A,e+r),i.stroke()}function ii(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function jt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Se(i){if(i===null)throw new Error("Value is null");return i}function Di(i){return Se(jt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(fl||(fl={})),(function(i){i[i.Solid=0]="Solid",i[i.Dotted=1]="Dotted",i[i.Dashed=2]="Dashed",i[i.LargeDashed=3]="LargeDashed",i[i.SparseDotted=4]="SparseDotted"})(gl||(gl={}));const wl={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 wA(i){return i<0?0:i>255?255:Math.round(i)||0}function Bl(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const zp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Wp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Rp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Gp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function sr(i){(i=i.toLowerCase())in wl&&(i=wl[i]);{const e=Gp.exec(i)||Rp.exec(i);if(e)return[wA(parseInt(e[1],10)),wA(parseInt(e[2],10)),wA(parseInt(e[3],10)),Bl(e.length<5?1:parseFloat(e[4]))]}{const e=Wp.exec(i);if(e)return[wA(parseInt(e[1],16)),wA(parseInt(e[2],16)),wA(parseInt(e[3],16)),1]}{const e=zp.exec(i);if(e)return[wA(17*parseInt(e[1],16)),wA(17*parseInt(e[2],16)),wA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function yl(i){return .199*i[0]+.687*i[1]+.114*i[2]}function An(i){const e=sr(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:yl(e)>160?"black":"white"}}class Mt{constructor(){this.h=[]}l(e,t,A){const r={o:e,_:t,u:A===!0};this.h.push(r)}v(e){const t=this.h.findIndex((A=>e===A.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,A){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function FA(i,...e){for(const t of e)for(const A in t)t[A]!==void 0&&Object.prototype.hasOwnProperty.call(t,A)&&!["__proto__","constructor","prototype"].includes(A)&&(typeof t[A]!="object"||i[A]===void 0||Array.isArray(t[A])?i[A]=t[A]:FA(i[A],t[A]));return i}function _A(i){return typeof i=="number"&&isFinite(i)}function or(i){return typeof i=="number"&&i%1==0}function ar(i){return typeof i=="string"}function rn(i){return typeof i=="boolean"}function YA(i){const e=i;if(!e||typeof e!="object")return e;let t,A,r;for(A in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(A)&&(r=e[A],t[A]=r&&typeof r=="object"?YA(r):r);return t}function $p(i){return i!==null}function lr(i){return i===null?void 0:i}const Vs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function _i(i,e,t){return e===void 0&&(e=Vs),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Xp{constructor(e){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=e}W(){const e=this.k,t=this.j(),A=this.H();return e.P===t&&e.D===A||(e.P=t,e.D=A,e.R=_i(t,A),e.L=2.5/12*t,e.B=e.L,e.A=t/12*e.T,e.I=t/12*e.T,e.N=0),e.V=this.$(),e.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 zs{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class UA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class Jp extends UA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const u=n.it[c],m=Math.round(u.nt*t)+s,y=u.st*A,v=l*A+s;e.moveTo(m,y),e.arc(m,y,v,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function Zp(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Yp={from:0,to:1};class qp{constructor(e,t){this.ut=new zs,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=t,this.ut.Z(this.ct)}bt(e){const t=this.F.wt();t.length!==this.ct.length&&(this.dt=t.map(Zp),this.ct=this.dt.map((A=>{const r=new Jp;return r.J(A),r})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,t=this.F.wt(),A=this.vt.xt(),r=this.F.St();t.forEach(((n,s)=>{var o;const l=this.dt[s],c=n.kt(A);if(e||c===null||!n.yt())return void(l.tt=null);const u=Se(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,u.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=A,l.it[0].nt=r.It(A),l.tt=Yp}))}}let jp=class extends UA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*A),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*A),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,Bi(e,this.zt.Lt.Nt),(function(c,u,m,y){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,m),c.lineTo(u+v,y),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,Bi(e,this.zt.Et.Nt),ml(e,l,0,t.width))}};class ef{constructor(e){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 jp(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),t=Se(this.jt.Ht()),A=t.$t().W().crosshair,r=this.Ft;if(A.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=A.horzLine.width,r.Et.Nt=A.horzLine.style,r.Et.V=A.horzLine.color,r.Lt.et=A.vertLine.width,r.Lt.Nt=A.vertLine.style,r.Lt.V=A.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function tf(i,e,t,A,r,n){i.fillRect(e+n,t,A-2*n,n),i.fillRect(e+n,t+r-n,A-2*n,n),i.fillRect(e,t,n,r),i.fillRect(e+A-n,t,n,r)}function nn(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function Cl(i,e,t,A,r,n){i.beginPath(),i.roundRect?i.roundRect(e,t,A,r,n):(i.lineTo(e+A-n[1],t),n[1]!==0&&i.arcTo(e+A,t,e+A,t+n[1],n[1]),i.lineTo(e+A,t+r-n[2]),n[2]!==0&&i.arcTo(e+A,t+r,e+A-n[2],t+r,n[2]),i.lineTo(e+n[3],t+r),n[3]!==0&&i.arcTo(e,t+r,e,t+r-n[3],n[3]),i.lineTo(e,t+n[0]),n[0]!==0&&i.arcTo(e,t,e+n[0],t,n[0]))}function vl(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return Cl(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;Cl(i,e+c,t+c,A-s,r-s,(u=-c,o.map((m=>m===0?m:m+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function Tl(i,e,t,A,r,n,s){i.save(),i.globalCompositeOperation="copy";const o=i.createLinearGradient(0,0,0,r);o.addColorStop(0,n),o.addColorStop(1,s),i.fillStyle=o,i.fillRect(e,t,A,r),i.restore()}class xl{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,A,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const u=this.Gt(l,t,A,r),m=u.Jt;return u.Qt?vl(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):vl(c,m.ri,m.ii,m.ni,m.si,s,m.ei,[0,m.ht,m.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(m.ri,m.li,m.ai-m.ri,m.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(u.Qt?m.ui-m.ei:0,m.ii,m.ei,m.ci-m.ii)),u}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,m=this.zt.hi||!this.zt.mi?t.T:0,y=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,T=t.B+this.Xt.gi,C=t.A,U=t.I,F=this.zt.Kt,E=t.P,N=A.Mi(s,F),R=Math.ceil(A.xi(s,F)),M=E+v+T,z=t.C+C+U+R+m,ne=Math.max(1,Math.floor(u));let $=Math.round(M*u);$%2!=ne%2&&($+=1);const V=y>0?Math.max(1,Math.floor(y*c)):0,Ae=Math.round(z*c),re=Math.round(m*c),he=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,Z=Math.round(he*u)-Math.floor(.5*u),te=Math.floor(Z+ne/2-$/2),ae=te+$,ce=r==="right",se=ce?l.width-y:y,le=ce?o.width-V:V;let pe,Be,Fe;return ce?(pe=le-Ae,Be=le-re,Fe=se-m-C-y):(pe=le+Ae,Be=le+re,Fe=se+m+C),{Qt:ce,Jt:{ii:te,li:Z,ci:ae,ni:Ae,si:$,ht:2*c,ei:V,ti:pe,ri:le,ai:Be,oi:ne,ui:o.width},di:{ii:te/u,ci:ae/u,fi:Fe,pi:N}}}}class sn{constructor(e){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(e||xl)(this.Ci,this.yi),this.Ri=new(e||xl)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(e,t=!1){return Math.max(this.Pi.At(e,t),this.Ri.At(e,t))}Vi(){return this.yi.Si||0}Oi(e){this.yi.Si=e}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(e){return this.Di(),this.Ci.hi=this.Ci.hi&&e.W().ticksVisible,this.Ti.hi=this.Ti.hi&&e.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 Af extends sn{constructor(e,t,A){super(),this.jt=e,this.Li=t,this.Ei=A}zi(e,t,A){if(e.yt=!1,this.jt.W().mode===2)return;const r=this.jt.W().horzLine;if(!r.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=An(r.labelBackgroundColor);A.t=s.t,e.V=s.i;const o=2/12*this.Li.P();A.wi=o,A.gi=o;const l=this.Ei(this.Li);A.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const rf=/[1-9]/g;class bl{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const A=e.useMediaCoordinateSpace((({context:y})=>(y.font=t.R,Math.round(t.Wi.xi(y,Se(this.zt).Kt,rf)))));if(A<=0)return;const r=t.ji,n=A+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const u=c+n,m=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:y,horizontalPixelRatio:v,verticalPixelRatio:T})=>{const C=Se(this.zt);y.fillStyle=C.t;const U=Math.round(c*v),F=Math.round(0*T),E=Math.round(u*v),N=Math.round(m*T),R=Math.round(2*v);if(y.beginPath(),y.moveTo(U,F),y.lineTo(U,N-R),y.arcTo(U,N,U+R,N,R),y.lineTo(E-R,N),y.arcTo(E,N,E,N-R,R),y.lineTo(E,F),y.fill(),C.hi){const M=Math.round(C.ki*v),z=F,ne=Math.round((z+t.T)*T);y.fillStyle=C.V;const $=Math.max(1,Math.floor(v)),V=Math.floor(.5*v);y.fillRect(M-V,z,$,ne-z)}})),e.useMediaCoordinateSpace((({context:y})=>{const v=Se(this.zt),T=0+t.C+t.T+t.L+t.P/2;y.font=t.R,y.textAlign="left",y.textBaseline="middle",y.fillStyle=v.V;const C=t.Wi.Mi(y,"Apr0");y.translate(c+r,T+C),y.fillText(v.Kt,0,0)}))}}class nf{constructor(e,t,A){this.ft=!0,this.Wt=new bl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Se(n)),e.yt=!0;const s=An(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Ws{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(e){this.Zi=e}Dt(){return this.Yi}Gi(e){this.Yi=e}Ji(e){return[]}Qi(){return[]}yt(){return!0}}var Ql;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(Ql||(Ql={}));class sf extends Ws{constructor(e,t){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=e,this.cn=t,this.dn=new qp(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Se(this.tn).vn())return{_t:l,ki:o};{const c=Se(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new nf(this,e,A),this.wn=new ef(this)}W(){return this.cn}gn(e,t){this._n=e,this.un=t}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(e,t,A){this.hn||(this.hn=!0),this.en=!0,this.yn(e,t,A)}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(e){return this.tn!==null?[this.wn,this.dn]:[]}Ut(e){return e===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(e,t){this.en&&this.tn===e||this.rn.clear();const A=[];return this.tn===e&&A.push(this.Dn(this.rn,t,this.fn)),A}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach((e=>e.bt())),this.bn.bt(),this.dn.bt()}On(e){return e&&!e.vn().Ni()?e.vn():null}yn(e,t,A){this.Bn(e,t,A)&&this.Vn()}Bn(e,t,A){const r=this.ln,n=this.an,s=this.nn,o=this.sn,l=this.tn,c=this.On(A);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=A;const u=c!==null?c.Ct():null;return c!==null&&u!==null?(this.nn=t,this.an=c.Rt(t,u)):(this.nn=NaN,this.an=NaN),r!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter($p),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,A){let r=e.get(t);return r===void 0&&(r=new Af(this,t,A),e.set(t,r)),r}}function on(i){return i==="left"||i==="right"}class Kt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(r,n){return r===void 0?n:{Fn:Math.max(r.Fn,n.Fn),Wn:r.Wn||n.Wn}})(this.zn.get(e),t);this.zn.set(e,A)}jn(){return this.En}Hn(e){const t=this.zn.get(e);return t===void 0?{Fn:this.En}:{Fn:Math.max(this.En,t.Fn),Wn:t.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(e){this.Un(),this.Ln=[{qn:1,Vt:e}]}Zn(e){this.Xn(),this.Ln.push({qn:5,Vt:e})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(e){this.Un(),this.Ln.push({qn:2,Vt:e})}Jn(e){this.Un(),this.Ln.push({qn:3,Vt:e})}Qn(){return this.Ln}ts(e){for(const t of e.Ln)this.ns(t);this.En=Math.max(this.En,e.En),e.zn.forEach(((t,A)=>{this.Nn(A,t)}))}static ss(){return new Kt(2)}static es(){return new Kt(3)}ns(e){switch(e.qn){case 0:this.$n();break;case 1:this.Yn(e.Vt);break;case 2:this.Gn(e.Vt);break;case 3:this.Jn(e.Vt);break;case 4:this.Kn();break;case 5:this.Zn(e.Vt);break;case 6:this.Xn()}}Xn(){const e=this.Ln.findIndex((t=>t.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Fl=".";function qA(i,e){if(!_A(i))return"n/a";if(!or(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?i.toString():("0000000000000000"+i.toString()).slice(-e)}class an{constructor(e,t){if(t||(t=1),_A(e)&&or(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=t,this.hs()}format(e){const t=e<0?"−":"";return e=Math.abs(e),t+this.ls(e)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let e=this.Li;for(;e>1;)e/=10,this._s++}}ls(e){const t=this.Li/this.rs;let A=Math.floor(e),r="";const n=this._s!==void 0?this._s:NaN;if(t>1){let s=+(Math.round(e*t)-A*t).toFixed(this._s);s>=t&&(s-=t,A+=1),r=Fl+qA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=Fl+qA(0,n));return A.toFixed(0)+r}}class Ul extends an{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class of{constructor(e){this.us=e}format(e){let t="";return e<0&&(t="-",e=-e),e<995?t+this.cs(e):e<999995?t+this.cs(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),t+this.cs(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),t+this.cs(e/1e9)+"B")}cs(e){let t;const A=Math.pow(10,this.us);return t=(e=Math.round(e*A)/A)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),t.replace(/(\.[1-9]*)0+$/,((r,n)=>n))}}function Sl(i,e,t,A,r,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=i,u=e[A.from];let m=n(i,u),y=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const T={nt:u.nt-v,st:u.st},C={nt:u.nt+v,st:u.st};o.moveTo(T.nt*l,T.st*c),o.lineTo(C.nt*l,C.st*c),s(i,m,T,C)}else{const v=(C,U)=>{s(i,m,y,U),o.beginPath(),m=C,y=U};let T=y;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let C=A.from+1;C<A.to;++C){T=e[C];const U=n(i,T);switch(t){case 0:o.lineTo(T.nt*l,T.st*c);break;case 1:o.lineTo(T.nt*l,e[C-1].st*c),U!==m&&(v(U,T),o.lineTo(T.nt*l,e[C-1].st*c)),o.lineTo(T.nt*l,T.st*c);break;case 2:{const[F,E]=af(e,C-1,C);o.bezierCurveTo(F.nt*l,F.st*c,E.nt*l,E.st*c,T.nt*l,T.st*c);break}}t!==1&&U!==m&&(v(U,T),o.moveTo(T.nt*l,T.st*c))}(y!==T||y===T&&t===1)&&s(i,m,y,T)}}const El=6;function Rs(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Ll(i,e){return{nt:i.nt/e,st:i.st/e}}function af(i,e,t){const A=Math.max(0,e-1),r=Math.min(i.length-1,t+1);var n,s;return[(n=i[e],s=Ll(Rs(i[t],i[A]),El),{nt:n.nt+s.nt,st:n.st+s.st}),Rs(i[t],Ll(Rs(i[r],i[e]),El))]}function lf(i,e,t,A,r){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(r.nt*s,i*o),n.lineTo(A.nt*s,i*o),n.closePath(),n.fillStyle=t,n.fill()}class Ml extends UA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:A,tt:r,ds:n,et:s,Nt:o,fs:l}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(r===null)return;const u=e.context;u.lineCap="butt",u.lineJoin="round",u.lineWidth=s,Bi(u,o),u.lineWidth=1,Sl(e,A,l,r,n,this.bs.bind(this),lf.bind(null,c))}}function Gs(i,e,t){return Math.min(Math.max(i,e),t)}function ln(i,e,t){return e-i<=t}function Hl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class $s{ws(e,t){const A=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==r||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==l){const u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const m=Gs(c*e.verticalPixelRatio/l,0,1);u.addColorStop(m,n),u.addColorStop(m,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class cf extends Ml{constructor(){super(...arguments),this.Ts=new $s}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function hf(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class Il extends UA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,Bi(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&Sl(e,t,n,A,r,u,hf),l&&(function(m,y,v,T,C){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:E}=m;let N=null;const R=Math.max(1,Math.floor(U))%2/2,M=v*F+R;for(let z=T.to-1;z>=T.from;--z){const ne=y[z];if(ne){const $=C(m,ne);$!==N&&(E.beginPath(),N!==null&&E.fill(),E.fillStyle=$,N=$);const V=Math.round(ne.nt*U)+R,Ae=ne.st*F;E.moveTo(V,Ae),E.arc(V,Ae,M,0,2*Math.PI)}}E.fill()})(e,t,l,A,u)}}class Dl extends Il{Vs(e,t){return t.lt}}function _l(i,e,t,A,r=0,n=e.length){let s=n-r;for(;0<s;){const o=s>>1,l=r+o;A(e[l],t)===i?(r=l+1,s-=o+1):s=o}return r}const cr=_l.bind(null,!0),Pl=_l.bind(null,!1);function uf(i,e){return i.ot<e}function df(i,e){return e<i.ot}function kl(i,e,t){const A=e.Os(),r=e.ui(),n=cr(i,A,uf),s=Pl(i,r,df);if(!t)return{from:n,to:s};let o=n,l=s;return n>0&&n<i.length&&i[n].ot>=A&&(o=n-1),s>0&&s<i.length&&i[s-1].ot<=r&&(l=s+1),{from:o,to:l}}class Xs{constructor(e,t,A){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=t,this.Fs=A}bt(e){this.Bs=!0,e==="data"&&(this.As=!0),e==="options"&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),this.Ls===null?null:this.js):null}Hs(){this.zs=this.zs.map((e=>Object.assign(Object.assign({},e),this.Es.Us().$s(e.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 e=this.Es.Dt(),t=this.Ns.St();if(this.qs(),t.Ni()||e.Ni())return;const A=t.Xs();if(A===null||this.Es.In().Ks()===0)return;const r=this.Es.Ct();r!==null&&(this.Ls=kl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class cn extends Xs{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.te(this.zs,A,lr(this.Ls))}ie(e,t){return{ot:e,_t:t,nt:NaN,st:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>{const A=t.Vt[3];return this.se(t.ee,A,e)}))}}class pf extends cn{constructor(e,t){super(e,t),this.js=new zs,this.re=new cf,this.he=new Dl,this.js.Z([this.re,this.he])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W();this.re.J({fs:e.lineType,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,vs:null,ps:e.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:e.lineVisible?e.lineType:void 0,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}}class ff extends UA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),u=c-l,m=this.oe,y=u+m-1,v=Math.min(o.de,o.fe),T=Math.max(o.de,o.fe),C=Math.round(v*A)-l,U=Math.round(T*A)+l,F=Math.max(U-C,this.oe);e.fillRect(u,C,m,F);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-E;let ne=Math.max(C,Math.round(o.pe*A)-l),$=ne+m-1;$>C+F-1&&($=C+F-1,ne=$-m+1),e.fillRect(z,ne,u-z,$-ne+1)}const N=c+E;let R=Math.max(C,Math.round(o.me*A)-l),M=R+m-1;M>C+F-1&&(M=C+F-1,R=M-m+1),e.fillRect(y+1,R,N-y,M-R+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Se(this.zt).le,e)))}}class Nl extends Xs{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.be(this.zs,A,lr(this.Ls))}we(e,t,A){return{ot:e,ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>this.se(t.ee,t,e)))}}class gf extends Nl{constructor(){super(...arguments),this.js=new ff}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class mf extends Ml{constructor(){super(...arguments),this.Ts=new $s}bs(e,t){const A=this.G;return this.Ts.ws(e,{Ms:t.ke,xs:t.ye,Ss:t.Ce,ks:t.Te,ys:e.bitmapSize.height,vs:A.vs})}}class wf extends Il{constructor(){super(...arguments),this.Pe=new $s}Vs(e,t){const A=this.G;return this.Pe.ws(e,{Ms:t.Re,xs:t.Re,Ss:t.De,ks:t.De,ys:e.bitmapSize.height,vs:A.vs})}}class Bf extends cn{constructor(e,t){super(e,t),this.js=new zs,this.Ve=new mf,this.Oe=new wf,this.js.Z([this.Ve,this.Oe])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const t=this.Es.W(),A=this.Es.Dt().Rt(t.baseValue.price,e.Vt),r=this.Ns.St().le();this.Ve.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineType,vs:A,ps:!1,tt:this.Ls,ds:r}),this.Oe.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,vs:A,tt:this.Ls,ds:r})}}class yf extends UA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),l=Math.floor(n*o*s),c=Math.floor(n*s),u=Math.min(l,c);return Math.max(Math.floor(s),u)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",l=Math.min(Math.floor(n),Math.floor(this.zt.le*n));l=Math.max(Math.floor(n),Math.min(l,this.ae));const c=Math.floor(.5*l);let u=null;for(let m=A.from;m<A.to;m++){const y=t[m];y.Ee!==o&&(r.fillStyle=y.Ee,o=y.Ee);const v=Math.round(Math.min(y.pe,y.me)*s),T=Math.round(Math.max(y.pe,y.me)*s),C=Math.round(y.de*s),U=Math.round(y.fe*s);let F=Math.round(n*y.nt)-c;const E=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,E));const N=E-F+1;r.fillRect(F,C,N,v-C),r.fillRect(F,T+1,N,U-T),u=E}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const A=Math.max(Math.floor(e),t);return this.ae<=2*A?Math.max(Math.floor(e),Math.floor(1*e)):A}Ie(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let u=A.from;u<A.to;u++){const m=t[u];m.Ne!==o&&(r.fillStyle=m.Ne,o=m.Ne);let y=Math.round(m.nt*n)-Math.floor(.5*this.ae);const v=y+this.ae-1,T=Math.round(Math.min(m.pe,m.me)*s),C=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(y=Math.max(c+1,y),y=Math.min(y,v)),this.zt.le*n>2*l)tf(r,y,T,v-y+1,C-T+1,l);else{const U=v-y+1;r.fillRect(y,T,U,C-T+1)}c=v}}Le(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=A.from;c<A.to;c++){const u=t[c];let m=Math.round(Math.min(u.pe,u.me)*s),y=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),T=v+this.ae-1;if(u.ce!==o){const C=u.ce;r.fillStyle=C,o=C}this.zt._i&&(v+=l,m+=l,T-=l,y-=l),m>y||r.fillRect(v,m,T-v+1,y-m+1)}}}class Cf extends Nl{constructor(){super(...arguments),this.js=new yf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class vf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Js extends Xs{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new vf(this.wn.renderer(),(r=>{const n=e.Ct();return n===null?null:e.Dt().Rt(r,n.Vt)}))}We(e){return this.wn.priceValueBuilder(e)}je(e){return this.wn.isWhitespace(e)}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>Object.assign(Object.assign({ot:t.ee,nt:NaN},e.$s(t.ee)),{He:t.$e})))}Gs(e,t){t.Qs(this.zs,lr(this.Ls))}Js(){this.wn.update({bars:this.zs.map(Tf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Tf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class xf extends UA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],u=Math.round(l.st*A);let m,y;e.fillStyle=l.ce,u<=n?(m=u,y=s):(m=n,y=u-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,y-m)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,c;if(A%2){const u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class bf extends cn{constructor(){super(...arguments),this.js=new xf}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,Se(this.Es.Ct()).Vt)};this.js.J(e)}}class Qf extends cn{constructor(){super(...arguments),this.js=new Dl}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W(),t={it:this.zs,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,et:e.lineWidth,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(t)}}const Ff=/[2-9]/g;class hr{constructor(e=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=e}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(e,t,A){return this.sr(e,t,A).width}Mi(e,t,A){const r=this.sr(e,t,A);return((r.actualBoundingBoxAscent||0)-(r.actualBoundingBoxDescent||0))/2}sr(e,t,A){const r=A||Ff,n=String(t).replace(r,"0");if(this.tr.has(n))return jt(this.tr.get(n)).er;if(this.Ke===this.ir){const o=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(o),this.Je++,this.Ke--}e.save(),e.textBaseline="middle";const s=e.measureText(n);return e.restore(),s.width===0&&t.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class Uf{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,t,A){this.hr=e,this.k=t,this.lr=A}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class Ol{constructor(e,t,A){this.ur=e,this.ar=new hr(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new Uf(this.ar)}gt(){const e=this.F.dr(this.cr);if(e===null)return null;const t=e.vr(this.cr)?e.pr():this.cr.Dt();if(t===null)return null;const A=e.mr(t);if(A==="overlay")return null;const r=this.F.br();return r.P!==this.j&&(this.j=r.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),r,A),this.Wt}}class Sf extends UA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var A;if(!(!((A=this.zt)===null||A===void 0)&&A.yt))return null;const{st:r,et:n,gr:s}=this.zt;return t>=r-n-7&&t<=r+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*r);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),Bi(e,this.zt.Nt),ml(e,n,0,t.width))}}class Zs{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new Sf,this.ft=!0,this.Es=e,this.Ns=e.$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 Ef extends Zs{constructor(e){super(e)}yr(){this.Sr.yt=!1;const e=this.Es.Dt(),t=e.Cr().Cr;if(t!==2&&t!==3)return;const A=this.Es.W();if(!A.baseLineVisible||!this.Es.yt())return;const r=this.Es.Ct();r!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(r.Vt,r.Vt),this.Sr.V=A.baseLineColor,this.Sr.et=A.baseLineWidth,this.Sr.Nt=A.baseLineStyle)}}class Lf extends UA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){const r=this.zt;if(r===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(r.Xe.x*t)+s,l=r.Xe.y*A;e.fillStyle=r.Tr,e.beginPath();const c=Math.max(2,1.5*r.Pr)*t;e.arc(o,l,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=r.Rr,e.beginPath(),e.arc(o,l,r.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=r.Dr,e.beginPath(),e.arc(o,l,r.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const Mf=[{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 Kl(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=sr(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Vl(i,e){const t=i%2600/2600;let A;for(const l of Mf)if(t>=l.Vr&&t<=l.Or){A=l;break}ii(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:Kl(e,r,A.Ir,A.zr),Dr:Kl(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class Hf{constructor(e){this.Wt=new Lf,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=e}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),this.jr.W().lastPriceAnimation===2){const e=performance.now(),t=this.Wr-e;if(t>0)return void(t<650&&(this.Wr+=2600));this.Fr=e,this.Wr=e+2600}}bt(){this.ft=!0}Ur(){this.Nr=!0}yt(){return this.jr.W().lastPriceAnimation!==0}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 e=this.jr.$t().St(),t=e.Xs(),A=this.jr.Ct();if(t===null||A===null)return;const r=this.jr.Zr(!0);if(r.Xr||!t.Kr(r.ee))return;const n={x:e.It(r.ee),y:this.jr.Dt().Rt(r._t,A.Vt)},s=r.V,o=this.jr.W().lineWidth,l=Vl(this.Gr(),s);this.Wt.J({Tr:s,Pr:o,Rr:l.Rr,Dr:l.Dr,ht:l.ht,Xe:n})}Yr(){const e=this.Wt.$e();if(e!==null){const t=Vl(this.Gr(),e.Tr);e.Rr=t.Rr,e.Dr=t.Dr,e.ht=t.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function ur(i,e){return Hl(Math.min(Math.max(i,12),30)*e)}function dr(i,e){switch(i){case"arrowDown":case"arrowUp":return ur(e,1);case"circle":return ur(e,.8);case"square":return ur(e,.7)}}function zl(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(ur(i,1))}function Wl(i){return Math.max(ur(i,.1),3)}function Rl(i,e,t){return e?i:t?Math.ceil(i/2):0}function Gl(i,e,t,A,r){const n=dr("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function $l(i,e,t,A){const r=(dr("arrowUp",A)-1)/2*t.Jr,n=(Hl(A/2)-1)/2*t.Jr;e.beginPath(),i?(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st-r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+r),e.lineTo(t.nt-n,t.st+r),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st+r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-r),e.lineTo(t.nt-n,t.st-r),e.lineTo(t.nt-n,t.st)),e.fill()}function If(i,e,t,A,r,n){return Gl(e,t,A,r,n)}class Df extends UA{constructor(){super(...arguments),this.zt=null,this.ar=new hr,this.j=-1,this.H="",this.Qr=""}J(e){this.zt=e}_r(e,t){this.j===e&&this.H===t||(this.j=e,this.H=t,this.Qr=_i(e,t),this.ar.nr())}wr(e,t){if(this.zt===null||this.zt.tt===null)return null;for(let A=this.zt.tt.from;A<this.zt.tt.to;A++){const r=this.zt.it[A];if(Pf(r,e,t))return{Mr:r.th,gr:r.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A},r,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),_f(o,e,t,A)}}}}function _f(i,e,t,A){e.fillStyle=i.V,i.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,i.Kt.ih,i.Kt.nt,i.Kt.st,t,A),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void $l(!1,n,s,r.Ks);case"arrowUp":return void $l(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(dr("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,u*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const u=dr("square",c),m=(u-1)*l.Jr/2,y=l.nt-m,v=l.st-m;o.fillRect(y,v,u*l.Jr,u*l.Jr)})(n,s,r.Ks)}r.nh}})(i,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(i,t,A))}function Pf(i,e,t){return!(i.Kt===void 0||!(function(A,r,n,s,o,l){const c=s/2;return o>=A&&o<=A+n&&l>=r-c&&l<=r+c})(i.Kt.nt,i.Kt.st,i.Kt.Hi,i.Kt.At,e,t))||(function(A,r,n){if(A.Ks===0)return!1;switch(A.nh){case"arrowDown":case"arrowUp":return If(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const m=2+dr("circle",l)/2,y=s-c,v=o-u;return Math.sqrt(y*y+v*v)<=m})(A.nt,A.st,A.Ks,r,n);case"square":return Gl(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function kf(i,e,t,A,r,n,s,o,l){const c=_A(t)?t:t.Se,u=_A(t)?t:t.Me,m=_A(t)?t:t.xe,y=_A(e.size)?Math.max(e.size,0):1,v=zl(o.le())*y,T=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-T-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-T-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(m,l)+T+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class Nf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Df,this.jr=e,this.$i=t,this.zt={it:[],tt:null}}bt(e){this.ft=!0,this.hh=!0,e==="data"&&(this.rh=!0,this.oh=null)}gt(e){if(!this.jr.yt())return null;this.ft&&this._h();const t=this.$i.W().layout;return this.Wt._r(t.fontSize,t.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const e=this.$i.St().le(),t=Wl(e),A=1.5*zl(e)+2*t,r=this.fh();this.ah={above:Rl(A,r.aboveBar,r.inBar),below:Rl(A,r.belowBar,r.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),t=this.$i.St(),A=this.jr.dh();this.rh&&(this.zt.it=A.map((u=>({ot:u.time,nt:0,st:0,Ks:0,nh:u.shape,V:u.color,th:u.th,gr:u.id,Kt:void 0}))),this.rh=!1);const r=this.$i.W().layout;this.zt.tt=null;const n=t.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=Wl(t.le()),c={sh:l,eh:l};this.zt.tt=kl(this.zt.it,n,!0);for(let u=this.zt.tt.from;u<this.zt.tt.to;u++){const m=A[u];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const y=this.zt.it[u];y.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(y.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(m.time);v!==null&&kf(y,m,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Of extends Zs{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const t=this.Es.W();if(!t.priceLineVisible||!this.Es.yt())return;const A=this.Es.Zr(t.priceLineSource===0);A.Xr||(e.yt=!0,e.st=A.ki,e.V=this.Es.mh(A.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class Kf extends sn{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const u=r.mh(c.V),m=An(u);A.t=m.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=m.i,t.V=m.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function Xl(i,e,t,A){const r=Number.isFinite(e),n=Number.isFinite(t);return r&&n?i(e,t):r||n?r?e:t:A}class rA{constructor(e,t){this.kh=e,this.yh=t}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new rA(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(e){return e===null?this:new rA(Xl(Math.min,this.Ph(),e.Ph(),-1/0),Xl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!_A(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let A=this.yh-t,r=this.kh-t;A*=e,r*=e,this.yh=t+A,this.kh=t+r}Oh(e){_A(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new rA(e.minValue,e.maxValue)}}class hn{constructor(e,t){this.Ih=e,this.zh=t||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return this.Ih===null?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(e){return e===null?null:new hn(rA.Ah(e.priceRange),e.margins)}}class Vf extends Zs{constructor(e,t){super(e),this.Nh=t}yr(){const e=this.Sr;e.yt=!1;const t=this.Nh.W();if(!this.Es.yt()||!t.lineVisible)return;const A=this.Nh.Fh();A!==null&&(e.yt=!0,e.st=A,e.V=t.color,e.et=t.lineWidth,e.Nt=t.lineStyle,e.gr=this.Nh.W().id)}}class zf extends sn{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.Nh.W(),n=r.axisLabelVisible,s=r.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(t.Kt=r.title,t.yt=!0),t.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(r.price),e.yt=!0;const c=An(r.axisLabelColor||r.color);A.t=c.t;const u=r.axisLabelTextColor||c.i;e.V=u,t.V=u,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Wf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Vf(e,this),this.ur=new zf(e,this),this.Hh=new Ol(this.ur,e,e.$t())}$h(e){FA(this.cn,e),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 e=this.jr,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const A=e.Ct();return A===null?null:t.Rt(this.cn.price,A.Vt)}}class Rf extends Ws{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Gf={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Se(i(t,A)),l=Di(o.Vt[0])<=Di(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,u=e.borderDownColor,m=e.wickUpColor,y=e.wickDownColor,v=Se(i(t,A)),T=Di(v.Vt[0])<=Di(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:T?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:T?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:T?m:y}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Se(i(t,A));return{ce:(r=l.lt)!==null&&r!==void 0?r:e.lineColor,lt:(n=l.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=l.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=l.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(i,e,t,A)=>{var r,n,s,o,l,c;const u=Se(i(t,A));return{ce:u.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=u.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=u.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=u.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=u.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=u.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=u.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Se(i(t,A));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class $f{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Gf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var Jl;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(Jl||(Jl={}));const ri=30;class Xf{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 this.Ks()===0}Kr(e){return this.hl(e,0)!==null}Gh(e){return this.ll(e)}ll(e,t=0){const A=this.hl(e,t);return A===null?null:Object.assign(Object.assign({},this.al(A)),{ee:this.rl(A)})}ne(){return this.tl}ol(e,t,A){if(this.Ni())return null;let r=null;for(const n of A)r=un(r,this._l(e,t,n));return r}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,t){const A=this.ul(e);if(A===null&&t!==0)switch(t){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return A}cl(e){let t=this.fl(e);return t>0&&(t-=1),t!==this.tl.length&&this.rl(t)<e?t:null}dl(e){const t=this.vl(e);return t!==this.tl.length&&e<this.rl(t)?t:null}ul(e){const t=this.fl(e);return t===this.tl.length||e<this.tl[t].ee?null:t}fl(e){return cr(this.tl,e,((t,A)=>t.ee<A))}vl(e){return Pl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,A){if(this.Ni())return null;let r=null;const n=Se(this.el()),s=Se(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/ri)*ri,u=Math.max(c,Math.floor(l/ri)*ri);{const y=this.fl(o),v=this.vl(Math.min(l,c,t));r=un(r,this.pl(y,v,A))}let m=this.il.get(A);m===void 0&&(m=new Map,this.il.set(A,m));for(let y=Math.max(c+1,o);y<u;y+=ri){const v=Math.floor(y/ri);let T=m.get(v);if(T===void 0){const C=this.fl(v*ri),U=this.vl((v+1)*ri-1);T=this.pl(C,U,A),m.set(v,T)}r=un(r,T)}{const y=this.fl(u),v=this.vl(l);r=un(r,this.pl(y,v,A))}return r}}function un(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class Jf{constructor(e){this.wl=e}X(e,t,A){this.wl.draw(e)}gl(e,t,A){var r,n;(n=(r=this.wl).drawBackground)===null||n===void 0||n.call(r,e)}}class Ys{constructor(e){this.tr=null,this.wn=e}gt(){var e;const t=this.wn.renderer();if(t===null)return null;if(((e=this.tr)===null||e===void 0?void 0:e.Ml)===t)return this.tr.xl;const A=new Jf(t);return this.tr={Ml:t,xl:A},A}Sl(){var e,t,A;return(A=(t=(e=this.wn).zOrder)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:"normal"}}function Zl(i){var e,t,A,r,n;return{Kt:i.text(),ki:i.coordinate(),Si:(e=i.fixedCoordinate)===null||e===void 0?void 0:e.call(i),V:i.textColor(),t:i.backColor(),yt:(A=(t=i.visible)===null||t===void 0?void 0:t.call(i))===null||A===void 0||A,hi:(n=(r=i.tickVisible)===null||r===void 0?void 0:r.call(i))===null||n===void 0||n}}class Zf{constructor(e,t){this.Wt=new bl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Zl(this.kl))),this.Wt}}class Yf extends sn{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Zl(this.kl);A.t=r.t,e.V=r.V;const n=2/12*this.Li.P();A.wi=n,A.gi=n,A.ki=r.ki,A.Si=r.Si,e.Kt=r.Kt,e.yt=r.yt,e.hi=r.hi}}class qf{constructor(e,t){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=e,this.jr=t}Ol(){return this.Vl}Vn(){var e,t;(t=(e=this.Vl).updateAllViews)===null||t===void 0||t.call(e)}Pn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Cl)===null||r===void 0?void 0:r.Ml)===n)return this.Cl.xl;const s=n.map((o=>new Ys(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Tl)===null||r===void 0?void 0:r.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((l=>new Zf(l,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Pl)===null||r===void 0?void 0:r.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((l=>new Yf(l,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Rl)===null||r===void 0?void 0:r.Ml)===n)return this.Rl.xl;const s=n.map((o=>new Ys(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Dl)===null||r===void 0?void 0:r.Ml)===n)return this.Dl.xl;const s=n.map((o=>new Ys(o)));return this.Dl={Ml:n,xl:s},s}Il(e,t){var A,r,n;return(n=(r=(A=this.Vl).autoscaleInfo)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}wr(e,t){var A,r,n;return(n=(r=(A=this.Vl).hitTest)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}}function qs(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function js(i){return i.Pn()}function jf(i){return i.Bl()}function e0(i){return i.Al()}class eo extends Rf{constructor(e,t,A,r,n){super(e),this.zt=new Xf,this.jh=new Of(this),this.zl=[],this.Ll=new Ef(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=t,this.$l=A;const s=new Kf(this);this.rn=[s],this.Hh=new Ol(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new Hf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},A=this.Dt();if(this.$t().St().Ni()||A.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const m=this.zt.sl();if(m===null)return t;s=m,o=m.ee}else{const m=this.zt.ll(r.ui(),-1);if(m===null||(s=this.zt.Gh(m.ee),s===null))return t;o=m.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),u=A.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:A.Fi(l,n.Vt),xh:A.Yl(l),Sh:A.Zl(l,n.Vt),V:c.ce,ki:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new $f(this)),this.Nl}W(){return this.cn}$h(e){const t=e.priceScaleId;t!==void 0&&t!==this.cn.priceScaleId&&this.$t().Xl(this,t),FA(this.cn,e),e.priceFormat!==void 0&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(e,t){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(t&&t.ta?this.El.$r():e.length===0&&this.El.Hr());const A=this.$t().dr(this);this.$t().ia(A),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const t=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const t=new Wf(this,e);return this.zl.push(t),this.$t().Gl(this),t}ra(e){const t=this.zl.indexOf(e);t!==-1&&this.zl.splice(t,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const e=this.ha();return e===null?null:{Vt:e.Vt[3],la:e.ot}}ha(){const e=this.$t().St().Xs();if(e===null)return null;const t=e.Os();return this.zt.ll(t,1)}In(){return this.zt}ph(e){const t=this.zt.Gh(e);return t===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3]}:t.Vt[3]}aa(e){const t=[];qs(this.Hl,js,"top",t);const A=this.El;return A!==null&&A.yt()&&(this.jl===null&&A.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),A.Ur(),t.unshift(A)),t}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const t=this.zl.map((A=>A.qh()));return e.push(...t),qs(this.Hl,js,"normal",e),e}ua(){return this.ca(js,"bottom")}da(e){return this.ca(jf,e)}fa(e){return this.ca(e0,e)}va(e,t){return this.Hl.map((A=>A.wr(e,t))).filter((A=>A!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const A=[...this.rn];for(const r of this.zl)A.push(r.Zh());return this.Hl.forEach((r=>{A.push(...r.Rn())})),A}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const A=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return hn.Ah(A)}return this.pa(e,t)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;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(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return Se(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new qf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Js)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Js)return e=>this.wn.je(e)}_a(){return!on(this.Dt().Pa())}pa(e,t){if(!or(e)||!or(t)||this.zt.Ni())return null;const A=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],r=this.zt.ol(e,t,A);let n=r!==null?new rA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new rA(o,o);n=n!==null?n.ts(l):l}let s=this.dn.uh();return this.Hl.forEach((o=>{const l=o.Il(e,t);if(l?.priceRange){const v=new rA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,m,y;l?.margins&&(c=s,u=l.margins,s={above:Math.max((m=c?.above)!==null&&m!==void 0?m:0,u.above),below:Math.max((y=c?.below)!==null&&y!==void 0?y:0,u.below)})})),new hn(n,s)}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 e=this.cn.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(e){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(t.length!==0)return t}}return this.Us().$s(e).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new of(this.cn.priceFormat.precision);break;case"percent":this.wa=new Ul(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new an(e,this.cn.priceFormat.minMove*e)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const e=this.$t().St();if(!e.Da()||this.zt.Ni())return void(this.Wl=[]);const t=Se(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Se(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Se(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:r,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new Nf(this,this.$t()),this.$l){case"Bar":this.wn=new gf(this,this.$t());break;case"Candlestick":this.wn=new Cf(this,this.$t());break;case"Line":this.wn=new Qf(this,this.$t());break;case"Custom":this.wn=new Js(this,this.$t(),jt(e));break;case"Area":this.wn=new pf(this,this.$t());break;case"Baseline":this.wn=new Bf(this,this.$t());break;case"Histogram":this.wn=new bf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return qs(this.Hl,e,t,A),A}}class t0{constructor(e){this.cn=e}Oa(e,t,A){let r=e;if(this.cn.mode===0)return r;const n=A.vn(),s=n.Ct();if(s===null)return r;const o=n.Rt(e,s),l=A.Ba().filter((u=>u instanceof eo)).reduce(((u,m)=>{if(A.vr(m)||!m.yt())return u;const y=m.Dt(),v=m.In();if(y.Ni()||!v.Kr(t))return u;const T=v.Gh(t);if(T===null)return u;const C=Di(m.Ct());return u.concat([y.Rt(T.Vt[3],C.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,m)=>Math.abs(u-o)-Math.abs(m-o)));const c=l[0];return r=n.pn(c,s),r}}class A0 extends UA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(A));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Se(this.zt);if(s.Aa){e.strokeStyle=s.Ia,Bi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*A);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,Bi(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*r);e.moveTo(-n,l),e.lineTo(t.width+n,l)}e.stroke()}}))}}class i0{constructor(e){this.Wt=new A0,this.ft=!0,this.tn=e}bt(){this.ft=!0}gt(){if(this.ft){const e=this.tn.$t().W().grid,t={Na:e.horzLines.visible,Aa:e.vertLines.visible,Fa:e.horzLines.color,Ia:e.vertLines.color,Wa:e.horzLines.style,za:e.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map((A=>({Ea:A.coord})))};this.Wt.J(t),this.ft=!1}return this.Wt}}class r0{constructor(e){this.wn=new i0(e)}qh(){return this.wn}}const to={$a:4,Ua:1e-4};function Pi(i,e){const t=100*(i-e)/e;return e<0?-t:t}function n0(i,e){const t=Pi(i.Ph(),e),A=Pi(i.Rh(),e);return new rA(t,A)}function pr(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function s0(i,e){const t=pr(i.Ph(),e),A=pr(i.Rh(),e);return new rA(t,A)}function dn(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.log10(t+e.Ua)+e.$a;return i<0?-A:A}function fr(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.pow(10,t-e.$a)-e.Ua;return i<0?-A:A}function gr(i,e){if(i===null)return null;const t=dn(i.Ph(),e),A=dn(i.Rh(),e);return new rA(t,A)}function pn(i,e){if(i===null)return null;const t=fr(i.Ph(),e),A=fr(i.Rh(),e);return new rA(t,A)}function Ao(i){if(i===null)return to;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return to;const t=Math.ceil(Math.abs(Math.log10(e))),A=to.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class io{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let r=A;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let A=this.qa;A!==1;){if(A%2==0)this.Za.push(2),A/=2;else{if(A%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),A/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,A){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const m=ln(n,r,1e-14)&&n>r+1e-14,y=ln(n,A*o,1e-14),v=ln(n,1,1e-14);if(!(m&&y&&v))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];ln(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,u;return n}}class Yl{constructor(e,t,A,r){this.Ka=[],this.Li=e,this.qa=t,this.Ga=A,this.Ja=r}Xa(e,t){if(e<t)throw new Error("high < low");const A=this.Li.At(),r=(e-t)*this.Qa()/A,n=new io(this.qa,[2,2.5,2]),s=new io(this.qa,[2,2,2.5]),o=new io(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let u=c[0];for(let m=1;m<c.length;++m)c[m]<u&&(u=c[m]);return u})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),r=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=A-1-s,c=Math.max(r,n),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let m=this.Xa(c,u),y=c%m;y+=y<0?m:0;const v=c>=u?1:-1;let T=null,C=0;for(let U=c-y;U>u;U-=m){const F=this.Ja(U,t,!0);T!==null&&Math.abs(F-T)<this.Qa()||F<o||F>l||(C<this.Ka.length?(this.Ka[C].Ea=F,this.Ka[C].so=e.eo(U)):this.Ka.push({Ea:F,so:e.eo(U)}),C++,T=F,e.ro()&&(m=this.Xa(U*v,u)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function ql(i){return i.slice().sort(((e,t)=>Se(e.Xi())-Se(t.Xi())))}var jl;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(jl||(jl={}));const ec=new Ul,tc=new an(100,1);class o0{constructor(e,t,A,r){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 Mt,this.vo=new Mt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=tc,this.xo=Ao(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Yl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(FA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=jt(e.scaleMargins.top),A=jt(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(A<0||A>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${A}`);if(t+A>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+A}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return this.cn.mode===1}Mh(){return this.cn.mode===2}Oo(){return this.cn.mode===3}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(e){const t=this.Cr();let A=null;e.Wn!==void 0&&(this.cn.autoScale=e.Wn),e.Cr!==void 0&&(this.cn.mode=e.Cr,e.Cr!==2&&e.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),t.Cr===1&&e.Cr!==t.Cr&&((function(n,s){if(n===null)return!1;const o=fr(n.Ph(),s),l=fr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=pn(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=gr(this.Ih,this.xo),A!==null&&this.Ao(A));const r=t.Cr!==this.cn.mode;r&&(t.Cr===2||this.Mh())&&this.Ra(),r&&(t.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&t.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(t,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(e){this.ho!==e&&(this.ho=e,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const e=this.At()-this.No()-this.Fo();return this.lo=e,e}Lh(){return this.Wo(),this.Ih}Ao(e,t){const A=this.Ih;(t||A===null&&e!==null||A!==null&&!A.Ch(e))&&(this.bo=null,this.Ih=e)}Ni(){return this.Wo(),this.ho===0||!this.Ih||this.Ih.Ni()}jo(e){return this.Bo()?e:this.At()-1-e}Rt(e,t){return this.Mh()?e=Pi(e,t):this.Oo()&&(e=pr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T],U=C._t;if(isNaN(U))continue;let F=U;v!==null&&(F=v(C._t,t));const E=r+u*(F-s),N=c?E:this.ho-1-E;C.st=N}}be(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T];let U=C.ge,F=C.Me,E=C.xe,N=C.Se;v!==null&&(U=v(C.ge,t),F=v(C.Me,t),E=v(C.xe,t),N=v(C.Se,t));let R=r+u*(U-s),M=c?R:this.ho-1-R;C.pe=M,R=r+u*(F-s),M=c?R:this.ho-1-R,C.de=M,R=r+u*(E-s),M=c?R:this.ho-1-R,C.fe=M,R=r+u*(N-s),M=c?R:this.ho-1-R,C.me=M}}pn(e,t){const A=this.To(e,t);return this.$o(A,t)}$o(e,t){let A=e;return this.Mh()?A=(function(r,n){return n<0&&(r=-r),r/100*n+n})(A,t):this.Oo()&&(A=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(A,t)),A}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const A=this.po[t];A.Xi()===null&&A.Ki(t+1),e.push(A)}return e=ql(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const A=t.Ct();A!==null&&(e===null||A.la<e.la)&&(e=A)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=Se(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const A=Se(this.ao).Th();t=Math.max(t,.1),A.Vh(t),this.Ao(A)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=Se(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Se(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Se(this.ao).Th();n.Oh(r),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(Pi(e,t));case 3:return this.ba().format(pr(e,t));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,Se(this.e_()).ba())}Zl(e,t){return e=Pi(e,t),this.s_(e,ec)}r_(){return this.po}h_(e){this.oo={uo:e,_o:!1}}Vn(){this.po.forEach((e=>e.Vn()))}Ra(){this.bo=null;const e=this.e_();let t=100;e!==null&&(t=Math.round(1/e.ma())),this.wa=tc,this.Mh()?(this.wa=ec,t=100):this.Oo()?(this.wa=new an(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Yl(this,t,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(e,t){if(this.Wo(),this.Ni())return 0;e=this.ro()&&e?dn(e,this.xo):e;const A=Se(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),r=Se(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?fr(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const A=this.r_();let r=0,n=0;for(const l of A){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const u=l.Il(e.Os(),e.ui());let m=u&&u.Lh();if(m!==null){switch(this.cn.mode){case 1:m=gr(m,this.xo);break;case 2:m=n0(m,c.Vt);break;case 3:m=s0(m,c.Vt)}if(t=t===null?m:t.ts(Se(m)),u!==null){const y=u.Eh();y!==null&&(r=Math.max(r,y.above),n=Math.max(n,y.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=pn(t,this.xo)),t=new rA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=gr(t,this.xo))}if(this.ro()){const l=pn(t,this.xo),c=Ao(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?pn(this.ao,this.xo):null;this.xo=c,t=gr(l,c),u!==null&&(this.ao=gr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new rA(-.5,.5)),this.xo=Ao(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Pi:this.Oo()?pr:this.ro()?e=>dn(e,this.xo):null}a_(e,t,A){return t===void 0?(A===void 0&&(A=this.ba()),A.format(e)):t(e)}Wh(e,t){return this.a_(e,this.yo.priceFormatter,t)}s_(e,t){return this.a_(e,this.yo.percentageFormatter,t)}}class a0{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Mt,this.yl=e,this.$i=t,this.d_=new r0(this);const A=t.W();this.f_=this.v_("left",A.leftPriceScale),this.p_=this.v_("right",A.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_(A)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const t=Array.from(this.o_.values());for(const A of t){const r=Se(A[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?jt(this.o_.get(e))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((e=>{e.S&&e.S()})),this.c_.m()}M_(){return this.u_}x_(e){this.u_=e}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(e){this.__=e,this.k_()}Lo(e){this.ho=e,this.f_.Lo(e),this.p_.Lo(e),this.po.forEach((t=>{if(this.vr(t)){const A=t.Dt();A!==null&&A.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const t=e.Dt();return t===null||this.f_!==t&&this.p_!==t}qo(e,t,A){const r=A!==void 0?A:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ii(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Se(e.Dt()).Pa();if(this.o_.has(A)){const n=jt(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const r=e.Dt();r&&r.Ba().indexOf(e)>=0&&r.Zo(e),r!==null&&(r.Yo(),this.P_(r)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,t){e.Go(t)}O_(e,t){e.Jo(t),this.k_()}B_(e){e.Qo()}A_(e,t){e.t_(t)}I_(e,t){e.i_(t),this.k_()}z_(e){e.n_()}k_(){this.po.forEach((e=>{e.Vn()}))}vn(){let e=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?e=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?e=this.f_:this.po.length!==0&&(e=this.po[0].Dt()),e===null&&(e=this.p_),e}pr(){let e=null;return this.$i.W().rightPriceScale.visible?e=this.p_:this.$i.W().leftPriceScale.visible&&(e=this.f_),e}P_(e){e!==null&&e.Vo()&&this.L_(e)}E_(e){const t=this.yl.Xs();e.Ro({Wn:!0}),t!==null&&e.h_(t),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((e=>{this.vr(e)&&this.P_(e.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=ql(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const t=e.r_();if(t&&t.length>0&&!this.yl.Ni()){const A=this.yl.Xs();A!==null&&e.h_(A)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let t=0,A=0;for(let r=0;r<e.length;r++){const n=e[r].Xi();n!==null&&(n<t&&(t=n),n>A&&(A=n))}return{H_:t,y_:A}}T_(e,t,A){let r=this.w_(t);if(r===null&&(r=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!on(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}r.qo(e),e.Gi(r),e.Ki(A),this.P_(r),this.mo=null}m_(e,t,A){t.Cr!==A.Cr&&this.L_(e)}v_(e,t){const A=Object.assign({visible:!0,autoScale:!0},YA(t)),r=new o0(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class l0{constructor(e,t,A=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=t,this.ir=A}Y_(e){const t=e.time,A=this.q_.cacheKey(t),r=this.tr.get(A);if(r!==void 0)return r.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(jt(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(A,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,A),this.Ke++,this.Ge++,n}}class mr{constructor(e,t){ii(e<=t,"right should be >= left"),this.X_=e,this.K_=t}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(e){return this.X_<=e&&e<=this.K_}Ch(e){return this.X_===e.Os()&&this.K_===e.ui()}}function Ac(i,e){return i===null||e===null?i===e:i.Ch(e)}class c0{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,t){this.nu(t),this.tr=null;for(let A=t;A<e.length;++A){const r=e[A];let n=this.J_.get(r.timeWeight);n===void 0&&(n=[],this.J_.set(r.timeWeight,n)),n.push({index:A,time:r.time,weight:r.timeWeight,originalTime:r.originalTime})}}su(e,t){const A=Math.ceil(t/e);return this.tr!==null&&this.tr.eu===A||(this.tr={Ha:this.ru(A),eu:A}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const t=[];this.J_.forEach(((A,r)=>{e<=A[0].index?t.push(r):A.splice(cr(A,e,(n=>n.index<e)),1/0)}));for(const A of t)this.J_.delete(A)}ru(e){let t=[];for(const A of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(A))continue;const r=t;t=[];const n=r.length;let s=0;const o=jt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let m=0;m<l;m++){const y=o[m],v=y.index;for(;s<n;){const T=r[s],C=T.index;if(!(C<v)){c=C;break}s++,t.push(T),u=C,c=1/0}if(c-v>=e&&v-u>=e)t.push(y),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class ki{constructor(e){this.hu=e}lu(){return this.hu===null?null:new mr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new ki(null)}}function h0(i,e){return i.weight>e.weight?i:e}class u0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new c0,this.du=new Map,this.fu=ki.ou(),this.vu=!0,this.pu=new Mt,this.mu=new Mt,this.bu=new Mt,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=A,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){FA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;FA(this.cn,e),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),e.barSpacing!==void 0&&this.$i.Gn(e.barSpacing),e.rightOffset!==void 0&&this.$i.Jn(e.rightOffset),e.minBarSpacing!==void 0&&this.$i.Gn((A=e.barSpacing)!==null&&A!==void 0?A:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var t,A;return(A=(t=this.uu[e])===null||t===void 0?void 0:t.time)!==null&&A!==void 0?A:null}Ui(e){var t;return(t=this.uu[e])!==null&&t!==void 0?t:null}Va(e,t){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return t?this.uu.length-1:null;const A=cr(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[A].time)?t?A:null:A}Ni(){return this.__===0||this.uu.length===0||this._u===null}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const e=this.Xs();if(e===null)return null;const t={from:e.Os(),to:e.ui()};return this.Ou(t)}Ou(e){const t=Math.round(e.from),A=Math.round(e.to),r=Se(this.Bu()),n=Se(this.Au());return{from:Se(this.Ui(Math.max(r,t))),to:Se(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Se(this.Va(e.from,!0)),to:Se(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),A=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&A!==0){const r=this.Su*e/A;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=A-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!or(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=A+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(this.gu!==null)return this.gu;const e=this.Su,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),A=Math.round(t/e),r=Se(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,u=this.$u(),m=this.cn.fixLeftEdge||u,y=this.cn.fixRightEdge||u;let v=0;for(const T of o){if(!(n<=T.index&&T.index<=s))continue;let C;v<this.Mu.length?(C=this.Mu[v],C.coord=this.It(T.index),C.label=this.Uu(T),C.weight=T.weight):(C={needAlignCoordinate:!1,coord:this.It(T.index),label:this.Uu(T),weight:T.weight},this.Mu.push(C)),this.Su>t/2&&!u?C.needAlignCoordinate=!1:C.needAlignCoordinate=m&&T.index<=l||y&&T.index>=c,v++}return this.Mu.length=v,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const A=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(A-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const t=Gs(this.__-e,0,this.__),A=Gs(this.__-Se(this.wo),0,this.__);t!==0&&A!==0&&this.Gn(this.wu.le*t/A)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const t=(this.Mo-e)/this.le();this.xu=Se(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const A=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:A+(e-A)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new mr(e,t+this.cn.rightOffset))}lc(e){const t=new mr(e.from,e.to);this.rc(t)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:t}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(e){return(this.__-1-e)/this.Su}Fu(e){const t=this.ac(e),A=this.Eu()+this.xu-t;return Math.round(1e6*A)/1e6}ju(e){const t=this.Su;this.Su=e,this.zu(),t!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(ki.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new mr(A-t+1,A);this._c(new ki(r))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const e=this.cc();e!==null&&this.xu<e&&(this.xu=e,this.vu=!0);const t=this.dc();this.xu>t&&(this.xu=t,this.vu=!0)}cc(){const e=this.Bu(),t=this._u;return e===null||t===null?null:e-t-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(e){let t=this.du.get(e.weight);return t===void 0&&(t=new l0((A=>this.fc(A)),this.q_),this.du.set(e.weight,t)),t.Y_(e)}fc(e){return this.q_.formatTickmark(e,this.yo)}_c(e){const t=this.fu;this.fu=e,Ac(t.lu(),this.fu.lu())||this.pu.m(),Ac(t.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 e=this.Bu();if(e===null)return;const t=this.Xs();if(t===null)return;const A=t.Os()-e;if(A<0){const r=this.xu-A-1;this.Jn(r)}this.zu()}Pu(){this.Lu(),this.zu()}}class d0{X(e,t,A){e.useMediaCoordinateSpace((r=>this.K(r,t,A)))}gl(e,t,A){e.useMediaCoordinateSpace((r=>this.vc(r,t,A)))}vc(e,t,A){}}class p0 extends d0{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:t,mediaSize:A}=e;let r=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;t.font=s.R;const o=this.wc(t,s.Kt);o>A.width?s.Zu=A.width/o:s.Zu=1,r+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((A.height-r)/2,0);break;case"bottom":n=Math.max(A.height-r,0)}t.fillStyle=this.zt.V;for(const s of this.zt.bc){t.save();let o=0;switch(this.zt.xc){case"left":t.textAlign="left",o=s.gc/2;break;case"center":t.textAlign="center",o=A.width/2;break;case"right":t.textAlign="right",o=A.width-1-s.gc/2}t.translate(o,n),t.textBaseline="top",t.font=s.R,t.scale(s.Zu,s.Zu),t.fillText(s.Kt,0,s.Sc),t.restore(),n+=s.gc*s.Zu}}wc(e,t){const A=this.kc(e.font);let r=A.get(t);return r===void 0&&(r=e.measureText(t).width,A.set(t,r)),r}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class f0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new p0(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.W(),t=this.Ft;t.yt=e.visible,t.yt&&(t.V=e.color,t.xc=e.horzAlign,t.Mc=e.vertAlign,t.bc=[{Kt:e.text,R:_i(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class g0 extends Ws{constructor(e,t){super(),this.cn=t,this.wn=new f0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var ic,rc,nc,sc,oc;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(ic||(ic={}));class m0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Mt,this.Rc=new Mt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Xp(this),this.yl=new u0(this,t.timeScale,this.cn.localization,A),this.vt=new sf(this,t.crosshair),this.Bc=new t0(t.crosshair),this.Ac=new g0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Kt.es())}Uh(){this.Nc(Kt.ss())}oa(){this.Nc(new Kt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){FA(this.cn,e),this.yc.forEach((t=>t.b_(e))),e.timeScale!==void 0&&this.yl.$h(e.timeScale),e.localization!==void 0&&this.yl.yu(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(e,t){if(e==="left")return void this.$h({leftPriceScale:t});if(e==="right")return void this.$h({rightPriceScale:t});const A=this.Uc(e);A!==null&&(A.Dt.$h(t),this.Pc.m())}Uc(e){for(const t of this.yc){const A=t.w_(e);if(A!==null)return{Ht:t,Dt:A}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,t){e.Lo(t),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((t=>t.S_(e))),this.Wu()}Ic(e){const t=new a0(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const A=e===void 0?this.yc.length-1:e,r=Kt.es();return r.Nn(A,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,A){e.V_(t,A)}O_(e,t,A){e.O_(t,A),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,A){t.Vo()||e.A_(t,A)}I_(e,t,A){t.Vo()||(e.I_(t,A),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,t){t.Vo()||(e.z_(t),this.Nc(this.Gc(e,2)))}E_(e,t){e.E_(t),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,t){const A=this.St();if(A.Ni()||t===0)return;const r=A.Hi();e=Math.max(1,Math.min(e,r)),A.Zu(e,t),this.Wu()}td(e){this.nd(0),this.sd(e),this.ed()}rd(e){this.yl.Jo(e),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(e){this.yl.t_(e)}sd(e){this.yl.i_(e),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(e,t,A,r,n){this.vt.gn(e,t);let s=NaN,o=this.yl.Nu(e);const l=this.yl.Xs();l!==null&&(o=Math.min(Math.max(l.Os(),o),l.ui()));const c=r.vn(),u=c.Ct();u!==null&&(s=c.pn(t,u)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const r=A.vn(),n=r.Ct(),s=r.Rt(e,Se(n)),o=this.yl.Va(t,!0),l=this.yl.It(Se(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),u=e!==null&&e>s&&!c,m=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,y=l&&(A!==void 0||m)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!y){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.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(e,t,A){const r=this.yc[0],n=this.fd(t,e,r,A);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),A=this.Cc.indexOf(e);ii(A!==-1,"Series not found"),this.Cc.splice(A,1),Se(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Se(this.dr(e));A.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();A.qo(e,t,n)}else{const n=r.Ht===A?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Kt.ss();e.$n(),this.Nc(e)}pd(e){const t=Kt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Kt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Kt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Kt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Kt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Kt.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,u,m]=sr(n),[y,v,T,C]=sr(s),U=[wA(l+o*(y-l)),wA(c+o*(v-c)),wA(u+o*(T-u)),Bl(m+o*(C-m))];return`rgba(${U[0]}, ${U[1]}, ${U[2]}, ${U[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new Kt(t);if(e!==null){const r=this.yc.indexOf(e);A.Nn(r,{Fn:t})}return A}Fc(e,t){return t===void 0&&(t=2),this.Gc(this.dr(e),t)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((t=>t.j_().qh().bt()))}fd(e,t,A,r){const n=new eo(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),on(s)||n.$h(e),n}Lc(e){const t=this.cn.layout;return t.background.type==="gradient"?e===0?t.background.topColor:t.background.bottomColor:t.background.color}}function ro(i){return!_A(i)&&!ar(i)}function ac(i){return _A(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(rc||(rc={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(nc||(nc={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(sc||(sc={})),(function(i){i[i.Year=0]="Year",i[i.Month=1]="Month",i[i.DayOfMonth=2]="DayOfMonth",i[i.Time=3]="Time",i[i.TimeWithSeconds=4]="TimeWithSeconds"})(oc||(oc={}));const lc=i=>i.getUTCFullYear();function w0(i,e,t){return e.replace(/yyyy/g,(A=>qA(lc(A),4))(i)).replace(/yy/g,(A=>qA(lc(A)%100,2))(i)).replace(/MMMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"long"}))(i,t)).replace(/MMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"short"}))(i,t)).replace(/MM/g,(A=>qA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>qA((r=>r.getUTCDate())(A),2))(i))}class cc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return w0(e,this.gd,this.Md)}}class B0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",qA(e.getUTCHours(),2)).replace("%m",qA(e.getUTCMinutes(),2)).replace("%s",qA(e.getUTCSeconds(),2))}}const y0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class C0{constructor(e={}){const t=Object.assign(Object.assign({},y0),e);this.Td=new cc(t.Sd,t.Cd),this.Pd=new B0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function fn(i){return 60*i*60*1e3}function no(i){return 60*i*1e3}const gn=[{Dd:(hc=1,1e3*hc),Vd:10},{Dd:no(1),Vd:20},{Dd:no(5),Vd:21},{Dd:no(30),Vd:22},{Dd:fn(1),Vd:30},{Dd:fn(3),Vd:31},{Dd:fn(6),Vd:32},{Dd:fn(12),Vd:33}];var hc;function uc(i,e){if(i.getUTCFullYear()!==e.getUTCFullYear())return 70;if(i.getUTCMonth()!==e.getUTCMonth())return 60;if(i.getUTCDate()!==e.getUTCDate())return 50;for(let t=gn.length-1;t>=0;--t)if(Math.floor(e.getTime()/gn[t].Dd)!==Math.floor(i.getTime()/gn[t].Dd))return gn[t].Vd;return 0}function so(i){let e=i;if(ar(i)&&(e=oo(i)),!ro(e))throw new Error("time must be of type BusinessDay");const t=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(t.getTime()/1e3),Bd:e}}function dc(i){if(!ac(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function oo(i){const e=new Date(i);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${i}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function pc(i){ar(i.time)&&(i.time=oo(i.time))}class fc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(pc)})(e):pc(e)}createConverterToInternalObj(e){return Se((function(t){return t.length===0?null:ro(t[0].time)||ar(t[0].time)?so:dc})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const t=e;return t.Bd===void 0?new Date(1e3*t.Od).getTime():new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day)).getTime()}convertHorzItemToInternal(e){return ac(t=e)?dc(t):ro(t)?so(t):so(oo(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new C0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new cc(t,e.locale)}formatHorzItem(e){const t=e;return this.Ad.Y_(new Date(1e3*t.Od))}formatTickmark(e,t){const A=(function(n,s,o){switch(n){case 0:case 10:return s?o?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return s?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(e.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),r=this.cn.timeScale;if(r.tickMarkFormatter!==void 0){const n=r.tickMarkFormatter(e.originalTime,A,t.locale);if(n!==null)return n}return(function(n,s,o){const l={};switch(s){case 0:l.year="numeric";break;case 1:l.month="short";break;case 2:l.day="numeric";break;case 3:l.hour12=!1,l.hour="2-digit",l.minute="2-digit";break;case 4:l.hour12=!1,l.hour="2-digit",l.minute="2-digit",l.second="2-digit"}const c=n.Bd===void 0?new Date(1e3*n.Od):new Date(Date.UTC(n.Bd.year,n.Bd.month-1,n.Bd.day));return new Date(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()).toLocaleString(o,l)})(e.time,A,t.locale)}maxTickMarkWeight(e){let t=e.reduce(h0,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(A,r=0){if(A.length===0)return;let n=r===0?null:A[r-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let l=r;l<A.length;++l){const c=A[l],u=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=uc(u,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=u}if(r===0&&A.length>1){const l=Math.ceil(o/(A.length-1)),c=new Date(1e3*(A[0].time.Od-l));A[0].timeWeight=uc(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return FA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const Ni=typeof window<"u";function gc(){return!!Ni&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ao(){return!!Ni&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function lo(i){return i+i%2}function co(i,e){return i.zd-e.zd}function ho(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class v0{constructor(e,t,A,r){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=e,this.Ud=t,this.qd=A,this.rs=r}Yd(e,t){if(this.Ld!==null){if(this.Ld.ot===t)return void(this.Ld.zd=e);if(Math.abs(this.Ld.zd-e)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:t,zd:e}}Vr(e,t){if(this.Ld===null||this.Ed===null||t-this.Ld.ot>50)return;let A=0;const r=ho(this.Ld,this.Ed,this.Ud),n=co(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=ho(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=co(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const m=ho(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const y=co(this.Nd,this.Fd);s.push(m),o.push(y),A+=y}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/A*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,u){const m=Math.log(u);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Se(this.Wd),A=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,A)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Se(this.Wd).ot;return Math.min(t,this.jd)}}class T0{constructor(e,t){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=e,this.Qd=t,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 yl(sr(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.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",this.Gd==="dark"),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function yi(i,e){const t=Se(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=Hp(t,{options:{allowResizeObserver:!1},transform:(r,n)=>({width:Math.max(r.width,n.width),height:Math.max(r.height,n.height)})});return A.resizeCanvasElement(e),A}function Ci(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function uo(i,e,t,A){i.gl&&i.gl(e,t,A)}function mn(i,e,t,A){i.X(e,t,A)}function po(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function x0(i){Ni&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class fo{constructor(e,t,A){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=!ao(),this.Af=r=>{this.If(r)},this.zf=r=>{if(this.Lf(r)){const n=this.Ef(r);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(PA(r),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(r);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(PA(r),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=t,this.cn=A,this.Xf()}S(){this.gf!==null&&(this.gf(),this.gf=null),this.Mf!==null&&(this.Mf(),this.Mf=null),this.Sf!==null&&(this.Sf(),this.Sf=null),this.kf!==null&&(this.kf(),this.kf=null),this.yf!==null&&(this.yf(),this.yf=null),this.xf!==null&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(e){this.Sf&&this.Sf();const t=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",t)},this.Zf.addEventListener("mousemove",t),this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.Qf),this.Bf=!0}Yf(){this.lf!==null&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){this.uf!==null&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(e){if(this.Df||this.pf!==null||this.Lf(e))return;const t=this.Ef(e);this.Uf(t,this.Hf.tv),this.Bf=!0}iv(e){const t=go(e.changedTouches,Se(this.Of));if(t===null||(this.Vf=wn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(PA(t),Se(this.pf)),{nv:r,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),Oi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(PA(e),Se(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:A,sv:r,Nf:A+r}}ov(e){let t=go(e.changedTouches,Se(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=wn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const A=this.Ef(e,t);if(this.Wf(A,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(PA(t),this.cf);r<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&Oi(e));this._f===0&&Oi(e),e.touches.length===0&&this.ff&&(this.ff=!1,Oi(e))}If(e){if(e.button!==0)return;const t=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),gc()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(t,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:A}=this.Ff(PA(e),this.af);A<5&&!this.bf&&this.Uf(t,this.Hf.qf),this.Yf()}else this.bf||this.Uf(t,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const t=e.changedTouches[0];this.Of=t.identifier,this.Vf=wn(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=PA(t),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{A.removeEventListener("touchmove",n),A.removeEventListener("touchend",s)},A.addEventListener("touchmove",n,{passive:!1}),A.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const r=this.Ef(e,t);this.Wf(r,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=PA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;gc()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=PA(e),this.kf&&(this.kf(),this.kf=null);{const r=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",r),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",r),t.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=PA(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,t=A=>{this.Hf.wv&&(A.composed&&this.Zf.contains(A.composedPath()[0])||A.target&&this.Zf.contains(A.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",t)},this.gf=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}ao()&&(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}),x0(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",(()=>{}),{passive:!1})}Mv(){this.Hf.xv===void 0&&this.Hf.Sv===void 0&&this.Hf.kv===void 0||(this.Zf.addEventListener("touchstart",(e=>this.yv(e.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(e=>{if(e.touches.length===2&&this.Cf!==null&&this.Hf.Sv!==void 0){const t=mc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Oi(e)}}),{passive:!1}),this.Zf.addEventListener("touchend",(e=>{this.yv(e.touches)})))}yv(e){e.length===1&&(this.Pf=!1),e.length!==2||this.Pf||this.ff?this.Cv():this.Tv(e)}Tv(e){const t=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,st:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this.Tf=mc(e[0],e[1]),this.Hf.xv!==void 0&&this.Hf.xv(),this.Kf()}Cv(){this.Cf!==null&&(this.Cf=null,this.Hf.kv!==void 0&&this.Hf.kv())}gv(e){if(this.Sf&&this.Sf(),this.Lf(e)||!this.Bf)return;const t=this.Ef(e);this.Uf(t,this.Hf.Pv),this.Bf=!ao()}vv(e){const t=go(e.touches,Se(this.Of));if(t===null)return;const A=this.Ef(e,t);this.Wf(A,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:wn(e)<this.Vf+500}Wf(e,t){t&&t.call(this.Hf,e)}Uf(e,t){t&&t.call(this.Hf,e)}Ef(e,t){const A=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:A.clientX,clientY:A.clientY,pageX:A.pageX,pageY:A.pageY,screenX:A.screenX,screenY:A.screenY,localX:A.clientX-r.left,localY:A.clientY-r.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Oi(e)}}}}function mc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Oi(i){i.cancelable&&i.preventDefault()}function PA(i){return{nt:i.pageX,st:i.pageY}}function wn(i){return i.timeStamp||performance.now()}function go(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function Bn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function b0(i,e,t){for(const A of i){const r=A.gt();if(r!==null&&r.wr){const n=r.wr(e,t);if(n!==null)return{Bv:A,Iv:n}}}return null}function mo(i,e){return t=>{var A,r,n,s;return((r=(A=t.Dt())===null||A===void 0?void 0:A.Pa())!==null&&r!==void 0?r:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,i))!==null&&s!==void 0?s:[]}}function wc(i,e,t,A){if(!i.length)return;let r=0;const n=t/2,s=i[0].At(A,!0);let o=e===1?n-(i[0].Vi()-s/2):i[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<i.length;l++){const c=i[l],u=i[l-1],m=u.At(A,!1),y=c.Vi(),v=u.Vi();if(e===1?y>v-m:y<v+m){const T=v-m*e;c.Oi(T);const C=T-e*m/2;if((e===1?C<0:C>t)&&o>0){const U=e===1?-1-C:C-t,F=Math.min(U,o);for(let E=r;E<i.length;E++)i[E].Oi(i[E].Vi()+e*F);o-=F}}else r=l,o=e===1?v-m-y:y-(v+m)}}class Bc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new hr(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=e,this.cn=t,this.ko=t.layout,this.Oc=A,this.qv=r==="left",this.Yv=mo("normal",r),this.Zv=mo("top",r),this.Xv=mo("bottom",r),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=yi(this.Kv,xt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const n=this.Gv.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Jv=yi(this.Kv,xt({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";const o={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 fo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose(),this.Li!==null&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const t=this.ap(),A=Se(this.Gv.canvasElement.getContext("2d"));A.save();const r=this.Li.Ha();A.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(A,r[0].so),this.Fv.xi(A,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const u=this.Fv.xi(A,n[c].Kt());u>e&&(e=u)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),u=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,u))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,u))-.11111111111111,s)))}var o;A.restore();const l=e||34;return lo(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&mi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return Se(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,Se(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}bt(){var e;(e=this.Li)===null||e===void 0||e.Ha()}Qv(e){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!0,t.V_(A,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp(),r=this.Li;t.O_(A,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),A=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,A))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!1,t.B_(A,this.Li)}sp(e){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(e){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(e){this.kp(0)}up(){const e=[],t=this.Li===null?void 0:this.Li;return(A=>{for(let r=0;r<A.length;++r){const n=A[r].Rn(this.tn.fp(),t);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,s):Tl(e,0,0,A,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(l)),u=Math.floor(.5*l),m=Math.round(r.T*o);s.beginPath();for(const y of t)s.rect(Math.floor(n*o),Math.round(y.Ea*l)-u,m,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-r.A):Math.round(n+r.T+r.A),c=t.map((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const m=t[u];s.fillText(m.so,l,m.Ea+c[u])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),r=this.ap();this.Li===A.pr()&&this.tn.fp().Uo().forEach((s=>{A.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(A,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,r)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,r=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));r.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),l=s.ki();l>-o&&l<o&&s.Oi(o),l>this.Ev.height-o&&l<this.Ev.height+o&&s.Oi(this.Ev.height-o)}wc(r,1,this.Ev.height,t),wc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Se(this.Li)).X(e,A,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((l=>{l.forEach((c=>{c.gt(Se(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return _i(this.ko.fontSize,this.ko.fontFamily)}}function Q0(i,e){var t,A;return(A=(t=i.ua)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function yn(i,e){var t,A;return(A=(t=i.Pn)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function F0(i,e){var t,A;return(A=(t=i.Ji)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function U0(i,e){var t,A;return(A=(t=i.aa)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}class wo{constructor(e,t){this.Ev=xt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Mt,this.Op=new Mt,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||this.Np===null||this.$i().Uh()},this.Uv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Qd=e,this.Np=t,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 A=document.createElement("div");A.style.width="100%",A.style.height="100%",A.style.position="relative",A.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(A),this.Gv=yi(A,xt({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=yi(A,xt({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const n=this.Jv.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.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 fo(this.Jv.canvasElement,this,{ev:()=>this.Ip===null&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>this.Ip===null&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.Cp!==null&&this.Cp.S(),this.Tp!==null&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Se(this.Np)}qp(e){var t,A;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(wo.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(t=this.Pp)!==null&&t!==void 0?t:new T0(this.Wp,this.Qd),this.Pp.bt()):((A=this.Pp)===null||A===void 0||A.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const e=this.Np.R_();this.Cp.Gi(Se(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Se(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const t=e.localX,A=e.localY;this.Gp(t,A,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const A=e.localX,r=e.localY;this.Gp(A,r,e);const n=this.wr(A,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const t={x:e.localX,y:e.localY};this.rm(t,t,e)}}Pv(e){this.Np!==null&&(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(e,t){if(!this.Qd.W().handleScale.pinch)return;const A=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,A)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,A=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Se(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,u,m){var y,v;let T,C;for(const E of c){const N=(v=(y=E.va)===null||y===void 0?void 0:y.call(E,u,m))!==null&&v!==void 0?v:[];for(const R of N)U=R.zOrder,(!(F=T?.zOrder)||U==="top"&&F!=="top"||U==="normal"&&F==="bottom")&&(T=R,C=E)}var U,F;return T&&C?{zv:T,Hc:C}:null})(o,n,s);if(l?.zv.zOrder==="top")return Bn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Bn(l);const u=b0(c.Pn(r),n,s);if(u!==null)return{Hc:c,Bv:u.Bv,Iv:u.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Bn(l)}return l?.zv?Bn(l):null})(A,e,t)}_m(e,t){Se(t==="left"?this.Cp:this.Tp).cp(xt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){mi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Wp.style.width=e.width+"px",this.Wp.style.height=e.height+"px")}dm(){const e=Se(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const A=t.Dt();A!==null&&e.P_(A),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,Q0),this.vm(A),this.pm(A),this.fm(A,yn),this.fm(A,F0)))}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,U0))}wm(){return this.Cp}gm(){return this.Tp}bp(e,t){this.fm(e,t)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,t){const A=t.localX,r=t.localY;e.M()&&e.m(this.$i().St().Nu(A),{x:A,y:r},t)}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,o):Tl(e,0,0,A,r,s,o)}vm(e){const t=Se(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,yn,uo,t),this.Mm(e,yn,mn,t)}bm(e){this.Mm(e,yn,mn,this.$i().Zc())}fm(e,t){const A=Se(this.Np).Uo();for(const r of A)this.Mm(e,t,uo,r);for(const r of A)this.Mm(e,t,mn,r)}Mm(e,t,A,r){const n=Se(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;po(t,(c=>A(c,e,o,l)),r,n)}Zp(){if(this.Np===null)return;const e=this.Qd,t=this.Np.R_().W().visible,A=this.Np.D_().W().visible;t||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),A||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const r=e.$t().ud();t&&this.Cp===null&&(this.Cp=new Bc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new Bc(this,e.W(),r,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,Se(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,A){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,A);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),A=this.fp();if(t.z_(A,A.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Se(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const t=this.$i(),A=t.St();if(A.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),l=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:l,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new v0(.2/c,7/c,.997,15/c),this.Ep.Yd(A.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||t.A_(this.Np,o,e.localY),t.nd(e.localX),this.Dp=!0}this.Dp&&(o.Ni()||t.I_(this.Np,o,e.localY),t.sd(e.localX),this.Ep!==null&&this.Ep.Yd(A.Hu(),l))}}class yc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=xt({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=A.ud,this.cn=t,this.Tm=r,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=yi(this.Kv,xt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){mi(this.Ev,e)||(this.Ev=e,this.Gv.resizeCanvasElement(e),this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.ft=!0)}vp(e){if(e<3&&!this.ft||this.Ev.width===0||this.Ev.height===0)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const t=wi(this.Gv);t!==null&&t.useBitmapCoordinateSpace((A=>{this.mp(A),this.Ie(A)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*A),s=Math.floor(this.Oc.W().C*r),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Pm())}}function Bo(i){return e=>{var t,A;return(A=(t=e.fa)===null||t===void 0?void 0:t.call(e,i))!==null&&A!==void 0?A:[]}}const S0=Bo("normal"),E0=Bo("top"),L0=Bo("bottom");class M0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=xt({width:0,height:0}),this.Om=new Mt,this.Fv=new hr(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=e,this.q_=t,this.cn=e.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=yi(this.Im,xt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const A=this.Gv.canvasElement;A.style.position="absolute",A.style.zIndex="1",A.style.left="0",A.style.top="0",this.Jv=yi(this.Im,xt({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.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 fo(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),this.Rm!==null&&this.Rm.S(),this.Dm!==null&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(e){if(this.Vm)return;this.Vm=!0;const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.Jc(e.localX)}pv(e){this.bv(e)}wv(){const e=this.Qd.$t();!e.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&e.hd())}av(e){const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.rd(e.localX)}hv(e){this.av(e)}cv(){this.Vm=!1;const e=this.Qd.$t();e.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||e.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(e,t,A){mi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.Om.m(e)),this.Rm!==null&&this.Rm.cp(xt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(xt({width:A,height:e.height}))}Wm(){const e=this.jm();return Math.ceil(e.C+e.T+e.P+e.L+e.B+e.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,L0)})),this.wp(A),this.$m(A,S0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,E0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)po(t,(n=>uo(n,e,!1,void 0)),r,void 0);for(const r of A)po(t,(n=>mn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const u=Math.max(1,Math.floor(l)),m=Math.floor(.5*l);o.beginPath();const y=Math.round(n.T*c);for(let v=A.length;v--;){const T=Math.round(A[v].coord*l);o.rect(T-m,0,u,y)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const l=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}}))}Ym(e,t,A){const r=this.Fv.xi(e,A),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const A=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return _i(this.j(),this.cn.fontFamily)}Zm(){return _i(this.j(),this.cn.fontFamily,"bold")}jm(){this.k===null&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new hr,Hm:0});const e=this.k,t=this._p();if(e.R!==t){const A=this.j();e.P=A,e.R=t,e.L=3*A/12,e.B=3*A/12,e.ji=9*A/12,e.N=0,e.Hm=4*A/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),t=e.W();t.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),t.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const A={ud:this.Qd.$t().ud()},r=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new yc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new yc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const H0=!!Ni&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!Ni&&(!((yo=navigator?.userAgentData)===null||yo===void 0)&&yo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var yo;class I0{constructor(e,t,A){var r;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 Mt,this.Op=new Mt,this.Rc=new Mt,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=A,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%",(r=this.Xd).style.userSelect="none",r.style.webkitUserSelect="none",r.style.msUserSelect="none",r.style.MozUserSelect="none",r.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Co(this.cn)&&this.hb(!0),this.$i=new m0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new M0(this,this.q_),this.sb.appendChild(this.ab.lp());const n=t.autoSize&&this.ob();let s=this.cn.width,o=this.cn.height;if(n||s===0||o===0){const l=e.getBoundingClientRect();s=s||l.width,o=o||l.height}this._b(s,o),this.ub(),e.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),this.Km!==0&&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 e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],Se(this.ab).S(),this.Xd.parentElement!==null&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(e,t,A=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return xt({width:l-l%2,height:c-c%2})})(xt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Se(this.Xd).style.height=n,Se(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Kt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Kt.es());for(let t=0;t<this.Xm.length;t++)this.Xm[t].vp(e.Hn(t).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const t=Co(this.cn);this.$i.$h(e);const A=Co(this.cn);A!==t&&this.hb(A),this.cb(),this.bb(e)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){this.Qm!==null&&(this.mb(this.Qm,performance.now()),this.Qm=null);const e=this.gb(null),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const A=Se(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Se(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return jt(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let u=0;u<this.Xm.length;u++){const m=this.Xm[u],y=Se(o==="left"?m.wm():m.gm()),v=y.xp();e!==null&&y.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Se(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,A),A+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Se(r.gm()).xp().width);const s=(o,l,c)=>{Se(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Se(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,A),l=Se(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return xt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const T of this.Xm)this.xb()&&(t=Math.max(t,Se(T.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Se(T.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=T.M_();t=lo(t),A=lo(A);const r=this.__,n=this.ho,s=Math.max(r-t-A,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const u=0+l,m=n<u?0:n-u,y=m/e;let v=0;for(let T=0;T<this.Xm.length;++T){const C=this.Xm[T];C.qp(this.$i.qc()[T]);let U=0,F=0;F=T===this.Xm.length-1?m-v:Math.round(C.M_()*y),U=Math.max(F,2),v+=U,C.cp(xt({width:s,height:U})),this.xb()&&C._m(t,"left"),this.Sb()&&C._m(A,"right"),C.fp()&&this.$i.Kc(C.fp(),U)}this.ab.Fm(xt({width:o?s:0,height:l}),o?t:0,o?A:0),this.$i.S_(s),this.Gm!==t&&(this.Gm=t),this.Jm!==A&&(this.Jm=A)}hb(e){e?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return H0?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const t=this.Rb(e),A=t*e.deltaX/100,r=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),r!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(r)*Math.min(1,Math.abs(r)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}A!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*A)}mb(e,t){var A;const r=e.jn();r===3&&this.Db(),r!==3&&r!==2||(this.Vb(e),this.Ob(e,t),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((A=this.Qm)===null||A===void 0?void 0:A.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,t),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,t){for(const A of e.Qn())this.ns(A,t)}Vb(e){const t=this.$i.qc();for(let A=0;A<t.length;A++)e.Hn(A).Wn&&t[A].N_()}ns(e,t){const A=this.$i.St();switch(e.qn){case 0:A.hc();break;case 1:A.lc(e.Vt);break;case 2:A.Gn(e.Vt);break;case 3:A.Jn(e.Vt);break;case 4:A.qu();break;case 5:e.Vt.Qu(t)||A.Jn(e.Vt.tc(t))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((t=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const A=this.Qm;this.Qm=null,this.mb(A,t);for(const r of A.Qn())if(r.qn===5&&!r.Vt.Qu(t)){this.$t().Zn(r.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,A=this.Xm.length;for(let r=t;r<A;r++){const n=jt(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=A;r<t;r++){const n=new wo(this,e[r]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var r;const n=new Map;e!==null&&this.$i.wt().forEach((u=>{const m=u.In().ll(e);m!==null&&n.set(u,m)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof eo?o.Hc:void 0,c=o!==null&&o.Iv!==void 0?o.Iv.gr:void 0;return{zb:s,ee:e??void 0,Lb:t??void 0,Eb:l,Nb:n,Fb:c,Wb:A??void 0}}Bb(e,t,A){this.Vp.m((()=>this.Ib(e,t,A)))}Ab(e,t,A){this.Op.m((()=>this.Ib(e,t,A)))}lb(e,t,A){this.Rc.m((()=>this.Ib(e,t,A)))}cb(){const e=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=e}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((e=>{const t=e.find((A=>A.target===this.Jd));t&&this._b(t.contentRect.width,t.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function Co(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function D0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function Cc(i,e){var t={};for(var A in i)Object.prototype.hasOwnProperty.call(i,A)&&e.indexOf(A)<0&&(t[A]=i[A]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(A=Object.getOwnPropertySymbols(i);r<A.length;r++)e.indexOf(A[r])<0&&Object.prototype.propertyIsEnumerable.call(i,A[r])&&(t[A[r]]=i[A[r]])}return t}function vc(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.color!==void 0&&(n.V=t.color),n}function _0(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.lineColor!==void 0&&(n.lt=t.lineColor),t.topColor!==void 0&&(n.Ps=t.topColor),t.bottomColor!==void 0&&(n.Rs=t.bottomColor),n}function P0(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.topLineColor!==void 0&&(n.Re=t.topLineColor),t.bottomLineColor!==void 0&&(n.De=t.bottomLineColor),t.topFillColor1!==void 0&&(n.ke=t.topFillColor1),t.topFillColor2!==void 0&&(n.ye=t.topFillColor2),t.bottomFillColor1!==void 0&&(n.Ce=t.bottomFillColor1),t.bottomFillColor2!==void 0&&(n.Te=t.bottomFillColor2),n}function k0(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),r}function N0(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function O0(i,e,t,A,r){const n=jt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:m,color:y}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:Cc(u,["time","color"]),V:y}}function Cn(i){return i.Vt!==void 0}function Tc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function vi(i){return(e,t,A,r,n,s)=>(function(o,l){return l?l(o):(c=o).open===void 0&&c.value===void 0;var c})(A,s)?Tc({ot:e,ee:t,zb:r},A):Tc(i(e,t,A,r,n),A)}function xc(i){return{Candlestick:vi(N0),Bar:vi(k0),Area:vi(_0),Baseline:vi(P0),Histogram:vi(vc),Line:vi(vc),Custom:vi(O0)}[i]}function bc(i){return{ee:0,Hb:new Map,la:i}}function Qc(i,e){if(i!==void 0&&i.length!==0)return{$b:e.key(i[0].ot),Ub:e.key(i[i.length-1].ot)}}function Fc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),jt(e)}class K0{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,t){let A=this.qb.size!==0,r=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)A=!1,r=!0,this.qb.clear();else for(const l of this.Xb)l.pointData.Hb.delete(e)&&(r=!0);let s=[];if(t.length!==0){const l=t.map((v=>v.time)),c=this.q_.createConverterToInternalObj(t),u=xc(e.Qh()),m=e.Ca(),y=e.Ta();s=t.map(((v,T)=>{const C=c(v.time),U=this.q_.key(C);let F=this.qb.get(U);F===void 0&&(F=bc(C),this.qb.set(U,F),r=!0);const E=u(C,F.ee,v,l[T],m,y);return F.Hb.set(e,E),E}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:Fc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const m=Qc(l,u),y=Qc(c,u);if(m!==void 0&&y!==void 0)return{ta:m.Ub>=y.Ub&&m.$b>=y.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(C){C.zb===void 0&&(C.zb=C.time)})(A),this.q_.preprocessData(t);const r=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(r)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${r}`);let s=this.qb.get(this.q_.key(r));const o=s===void 0;s===void 0&&(s=bc(r),this.qb.set(this.q_.key(r),s));const l=xc(e.Qh()),c=e.Ca(),u=e.Ta(),m=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,m),this.nw(e,m);const y={ta:Cn(m)};if(!o)return this.tw(e,-1,y);const v={timeWeight:0,time:s.la,pointData:s,originalTime:Fc(s.Hb)},T=cr(this.Xb,this.q_.key(v.time),((C,U)=>this.q_.key(C.time)<U));this.Xb.splice(T,0,v);for(let C=T;C<this.Xb.length;++C)vo(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,T),this.tw(e,T,y)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const r=A.length!==0?A[A.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?Cn(t)&&A.push(t):Cn(t)?A[A.length-1]=t:A.splice(-1,1),this.Zb.set(e,t.ot)}Jb(e,t){t.length!==0?(this.Yb.set(e,t.filter(Cn)),this.Zb.set(e,t[t.length-1].ot)):(this.Yb.delete(e),this.Zb.delete(e))}Gb(){for(const e of this.Xb)e.pointData.Hb.size===0&&this.qb.delete(this.q_.key(e.time))}Qb(e){let t=-1;for(let A=0;A<this.Xb.length&&A<e.length;++A){const r=this.Xb[A],n=e[A];if(this.q_.key(r.time)!==this.q_.key(n.time)){t=A;break}n.timeWeight=r.timeWeight,vo(n.pointData,A)}if(t===-1&&this.Xb.length!==e.length&&(t=Math.min(this.Xb.length,e.length)),t===-1)return-1;for(let A=t;A<e.length;++A)vo(e[A].pointData,A);return this.q_.fillWeightsForPoints(e,t),this.Xb=e,t}sw(){if(this.Yb.size===0)return null;let e=0;return this.Yb.forEach((t=>{t.length!==0&&(e=Math.max(e,t[t.length-1].ee))})),e}tw(e,t,A){const r={ew:new Map,St:{Eu:this.sw()}};if(t!==-1)this.Yb.forEach(((n,s)=>{r.ew.set(s,{$e:n,rw:s===e?A:void 0})})),this.Yb.has(e)||r.ew.set(e,{$e:[],rw:A}),r.St.hw=this.Xb,r.St.lw=t;else{const n=this.Yb.get(e);r.ew.set(e,{$e:n||[],rw:A})}return r}}function vo(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function To(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function Uc(i){const e=To(i);return i.V!==void 0&&(e.color=i.V),e}function V0(i){const e=To(i);return i.lt!==void 0&&(e.lineColor=i.lt),i.Ps!==void 0&&(e.topColor=i.Ps),i.Rs!==void 0&&(e.bottomColor=i.Rs),e}function z0(i){const e=To(i);return i.Re!==void 0&&(e.topLineColor=i.Re),i.De!==void 0&&(e.bottomLineColor=i.De),i.ke!==void 0&&(e.topFillColor1=i.ke),i.ye!==void 0&&(e.topFillColor2=i.ye),i.Ce!==void 0&&(e.bottomFillColor1=i.Ce),i.Te!==void 0&&(e.bottomFillColor2=i.Te),e}function Sc(i){const e={open:i.Vt[0],high:i.Vt[1],low:i.Vt[2],close:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function W0(i){const e=Sc(i);return i.V!==void 0&&(e.color=i.V),e}function R0(i){const e=Sc(i),{V:t,Ot:A,Xh:r}=i;return t!==void 0&&(e.color=t),A!==void 0&&(e.borderColor=A),r!==void 0&&(e.wickColor=r),e}function xo(i){return{Area:V0,Line:Uc,Baseline:z0,Histogram:Uc,Bar:W0,Candlestick:R0,Custom:G0}[i]}function G0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const $0={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},X0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},J0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Vs,attributionLogo:!0},bo={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},Z0={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},Y0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Vs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Ec(){return{width:0,height:0,autoSize:!1,layout:J0,crosshair:$0,grid:X0,overlayPriceScales:Object.assign({},bo),leftPriceScale:Object.assign(Object.assign({},bo),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},bo),{visible:!0}),timeScale:Z0,watermark:Y0,localization:{locale:Ni?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 q0{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return on(this.ow)?this.aw.Mb(this.ow):0}Li(){return Se(this.aw.$t().Uc(this.ow)).Dt}}function Lc(i,e,t){const A=Cc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const j0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class e1{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class t1{constructor(e,t,A,r,n){this.uw=new Mt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=r}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().Rt(e,t.Vt)}coordinateToPrice(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().pn(e,t.Vt)}barsInLogicalRange(e){if(e===null)return null;const t=new ki(new mr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const r=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=Se(A.el()),o=Se(A.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.zb,l.to=n.zb),l}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:xo(this.seriesType())(A)}data(){const e=xo(this.seriesType());return this.Es.In().ne().map((t=>e(t)))}subscribeDataChanged(e){this.uw.l(e)}unsubscribeDataChanged(e){this.uw.v(e)}setMarkers(e){this.q_;const t=e.map((A=>Lc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Lc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return YA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=FA(YA(j0),e),A=this.Es.ea(t);return new e1(A)}removePriceLine(e){this.Es.ra(e._w())}seriesType(){return this.Es.Qh()}attachPrimitive(e){this.Es.ka(e),e.attached&&e.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(e){this.Es.ya(e),e.detached&&e.detached()}mw(e){this.uw.M()&&this.uw.m(e)}}class A1{constructor(e,t,A){this.ww=new Mt,this.mu=new Mt,this.Om=new Mt,this.$i=e,this.yl=e.St(),this.ab=t,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_=A}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(e,t){t?this.yl.Ju(e,1e3):this.$i.Jn(e)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const e=this.yl.Vu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const t={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},A=this.yl.Iu(t);this.$i.pd(A)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ii(e.from<=e.to,"The from index cannot be after the to index."),this.$i.pd(e)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(e){const t=this.$i.St();return t.Ni()?null:t.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const t=this.q_.convertHorzItemToInternal(e),A=this.yl.Va(t,!1);return A===null?null:this.yl.It(A)}coordinateToTime(e){const t=this.$i.St(),A=t.Nu(e),r=t.Ui(A);return r===null?null:r.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},YA(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(e){this.Om.m(e.width,e.height)}}function i1(i){if(i===void 0||i.type==="custom")return;const e=i;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(t){if(t>=1)return 0;let A=0;for(;A<8;A++){const r=Math.round(t);if(Math.abs(r-t)<1e-8)return A;t*=10}return A})(e.minMove))}function Mc(i){return(function(e){if(rn(e.handleScale)){const A=e.handleScale;e.handleScale={axisDoubleClickReset:{time:A,price:A},axisPressedMouseMove:{time:A,price:A},mouseWheel:A,pinch:A}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:A,axisDoubleClickReset:r}=e.handleScale;rn(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),rn(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;rn(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class r1{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Mt,this.Cw=new Mt,this.Tw=new Mt,this.Pw=new K0(t);const r=A===void 0?YA(Ec()):FA(YA(Ec()),Mc(A));this.q_=t,this.aw=new I0(e,r,t),this.aw.lm().l((s=>{this.yw.M()&&this.yw.m(this.Rw(s()))}),this),this.aw.am().l((s=>{this.Cw.M()&&this.Cw.m(this.Rw(s()))}),this),this.aw.Xc().l((s=>{this.Tw.M()&&this.Tw.m(this.Rw(s()))}),this);const n=this.aw.$t();this.Dw=new A1(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(e,t,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=Di(e),r=Object.assign(Object.assign({},dl),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Op,e)}addBaselineSeries(e){return this.Vw("Baseline",Kp,e)}addBarSeries(e){return this.Vw("Bar",kp,e)}addCandlestickSeries(e={}){return(function(t){t.borderColor!==void 0&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),t.wickColor!==void 0&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)})(e),this.Vw("Candlestick",Pp,e)}addHistogramSeries(e){return this.Vw("Histogram",Vp,e)}addLineSeries(e){return this.Vw("Line",Np,e)}removeSeries(e){const t=jt(this.Sw.get(e)),A=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(A),this.Sw.delete(e),this.kw.delete(t)}pw(e,t){this.Ow(this.Pw.Kb(e,t))}bw(e,t){this.Ow(this.Pw.iw(e,t))}subscribeClick(e){this.yw.l(e)}unsubscribeClick(e){this.yw.v(e)}subscribeCrosshairMove(e){this.Tw.l(e)}unsubscribeCrosshairMove(e){this.Tw.v(e)}subscribeDblClick(e){this.Cw.l(e)}unsubscribeDblClick(e){this.Cw.v(e)}priceScale(e){return new q0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Mc(e))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const e=this.aw.Tb();return{height:e.height,width:e.width}}setCrosshairPosition(e,t,A){const r=this.Sw.get(A);if(r===void 0)return;const n=this.aw.$t().dr(r);n!==null&&this.aw.$t().ad(e,t,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,t,A={},r){i1(A.priceFormat);const n=FA(YA(pl),YA(t),A),s=this.aw.$t().dd(e,n,r),o=new t1(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((A,r)=>r.J(A.$e,A.rw))),t.Wu()}Bw(e){return jt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=xo(s)(r);if(s!=="Custom")ii(D0(o));else{const l=n.Ta();ii(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const A=e.Eb!==void 0&&this.kw.has(e.Eb)?this.Bw(e.Eb):void 0;return{time:e.zb,logical:e.ee,point:e.Lb,hoveredSeries:A,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function n1(i,e,t){let A;if(ar(i)){const n=document.getElementById(i);ii(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new r1(A,e,t);return e.setOptions(r.options()),r}function s1(i,e){return n1(i,new fc,fc.Id(e))}Object.assign(Object.assign({},pl),dl);function Hc(i,e){return function(){return i.apply(e,arguments)}}const{toString:o1}=Object.prototype,{getPrototypeOf:Qo}=Object,{iterator:vn,toStringTag:Ic}=Symbol,Tn=(i=>e=>{const t=o1.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),SA=i=>(i=i.toLowerCase(),e=>Tn(e)===i),xn=i=>e=>typeof e===i,{isArray:Ki}=Array,Vi=xn("undefined");function wr(i){return i!==null&&!Vi(i)&&i.constructor!==null&&!Vi(i.constructor)&&nA(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Dc=SA("ArrayBuffer");function a1(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Dc(i.buffer),e}const l1=xn("string"),nA=xn("function"),_c=xn("number"),Br=i=>i!==null&&typeof i=="object",c1=i=>i===!0||i===!1,bn=i=>{if(Tn(i)!=="object")return!1;const e=Qo(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ic in i)&&!(vn in i)},h1=i=>{if(!Br(i)||wr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},u1=SA("Date"),d1=SA("File"),p1=SA("Blob"),f1=SA("FileList"),g1=i=>Br(i)&&nA(i.pipe),m1=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||nA(i.append)&&((e=Tn(i))==="formdata"||e==="object"&&nA(i.toString)&&i.toString()==="[object FormData]"))},w1=SA("URLSearchParams"),[B1,y1,C1,v1]=["ReadableStream","Request","Response","Headers"].map(SA),T1=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Ki(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(wr(i))return;const n=t?Object.getOwnPropertyNames(i):Object.keys(i),s=n.length;let o;for(A=0;A<s;A++)o=n[A],e.call(null,i[o],o,i)}}function Pc(i,e){if(wr(i))return null;e=e.toLowerCase();const t=Object.keys(i);let A=t.length,r;for(;A-- >0;)if(r=t[A],e===r.toLowerCase())return r;return null}const Ti=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,kc=i=>!Vi(i)&&i!==Ti;function Fo(){const{caseless:i,skipUndefined:e}=kc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&Pc(t,n)||n;bn(t[s])&&bn(r)?t[s]=Fo(t[s],r):bn(r)?t[s]=Fo({},r):Ki(r)?t[s]=r.slice():(!e||!Vi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&yr(arguments[r],A);return t}const x1=(i,e,t,{allOwnKeys:A}={})=>(yr(e,(r,n)=>{t&&nA(r)?Object.defineProperty(i,n,{value:Hc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),b1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Q1=(i,e,t,A)=>{i.prototype=Object.create(e.prototype,A),Object.defineProperty(i.prototype,"constructor",{value:i,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},F1=(i,e,t,A)=>{let r,n,s;const o={};if(e=e||{},i==null)return e;do{for(r=Object.getOwnPropertyNames(i),n=r.length;n-- >0;)s=r[n],(!A||A(s,i,e))&&!o[s]&&(e[s]=i[s],o[s]=!0);i=t!==!1&&Qo(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},U1=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const A=i.indexOf(e,t);return A!==-1&&A===t},S1=i=>{if(!i)return null;if(Ki(i))return i;let e=i.length;if(!_c(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},E1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Qo(Uint8Array)),L1=(i,e)=>{const A=(i&&i[vn]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},M1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},H1=SA("HTMLFormElement"),I1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Nc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),D1=SA("RegExp"),Oc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};yr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},_1=i=>{Oc(i,(e,t)=>{if(nA(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(nA(A)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},P1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Ki(i)?A(i):A(String(i).split(e)),t},k1=()=>{},N1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function O1(i){return!!(i&&nA(i.append)&&i[Ic]==="FormData"&&i[vn])}const K1=i=>{const e=new Array(10),t=(A,r)=>{if(Br(A)){if(e.indexOf(A)>=0)return;if(wr(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Ki(A)?[]:{};return yr(A,(s,o)=>{const l=t(s,r+1);!Vi(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},V1=SA("AsyncFunction"),z1=i=>i&&(Br(i)||nA(i))&&nA(i.then)&&nA(i.catch),Kc=((i,e)=>i?setImmediate:e?((t,A)=>(Ti.addEventListener("message",({source:r,data:n})=>{r===Ti&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),Ti.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",nA(Ti.postMessage)),W1=typeof queueMicrotask<"u"?queueMicrotask.bind(Ti):typeof process<"u"&&process.nextTick||Kc,fe={isArray:Ki,isArrayBuffer:Dc,isBuffer:wr,isFormData:m1,isArrayBufferView:a1,isString:l1,isNumber:_c,isBoolean:c1,isObject:Br,isPlainObject:bn,isEmptyObject:h1,isReadableStream:B1,isRequest:y1,isResponse:C1,isHeaders:v1,isUndefined:Vi,isDate:u1,isFile:d1,isBlob:p1,isRegExp:D1,isFunction:nA,isStream:g1,isURLSearchParams:w1,isTypedArray:E1,isFileList:f1,forEach:yr,merge:Fo,extend:x1,trim:T1,stripBOM:b1,inherits:Q1,toFlatObject:F1,kindOf:Tn,kindOfTest:SA,endsWith:U1,toArray:S1,forEachEntry:L1,matchAll:M1,isHTMLForm:H1,hasOwnProperty:Nc,hasOwnProp:Nc,reduceDescriptors:Oc,freezeMethods:_1,toObjectSet:P1,toCamelCase:I1,noop:k1,toFiniteNumber:N1,findKey:Pc,global:Ti,isContextDefined:kc,isSpecCompliantForm:O1,toJSONObject:K1,isAsyncFn:V1,isThenable:z1,setImmediate:Kc,asap:W1,isIterable:i=>i!=null&&nA(i[vn])};let Ge=class vp extends Error{static from(e,t,A,r,n,s){const o=new vp(e.message,t||e.code,A,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),r&&(this.request=r),n&&(this.response=n,this.status=n.status)}toJSON(){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:fe.toJSONObject(this.config),code:this.code,status:this.status}}};Ge.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ge.ERR_BAD_OPTION="ERR_BAD_OPTION",Ge.ECONNABORTED="ECONNABORTED",Ge.ETIMEDOUT="ETIMEDOUT",Ge.ERR_NETWORK="ERR_NETWORK",Ge.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ge.ERR_DEPRECATED="ERR_DEPRECATED",Ge.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ge.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ge.ERR_CANCELED="ERR_CANCELED",Ge.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ge.ERR_INVALID_URL="ERR_INVALID_URL";const R1=null;function Uo(i){return fe.isPlainObject(i)||fe.isArray(i)}function Vc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function zc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Vc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function G1(i){return fe.isArray(i)&&!i.some(Uo)}const $1=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function Qn(i,e,t){if(!fe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=fe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!fe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(r))throw new TypeError("visitor must be a function");function c(T){if(T===null)return"";if(fe.isDate(T))return T.toISOString();if(fe.isBoolean(T))return T.toString();if(!l&&fe.isBlob(T))throw new Ge("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(T)||fe.isTypedArray(T)?l&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function u(T,C,U){let F=T;if(T&&!U&&typeof T=="object"){if(fe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),T=JSON.stringify(T);else if(fe.isArray(T)&&G1(T)||(fe.isFileList(T)||fe.endsWith(C,"[]"))&&(F=fe.toArray(T)))return C=Vc(C),F.forEach(function(N,R){!(fe.isUndefined(N)||N===null)&&e.append(s===!0?zc([C],R,n):s===null?C:C+"[]",c(N))}),!1}return Uo(T)?!0:(e.append(zc(U,C,n),c(T)),!1)}const m=[],y=Object.assign($1,{defaultVisitor:u,convertValue:c,isVisitable:Uo});function v(T,C){if(!fe.isUndefined(T)){if(m.indexOf(T)!==-1)throw Error("Circular reference detected in "+C.join("."));m.push(T),fe.forEach(T,function(F,E){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(E)?E.trim():E,C,y))===!0&&v(F,C?C.concat(E):[E])}),m.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Wc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function So(i,e){this._pairs=[],i&&Qn(i,this,e)}const Rc=So.prototype;Rc.append=function(e,t){this._pairs.push([e,t])},Rc.toString=function(e){const t=e?function(A){return e.call(this,A,Wc)}:Wc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function X1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Gc(i,e,t){if(!e)return i;const A=t&&t.encode||X1,r=fe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=fe.isURLSearchParams(e)?e.toString():new So(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class $c{constructor(){this.handlers=[]}use(e,t,A){return this.handlers.push({fulfilled:e,rejected:t,synchronous:A?A.synchronous:!1,runWhen:A?A.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){fe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const Eo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},J1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:So,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Lo=typeof window<"u"&&typeof document<"u",Mo=typeof navigator=="object"&&navigator||void 0,Z1=Lo&&(!Mo||["ReactNative","NativeScript","NS"].indexOf(Mo.product)<0),Y1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",q1=Lo&&window.location.href||"http://localhost",Xt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Lo,hasStandardBrowserEnv:Z1,hasStandardBrowserWebWorkerEnv:Y1,navigator:Mo,origin:q1},Symbol.toStringTag,{value:"Module"})),...J1};function j1(i,e){return Qn(i,new Xt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Xt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function eg(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function tg(i){const e={},t=Object.keys(i);let A;const r=t.length;let n;for(A=0;A<r;A++)n=t[A],e[n]=i[n];return e}function Xc(i){function e(t,A,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&fe.isArray(r)?r.length:s,l?(fe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!fe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&fe.isArray(r[s])&&(r[s]=tg(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(eg(A),r,t,0)}),t}return null}function Ag(i,e,t){if(fe.isString(i))try{return(e||JSON.parse)(i),fe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const Cr={transitional:Eo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=fe.isObject(e);if(n&&fe.isHTMLForm(e)&&(e=new FormData(e)),fe.isFormData(e))return r?JSON.stringify(Xc(e)):e;if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)||fe.isReadableStream(e))return e;if(fe.isArrayBufferView(e))return e.buffer;if(fe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(A.indexOf("application/x-www-form-urlencoded")>-1)return j1(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Qn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),Ag(e)):e}],transformResponse:[function(e){const t=this.transitional||Cr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(fe.isResponse(e)||fe.isReadableStream(e))return e;if(e&&fe.isString(e)&&(A&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Ge.from(o,Ge.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xt.classes.FormData,Blob:Xt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],i=>{Cr.headers[i]={}});const ig=fe.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"]),rg=i=>{const e={};let t,A,r;return i&&i.split(`
|
|
2
|
-
`).forEach(function(s){r=s.indexOf(":"),t=s.substring(0,r).trim().toLowerCase(),A=s.substring(r+1).trim(),!(!t||e[t]&&
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[Jc]=this[Jc]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=vr(s);A[o]||(ag(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};sA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(sA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(sA);function Io(i,e){const t=this||Cr,A=e||t,r=sA.from(A.headers);let n=A.data;return fe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function Zc(i){return!!(i&&i.__CANCEL__)}let Tr=class extends Ge{constructor(e,t,A){super(e??"canceled",Ge.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function Yc(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Ge("Request failed with status code "+t.status,[Ge.ERR_BAD_REQUEST,Ge.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function lg(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function cg(i,e){i=i||10;const t=new Array(i),A=new Array(i);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let m=n,y=0;for(;m!==r;)y+=t[m++],m=m%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(y*1e3/v):void 0}}function hg(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),m=u-t;m>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-m)))},()=>r&&s(r)]}const Un=(i,e,t=3)=>{let A=0;const r=cg(50,250);return hg(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(m)},t)},qc=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},jc=i=>(...e)=>fe.asap(()=>i(...e)),ug=Xt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Xt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,dg=Xt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];fe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),fe.isString(A)&&o.push(`path=${A}`),fe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),fe.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function pg(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function fg(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function eh(i,e,t){let A=!pg(e);return i&&(A||t==!1)?fg(i,e):e}const th=i=>i instanceof sA?{...i}:i;function xi(i,e){e=e||{};const t={};function A(c,u,m,y){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:y},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,m,y){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,m,y)}else return A(c,u,m,y)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,m){if(m in e)return A(c,u);if(m in i)return A(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,u,m)=>r(th(c),th(u),m,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=fe.hasOwnProp(l,u)?l[u]:r,y=m(i[u],e[u],u);fe.isUndefined(y)&&m!==o||(t[u]=y)}),t}const Ah=i=>{const e=xi({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=sA.from(s),e.url=Gc(eh(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),fe.isFormData(t)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,m])=>{c.includes(u.toLowerCase())&&s.set(u,m)})}}if(Xt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&ug(e.url))){const l=r&&n&&dg.read(n);l&&s.set(r,l)}return e},gg=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=Ah(i);let n=r.data;const s=sA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,m,y,v,T;function C(){v&&v(),T&&T(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function F(){if(!U)return;const N=sA.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),M={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:N,config:i,request:U};Yc(function(ne){t(ne),C()},function(ne){A(ne),C()},M),U=null}"onloadend"in U?U.onloadend=F:U.onreadystatechange=function(){!U||U.readyState!==4||U.status===0&&!(U.responseURL&&U.responseURL.indexOf("file:")===0)||setTimeout(F)},U.onabort=function(){U&&(A(new Ge("Request aborted",Ge.ECONNABORTED,i,U)),U=null)},U.onerror=function(R){const M=R&&R.message?R.message:"Network Error",z=new Ge(M,Ge.ERR_NETWORK,i,U);z.event=R||null,A(z),U=null},U.ontimeout=function(){let R=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||Eo;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Ge(R,M.clarifyTimeoutError?Ge.ETIMEDOUT:Ge.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&fe.forEach(s.toJSON(),function(R,M){U.setRequestHeader(M,R)}),fe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([y,T]=Un(c,!0),U.addEventListener("progress",y)),l&&U.upload&&([m,v]=Un(l),U.upload.addEventListener("progress",m),U.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=N=>{U&&(A(!N||N.type?new Tr(null,i,U):N),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const E=lg(r.url);if(E&&Xt.protocols.indexOf(E)===-1){A(new Ge("Unsupported protocol "+E+":",Ge.ERR_BAD_REQUEST,i));return}U.send(n||null)})},mg=(i,e)=>{const{length:t}=i=i?i.filter(Boolean):[];if(e||t){let A=new AbortController,r;const n=function(c){if(!r){r=!0,o();const u=c instanceof Error?c:this.reason;A.abort(u instanceof Ge?u:new Tr(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Ge(`timeout of ${e}ms exceeded`,Ge.ETIMEDOUT))},e);const o=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),i=null)};i.forEach(c=>c.addEventListener("abort",n));const{signal:l}=A;return l.unsubscribe=()=>fe.asap(o),l}},wg=function*(i,e){let t=i.byteLength;if(t<e){yield i;return}let A=0,r;for(;A<t;)r=A+e,yield i.slice(A,r),A=r},Bg=async function*(i,e){for await(const t of yg(i))yield*wg(t,e)},yg=async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}const e=i.getReader();try{for(;;){const{done:t,value:A}=await e.read();if(t)break;yield A}}finally{await e.cancel()}},ih=(i,e,t,A)=>{const r=Bg(i,e);let n=0,s,o=l=>{s||(s=!0,A&&A(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){o(),l.close();return}let m=u.byteLength;if(t){let y=n+=m;t(y)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},rh=64*1024,{isFunction:Sn}=fe,Cg=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:nh,TextEncoder:sh}=fe.global,oh=(i,...e)=>{try{return!!i(...e)}catch{return!1}},vg=i=>{i=fe.merge.call({skipUndefined:!0},Cg,i);const{fetch:e,Request:t,Response:A}=i,r=e?Sn(e):typeof fetch=="function",n=Sn(t),s=Sn(A);if(!r)return!1;const o=r&&Sn(nh),l=r&&(typeof sh=="function"?(T=>C=>T.encode(C))(new sh):async T=>new Uint8Array(await new t(T).arrayBuffer())),c=n&&o&&oh(()=>{let T=!1;const C=new t(Xt.origin,{body:new nh,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!C}),u=s&&o&&oh(()=>fe.isReadableStream(new A("").body)),m={stream:u&&(T=>T.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!m[T]&&(m[T]=(C,U)=>{let F=C&&C[T];if(F)return F.call(C);throw new Ge(`Response type '${T}' is not supported`,Ge.ERR_NOT_SUPPORT,U)})});const y=async T=>{if(T==null)return 0;if(fe.isBlob(T))return T.size;if(fe.isSpecCompliantForm(T))return(await new t(Xt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(T)||fe.isArrayBuffer(T))return T.byteLength;if(fe.isURLSearchParams(T)&&(T=T+""),fe.isString(T))return(await l(T)).byteLength},v=async(T,C)=>{const U=fe.toFiniteNumber(T.getContentLength());return U??y(C)};return async T=>{let{url:C,method:U,data:F,signal:E,cancelToken:N,timeout:R,onDownloadProgress:M,onUploadProgress:z,responseType:ne,headers:$,withCredentials:V="same-origin",fetchOptions:Ae}=Ah(T),re=e||fetch;ne=ne?(ne+"").toLowerCase():"text";let he=mg([E,N&&N.toAbortSignal()],R),Z=null;const te=he&&he.unsubscribe&&(()=>{he.unsubscribe()});let ae;try{if(z&&c&&U!=="get"&&U!=="head"&&(ae=await v($,F))!==0){let Fe=new t(C,{method:"POST",body:F,duplex:"half"}),Ue;if(fe.isFormData(F)&&(Ue=Fe.headers.get("content-type"))&&$.setContentType(Ue),Fe.body){const[ye,Te]=qc(ae,Un(jc(z)));F=ih(Fe.body,rh,ye,Te)}}fe.isString(V)||(V=V?"include":"omit");const ce=n&&"credentials"in t.prototype,se={...Ae,signal:he,method:U.toUpperCase(),headers:$.normalize().toJSON(),body:F,duplex:"half",credentials:ce?V:void 0};Z=n&&new t(C,se);let le=await(n?re(Z,Ae):re(C,se));const pe=u&&(ne==="stream"||ne==="response");if(u&&(M||pe&&te)){const Fe={};["status","statusText","headers"].forEach(ve=>{Fe[ve]=le[ve]});const Ue=fe.toFiniteNumber(le.headers.get("content-length")),[ye,Te]=M&&qc(Ue,Un(jc(M),!0))||[];le=new A(ih(le.body,rh,ye,()=>{Te&&Te(),te&&te()}),Fe)}ne=ne||"text";let Be=await m[fe.findKey(m,ne)||"text"](le,T);return!pe&&te&&te(),await new Promise((Fe,Ue)=>{Yc(Fe,Ue,{data:Be,headers:sA.from(le.headers),status:le.status,statusText:le.statusText,config:T,request:Z})})}catch(ce){throw te&&te(),ce&&ce.name==="TypeError"&&/Load failed|fetch/i.test(ce.message)?Object.assign(new Ge("Network Error",Ge.ERR_NETWORK,T,Z,ce&&ce.response),{cause:ce.cause||ce}):Ge.from(ce,ce&&ce.code,T,Z,ce&&ce.response)}}},Tg=new Map,ah=i=>{let e=i&&i.env||{};const{fetch:t,Request:A,Response:r}=e,n=[A,r,t];let s=n.length,o=s,l,c,u=Tg;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:vg(e)),u=c;return c};ah();const Do={http:R1,xhr:gg,fetch:{get:ah}};fe.forEach(Do,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const lh=i=>`- ${i}`,xg=i=>fe.isFunction(i)||i===null||i===!1;function bg(i,e){i=fe.isArray(i)?i:[i];const{length:t}=i;let A,r;const n={};for(let s=0;s<t;s++){A=i[s];let o;if(r=A,!xg(A)&&(r=Do[(o=String(A)).toLowerCase()],r===void 0))throw new Ge(`Unknown adapter '${o}'`);if(r&&(fe.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
4
|
-
`+s.map(
|
|
5
|
-
`):" "+
|
|
6
|
-
`+n):A.stack=n}catch{}}throw A}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=xi(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&Ln.assertOptions(A,{silentJSONParsing:BA.transitional(BA.boolean),forcedJSONParsing:BA.transitional(BA.boolean),clarifyTimeoutError:BA.transitional(BA.boolean),legacyInterceptorReqResOrdering:BA.transitional(BA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:Ln.assertOptions(r,{encode:BA.function,serialize:BA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ln.assertOptions(t,{baseUrl:BA.spelling("baseURL"),withXsrfToken:BA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&fe.merge(n.common,n[t.method]);n&&fe.forEach(["delete","get","head","post","put","patch","common"],T=>{delete n[T]}),t.headers=sA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(t)===!1)return;l=l&&C.synchronous;const U=t.transitional||Eo;U&&U.legacyInterceptorReqResOrdering?o.unshift(C.fulfilled,C.rejected):o.push(C.fulfilled,C.rejected)});const c=[];this.interceptors.response.forEach(function(C){c.push(C.fulfilled,C.rejected)});let u,m=0,y;if(!l){const T=[hh.bind(this),void 0];for(T.unshift(...o),T.push(...c),y=T.length,u=Promise.resolve(t);m<y;)u=u.then(T[m++],T[m++]);return u}y=o.length;let v=t;for(;m<y;){const T=o[m++],C=o[m++];try{v=T(v)}catch(U){C.call(this,U);break}}try{u=hh.call(this,v)}catch(T){return Promise.reject(T)}for(m=0,y=c.length;m<y;)u=u.then(c[m++],c[m++]);return u}getUri(e){e=xi(this.defaults,e);const t=eh(e.baseURL,e.url,e.allowAbsoluteUrls);return Gc(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){bi.prototype[e]=function(t,A){return this.request(xi(A||{},{method:e,url:t,data:(A||{}).data}))}}),fe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(xi(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}bi.prototype[e]=t(),bi.prototype[e+"Form"]=t(!0)});let Fg=class Tp{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(n){t=n});const A=this;this.promise.then(r=>{if(!A._listeners)return;let n=A._listeners.length;for(;n-- >0;)A._listeners[n](r);A._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{A.subscribe(o),n=o}).then(r);return s.cancel=function(){A.unsubscribe(n)},s},e(function(n,s,o){A.reason||(A.reason=new Tr(n,s,o),t(A.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=A=>{e.abort(A)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Tp(function(r){e=r}),cancel:e}}};function Ug(i){return function(t){return i.apply(null,t)}}function Sg(i){return fe.isObject(i)&&i.isAxiosError===!0}const Po={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Po).forEach(([i,e])=>{Po[e]=i});function ph(i){const e=new bi(i),t=Hc(bi.prototype.request,e);return fe.extend(t,bi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return ph(xi(i,r))},t}const gt=ph(Cr);gt.Axios=bi,gt.CanceledError=Tr,gt.CancelToken=Fg,gt.isCancel=Zc,gt.VERSION=uh,gt.toFormData=Qn,gt.AxiosError=Ge,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=Ug,gt.isAxiosError=Sg,gt.mergeConfig=xi,gt.AxiosHeaders=sA,gt.formToJSON=i=>Xc(fe.isHTMLForm(i)?new FormData(i):i),gt.getAdapter=ch.getAdapter,gt.HttpStatusCode=Po,gt.default=gt;const{Axios:nx,AxiosError:sx,CanceledError:ox,isCancel:ax,CancelToken:lx,VERSION:cx,all:hx,Cancel:ux,isAxiosError:dx,spread:px,toFormData:fx,AxiosHeaders:gx,HttpStatusCode:mx,formToJSON:wx,getAdapter:Bx,mergeConfig:yx}=gt,kA=Object.create(null);kA.open="0",kA.close="1",kA.ping="2",kA.pong="3",kA.message="4",kA.upgrade="5",kA.noop="6";const Mn=Object.create(null);Object.keys(kA).forEach(i=>{Mn[kA[i]]=i});const ko={type:"error",data:"parser error"},fh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",gh=typeof ArrayBuffer=="function",mh=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,No=({type:i,data:e},t,A)=>fh&&e instanceof Blob?t?A(e):wh(e,A):gh&&(e instanceof ArrayBuffer||mh(e))?t?A(e):wh(new Blob([e]),A):A(kA[i]+(e||"")),wh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function Bh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Oo;function Eg(i,e){if(fh&&i.data instanceof Blob)return i.data.arrayBuffer().then(Bh).then(e);if(gh&&(i.data instanceof ArrayBuffer||mh(i.data)))return e(Bh(i.data));No(i,!1,t=>{Oo||(Oo=new TextEncoder),e(Oo.encode(t))})}const yh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<yh.length;i++)xr[yh.charCodeAt(i)]=i;const Lg=i=>{let e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);const c=new ArrayBuffer(e),u=new Uint8Array(c);for(A=0;A<t;A+=4)n=xr[i.charCodeAt(A)],s=xr[i.charCodeAt(A+1)],o=xr[i.charCodeAt(A+2)],l=xr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Mg=typeof ArrayBuffer=="function",Ko=(i,e)=>{if(typeof i!="string")return{type:"message",data:Ch(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:Hg(i.substring(1),e)}:Mn[t]?i.length>1?{type:Mn[t],data:i.substring(1)}:{type:Mn[t]}:ko},Hg=(i,e)=>{if(Mg){const t=Lg(i);return Ch(t,e)}else return{base64:!0,data:i}},Ch=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,vh="",Ig=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{No(n,!1,o=>{A[s]=o,++r===t&&e(A.join(vh))})})},Dg=(i,e)=>{const t=i.split(vh),A=[];for(let r=0;r<t.length;r++){const n=Ko(t[r],e);if(A.push(n),n.type==="error")break}return A};function _g(){return new TransformStream({transform(i,e){Eg(i,t=>{const A=t.length;let r;if(A<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,A);else if(A<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,A)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(A))}i.data&&typeof i.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Vo;function Hn(i){return i.reduce((e,t)=>e+t.length,0)}function In(i,e){if(i[0].length===e)return i.shift();const t=new Uint8Array(e);let A=0;for(let r=0;r<e;r++)t[r]=i[0][A++],A===i[0].length&&(i.shift(),A=0);return i.length&&A<i[0].length&&(i[0]=i[0].slice(A)),t}function Pg(i,e){Vo||(Vo=new TextDecoder);const t=[];let A=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(Hn(t)<1)break;const l=In(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?A=3:r===126?A=1:A=2}else if(A===1){if(Hn(t)<2)break;const l=In(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(Hn(t)<8)break;const l=In(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(ko);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(Hn(t)<r)break;const l=In(t,r);o.enqueue(Ko(n?l:Vo.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(ko);break}}}})}const Th=4;function _t(i){if(i)return kg(i)}function kg(i){for(var e in _t.prototype)i[e]=_t.prototype[e];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},_t.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var A,r=0;r<t.length;r++)if(A=t[r],A===e||A.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+i],this},_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){t=t.slice(0);for(var A=0,r=t.length;A<r;++A)t[A].apply(this,e)}return this},_t.prototype.emitReserved=_t.prototype.emit,_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),yA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ng="arraybuffer";function Cx(){}function xh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Og=yA.setTimeout,Kg=yA.clearTimeout;function _n(i,e){e.useNativeTimers?(i.setTimeoutFn=Og.bind(yA),i.clearTimeoutFn=Kg.bind(yA)):(i.setTimeoutFn=yA.setTimeout.bind(yA),i.clearTimeoutFn=yA.clearTimeout.bind(yA))}const Vg=1.33;function zg(i){return typeof i=="string"?Wg(i):Math.ceil((i.byteLength||i.size)*Vg)}function Wg(i){let e=0,t=0;for(let A=0,r=i.length;A<r;A++)e=i.charCodeAt(A),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(A++,t+=4);return t}function bh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Rg(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Gg(i){let e={},t=i.split("&");for(let A=0,r=t.length;A<r;A++){let n=t[A].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class $g extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class zo extends _t{constructor(e){super(),this.writable=!1,_n(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,A){return super.emitReserved("error",new $g(e,t,A)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Ko(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Rg(e);return t.length?"?"+t:""}}class Xg extends zo{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let A=0;this._polling&&(A++,this.once("pollComplete",function(){--A||t()})),this.writable||(A++,this.once("drain",function(){--A||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=A=>{if(this.readyState==="opening"&&A.type==="open"&&this.onOpen(),A.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(A)};Dg(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Ig(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=bh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Qh=!1;try{Qh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Jg=Qh;function Zg(){}class Yg extends Xg{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let A=location.port;A||(A=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||A!==e.port}}doWrite(e,t){const A=this.request({method:"POST",data:e});A.on("success",t),A.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,A)=>{this.onError("xhr poll error",t,A)}),this.pollXhr=e}}class NA extends _t{constructor(e,t,A){super(),this.createRequest=e,_n(this,A),this._opts=A,this._method=A.method||"GET",this._uri=t,this._data=A.data!==void 0?A.data:null,this._create()}_create(){var e;const t=xh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const A=this._xhr=this.createRequest(t);try{A.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){A.setDisableHeaderCheck&&A.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&A.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{A.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{A.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(A),"withCredentials"in A&&(A.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(A.timeout=this._opts.requestTimeout),A.onreadystatechange=()=>{var r;A.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(A.getResponseHeader("set-cookie"))),A.readyState===4&&(A.status===200||A.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof A.status=="number"?A.status:0)},0))},A.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=NA.requestsCount++,NA.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Zg,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete NA.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(NA.requestsCount=0,NA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Fh);else if(typeof addEventListener=="function"){const i="onpagehide"in yA?"pagehide":"unload";addEventListener(i,Fh,!1)}}function Fh(){for(let i in NA.requests)NA.requests.hasOwnProperty(i)&&NA.requests[i].abort()}const qg=(function(){const i=Uh({xdomain:!1});return i&&i.responseType!==null})();class jg extends Yg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=qg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new NA(Uh,this.uri(),e)}}function Uh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Jg))return new XMLHttpRequest}catch{}if(!e)try{return new yA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Sh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class em extends zo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=Sh?{}:xh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(A.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,A)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;No(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=bh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Wo=yA.WebSocket||yA.MozWebSocket;class tm extends em{createSocket(e,t,A){return Sh?new Wo(e,t,A):t?new Wo(e,t):new Wo(e)}doWrite(e,t){this.ws.send(t)}}class Am extends zo{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Pg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=_g();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{A.read().then(({done:o,value:l})=>{o||(this.onPacket(l),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;this._writer.write(A).then(()=>{r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const im={websocket:tm,webtransport:Am,polling:jg},rm=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,nm=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ro(i){if(i.length>8e3)throw"URI too long";const e=i,t=i.indexOf("["),A=i.indexOf("]");t!=-1&&A!=-1&&(i=i.substring(0,t)+i.substring(t,A).replace(/:/g,";")+i.substring(A,i.length));let r=rm.exec(i||""),n={},s=14;for(;s--;)n[nm[s]]=r[s]||"";return t!=-1&&A!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=sm(n,n.path),n.queryKey=om(n,n.query),n}function sm(i,e){const t=/\/{2,9}/g,A=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&A.splice(0,1),e.slice(-1)=="/"&&A.splice(A.length-1,1),A}function om(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Go=typeof addEventListener=="function"&&typeof removeEventListener=="function",Pn=[];Go&&addEventListener("offline",()=>{Pn.forEach(i=>i())},!1);class ni extends _t{constructor(e,t){if(super(),this.binaryType=Ng,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const A=Ro(e);t.hostname=A.host,t.secure=A.protocol==="https"||A.protocol==="wss",t.port=A.port,A.query&&(t.query=A.query)}else t.host&&(t.hostname=Ro(t.host).host);_n(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(A=>{const r=A.prototype.name;this.transports.push(r),this._transportsByName[r]=A}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Gg(this.opts.query)),Go&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Pn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Th,t.transport=e,this.id&&(t.sid=this.id);const A=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](A)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ni.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ni.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let A=0;A<this.writeBuffer.length;A++){const r=this.writeBuffer[A].data;if(r&&(t+=zg(r)),A>0&&t>this._maxPayload)return this.writeBuffer.slice(0,A);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Dn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,A){return this._sendPacket("message",e,t,A),this}send(e,t,A){return this._sendPacket("message",e,t,A),this}_sendPacket(e,t,A,r){if(typeof t=="function"&&(r=t,t=void 0),typeof A=="function"&&(r=A,A=null),this.readyState==="closing"||this.readyState==="closed")return;A=A||{},A.compress=A.compress!==!1;const n={type:e,data:t,options:A};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},A=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?A():e()}):this.upgrading?A():e()),this}_onError(e){if(ni.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Go&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Pn.indexOf(this._offlineEventListener);A!==-1&&Pn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ni.protocol=Th;class am extends ni{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),A=!1;ni.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!A)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ni.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const y=new Error("probe error");y.transport=t.name,this.emitReserved("upgradeError",y)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=m=>{const y=new Error("probe error: "+m);y.transport=t.name,n(),this.emitReserved("upgradeError",y)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const u=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{A||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let A=0;A<e.length;A++)~this.transports.indexOf(e[A])&&t.push(e[A]);return t}}let lm=class extends am{constructor(e,t={}){const A=typeof e=="object"?e:t;(!A.transports||A.transports&&typeof A.transports[0]=="string")&&(A.transports=(A.transports||["polling","websocket","webtransport"]).map(r=>im[r]).filter(r=>!!r)),super(e,A)}};function cm(i,e="",t){let A=i;t=t||typeof location<"u"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(typeof t<"u"?i=t.protocol+"//"+i:i="https://"+i),A=Ro(i)),A.port||(/^(http|ws)$/.test(A.protocol)?A.port="80":/^(http|ws)s$/.test(A.protocol)&&(A.port="443")),A.path=A.path||"/";const n=A.host.indexOf(":")!==-1?"["+A.host+"]":A.host;return A.id=A.protocol+"://"+n+":"+A.port+e,A.href=A.protocol+"://"+n+(t&&t.port===A.port?"":":"+A.port),A}const hm=typeof ArrayBuffer=="function",um=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Eh=Object.prototype.toString,dm=typeof Blob=="function"||typeof Blob<"u"&&Eh.call(Blob)==="[object BlobConstructor]",pm=typeof File=="function"||typeof File<"u"&&Eh.call(File)==="[object FileConstructor]";function $o(i){return hm&&(i instanceof ArrayBuffer||um(i))||dm&&i instanceof Blob||pm&&i instanceof File}function kn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(kn(i[t]))return!0;return!1}if($o(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return kn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&kn(i[t]))return!0;return!1}function fm(i){const e=[],t=i.data,A=i;return A.data=Xo(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Xo(i,e){if(!i)return i;if($o(i)){const t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){const t=new Array(i.length);for(let A=0;A<i.length;A++)t[A]=Xo(i[A],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){const t={};for(const A in i)Object.prototype.hasOwnProperty.call(i,A)&&(t[A]=Xo(i[A],e));return t}return i}function gm(i,e){return i.data=Jo(i.data,e),delete i.attachments,i}function Jo(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Jo(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Jo(i[t],e));return i}const mm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ct;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(ct||(ct={}));class wm{constructor(e){this.replacer=e}encode(e){return(e.type===ct.EVENT||e.type===ct.ACK)&&kn(e)?this.encodeAsBinary({type:e.type===ct.EVENT?ct.BINARY_EVENT:ct.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ct.BINARY_EVENT||e.type===ct.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=fm(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class Zo extends _t{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const A=t.type===ct.BINARY_EVENT;A||t.type===ct.BINARY_ACK?(t.type=A?ct.EVENT:ct.ACK,this.reconstructor=new Bm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if($o(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const A={type:Number(e.charAt(0))};if(ct[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===ct.BINARY_EVENT||A.type===ct.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");A.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););A.nsp=e.substring(n,t)}else A.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}A.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(Zo.isPayloadValid(A.type,n))A.data=n;else throw new Error("invalid payload")}return A}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ct.CONNECT:return Lh(t);case ct.DISCONNECT:return t===void 0;case ct.CONNECT_ERROR:return typeof t=="string"||Lh(t);case ct.EVENT:case ct.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&mm.indexOf(t[0])===-1);case ct.ACK:case ct.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Bm{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=gm(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Lh(i){return Object.prototype.toString.call(i)==="[object Object]"}const ym=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Zo,Encoder:wm,get PacketType(){return ct}},Symbol.toStringTag,{value:"Module"}));function EA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const Cm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Mh extends _t{constructor(e,t,A){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,A&&A.auth&&(this.auth=A.auth),this._opts=Object.assign({},A),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[EA(e,"open",this.onopen.bind(this)),EA(e,"packet",this.onpacket.bind(this)),EA(e,"error",this.onerror.bind(this)),EA(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var A,r,n;if(Cm.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ct.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,m=t.pop();this._registerAckCallback(u,m),s.id=u}const o=(r=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const r=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,r)=>{const n=(s,o)=>s?r(s):A(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const A={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),A.pending=!1,this._drainQueue())),this._queue.push(A),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ct.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(A=>String(A.id)===e)){const A=this.acks[e];delete this.acks[e],A.withError&&A.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ct.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ct.EVENT:case ct.BINARY_EVENT:this.onevent(e);break;case ct.ACK:case ct.BINARY_ACK:this.onack(e);break;case ct.DISCONNECT:this.ondisconnect();break;case ct.CONNECT_ERROR:this.destroy();const A=new Error(e.data.message);A.data=e.data.data,this.emitReserved("connect_error",A);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const A of t)A.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let A=!1;return function(...r){A||(A=!0,t.packet({type:ct.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ct.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const A of t)A.apply(this,e.data)}}}function zi(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}zi.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=(Math.floor(e*10)&1)==0?i-t:i+t}return Math.min(i,this.max)|0},zi.prototype.reset=function(){this.attempts=0},zi.prototype.setMin=function(i){this.ms=i},zi.prototype.setMax=function(i){this.max=i},zi.prototype.setJitter=function(i){this.jitter=i};class Yo extends _t{constructor(e,t){var A;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,_n(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((A=t.randomizationFactor)!==null&&A!==void 0?A:.5),this.backoff=new zi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||ym;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new lm(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=EA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=EA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(EA(e,"ping",this.onping.bind(this)),EA(e,"data",this.ondata.bind(this)),EA(e,"error",this.onerror.bind(this)),EA(e,"close",this.onclose.bind(this)),EA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Dn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let A=this.nsps[e];return A?this._autoConnect&&!A.active&&A.connect():(A=new Mh(this,e,t),this.nsps[e]=A),A}_destroy(e){const t=Object.keys(this.nsps);for(const A of t)if(this.nsps[A].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let A=0;A<t.length;A++)this.engine.write(t[A],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var A;this.cleanup(),(A=this.engine)===null||A===void 0||A.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const A=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&A.unref(),this.subs.push(()=>{this.clearTimeoutFn(A)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const br={};function Nn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=cm(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=br[r]&&n in br[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new Yo(A,e):(br[r]||(br[r]=new Yo(A,e)),l=br[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Nn,{Manager:Yo,Socket:Mh,io:Nn,connect:Nn});function qo(i){if(!i)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(i,e),A=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${A}`}catch{return String(i).trim().replace(/\/+$/,"")}}let dA=qo("http://localhost:8000");function Hh(i){const e=qo(i);e&&e!==dA&&(dA=e,St&&(St.disconnect(),St.removeAllListeners(),St=null))}let St=null;function vm(){const i=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=i();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:dA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=Nn(dA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),A=()=>{const r=i();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:dA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:dA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=A();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:dA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:dA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function jo(){const i=qo(St?.io?.uri||null);return!St||St.io&&i&&dA&&i!==dA?(St&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:dA,wasConnected:St.connected,reason:"baseUrl changed"}),St.disconnect(),St.removeAllListeners(),St=null),St=vm()):St.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:St.id,connected:St.connected,baseUrl:dA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:St.id,baseUrl:dA}),St}function Tm(i,e){const t=jo();return t.on(i,e),()=>t.off(i,e)}function xm(i,e){St&&St.off(i,e)}function bm(i,e){jo().emit(i,e)}function Qm(){return St?St.connected?"connected":"connecting":"disconnected"}const On={getSocket:jo,on:Tm,off:xm,emit:bm,getStatus:Qm,setBaseUrl:Hh},Fm={},Ih=q.createContext(),Vt=()=>{const i=q.useContext(Ih);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},Um=({children:i,baseUrl:e,endpoints:t,accountId:A,initialSymbol:r,initialTimeframe:n,indicators:s,indicatorSettings:o})=>{const l=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ks&&Ks.tagName.toUpperCase()==="SCRIPT"&&Ks.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&Fm?.VITE_BASE_URL)??"http://localhost:5002";On.setBaseUrl(l);const u={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[y,v]=q.useState(r||"BTC/USD"),[T,C]=q.useState(n||"M1"),[U,F]=q.useState([]),[E,N]=q.useState(!0),[R,M]=q.useState([]),[z,ne]=q.useState(!1),[$,V]=q.useState(1e5),[Ae,re]=q.useState(null),[he,Z]=q.useState([]),[te,ae]=q.useState(!0),[ce,se]=q.useState(!1),[le,pe]=q.useState(!0),[Be,Fe]=q.useState("candles"),[Ue,ye]=q.useState(!1),[Te,ve]=q.useState("dark"),[be,Le]=q.useState(null),[Re,Ke]=q.useState(!1),[xe,De]=q.useState(!1),[Ce,de]=q.useState(!1),[_e,et]=q.useState(!1),[rt,nt]=q.useState(!1),[ut,fA]=q.useState(!1),[Xe,ke]=q.useState(!1),[at,it]=q.useState(!1),[Ct,bt]=q.useState(!1),[$A,XA]=q.useState(!1),[Rt,gA]=q.useState([]),JA=q.useRef(null),Yt=q.useRef(new Map),Et=q.useRef(null),QA=1e3,st=q.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;ne(!0);const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let Pe=[];Array.isArray(ze.data)?Pe=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Pe=ze.data.data);const At=Pe.filter(Ne=>Ne.closePrice===null||Ne.closePrice===void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,comment:Ne.comment||"",status:"OPEN",swap:0,profit:Ne.profit||0,profitCurrency:"USD",time:new Date(Ne.openedAt||Ne.openAt||Date.now()).toLocaleTimeString(),openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt}));M(At)}catch(me){console.error("❌ Error fetching orders:",me.response?.data||me.message),M([])}finally{ne(!1)}},[l,A]),ft=q.useCallback((me,ze)=>!ze||!me.price||isNaN(ze)||isNaN(me.price)?me.profit||0:(me?.type?.toUpperCase()==="BUY"?ze-me.price:me.price-ze)*me.volume,[]),Ut=q.useCallback(async()=>{try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;const ze=await gt.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${me}`}});if(ze.data&&ze.data.data){const Pe=parseFloat(ze.data.data.balance);isNaN(Pe)||V(Pe)}}catch(me){console.error("❌ Error fetching user balance:",me.response?.data||me.message)}},[l]),Tt=q.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let Pe=[];Array.isArray(ze.data)?Pe=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Pe=ze.data.data);const At=Pe.filter(Ne=>Ne.closePrice!==null&&Ne.closePrice!==void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,closePrice:Ne.closePrice,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,profit:Ne.profit??Ne.profitLoss??0,profitCurrency:"USD",openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt,closeReason:Ne.closeReason||"",status:"CLOSED"}));gA(At)}catch(me){console.error("❌ Error fetching history orders:",me.response?.data||me.message),gA([])}},[l,A]),Je=q.useMemo(()=>{const me=$,ze=R.reduce((wt,Lt)=>wt+Lt.volume*Lt.price*.01,0),Pe=R.reduce((wt,Lt)=>{const cA=U.find(mA=>mA.symbol===Lt.symbol);if(cA){const mA=Lt.type?.toUpperCase()==="BUY"?parseFloat(cA.bid||0):parseFloat(cA.ask||0);if(mA&&mA>0&&!isNaN(mA))return wt+ft(Lt,mA)}return wt+(Lt.profit||0)},0),At=me+Pe,Ne=At-ze,Ye=ze>0?At/ze*100:0;return{balance:me,equity:At,margin:ze,freeMargin:Ne,level:Ye.toFixed(2)}},[R,U,$,ft]);q.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(st(),Ut(),Tt())},[st,Ut,Tt,A]),q.useEffect(()=>{(async()=>{try{N(!0);const ze=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Pe=await gt.get(ze);let At=[];Array.isArray(Pe.data)?At=Pe.data:Pe.data&&Pe.data.data&&Array.isArray(Pe.data.data)?At=Pe.data.data:Pe.data&&Pe.data.prices&&Array.isArray(Pe.data.prices)?At=Pe.data.prices:Pe.data&&Array.isArray(Pe.data)&&(At=Pe.data);const Ne=At.map(Ye=>{const wt=Ye.symbol||Ye.name||"",Lt=Ye.category||null;return wt&&(Ye.bid!==void 0||Ye.price!==void 0)?{symbol:wt,bid:Ye.bid??Ye.price??0,ask:Ye.ask??Ye.price??0,change:Ye.change??0,category:Lt}:{...Ye,symbol:wt,category:Lt}});Ne.length>0?(F(Ne),Ne.find(wt=>wt.symbol===y)||v(Ne[0].symbol)):F([])}catch(ze){console.error("❌ Error fetching symbols:",ze.response?.data||ze.message),F([])}finally{N(!1)}})()},[l,u.symbols]);const Ie=q.useCallback(()=>{const me=Yt.current;if(me.size===0)return;const ze=new Map(me);me.clear(),F(Pe=>Pe.map(At=>{const Ne=ze.get(At.symbol);return Ne?{...At,...Ne}:At})),M(Pe=>{let At=!1;const Ne=Pe.map(Ye=>{const wt=ze.get(Ye.symbol);if(!wt)return Ye;const Lt=Ye.type?.toUpperCase()==="BUY"?parseFloat(wt.bid||0):parseFloat(wt.ask||0);if(!Lt||isNaN(Lt)||Lt<=0)return Ye;const cA=ft(Ye,Lt);return cA===Ye.profit?Ye:(At=!0,{...Ye,profit:cA})});return At?Ne:Pe})},[ft]);q.useEffect(()=>{JA.current||(JA.current=On.getSocket());const me=JA.current,ze=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&me.emit("joinUserRoom",{userId:Number(A)})},Pe=()=>console.log("⚠️ TradingContext: Disconnected"),At=Ye=>{Ye?.symbol&&(Yt.current.set(Ye.symbol,Ye),Et.current||(Et.current=setTimeout(()=>{Et.current=null,Ie()},QA)))},Ne=async Ye=>{if(Ye){if(Ye.newBalance!==void 0){const wt=parseFloat(Ye.newBalance);isNaN(wt)||V(wt)}if(window.notify){const wt=Ye.profitLoss||Ye.profit||0,Lt=wt>=0?`+${wt.toFixed(2)}`:wt.toFixed(2),cA=Ye.symbol||"Trade",mA=Ye.reason||"Closed";window.notify(`Trade Closed: ${mA} | ${cA} | P/L: ${Lt} USD`,wt>=0?"success":"error")}Ye.tradeId&&M(wt=>wt.filter(Lt=>Lt.id!==Ye.tradeId)),await st(),await Ut()}};return me.on("connect",ze),me.on("disconnect",Pe),me.on("priceUpdate",At),me.on("tradeClosed",Ne),me.connected&&A&&Number.isFinite(Number(A))&&me.emit("joinUserRoom",{userId:Number(A)}),()=>{me.off("connect",ze),me.off("disconnect",Pe),me.off("priceUpdate",At),me.off("tradeClosed",Ne),Et.current&&(clearTimeout(Et.current),Et.current=null),Yt.current.clear()}},[Ie,st,Ut]),q.useEffect(()=>{try{const me=document.documentElement;if(!me)return;me.dataset.theme=Te}catch{}},[Te]);const tt=q.useMemo(()=>U.find(me=>me.symbol===y)||{bid:"0.00000",ask:"0.00000",change:0},[U,y]),$e=q.useMemo(()=>({selectedSymbol:y,setSelectedSymbol:v,selectedTimeframe:T,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:E,orders:R,setOrders:M,ordersLoading:z,fetchOrders:st,fetchUserBalance:Ut,userBalance:$,setUserBalance:V,accountSummary:Je,currentSymbolData:tt,activeTool:Ae,setActiveTool:re,chartObjects:he,setChartObjects:Z,showGrid:te,setShowGrid:ae,snapToGrid:ce,setSnapToGrid:se,drawingsVisible:le,setDrawingsVisible:pe,chartType:Be,setChartType:Fe,chartLocked:Ue,setChartLocked:ye,theme:Te,setTheme:ve,candleColors:be,setCandleColors:Le,showTradeOrders:Re,setShowTradeOrders:Ke,showTradePosition:xe,setShowTradePosition:De,showTradeHistory:Ce,setShowTradeHistory:de,showSLTP:_e,setShowSLTP:et,showAskPrice:rt,setShowAskPrice:nt,showChartControls:ut,setShowChartControls:fA,showTradeNotification:Xe,setShowTradeNotification:ke,showCrosshair:at,setShowCrosshair:it,showOHLC:Ct,setShowOHLC:bt,baseUrl:l,endpoints:u,endpointParams:m,accountId:A,isShow:$A,setIsShow:XA,historyOrders:Rt,setHistoryOrders:gA,fetchHistoryOrders:Tt,indicators:s,indicatorSettings:o}),[y,T,U,E,R,z,st,Ut,$,Je,tt,Ae,he,te,ce,le,Be,Ue,Te,be,Re,xe,Ce,_e,rt,ut,Xe,at,Ct,l,u,m,$A,Rt,Tt,s,o]);return a.jsx(Ih.Provider,{value:$e,children:i})};var Dh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_h=q.createContext&&q.createContext(Dh),Sm=["attr","size","title"];function Em(i,e){if(i==null)return{};var t=Lm(i,e),A,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)A=n[r],!(e.indexOf(A)>=0)&&Object.prototype.propertyIsEnumerable.call(i,A)&&(t[A]=i[A])}return t}function Lm(i,e){if(i==null)return{};var t={};for(var A in i)if(Object.prototype.hasOwnProperty.call(i,A)){if(e.indexOf(A)>=0)continue;t[A]=i[A]}return t}function Kn(){return Kn=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(i[A]=t[A])}return i},Kn.apply(this,arguments)}function Ph(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(i);e&&(A=A.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,A)}return t}function Vn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ph(Object(t),!0).forEach(function(A){Mm(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ph(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function Mm(i,e,t){return e=Hm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hm(i){var e=Im(i,"string");return typeof e=="symbol"?e:e+""}function Im(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var A=t.call(i,e);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function kh(i){return i&&i.map((e,t)=>q.createElement(e.tag,Vn({key:t},e.attr),kh(e.child)))}function eA(i){return e=>q.createElement(Dm,Kn({attr:Vn({},i.attr)},e),kh(i.child))}function Dm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=Em(i,Sm),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),q.createElement("svg",Kn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Vn(Vn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&q.createElement("title",null,n),i.children)};return _h!==void 0?q.createElement(_h.Consumer,null,t=>e(t)):e(Dh)}function _m(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(i)}function Pm(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(i)}function km(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(i)}function Nm(i){return eA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(i)}function Nh(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(i)}function Om(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(i)}function Km(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(i)}function Vm(i){return eA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(i)}function zm(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(i)}function Wm(i){return eA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(i)}const Rm={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Oh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=Vt(),c=r==="light",[u,m]=q.useState("0.01"),[y,v]=q.useState(""),[T,C]=q.useState(!1),U=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",E=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",N=M=>{const z=parseFloat(u)||.01,ne=Math.max(.01,z+M);m(ne.toFixed(2))},R=async M=>{v("");const z=M,ne=parseFloat(z==="BUY"?e:i),$=parseFloat(u);if(!$||$<=0||isNaN($)){v("Please enter a valid volume (minimum 0.01)");return}if($<.01){v("Volume must be at least 0.01");return}if(!ne||ne<=0||isNaN(ne)){v("Invalid price. Please refresh and try again.");return}const V=localStorage.getItem("token")??localStorage.getItem("authToken");if(!V){v("Please login to place trades");return}C(!0);const Ae=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:Ae,type:z,volume:$,openPrice:ne,takeProfit:null,stopLoss:null};try{const he=o||Rm?.VITE_BASE_URL||"http://localhost:8000",Z=l?.trades||"/api/trades",te=await gt.post(`${he}${Z}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(te.status<200||te.status>=300){v(te.data?.message||`Failed to place trade (${te.status})`);return}s&&s(),A&&A()}catch(he){const Z=he?.response?.data?.message||he?.message||"Network error. Please try again.";v(Z)}finally{C(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>R("SELL"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:i?Number(i).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${U}`,children:[a.jsx("button",{type:"button",onClick:()=>N(-.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Nh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:M=>{const z=M.target.value;(z===""||/^\d*\.?\d{0,2}$/.test(z))&&m(z)},onBlur:()=>{const M=parseFloat(u);m(isNaN(M)||M<.01?"0.01":M.toFixed(2))},className:`w-14 text-center focus:outline-none ${U} ${F}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>N(.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Om,{size:8})})]}),a.jsxs("button",{onClick:()=>R("BUY"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),y&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:y})]})},Gm={},Kh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:m,selectedTimeframe:y,setOrders:v,symbols:T,fetchOrders:C,theme:U,baseUrl:F,endpoints:E}=Vt(),N=U==="light",R={getContractSpec:Xe=>{const ke=String(Xe||"").toUpperCase();return ke.includes("BTC")||ke.includes("ETH")||ke.includes("SOL")||ke.includes("XRP")||ke.includes("ADA")||ke.includes("DOGE")||ke.includes("BNB")||ke.includes("AVAX")||ke.includes("DOT")||ke.includes("LINK")||ke.endsWith("USDT")?{contractSize:1}:ke.includes("XAU")||ke.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Xe,volume:ke})=>{const at=R.getContractSpec(Xe);return(parseFloat(ke)||0)*(at.contractSize||1)}},M=u||R,[z,ne]=q.useState("0.01"),[$,V]=q.useState(""),[Ae,re]=q.useState(""),[he,Z]=q.useState(""),[te,ae]=q.useState(!1),[ce,se]=q.useState(null),[le,pe]=q.useState(""),[Be,Fe]=q.useState(t||"BUY"),[Ue,ye]=q.useState(parseFloat(A)||0),[Te,ve]=q.useState(parseFloat(r)||0),[be,Le]=q.useState("text-white"),[Re,Ke]=q.useState("text-white"),xe=q.useRef(parseFloat(A)||0),De=q.useRef(parseFloat(r)||0);q.useEffect(()=>{if(!i)return;const Xe=On.getSocket(),ke=it=>{if(!(!it||!it.symbol)&&it.symbol.toUpperCase()===m?.toUpperCase()){const Ct=parseFloat(it.bid)||0,bt=parseFloat(it.ask)||0;Ct>0&&(Ct>xe.current?(Le("text-green-400"),setTimeout(()=>Le("text-white"),500)):Ct<xe.current&&xe.current>0&&(Le("text-red-400"),setTimeout(()=>Le("text-white"),500)),ye(Ct),xe.current=Ct),bt>0&&(bt>De.current?(Ke("text-green-400"),setTimeout(()=>Ke("text-white"),500)):bt<De.current&&De.current>0&&(Ke("text-red-400"),setTimeout(()=>Ke("text-white"),500)),ve(bt),De.current=bt)}};Xe.on("priceUpdate",ke);const at=T.find(it=>it.symbol===m);if(at){const it=parseFloat(at.bid)||0,Ct=parseFloat(at.ask)||0;it>0&&(ye(it),xe.current=it),Ct>0&&(ve(Ct),De.current=Ct)}return()=>{Xe.off("priceUpdate",ke)}},[i,m,T]),q.useEffect(()=>{if(i){ne(o?String(o):"0.01"),V(""),re(""),Z(""),pe(""),Fe(t||"BUY");const Xe=parseFloat(A)||0,ke=parseFloat(r)||0;Xe>0&&(ye(Xe),xe.current=Xe),ke>0&&(ve(ke),De.current=ke)}},[i,t,A,r,o]);const Ce=Ue||0,de=Te||0,_e=Xe=>{const ke=parseFloat(z)||.01,at=Math.max(.01,ke+Xe);ne(at.toFixed(2))},et=Xe=>{const ke=parseFloat($)||0,at=parseFloat(Be==="BUY"?Te:Ue)||0;if(!at){pe("Current price not available. Please wait...");return}let it=ke+Xe;Be==="BUY"?it=Math.max(1e-5,Math.min(it,at-1e-5)):it=Math.max(at+1e-5,it),V(it>0?it.toFixed(5):""),pe("")},rt=Xe=>{const ke=parseFloat(Ae)||0,at=parseFloat(Be==="BUY"?Te:Ue)||0;if(!at){pe("Current price not available. Please wait...");return}let it=ke+Xe;Be==="BUY"?it=Math.max(at+1e-5,it):it=Math.max(1e-5,Math.min(it,at-1e-5)),re(it>0?it.toFixed(5):""),pe("")},nt=async Xe=>{pe("");const ke=Xe||Be,at=parseFloat(ke==="BUY"?Te:Ue),it=parseFloat(z),Ct=$?parseFloat($):null,bt=Ae?parseFloat(Ae):null;if(!it||it<=0||isNaN(it)){pe("Please enter a valid volume (minimum 0.01)");return}if(it<.01){pe("Volume must be at least 0.01");return}if(!at||at<=0||isNaN(at)){pe("Invalid price. Please refresh and try again.");return}if(Ct!==null&&Ct!==""){if(isNaN(Ct)||Ct<=0){pe("Stop Loss must be a valid positive number");return}if(ke==="BUY"&&Ct>=at){pe("Stop Loss must be below the current price for BUY orders");return}if(ke==="SELL"&&Ct<=at){pe("Stop Loss must be above the current price for SELL orders");return}}if(bt!==null&&bt!==""){if(isNaN(bt)||bt<=0){pe("Take Profit must be a valid positive number");return}if(ke==="BUY"){if(bt<=at){pe(`Take Profit must be above the entry price (${at.toFixed(5)}) for BUY orders`);return}}else if(ke==="SELL"&&bt>=at){pe(`Take Profit must be below the entry price (${at.toFixed(5)}) for SELL orders`);return}}Fe(ke),se(ke),ae(!0);const $A=new Date,XA=$A.toLocaleTimeString(),Rt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,gA=localStorage.getItem("token")??localStorage.getItem("authToken");if(!gA){pe("Please login to place trades"),ae(!1),se(null);return}const JA={accountId:s,symbol:m,type:ke,volume:it,price:at,takeProfit:bt,stopLoss:Ct,comment:he.trim()||null},Yt={ticket:Rt.substring(0,8),symbol:m,type:ke,volume:parseFloat(it),price:parseFloat(at),time:XA,stopLoss:Ct?parseFloat(Ct):null,takeProfit:bt?parseFloat(bt):null,swap:0,profit:0,profitCurrency:"USD",comment:he.trim()||"",id:Rt,status:"OPEN",openAt:$A.toISOString()};if(!l&&v&&v(Et=>[...Et,Yt]),c&&!n){pe("Execution handler is required in forceParentExecution mode"),ae(!1),se(null);return}if(n){ae(!1),se(null),e();const Et={symbol:m,type:ke,lotSize:it,entryPrice:at,stopLoss:Ct,takeProfit:bt,comment:he.trim()||null};Promise.resolve(n(Et)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(QA=>{console.error("❌ Trade execution failed:",QA),!l&&v&&v(st=>st.filter(ft=>ft.id!==Rt))})}else{if(c){pe("Fallback API path disabled in forceParentExecution mode"),ae(!1),se(null);return}ae(!1),se(null),e();const Et=F||Gm?.VITE_BASE_URL||"http://localhost:8000",QA=E?.trades||"/api/trades";gt.post(`${Et}${QA}`,JA,{headers:{Authorization:`Bearer ${gA}`,"Content-Type":"application/json"}}).then(st=>{if(st.data&&st.data.data){const ft=st.data.data.trade;!l&&v&&v(Ut=>Ut.map(Tt=>Tt.id===Rt?{...Tt,id:ft.id,ticket:ft.id.substring(0,8),time:XA,openAt:ft.openAt}:Tt)),console.log("✅ Trade saved successfully:",ft),window.notify&&window.notify(`Trade placed successfully: ${ft.symbol} ${ft.type}`,"success")}else{!l&&v&&v(Ut=>Ut.filter(Tt=>Tt.id!==Rt));const ft=st.data?.message||"Failed to place trade";window.notify&&window.notify(ft,"error")}}).catch(st=>{console.error("Error placing trade:",st),!l&&v&&v(Ut=>Ut.filter(Tt=>Tt.id!==Rt));let ft="Failed to place trade";if(st.response){const Ut=st.response.status,Tt=st.response.data;Ut===400?ft=Tt?.message||"Invalid trade data. Please check your inputs.":Ut===401?ft="Authentication failed. Please login again.":Ut===404?ft=Tt?.message||"Symbol not found. Please select a valid symbol.":Ut===500?ft="Server error. Please try again later.":ft=Tt?.message||`Error: ${Ut}`}else st.request&&(ft="Network error. Please check your internet connection.");window.notify&&window.notify(ft,"error")})}},fA=(M?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return i?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${N?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${N?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${N?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[le&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:le}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[fA," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>_e(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:z,onChange:Xe=>{const ke=Xe.target.value;(ke===""||/^\d*\.?\d{0,2}$/.test(ke))&&(ne(ke),pe(""))},onBlur:()=>{const Xe=parseFloat(z);ne(isNaN(Xe)||Xe<.01?"0.01":Xe.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>_e(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>et(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:$,onChange:Xe=>{const ke=Xe.target.value;(ke===""||/^\d*\.?\d*$/.test(ke))&&(V(ke),pe(""))},onBlur:Xe=>{const ke=parseFloat(Xe.target.value);!isNaN(ke)&&ke>0?V(ke.toFixed(5)):Xe.target.value===""&&V("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>et(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>rt(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:Ae,onChange:Xe=>{const ke=Xe.target.value;(ke===""||/^\d*\.?\d*$/.test(ke))&&(re(ke),pe(""))},onBlur:Xe=>{const ke=parseFloat(Xe.target.value);!isNaN(ke)&&ke>0?re(ke.toFixed(5)):Xe.target.value===""&&re("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>rt(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:he,onChange:Xe=>Z(Xe.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${be} font-medium transition-colors duration-400`,children:Ce>0?Ce.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Re} font-medium transition-colors duration-400`,children:de>0?de.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>nt("SELL"),disabled:te,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:te&&ce==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>nt("BUY"),disabled:te,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:te&&ce==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},$m={text:"Text",trendline:"Trend Line",parallellines:"Parallel Channel",fibonacci:"Fibonacci Retracement",rectangle:"Rectangle",pricelevel:"Horizontal Line",horizontalray:"Horizontal Ray",verticalline:"Vertical Line",infoline:"Info Line",rulerline:"Ruler Line",arrowedline:"Arrowed Line",rayline:"Ray",extendedline:"Extended Line",crossline:"Cross Line",trendbyangle:"Trend By Angle",disjointchannel:"Disjoint Channel",flattopbottom:"Flat Top/Bottom",regressionchannel:"Regression Channel",stddevchannel:"StdDev Channel",andrewspitchfork:"Andrew's Pitchfork",gannline:"Gann Line",gannfan:"Gann Fan",ganngrid:"Gann Grid",circle:"Circle",triangle:"Triangle",ellipse:"Ellipse",equidistantchannel:"Equidistant Channel"},Xm=[10,11,12,14,16,20,24,28,30,40],zn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],si={width:"78%",height:"78%",display:"block"},Vh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Jm(i){return i?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function OA(i,e="#5f8f96"){if(typeof i!="string")return e;const t=i.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const Zm=()=>a.jsx(zm,{style:si}),Ym=()=>a.jsx(Wm,{style:si}),qm=()=>a.jsx(Nm,{style:si}),jm=()=>a.jsx(Vm,{style:si}),ew=()=>a.jsx(Pm,{style:si}),tw=()=>a.jsx(_m,{style:si}),Aw=()=>a.jsx(km,{style:si}),iw=()=>a.jsx(Nh,{style:si}),ea=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function Qr({checked:i,onClick:e,hideLeftBorder:t,tokens:A,children:r,title:n}){return a.jsx("button",{type:"button",onClick:e,title:n,style:{display:"flex",width:30,height:30,alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,borderLeftWidth:t?0:1,background:i?A.activeFill:"transparent",color:i?A.activeText:A.text,cursor:"pointer",padding:0},children:a.jsx(ea,{size:"18px",children:r})})}function Ze({checked:i,onChange:e,label:t,tokens:A,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:i,onChange:n=>e(n.target.checked),disabled:r,style:Vh}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,background:A.fieldBg},children:i&&a.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Nt({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=OA(i,"#5f8f96"),s=(i||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:A?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:u=>e(u.target.value),disabled:A,style:{...Vh,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:u=>{const m=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:A,style:c})]})}function CA({tokens:i,disabled:e=!1,style:t={},...A}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?i.fieldDisabledBg:i.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?i.fieldDisabledBg:i.fieldBg,color:e?i.fieldDisabledText:i.text,...t},...A})}function Qi({value:i,onChange:e,tokens:t,disabled:A=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:i,onChange:e,disabled:A,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${A?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:A?t.fieldDisabledBg:t.fieldBg,color:A?t.fieldDisabledText:t.text,cursor:A?"default":"pointer",opacity:A?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(iw,{})})]})}function rw({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===zn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:zn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(Ze,{checked:A,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:zn.map(s=>a.jsx(Ze,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function nw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,OA(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(Qi,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Xm.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(qm,{})}),a.jsx(Qr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(jm,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(ew,{})}),a.jsx(Qr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(tw,{})}),a.jsx(Qr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(Aw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(Ze,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(Ze,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(Nt,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(CA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.borderEnabled,value:i.borderOpacity??.1,onChange:n=>A("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!i.borderEnabled,value:i.borderWidth??1,onChange:n=>A("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:i.borderWidth??1})]}),a.jsx(Ze,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Nt,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(CA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.bgEnabled,value:i.bgOpacity??.1,onChange:n=>A("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:i.text||"",onChange:n=>A("text",n.target.value),placeholder:"Your text",rows:4,style:{width:"100%",resize:"none",border:`1px solid ${t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text}})]})}function Wn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#22c55e",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(Ze,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(Ze,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ze,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(Ze,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(Ze,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function sw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ze,{checked:i.showArea!==!1,onChange:n=>A("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ze,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function ow({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ze,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(Ze,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(Ze,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function aw({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Fi(i){if(!i)return"";const e=new Date(i*1e3),t=A=>String(A).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function Ui({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point1Time),style:n}),a.jsx(CA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point2Time),style:n}),a.jsx(CA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function zh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,OA(o,l)),n=!i.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:s=>A("lineColor",s),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:s=>A("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ze,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(Ze,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(Nt,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(Qi,{value:i.textHAlign??"center",onChange:s=>A("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(Qi,{value:i.textVAlign??"top",onChange:s=>A("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:i.textContent||"",onChange:s=>A("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function lw({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"Price"}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function cw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.originTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function hw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ze,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function uw({draft:i,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.rawTime),style:t})]})})}function dw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#7aa6ae",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(Ze,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(Ze,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ze,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function pw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#06a0e3",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ze,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(Ze,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function fw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.rawTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Wh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#129f5c",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(Ze,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Nt,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(CA,{tokens:t,value:i.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&A("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(Ze,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Nt,{value:i.pricesColor||"#129f5c",onChange:n=>A("pricesColor",n),onBlur:()=>r("pricesColor",i.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(Ze,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(Ze,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Rh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point1Time),style:n}),a.jsx(CA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point2Time),style:n}),a.jsx(CA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(CA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function gw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||zn.map(t=>t.key)};if(i.type==="trendline"){const t=typeof i.series?.options=="function"?i.series.options():{};return{...e,lineColor:t.color??i.lineColor??"#22c55e",lineWidth:t.lineWidth??i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.point1?.price??0,point1Time:i.point1?.rawTime??i.point1?.time??0,point2Price:i.point2?.price??0,point2Time:i.point2?.rawTime??i.point2?.time??0}}return i.type==="text"?{...e,text:i.primitive?.text??i.text??"Text",color:i.primitive?.color??"#5f8f96",fontSize:i.primitive?.fontSize??12,fontWeight:i.primitive?.fontWeight??"normal",fontStyle:i.primitive?.fontStyle??"normal",textAlign:i.primitive?.textAlign??"center",textWrap:i.primitive?.textWrap??!1,borderEnabled:i.primitive?.borderEnabled??!1,borderColor:i.primitive?.borderColor??"#5f8f96",borderOpacity:i.primitive?.borderOpacity??.1,borderWidth:i.primitive?.borderWidth??1,bgEnabled:i.primitive?.bgEnabled??!1,bgColor:i.primitive?.bgColor??"#5f8f96",bgOpacity:i.primitive?.bgOpacity??.1,price:i.price}:i.type==="pricelevel"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price}:i.type==="horizontalray"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price,originTime:i.rawOriginTime??i.originTime}:i.type==="verticalline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showDate:i.showDate!==!1,rawTime:i.rawTime}:i.type==="infoline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!0,statsPriceRange:i.statsPriceRange??!0,statsBarsRange:i.statsBarsRange??!0,statsDateRange:i.statsDateRange??!0,statsAngle:i.statsAngle??!0,statsDistance:i.statsDistance??!0,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="arrowedline"?{...e,lineColor:i.lineColor??"#f59e0b",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight!==!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="rayline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="extendedline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft!==!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="crossline"?{...e,lineColor:i.lineColor??"#06a0e3",lineWidth:i.lineWidth??2,showTime:i.showTime??!1,showPrice:i.showPrice??!1,rawTime:i.p?.rawTime??0,price:i.p?.price??0}:i.type==="trendbyangle"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="disjointchannel"?{...e,lineColor:i.lineColor??"#129f5c",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#6aa84f",fillOpacity:i.fillOpacity??.1,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#129f5c",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="flattopbottom"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#3b82f6",fillOpacity:i.fillOpacity??.12,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#3b82f6",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="rulerline"?{...e,lineColor:i.lineColor??"#3b82f6",showArea:i.showArea!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways!==!1,statsPriceRange:i.statsPriceRange!==!1,statsBarsRange:i.statsBarsRange!==!1,statsDateRange:i.statsDateRange!==!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:e}const Gh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Vt(),s=Jm(r==="light"),[o,l]=q.useState("style"),[c,u]=q.useState({}),[m,y]=q.useState(null),v=q.useRef(null),T=q.useRef(null);q.useEffect(()=>{t&&(u(gw(t)),l("style"))},[t]),q.useEffect(()=>{i||y(null)},[i]);const C=M=>{if(M.button!==0)return;M.preventDefault();const z=v.current;if(!z)return;const ne=z.offsetParent,$=ne?ne.getBoundingClientRect():{left:0,top:0},V=z.getBoundingClientRect(),Ae=V.left-$.left,re=V.top-$.top;T.current={startMX:M.clientX,startMY:M.clientY,startX:Ae,startY:re},y({x:Ae,y:re});const he=te=>{const{startMX:ae,startMY:ce,startX:se,startY:le}=T.current;y({x:se+te.clientX-ae,y:le+te.clientY-ce})},Z=()=>{T.current=null,document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Z)};document.addEventListener("mousemove",he),document.addEventListener("mouseup",Z)};if(!i||!t)return null;const U=$m[t.type]||t.type,F=["style","coordinates","visualization"],E=()=>{if(o==="visualization")return a.jsx(rw,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(nw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(aw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(lw,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(cw,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(hw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(uw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(ow,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(sw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(pw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(fw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(dw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Wh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Rh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Wh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Rh,{draft:c,setDraft:u,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},N=()=>{A(c),e()};return a.jsxs("div",{ref:v,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...m===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:m.y,left:m.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:C,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(ea,{size:"18px",children:a.jsx(Zm,{})})})]})}),a.jsx("button",{type:"button",onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",background:s.headerBlue,color:s.headerText,border:"none",cursor:"pointer"},children:a.jsx(ea,{size:"20px",children:a.jsx(Ym,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(M=>{const z=o===M;return a.jsxs("button",{type:"button",onClick:()=>l(M),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:z?s.text:s.mutedText,cursor:"pointer"},children:[M.charAt(0).toUpperCase()+M.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},M)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:E()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:N,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var ta=function(i,e){return ta=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(t[r]=A[r])},ta(i,e)};function LA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ta(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Aa=function(){return Aa=Object.assign||function(e){for(var t,A=1,r=arguments.length;A<r;A++){t=arguments[A];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Aa.apply(this,arguments)};function tA(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(u){try{c(A.next(u))}catch(m){s(m)}}function l(u){try{c(A.throw(u))}catch(m){s(m)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Jt(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},A,r,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(u){return l([c,u])}}function l(c){if(A)throw new TypeError("Generator is already executing.");for(;t;)try{if(A=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(u){c=[6,u],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Rn(i,e,t){if(arguments.length===2)for(var A=0,r=e.length,n;A<r;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return i.concat(n||e)}for(var jA=(function(){function i(e,t,A,r){this.left=e,this.top=t,this.width=A,this.height=r}return i.prototype.add=function(e,t,A,r){return new i(this.left+e,this.top+t,this.width+A,this.height+r)},i.fromClientRect=function(e,t){return new i(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},i.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(r){return r.width!==0});return A?new i(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):i.EMPTY},i.EMPTY=new i(0,0,0,0),i})(),Gn=function(i,e){return jA.fromClientRect(i,e.getBoundingClientRect())},mw=function(i){var e=i.body,t=i.documentElement;if(!e||!t)throw new Error("Unable to get document size");var A=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new jA(0,0,A,r)},$n=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},Ht=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},$h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ww=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<$h.length;Xn++)ww[$h.charCodeAt(Xn)]=Xn;for(var Xh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Jn=0;Jn<Xh.length;Jn++)Fr[Xh.charCodeAt(Jn)]=Jn;for(var Bw=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Fr[i.charCodeAt(A)],s=Fr[i.charCodeAt(A+1)],o=Fr[i.charCodeAt(A+2)],l=Fr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},yw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Cw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Si=5,ia=11,ra=2,vw=ia-Si,Jh=65536>>Si,Tw=1<<Si,na=Tw-1,xw=1024>>Si,bw=Jh+xw,Qw=bw,Fw=32,Uw=Qw+Fw,Sw=65536>>ia,Ew=1<<vw,Lw=Ew-1,Zh=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Mw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Hw=function(i,e){var t=Bw(i),A=Array.isArray(t)?Cw(t):new Uint32Array(t),r=Array.isArray(t)?yw(t):new Uint16Array(t),n=24,s=Zh(r,n/2,A[4]/2),o=A[5]===2?Zh(r,(n+A[4])/2):Mw(A,Math.ceil((n+A[4])/4));return new Iw(A[0],A[1],A[2],A[3],s,o)},Iw=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Si],t=(t<<ra)+(e&na),this.data[t];if(e<=65535)return t=this.index[Jh+(e-55296>>Si)],t=(t<<ra)+(e&na),this.data[t];if(e<this.highStart)return t=Uw-Sw+(e>>ia),t=this.index[t],t+=e>>Si&Lw,t=this.index[t],t=(t<<ra)+(e&na),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Yh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<Yh.length;Zn++)Dw[Yh.charCodeAt(Zn)]=Zn;var _w="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",qh=50,Pw=1,jh=2,eu=3,kw=4,Nw=5,tu=7,Au=8,iu=9,oi=10,sa=11,ru=12,oa=13,Ow=14,Ur=15,aa=16,Yn=17,Sr=18,Kw=19,nu=20,la=21,Er=22,ca=23,Wi=24,pA=25,Lr=26,Mr=27,Ri=28,Vw=29,Ei=30,zw=31,qn=32,jn=33,ha=34,ua=35,da=36,Hr=37,pa=38,es=39,ts=40,fa=41,su=42,Ww=43,Rw=[9001,65288],ou="!",lt="×",As="÷",ga=Hw(_w),ei=[Ei,da],ma=[Pw,jh,eu,Nw],au=[oi,Au],lu=[Mr,Lr],Gw=ma.concat(au),cu=[pa,es,ts,ha,ua],$w=[Ur,oa],Xw=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ga.get(n);if(o>qh?(r.push(!0),o-=qh):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(aa);if(o===kw||o===sa){if(s===0)return A.push(s),t.push(Ei);var l=t[s-1];return Gw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(Ei))}if(A.push(s),o===zw)return t.push(e==="strict"?la:Hr);if(o===su||o===Vw)return t.push(Ei);if(o===Ww)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Hr):t.push(Ei);t.push(o)}),[A,t,r]},wa=function(i,e,t,A){var r=A[t];if(Array.isArray(i)?i.indexOf(r)!==-1:i===r)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==oi)break}if(r===oi)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(i)?i.indexOf(o)!==-1:i===o)for(var l=t;l<=A.length;){l++;var s=A[l];if(s===e)return!0;if(s!==oi)break}if(o!==oi)break}return!1},hu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===oi)t--;else return A}return 0},Jw=function(i,e,t,A,r){if(t[A]===0)return lt;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return lt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===jh&&u===eu)return lt;if(ma.indexOf(l)!==-1)return ou;if(ma.indexOf(u)!==-1||au.indexOf(u)!==-1)return lt;if(hu(n,e)===Au)return As;if(ga.get(i[n])===sa||(l===qn||l===jn)&&ga.get(i[o])===sa||l===tu||u===tu||l===iu||[oi,oa,Ur].indexOf(l)===-1&&u===iu||[Yn,Sr,Kw,Wi,Ri].indexOf(u)!==-1||hu(n,e)===Er||wa(ca,Er,n,e)||wa([Yn,Sr],la,n,e)||wa(ru,ru,n,e))return lt;if(l===oi)return As;if(l===ca||u===ca)return lt;if(u===aa||l===aa)return As;if([oa,Ur,la].indexOf(u)!==-1||l===Ow||c===da&&$w.indexOf(l)!==-1||l===Ri&&u===da||u===nu||ei.indexOf(u)!==-1&&l===pA||ei.indexOf(l)!==-1&&u===pA||l===Mr&&[Hr,qn,jn].indexOf(u)!==-1||[Hr,qn,jn].indexOf(l)!==-1&&u===Lr||ei.indexOf(l)!==-1&&lu.indexOf(u)!==-1||lu.indexOf(l)!==-1&&ei.indexOf(u)!==-1||[Mr,Lr].indexOf(l)!==-1&&(u===pA||[Er,Ur].indexOf(u)!==-1&&e[o+1]===pA)||[Er,Ur].indexOf(l)!==-1&&u===pA||l===pA&&[pA,Ri,Wi].indexOf(u)!==-1)return lt;if([pA,Ri,Wi,Yn,Sr].indexOf(u)!==-1)for(var m=n;m>=0;){var y=e[m];if(y===pA)return lt;if([Ri,Wi].indexOf(y)!==-1)m--;else break}if([Mr,Lr].indexOf(u)!==-1)for(var m=[Yn,Sr].indexOf(l)!==-1?s:n;m>=0;){var y=e[m];if(y===pA)return lt;if([Ri,Wi].indexOf(y)!==-1)m--;else break}if(pa===l&&[pa,es,ha,ua].indexOf(u)!==-1||[es,ha].indexOf(l)!==-1&&[es,ts].indexOf(u)!==-1||[ts,ua].indexOf(l)!==-1&&u===ts||cu.indexOf(l)!==-1&&[nu,Lr].indexOf(u)!==-1||cu.indexOf(u)!==-1&&l===Mr||ei.indexOf(l)!==-1&&ei.indexOf(u)!==-1||l===Wi&&ei.indexOf(u)!==-1||ei.concat(pA).indexOf(l)!==-1&&u===Er&&Rw.indexOf(i[o])===-1||ei.concat(pA).indexOf(u)!==-1&&l===Sr)return lt;if(l===fa&&u===fa){for(var v=t[n],T=1;v>0&&(v--,e[v]===fa);)T++;if(T%2!==0)return lt}return l===qn&&u===jn?lt:As},Zw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Xw(i,e.lineBreak),A=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[pA,Ei,su].indexOf(o)!==-1?Hr:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&i[l]>=19968&&i[l]<=40959}):void 0;return[A,r,s]},Yw=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===ou,this.start=A,this.end=r}return i.prototype.slice=function(){return Ht.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),qw=function(i,e){var t=$n(i),A=Zw(t,e),r=A[0],n=A[1],s=A[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var u=lt;c<o&&(u=Jw(t,n,r,++c,s))===lt;);if(u!==lt||c===o){var m=new Yw(t,u,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},jw=1,eB=2,Ir=4,uu=8,is=10,du=47,Dr=92,tB=9,AB=32,rs=34,_r=61,iB=35,rB=36,nB=37,ns=39,ss=40,Pr=41,sB=95,oA=45,oB=33,aB=60,lB=62,cB=64,hB=91,uB=93,dB=61,pB=123,os=63,fB=125,pu=124,gB=126,mB=128,fu=65533,Ba=42,Li=43,wB=44,BB=58,yB=59,kr=46,CB=0,vB=8,TB=11,xB=14,bB=31,QB=127,KA=-1,gu=48,mu=97,wu=101,FB=102,UB=117,SB=122,Bu=65,yu=69,Cu=70,EB=85,LB=90,Zt=function(i){return i>=gu&&i<=57},MB=function(i){return i>=55296&&i<=57343},Gi=function(i){return Zt(i)||i>=Bu&&i<=Cu||i>=mu&&i<=FB},HB=function(i){return i>=mu&&i<=SB},IB=function(i){return i>=Bu&&i<=LB},DB=function(i){return HB(i)||IB(i)},_B=function(i){return i>=mB},as=function(i){return i===is||i===tB||i===AB},ls=function(i){return DB(i)||_B(i)||i===sB},vu=function(i){return ls(i)||Zt(i)||i===oA},PB=function(i){return i>=CB&&i<=vB||i===TB||i>=xB&&i<=bB||i===QB},ai=function(i,e){return i!==Dr?!1:e!==is},cs=function(i,e,t){return i===oA?ls(e)||ai(e,t):ls(i)?!0:!!(i===Dr&&ai(i,e))},ya=function(i,e,t){return i===Li||i===oA?Zt(e)?!0:e===kr&&Zt(t):Zt(i===kr?e:i)},kB=function(i){var e=0,t=1;(i[e]===Li||i[e]===oA)&&(i[e]===oA&&(t=-1),e++);for(var A=[];Zt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Ht.apply(void 0,A),10):0;i[e]===kr&&e++;for(var n=[];Zt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Ht.apply(void 0,n),10):0;(i[e]===yu||i[e]===wu)&&e++;var l=1;(i[e]===Li||i[e]===oA)&&(i[e]===oA&&(l=-1),e++);for(var c=[];Zt(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Ht.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},NB={type:2},OB={type:3},KB={type:4},VB={type:13},zB={type:8},WB={type:21},RB={type:9},GB={type:10},$B={type:11},XB={type:12},JB={type:14},hs={type:23},ZB={type:1},YB={type:25},qB={type:24},jB={type:26},e2={type:27},t2={type:28},A2={type:29},i2={type:31},Ca={type:32},Tu=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat($n(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ca;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case rs:return this.consumeStringToken(rs);case iB:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(vu(t)||ai(A,r)){var n=cs(t,A,r)?eB:jw,s=this.consumeName();return{type:5,value:s,flags:n}}break;case rB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),VB;break;case ns:return this.consumeStringToken(ns);case ss:return NB;case Pr:return OB;case Ba:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),JB;break;case Li:if(ya(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case wB:return KB;case oA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(ya(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(cs(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===oA&&c===lB)return this.consumeCodePoint(),this.consumeCodePoint(),qB;break;case kr:if(ya(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case du:if(this.peekCodePoint(0)===Ba)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===Ba&&(u=this.consumeCodePoint(),u===du))return this.consumeToken();if(u===KA)return this.consumeToken()}break;case BB:return jB;case yB:return e2;case aB:if(this.peekCodePoint(0)===oB&&this.peekCodePoint(1)===oA&&this.peekCodePoint(2)===oA)return this.consumeCodePoint(),this.consumeCodePoint(),YB;break;case cB:var m=this.peekCodePoint(0),y=this.peekCodePoint(1),v=this.peekCodePoint(2);if(cs(m,y,v)){var s=this.consumeName();return{type:7,value:s}}break;case hB:return t2;case Dr:if(ai(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case uB:return A2;case dB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),zB;break;case pB:return $B;case fB:return XB;case UB:case EB:var T=this.peekCodePoint(0),C=this.peekCodePoint(1);return T===Li&&(Gi(C)||C===os)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case pu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),RB;if(this.peekCodePoint(0)===pu)return this.consumeCodePoint(),WB;break;case gB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),GB;break;case KA:return Ca}return as(e)?(this.consumeWhiteSpace(),i2):Zt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ls(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ht(e)}},i.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},i.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},i.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},i.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Gi(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===os&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Ht.apply(void 0,e.map(function(l){return l===os?gu:l})),16),n=parseInt(Ht.apply(void 0,e.map(function(l){return l===os?Cu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Ht.apply(void 0,e),16);if(this.peekCodePoint(0)===oA&&Gi(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Gi(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Ht.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},i.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ss?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ss?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===KA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ns||t===rs){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===KA||this.peekCodePoint(0)===Pr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),hs)}for(;;){var r=this.consumeCodePoint();if(r===KA||r===Pr)return{type:22,value:Ht.apply(void 0,e)};if(as(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===KA||this.peekCodePoint(0)===Pr?(this.consumeCodePoint(),{type:22,value:Ht.apply(void 0,e)}):(this.consumeBadUrlRemnants(),hs);if(r===rs||r===ns||r===ss||PB(r))return this.consumeBadUrlRemnants(),hs;if(r===Dr)if(ai(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),hs;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;as(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Pr||e===KA)return;ai(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},i.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var r=Math.min(t,e);A+=Ht.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),A},i.prototype.consumeStringToken=function(e){var t="",A=0;do{var r=this._value[A];if(r===KA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===is)return this._value.splice(0,A),ZB;if(r===Dr){var n=this._value[A+1];n!==KA&&n!==void 0&&(n===is?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):ai(r,n)&&(t+=this.consumeStringSlice(A),t+=Ht(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Ir,A=this.peekCodePoint(0);for((A===Li||A===oA)&&e.push(this.consumeCodePoint());Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===kr&&Zt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=uu;Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===yu||A===wu)&&((r===Li||r===oA)&&Zt(n)||Zt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=uu;Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[kB(e),t]},i.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(cs(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===nB?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Gi(e)){for(var t=Ht(e);Gi(this.peekCodePoint(0))&&t.length<6;)t+=Ht(this.consumeCodePoint());as(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||MB(A)||A>1114111?fu:A}return e===KA?fu:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(vu(t))e+=Ht(t);else if(ai(t,this.peekCodePoint(0)))e+=Ht(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),xu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new Tu;return t.write(e),new i(t.read())},i.parseValue=function(e){return i.create(e).parseComponentValue()},i.parseValues=function(e){return i.create(e).parseComponentValues()},i.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},i.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},i.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},i.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},A=this.consumeToken();;){if(A.type===32||n2(A,e))return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue()),A=this.consumeToken()}},i.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var A=this.consumeToken();if(A.type===32||A.type===3)return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue())}},i.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Ca:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),Nr=function(i){return i.type===15},$i=function(i){return i.type===17},mt=function(i){return i.type===20},r2=function(i){return i.type===0},va=function(i,e){return mt(i)&&i.value===e},bu=function(i){return i.type!==31},Xi=function(i){return i.type!==31&&i.type!==4},VA=function(i){var e=[],t=[];return i.forEach(function(A){if(A.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}A.type!==31&&t.push(A)}),t.length&&e.push(t),e},n2=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},li=function(i){return i.type===17||i.type===15},Pt=function(i){return i.type===16||li(i)},Qu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},zt={type:17,number:0,flags:Ir},Ta={type:16,number:50,flags:Ir},ci={type:16,number:100,flags:Ir},Or=function(i,e,t){var A=i[0],r=i[1];return[vt(A,e),vt(typeof r<"u"?r:A,t)]},vt=function(i,e){if(i.type===16)return i.number/100*e;if(Nr(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},Fu="deg",Uu="grad",Su="rad",Eu="turn",us={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case Fu:return Math.PI*e.number/180;case Uu:return Math.PI/200*e.number;case Su:return e.number;case Eu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Lu=function(i){return i.type===15&&(i.unit===Fu||i.unit===Uu||i.unit===Su||i.unit===Eu)},Mu=function(i){var e=i.filter(mt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[zt,zt];case"to top":case"bottom":return vA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[zt,ci];case"to right":case"left":return vA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ci,ci];case"to bottom":case"top":return vA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ci,zt];case"to left":case"right":return vA(270)}return 0},vA=function(i){return Math.PI*i/180},hi={name:"color",parse:function(i,e){if(e.type===18){var t=s2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(i,e.values)}if(e.type===5){if(e.value.length===3){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return di(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return di(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return di(parseInt(A,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return di(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ti[e.value.toUpperCase()];if(typeof o<"u")return o}return ti.TRANSPARENT}},ui=function(i){return(255&i)===0},Ot=function(i){var e=255&i,t=255&i>>8,A=255&i>>16,r=255&i>>24;return e<255?"rgba("+r+","+A+","+t+","+e/255+")":"rgb("+r+","+A+","+t+")"},di=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},Hu=function(i,e){if(i.type===17)return i.number;if(i.type===16){var t=e===3?1:255;return e===3?i.number/100*t:Math.round(i.number/100*t)}return 0},Iu=function(i,e){var t=e.filter(Xi);if(t.length===3){var A=t.map(Hu),r=A[0],n=A[1],s=A[2];return di(r,n,s,1)}if(t.length===4){var o=t.map(Hu),r=o[0],n=o[1],s=o[2],l=o[3];return di(r,n,s,l)}return 0};function xa(i,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-i)*t*6+i:t<1/2?e:t<2/3?(e-i)*6*(2/3-t)+i:i}var Du=function(i,e){var t=e.filter(Xi),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?vA(A.number):us.parse(i,A))/(Math.PI*2),l=Pt(r)?r.number/100:0,c=Pt(n)?n.number/100:0,u=typeof s<"u"&&Pt(s)?vt(s,1):1;if(l===0)return di(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,y=c*2-m,v=xa(y,m,o+1/3),T=xa(y,m,o),C=xa(y,m,o-1/3);return di(v*255,T*255,C*255,u)},s2={hsl:Du,hsla:Du,rgb:Iu,rgba:Iu},Kr=function(i,e){return hi.parse(i,xu.create(e).parseComponentValue())},ti={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},o2={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(mt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},a2={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ds=function(i,e){var t=hi.parse(i,e[0]),A=e[1];return A&&Pt(A)?{color:t,stop:A}:{color:t,stop:null}},_u=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=zt),A.stop===null&&(A.stop=ci);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=vt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,y=r[c-1],v=(u-y)/(m+1),T=1;T<=m;T++)r[c+T-1]=v*T;c=null}}return i.map(function(C,U){var F=C.color;return{color:F,stop:Math.max(Math.min(1,r[U]/e),0)}})},l2=function(i,e,t){var A=e/2,r=t/2,n=vt(i[0],e)-A,s=r-vt(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},c2=function(i,e,t){var A=typeof i=="number"?i:l2(i,e,t),r=Math.abs(e*Math.sin(A))+Math.abs(t*Math.cos(A)),n=e/2,s=t/2,o=r/2,l=Math.sin(A-Math.PI/2)*o,c=Math.cos(A-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},MA=function(i,e){return Math.sqrt(i*i+e*e)},Pu=function(i,e,t,A,r){var n=[[0,0],[0,e],[i,0],[i,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],u=MA(t-l,A-c);return(r?u<s.optimumDistance:u>s.optimumDistance)?{optimumCorner:o,optimumDistance:u}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},h2=function(i,e,t,A,r){var n=0,s=0;switch(i.size){case 0:i.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-A)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(i.shape===0)n=s=Math.min(MA(e,t),MA(e,t-r),MA(e-A,t),MA(e-A,t-r));else if(i.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-A)),l=Pu(A,r,e,t,!0),c=l[0],u=l[1];n=MA(c-e,(u-t)/o),s=o*n}break;case 1:i.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-A)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(i.shape===0)n=s=Math.max(MA(e,t),MA(e,t-r),MA(e-A,t),MA(e-A,t-r));else if(i.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-A)),m=Pu(A,r,e,t,!1),c=m[0],u=m[1];n=MA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=vt(i.size[0],A),s=i.size.length===2?vt(i.size[1],r):n),[n,s]},u2=function(i,e){var t=vA(180),A=[];return VA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Mu(r);return}else if(Lu(s)){t=us.parse(i,s);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},ps=function(i,e){var t=vA(180),A=[];return VA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=Mu(r);return}else if(Lu(s)){t=(us.parse(i,s)+vA(270))%vA(360);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},d2=function(i,e){var t=vA(180),A=[],r=1,n=0,s=3,o=[];return VA(e).forEach(function(l,c){var u=l[0];if(c===0){if(mt(u)&&u.value==="linear"){r=1;return}else if(mt(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var m=hi.parse(i,u.values[0]);A.push({stop:zt,color:m})}else if(u.name==="to"){var m=hi.parse(i,u.values[0]);A.push({stop:ci,color:m})}else if(u.name==="color-stop"){var y=u.values.filter(Xi);if(y.length===2){var m=hi.parse(i,y[1]),v=y[0];$i(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:m})}}}}),r===1?{angle:(t+vA(180))%vA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},ku="closest-side",Nu="farthest-side",Ou="closest-corner",Ku="farthest-corner",Vu="circle",zu="ellipse",Wu="cover",Ru="contain",p2=function(i,e){var t=0,A=3,r=[],n=[];return VA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,y){if(c)if(mt(y))switch(y.value){case"center":return n.push(Ta),m;case"top":case"left":return n.push(zt),m;case"right":case"bottom":return n.push(ci),m}else(Pt(y)||li(y))&&n.push(y);else if(mt(y))switch(y.value){case Vu:return t=0,!1;case zu:return t=1,!1;case"at":return c=!0,!1;case ku:return A=0,!1;case Wu:case Nu:return A=1,!1;case Ru:case Ou:return A=2,!1;case Ku:return A=3,!1}else if(li(y)||Pt(y))return Array.isArray(A)||(A=[]),A.push(y),!1;return m},l)}if(l){var u=ds(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},fs=function(i,e){var t=0,A=3,r=[],n=[];return VA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,m){if(mt(m))switch(m.value){case"center":return n.push(Ta),!1;case"top":case"left":return n.push(zt),!1;case"right":case"bottom":return n.push(ci),!1}else if(Pt(m)||li(m))return n.push(m),!1;return u},l):o===1&&(l=s.reduce(function(u,m){if(mt(m))switch(m.value){case Vu:return t=0,!1;case zu:return t=1,!1;case Ru:case ku:return A=0,!1;case Nu:return A=1,!1;case Ou:return A=2,!1;case Wu:case Ku:return A=3,!1}else if(li(m)||Pt(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return u},l)),l){var c=ds(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},f2=function(i){return i.type===1},g2=function(i){return i.type===2},ba={name:"image",parse:function(i,e){if(e.type===22){var t={url:e.value,type:0};return i.cache.addImage(e.value),t}if(e.type===18){var A=Gu[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return A(i,e.values)}throw new Error("Unsupported image type "+e.type)}};function m2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Gu[i.name])}var Gu={"linear-gradient":u2,"-moz-linear-gradient":ps,"-ms-linear-gradient":ps,"-o-linear-gradient":ps,"-webkit-linear-gradient":ps,"radial-gradient":p2,"-moz-radial-gradient":fs,"-ms-radial-gradient":fs,"-o-radial-gradient":fs,"-webkit-radial-gradient":fs,"-webkit-gradient":d2},w2={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(A){return Xi(A)&&m2(A)}).map(function(A){return ba.parse(i,A)})}},B2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(mt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},y2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return VA(e).map(function(t){return t.filter(Pt)}).map(Qu)}},C2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return VA(e).map(function(t){return t.filter(mt).map(function(A){return A.value}).join(" ")}).map(v2)}},v2=function(i){switch(i){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},Ji;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Ji||(Ji={}));var T2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return VA(e).map(function(t){return t.filter(x2)})}},x2=function(i){return mt(i)||Pt(i)},gs=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},b2=gs("top"),Q2=gs("right"),F2=gs("bottom"),U2=gs("left"),ms=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Qu(t.filter(Pt))}}},S2=ms("top-left"),E2=ms("top-right"),L2=ms("bottom-right"),M2=ms("bottom-left"),ws=function(i){return{name:"border-"+i+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},H2=ws("top"),I2=ws("right"),D2=ws("bottom"),_2=ws("left"),Bs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Nr(t)?t.number:0}}},P2=Bs("top"),k2=Bs("right"),N2=Bs("bottom"),O2=Bs("left"),K2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},V2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},z2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(mt).reduce(function(t,A){return t|W2(A.value)},0)}},W2=function(i){switch(i){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},R2={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},G2={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(i,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},ys;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ys||(ys={}));var $2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ys.STRICT:ys.NORMAL}},X2={name:"line-height",initialValue:"normal",prefix:!1,type:4},$u=function(i,e){return mt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Pt(i)?vt(i,e):e},J2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:ba.parse(i,e)}},Z2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},Qa={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Cs=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},Y2=Cs("top"),q2=Cs("right"),j2=Cs("bottom"),ey=Cs("left"),ty={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(mt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},Ay={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},vs=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},iy=vs("top"),ry=vs("right"),ny=vs("bottom"),sy=vs("left"),oy={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(i,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},ay={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(i,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},ly={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&va(e[0],"none")?[]:VA(e).map(function(t){for(var A={color:ti.TRANSPARENT,offsetX:zt,offsetY:zt,blur:zt},r=0,n=0;n<t.length;n++){var s=t[n];li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=hi.parse(i,s)}return A})}},cy={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},hy={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(i,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=py[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},uy=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},dy=function(i){var e=i.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],A=e[1];e[2],e[3];var r=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,A,r,n,s,o]:null},py={matrix:uy,matrix3d:dy},Xu={type:16,number:50,flags:Ir},fy=[Xu,Xu],gy={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Pt);return t.length!==2?fy:[t[0],t[1]]}},my={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Vr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var wy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},By={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if($i(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Ju={name:"time",parse:function(i,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},yy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return $i(e)?e.number:1}},Cy={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},vy={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(mt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},Ty={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(i,e){var t=[],A=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:A.push(t.join(" ")),t.length=0;break}}),t.length&&A.push(t.join(" ")),A.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},xy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},by={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return $i(e)?e.number:mt(e)&&e.value==="bold"?700:400}},Qy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(mt).map(function(t){return t.value})}},Fy={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},kt=function(i,e){return(i&e)!==0},Uy={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},Sy={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var A=[],r=e.filter(bu),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&$i(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},Ey={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(bu),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(mt(n)&&n.value!=="none"){var o=s&&$i(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},Ly={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(Nr).map(function(t){return Ju.parse(i,t)})}},My={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var A=[],r=e.filter(r2);if(r.length%2!==0)return null;for(var n=0;n<r.length;n+=2){var s=r[n].value,o=r[n+1].value;A.push({open:s,close:o})}return A}},Zu=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},Hy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&va(e[0],"none")?[]:VA(e).map(function(t){for(var A={color:255,offsetX:zt,offsetY:zt,blur:zt,spread:zt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];va(s,"inset")?A.inset=!0:li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=hi.parse(i,s)}return A})}},Iy={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(mt).forEach(function(r){switch(r.value){case"stroke":A.push(1);break;case"fill":A.push(0);break;case"markers":A.push(2);break}}),t.forEach(function(r){A.indexOf(r)===-1&&A.push(r)}),A}},Dy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},_y={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return Nr(e)?e.number:0}},Py=(function(){function i(e,t){var A,r;this.animationDuration=He(e,Ly,t.animationDuration),this.backgroundClip=He(e,o2,t.backgroundClip),this.backgroundColor=He(e,a2,t.backgroundColor),this.backgroundImage=He(e,w2,t.backgroundImage),this.backgroundOrigin=He(e,B2,t.backgroundOrigin),this.backgroundPosition=He(e,y2,t.backgroundPosition),this.backgroundRepeat=He(e,C2,t.backgroundRepeat),this.backgroundSize=He(e,T2,t.backgroundSize),this.borderTopColor=He(e,b2,t.borderTopColor),this.borderRightColor=He(e,Q2,t.borderRightColor),this.borderBottomColor=He(e,F2,t.borderBottomColor),this.borderLeftColor=He(e,U2,t.borderLeftColor),this.borderTopLeftRadius=He(e,S2,t.borderTopLeftRadius),this.borderTopRightRadius=He(e,E2,t.borderTopRightRadius),this.borderBottomRightRadius=He(e,L2,t.borderBottomRightRadius),this.borderBottomLeftRadius=He(e,M2,t.borderBottomLeftRadius),this.borderTopStyle=He(e,H2,t.borderTopStyle),this.borderRightStyle=He(e,I2,t.borderRightStyle),this.borderBottomStyle=He(e,D2,t.borderBottomStyle),this.borderLeftStyle=He(e,_2,t.borderLeftStyle),this.borderTopWidth=He(e,P2,t.borderTopWidth),this.borderRightWidth=He(e,k2,t.borderRightWidth),this.borderBottomWidth=He(e,N2,t.borderBottomWidth),this.borderLeftWidth=He(e,O2,t.borderLeftWidth),this.boxShadow=He(e,Hy,t.boxShadow),this.color=He(e,K2,t.color),this.direction=He(e,V2,t.direction),this.display=He(e,z2,t.display),this.float=He(e,R2,t.cssFloat),this.fontFamily=He(e,Ty,t.fontFamily),this.fontSize=He(e,xy,t.fontSize),this.fontStyle=He(e,Fy,t.fontStyle),this.fontVariant=He(e,Qy,t.fontVariant),this.fontWeight=He(e,by,t.fontWeight),this.letterSpacing=He(e,G2,t.letterSpacing),this.lineBreak=He(e,$2,t.lineBreak),this.lineHeight=He(e,X2,t.lineHeight),this.listStyleImage=He(e,J2,t.listStyleImage),this.listStylePosition=He(e,Z2,t.listStylePosition),this.listStyleType=He(e,Qa,t.listStyleType),this.marginTop=He(e,Y2,t.marginTop),this.marginRight=He(e,q2,t.marginRight),this.marginBottom=He(e,j2,t.marginBottom),this.marginLeft=He(e,ey,t.marginLeft),this.opacity=He(e,yy,t.opacity);var n=He(e,ty,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=He(e,Ay,t.overflowWrap),this.paddingTop=He(e,iy,t.paddingTop),this.paddingRight=He(e,ry,t.paddingRight),this.paddingBottom=He(e,ny,t.paddingBottom),this.paddingLeft=He(e,sy,t.paddingLeft),this.paintOrder=He(e,Iy,t.paintOrder),this.position=He(e,ay,t.position),this.textAlign=He(e,oy,t.textAlign),this.textDecorationColor=He(e,Cy,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=He(e,vy,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=He(e,ly,t.textShadow),this.textTransform=He(e,cy,t.textTransform),this.transform=He(e,hy,t.transform),this.transformOrigin=He(e,gy,t.transformOrigin),this.visibility=He(e,my,t.visibility),this.webkitTextStrokeColor=He(e,Dy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=He(e,_y,t.webkitTextStrokeWidth),this.wordBreak=He(e,wy,t.wordBreak),this.zIndex=He(e,By,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return ui(this.backgroundColor)},i.prototype.isTransformed=function(){return this.transform!==null},i.prototype.isPositioned=function(){return this.position!==0},i.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},i.prototype.isFloating=function(){return this.float!==0},i.prototype.isInlineLevel=function(){return kt(this.display,4)||kt(this.display,33554432)||kt(this.display,268435456)||kt(this.display,536870912)||kt(this.display,67108864)||kt(this.display,134217728)},i})(),ky=(function(){function i(e,t){this.content=He(e,Uy,t.content),this.quotes=He(e,My,t.quotes)}return i})(),Yu=(function(){function i(e,t){this.counterIncrement=He(e,Sy,t.counterIncrement),this.counterReset=He(e,Ey,t.counterReset)}return i})(),He=function(i,e,t){var A=new Tu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new xu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,mt(s)?s.value:e.initialValue);case 0:return e.parse(i,n.parseComponentValue());case 1:return e.parse(i,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return us.parse(i,n.parseComponentValue());case"color":return hi.parse(i,n.parseComponentValue());case"image":return ba.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return li(o)?o:zt;case"length-percentage":var l=n.parseComponentValue();return Pt(l)?l:zt;case"time":return Ju.parse(i,n.parseComponentValue())}break}},Ny="data-html2canvas-debug",Oy=function(i){var e=i.getAttribute(Ny);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Fa=function(i,e){var t=Oy(i);return t===1||e===t},zA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Fa(t,3))debugger;this.styles=new Py(e,window.getComputedStyle(t,null)),Ka(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Gn(this.context,t),Fa(t,4)&&(this.flags|=16)}return i})(),Ky="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",qu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<qu.length;Ts++)zr[qu.charCodeAt(Ts)]=Ts;for(var Vy=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=zr[i.charCodeAt(A)],s=zr[i.charCodeAt(A+1)],o=zr[i.charCodeAt(A+2)],l=zr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},zy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Wy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Mi=5,Ua=11,Sa=2,Ry=Ua-Mi,ju=65536>>Mi,Gy=1<<Mi,Ea=Gy-1,$y=1024>>Mi,Xy=ju+$y,Jy=Xy,Zy=32,Yy=Jy+Zy,qy=65536>>Ua,jy=1<<Ry,eC=jy-1,ed=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},tC=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},AC=function(i,e){var t=Vy(i),A=Array.isArray(t)?Wy(t):new Uint32Array(t),r=Array.isArray(t)?zy(t):new Uint16Array(t),n=24,s=ed(r,n/2,A[4]/2),o=A[5]===2?ed(r,(n+A[4])/2):tC(A,Math.ceil((n+A[4])/4));return new iC(A[0],A[1],A[2],A[3],s,o)},iC=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mi],t=(t<<Sa)+(e&Ea),this.data[t];if(e<=65535)return t=this.index[ju+(e-55296>>Mi)],t=(t<<Sa)+(e&Ea),this.data[t];if(e<this.highStart)return t=Yy-qy+(e>>Ua),t=this.index[t],t+=e>>Mi&eC,t=this.index[t],t=(t<<Sa)+(e&Ea),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rC=typeof Uint8Array>"u"?[]:new Uint8Array(256),xs=0;xs<td.length;xs++)rC[td.charCodeAt(xs)]=xs;var nC=1,La=2,Ma=3,Ad=4,id=5,sC=7,rd=8,Ha=9,Ia=10,nd=11,sd=12,od=13,ad=14,Da=15,oC=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},aC=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},lC=AC(Ky),TA="×",_a="÷",cC=function(i){return lC.get(i)},hC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===La&&s===Ma)return TA;if(n===La||n===Ma||n===Ad||s===La||s===Ma||s===Ad)return _a;if(n===rd&&[rd,Ha,nd,sd].indexOf(s)!==-1||(n===nd||n===Ha)&&(s===Ha||s===Ia)||(n===sd||n===Ia)&&s===Ia||s===od||s===id||s===sC||n===nC)return TA;if(n===od&&s===ad){for(;r===id;)r=e[--A];if(r===ad)return TA}if(n===Da&&s===Da){for(var o=0;r===Da;)o++,r=e[--A];if(o%2===0)return TA}return _a},uC=function(i){var e=oC(i),t=e.length,A=0,r=0,n=e.map(cC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=TA;A<t&&(s=hC(e,n,++A))===TA;);if(s!==TA||A===t){var o=aC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},dC=function(i){for(var e=uC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},pC=function(i){var e=123;if(i.createRange){var t=i.createRange();if(t.getBoundingClientRect){var A=i.createElement("boundtest");A.style.height=e+"px",A.style.display="block",i.body.appendChild(A),t.selectNode(A);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(i.body.removeChild(A),n===e)return!0}}return!1},fC=function(i){var e=i.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",i.body.appendChild(e);var t=i.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var A=e.firstChild,r=$n(A.data).map(function(l){return Ht(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var m=u.x>s.x||u.y>s.y;return s=u,c===0?!0:m});return i.body.removeChild(e),o},gC=function(){return typeof new Image().crossOrigin<"u"},mC=function(){return typeof new XMLHttpRequest().responseType=="string"},wC=function(i){var e=new Image,t=i.createElement("canvas"),A=t.getContext("2d");if(!A)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{A.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},ld=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},BC=function(i){var e=i.createElement("canvas"),t=100;e.width=t,e.height=t;var A=e.getContext("2d");if(!A)return Promise.reject(!1);A.fillStyle="rgb(0, 255, 0)",A.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Pa(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),cd(s).then(function(o){A.drawImage(o,0,0);var l=A.getImageData(0,0,t,t).data;A.fillStyle="red",A.fillRect(0,0,t,t);var c=i.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",ld(l)?cd(Pa(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),ld(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Pa=function(i,e,t,A,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",i.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",A.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},cd=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){return e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Wt={get SUPPORT_RANGE_BOUNDS(){var i=pC(document);return Object.defineProperty(Wt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Wt.SUPPORT_RANGE_BOUNDS&&fC(document);return Object.defineProperty(Wt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=wC(document);return Object.defineProperty(Wt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?BC(document):Promise.resolve(!1);return Object.defineProperty(Wt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=gC();return Object.defineProperty(Wt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=mC();return Object.defineProperty(Wt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Wt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Wt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Wr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),yC=function(i,e,t,A){var r=TC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Wt.SUPPORT_RANGE_BOUNDS){var l=hd(A,s,o.length).getClientRects();if(l.length>1){var c=ka(o),u=0;c.forEach(function(y){n.push(new Wr(y,jA.fromDOMRectList(i,hd(A,u+s,y.length).getClientRects()))),u+=y.length})}else n.push(new Wr(o,jA.fromDOMRectList(i,l)))}else{var m=A.splitText(o.length);n.push(new Wr(o,CC(i,A))),A=m}else Wt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},CC=function(i,e){var t=e.ownerDocument;if(t){var A=t.createElement("html2canvaswrapper");A.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(A,e);var n=Gn(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return jA.EMPTY},hd=function(i,e,t){var A=i.ownerDocument;if(!A)throw new Error("Node has no owner document");var r=A.createRange();return r.setStart(i,e),r.setEnd(i,e+t),r},ka=function(i){if(Wt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(i)).map(function(t){return t.segment})}return dC(i)},vC=function(i,e){if(Wt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(i)).map(function(A){return A.segment})}return bC(i,e)},TC=function(i,e){return e.letterSpacing!==0?ka(i):vC(i,e)},xC=[32,160,4961,65792,65793,4153,4241],bC=function(i,e){for(var t=qw(i,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),A=[],r,n=function(){if(r.value){var s=r.value.slice(),o=$n(s),l="";o.forEach(function(c){xC.indexOf(c)===-1?l+=Ht(c):(l.length&&A.push(l),A.push(Ht(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},QC=(function(){function i(e,t,A){this.text=FC(t.data,A.textTransform),this.textBounds=yC(e,this.text,A,t)}return i})(),FC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(UC,SC);case 2:return i.toUpperCase();default:return i}},UC=/(^|\s|:|-|\(|\))([a-z])/g,SC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},ud=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.src=A.currentSrc||A.src,r.intrinsicWidth=A.naturalWidth,r.intrinsicHeight=A.naturalHeight,r.context.cache.addImage(r.src),r}return e})(zA),dd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A,r.intrinsicWidth=A.width,r.intrinsicHeight=A.height,r}return e})(zA),pd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Gn(t,A);return A.setAttribute("width",s.width+"px"),A.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),r.intrinsicWidth=A.width.baseVal.value,r.intrinsicHeight=A.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})(zA),fd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(zA),Na=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.start=A.start,r.reversed=typeof A.reversed=="boolean"&&A.reversed===!0,r}return e})(zA),EC=[{type:15,flags:0,unit:"px",number:3}],LC=[{type:16,flags:0,number:50}],MC=function(i){return i.width>i.height?new jA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new jA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},HC=function(i){var e=i.type===IC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},bs="checkbox",Qs="radio",IC="password",gd=707406591,Oa=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;switch(r.type=A.type.toLowerCase(),r.checked=A.checked,r.value=HC(A),(r.type===bs||r.type===Qs)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=MC(r.bounds)),r.type){case bs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=EC;break;case Qs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=LC;break}return r}return e})(zA),md=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=A.options[A.selectedIndex||0];return r.value=n&&n.text||"",r}return e})(zA),wd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(zA),Bd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;r.src=A.src,r.width=parseInt(A.width,10)||0,r.height=parseInt(A.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(A.contentWindow&&A.contentWindow.document&&A.contentWindow.document.documentElement){r.tree=Cd(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Kr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):ti.TRANSPARENT,s=A.contentWindow.document.body?Kr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):ti.TRANSPARENT;r.backgroundColor=ui(n)?ui(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(zA),DC=["OL","UL","MENU"],Fs=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,vd(r)&&r.data.trim().length>0)t.textNodes.push(new QC(i,r,t.styles));else if(Zi(r))if(Ud(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Fs(i,o,t,A)});else{var s=yd(i,r);s.styles.isVisible()&&(_C(r,s,A)?s.flags|=4:PC(s.styles)&&(s.flags|=2),DC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Fs(i,r.shadowRoot,s,A):!Ss(r)&&!Td(r)&&!Es(r)&&Fs(i,r,s,A))}},yd=function(i,e){return za(e)?new ud(i,e):xd(e)?new dd(i,e):Td(e)?new pd(i,e):kC(e)?new fd(i,e):NC(e)?new Na(i,e):OC(e)?new Oa(i,e):Es(e)?new md(i,e):Ss(e)?new wd(i,e):Qd(e)?new Bd(i,e):new zA(i,e)},Cd=function(i,e){var t=yd(i,e);return t.flags|=4,Fs(i,e,t,t),t},_C=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Va(i)&&t.styles.isTransparent()},PC=function(i){return i.isPositioned()||i.isFloating()},vd=function(i){return i.nodeType===Node.TEXT_NODE},Zi=function(i){return i.nodeType===Node.ELEMENT_NODE},Ka=function(i){return Zi(i)&&typeof i.style<"u"&&!Us(i)},Us=function(i){return typeof i.className=="object"},kC=function(i){return i.tagName==="LI"},NC=function(i){return i.tagName==="OL"},OC=function(i){return i.tagName==="INPUT"},KC=function(i){return i.tagName==="HTML"},Td=function(i){return i.tagName==="svg"},Va=function(i){return i.tagName==="BODY"},xd=function(i){return i.tagName==="CANVAS"},bd=function(i){return i.tagName==="VIDEO"},za=function(i){return i.tagName==="IMG"},Qd=function(i){return i.tagName==="IFRAME"},Fd=function(i){return i.tagName==="STYLE"},VC=function(i){return i.tagName==="SCRIPT"},Ss=function(i){return i.tagName==="TEXTAREA"},Es=function(i){return i.tagName==="SELECT"},Ud=function(i){return i.tagName==="SLOT"},Sd=function(i){return i.tagName.indexOf("-")>0},zC=(function(){function i(){this.counters={}}return i.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},i.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},i.prototype.pop=function(e){var t=this;e.forEach(function(A){return t.counters[A].pop()})},i.prototype.parse=function(e){var t=this,A=e.counterIncrement,r=e.counterReset,n=!0;A!==null&&A.forEach(function(o){var l=t.counters[o.counter];l&&o.increment!==0&&(n=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var s=[];return n&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},i})(),Ed={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Ld={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},WC={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},RC={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Yi=function(i,e,t,A,r,n){return i<e||i>t?Gr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Md=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},It=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Md(Math.abs(i),n,A,function(s){return Ht(Math.floor(s%n)+e)})+r)},Hi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Md(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},qi=1,pi=2,fi=4,Rr=8,Ai=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Gr(i,4,r.length>0);var s=Math.abs(i),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&kt(n,qi)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&kt(n,pi)||c===1&&l===1&&kt(n,fi)&&i>100||c===1&&l>1&&kt(n,Rr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(i<0?A:"")+o},Hd="十百千萬",Id="拾佰仟萬",Dd="マイナス",Wa="마이너스",Gr=function(i,e,t){var A=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=It(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Hi(i,"〇一二三四五六七八九",r);case 6:return Yi(i,1,3999,Ed,3,A).toLowerCase();case 7:return Yi(i,1,3999,Ed,3,A);case 8:return It(i,945,969,!1,A);case 9:return It(i,97,122,!1,A);case 10:return It(i,65,90,!1,A);case 11:return It(i,1632,1641,!0,A);case 12:case 49:return Yi(i,1,9999,Ld,3,A);case 35:return Yi(i,1,9999,Ld,3,A).toLowerCase();case 13:return It(i,2534,2543,!0,A);case 14:case 30:return It(i,6112,6121,!0,A);case 15:return Hi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Hi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return Ai(i,"零一二三四五六七八九",Hd,"負",r,pi|fi|Rr);case 47:return Ai(i,"零壹貳參肆伍陸柒捌玖",Id,"負",r,qi|pi|fi|Rr);case 42:return Ai(i,"零一二三四五六七八九",Hd,"负",r,pi|fi|Rr);case 41:return Ai(i,"零壹贰叁肆伍陆柒捌玖",Id,"负",r,qi|pi|fi|Rr);case 26:return Ai(i,"〇一二三四五六七八九","十百千万",Dd,r,0);case 25:return Ai(i,"零壱弐参四伍六七八九","拾百千万",Dd,r,qi|pi|fi);case 31:return Ai(i,"영일이삼사오육칠팔구","십백천만",Wa,n,qi|pi|fi);case 33:return Ai(i,"零一二三四五六七八九","十百千萬",Wa,n,0);case 32:return Ai(i,"零壹貳參四五六七八九","拾百千",Wa,n,qi|pi|fi);case 18:return It(i,2406,2415,!0,A);case 20:return Yi(i,1,19999,RC,3,A);case 21:return It(i,2790,2799,!0,A);case 22:return It(i,2662,2671,!0,A);case 22:return Yi(i,1,10999,WC,3,A);case 23:return Hi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Hi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return It(i,3302,3311,!0,A);case 28:return Hi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Hi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return It(i,3792,3801,!0,A);case 37:return It(i,6160,6169,!0,A);case 38:return It(i,4160,4169,!0,A);case 39:return It(i,2918,2927,!0,A);case 40:return It(i,1776,1785,!0,A);case 43:return It(i,3046,3055,!0,A);case 44:return It(i,3174,3183,!0,A);case 45:return It(i,3664,3673,!0,A);case 46:return It(i,3872,3881,!0,A);default:return It(i,48,57,!0,A)}},_d="data-html2canvas-ignore",Pd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new zC,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return i.prototype.toIFrame=function(e,t){var A=this,r=GC(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=r.contentWindow,l=o.document,c=JC(r).then(function(){return tA(A,void 0,void 0,function(){var u,m;return Jt(this,function(y){switch(y.label){case 0:return this.scrolledElements.forEach(jC),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,m=this.clonedReferenceElement,typeof m>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:y.sent(),y.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,XC(l)]:[3,4];case 3:y.sent(),y.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(YC(document.doctype)+"<html></html>"),qC(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(Fa(e,2))debugger;if(xd(e))return this.createCanvasClone(e);if(bd(e))return this.createVideoClone(e);if(Fd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return za(t)&&(za(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Sd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ra(e.style,t),t},i.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var A=[].slice.call(t.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),r=e.cloneNode(!1);return r.textContent=A,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},i.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var A=e.ownerDocument.createElement("img");try{return A.src=e.toDataURL(),A}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var l=o.getContextAttributes();l?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},i.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var A=t.getContext("2d");try{return A&&(A.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||A.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},i.prototype.appendChildNode=function(e,t,A){(!Zi(t)||!VC(t)&&!t.hasAttribute(_d)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Zi(t)||!Fd(t))&&e.appendChild(this.cloneNode(t,A))},i.prototype.cloneChildNodes=function(e,t,A){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(Zi(n)&&Ud(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,A)})}else this.appendChildNode(t,n,A)},i.prototype.cloneNode=function(e,t){if(vd(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Zi(e)&&(Ka(e)||Us(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),o=A.getComputedStyle(e,":after");this.referenceElement===e&&Ka(r)&&(this.clonedReferenceElement=r),Va(r)&&Av(r);var l=this.counters.parse(new Yu(this.context,n)),c=this.resolvePseudoContent(e,r,s,$r.BEFORE);Sd(e)&&(t=!0),bd(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,o,$r.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||Us(e))&&!Qd(e)||t)&&Ra(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ss(e)||Es(e))&&(Ss(r)||Es(r))&&(r.value=e.value),r}return e.cloneNode(!1)},i.prototype.resolvePseudoContent=function(e,t,A,r){var n=this;if(A){var s=A.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||A.display==="none")){this.counters.parse(new Yu(this.context,A));var l=new ky(this.context,A),c=o.createElement("html2canvaspseudoelement");Ra(A,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var y=o.createElement("img");y.src=m.value,y.style.opacity="1",c.appendChild(y)}else if(m.type===18){if(m.name==="attr"){var v=m.values.filter(mt);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(m.name==="counter"){var T=m.values.filter(Xi),C=T[0],U=T[1];if(C&&mt(C)){var F=n.counters.getCounterValue(C.value),E=U&&mt(U)?Qa.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Gr(F,E,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Xi),C=N[0],R=N[1],U=N[2];if(C&&mt(C)){var M=n.counters.getCounterValues(C.value),z=U&&mt(U)?Qa.parse(n.context,U.value):3,ne=R&&R.type===0?R.value:"",$=M.map(function(re){return Gr(re,z,!1)}).join(ne);c.appendChild(o.createTextNode($))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(Zu(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Zu(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=Ga+" "+$a;var u=r===$r.BEFORE?" "+Ga:" "+$a;return Us(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),$r;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})($r||($r={}));var GC=function(i,e){var t=i.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(_d,"true"),i.body.appendChild(t),t},$C=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},XC=function(i){return Promise.all([].slice.call(i.images,0).map($C))},JC=function(i){return new Promise(function(e,t){var A=i.contentWindow;if(!A)return t("No window assigned for iframe");var r=A.document;A.onload=i.onload=function(){A.onload=i.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(i))},50)}})},ZC=["all","d","content"],Ra=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);ZC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},YC=function(i){var e="";return i&&(e+="<!DOCTYPE ",i.name&&(e+=i.name),i.internalSubset&&(e+=i.internalSubset),i.publicId&&(e+='"'+i.publicId+'"'),i.systemId&&(e+='"'+i.systemId+'"'),e+=">"),e},qC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},jC=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},ev=":before",tv=":after",Ga="___html2canvas___pseudoelement_before",$a="___html2canvas___pseudoelement_after",kd=`{
|
|
1
|
+
(function(Ye,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(Ye=typeof globalThis<"u"?globalThis:Ye||self,a(Ye.ChartSDK={},Ye.jsxRuntime,Ye.React))})(this,(function(Ye,a,Y){"use strict";var Ws=typeof document<"u"?document.currentScript:null;const $t="17:00-17:00",Xt="America/New_York",HA="24x7",IA="UTC",ll={EURUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},ETHUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},BNBUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},SOLUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},ADAUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},XRPUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},DOTUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},MATICUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},LINKUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"}},cl={type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"};function nr(i){return i&&ll[i.toUpperCase()]||cl}function en(i){return nr(i).type==="forex"}function tn(i){return nr(i).type==="crypto"}function Hp(i){return nr(i).session==="24x7"}function ee(i){if(i==null)return null;if(typeof i=="number"){if(Number.isNaN(i)||!Number.isFinite(i))return null;let e;i>1e10?e=i/1e3:(i<1e9,e=i);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof i=="string"){const e=Date.parse(i);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof i=="object"&&"year"in i&&"month"in i&&"day"in i){const t=new Date(Date.UTC(i.year,i.month-1,i.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function Ip(i,e){if(!i||i.length<2)return[];const t=[],A=2;for(let r=1;r<i.length;r++){const n=i[r-1].time,s=i[r].time,o=s-n;o>e*A&&t.push({from:n,to:s,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(n*1e3).toISOString(),toDate:new Date(s*1e3).toISOString()})}return t}function Dp(i,e="America/New_York"){const t=new Date(i*1e3),A=new Date(t.toLocaleString("en-US",{timeZone:e})),r=A.getDay();return!(r===0||r===6||r===5&&A.getHours()>=17)}function hl(i){return Array.isArray(i)?i.map(e=>({...e,time:ee(e.time)})).filter(e=>e.time!=null):[]}function _p(i){if(!i||i.length<2)return!0;for(let e=1;e<i.length;e++)if(i[e].time<=i[e-1].time)return!1;return!0}function ke(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function ul(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(ee(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof A!="number"||!Number.isFinite(A)||typeof r!="number"||!Number.isFinite(r)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||A<t||A<n||A<r||r>t||r>n||r>A||t<=0||A<=0||r<=0||n<=0)}function dl(i){const e=s=>Math.round(s*1e5)/1e5;let t=e(i.open),A=e(i.high),r=e(i.low),n=e(i.close);return A=Math.max(A,t,n,r),r=Math.min(r,t,n,A),{...i,open:t,high:A,low:r,close:n,volume:i.volume!=null?Math.round(i.volume):i.volume}}function pl(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=ee(t.time);if(A!=null)if(e.has(A)){const r=e.get(A);e.set(A,{...t,time:A,open:t.open,high:Math.max(r.high,t.high),low:Math.min(r.low,t.low),close:t.close,volume:(r.volume||0)+(t.volume||0)})}else e.set(A,{...t,time:A})}),Array.from(e.values())}function Pp(i,e="percentile"){if(!Array.isArray(i)||i.length<3)return i;const t=i.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return i;const A=[...t].sort((s,o)=>s-o);let r,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),l=A[s],c=A[o],u=c-l;r=l-1.5*u,n=c+1.5*u}else{const s=t.reduce((c,u)=>c+u,0)/t.length,o=t.reduce((c,u)=>c+Math.pow(u-s,2),0)/t.length,l=Math.sqrt(o);if(l===0)return i;r=s-3*l,n=s+3*l}return i.map((s,o)=>{const l=s.close;if(l<r||l>n){if(o===0)return s;const c=i[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function Np(i,e){if(!Array.isArray(i)||i.length===0)return i;const t=[],A=Math.max(e*10080,604800),r=1e4;for(let o=0;o<i.length;o++)if(t.push(i[o]),o<i.length-1){const l=i[o].time,c=i[o+1].time,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const g=i[o];let B=l+e,v=0;for(B=ke(B,e);B<c&&v<r;){const b=ke(B,e);t.some(U=>U.time===b)||(t.push({time:b,open:g.close,high:g.close,low:g.close,close:g.close,volume:0}),v++),B+=e}if(B<c&&v>=r){const b=ke(c-e,e);t.some(U=>U.time===b)||t.push({time:b,open:g.close,high:g.close,low:g.close,close:g.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function uA(i){if(!i||typeof i!="string")return 60;const e=i.toUpperCase();if(e==="MN")return 2592e3;let t=e.match(/^([MHDW])(\d+)$/);if(t){const A=t[1];return parseInt(t[2],10)*({M:60,H:3600,D:86400,W:604800}[A]||60)}if(t=i.match(/^(\d+)([mhdwy])$/i),t){const A=parseInt(t[1],10),r=t[2].toLowerCase();return A*({m:60,h:3600,d:86400,w:604800,y:31536e3}[r]||60)}return 60}function fl(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=nr(e),r=uA(t),o=hl(i).map(S=>({...S,time:ke(S.time,r)})).filter(S=>ul(S)).map(S=>dl(S)),l=pl(o);l.sort((S,K)=>S.time-K.time);const c=Math.floor(Date.now()/1e3),u=l.filter(S=>S.time<=c),g=u.filter((S,K)=>K===0?!0:S.time>u[K-1].time),B=g.length>10?Pp(g,"percentile"):g,v=pl(B);v.sort((S,K)=>S.time-K.time);const b=Np(v,r),C=[];for(let S=1;S<b.length;S++){const K=b[S].time-b[S-1].time;K>r*2&&C.push({from:b[S-1].time,to:b[S].time,gapSeconds:K,gapMinutes:Math.round(K/60),fromDate:new Date(b[S-1].time*1e3).toISOString(),toDate:new Date(b[S].time*1e3).toISOString()})}const U=B.filter((S,K)=>K===0?!1:S.close===B[K-1].close&&S.open===B[K-1].close).length,F={original:i.length,processed:b.length,duplicates:i.length-l.length,outliers:U,gaps:C,filledGaps:b.length-v.length,symbolConfig:A};return{candles:b,stats:F}}function ml(i,e,t="1m"){if(!i||!e||!ul(i))return null;const A=ee(i.time);if(A==null)return null;const r=uA(t),n=ke(A,r);return dl({...i,time:n})}function gl(i,e=20,t=2){if(!i||i.length<e)return null;const A=[],r=[],n=[];for(let s=e-1;s<i.length;s++){let o=0;for(let B=s-e+1;B<=s;B++)o+=i[B].close;const l=o/e;let c=0;for(let B=s-e+1;B<=s;B++){const v=i[B].close-l;c+=v*v}const u=Math.sqrt(c/e),g=i[s].time;r.push({time:g,value:l}),A.push({time:g,value:l+t*u}),n.push({time:g,value:l-t*u})}return{upper:A,middle:r,lower:n}}function Rs(i,e=20,t=2){if(!i||i.length<e)return null;const A=i.slice(-e);let r=0;for(let c=0;c<A.length;c++)r+=A[c].close;const n=r/e;let s=0;for(let c=0;c<A.length;c++){const u=A[c].close-n;s+=u*u}const o=Math.sqrt(s/e);return{time:i[i.length-1].time,upper:n+t*o,middle:n,lower:n-t*o}}function bt(i){var e=i.width,t=i.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(t<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:t}}function wi(i,e){return i.width===e.width&&i.height===e.height}var Op=(function(){function i(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return i.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(i.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),i.prototype.subscribe=function(e){var t=this,A={next:e};return this._observers.push(A),{unsubscribe:function(){t._observers=t._observers.filter(function(r){return r!==A})}}},i.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},i.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},i.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},i.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},i})();function kp(i){return new Op(i)}var Kp=(function(){function i(e,t,A){var r;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=bt({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(r=A?.allowResizeObserver)!==null&&r!==void 0?r:!0,this._chooseAndInitObserver()}return i.prototype.dispose=function(){var e,t;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(t=this._devicePixelRatioObservable)===null||t===void 0||t.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(i.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"bitmapSize",{get:function(){return bt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=bt(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},i.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(i.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),i.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},i.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},i.prototype._resizeBitmap=function(e){var t=this.bitmapSize;wi(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},i.prototype._emitBitmapSizeChanged=function(e,t){var A=this;this._bitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,A=bt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=wi(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&wi(t,r)||(this._suggestedBitmapSize=r,this._emitSuggestedBitmapSizeChanged(t,r))},i.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var A=this;this._suggestedBitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}zp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=wl(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=kp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=wl(this._canvasElement);if(A!==null){var r=(t=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:A.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?Wp(n[0],r):bt({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(s)}}},i.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var A=t.find(function(s){return s.target===e._canvasElement});if(!(!A||!A.devicePixelContentBoxSize||!A.devicePixelContentBoxSize[0])){var r=A.devicePixelContentBoxSize[0],n=bt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function Vp(i,e){return new Kp(i,e.transform,e.options)}function wl(i){return i.ownerDocument.defaultView}function zp(){return new Promise(function(i){var e=new ResizeObserver(function(t){i(t.every(function(A){return"devicePixelContentBoxSize"in A})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function Wp(i,e){return bt({width:Math.round(i.left*e+i.width*e)-Math.round(i.left*e),height:Math.round(i.top*e+i.height*e)-Math.round(i.top*e)})}var Rp=(function(){function i(e,t,A){if(t.width===0||t.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,A.width===0||A.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=A,this._context=e}return i.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},i.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(i.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),i})();function Bi(i,e){var t=i.canvasElementClientSize;if(t.width===0||t.height===0)return null;var A=i.bitmapSize;if(A.width===0||A.height===0)return null;var r=i.canvasElement.getContext("2d",e);return r===null?null:new Rp(r,t,A)}const Gp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},$p={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Xp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Jp={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},Zp={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},Yp={color:"#26a69a",base:0},Bl={color:"#2196f3"},yl={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 Cl,vl;function yi(i,e){const t={0:[],1:[i.lineWidth,i.lineWidth],2:[2*i.lineWidth,2*i.lineWidth],3:[6*i.lineWidth,6*i.lineWidth],4:[i.lineWidth,4*i.lineWidth]}[e];i.setLineDash(t)}function Tl(i,e,t,A){i.beginPath();const r=i.lineWidth%2?.5:0;i.moveTo(t,e+r),i.lineTo(A,e+r),i.stroke()}function ri(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function jt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Se(i){if(i===null)throw new Error("Value is null");return i}function _i(i){return Se(jt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(Cl||(Cl={})),(function(i){i[i.Solid=0]="Solid",i[i.Dotted=1]="Dotted",i[i.Dashed=2]="Dashed",i[i.LargeDashed=3]="LargeDashed",i[i.SparseDotted=4]="SparseDotted"})(vl||(vl={}));const bl={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 wA(i){return i<0?0:i>255?255:Math.round(i)||0}function xl(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const qp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,jp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,ef=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,tf=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function sr(i){(i=i.toLowerCase())in bl&&(i=bl[i]);{const e=tf.exec(i)||ef.exec(i);if(e)return[wA(parseInt(e[1],10)),wA(parseInt(e[2],10)),wA(parseInt(e[3],10)),xl(e.length<5?1:parseFloat(e[4]))]}{const e=jp.exec(i);if(e)return[wA(parseInt(e[1],16)),wA(parseInt(e[2],16)),wA(parseInt(e[3],16)),1]}{const e=qp.exec(i);if(e)return[wA(17*parseInt(e[1],16)),wA(17*parseInt(e[2],16)),wA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function Ql(i){return .199*i[0]+.687*i[1]+.114*i[2]}function An(i){const e=sr(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Ql(e)>160?"black":"white"}}class Lt{constructor(){this.h=[]}l(e,t,A){const r={o:e,_:t,u:A===!0};this.h.push(r)}v(e){const t=this.h.findIndex((A=>e===A.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,A){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function QA(i,...e){for(const t of e)for(const A in t)t[A]!==void 0&&Object.prototype.hasOwnProperty.call(t,A)&&!["__proto__","constructor","prototype"].includes(A)&&(typeof t[A]!="object"||i[A]===void 0||Array.isArray(t[A])?i[A]=t[A]:QA(i[A],t[A]));return i}function DA(i){return typeof i=="number"&&isFinite(i)}function or(i){return typeof i=="number"&&i%1==0}function ar(i){return typeof i=="string"}function rn(i){return typeof i=="boolean"}function ZA(i){const e=i;if(!e||typeof e!="object")return e;let t,A,r;for(A in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(A)&&(r=e[A],t[A]=r&&typeof r=="object"?ZA(r):r);return t}function Af(i){return i!==null}function lr(i){return i===null?void 0:i}const Gs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Pi(i,e,t){return e===void 0&&(e=Gs),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class rf{constructor(e){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=e}W(){const e=this.k,t=this.j(),A=this.H();return e.P===t&&e.D===A||(e.P=t,e.D=A,e.R=Pi(t,A),e.L=2.5/12*t,e.B=e.L,e.A=t/12*e.T,e.I=t/12*e.T,e.N=0),e.V=this.$(),e.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 $s{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class FA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class nf extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const u=n.it[c],g=Math.round(u.nt*t)+s,B=u.st*A,v=l*A+s;e.moveTo(g,B),e.arc(g,B,v,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function sf(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const of={from:0,to:1};class af{constructor(e,t){this.ut=new $s,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=t,this.ut.Z(this.ct)}bt(e){const t=this.F.wt();t.length!==this.ct.length&&(this.dt=t.map(sf),this.ct=this.dt.map((A=>{const r=new nf;return r.J(A),r})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,t=this.F.wt(),A=this.vt.xt(),r=this.F.St();t.forEach(((n,s)=>{var o;const l=this.dt[s],c=n.kt(A);if(e||c===null||!n.yt())return void(l.tt=null);const u=Se(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,u.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=A,l.it[0].nt=r.It(A),l.tt=of}))}}let lf=class extends FA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*A),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*A),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,yi(e,this.zt.Lt.Nt),(function(c,u,g,B){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,g),c.lineTo(u+v,B),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,yi(e,this.zt.Et.Nt),Tl(e,l,0,t.width))}};class cf{constructor(e){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 lf(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),t=Se(this.jt.Ht()),A=t.$t().W().crosshair,r=this.Ft;if(A.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=A.horzLine.width,r.Et.Nt=A.horzLine.style,r.Et.V=A.horzLine.color,r.Lt.et=A.vertLine.width,r.Lt.Nt=A.vertLine.style,r.Lt.V=A.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function hf(i,e,t,A,r,n){i.fillRect(e+n,t,A-2*n,n),i.fillRect(e+n,t+r-n,A-2*n,n),i.fillRect(e,t,n,r),i.fillRect(e+A-n,t,n,r)}function nn(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function Fl(i,e,t,A,r,n){i.beginPath(),i.roundRect?i.roundRect(e,t,A,r,n):(i.lineTo(e+A-n[1],t),n[1]!==0&&i.arcTo(e+A,t,e+A,t+n[1],n[1]),i.lineTo(e+A,t+r-n[2]),n[2]!==0&&i.arcTo(e+A,t+r,e+A-n[2],t+r,n[2]),i.lineTo(e+n[3],t+r),n[3]!==0&&i.arcTo(e,t+r,e,t+r-n[3],n[3]),i.lineTo(e,t+n[0]),n[0]!==0&&i.arcTo(e,t,e+n[0],t,n[0]))}function Ul(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return Fl(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;Fl(i,e+c,t+c,A-s,r-s,(u=-c,o.map((g=>g===0?g:g+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function Sl(i,e,t,A,r,n,s){i.save(),i.globalCompositeOperation="copy";const o=i.createLinearGradient(0,0,0,r);o.addColorStop(0,n),o.addColorStop(1,s),i.fillStyle=o,i.fillRect(e,t,A,r),i.restore()}class El{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,A,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const u=this.Gt(l,t,A,r),g=u.Jt;return u.Qt?Ul(c,g.ti,g.ii,g.ni,g.si,s,g.ei,[g.ht,0,0,g.ht],s):Ul(c,g.ri,g.ii,g.ni,g.si,s,g.ei,[0,g.ht,g.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(g.ri,g.li,g.ai-g.ri,g.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(u.Qt?g.ui-g.ei:0,g.ii,g.ei,g.ci-g.ii)),u}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,g=this.zt.hi||!this.zt.mi?t.T:0,B=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,b=t.B+this.Xt.gi,C=t.A,U=t.I,F=this.zt.Kt,S=t.P,K=A.Mi(s,F),G=Math.ceil(A.xi(s,F)),M=S+v+b,W=t.C+C+U+G+g,ne=Math.max(1,Math.floor(u));let J=Math.round(M*u);J%2!=ne%2&&(J+=1);const V=B>0?Math.max(1,Math.floor(B*c)):0,ie=Math.round(W*c),re=Math.round(g*c),ce=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,Z=Math.round(ce*u)-Math.floor(.5*u),Ae=Math.floor(Z+ne/2-J/2),oe=Ae+J,le=r==="right",se=le?l.width-B:B,ae=le?o.width-V:V;let pe,we,Qe;return le?(pe=ae-ie,we=ae-re,Qe=se-g-C-B):(pe=ae+ie,we=ae+re,Qe=se+g+C),{Qt:le,Jt:{ii:Ae,li:Z,ci:oe,ni:ie,si:J,ht:2*c,ei:V,ti:pe,ri:ae,ai:we,oi:ne,ui:o.width},di:{ii:Ae/u,ci:oe/u,fi:Qe,pi:K}}}}class sn{constructor(e){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(e||El)(this.Ci,this.yi),this.Ri=new(e||El)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(e,t=!1){return Math.max(this.Pi.At(e,t),this.Ri.At(e,t))}Vi(){return this.yi.Si||0}Oi(e){this.yi.Si=e}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(e){return this.Di(),this.Ci.hi=this.Ci.hi&&e.W().ticksVisible,this.Ti.hi=this.Ti.hi&&e.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 uf extends sn{constructor(e,t,A){super(),this.jt=e,this.Li=t,this.Ei=A}zi(e,t,A){if(e.yt=!1,this.jt.W().mode===2)return;const r=this.jt.W().horzLine;if(!r.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=An(r.labelBackgroundColor);A.t=s.t,e.V=s.i;const o=2/12*this.Li.P();A.wi=o,A.gi=o;const l=this.Ei(this.Li);A.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const df=/[1-9]/g;class Ll{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const A=e.useMediaCoordinateSpace((({context:B})=>(B.font=t.R,Math.round(t.Wi.xi(B,Se(this.zt).Kt,df)))));if(A<=0)return;const r=t.ji,n=A+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const u=c+n,g=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:B,horizontalPixelRatio:v,verticalPixelRatio:b})=>{const C=Se(this.zt);B.fillStyle=C.t;const U=Math.round(c*v),F=Math.round(0*b),S=Math.round(u*v),K=Math.round(g*b),G=Math.round(2*v);if(B.beginPath(),B.moveTo(U,F),B.lineTo(U,K-G),B.arcTo(U,K,U+G,K,G),B.lineTo(S-G,K),B.arcTo(S,K,S,K-G,G),B.lineTo(S,F),B.fill(),C.hi){const M=Math.round(C.ki*v),W=F,ne=Math.round((W+t.T)*b);B.fillStyle=C.V;const J=Math.max(1,Math.floor(v)),V=Math.floor(.5*v);B.fillRect(M-V,W,J,ne-W)}})),e.useMediaCoordinateSpace((({context:B})=>{const v=Se(this.zt),b=0+t.C+t.T+t.L+t.P/2;B.font=t.R,B.textAlign="left",B.textBaseline="middle",B.fillStyle=v.V;const C=t.Wi.Mi(B,"Apr0");B.translate(c+r,b+C),B.fillText(v.Kt,0,0)}))}}class pf{constructor(e,t,A){this.ft=!0,this.Wt=new Ll,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Se(n)),e.yt=!0;const s=An(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Xs{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(e){this.Zi=e}Dt(){return this.Yi}Gi(e){this.Yi=e}Ji(e){return[]}Qi(){return[]}yt(){return!0}}var Ml;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(Ml||(Ml={}));class ff extends Xs{constructor(e,t){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=e,this.cn=t,this.dn=new af(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Se(this.tn).vn())return{_t:l,ki:o};{const c=Se(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new pf(this,e,A),this.wn=new cf(this)}W(){return this.cn}gn(e,t){this._n=e,this.un=t}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(e,t,A){this.hn||(this.hn=!0),this.en=!0,this.yn(e,t,A)}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(e){return this.tn!==null?[this.wn,this.dn]:[]}Ut(e){return e===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(e,t){this.en&&this.tn===e||this.rn.clear();const A=[];return this.tn===e&&A.push(this.Dn(this.rn,t,this.fn)),A}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach((e=>e.bt())),this.bn.bt(),this.dn.bt()}On(e){return e&&!e.vn().Ni()?e.vn():null}yn(e,t,A){this.Bn(e,t,A)&&this.Vn()}Bn(e,t,A){const r=this.ln,n=this.an,s=this.nn,o=this.sn,l=this.tn,c=this.On(A);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=A;const u=c!==null?c.Ct():null;return c!==null&&u!==null?(this.nn=t,this.an=c.Rt(t,u)):(this.nn=NaN,this.an=NaN),r!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter(Af),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,A){let r=e.get(t);return r===void 0&&(r=new uf(this,t,A),e.set(t,r)),r}}function on(i){return i==="left"||i==="right"}class Vt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(r,n){return r===void 0?n:{Fn:Math.max(r.Fn,n.Fn),Wn:r.Wn||n.Wn}})(this.zn.get(e),t);this.zn.set(e,A)}jn(){return this.En}Hn(e){const t=this.zn.get(e);return t===void 0?{Fn:this.En}:{Fn:Math.max(this.En,t.Fn),Wn:t.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(e){this.Un(),this.Ln=[{qn:1,Vt:e}]}Zn(e){this.Xn(),this.Ln.push({qn:5,Vt:e})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(e){this.Un(),this.Ln.push({qn:2,Vt:e})}Jn(e){this.Un(),this.Ln.push({qn:3,Vt:e})}Qn(){return this.Ln}ts(e){for(const t of e.Ln)this.ns(t);this.En=Math.max(this.En,e.En),e.zn.forEach(((t,A)=>{this.Nn(A,t)}))}static ss(){return new Vt(2)}static es(){return new Vt(3)}ns(e){switch(e.qn){case 0:this.$n();break;case 1:this.Yn(e.Vt);break;case 2:this.Gn(e.Vt);break;case 3:this.Jn(e.Vt);break;case 4:this.Kn();break;case 5:this.Zn(e.Vt);break;case 6:this.Xn()}}Xn(){const e=this.Ln.findIndex((t=>t.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Hl=".";function YA(i,e){if(!DA(i))return"n/a";if(!or(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?i.toString():("0000000000000000"+i.toString()).slice(-e)}class an{constructor(e,t){if(t||(t=1),DA(e)&&or(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=t,this.hs()}format(e){const t=e<0?"−":"";return e=Math.abs(e),t+this.ls(e)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let e=this.Li;for(;e>1;)e/=10,this._s++}}ls(e){const t=this.Li/this.rs;let A=Math.floor(e),r="";const n=this._s!==void 0?this._s:NaN;if(t>1){let s=+(Math.round(e*t)-A*t).toFixed(this._s);s>=t&&(s-=t,A+=1),r=Hl+YA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=Hl+YA(0,n));return A.toFixed(0)+r}}class Il extends an{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class mf{constructor(e){this.us=e}format(e){let t="";return e<0&&(t="-",e=-e),e<995?t+this.cs(e):e<999995?t+this.cs(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),t+this.cs(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),t+this.cs(e/1e9)+"B")}cs(e){let t;const A=Math.pow(10,this.us);return t=(e=Math.round(e*A)/A)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),t.replace(/(\.[1-9]*)0+$/,((r,n)=>n))}}function Dl(i,e,t,A,r,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=i,u=e[A.from];let g=n(i,u),B=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const b={nt:u.nt-v,st:u.st},C={nt:u.nt+v,st:u.st};o.moveTo(b.nt*l,b.st*c),o.lineTo(C.nt*l,C.st*c),s(i,g,b,C)}else{const v=(C,U)=>{s(i,g,B,U),o.beginPath(),g=C,B=U};let b=B;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let C=A.from+1;C<A.to;++C){b=e[C];const U=n(i,b);switch(t){case 0:o.lineTo(b.nt*l,b.st*c);break;case 1:o.lineTo(b.nt*l,e[C-1].st*c),U!==g&&(v(U,b),o.lineTo(b.nt*l,e[C-1].st*c)),o.lineTo(b.nt*l,b.st*c);break;case 2:{const[F,S]=gf(e,C-1,C);o.bezierCurveTo(F.nt*l,F.st*c,S.nt*l,S.st*c,b.nt*l,b.st*c);break}}t!==1&&U!==g&&(v(U,b),o.moveTo(b.nt*l,b.st*c))}(B!==b||B===b&&t===1)&&s(i,g,B,b)}}const _l=6;function Js(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Pl(i,e){return{nt:i.nt/e,st:i.st/e}}function gf(i,e,t){const A=Math.max(0,e-1),r=Math.min(i.length-1,t+1);var n,s;return[(n=i[e],s=Pl(Js(i[t],i[A]),_l),{nt:n.nt+s.nt,st:n.st+s.st}),Js(i[t],Pl(Js(i[r],i[e]),_l))]}function wf(i,e,t,A,r){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(r.nt*s,i*o),n.lineTo(A.nt*s,i*o),n.closePath(),n.fillStyle=t,n.fill()}class Nl extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:A,tt:r,ds:n,et:s,Nt:o,fs:l}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(r===null)return;const u=e.context;u.lineCap="butt",u.lineJoin="round",u.lineWidth=s,yi(u,o),u.lineWidth=1,Dl(e,A,l,r,n,this.bs.bind(this),wf.bind(null,c))}}function Zs(i,e,t){return Math.min(Math.max(i,e),t)}function ln(i,e,t){return e-i<=t}function Ol(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Ys{ws(e,t){const A=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==r||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==l){const u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const g=Zs(c*e.verticalPixelRatio/l,0,1);u.addColorStop(g,n),u.addColorStop(g,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class Bf extends Nl{constructor(){super(...arguments),this.Ts=new Ys}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function yf(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class kl extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,yi(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&Dl(e,t,n,A,r,u,yf),l&&(function(g,B,v,b,C){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:S}=g;let K=null;const G=Math.max(1,Math.floor(U))%2/2,M=v*F+G;for(let W=b.to-1;W>=b.from;--W){const ne=B[W];if(ne){const J=C(g,ne);J!==K&&(S.beginPath(),K!==null&&S.fill(),S.fillStyle=J,K=J);const V=Math.round(ne.nt*U)+G,ie=ne.st*F;S.moveTo(V,ie),S.arc(V,ie,M,0,2*Math.PI)}}S.fill()})(e,t,l,A,u)}}class Kl extends kl{Vs(e,t){return t.lt}}function Vl(i,e,t,A,r=0,n=e.length){let s=n-r;for(;0<s;){const o=s>>1,l=r+o;A(e[l],t)===i?(r=l+1,s-=o+1):s=o}return r}const cr=Vl.bind(null,!0),zl=Vl.bind(null,!1);function Cf(i,e){return i.ot<e}function vf(i,e){return e<i.ot}function Wl(i,e,t){const A=e.Os(),r=e.ui(),n=cr(i,A,Cf),s=zl(i,r,vf);if(!t)return{from:n,to:s};let o=n,l=s;return n>0&&n<i.length&&i[n].ot>=A&&(o=n-1),s>0&&s<i.length&&i[s-1].ot<=r&&(l=s+1),{from:o,to:l}}class qs{constructor(e,t,A){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=t,this.Fs=A}bt(e){this.Bs=!0,e==="data"&&(this.As=!0),e==="options"&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),this.Ls===null?null:this.js):null}Hs(){this.zs=this.zs.map((e=>Object.assign(Object.assign({},e),this.Es.Us().$s(e.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 e=this.Es.Dt(),t=this.Ns.St();if(this.qs(),t.Ni()||e.Ni())return;const A=t.Xs();if(A===null||this.Es.In().Ks()===0)return;const r=this.Es.Ct();r!==null&&(this.Ls=Wl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class cn extends qs{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.te(this.zs,A,lr(this.Ls))}ie(e,t){return{ot:e,_t:t,nt:NaN,st:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>{const A=t.Vt[3];return this.se(t.ee,A,e)}))}}class Tf extends cn{constructor(e,t){super(e,t),this.js=new $s,this.re=new Bf,this.he=new Kl,this.js.Z([this.re,this.he])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W();this.re.J({fs:e.lineType,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,vs:null,ps:e.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:e.lineVisible?e.lineType:void 0,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}}class bf extends FA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),u=c-l,g=this.oe,B=u+g-1,v=Math.min(o.de,o.fe),b=Math.max(o.de,o.fe),C=Math.round(v*A)-l,U=Math.round(b*A)+l,F=Math.max(U-C,this.oe);e.fillRect(u,C,g,F);const S=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const W=c-S;let ne=Math.max(C,Math.round(o.pe*A)-l),J=ne+g-1;J>C+F-1&&(J=C+F-1,ne=J-g+1),e.fillRect(W,ne,u-W,J-ne+1)}const K=c+S;let G=Math.max(C,Math.round(o.me*A)-l),M=G+g-1;M>C+F-1&&(M=C+F-1,G=M-g+1),e.fillRect(B+1,G,K-B,M-G+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Se(this.zt).le,e)))}}class Rl extends qs{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.be(this.zs,A,lr(this.Ls))}we(e,t,A){return{ot:e,ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>this.se(t.ee,t,e)))}}class xf extends Rl{constructor(){super(...arguments),this.js=new bf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class Qf extends Nl{constructor(){super(...arguments),this.Ts=new Ys}bs(e,t){const A=this.G;return this.Ts.ws(e,{Ms:t.ke,xs:t.ye,Ss:t.Ce,ks:t.Te,ys:e.bitmapSize.height,vs:A.vs})}}class Ff extends kl{constructor(){super(...arguments),this.Pe=new Ys}Vs(e,t){const A=this.G;return this.Pe.ws(e,{Ms:t.Re,xs:t.Re,Ss:t.De,ks:t.De,ys:e.bitmapSize.height,vs:A.vs})}}class Uf extends cn{constructor(e,t){super(e,t),this.js=new $s,this.Ve=new Qf,this.Oe=new Ff,this.js.Z([this.Ve,this.Oe])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const t=this.Es.W(),A=this.Es.Dt().Rt(t.baseValue.price,e.Vt),r=this.Ns.St().le();this.Ve.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineType,vs:A,ps:!1,tt:this.Ls,ds:r}),this.Oe.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,vs:A,tt:this.Ls,ds:r})}}class Sf extends FA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),l=Math.floor(n*o*s),c=Math.floor(n*s),u=Math.min(l,c);return Math.max(Math.floor(s),u)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",l=Math.min(Math.floor(n),Math.floor(this.zt.le*n));l=Math.max(Math.floor(n),Math.min(l,this.ae));const c=Math.floor(.5*l);let u=null;for(let g=A.from;g<A.to;g++){const B=t[g];B.Ee!==o&&(r.fillStyle=B.Ee,o=B.Ee);const v=Math.round(Math.min(B.pe,B.me)*s),b=Math.round(Math.max(B.pe,B.me)*s),C=Math.round(B.de*s),U=Math.round(B.fe*s);let F=Math.round(n*B.nt)-c;const S=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,S));const K=S-F+1;r.fillRect(F,C,K,v-C),r.fillRect(F,b+1,K,U-b),u=S}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const A=Math.max(Math.floor(e),t);return this.ae<=2*A?Math.max(Math.floor(e),Math.floor(1*e)):A}Ie(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let u=A.from;u<A.to;u++){const g=t[u];g.Ne!==o&&(r.fillStyle=g.Ne,o=g.Ne);let B=Math.round(g.nt*n)-Math.floor(.5*this.ae);const v=B+this.ae-1,b=Math.round(Math.min(g.pe,g.me)*s),C=Math.round(Math.max(g.pe,g.me)*s);if(c!==null&&(B=Math.max(c+1,B),B=Math.min(B,v)),this.zt.le*n>2*l)hf(r,B,b,v-B+1,C-b+1,l);else{const U=v-B+1;r.fillRect(B,b,U,C-b+1)}c=v}}Le(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=A.from;c<A.to;c++){const u=t[c];let g=Math.round(Math.min(u.pe,u.me)*s),B=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),b=v+this.ae-1;if(u.ce!==o){const C=u.ce;r.fillStyle=C,o=C}this.zt._i&&(v+=l,g+=l,b-=l,B-=l),g>B||r.fillRect(v,g,b-v+1,B-g+1)}}}class Ef extends Rl{constructor(){super(...arguments),this.js=new Sf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class Lf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class js extends qs{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new Lf(this.wn.renderer(),(r=>{const n=e.Ct();return n===null?null:e.Dt().Rt(r,n.Vt)}))}We(e){return this.wn.priceValueBuilder(e)}je(e){return this.wn.isWhitespace(e)}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>Object.assign(Object.assign({ot:t.ee,nt:NaN},e.$s(t.ee)),{He:t.$e})))}Gs(e,t){t.Qs(this.zs,lr(this.Ls))}Js(){this.wn.update({bars:this.zs.map(Mf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Mf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class Hf extends FA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],u=Math.round(l.st*A);let g,B;e.fillStyle=l.ce,u<=n?(g=u,B=s):(g=n,B=u-Math.floor(r/2)+r),e.fillRect(c.Os,g,c.ui-c.Os+1,B-g)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,c;if(A%2){const u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class If extends cn{constructor(){super(...arguments),this.js=new Hf}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,Se(this.Es.Ct()).Vt)};this.js.J(e)}}class Df extends cn{constructor(){super(...arguments),this.js=new Kl}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W(),t={it:this.zs,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,et:e.lineWidth,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(t)}}const _f=/[2-9]/g;class hr{constructor(e=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=e}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(e,t,A){return this.sr(e,t,A).width}Mi(e,t,A){const r=this.sr(e,t,A);return((r.actualBoundingBoxAscent||0)-(r.actualBoundingBoxDescent||0))/2}sr(e,t,A){const r=A||_f,n=String(t).replace(r,"0");if(this.tr.has(n))return jt(this.tr.get(n)).er;if(this.Ke===this.ir){const o=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(o),this.Je++,this.Ke--}e.save(),e.textBaseline="middle";const s=e.measureText(n);return e.restore(),s.width===0&&t.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class Pf{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,t,A){this.hr=e,this.k=t,this.lr=A}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class Gl{constructor(e,t,A){this.ur=e,this.ar=new hr(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new Pf(this.ar)}gt(){const e=this.F.dr(this.cr);if(e===null)return null;const t=e.vr(this.cr)?e.pr():this.cr.Dt();if(t===null)return null;const A=e.mr(t);if(A==="overlay")return null;const r=this.F.br();return r.P!==this.j&&(this.j=r.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),r,A),this.Wt}}class Nf extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var A;if(!(!((A=this.zt)===null||A===void 0)&&A.yt))return null;const{st:r,et:n,gr:s}=this.zt;return t>=r-n-7&&t<=r+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*r);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),yi(e,this.zt.Nt),Tl(e,n,0,t.width))}}class eo{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new Nf,this.ft=!0,this.Es=e,this.Ns=e.$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 Of extends eo{constructor(e){super(e)}yr(){this.Sr.yt=!1;const e=this.Es.Dt(),t=e.Cr().Cr;if(t!==2&&t!==3)return;const A=this.Es.W();if(!A.baseLineVisible||!this.Es.yt())return;const r=this.Es.Ct();r!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(r.Vt,r.Vt),this.Sr.V=A.baseLineColor,this.Sr.et=A.baseLineWidth,this.Sr.Nt=A.baseLineStyle)}}class kf extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){const r=this.zt;if(r===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(r.Xe.x*t)+s,l=r.Xe.y*A;e.fillStyle=r.Tr,e.beginPath();const c=Math.max(2,1.5*r.Pr)*t;e.arc(o,l,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=r.Rr,e.beginPath(),e.arc(o,l,r.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=r.Dr,e.beginPath(),e.arc(o,l,r.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const Kf=[{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 $l(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=sr(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Xl(i,e){const t=i%2600/2600;let A;for(const l of Kf)if(t>=l.Vr&&t<=l.Or){A=l;break}ri(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:$l(e,r,A.Ir,A.zr),Dr:$l(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class Vf{constructor(e){this.Wt=new kf,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=e}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),this.jr.W().lastPriceAnimation===2){const e=performance.now(),t=this.Wr-e;if(t>0)return void(t<650&&(this.Wr+=2600));this.Fr=e,this.Wr=e+2600}}bt(){this.ft=!0}Ur(){this.Nr=!0}yt(){return this.jr.W().lastPriceAnimation!==0}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 e=this.jr.$t().St(),t=e.Xs(),A=this.jr.Ct();if(t===null||A===null)return;const r=this.jr.Zr(!0);if(r.Xr||!t.Kr(r.ee))return;const n={x:e.It(r.ee),y:this.jr.Dt().Rt(r._t,A.Vt)},s=r.V,o=this.jr.W().lineWidth,l=Xl(this.Gr(),s);this.Wt.J({Tr:s,Pr:o,Rr:l.Rr,Dr:l.Dr,ht:l.ht,Xe:n})}Yr(){const e=this.Wt.$e();if(e!==null){const t=Xl(this.Gr(),e.Tr);e.Rr=t.Rr,e.Dr=t.Dr,e.ht=t.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function ur(i,e){return Ol(Math.min(Math.max(i,12),30)*e)}function dr(i,e){switch(i){case"arrowDown":case"arrowUp":return ur(e,1);case"circle":return ur(e,.8);case"square":return ur(e,.7)}}function Jl(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(ur(i,1))}function Zl(i){return Math.max(ur(i,.1),3)}function Yl(i,e,t){return e?i:t?Math.ceil(i/2):0}function ql(i,e,t,A,r){const n=dr("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function jl(i,e,t,A){const r=(dr("arrowUp",A)-1)/2*t.Jr,n=(Ol(A/2)-1)/2*t.Jr;e.beginPath(),i?(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st-r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+r),e.lineTo(t.nt-n,t.st+r),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st+r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-r),e.lineTo(t.nt-n,t.st-r),e.lineTo(t.nt-n,t.st)),e.fill()}function zf(i,e,t,A,r,n){return ql(e,t,A,r,n)}class Wf extends FA{constructor(){super(...arguments),this.zt=null,this.ar=new hr,this.j=-1,this.H="",this.Qr=""}J(e){this.zt=e}_r(e,t){this.j===e&&this.H===t||(this.j=e,this.H=t,this.Qr=Pi(e,t),this.ar.nr())}wr(e,t){if(this.zt===null||this.zt.tt===null)return null;for(let A=this.zt.tt.from;A<this.zt.tt.to;A++){const r=this.zt.it[A];if(Gf(r,e,t))return{Mr:r.th,gr:r.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A},r,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),Rf(o,e,t,A)}}}}function Rf(i,e,t,A){e.fillStyle=i.V,i.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,i.Kt.ih,i.Kt.nt,i.Kt.st,t,A),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void jl(!1,n,s,r.Ks);case"arrowUp":return void jl(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(dr("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,u*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const u=dr("square",c),g=(u-1)*l.Jr/2,B=l.nt-g,v=l.st-g;o.fillRect(B,v,u*l.Jr,u*l.Jr)})(n,s,r.Ks)}r.nh}})(i,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(i,t,A))}function Gf(i,e,t){return!(i.Kt===void 0||!(function(A,r,n,s,o,l){const c=s/2;return o>=A&&o<=A+n&&l>=r-c&&l<=r+c})(i.Kt.nt,i.Kt.st,i.Kt.Hi,i.Kt.At,e,t))||(function(A,r,n){if(A.Ks===0)return!1;switch(A.nh){case"arrowDown":case"arrowUp":return zf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const g=2+dr("circle",l)/2,B=s-c,v=o-u;return Math.sqrt(B*B+v*v)<=g})(A.nt,A.st,A.Ks,r,n);case"square":return ql(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function $f(i,e,t,A,r,n,s,o,l){const c=DA(t)?t:t.Se,u=DA(t)?t:t.Me,g=DA(t)?t:t.xe,B=DA(e.size)?Math.max(e.size,0):1,v=Jl(o.le())*B,b=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-b-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-b-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(g,l)+b+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class Xf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Wf,this.jr=e,this.$i=t,this.zt={it:[],tt:null}}bt(e){this.ft=!0,this.hh=!0,e==="data"&&(this.rh=!0,this.oh=null)}gt(e){if(!this.jr.yt())return null;this.ft&&this._h();const t=this.$i.W().layout;return this.Wt._r(t.fontSize,t.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const e=this.$i.St().le(),t=Zl(e),A=1.5*Jl(e)+2*t,r=this.fh();this.ah={above:Yl(A,r.aboveBar,r.inBar),below:Yl(A,r.belowBar,r.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),t=this.$i.St(),A=this.jr.dh();this.rh&&(this.zt.it=A.map((u=>({ot:u.time,nt:0,st:0,Ks:0,nh:u.shape,V:u.color,th:u.th,gr:u.id,Kt:void 0}))),this.rh=!1);const r=this.$i.W().layout;this.zt.tt=null;const n=t.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=Zl(t.le()),c={sh:l,eh:l};this.zt.tt=Wl(this.zt.it,n,!0);for(let u=this.zt.tt.from;u<this.zt.tt.to;u++){const g=A[u];g.time!==o&&(c.sh=l,c.eh=l,o=g.time);const B=this.zt.it[u];B.nt=t.It(g.time),g.text!==void 0&&g.text.length>0&&(B.Kt={ih:g.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(g.time);v!==null&&$f(B,g,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Jf extends eo{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const t=this.Es.W();if(!t.priceLineVisible||!this.Es.yt())return;const A=this.Es.Zr(t.priceLineSource===0);A.Xr||(e.yt=!0,e.st=A.ki,e.V=this.Es.mh(A.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class Zf extends sn{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const u=r.mh(c.V),g=An(u);A.t=g.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=g.i,t.V=g.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function ec(i,e,t,A){const r=Number.isFinite(e),n=Number.isFinite(t);return r&&n?i(e,t):r||n?r?e:t:A}class rA{constructor(e,t){this.kh=e,this.yh=t}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new rA(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(e){return e===null?this:new rA(ec(Math.min,this.Ph(),e.Ph(),-1/0),ec(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!DA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let A=this.yh-t,r=this.kh-t;A*=e,r*=e,this.yh=t+A,this.kh=t+r}Oh(e){DA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new rA(e.minValue,e.maxValue)}}class hn{constructor(e,t){this.Ih=e,this.zh=t||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return this.Ih===null?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(e){return e===null?null:new hn(rA.Ah(e.priceRange),e.margins)}}class Yf extends eo{constructor(e,t){super(e),this.Nh=t}yr(){const e=this.Sr;e.yt=!1;const t=this.Nh.W();if(!this.Es.yt()||!t.lineVisible)return;const A=this.Nh.Fh();A!==null&&(e.yt=!0,e.st=A,e.V=t.color,e.et=t.lineWidth,e.Nt=t.lineStyle,e.gr=this.Nh.W().id)}}class qf extends sn{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.Nh.W(),n=r.axisLabelVisible,s=r.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(t.Kt=r.title,t.yt=!0),t.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(r.price),e.yt=!0;const c=An(r.axisLabelColor||r.color);A.t=c.t;const u=r.axisLabelTextColor||c.i;e.V=u,t.V=u,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class jf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Yf(e,this),this.ur=new qf(e,this),this.Hh=new Gl(this.ur,e,e.$t())}$h(e){QA(this.cn,e),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 e=this.jr,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const A=e.Ct();return A===null?null:t.Rt(this.cn.price,A.Vt)}}class e0 extends Xs{constructor(e){super(),this.$i=e}$t(){return this.$i}}const t0={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Se(i(t,A)),l=_i(o.Vt[0])<=_i(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,u=e.borderDownColor,g=e.wickUpColor,B=e.wickDownColor,v=Se(i(t,A)),b=_i(v.Vt[0])<=_i(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:b?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:b?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:b?g:B}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Se(i(t,A));return{ce:(r=l.lt)!==null&&r!==void 0?r:e.lineColor,lt:(n=l.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=l.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=l.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(i,e,t,A)=>{var r,n,s,o,l,c;const u=Se(i(t,A));return{ce:u.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=u.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=u.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=u.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=u.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=u.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=u.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Se(i(t,A));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class A0{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=t0[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var tc;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(tc||(tc={}));const ni=30;class i0{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 this.Ks()===0}Kr(e){return this.hl(e,0)!==null}Gh(e){return this.ll(e)}ll(e,t=0){const A=this.hl(e,t);return A===null?null:Object.assign(Object.assign({},this.al(A)),{ee:this.rl(A)})}ne(){return this.tl}ol(e,t,A){if(this.Ni())return null;let r=null;for(const n of A)r=un(r,this._l(e,t,n));return r}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,t){const A=this.ul(e);if(A===null&&t!==0)switch(t){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return A}cl(e){let t=this.fl(e);return t>0&&(t-=1),t!==this.tl.length&&this.rl(t)<e?t:null}dl(e){const t=this.vl(e);return t!==this.tl.length&&e<this.rl(t)?t:null}ul(e){const t=this.fl(e);return t===this.tl.length||e<this.tl[t].ee?null:t}fl(e){return cr(this.tl,e,((t,A)=>t.ee<A))}vl(e){return zl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,A){if(this.Ni())return null;let r=null;const n=Se(this.el()),s=Se(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/ni)*ni,u=Math.max(c,Math.floor(l/ni)*ni);{const B=this.fl(o),v=this.vl(Math.min(l,c,t));r=un(r,this.pl(B,v,A))}let g=this.il.get(A);g===void 0&&(g=new Map,this.il.set(A,g));for(let B=Math.max(c+1,o);B<u;B+=ni){const v=Math.floor(B/ni);let b=g.get(v);if(b===void 0){const C=this.fl(v*ni),U=this.vl((v+1)*ni-1);b=this.pl(C,U,A),g.set(v,b)}r=un(r,b)}{const B=this.fl(u),v=this.vl(l);r=un(r,this.pl(B,v,A))}return r}}function un(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class r0{constructor(e){this.wl=e}X(e,t,A){this.wl.draw(e)}gl(e,t,A){var r,n;(n=(r=this.wl).drawBackground)===null||n===void 0||n.call(r,e)}}class to{constructor(e){this.tr=null,this.wn=e}gt(){var e;const t=this.wn.renderer();if(t===null)return null;if(((e=this.tr)===null||e===void 0?void 0:e.Ml)===t)return this.tr.xl;const A=new r0(t);return this.tr={Ml:t,xl:A},A}Sl(){var e,t,A;return(A=(t=(e=this.wn).zOrder)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:"normal"}}function Ac(i){var e,t,A,r,n;return{Kt:i.text(),ki:i.coordinate(),Si:(e=i.fixedCoordinate)===null||e===void 0?void 0:e.call(i),V:i.textColor(),t:i.backColor(),yt:(A=(t=i.visible)===null||t===void 0?void 0:t.call(i))===null||A===void 0||A,hi:(n=(r=i.tickVisible)===null||r===void 0?void 0:r.call(i))===null||n===void 0||n}}class n0{constructor(e,t){this.Wt=new Ll,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Ac(this.kl))),this.Wt}}class s0 extends sn{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Ac(this.kl);A.t=r.t,e.V=r.V;const n=2/12*this.Li.P();A.wi=n,A.gi=n,A.ki=r.ki,A.Si=r.Si,e.Kt=r.Kt,e.yt=r.yt,e.hi=r.hi}}class o0{constructor(e,t){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=e,this.jr=t}Ol(){return this.Vl}Vn(){var e,t;(t=(e=this.Vl).updateAllViews)===null||t===void 0||t.call(e)}Pn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Cl)===null||r===void 0?void 0:r.Ml)===n)return this.Cl.xl;const s=n.map((o=>new to(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Tl)===null||r===void 0?void 0:r.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((l=>new n0(l,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Pl)===null||r===void 0?void 0:r.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((l=>new s0(l,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Rl)===null||r===void 0?void 0:r.Ml)===n)return this.Rl.xl;const s=n.map((o=>new to(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Dl)===null||r===void 0?void 0:r.Ml)===n)return this.Dl.xl;const s=n.map((o=>new to(o)));return this.Dl={Ml:n,xl:s},s}Il(e,t){var A,r,n;return(n=(r=(A=this.Vl).autoscaleInfo)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}wr(e,t){var A,r,n;return(n=(r=(A=this.Vl).hitTest)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}}function Ao(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function io(i){return i.Pn()}function a0(i){return i.Bl()}function l0(i){return i.Al()}class ro extends e0{constructor(e,t,A,r,n){super(e),this.zt=new i0,this.jh=new Jf(this),this.zl=[],this.Ll=new Of(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=t,this.$l=A;const s=new Zf(this);this.rn=[s],this.Hh=new Gl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new Vf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},A=this.Dt();if(this.$t().St().Ni()||A.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const g=this.zt.sl();if(g===null)return t;s=g,o=g.ee}else{const g=this.zt.ll(r.ui(),-1);if(g===null||(s=this.zt.Gh(g.ee),s===null))return t;o=g.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),u=A.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:A.Fi(l,n.Vt),xh:A.Yl(l),Sh:A.Zl(l,n.Vt),V:c.ce,ki:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new A0(this)),this.Nl}W(){return this.cn}$h(e){const t=e.priceScaleId;t!==void 0&&t!==this.cn.priceScaleId&&this.$t().Xl(this,t),QA(this.cn,e),e.priceFormat!==void 0&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(e,t){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(t&&t.ta?this.El.$r():e.length===0&&this.El.Hr());const A=this.$t().dr(this);this.$t().ia(A),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const t=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const t=new jf(this,e);return this.zl.push(t),this.$t().Gl(this),t}ra(e){const t=this.zl.indexOf(e);t!==-1&&this.zl.splice(t,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const e=this.ha();return e===null?null:{Vt:e.Vt[3],la:e.ot}}ha(){const e=this.$t().St().Xs();if(e===null)return null;const t=e.Os();return this.zt.ll(t,1)}In(){return this.zt}ph(e){const t=this.zt.Gh(e);return t===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3]}:t.Vt[3]}aa(e){const t=[];Ao(this.Hl,io,"top",t);const A=this.El;return A!==null&&A.yt()&&(this.jl===null&&A.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),A.Ur(),t.unshift(A)),t}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const t=this.zl.map((A=>A.qh()));return e.push(...t),Ao(this.Hl,io,"normal",e),e}ua(){return this.ca(io,"bottom")}da(e){return this.ca(a0,e)}fa(e){return this.ca(l0,e)}va(e,t){return this.Hl.map((A=>A.wr(e,t))).filter((A=>A!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const A=[...this.rn];for(const r of this.zl)A.push(r.Zh());return this.Hl.forEach((r=>{A.push(...r.Rn())})),A}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const A=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return hn.Ah(A)}return this.pa(e,t)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;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(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return Se(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new o0(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof js)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof js)return e=>this.wn.je(e)}_a(){return!on(this.Dt().Pa())}pa(e,t){if(!or(e)||!or(t)||this.zt.Ni())return null;const A=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],r=this.zt.ol(e,t,A);let n=r!==null?new rA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new rA(o,o);n=n!==null?n.ts(l):l}let s=this.dn.uh();return this.Hl.forEach((o=>{const l=o.Il(e,t);if(l?.priceRange){const v=new rA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,g,B;l?.margins&&(c=s,u=l.margins,s={above:Math.max((g=c?.above)!==null&&g!==void 0?g:0,u.above),below:Math.max((B=c?.below)!==null&&B!==void 0?B:0,u.below)})})),new hn(n,s)}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 e=this.cn.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(e){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(t.length!==0)return t}}return this.Us().$s(e).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new mf(this.cn.priceFormat.precision);break;case"percent":this.wa=new Il(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new an(e,this.cn.priceFormat.minMove*e)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const e=this.$t().St();if(!e.Da()||this.zt.Ni())return void(this.Wl=[]);const t=Se(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Se(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Se(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:r,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new Xf(this,this.$t()),this.$l){case"Bar":this.wn=new xf(this,this.$t());break;case"Candlestick":this.wn=new Ef(this,this.$t());break;case"Line":this.wn=new Df(this,this.$t());break;case"Custom":this.wn=new js(this,this.$t(),jt(e));break;case"Area":this.wn=new Tf(this,this.$t());break;case"Baseline":this.wn=new Uf(this,this.$t());break;case"Histogram":this.wn=new If(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return Ao(this.Hl,e,t,A),A}}class c0{constructor(e){this.cn=e}Oa(e,t,A){let r=e;if(this.cn.mode===0)return r;const n=A.vn(),s=n.Ct();if(s===null)return r;const o=n.Rt(e,s),l=A.Ba().filter((u=>u instanceof ro)).reduce(((u,g)=>{if(A.vr(g)||!g.yt())return u;const B=g.Dt(),v=g.In();if(B.Ni()||!v.Kr(t))return u;const b=v.Gh(t);if(b===null)return u;const C=_i(g.Ct());return u.concat([B.Rt(b.Vt[3],C.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,g)=>Math.abs(u-o)-Math.abs(g-o)));const c=l[0];return r=n.pn(c,s),r}}class h0 extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(A));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Se(this.zt);if(s.Aa){e.strokeStyle=s.Ia,yi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*A);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,yi(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*r);e.moveTo(-n,l),e.lineTo(t.width+n,l)}e.stroke()}}))}}class u0{constructor(e){this.Wt=new h0,this.ft=!0,this.tn=e}bt(){this.ft=!0}gt(){if(this.ft){const e=this.tn.$t().W().grid,t={Na:e.horzLines.visible,Aa:e.vertLines.visible,Fa:e.horzLines.color,Ia:e.vertLines.color,Wa:e.horzLines.style,za:e.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map((A=>({Ea:A.coord})))};this.Wt.J(t),this.ft=!1}return this.Wt}}class d0{constructor(e){this.wn=new u0(e)}qh(){return this.wn}}const no={$a:4,Ua:1e-4};function Ni(i,e){const t=100*(i-e)/e;return e<0?-t:t}function p0(i,e){const t=Ni(i.Ph(),e),A=Ni(i.Rh(),e);return new rA(t,A)}function pr(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function f0(i,e){const t=pr(i.Ph(),e),A=pr(i.Rh(),e);return new rA(t,A)}function dn(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.log10(t+e.Ua)+e.$a;return i<0?-A:A}function fr(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.pow(10,t-e.$a)-e.Ua;return i<0?-A:A}function mr(i,e){if(i===null)return null;const t=dn(i.Ph(),e),A=dn(i.Rh(),e);return new rA(t,A)}function pn(i,e){if(i===null)return null;const t=fr(i.Ph(),e),A=fr(i.Rh(),e);return new rA(t,A)}function so(i){if(i===null)return no;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return no;const t=Math.ceil(Math.abs(Math.log10(e))),A=no.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class oo{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let r=A;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let A=this.qa;A!==1;){if(A%2==0)this.Za.push(2),A/=2;else{if(A%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),A/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,A){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const g=ln(n,r,1e-14)&&n>r+1e-14,B=ln(n,A*o,1e-14),v=ln(n,1,1e-14);if(!(g&&B&&v))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];ln(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,u;return n}}class ic{constructor(e,t,A,r){this.Ka=[],this.Li=e,this.qa=t,this.Ga=A,this.Ja=r}Xa(e,t){if(e<t)throw new Error("high < low");const A=this.Li.At(),r=(e-t)*this.Qa()/A,n=new oo(this.qa,[2,2.5,2]),s=new oo(this.qa,[2,2,2.5]),o=new oo(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let u=c[0];for(let g=1;g<c.length;++g)c[g]<u&&(u=c[g]);return u})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),r=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=A-1-s,c=Math.max(r,n),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let g=this.Xa(c,u),B=c%g;B+=B<0?g:0;const v=c>=u?1:-1;let b=null,C=0;for(let U=c-B;U>u;U-=g){const F=this.Ja(U,t,!0);b!==null&&Math.abs(F-b)<this.Qa()||F<o||F>l||(C<this.Ka.length?(this.Ka[C].Ea=F,this.Ka[C].so=e.eo(U)):this.Ka.push({Ea:F,so:e.eo(U)}),C++,b=F,e.ro()&&(g=this.Xa(U*v,u)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function rc(i){return i.slice().sort(((e,t)=>Se(e.Xi())-Se(t.Xi())))}var nc;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(nc||(nc={}));const sc=new Il,oc=new an(100,1);class m0{constructor(e,t,A,r){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 Lt,this.vo=new Lt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=oc,this.xo=so(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new ic(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(QA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=jt(e.scaleMargins.top),A=jt(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(A<0||A>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${A}`);if(t+A>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+A}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return this.cn.mode===1}Mh(){return this.cn.mode===2}Oo(){return this.cn.mode===3}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(e){const t=this.Cr();let A=null;e.Wn!==void 0&&(this.cn.autoScale=e.Wn),e.Cr!==void 0&&(this.cn.mode=e.Cr,e.Cr!==2&&e.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),t.Cr===1&&e.Cr!==t.Cr&&((function(n,s){if(n===null)return!1;const o=fr(n.Ph(),s),l=fr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=pn(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=mr(this.Ih,this.xo),A!==null&&this.Ao(A));const r=t.Cr!==this.cn.mode;r&&(t.Cr===2||this.Mh())&&this.Ra(),r&&(t.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&t.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(t,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(e){this.ho!==e&&(this.ho=e,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const e=this.At()-this.No()-this.Fo();return this.lo=e,e}Lh(){return this.Wo(),this.Ih}Ao(e,t){const A=this.Ih;(t||A===null&&e!==null||A!==null&&!A.Ch(e))&&(this.bo=null,this.Ih=e)}Ni(){return this.Wo(),this.ho===0||!this.Ih||this.Ih.Ni()}jo(e){return this.Bo()?e:this.At()-1-e}Rt(e,t){return this.Mh()?e=Ni(e,t):this.Oo()&&(e=pr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),g=A===void 0?0:A.from,B=A===void 0?e.length:A.to,v=this.Ho();for(let b=g;b<B;b++){const C=e[b],U=C._t;if(isNaN(U))continue;let F=U;v!==null&&(F=v(C._t,t));const S=r+u*(F-s),K=c?S:this.ho-1-S;C.st=K}}be(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),g=A===void 0?0:A.from,B=A===void 0?e.length:A.to,v=this.Ho();for(let b=g;b<B;b++){const C=e[b];let U=C.ge,F=C.Me,S=C.xe,K=C.Se;v!==null&&(U=v(C.ge,t),F=v(C.Me,t),S=v(C.xe,t),K=v(C.Se,t));let G=r+u*(U-s),M=c?G:this.ho-1-G;C.pe=M,G=r+u*(F-s),M=c?G:this.ho-1-G,C.de=M,G=r+u*(S-s),M=c?G:this.ho-1-G,C.fe=M,G=r+u*(K-s),M=c?G:this.ho-1-G,C.me=M}}pn(e,t){const A=this.To(e,t);return this.$o(A,t)}$o(e,t){let A=e;return this.Mh()?A=(function(r,n){return n<0&&(r=-r),r/100*n+n})(A,t):this.Oo()&&(A=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(A,t)),A}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const A=this.po[t];A.Xi()===null&&A.Ki(t+1),e.push(A)}return e=rc(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const A=t.Ct();A!==null&&(e===null||A.la<e.la)&&(e=A)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=Se(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const A=Se(this.ao).Th();t=Math.max(t,.1),A.Vh(t),this.Ao(A)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=Se(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Se(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Se(this.ao).Th();n.Oh(r),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(Ni(e,t));case 3:return this.ba().format(pr(e,t));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,Se(this.e_()).ba())}Zl(e,t){return e=Ni(e,t),this.s_(e,sc)}r_(){return this.po}h_(e){this.oo={uo:e,_o:!1}}Vn(){this.po.forEach((e=>e.Vn()))}Ra(){this.bo=null;const e=this.e_();let t=100;e!==null&&(t=Math.round(1/e.ma())),this.wa=oc,this.Mh()?(this.wa=sc,t=100):this.Oo()?(this.wa=new an(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new ic(this,t,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(e,t){if(this.Wo(),this.Ni())return 0;e=this.ro()&&e?dn(e,this.xo):e;const A=Se(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),r=Se(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?fr(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const A=this.r_();let r=0,n=0;for(const l of A){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const u=l.Il(e.Os(),e.ui());let g=u&&u.Lh();if(g!==null){switch(this.cn.mode){case 1:g=mr(g,this.xo);break;case 2:g=p0(g,c.Vt);break;case 3:g=f0(g,c.Vt)}if(t=t===null?g:t.ts(Se(g)),u!==null){const B=u.Eh();B!==null&&(r=Math.max(r,B.above),n=Math.max(n,B.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=pn(t,this.xo)),t=new rA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=mr(t,this.xo))}if(this.ro()){const l=pn(t,this.xo),c=so(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?pn(this.ao,this.xo):null;this.xo=c,t=mr(l,c),u!==null&&(this.ao=mr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new rA(-.5,.5)),this.xo=so(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ni:this.Oo()?pr:this.ro()?e=>dn(e,this.xo):null}a_(e,t,A){return t===void 0?(A===void 0&&(A=this.ba()),A.format(e)):t(e)}Wh(e,t){return this.a_(e,this.yo.priceFormatter,t)}s_(e,t){return this.a_(e,this.yo.percentageFormatter,t)}}class g0{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Lt,this.yl=e,this.$i=t,this.d_=new d0(this);const A=t.W();this.f_=this.v_("left",A.leftPriceScale),this.p_=this.v_("right",A.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_(A)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const t=Array.from(this.o_.values());for(const A of t){const r=Se(A[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?jt(this.o_.get(e))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((e=>{e.S&&e.S()})),this.c_.m()}M_(){return this.u_}x_(e){this.u_=e}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(e){this.__=e,this.k_()}Lo(e){this.ho=e,this.f_.Lo(e),this.p_.Lo(e),this.po.forEach((t=>{if(this.vr(t)){const A=t.Dt();A!==null&&A.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const t=e.Dt();return t===null||this.f_!==t&&this.p_!==t}qo(e,t,A){const r=A!==void 0?A:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ri(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Se(e.Dt()).Pa();if(this.o_.has(A)){const n=jt(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const r=e.Dt();r&&r.Ba().indexOf(e)>=0&&r.Zo(e),r!==null&&(r.Yo(),this.P_(r)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,t){e.Go(t)}O_(e,t){e.Jo(t),this.k_()}B_(e){e.Qo()}A_(e,t){e.t_(t)}I_(e,t){e.i_(t),this.k_()}z_(e){e.n_()}k_(){this.po.forEach((e=>{e.Vn()}))}vn(){let e=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?e=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?e=this.f_:this.po.length!==0&&(e=this.po[0].Dt()),e===null&&(e=this.p_),e}pr(){let e=null;return this.$i.W().rightPriceScale.visible?e=this.p_:this.$i.W().leftPriceScale.visible&&(e=this.f_),e}P_(e){e!==null&&e.Vo()&&this.L_(e)}E_(e){const t=this.yl.Xs();e.Ro({Wn:!0}),t!==null&&e.h_(t),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((e=>{this.vr(e)&&this.P_(e.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=rc(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const t=e.r_();if(t&&t.length>0&&!this.yl.Ni()){const A=this.yl.Xs();A!==null&&e.h_(A)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let t=0,A=0;for(let r=0;r<e.length;r++){const n=e[r].Xi();n!==null&&(n<t&&(t=n),n>A&&(A=n))}return{H_:t,y_:A}}T_(e,t,A){let r=this.w_(t);if(r===null&&(r=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!on(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}r.qo(e),e.Gi(r),e.Ki(A),this.P_(r),this.mo=null}m_(e,t,A){t.Cr!==A.Cr&&this.L_(e)}v_(e,t){const A=Object.assign({visible:!0,autoScale:!0},ZA(t)),r=new m0(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class w0{constructor(e,t,A=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=t,this.ir=A}Y_(e){const t=e.time,A=this.q_.cacheKey(t),r=this.tr.get(A);if(r!==void 0)return r.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(jt(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(A,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,A),this.Ke++,this.Ge++,n}}class gr{constructor(e,t){ri(e<=t,"right should be >= left"),this.X_=e,this.K_=t}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(e){return this.X_<=e&&e<=this.K_}Ch(e){return this.X_===e.Os()&&this.K_===e.ui()}}function ac(i,e){return i===null||e===null?i===e:i.Ch(e)}class B0{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,t){this.nu(t),this.tr=null;for(let A=t;A<e.length;++A){const r=e[A];let n=this.J_.get(r.timeWeight);n===void 0&&(n=[],this.J_.set(r.timeWeight,n)),n.push({index:A,time:r.time,weight:r.timeWeight,originalTime:r.originalTime})}}su(e,t){const A=Math.ceil(t/e);return this.tr!==null&&this.tr.eu===A||(this.tr={Ha:this.ru(A),eu:A}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const t=[];this.J_.forEach(((A,r)=>{e<=A[0].index?t.push(r):A.splice(cr(A,e,(n=>n.index<e)),1/0)}));for(const A of t)this.J_.delete(A)}ru(e){let t=[];for(const A of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(A))continue;const r=t;t=[];const n=r.length;let s=0;const o=jt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let g=0;g<l;g++){const B=o[g],v=B.index;for(;s<n;){const b=r[s],C=b.index;if(!(C<v)){c=C;break}s++,t.push(b),u=C,c=1/0}if(c-v>=e&&v-u>=e)t.push(B),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class Oi{constructor(e){this.hu=e}lu(){return this.hu===null?null:new gr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Oi(null)}}function y0(i,e){return i.weight>e.weight?i:e}class C0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new B0,this.du=new Map,this.fu=Oi.ou(),this.vu=!0,this.pu=new Lt,this.mu=new Lt,this.bu=new Lt,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=A,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){QA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;QA(this.cn,e),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),e.barSpacing!==void 0&&this.$i.Gn(e.barSpacing),e.rightOffset!==void 0&&this.$i.Jn(e.rightOffset),e.minBarSpacing!==void 0&&this.$i.Gn((A=e.barSpacing)!==null&&A!==void 0?A:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var t,A;return(A=(t=this.uu[e])===null||t===void 0?void 0:t.time)!==null&&A!==void 0?A:null}Ui(e){var t;return(t=this.uu[e])!==null&&t!==void 0?t:null}Va(e,t){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return t?this.uu.length-1:null;const A=cr(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[A].time)?t?A:null:A}Ni(){return this.__===0||this.uu.length===0||this._u===null}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const e=this.Xs();if(e===null)return null;const t={from:e.Os(),to:e.ui()};return this.Ou(t)}Ou(e){const t=Math.round(e.from),A=Math.round(e.to),r=Se(this.Bu()),n=Se(this.Au());return{from:Se(this.Ui(Math.max(r,t))),to:Se(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Se(this.Va(e.from,!0)),to:Se(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),A=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&A!==0){const r=this.Su*e/A;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=A-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!or(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=A+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(this.gu!==null)return this.gu;const e=this.Su,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),A=Math.round(t/e),r=Se(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,u=this.$u(),g=this.cn.fixLeftEdge||u,B=this.cn.fixRightEdge||u;let v=0;for(const b of o){if(!(n<=b.index&&b.index<=s))continue;let C;v<this.Mu.length?(C=this.Mu[v],C.coord=this.It(b.index),C.label=this.Uu(b),C.weight=b.weight):(C={needAlignCoordinate:!1,coord:this.It(b.index),label:this.Uu(b),weight:b.weight},this.Mu.push(C)),this.Su>t/2&&!u?C.needAlignCoordinate=!1:C.needAlignCoordinate=g&&b.index<=l||B&&b.index>=c,v++}return this.Mu.length=v,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const A=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(A-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const t=Zs(this.__-e,0,this.__),A=Zs(this.__-Se(this.wo),0,this.__);t!==0&&A!==0&&this.Gn(this.wu.le*t/A)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const t=(this.Mo-e)/this.le();this.xu=Se(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const A=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:A+(e-A)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new gr(e,t+this.cn.rightOffset))}lc(e){const t=new gr(e.from,e.to);this.rc(t)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:t}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(e){return(this.__-1-e)/this.Su}Fu(e){const t=this.ac(e),A=this.Eu()+this.xu-t;return Math.round(1e6*A)/1e6}ju(e){const t=this.Su;this.Su=e,this.zu(),t!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Oi.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new gr(A-t+1,A);this._c(new Oi(r))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const e=this.cc();e!==null&&this.xu<e&&(this.xu=e,this.vu=!0);const t=this.dc();this.xu>t&&(this.xu=t,this.vu=!0)}cc(){const e=this.Bu(),t=this._u;return e===null||t===null?null:e-t-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(e){let t=this.du.get(e.weight);return t===void 0&&(t=new w0((A=>this.fc(A)),this.q_),this.du.set(e.weight,t)),t.Y_(e)}fc(e){return this.q_.formatTickmark(e,this.yo)}_c(e){const t=this.fu;this.fu=e,ac(t.lu(),this.fu.lu())||this.pu.m(),ac(t.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 e=this.Bu();if(e===null)return;const t=this.Xs();if(t===null)return;const A=t.Os()-e;if(A<0){const r=this.xu-A-1;this.Jn(r)}this.zu()}Pu(){this.Lu(),this.zu()}}class v0{X(e,t,A){e.useMediaCoordinateSpace((r=>this.K(r,t,A)))}gl(e,t,A){e.useMediaCoordinateSpace((r=>this.vc(r,t,A)))}vc(e,t,A){}}class T0 extends v0{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:t,mediaSize:A}=e;let r=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;t.font=s.R;const o=this.wc(t,s.Kt);o>A.width?s.Zu=A.width/o:s.Zu=1,r+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((A.height-r)/2,0);break;case"bottom":n=Math.max(A.height-r,0)}t.fillStyle=this.zt.V;for(const s of this.zt.bc){t.save();let o=0;switch(this.zt.xc){case"left":t.textAlign="left",o=s.gc/2;break;case"center":t.textAlign="center",o=A.width/2;break;case"right":t.textAlign="right",o=A.width-1-s.gc/2}t.translate(o,n),t.textBaseline="top",t.font=s.R,t.scale(s.Zu,s.Zu),t.fillText(s.Kt,0,s.Sc),t.restore(),n+=s.gc*s.Zu}}wc(e,t){const A=this.kc(e.font);let r=A.get(t);return r===void 0&&(r=e.measureText(t).width,A.set(t,r)),r}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class b0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new T0(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.W(),t=this.Ft;t.yt=e.visible,t.yt&&(t.V=e.color,t.xc=e.horzAlign,t.Mc=e.vertAlign,t.bc=[{Kt:e.text,R:Pi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class x0 extends Xs{constructor(e,t){super(),this.cn=t,this.wn=new b0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var lc,cc,hc,uc,dc;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(lc||(lc={}));class Q0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Lt,this.Rc=new Lt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new rf(this),this.yl=new C0(this,t.timeScale,this.cn.localization,A),this.vt=new ff(this,t.crosshair),this.Bc=new c0(t.crosshair),this.Ac=new x0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Vt.es())}Uh(){this.Nc(Vt.ss())}oa(){this.Nc(new Vt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){QA(this.cn,e),this.yc.forEach((t=>t.b_(e))),e.timeScale!==void 0&&this.yl.$h(e.timeScale),e.localization!==void 0&&this.yl.yu(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(e,t){if(e==="left")return void this.$h({leftPriceScale:t});if(e==="right")return void this.$h({rightPriceScale:t});const A=this.Uc(e);A!==null&&(A.Dt.$h(t),this.Pc.m())}Uc(e){for(const t of this.yc){const A=t.w_(e);if(A!==null)return{Ht:t,Dt:A}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,t){e.Lo(t),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((t=>t.S_(e))),this.Wu()}Ic(e){const t=new g0(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const A=e===void 0?this.yc.length-1:e,r=Vt.es();return r.Nn(A,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,A){e.V_(t,A)}O_(e,t,A){e.O_(t,A),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,A){t.Vo()||e.A_(t,A)}I_(e,t,A){t.Vo()||(e.I_(t,A),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,t){t.Vo()||(e.z_(t),this.Nc(this.Gc(e,2)))}E_(e,t){e.E_(t),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,t){const A=this.St();if(A.Ni()||t===0)return;const r=A.Hi();e=Math.max(1,Math.min(e,r)),A.Zu(e,t),this.Wu()}td(e){this.nd(0),this.sd(e),this.ed()}rd(e){this.yl.Jo(e),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(e){this.yl.t_(e)}sd(e){this.yl.i_(e),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(e,t,A,r,n){this.vt.gn(e,t);let s=NaN,o=this.yl.Nu(e);const l=this.yl.Xs();l!==null&&(o=Math.min(Math.max(l.Os(),o),l.ui()));const c=r.vn(),u=c.Ct();u!==null&&(s=c.pn(t,u)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const r=A.vn(),n=r.Ct(),s=r.Rt(e,Se(n)),o=this.yl.Va(t,!0),l=this.yl.It(Se(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),u=e!==null&&e>s&&!c,g=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,B=l&&(A!==void 0||g)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!B){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.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(e,t,A){const r=this.yc[0],n=this.fd(t,e,r,A);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),A=this.Cc.indexOf(e);ri(A!==-1,"Series not found"),this.Cc.splice(A,1),Se(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Se(this.dr(e));A.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();A.qo(e,t,n)}else{const n=r.Ht===A?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Vt.ss();e.$n(),this.Nc(e)}pd(e){const t=Vt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Vt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Vt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Vt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Vt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Vt.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,u,g]=sr(n),[B,v,b,C]=sr(s),U=[wA(l+o*(B-l)),wA(c+o*(v-c)),wA(u+o*(b-u)),xl(g+o*(C-g))];return`rgba(${U[0]}, ${U[1]}, ${U[2]}, ${U[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new Vt(t);if(e!==null){const r=this.yc.indexOf(e);A.Nn(r,{Fn:t})}return A}Fc(e,t){return t===void 0&&(t=2),this.Gc(this.dr(e),t)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((t=>t.j_().qh().bt()))}fd(e,t,A,r){const n=new ro(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),on(s)||n.$h(e),n}Lc(e){const t=this.cn.layout;return t.background.type==="gradient"?e===0?t.background.topColor:t.background.bottomColor:t.background.color}}function ao(i){return!DA(i)&&!ar(i)}function pc(i){return DA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(cc||(cc={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(hc||(hc={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(uc||(uc={})),(function(i){i[i.Year=0]="Year",i[i.Month=1]="Month",i[i.DayOfMonth=2]="DayOfMonth",i[i.Time=3]="Time",i[i.TimeWithSeconds=4]="TimeWithSeconds"})(dc||(dc={}));const fc=i=>i.getUTCFullYear();function F0(i,e,t){return e.replace(/yyyy/g,(A=>YA(fc(A),4))(i)).replace(/yy/g,(A=>YA(fc(A)%100,2))(i)).replace(/MMMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"long"}))(i,t)).replace(/MMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"short"}))(i,t)).replace(/MM/g,(A=>YA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>YA((r=>r.getUTCDate())(A),2))(i))}class mc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return F0(e,this.gd,this.Md)}}class U0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",YA(e.getUTCHours(),2)).replace("%m",YA(e.getUTCMinutes(),2)).replace("%s",YA(e.getUTCSeconds(),2))}}const S0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class E0{constructor(e={}){const t=Object.assign(Object.assign({},S0),e);this.Td=new mc(t.Sd,t.Cd),this.Pd=new U0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function fn(i){return 60*i*60*1e3}function lo(i){return 60*i*1e3}const mn=[{Dd:(gc=1,1e3*gc),Vd:10},{Dd:lo(1),Vd:20},{Dd:lo(5),Vd:21},{Dd:lo(30),Vd:22},{Dd:fn(1),Vd:30},{Dd:fn(3),Vd:31},{Dd:fn(6),Vd:32},{Dd:fn(12),Vd:33}];var gc;function wc(i,e){if(i.getUTCFullYear()!==e.getUTCFullYear())return 70;if(i.getUTCMonth()!==e.getUTCMonth())return 60;if(i.getUTCDate()!==e.getUTCDate())return 50;for(let t=mn.length-1;t>=0;--t)if(Math.floor(e.getTime()/mn[t].Dd)!==Math.floor(i.getTime()/mn[t].Dd))return mn[t].Vd;return 0}function co(i){let e=i;if(ar(i)&&(e=ho(i)),!ao(e))throw new Error("time must be of type BusinessDay");const t=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(t.getTime()/1e3),Bd:e}}function Bc(i){if(!pc(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function ho(i){const e=new Date(i);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${i}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function yc(i){ar(i.time)&&(i.time=ho(i.time))}class Cc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(yc)})(e):yc(e)}createConverterToInternalObj(e){return Se((function(t){return t.length===0?null:ao(t[0].time)||ar(t[0].time)?co:Bc})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const t=e;return t.Bd===void 0?new Date(1e3*t.Od).getTime():new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day)).getTime()}convertHorzItemToInternal(e){return pc(t=e)?Bc(t):ao(t)?co(t):co(ho(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new E0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new mc(t,e.locale)}formatHorzItem(e){const t=e;return this.Ad.Y_(new Date(1e3*t.Od))}formatTickmark(e,t){const A=(function(n,s,o){switch(n){case 0:case 10:return s?o?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return s?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(e.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),r=this.cn.timeScale;if(r.tickMarkFormatter!==void 0){const n=r.tickMarkFormatter(e.originalTime,A,t.locale);if(n!==null)return n}return(function(n,s,o){const l={};switch(s){case 0:l.year="numeric";break;case 1:l.month="short";break;case 2:l.day="numeric";break;case 3:l.hour12=!1,l.hour="2-digit",l.minute="2-digit";break;case 4:l.hour12=!1,l.hour="2-digit",l.minute="2-digit",l.second="2-digit"}const c=n.Bd===void 0?new Date(1e3*n.Od):new Date(Date.UTC(n.Bd.year,n.Bd.month-1,n.Bd.day));return new Date(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()).toLocaleString(o,l)})(e.time,A,t.locale)}maxTickMarkWeight(e){let t=e.reduce(y0,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(A,r=0){if(A.length===0)return;let n=r===0?null:A[r-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let l=r;l<A.length;++l){const c=A[l],u=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=wc(u,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=u}if(r===0&&A.length>1){const l=Math.ceil(o/(A.length-1)),c=new Date(1e3*(A[0].time.Od-l));A[0].timeWeight=wc(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return QA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const ki=typeof window<"u";function vc(){return!!ki&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function uo(){return!!ki&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function po(i){return i+i%2}function fo(i,e){return i.zd-e.zd}function mo(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class L0{constructor(e,t,A,r){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=e,this.Ud=t,this.qd=A,this.rs=r}Yd(e,t){if(this.Ld!==null){if(this.Ld.ot===t)return void(this.Ld.zd=e);if(Math.abs(this.Ld.zd-e)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:t,zd:e}}Vr(e,t){if(this.Ld===null||this.Ed===null||t-this.Ld.ot>50)return;let A=0;const r=mo(this.Ld,this.Ed,this.Ud),n=fo(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=mo(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=fo(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const g=mo(this.Nd,this.Fd,this.Ud);if(Math.sign(g)===Math.sign(r)){const B=fo(this.Nd,this.Fd);s.push(g),o.push(B),A+=B}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/A*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,u){const g=Math.log(u);return Math.log(1*g/-c)/g})(Math.abs(l),this.qd))}tc(e){const t=Se(this.Wd),A=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,A)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Se(this.Wd).ot;return Math.min(t,this.jd)}}class M0{constructor(e,t){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=e,this.Qd=t,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 Ql(sr(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.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",this.Gd==="dark"),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function Ci(i,e){const t=Se(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=Vp(t,{options:{allowResizeObserver:!1},transform:(r,n)=>({width:Math.max(r.width,n.width),height:Math.max(r.height,n.height)})});return A.resizeCanvasElement(e),A}function vi(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function go(i,e,t,A){i.gl&&i.gl(e,t,A)}function gn(i,e,t,A){i.X(e,t,A)}function wo(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function H0(i){ki&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Bo{constructor(e,t,A){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=!uo(),this.Af=r=>{this.If(r)},this.zf=r=>{if(this.Lf(r)){const n=this.Ef(r);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(_A(r),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(r);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(_A(r),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=t,this.cn=A,this.Xf()}S(){this.gf!==null&&(this.gf(),this.gf=null),this.Mf!==null&&(this.Mf(),this.Mf=null),this.Sf!==null&&(this.Sf(),this.Sf=null),this.kf!==null&&(this.kf(),this.kf=null),this.yf!==null&&(this.yf(),this.yf=null),this.xf!==null&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(e){this.Sf&&this.Sf();const t=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",t)},this.Zf.addEventListener("mousemove",t),this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.Qf),this.Bf=!0}Yf(){this.lf!==null&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){this.uf!==null&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(e){if(this.Df||this.pf!==null||this.Lf(e))return;const t=this.Ef(e);this.Uf(t,this.Hf.tv),this.Bf=!0}iv(e){const t=yo(e.changedTouches,Se(this.Of));if(t===null||(this.Vf=wn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(_A(t),Se(this.pf)),{nv:r,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),Ki(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(_A(e),Se(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:A,sv:r,Nf:A+r}}ov(e){let t=yo(e.changedTouches,Se(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=wn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const A=this.Ef(e,t);if(this.Wf(A,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(_A(t),this.cf);r<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&Ki(e));this._f===0&&Ki(e),e.touches.length===0&&this.ff&&(this.ff=!1,Ki(e))}If(e){if(e.button!==0)return;const t=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),vc()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(t,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:A}=this.Ff(_A(e),this.af);A<5&&!this.bf&&this.Uf(t,this.Hf.qf),this.Yf()}else this.bf||this.Uf(t,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const t=e.changedTouches[0];this.Of=t.identifier,this.Vf=wn(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=_A(t),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{A.removeEventListener("touchmove",n),A.removeEventListener("touchend",s)},A.addEventListener("touchmove",n,{passive:!1}),A.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const r=this.Ef(e,t);this.Wf(r,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=_A(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;vc()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=_A(e),this.kf&&(this.kf(),this.kf=null);{const r=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",r),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",r),t.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=_A(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,t=A=>{this.Hf.wv&&(A.composed&&this.Zf.contains(A.composedPath()[0])||A.target&&this.Zf.contains(A.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",t)},this.gf=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}uo()&&(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}),H0(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",(()=>{}),{passive:!1})}Mv(){this.Hf.xv===void 0&&this.Hf.Sv===void 0&&this.Hf.kv===void 0||(this.Zf.addEventListener("touchstart",(e=>this.yv(e.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(e=>{if(e.touches.length===2&&this.Cf!==null&&this.Hf.Sv!==void 0){const t=Tc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Ki(e)}}),{passive:!1}),this.Zf.addEventListener("touchend",(e=>{this.yv(e.touches)})))}yv(e){e.length===1&&(this.Pf=!1),e.length!==2||this.Pf||this.ff?this.Cv():this.Tv(e)}Tv(e){const t=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,st:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this.Tf=Tc(e[0],e[1]),this.Hf.xv!==void 0&&this.Hf.xv(),this.Kf()}Cv(){this.Cf!==null&&(this.Cf=null,this.Hf.kv!==void 0&&this.Hf.kv())}gv(e){if(this.Sf&&this.Sf(),this.Lf(e)||!this.Bf)return;const t=this.Ef(e);this.Uf(t,this.Hf.Pv),this.Bf=!uo()}vv(e){const t=yo(e.touches,Se(this.Of));if(t===null)return;const A=this.Ef(e,t);this.Wf(A,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:wn(e)<this.Vf+500}Wf(e,t){t&&t.call(this.Hf,e)}Uf(e,t){t&&t.call(this.Hf,e)}Ef(e,t){const A=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:A.clientX,clientY:A.clientY,pageX:A.pageX,pageY:A.pageY,screenX:A.screenX,screenY:A.screenY,localX:A.clientX-r.left,localY:A.clientY-r.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Ki(e)}}}}function Tc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Ki(i){i.cancelable&&i.preventDefault()}function _A(i){return{nt:i.pageX,st:i.pageY}}function wn(i){return i.timeStamp||performance.now()}function yo(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function Bn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function I0(i,e,t){for(const A of i){const r=A.gt();if(r!==null&&r.wr){const n=r.wr(e,t);if(n!==null)return{Bv:A,Iv:n}}}return null}function Co(i,e){return t=>{var A,r,n,s;return((r=(A=t.Dt())===null||A===void 0?void 0:A.Pa())!==null&&r!==void 0?r:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,i))!==null&&s!==void 0?s:[]}}function bc(i,e,t,A){if(!i.length)return;let r=0;const n=t/2,s=i[0].At(A,!0);let o=e===1?n-(i[0].Vi()-s/2):i[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<i.length;l++){const c=i[l],u=i[l-1],g=u.At(A,!1),B=c.Vi(),v=u.Vi();if(e===1?B>v-g:B<v+g){const b=v-g*e;c.Oi(b);const C=b-e*g/2;if((e===1?C<0:C>t)&&o>0){const U=e===1?-1-C:C-t,F=Math.min(U,o);for(let S=r;S<i.length;S++)i[S].Oi(i[S].Vi()+e*F);o-=F}}else r=l,o=e===1?v-g-B:B-(v+g)}}class xc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new hr(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=e,this.cn=t,this.ko=t.layout,this.Oc=A,this.qv=r==="left",this.Yv=Co("normal",r),this.Zv=Co("top",r),this.Xv=Co("bottom",r),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=Ci(this.Kv,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const n=this.Gv.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Jv=Ci(this.Kv,bt({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";const o={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 Bo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose(),this.Li!==null&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const t=this.ap(),A=Se(this.Gv.canvasElement.getContext("2d"));A.save();const r=this.Li.Ha();A.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(A,r[0].so),this.Fv.xi(A,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const u=this.Fv.xi(A,n[c].Kt());u>e&&(e=u)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),u=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,u))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,u))-.11111111111111,s)))}var o;A.restore();const l=e||34;return po(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&wi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return Se(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,Se(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=Bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}bt(){var e;(e=this.Li)===null||e===void 0||e.Ha()}Qv(e){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!0,t.V_(A,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp(),r=this.Li;t.O_(A,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),A=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,A))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!1,t.B_(A,this.Li)}sp(e){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(e){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(e){this.kp(0)}up(){const e=[],t=this.Li===null?void 0:this.Li;return(A=>{for(let r=0;r<A.length;++r){const n=A[r].Rn(this.tn.fp(),t);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,s):Sl(e,0,0,A,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(l)),u=Math.floor(.5*l),g=Math.round(r.T*o);s.beginPath();for(const B of t)s.rect(Math.floor(n*o),Math.round(B.Ea*l)-u,g,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-r.A):Math.round(n+r.T+r.A),c=t.map((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const g=t[u];s.fillText(g.so,l,g.Ea+c[u])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),r=this.ap();this.Li===A.pr()&&this.tn.fp().Uo().forEach((s=>{A.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(A,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,r)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,r=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));r.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),l=s.ki();l>-o&&l<o&&s.Oi(o),l>this.Ev.height-o&&l<this.Ev.height+o&&s.Oi(this.Ev.height-o)}bc(r,1,this.Ev.height,t),bc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Se(this.Li)).X(e,A,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((l=>{l.forEach((c=>{c.gt(Se(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return Pi(this.ko.fontSize,this.ko.fontFamily)}}function D0(i,e){var t,A;return(A=(t=i.ua)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function yn(i,e){var t,A;return(A=(t=i.Pn)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function _0(i,e){var t,A;return(A=(t=i.Ji)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function P0(i,e){var t,A;return(A=(t=i.aa)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}class vo{constructor(e,t){this.Ev=bt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Lt,this.Op=new Lt,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||this.Np===null||this.$i().Uh()},this.Uv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Qd=e,this.Np=t,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 A=document.createElement("div");A.style.width="100%",A.style.height="100%",A.style.position="relative",A.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(A),this.Gv=Ci(A,bt({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=Ci(A,bt({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const n=this.Jv.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.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 Bo(this.Jv.canvasElement,this,{ev:()=>this.Ip===null&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>this.Ip===null&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.Cp!==null&&this.Cp.S(),this.Tp!==null&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Se(this.Np)}qp(e){var t,A;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(vo.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(t=this.Pp)!==null&&t!==void 0?t:new M0(this.Wp,this.Qd),this.Pp.bt()):((A=this.Pp)===null||A===void 0||A.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const e=this.Np.R_();this.Cp.Gi(Se(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Se(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const t=e.localX,A=e.localY;this.Gp(t,A,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const A=e.localX,r=e.localY;this.Gp(A,r,e);const n=this.wr(A,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const t={x:e.localX,y:e.localY};this.rm(t,t,e)}}Pv(e){this.Np!==null&&(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(e,t){if(!this.Qd.W().handleScale.pinch)return;const A=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,A)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,A=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Se(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,u,g){var B,v;let b,C;for(const S of c){const K=(v=(B=S.va)===null||B===void 0?void 0:B.call(S,u,g))!==null&&v!==void 0?v:[];for(const G of K)U=G.zOrder,(!(F=b?.zOrder)||U==="top"&&F!=="top"||U==="normal"&&F==="bottom")&&(b=G,C=S)}var U,F;return b&&C?{zv:b,Hc:C}:null})(o,n,s);if(l?.zv.zOrder==="top")return Bn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Bn(l);const u=I0(c.Pn(r),n,s);if(u!==null)return{Hc:c,Bv:u.Bv,Iv:u.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Bn(l)}return l?.zv?Bn(l):null})(A,e,t)}_m(e,t){Se(t==="left"?this.Cp:this.Tp).cp(bt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){wi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Wp.style.width=e.width+"px",this.Wp.style.height=e.height+"px")}dm(){const e=Se(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const A=t.Dt();A!==null&&e.P_(A),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,D0),this.vm(A),this.pm(A),this.fm(A,yn),this.fm(A,_0)))}this.Jv.applySuggestedBitmapSize();const t=Bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,P0))}wm(){return this.Cp}gm(){return this.Tp}bp(e,t){this.fm(e,t)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,t){const A=t.localX,r=t.localY;e.M()&&e.m(this.$i().St().Nu(A),{x:A,y:r},t)}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,o):Sl(e,0,0,A,r,s,o)}vm(e){const t=Se(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,yn,go,t),this.Mm(e,yn,gn,t)}bm(e){this.Mm(e,yn,gn,this.$i().Zc())}fm(e,t){const A=Se(this.Np).Uo();for(const r of A)this.Mm(e,t,go,r);for(const r of A)this.Mm(e,t,gn,r)}Mm(e,t,A,r){const n=Se(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;wo(t,(c=>A(c,e,o,l)),r,n)}Zp(){if(this.Np===null)return;const e=this.Qd,t=this.Np.R_().W().visible,A=this.Np.D_().W().visible;t||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),A||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const r=e.$t().ud();t&&this.Cp===null&&(this.Cp=new xc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new xc(this,e.W(),r,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,Se(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,A){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,A);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),A=this.fp();if(t.z_(A,A.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Se(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const t=this.$i(),A=t.St();if(A.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),l=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:l,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new L0(.2/c,7/c,.997,15/c),this.Ep.Yd(A.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||t.A_(this.Np,o,e.localY),t.nd(e.localX),this.Dp=!0}this.Dp&&(o.Ni()||t.I_(this.Np,o,e.localY),t.sd(e.localX),this.Ep!==null&&this.Ep.Yd(A.Hu(),l))}}class Qc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=bt({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=A.ud,this.cn=t,this.Tm=r,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=Ci(this.Kv,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){wi(this.Ev,e)||(this.Ev=e,this.Gv.resizeCanvasElement(e),this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.ft=!0)}vp(e){if(e<3&&!this.ft||this.Ev.width===0||this.Ev.height===0)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const t=Bi(this.Gv);t!==null&&t.useBitmapCoordinateSpace((A=>{this.mp(A),this.Ie(A)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*A),s=Math.floor(this.Oc.W().C*r),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Pm())}}function To(i){return e=>{var t,A;return(A=(t=e.fa)===null||t===void 0?void 0:t.call(e,i))!==null&&A!==void 0?A:[]}}const N0=To("normal"),O0=To("top"),k0=To("bottom");class K0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=bt({width:0,height:0}),this.Om=new Lt,this.Fv=new hr(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=e,this.q_=t,this.cn=e.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=Ci(this.Im,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const A=this.Gv.canvasElement;A.style.position="absolute",A.style.zIndex="1",A.style.left="0",A.style.top="0",this.Jv=Ci(this.Im,bt({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.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 Bo(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),this.Rm!==null&&this.Rm.S(),this.Dm!==null&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(e){if(this.Vm)return;this.Vm=!0;const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.Jc(e.localX)}pv(e){this.bv(e)}wv(){const e=this.Qd.$t();!e.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&e.hd())}av(e){const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.rd(e.localX)}hv(e){this.av(e)}cv(){this.Vm=!1;const e=this.Qd.$t();e.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||e.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(e,t,A){wi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.Om.m(e)),this.Rm!==null&&this.Rm.cp(bt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(bt({width:A,height:e.height}))}Wm(){const e=this.jm();return Math.ceil(e.C+e.T+e.P+e.L+e.B+e.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,k0)})),this.wp(A),this.$m(A,N0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=Bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,O0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)wo(t,(n=>go(n,e,!1,void 0)),r,void 0);for(const r of A)wo(t,(n=>gn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const u=Math.max(1,Math.floor(l)),g=Math.floor(.5*l);o.beginPath();const B=Math.round(n.T*c);for(let v=A.length;v--;){const b=Math.round(A[v].coord*l);o.rect(b-g,0,u,B)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const l=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}}))}Ym(e,t,A){const r=this.Fv.xi(e,A),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const A=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return Pi(this.j(),this.cn.fontFamily)}Zm(){return Pi(this.j(),this.cn.fontFamily,"bold")}jm(){this.k===null&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new hr,Hm:0});const e=this.k,t=this._p();if(e.R!==t){const A=this.j();e.P=A,e.R=t,e.L=3*A/12,e.B=3*A/12,e.ji=9*A/12,e.N=0,e.Hm=4*A/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),t=e.W();t.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),t.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const A={ud:this.Qd.$t().ud()},r=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Qc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Qc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const V0=!!ki&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!ki&&(!((bo=navigator?.userAgentData)===null||bo===void 0)&&bo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var bo;class z0{constructor(e,t,A){var r;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 Lt,this.Op=new Lt,this.Rc=new Lt,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=A,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%",(r=this.Xd).style.userSelect="none",r.style.webkitUserSelect="none",r.style.msUserSelect="none",r.style.MozUserSelect="none",r.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),xo(this.cn)&&this.hb(!0),this.$i=new Q0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new K0(this,this.q_),this.sb.appendChild(this.ab.lp());const n=t.autoSize&&this.ob();let s=this.cn.width,o=this.cn.height;if(n||s===0||o===0){const l=e.getBoundingClientRect();s=s||l.width,o=o||l.height}this._b(s,o),this.ub(),e.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),this.Km!==0&&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 e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],Se(this.ab).S(),this.Xd.parentElement!==null&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(e,t,A=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return bt({width:l-l%2,height:c-c%2})})(bt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Se(this.Xd).style.height=n,Se(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Vt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Vt.es());for(let t=0;t<this.Xm.length;t++)this.Xm[t].vp(e.Hn(t).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const t=xo(this.cn);this.$i.$h(e);const A=xo(this.cn);A!==t&&this.hb(A),this.cb(),this.bb(e)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){this.Qm!==null&&(this.mb(this.Qm,performance.now()),this.Qm=null);const e=this.gb(null),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const A=Se(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Se(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return jt(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let u=0;u<this.Xm.length;u++){const g=this.Xm[u],B=Se(o==="left"?g.wm():g.gm()),v=B.xp();e!==null&&B.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Se(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,A),A+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Se(r.gm()).xp().width);const s=(o,l,c)=>{Se(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Se(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,A),l=Se(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return bt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const b of this.Xm)this.xb()&&(t=Math.max(t,Se(b.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Se(b.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=b.M_();t=po(t),A=po(A);const r=this.__,n=this.ho,s=Math.max(r-t-A,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const u=0+l,g=n<u?0:n-u,B=g/e;let v=0;for(let b=0;b<this.Xm.length;++b){const C=this.Xm[b];C.qp(this.$i.qc()[b]);let U=0,F=0;F=b===this.Xm.length-1?g-v:Math.round(C.M_()*B),U=Math.max(F,2),v+=U,C.cp(bt({width:s,height:U})),this.xb()&&C._m(t,"left"),this.Sb()&&C._m(A,"right"),C.fp()&&this.$i.Kc(C.fp(),U)}this.ab.Fm(bt({width:o?s:0,height:l}),o?t:0,o?A:0),this.$i.S_(s),this.Gm!==t&&(this.Gm=t),this.Jm!==A&&(this.Jm=A)}hb(e){e?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return V0?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const t=this.Rb(e),A=t*e.deltaX/100,r=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),r!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(r)*Math.min(1,Math.abs(r)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}A!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*A)}mb(e,t){var A;const r=e.jn();r===3&&this.Db(),r!==3&&r!==2||(this.Vb(e),this.Ob(e,t),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((A=this.Qm)===null||A===void 0?void 0:A.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,t),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,t){for(const A of e.Qn())this.ns(A,t)}Vb(e){const t=this.$i.qc();for(let A=0;A<t.length;A++)e.Hn(A).Wn&&t[A].N_()}ns(e,t){const A=this.$i.St();switch(e.qn){case 0:A.hc();break;case 1:A.lc(e.Vt);break;case 2:A.Gn(e.Vt);break;case 3:A.Jn(e.Vt);break;case 4:A.qu();break;case 5:e.Vt.Qu(t)||A.Jn(e.Vt.tc(t))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((t=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const A=this.Qm;this.Qm=null,this.mb(A,t);for(const r of A.Qn())if(r.qn===5&&!r.Vt.Qu(t)){this.$t().Zn(r.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,A=this.Xm.length;for(let r=t;r<A;r++){const n=jt(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=A;r<t;r++){const n=new vo(this,e[r]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var r;const n=new Map;e!==null&&this.$i.wt().forEach((u=>{const g=u.In().ll(e);g!==null&&n.set(u,g)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof ro?o.Hc:void 0,c=o!==null&&o.Iv!==void 0?o.Iv.gr:void 0;return{zb:s,ee:e??void 0,Lb:t??void 0,Eb:l,Nb:n,Fb:c,Wb:A??void 0}}Bb(e,t,A){this.Vp.m((()=>this.Ib(e,t,A)))}Ab(e,t,A){this.Op.m((()=>this.Ib(e,t,A)))}lb(e,t,A){this.Rc.m((()=>this.Ib(e,t,A)))}cb(){const e=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=e}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((e=>{const t=e.find((A=>A.target===this.Jd));t&&this._b(t.contentRect.width,t.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function xo(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function W0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function Fc(i,e){var t={};for(var A in i)Object.prototype.hasOwnProperty.call(i,A)&&e.indexOf(A)<0&&(t[A]=i[A]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(A=Object.getOwnPropertySymbols(i);r<A.length;r++)e.indexOf(A[r])<0&&Object.prototype.propertyIsEnumerable.call(i,A[r])&&(t[A[r]]=i[A[r]])}return t}function Uc(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.color!==void 0&&(n.V=t.color),n}function R0(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.lineColor!==void 0&&(n.lt=t.lineColor),t.topColor!==void 0&&(n.Ps=t.topColor),t.bottomColor!==void 0&&(n.Rs=t.bottomColor),n}function G0(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.topLineColor!==void 0&&(n.Re=t.topLineColor),t.bottomLineColor!==void 0&&(n.De=t.bottomLineColor),t.topFillColor1!==void 0&&(n.ke=t.topFillColor1),t.topFillColor2!==void 0&&(n.ye=t.topFillColor2),t.bottomFillColor1!==void 0&&(n.Ce=t.bottomFillColor1),t.bottomFillColor2!==void 0&&(n.Te=t.bottomFillColor2),n}function $0(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),r}function X0(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function J0(i,e,t,A,r){const n=jt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:g,color:B}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:Fc(u,["time","color"]),V:B}}function Cn(i){return i.Vt!==void 0}function Sc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function Ti(i){return(e,t,A,r,n,s)=>(function(o,l){return l?l(o):(c=o).open===void 0&&c.value===void 0;var c})(A,s)?Sc({ot:e,ee:t,zb:r},A):Sc(i(e,t,A,r,n),A)}function Ec(i){return{Candlestick:Ti(X0),Bar:Ti($0),Area:Ti(R0),Baseline:Ti(G0),Histogram:Ti(Uc),Line:Ti(Uc),Custom:Ti(J0)}[i]}function Lc(i){return{ee:0,Hb:new Map,la:i}}function Mc(i,e){if(i!==void 0&&i.length!==0)return{$b:e.key(i[0].ot),Ub:e.key(i[i.length-1].ot)}}function Hc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),jt(e)}class Z0{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,t){let A=this.qb.size!==0,r=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)A=!1,r=!0,this.qb.clear();else for(const l of this.Xb)l.pointData.Hb.delete(e)&&(r=!0);let s=[];if(t.length!==0){const l=t.map((v=>v.time)),c=this.q_.createConverterToInternalObj(t),u=Ec(e.Qh()),g=e.Ca(),B=e.Ta();s=t.map(((v,b)=>{const C=c(v.time),U=this.q_.key(C);let F=this.qb.get(U);F===void 0&&(F=Lc(C),this.qb.set(U,F),r=!0);const S=u(C,F.ee,v,l[b],g,B);return F.Hb.set(e,S),S}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:Hc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const g=Mc(l,u),B=Mc(c,u);if(g!==void 0&&B!==void 0)return{ta:g.Ub>=B.Ub&&g.$b>=B.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(C){C.zb===void 0&&(C.zb=C.time)})(A),this.q_.preprocessData(t);const r=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(r)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${r}`);let s=this.qb.get(this.q_.key(r));const o=s===void 0;s===void 0&&(s=Lc(r),this.qb.set(this.q_.key(r),s));const l=Ec(e.Qh()),c=e.Ca(),u=e.Ta(),g=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,g),this.nw(e,g);const B={ta:Cn(g)};if(!o)return this.tw(e,-1,B);const v={timeWeight:0,time:s.la,pointData:s,originalTime:Hc(s.Hb)},b=cr(this.Xb,this.q_.key(v.time),((C,U)=>this.q_.key(C.time)<U));this.Xb.splice(b,0,v);for(let C=b;C<this.Xb.length;++C)Qo(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,b),this.tw(e,b,B)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const r=A.length!==0?A[A.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?Cn(t)&&A.push(t):Cn(t)?A[A.length-1]=t:A.splice(-1,1),this.Zb.set(e,t.ot)}Jb(e,t){t.length!==0?(this.Yb.set(e,t.filter(Cn)),this.Zb.set(e,t[t.length-1].ot)):(this.Yb.delete(e),this.Zb.delete(e))}Gb(){for(const e of this.Xb)e.pointData.Hb.size===0&&this.qb.delete(this.q_.key(e.time))}Qb(e){let t=-1;for(let A=0;A<this.Xb.length&&A<e.length;++A){const r=this.Xb[A],n=e[A];if(this.q_.key(r.time)!==this.q_.key(n.time)){t=A;break}n.timeWeight=r.timeWeight,Qo(n.pointData,A)}if(t===-1&&this.Xb.length!==e.length&&(t=Math.min(this.Xb.length,e.length)),t===-1)return-1;for(let A=t;A<e.length;++A)Qo(e[A].pointData,A);return this.q_.fillWeightsForPoints(e,t),this.Xb=e,t}sw(){if(this.Yb.size===0)return null;let e=0;return this.Yb.forEach((t=>{t.length!==0&&(e=Math.max(e,t[t.length-1].ee))})),e}tw(e,t,A){const r={ew:new Map,St:{Eu:this.sw()}};if(t!==-1)this.Yb.forEach(((n,s)=>{r.ew.set(s,{$e:n,rw:s===e?A:void 0})})),this.Yb.has(e)||r.ew.set(e,{$e:[],rw:A}),r.St.hw=this.Xb,r.St.lw=t;else{const n=this.Yb.get(e);r.ew.set(e,{$e:n||[],rw:A})}return r}}function Qo(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function Fo(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function Ic(i){const e=Fo(i);return i.V!==void 0&&(e.color=i.V),e}function Y0(i){const e=Fo(i);return i.lt!==void 0&&(e.lineColor=i.lt),i.Ps!==void 0&&(e.topColor=i.Ps),i.Rs!==void 0&&(e.bottomColor=i.Rs),e}function q0(i){const e=Fo(i);return i.Re!==void 0&&(e.topLineColor=i.Re),i.De!==void 0&&(e.bottomLineColor=i.De),i.ke!==void 0&&(e.topFillColor1=i.ke),i.ye!==void 0&&(e.topFillColor2=i.ye),i.Ce!==void 0&&(e.bottomFillColor1=i.Ce),i.Te!==void 0&&(e.bottomFillColor2=i.Te),e}function Dc(i){const e={open:i.Vt[0],high:i.Vt[1],low:i.Vt[2],close:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function j0(i){const e=Dc(i);return i.V!==void 0&&(e.color=i.V),e}function em(i){const e=Dc(i),{V:t,Ot:A,Xh:r}=i;return t!==void 0&&(e.color=t),A!==void 0&&(e.borderColor=A),r!==void 0&&(e.wickColor=r),e}function Uo(i){return{Area:Y0,Line:Ic,Baseline:q0,Histogram:Ic,Bar:j0,Candlestick:em,Custom:tm}[i]}function tm(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const Am={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},im={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},rm={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Gs,attributionLogo:!0},So={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},nm={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},sm={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Gs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function _c(){return{width:0,height:0,autoSize:!1,layout:rm,crosshair:Am,grid:im,overlayPriceScales:Object.assign({},So),leftPriceScale:Object.assign(Object.assign({},So),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},So),{visible:!0}),timeScale:nm,watermark:sm,localization:{locale:ki?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 om{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return on(this.ow)?this.aw.Mb(this.ow):0}Li(){return Se(this.aw.$t().Uc(this.ow)).Dt}}function Pc(i,e,t){const A=Fc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const am={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class lm{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class cm{constructor(e,t,A,r,n){this.uw=new Lt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=r}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().Rt(e,t.Vt)}coordinateToPrice(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().pn(e,t.Vt)}barsInLogicalRange(e){if(e===null)return null;const t=new Oi(new gr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const r=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=Se(A.el()),o=Se(A.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.zb,l.to=n.zb),l}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:Uo(this.seriesType())(A)}data(){const e=Uo(this.seriesType());return this.Es.In().ne().map((t=>e(t)))}subscribeDataChanged(e){this.uw.l(e)}unsubscribeDataChanged(e){this.uw.v(e)}setMarkers(e){this.q_;const t=e.map((A=>Pc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Pc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return ZA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=QA(ZA(am),e),A=this.Es.ea(t);return new lm(A)}removePriceLine(e){this.Es.ra(e._w())}seriesType(){return this.Es.Qh()}attachPrimitive(e){this.Es.ka(e),e.attached&&e.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(e){this.Es.ya(e),e.detached&&e.detached()}mw(e){this.uw.M()&&this.uw.m(e)}}class hm{constructor(e,t,A){this.ww=new Lt,this.mu=new Lt,this.Om=new Lt,this.$i=e,this.yl=e.St(),this.ab=t,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_=A}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(e,t){t?this.yl.Ju(e,1e3):this.$i.Jn(e)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const e=this.yl.Vu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const t={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},A=this.yl.Iu(t);this.$i.pd(A)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ri(e.from<=e.to,"The from index cannot be after the to index."),this.$i.pd(e)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(e){const t=this.$i.St();return t.Ni()?null:t.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const t=this.q_.convertHorzItemToInternal(e),A=this.yl.Va(t,!1);return A===null?null:this.yl.It(A)}coordinateToTime(e){const t=this.$i.St(),A=t.Nu(e),r=t.Ui(A);return r===null?null:r.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},ZA(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(e){this.Om.m(e.width,e.height)}}function um(i){if(i===void 0||i.type==="custom")return;const e=i;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(t){if(t>=1)return 0;let A=0;for(;A<8;A++){const r=Math.round(t);if(Math.abs(r-t)<1e-8)return A;t*=10}return A})(e.minMove))}function Nc(i){return(function(e){if(rn(e.handleScale)){const A=e.handleScale;e.handleScale={axisDoubleClickReset:{time:A,price:A},axisPressedMouseMove:{time:A,price:A},mouseWheel:A,pinch:A}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:A,axisDoubleClickReset:r}=e.handleScale;rn(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),rn(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;rn(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class dm{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Lt,this.Cw=new Lt,this.Tw=new Lt,this.Pw=new Z0(t);const r=A===void 0?ZA(_c()):QA(ZA(_c()),Nc(A));this.q_=t,this.aw=new z0(e,r,t),this.aw.lm().l((s=>{this.yw.M()&&this.yw.m(this.Rw(s()))}),this),this.aw.am().l((s=>{this.Cw.M()&&this.Cw.m(this.Rw(s()))}),this),this.aw.Xc().l((s=>{this.Tw.M()&&this.Tw.m(this.Rw(s()))}),this);const n=this.aw.$t();this.Dw=new hm(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(e,t,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=_i(e),r=Object.assign(Object.assign({},Bl),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Jp,e)}addBaselineSeries(e){return this.Vw("Baseline",Zp,e)}addBarSeries(e){return this.Vw("Bar",$p,e)}addCandlestickSeries(e={}){return(function(t){t.borderColor!==void 0&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),t.wickColor!==void 0&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)})(e),this.Vw("Candlestick",Gp,e)}addHistogramSeries(e){return this.Vw("Histogram",Yp,e)}addLineSeries(e){return this.Vw("Line",Xp,e)}removeSeries(e){const t=jt(this.Sw.get(e)),A=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(A),this.Sw.delete(e),this.kw.delete(t)}pw(e,t){this.Ow(this.Pw.Kb(e,t))}bw(e,t){this.Ow(this.Pw.iw(e,t))}subscribeClick(e){this.yw.l(e)}unsubscribeClick(e){this.yw.v(e)}subscribeCrosshairMove(e){this.Tw.l(e)}unsubscribeCrosshairMove(e){this.Tw.v(e)}subscribeDblClick(e){this.Cw.l(e)}unsubscribeDblClick(e){this.Cw.v(e)}priceScale(e){return new om(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Nc(e))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const e=this.aw.Tb();return{height:e.height,width:e.width}}setCrosshairPosition(e,t,A){const r=this.Sw.get(A);if(r===void 0)return;const n=this.aw.$t().dr(r);n!==null&&this.aw.$t().ad(e,t,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,t,A={},r){um(A.priceFormat);const n=QA(ZA(yl),ZA(t),A),s=this.aw.$t().dd(e,n,r),o=new cm(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((A,r)=>r.J(A.$e,A.rw))),t.Wu()}Bw(e){return jt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=Uo(s)(r);if(s!=="Custom")ri(W0(o));else{const l=n.Ta();ri(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const A=e.Eb!==void 0&&this.kw.has(e.Eb)?this.Bw(e.Eb):void 0;return{time:e.zb,logical:e.ee,point:e.Lb,hoveredSeries:A,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function pm(i,e,t){let A;if(ar(i)){const n=document.getElementById(i);ri(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new dm(A,e,t);return e.setOptions(r.options()),r}function fm(i,e){return pm(i,new Cc,Cc.Id(e))}Object.assign(Object.assign({},yl),Bl);function Oc(i,e){return function(){return i.apply(e,arguments)}}const{toString:mm}=Object.prototype,{getPrototypeOf:Eo}=Object,{iterator:vn,toStringTag:kc}=Symbol,Tn=(i=>e=>{const t=mm.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),UA=i=>(i=i.toLowerCase(),e=>Tn(e)===i),bn=i=>e=>typeof e===i,{isArray:Vi}=Array,zi=bn("undefined");function wr(i){return i!==null&&!zi(i)&&i.constructor!==null&&!zi(i.constructor)&&nA(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Kc=UA("ArrayBuffer");function gm(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Kc(i.buffer),e}const wm=bn("string"),nA=bn("function"),Vc=bn("number"),Br=i=>i!==null&&typeof i=="object",Bm=i=>i===!0||i===!1,xn=i=>{if(Tn(i)!=="object")return!1;const e=Eo(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(kc in i)&&!(vn in i)},ym=i=>{if(!Br(i)||wr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},Cm=UA("Date"),vm=UA("File"),Tm=UA("Blob"),bm=UA("FileList"),xm=i=>Br(i)&&nA(i.pipe),Qm=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||nA(i.append)&&((e=Tn(i))==="formdata"||e==="object"&&nA(i.toString)&&i.toString()==="[object FormData]"))},Fm=UA("URLSearchParams"),[Um,Sm,Em,Lm]=["ReadableStream","Request","Response","Headers"].map(UA),Mm=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Vi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(wr(i))return;const n=t?Object.getOwnPropertyNames(i):Object.keys(i),s=n.length;let o;for(A=0;A<s;A++)o=n[A],e.call(null,i[o],o,i)}}function zc(i,e){if(wr(i))return null;e=e.toLowerCase();const t=Object.keys(i);let A=t.length,r;for(;A-- >0;)if(r=t[A],e===r.toLowerCase())return r;return null}const bi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wc=i=>!zi(i)&&i!==bi;function Lo(){const{caseless:i,skipUndefined:e}=Wc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&zc(t,n)||n;xn(t[s])&&xn(r)?t[s]=Lo(t[s],r):xn(r)?t[s]=Lo({},r):Vi(r)?t[s]=r.slice():(!e||!zi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&yr(arguments[r],A);return t}const Hm=(i,e,t,{allOwnKeys:A}={})=>(yr(e,(r,n)=>{t&&nA(r)?Object.defineProperty(i,n,{value:Oc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),Im=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Dm=(i,e,t,A)=>{i.prototype=Object.create(e.prototype,A),Object.defineProperty(i.prototype,"constructor",{value:i,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},_m=(i,e,t,A)=>{let r,n,s;const o={};if(e=e||{},i==null)return e;do{for(r=Object.getOwnPropertyNames(i),n=r.length;n-- >0;)s=r[n],(!A||A(s,i,e))&&!o[s]&&(e[s]=i[s],o[s]=!0);i=t!==!1&&Eo(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},Pm=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const A=i.indexOf(e,t);return A!==-1&&A===t},Nm=i=>{if(!i)return null;if(Vi(i))return i;let e=i.length;if(!Vc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},Om=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Eo(Uint8Array)),km=(i,e)=>{const A=(i&&i[vn]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},Km=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},Vm=UA("HTMLFormElement"),zm=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Rc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Wm=UA("RegExp"),Gc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};yr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},Rm=i=>{Gc(i,(e,t)=>{if(nA(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(nA(A)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Gm=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Vi(i)?A(i):A(String(i).split(e)),t},$m=()=>{},Xm=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function Jm(i){return!!(i&&nA(i.append)&&i[kc]==="FormData"&&i[vn])}const Zm=i=>{const e=new Array(10),t=(A,r)=>{if(Br(A)){if(e.indexOf(A)>=0)return;if(wr(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Vi(A)?[]:{};return yr(A,(s,o)=>{const l=t(s,r+1);!zi(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},Ym=UA("AsyncFunction"),qm=i=>i&&(Br(i)||nA(i))&&nA(i.then)&&nA(i.catch),$c=((i,e)=>i?setImmediate:e?((t,A)=>(bi.addEventListener("message",({source:r,data:n})=>{r===bi&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),bi.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",nA(bi.postMessage)),jm=typeof queueMicrotask<"u"?queueMicrotask.bind(bi):typeof process<"u"&&process.nextTick||$c,fe={isArray:Vi,isArrayBuffer:Kc,isBuffer:wr,isFormData:Qm,isArrayBufferView:gm,isString:wm,isNumber:Vc,isBoolean:Bm,isObject:Br,isPlainObject:xn,isEmptyObject:ym,isReadableStream:Um,isRequest:Sm,isResponse:Em,isHeaders:Lm,isUndefined:zi,isDate:Cm,isFile:vm,isBlob:Tm,isRegExp:Wm,isFunction:nA,isStream:xm,isURLSearchParams:Fm,isTypedArray:Om,isFileList:bm,forEach:yr,merge:Lo,extend:Hm,trim:Mm,stripBOM:Im,inherits:Dm,toFlatObject:_m,kindOf:Tn,kindOfTest:UA,endsWith:Pm,toArray:Nm,forEachEntry:km,matchAll:Km,isHTMLForm:Vm,hasOwnProperty:Rc,hasOwnProp:Rc,reduceDescriptors:Gc,freezeMethods:Rm,toObjectSet:Gm,toCamelCase:zm,noop:$m,toFiniteNumber:Xm,findKey:zc,global:bi,isContextDefined:Wc,isSpecCompliantForm:Jm,toJSONObject:Zm,isAsyncFn:Ym,isThenable:qm,setImmediate:$c,asap:jm,isIterable:i=>i!=null&&nA(i[vn])};let Xe=class Lp extends Error{static from(e,t,A,r,n,s){const o=new Lp(e.message,t||e.code,A,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),r&&(this.request=r),n&&(this.response=n,this.status=n.status)}toJSON(){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:fe.toJSONObject(this.config),code:this.code,status:this.status}}};Xe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Xe.ERR_BAD_OPTION="ERR_BAD_OPTION",Xe.ECONNABORTED="ECONNABORTED",Xe.ETIMEDOUT="ETIMEDOUT",Xe.ERR_NETWORK="ERR_NETWORK",Xe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Xe.ERR_DEPRECATED="ERR_DEPRECATED",Xe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Xe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Xe.ERR_CANCELED="ERR_CANCELED",Xe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Xe.ERR_INVALID_URL="ERR_INVALID_URL";const eg=null;function Mo(i){return fe.isPlainObject(i)||fe.isArray(i)}function Xc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function Jc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Xc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function tg(i){return fe.isArray(i)&&!i.some(Mo)}const Ag=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function Qn(i,e,t){if(!fe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=fe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!fe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(r))throw new TypeError("visitor must be a function");function c(b){if(b===null)return"";if(fe.isDate(b))return b.toISOString();if(fe.isBoolean(b))return b.toString();if(!l&&fe.isBlob(b))throw new Xe("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(b)||fe.isTypedArray(b)?l&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function u(b,C,U){let F=b;if(b&&!U&&typeof b=="object"){if(fe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&tg(b)||(fe.isFileList(b)||fe.endsWith(C,"[]"))&&(F=fe.toArray(b)))return C=Xc(C),F.forEach(function(K,G){!(fe.isUndefined(K)||K===null)&&e.append(s===!0?Jc([C],G,n):s===null?C:C+"[]",c(K))}),!1}return Mo(b)?!0:(e.append(Jc(U,C,n),c(b)),!1)}const g=[],B=Object.assign(Ag,{defaultVisitor:u,convertValue:c,isVisitable:Mo});function v(b,C){if(!fe.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+C.join("."));g.push(b),fe.forEach(b,function(F,S){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(S)?S.trim():S,C,B))===!0&&v(F,C?C.concat(S):[S])}),g.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Zc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function Ho(i,e){this._pairs=[],i&&Qn(i,this,e)}const Yc=Ho.prototype;Yc.append=function(e,t){this._pairs.push([e,t])},Yc.toString=function(e){const t=e?function(A){return e.call(this,A,Zc)}:Zc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function ig(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function qc(i,e,t){if(!e)return i;const A=t&&t.encode||ig,r=fe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=fe.isURLSearchParams(e)?e.toString():new Ho(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class jc{constructor(){this.handlers=[]}use(e,t,A){return this.handlers.push({fulfilled:e,rejected:t,synchronous:A?A.synchronous:!1,runWhen:A?A.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){fe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const Io={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},rg={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ho,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Do=typeof window<"u"&&typeof document<"u",_o=typeof navigator=="object"&&navigator||void 0,ng=Do&&(!_o||["ReactNative","NativeScript","NS"].indexOf(_o.product)<0),sg=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",og=Do&&window.location.href||"http://localhost",Jt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Do,hasStandardBrowserEnv:ng,hasStandardBrowserWebWorkerEnv:sg,navigator:_o,origin:og},Symbol.toStringTag,{value:"Module"})),...rg};function ag(i,e){return Qn(i,new Jt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Jt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function lg(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function cg(i){const e={},t=Object.keys(i);let A;const r=t.length;let n;for(A=0;A<r;A++)n=t[A],e[n]=i[n];return e}function eh(i){function e(t,A,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&fe.isArray(r)?r.length:s,l?(fe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!fe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&fe.isArray(r[s])&&(r[s]=cg(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(lg(A),r,t,0)}),t}return null}function hg(i,e,t){if(fe.isString(i))try{return(e||JSON.parse)(i),fe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const Cr={transitional:Io,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=fe.isObject(e);if(n&&fe.isHTMLForm(e)&&(e=new FormData(e)),fe.isFormData(e))return r?JSON.stringify(eh(e)):e;if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)||fe.isReadableStream(e))return e;if(fe.isArrayBufferView(e))return e.buffer;if(fe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(A.indexOf("application/x-www-form-urlencoded")>-1)return ag(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Qn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),hg(e)):e}],transformResponse:[function(e){const t=this.transitional||Cr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(fe.isResponse(e)||fe.isReadableStream(e))return e;if(e&&fe.isString(e)&&(A&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Xe.from(o,Xe.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Jt.classes.FormData,Blob:Jt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],i=>{Cr.headers[i]={}});const ug=fe.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"]),dg=i=>{const e={};let t,A,r;return i&&i.split(`
|
|
2
|
+
`).forEach(function(s){r=s.indexOf(":"),t=s.substring(0,r).trim().toLowerCase(),A=s.substring(r+1).trim(),!(!t||e[t]&&ug[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},th=Symbol("internals");function vr(i){return i&&String(i).trim().toLowerCase()}function Fn(i){return i===!1||i==null?i:fe.isArray(i)?i.map(Fn):String(i)}function pg(i){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let A;for(;A=t.exec(i);)e[A[1]]=A[2];return e}const fg=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Po(i,e,t,A,r){if(fe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!fe.isString(e)){if(fe.isString(A))return e.indexOf(A)!==-1;if(fe.isRegExp(A))return A.test(e)}}function mg(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function gg(i,e){const t=fe.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(i,A+t,{value:function(r,n,s){return this[A].call(this,e,r,n,s)},configurable:!0})})}let sA=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=vr(l);if(!u)throw new Error("header name must be a non-empty string");const g=fe.findKey(r,u);(!g||r[g]===void 0||c===!0||c===void 0&&r[g]!==!1)&&(r[g||l]=Fn(o))}const s=(o,l)=>fe.forEach(o,(c,u)=>n(c,u,l));if(fe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(fe.isString(e)&&(e=e.trim())&&!fg(e))s(dg(e),t);else if(fe.isObject(e)&&fe.isIterable(e)){let o={},l,c;for(const u of e){if(!fe.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[c=u[0]]=(l=o[c])?fe.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=vr(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return pg(r);if(fe.isFunction(t))return t.call(this,r,A);if(fe.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vr(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||Po(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=vr(s),s){const o=fe.findKey(A,s);o&&(!t||Po(A,A[o],o,t))&&(delete A[o],r=!0)}}return fe.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let A=t.length,r=!1;for(;A--;){const n=t[A];(!e||Po(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,A={};return fe.forEach(this,(r,n)=>{const s=fe.findKey(A,n);if(s){t[s]=Fn(r),delete t[n];return}const o=e?mg(n):String(n).trim();o!==n&&delete t[n],t[o]=Fn(r),A[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return fe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&fe.isArray(A)?A.join(", "):A)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[th]=this[th]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=vr(s);A[o]||(gg(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};sA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(sA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(sA);function No(i,e){const t=this||Cr,A=e||t,r=sA.from(A.headers);let n=A.data;return fe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function Ah(i){return!!(i&&i.__CANCEL__)}let Tr=class extends Xe{constructor(e,t,A){super(e??"canceled",Xe.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function ih(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Xe("Request failed with status code "+t.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function wg(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function Bg(i,e){i=i||10;const t=new Array(i),A=new Array(i);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let g=n,B=0;for(;g!==r;)B+=t[g++],g=g%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(B*1e3/v):void 0}}function yg(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),g=u-t;g>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-g)))},()=>r&&s(r)]}const Un=(i,e,t=3)=>{let A=0;const r=Bg(50,250);return yg(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const g={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(g)},t)},rh=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},nh=i=>(...e)=>fe.asap(()=>i(...e)),Cg=Jt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Jt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Jt.origin),Jt.navigator&&/(msie|trident)/i.test(Jt.navigator.userAgent)):()=>!0,vg=Jt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];fe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),fe.isString(A)&&o.push(`path=${A}`),fe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),fe.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Tg(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function bg(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function sh(i,e,t){let A=!Tg(e);return i&&(A||t==!1)?bg(i,e):e}const oh=i=>i instanceof sA?{...i}:i;function xi(i,e){e=e||{};const t={};function A(c,u,g,B){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:B},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,g,B){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,g,B)}else return A(c,u,g,B)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,g){if(g in e)return A(c,u);if(g in i)return A(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,u,g)=>r(oh(c),oh(u),g,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const g=fe.hasOwnProp(l,u)?l[u]:r,B=g(i[u],e[u],u);fe.isUndefined(B)&&g!==o||(t[u]=B)}),t}const ah=i=>{const e=xi({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=sA.from(s),e.url=qc(sh(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),fe.isFormData(t)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,g])=>{c.includes(u.toLowerCase())&&s.set(u,g)})}}if(Jt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&Cg(e.url))){const l=r&&n&&vg.read(n);l&&s.set(r,l)}return e},xg=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=ah(i);let n=r.data;const s=sA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,g,B,v,b;function C(){v&&v(),b&&b(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function F(){if(!U)return;const K=sA.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),M={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:K,config:i,request:U};ih(function(ne){t(ne),C()},function(ne){A(ne),C()},M),U=null}"onloadend"in U?U.onloadend=F:U.onreadystatechange=function(){!U||U.readyState!==4||U.status===0&&!(U.responseURL&&U.responseURL.indexOf("file:")===0)||setTimeout(F)},U.onabort=function(){U&&(A(new Xe("Request aborted",Xe.ECONNABORTED,i,U)),U=null)},U.onerror=function(G){const M=G&&G.message?G.message:"Network Error",W=new Xe(M,Xe.ERR_NETWORK,i,U);W.event=G||null,A(W),U=null},U.ontimeout=function(){let G=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||Io;r.timeoutErrorMessage&&(G=r.timeoutErrorMessage),A(new Xe(G,M.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&fe.forEach(s.toJSON(),function(G,M){U.setRequestHeader(M,G)}),fe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([B,b]=Un(c,!0),U.addEventListener("progress",B)),l&&U.upload&&([g,v]=Un(l),U.upload.addEventListener("progress",g),U.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=K=>{U&&(A(!K||K.type?new Tr(null,i,U):K),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const S=wg(r.url);if(S&&Jt.protocols.indexOf(S)===-1){A(new Xe("Unsupported protocol "+S+":",Xe.ERR_BAD_REQUEST,i));return}U.send(n||null)})},Qg=(i,e)=>{const{length:t}=i=i?i.filter(Boolean):[];if(e||t){let A=new AbortController,r;const n=function(c){if(!r){r=!0,o();const u=c instanceof Error?c:this.reason;A.abort(u instanceof Xe?u:new Tr(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Xe(`timeout of ${e}ms exceeded`,Xe.ETIMEDOUT))},e);const o=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),i=null)};i.forEach(c=>c.addEventListener("abort",n));const{signal:l}=A;return l.unsubscribe=()=>fe.asap(o),l}},Fg=function*(i,e){let t=i.byteLength;if(t<e){yield i;return}let A=0,r;for(;A<t;)r=A+e,yield i.slice(A,r),A=r},Ug=async function*(i,e){for await(const t of Sg(i))yield*Fg(t,e)},Sg=async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}const e=i.getReader();try{for(;;){const{done:t,value:A}=await e.read();if(t)break;yield A}}finally{await e.cancel()}},lh=(i,e,t,A)=>{const r=Ug(i,e);let n=0,s,o=l=>{s||(s=!0,A&&A(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){o(),l.close();return}let g=u.byteLength;if(t){let B=n+=g;t(B)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},ch=64*1024,{isFunction:Sn}=fe,Eg=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:hh,TextEncoder:uh}=fe.global,dh=(i,...e)=>{try{return!!i(...e)}catch{return!1}},Lg=i=>{i=fe.merge.call({skipUndefined:!0},Eg,i);const{fetch:e,Request:t,Response:A}=i,r=e?Sn(e):typeof fetch=="function",n=Sn(t),s=Sn(A);if(!r)return!1;const o=r&&Sn(hh),l=r&&(typeof uh=="function"?(b=>C=>b.encode(C))(new uh):async b=>new Uint8Array(await new t(b).arrayBuffer())),c=n&&o&&dh(()=>{let b=!1;const C=new t(Jt.origin,{body:new hh,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!C}),u=s&&o&&dh(()=>fe.isReadableStream(new A("").body)),g={stream:u&&(b=>b.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(C,U)=>{let F=C&&C[b];if(F)return F.call(C);throw new Xe(`Response type '${b}' is not supported`,Xe.ERR_NOT_SUPPORT,U)})});const B=async b=>{if(b==null)return 0;if(fe.isBlob(b))return b.size;if(fe.isSpecCompliantForm(b))return(await new t(Jt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(b)||fe.isArrayBuffer(b))return b.byteLength;if(fe.isURLSearchParams(b)&&(b=b+""),fe.isString(b))return(await l(b)).byteLength},v=async(b,C)=>{const U=fe.toFiniteNumber(b.getContentLength());return U??B(C)};return async b=>{let{url:C,method:U,data:F,signal:S,cancelToken:K,timeout:G,onDownloadProgress:M,onUploadProgress:W,responseType:ne,headers:J,withCredentials:V="same-origin",fetchOptions:ie}=ah(b),re=e||fetch;ne=ne?(ne+"").toLowerCase():"text";let ce=Qg([S,K&&K.toAbortSignal()],G),Z=null;const Ae=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let oe;try{if(W&&c&&U!=="get"&&U!=="head"&&(oe=await v(J,F))!==0){let Qe=new t(C,{method:"POST",body:F,duplex:"half"}),Fe;if(fe.isFormData(F)&&(Fe=Qe.headers.get("content-type"))&&J.setContentType(Fe),Qe.body){const[Be,ve]=rh(oe,Un(nh(W)));F=lh(Qe.body,ch,Be,ve)}}fe.isString(V)||(V=V?"include":"omit");const le=n&&"credentials"in t.prototype,se={...ie,signal:ce,method:U.toUpperCase(),headers:J.normalize().toJSON(),body:F,duplex:"half",credentials:le?V:void 0};Z=n&&new t(C,se);let ae=await(n?re(Z,ie):re(C,se));const pe=u&&(ne==="stream"||ne==="response");if(u&&(M||pe&&Ae)){const Qe={};["status","statusText","headers"].forEach(Ce=>{Qe[Ce]=ae[Ce]});const Fe=fe.toFiniteNumber(ae.headers.get("content-length")),[Be,ve]=M&&rh(Fe,Un(nh(M),!0))||[];ae=new A(lh(ae.body,ch,Be,()=>{ve&&ve(),Ae&&Ae()}),Qe)}ne=ne||"text";let we=await g[fe.findKey(g,ne)||"text"](ae,b);return!pe&&Ae&&Ae(),await new Promise((Qe,Fe)=>{ih(Qe,Fe,{data:we,headers:sA.from(ae.headers),status:ae.status,statusText:ae.statusText,config:b,request:Z})})}catch(le){throw Ae&&Ae(),le&&le.name==="TypeError"&&/Load failed|fetch/i.test(le.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,b,Z,le&&le.response),{cause:le.cause||le}):Xe.from(le,le&&le.code,b,Z,le&&le.response)}}},Mg=new Map,ph=i=>{let e=i&&i.env||{};const{fetch:t,Request:A,Response:r}=e,n=[A,r,t];let s=n.length,o=s,l,c,u=Mg;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:Lg(e)),u=c;return c};ph();const Oo={http:eg,xhr:xg,fetch:{get:ph}};fe.forEach(Oo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const fh=i=>`- ${i}`,Hg=i=>fe.isFunction(i)||i===null||i===!1;function Ig(i,e){i=fe.isArray(i)?i:[i];const{length:t}=i;let A,r;const n={};for(let s=0;s<t;s++){A=i[s];let o;if(r=A,!Hg(A)&&(r=Oo[(o=String(A)).toLowerCase()],r===void 0))throw new Xe(`Unknown adapter '${o}'`);if(r&&(fe.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
4
|
+
`+s.map(fh).join(`
|
|
5
|
+
`):" "+fh(s[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const mh={getAdapter:Ig,adapters:Oo};function ko(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Tr(null,i)}function gh(i){return ko(i),i.headers=sA.from(i.headers),i.data=No.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),mh.getAdapter(i.adapter||Cr.adapter,i)(i).then(function(A){return ko(i),A.data=No.call(i,i.transformResponse,A),A.headers=sA.from(A.headers),A},function(A){return Ah(A)||(ko(i),A&&A.response&&(A.response.data=No.call(i,i.transformResponse,A.response),A.response.headers=sA.from(A.response.headers))),Promise.reject(A)})}const wh="1.13.5",En={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{En[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const Bh={};En.transitional=function(e,t,A){function r(n,s){return"[Axios v"+wh+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new Xe(r(s," has been removed"+(t?" in "+t:"")),Xe.ERR_DEPRECATED);return t&&!Bh[s]&&(Bh[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(n,s,o):!0}},En.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function Dg(i,e,t){if(typeof i!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const A=Object.keys(i);let r=A.length;for(;r-- >0;){const n=A[r],s=e[n];if(s){const o=i[n],l=o===void 0||s(o,n,i);if(l!==!0)throw new Xe("option "+n+" must be "+l,Xe.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Xe("Unknown option "+n,Xe.ERR_BAD_OPTION)}}const Ln={assertOptions:Dg,validators:En},BA=Ln.validators;let Qi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new jc,response:new jc}}async request(e,t){try{return await this._request(e,t)}catch(A){if(A instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{A.stack?n&&!String(A.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(A.stack+=`
|
|
6
|
+
`+n):A.stack=n}catch{}}throw A}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=xi(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&Ln.assertOptions(A,{silentJSONParsing:BA.transitional(BA.boolean),forcedJSONParsing:BA.transitional(BA.boolean),clarifyTimeoutError:BA.transitional(BA.boolean),legacyInterceptorReqResOrdering:BA.transitional(BA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:Ln.assertOptions(r,{encode:BA.function,serialize:BA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ln.assertOptions(t,{baseUrl:BA.spelling("baseURL"),withXsrfToken:BA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&fe.merge(n.common,n[t.method]);n&&fe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete n[b]}),t.headers=sA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(t)===!1)return;l=l&&C.synchronous;const U=t.transitional||Io;U&&U.legacyInterceptorReqResOrdering?o.unshift(C.fulfilled,C.rejected):o.push(C.fulfilled,C.rejected)});const c=[];this.interceptors.response.forEach(function(C){c.push(C.fulfilled,C.rejected)});let u,g=0,B;if(!l){const b=[gh.bind(this),void 0];for(b.unshift(...o),b.push(...c),B=b.length,u=Promise.resolve(t);g<B;)u=u.then(b[g++],b[g++]);return u}B=o.length;let v=t;for(;g<B;){const b=o[g++],C=o[g++];try{v=b(v)}catch(U){C.call(this,U);break}}try{u=gh.call(this,v)}catch(b){return Promise.reject(b)}for(g=0,B=c.length;g<B;)u=u.then(c[g++],c[g++]);return u}getUri(e){e=xi(this.defaults,e);const t=sh(e.baseURL,e.url,e.allowAbsoluteUrls);return qc(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){Qi.prototype[e]=function(t,A){return this.request(xi(A||{},{method:e,url:t,data:(A||{}).data}))}}),fe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(xi(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Qi.prototype[e]=t(),Qi.prototype[e+"Form"]=t(!0)});let _g=class Mp{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(n){t=n});const A=this;this.promise.then(r=>{if(!A._listeners)return;let n=A._listeners.length;for(;n-- >0;)A._listeners[n](r);A._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{A.subscribe(o),n=o}).then(r);return s.cancel=function(){A.unsubscribe(n)},s},e(function(n,s,o){A.reason||(A.reason=new Tr(n,s,o),t(A.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=A=>{e.abort(A)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Mp(function(r){e=r}),cancel:e}}};function Pg(i){return function(t){return i.apply(null,t)}}function Ng(i){return fe.isObject(i)&&i.isAxiosError===!0}const Ko={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ko).forEach(([i,e])=>{Ko[e]=i});function yh(i){const e=new Qi(i),t=Oc(Qi.prototype.request,e);return fe.extend(t,Qi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return yh(xi(i,r))},t}const gt=yh(Cr);gt.Axios=Qi,gt.CanceledError=Tr,gt.CancelToken=_g,gt.isCancel=Ah,gt.VERSION=wh,gt.toFormData=Qn,gt.AxiosError=Xe,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=Pg,gt.isAxiosError=Ng,gt.mergeConfig=xi,gt.AxiosHeaders=sA,gt.formToJSON=i=>eh(fe.isHTMLForm(i)?new FormData(i):i),gt.getAdapter=mh.getAdapter,gt.HttpStatusCode=Ko,gt.default=gt;const{Axios:pb,AxiosError:fb,CanceledError:mb,isCancel:gb,CancelToken:wb,VERSION:Bb,all:yb,Cancel:Cb,isAxiosError:vb,spread:Tb,toFormData:bb,AxiosHeaders:xb,HttpStatusCode:Qb,formToJSON:Fb,getAdapter:Ub,mergeConfig:Sb}=gt,PA=Object.create(null);PA.open="0",PA.close="1",PA.ping="2",PA.pong="3",PA.message="4",PA.upgrade="5",PA.noop="6";const Mn=Object.create(null);Object.keys(PA).forEach(i=>{Mn[PA[i]]=i});const Vo={type:"error",data:"parser error"},Ch=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",vh=typeof ArrayBuffer=="function",Th=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,zo=({type:i,data:e},t,A)=>Ch&&e instanceof Blob?t?A(e):bh(e,A):vh&&(e instanceof ArrayBuffer||Th(e))?t?A(e):bh(new Blob([e]),A):A(PA[i]+(e||"")),bh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function xh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Wo;function Og(i,e){if(Ch&&i.data instanceof Blob)return i.data.arrayBuffer().then(xh).then(e);if(vh&&(i.data instanceof ArrayBuffer||Th(i.data)))return e(xh(i.data));zo(i,!1,t=>{Wo||(Wo=new TextEncoder),e(Wo.encode(t))})}const Qh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",br=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Qh.length;i++)br[Qh.charCodeAt(i)]=i;const kg=i=>{let e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);const c=new ArrayBuffer(e),u=new Uint8Array(c);for(A=0;A<t;A+=4)n=br[i.charCodeAt(A)],s=br[i.charCodeAt(A+1)],o=br[i.charCodeAt(A+2)],l=br[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Kg=typeof ArrayBuffer=="function",Ro=(i,e)=>{if(typeof i!="string")return{type:"message",data:Fh(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:Vg(i.substring(1),e)}:Mn[t]?i.length>1?{type:Mn[t],data:i.substring(1)}:{type:Mn[t]}:Vo},Vg=(i,e)=>{if(Kg){const t=kg(i);return Fh(t,e)}else return{base64:!0,data:i}},Fh=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,Uh="",zg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{zo(n,!1,o=>{A[s]=o,++r===t&&e(A.join(Uh))})})},Wg=(i,e)=>{const t=i.split(Uh),A=[];for(let r=0;r<t.length;r++){const n=Ro(t[r],e);if(A.push(n),n.type==="error")break}return A};function Rg(){return new TransformStream({transform(i,e){Og(i,t=>{const A=t.length;let r;if(A<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,A);else if(A<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,A)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(A))}i.data&&typeof i.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Go;function Hn(i){return i.reduce((e,t)=>e+t.length,0)}function In(i,e){if(i[0].length===e)return i.shift();const t=new Uint8Array(e);let A=0;for(let r=0;r<e;r++)t[r]=i[0][A++],A===i[0].length&&(i.shift(),A=0);return i.length&&A<i[0].length&&(i[0]=i[0].slice(A)),t}function Gg(i,e){Go||(Go=new TextDecoder);const t=[];let A=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(Hn(t)<1)break;const l=In(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?A=3:r===126?A=1:A=2}else if(A===1){if(Hn(t)<2)break;const l=In(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(Hn(t)<8)break;const l=In(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(Vo);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(Hn(t)<r)break;const l=In(t,r);o.enqueue(Ro(n?l:Go.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(Vo);break}}}})}const Sh=4;function _t(i){if(i)return $g(i)}function $g(i){for(var e in _t.prototype)i[e]=_t.prototype[e];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},_t.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var A,r=0;r<t.length;r++)if(A=t[r],A===e||A.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+i],this},_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){t=t.slice(0);for(var A=0,r=t.length;A<r;++A)t[A].apply(this,e)}return this},_t.prototype.emitReserved=_t.prototype.emit,_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),yA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Xg="arraybuffer";function Eb(){}function Eh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Jg=yA.setTimeout,Zg=yA.clearTimeout;function _n(i,e){e.useNativeTimers?(i.setTimeoutFn=Jg.bind(yA),i.clearTimeoutFn=Zg.bind(yA)):(i.setTimeoutFn=yA.setTimeout.bind(yA),i.clearTimeoutFn=yA.clearTimeout.bind(yA))}const Yg=1.33;function qg(i){return typeof i=="string"?jg(i):Math.ceil((i.byteLength||i.size)*Yg)}function jg(i){let e=0,t=0;for(let A=0,r=i.length;A<r;A++)e=i.charCodeAt(A),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(A++,t+=4);return t}function Lh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function e1(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function t1(i){let e={},t=i.split("&");for(let A=0,r=t.length;A<r;A++){let n=t[A].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class A1 extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class $o extends _t{constructor(e){super(),this.writable=!1,_n(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,A){return super.emitReserved("error",new A1(e,t,A)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Ro(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=e1(e);return t.length?"?"+t:""}}class i1 extends $o{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let A=0;this._polling&&(A++,this.once("pollComplete",function(){--A||t()})),this.writable||(A++,this.once("drain",function(){--A||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=A=>{if(this.readyState==="opening"&&A.type==="open"&&this.onOpen(),A.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(A)};Wg(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,zg(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Lh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Mh=!1;try{Mh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const r1=Mh;function n1(){}class s1 extends i1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let A=location.port;A||(A=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||A!==e.port}}doWrite(e,t){const A=this.request({method:"POST",data:e});A.on("success",t),A.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,A)=>{this.onError("xhr poll error",t,A)}),this.pollXhr=e}}class NA extends _t{constructor(e,t,A){super(),this.createRequest=e,_n(this,A),this._opts=A,this._method=A.method||"GET",this._uri=t,this._data=A.data!==void 0?A.data:null,this._create()}_create(){var e;const t=Eh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const A=this._xhr=this.createRequest(t);try{A.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){A.setDisableHeaderCheck&&A.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&A.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{A.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{A.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(A),"withCredentials"in A&&(A.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(A.timeout=this._opts.requestTimeout),A.onreadystatechange=()=>{var r;A.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(A.getResponseHeader("set-cookie"))),A.readyState===4&&(A.status===200||A.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof A.status=="number"?A.status:0)},0))},A.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=NA.requestsCount++,NA.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=n1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete NA.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(NA.requestsCount=0,NA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Hh);else if(typeof addEventListener=="function"){const i="onpagehide"in yA?"pagehide":"unload";addEventListener(i,Hh,!1)}}function Hh(){for(let i in NA.requests)NA.requests.hasOwnProperty(i)&&NA.requests[i].abort()}const o1=(function(){const i=Ih({xdomain:!1});return i&&i.responseType!==null})();class a1 extends s1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=o1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new NA(Ih,this.uri(),e)}}function Ih(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||r1))return new XMLHttpRequest}catch{}if(!e)try{return new yA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Dh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class l1 extends $o{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=Dh?{}:Eh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(A.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,A)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;zo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Lh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Xo=yA.WebSocket||yA.MozWebSocket;class c1 extends l1{createSocket(e,t,A){return Dh?new Xo(e,t,A):t?new Xo(e,t):new Xo(e)}doWrite(e,t){this.ws.send(t)}}class h1 extends $o{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Gg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=Rg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{A.read().then(({done:o,value:l})=>{o||(this.onPacket(l),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;this._writer.write(A).then(()=>{r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const u1={websocket:c1,webtransport:h1,polling:a1},d1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,p1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Jo(i){if(i.length>8e3)throw"URI too long";const e=i,t=i.indexOf("["),A=i.indexOf("]");t!=-1&&A!=-1&&(i=i.substring(0,t)+i.substring(t,A).replace(/:/g,";")+i.substring(A,i.length));let r=d1.exec(i||""),n={},s=14;for(;s--;)n[p1[s]]=r[s]||"";return t!=-1&&A!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=f1(n,n.path),n.queryKey=m1(n,n.query),n}function f1(i,e){const t=/\/{2,9}/g,A=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&A.splice(0,1),e.slice(-1)=="/"&&A.splice(A.length-1,1),A}function m1(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Zo=typeof addEventListener=="function"&&typeof removeEventListener=="function",Pn=[];Zo&&addEventListener("offline",()=>{Pn.forEach(i=>i())},!1);class si extends _t{constructor(e,t){if(super(),this.binaryType=Xg,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const A=Jo(e);t.hostname=A.host,t.secure=A.protocol==="https"||A.protocol==="wss",t.port=A.port,A.query&&(t.query=A.query)}else t.host&&(t.hostname=Jo(t.host).host);_n(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(A=>{const r=A.prototype.name;this.transports.push(r),this._transportsByName[r]=A}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=t1(this.opts.query)),Zo&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Pn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Sh,t.transport=e,this.id&&(t.sid=this.id);const A=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](A)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&si.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",si.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let A=0;A<this.writeBuffer.length;A++){const r=this.writeBuffer[A].data;if(r&&(t+=qg(r)),A>0&&t>this._maxPayload)return this.writeBuffer.slice(0,A);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Dn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,A){return this._sendPacket("message",e,t,A),this}send(e,t,A){return this._sendPacket("message",e,t,A),this}_sendPacket(e,t,A,r){if(typeof t=="function"&&(r=t,t=void 0),typeof A=="function"&&(r=A,A=null),this.readyState==="closing"||this.readyState==="closed")return;A=A||{},A.compress=A.compress!==!1;const n={type:e,data:t,options:A};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},A=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?A():e()}):this.upgrading?A():e()),this}_onError(e){if(si.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Zo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Pn.indexOf(this._offlineEventListener);A!==-1&&Pn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}si.protocol=Sh;class g1 extends si{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),A=!1;si.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",g=>{if(!A)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;si.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const B=new Error("probe error");B.transport=t.name,this.emitReserved("upgradeError",B)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=g=>{const B=new Error("probe error: "+g);B.transport=t.name,n(),this.emitReserved("upgradeError",B)};function o(){s("transport closed")}function l(){s("socket closed")}function c(g){t&&g.name!==t.name&&n()}const u=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{A||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let A=0;A<e.length;A++)~this.transports.indexOf(e[A])&&t.push(e[A]);return t}}let w1=class extends g1{constructor(e,t={}){const A=typeof e=="object"?e:t;(!A.transports||A.transports&&typeof A.transports[0]=="string")&&(A.transports=(A.transports||["polling","websocket","webtransport"]).map(r=>u1[r]).filter(r=>!!r)),super(e,A)}};function B1(i,e="",t){let A=i;t=t||typeof location<"u"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(typeof t<"u"?i=t.protocol+"//"+i:i="https://"+i),A=Jo(i)),A.port||(/^(http|ws)$/.test(A.protocol)?A.port="80":/^(http|ws)s$/.test(A.protocol)&&(A.port="443")),A.path=A.path||"/";const n=A.host.indexOf(":")!==-1?"["+A.host+"]":A.host;return A.id=A.protocol+"://"+n+":"+A.port+e,A.href=A.protocol+"://"+n+(t&&t.port===A.port?"":":"+A.port),A}const y1=typeof ArrayBuffer=="function",C1=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,_h=Object.prototype.toString,v1=typeof Blob=="function"||typeof Blob<"u"&&_h.call(Blob)==="[object BlobConstructor]",T1=typeof File=="function"||typeof File<"u"&&_h.call(File)==="[object FileConstructor]";function Yo(i){return y1&&(i instanceof ArrayBuffer||C1(i))||v1&&i instanceof Blob||T1&&i instanceof File}function Nn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(Nn(i[t]))return!0;return!1}if(Yo(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Nn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&Nn(i[t]))return!0;return!1}function b1(i){const e=[],t=i.data,A=i;return A.data=qo(t,e),A.attachments=e.length,{packet:A,buffers:e}}function qo(i,e){if(!i)return i;if(Yo(i)){const t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){const t=new Array(i.length);for(let A=0;A<i.length;A++)t[A]=qo(i[A],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){const t={};for(const A in i)Object.prototype.hasOwnProperty.call(i,A)&&(t[A]=qo(i[A],e));return t}return i}function x1(i,e){return i.data=jo(i.data,e),delete i.attachments,i}function jo(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=jo(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=jo(i[t],e));return i}const Q1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ht;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(ht||(ht={}));class F1{constructor(e){this.replacer=e}encode(e){return(e.type===ht.EVENT||e.type===ht.ACK)&&Nn(e)?this.encodeAsBinary({type:e.type===ht.EVENT?ht.BINARY_EVENT:ht.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ht.BINARY_EVENT||e.type===ht.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=b1(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class ea extends _t{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const A=t.type===ht.BINARY_EVENT;A||t.type===ht.BINARY_ACK?(t.type=A?ht.EVENT:ht.ACK,this.reconstructor=new U1(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Yo(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const A={type:Number(e.charAt(0))};if(ht[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===ht.BINARY_EVENT||A.type===ht.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");A.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););A.nsp=e.substring(n,t)}else A.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}A.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(ea.isPayloadValid(A.type,n))A.data=n;else throw new Error("invalid payload")}return A}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ht.CONNECT:return Ph(t);case ht.DISCONNECT:return t===void 0;case ht.CONNECT_ERROR:return typeof t=="string"||Ph(t);case ht.EVENT:case ht.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Q1.indexOf(t[0])===-1);case ht.ACK:case ht.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class U1{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=x1(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Ph(i){return Object.prototype.toString.call(i)==="[object Object]"}const S1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ea,Encoder:F1,get PacketType(){return ht}},Symbol.toStringTag,{value:"Module"}));function SA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const E1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Nh extends _t{constructor(e,t,A){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,A&&A.auth&&(this.auth=A.auth),this._opts=Object.assign({},A),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[SA(e,"open",this.onopen.bind(this)),SA(e,"packet",this.onpacket.bind(this)),SA(e,"error",this.onerror.bind(this)),SA(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var A,r,n;if(E1.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ht.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,g=t.pop();this._registerAckCallback(u,g),s.id=u}const o=(r=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const r=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,r)=>{const n=(s,o)=>s?r(s):A(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const A={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),A.pending=!1,this._drainQueue())),this._queue.push(A),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ht.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(A=>String(A.id)===e)){const A=this.acks[e];delete this.acks[e],A.withError&&A.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ht.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ht.EVENT:case ht.BINARY_EVENT:this.onevent(e);break;case ht.ACK:case ht.BINARY_ACK:this.onack(e);break;case ht.DISCONNECT:this.ondisconnect();break;case ht.CONNECT_ERROR:this.destroy();const A=new Error(e.data.message);A.data=e.data.data,this.emitReserved("connect_error",A);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const A of t)A.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let A=!1;return function(...r){A||(A=!0,t.packet({type:ht.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ht.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const A of t)A.apply(this,e.data)}}}function Wi(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Wi.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=(Math.floor(e*10)&1)==0?i-t:i+t}return Math.min(i,this.max)|0},Wi.prototype.reset=function(){this.attempts=0},Wi.prototype.setMin=function(i){this.ms=i},Wi.prototype.setMax=function(i){this.max=i},Wi.prototype.setJitter=function(i){this.jitter=i};class ta extends _t{constructor(e,t){var A;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,_n(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((A=t.randomizationFactor)!==null&&A!==void 0?A:.5),this.backoff=new Wi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||S1;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new w1(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=SA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=SA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(SA(e,"ping",this.onping.bind(this)),SA(e,"data",this.ondata.bind(this)),SA(e,"error",this.onerror.bind(this)),SA(e,"close",this.onclose.bind(this)),SA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Dn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let A=this.nsps[e];return A?this._autoConnect&&!A.active&&A.connect():(A=new Nh(this,e,t),this.nsps[e]=A),A}_destroy(e){const t=Object.keys(this.nsps);for(const A of t)if(this.nsps[A].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let A=0;A<t.length;A++)this.engine.write(t[A],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var A;this.cleanup(),(A=this.engine)===null||A===void 0||A.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const A=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&A.unref(),this.subs.push(()=>{this.clearTimeoutFn(A)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const xr={};function On(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=B1(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=xr[r]&&n in xr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new ta(A,e):(xr[r]||(xr[r]=new ta(A,e)),l=xr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(On,{Manager:ta,Socket:Nh,io:On,connect:On});function Aa(i){if(!i)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(i,e),A=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${A}`}catch{return String(i).trim().replace(/\/+$/,"")}}let dA=Aa("http://localhost:8000");function Oh(i){const e=Aa(i);e&&e!==dA&&(dA=e,Et&&(Et.disconnect(),Et.removeAllListeners(),Et=null))}let Et=null;function L1(){const i=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=i();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:dA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=On(dA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),A=()=>{const r=i();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:dA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:dA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=A();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:dA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:dA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function ia(){const i=Aa(Et?.io?.uri||null);return!Et||Et.io&&i&&dA&&i!==dA?(Et&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:dA,wasConnected:Et.connected,reason:"baseUrl changed"}),Et.disconnect(),Et.removeAllListeners(),Et=null),Et=L1()):Et.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Et.id,connected:Et.connected,baseUrl:dA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Et.id,baseUrl:dA}),Et}function M1(i,e){const t=ia();return t.on(i,e),()=>t.off(i,e)}function H1(i,e){Et&&Et.off(i,e)}function I1(i,e){ia().emit(i,e)}function D1(){return Et?Et.connected?"connected":"connecting":"disconnected"}const kn={getSocket:ia,on:M1,off:H1,emit:I1,getStatus:D1,setBaseUrl:Oh},_1={},kh=Y.createContext(),zt=()=>{const i=Y.useContext(kh);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},P1=({children:i,baseUrl:e,endpoints:t,accountId:A,initialSymbol:r,initialTimeframe:n,indicators:s,indicatorSettings:o})=>{const l=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ws&&Ws.tagName.toUpperCase()==="SCRIPT"&&Ws.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&_1?.VITE_BASE_URL)??"http://localhost:5002";kn.setBaseUrl(l);const u={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},g=t?.params||{},[B,v]=Y.useState(r||"BTC/USD"),[b,C]=Y.useState(n||"M1"),[U,F]=Y.useState([]),[S,K]=Y.useState(!0),[G,M]=Y.useState([]),[W,ne]=Y.useState(!1),[J,V]=Y.useState(1e5),[ie,re]=Y.useState(null),[ce,Z]=Y.useState([]),[Ae,oe]=Y.useState(!0),[le,se]=Y.useState(!1),[ae,pe]=Y.useState(!0),[we,Qe]=Y.useState("candles"),[Fe,Be]=Y.useState(!1),[ve,Ce]=Y.useState("dark"),[be,Le]=Y.useState(null),[Ge,Ke]=Y.useState(!1),[Te,_e]=Y.useState(!1),[ye,de]=Y.useState(!1),[Pe,et]=Y.useState(!1),[it,rt]=Y.useState(!1),[dt,fA]=Y.useState(!1),[Ze,Oe]=Y.useState(!1),[at,At]=Y.useState(!1),[Ct,xt]=Y.useState(!1),[GA,$A]=Y.useState(!1),[Gt,mA]=Y.useState([]),XA=Y.useRef(null),Kt=Y.useRef(new Map),Ut=Y.useRef(null),gA=1e3,nt=Y.useCallback(async()=>{if(A)try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;ne(!0);const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Me}`}});let Ue=[];Array.isArray(ze.data)?Ue=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Ue=ze.data.data);const We=Ue.filter(Ne=>Ne.closePrice===null||Ne.closePrice===void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,comment:Ne.comment||"",status:"OPEN",swap:0,profit:Ne.profit||0,profitCurrency:"USD",time:new Date(Ne.openedAt||Ne.openAt||Date.now()).toLocaleTimeString(),openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt}));M(We)}catch(Me){console.error("❌ Error fetching orders:",Me.response?.data||Me.message),M([])}finally{ne(!1)}},[l,A]),mt=Y.useCallback((Me,ze)=>!ze||!Me.price||isNaN(ze)||isNaN(Me.price)?Me.profit||0:(Me?.type?.toUpperCase()==="BUY"?ze-Me.price:Me.price-ze)*Me.volume,[]),St=Y.useCallback(async()=>{try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;const ze=await gt.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${Me}`}});if(ze.data&&ze.data.data){const Ue=parseFloat(ze.data.data.balance);isNaN(Ue)||V(Ue)}}catch(Me){console.error("❌ Error fetching user balance:",Me.response?.data||Me.message)}},[l]),It=Y.useCallback(async()=>{if(A)try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Me}`}});let Ue=[];Array.isArray(ze.data)?Ue=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Ue=ze.data.data);const We=Ue.filter(Ne=>Ne.closePrice!==null&&Ne.closePrice!==void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,closePrice:Ne.closePrice,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,profit:Ne.profit??Ne.profitLoss??0,profitCurrency:"USD",openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt,closeReason:Ne.closeReason||"",status:"CLOSED"}));mA(We)}catch(Me){console.error("❌ Error fetching history orders:",Me.response?.data||Me.message),mA([])}},[l,A]),$e=Y.useMemo(()=>{const Me=J,ze=G.reduce((lt,vt)=>lt+vt.volume*vt.price*.01,0),Ue=G.reduce((lt,vt)=>{const cA=U.find(Ai=>Ai.symbol===vt.symbol);if(cA){const Ai=vt.type?.toUpperCase()==="BUY"?parseFloat(cA.bid||0):parseFloat(cA.ask||0);if(Ai&&Ai>0&&!isNaN(Ai))return lt+mt(vt,Ai)}return lt+(vt.profit||0)},0),We=Me+Ue,Ne=We-ze,st=ze>0?We/ze*100:0;return{balance:Me,equity:We,margin:ze,freeMargin:Ne,level:st.toFixed(2)}},[G,U,J,mt]);Y.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(nt(),St(),It())},[nt,St,It,A]),Y.useEffect(()=>{(async()=>{try{K(!0);const ze=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Ue=localStorage.getItem("token")??localStorage.getItem("authToken"),We=await gt.get(ze,{headers:Ue?{Authorization:`Bearer ${Ue}`}:{}});let Ne=[];Array.isArray(We.data)?Ne=We.data:We.data&&We.data.data&&Array.isArray(We.data.data)?Ne=We.data.data:We.data&&We.data.prices&&Array.isArray(We.data.prices)?Ne=We.data.prices:We.data&&Array.isArray(We.data)&&(Ne=We.data);const st=Ne.map(lt=>{const vt=lt.symbol||lt.name||"",cA=lt.category||null;return vt&&(lt.bid!==void 0||lt.price!==void 0)?{symbol:vt,bid:lt.bid??lt.price??0,ask:lt.ask??lt.price??0,change:lt.change??0,category:cA}:{...lt,symbol:vt,category:cA}});st.length>0?(F(st),st.find(vt=>vt.symbol===B)||v(st[0].symbol)):F([])}catch(ze){console.error("❌ Error fetching symbols:",ze.response?.data||ze.message),F([])}finally{K(!1)}})()},[l,u.symbols]);const He=Y.useCallback(()=>{const Me=Kt.current;if(Me.size===0)return;const ze=new Map(Me);Me.clear(),F(Ue=>Ue.map(We=>{const Ne=ze.get(We.symbol);return Ne?{...We,...Ne}:We})),M(Ue=>{let We=!1;const Ne=Ue.map(st=>{const lt=ze.get(st.symbol);if(!lt)return st;const vt=st.type?.toUpperCase()==="BUY"?parseFloat(lt.bid||0):parseFloat(lt.ask||0);if(!vt||isNaN(vt)||vt<=0)return st;const cA=mt(st,vt);return cA===st.profit?st:(We=!0,{...st,profit:cA})});return We?Ne:Ue})},[mt]);Y.useEffect(()=>{XA.current||(XA.current=kn.getSocket());const Me=XA.current,ze=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Me.emit("joinUserRoom",{userId:Number(A)})},Ue=()=>console.log("⚠️ TradingContext: Disconnected"),We=st=>{st?.symbol&&(Kt.current.set(st.symbol,st),Ut.current||(Ut.current=setTimeout(()=>{Ut.current=null,He()},gA)))},Ne=async st=>{if(st){if(st.newBalance!==void 0){const lt=parseFloat(st.newBalance);isNaN(lt)||V(lt)}if(window.notify){const lt=st.profitLoss||st.profit||0,vt=lt>=0?`+${lt.toFixed(2)}`:lt.toFixed(2),cA=st.symbol||"Trade",Ai=st.reason||"Closed";window.notify(`Trade Closed: ${Ai} | ${cA} | P/L: ${vt} USD`,lt>=0?"success":"error")}st.tradeId&&M(lt=>lt.filter(vt=>vt.id!==st.tradeId)),await nt(),await St()}};return Me.on("connect",ze),Me.on("disconnect",Ue),Me.on("priceUpdate",We),Me.on("tradeClosed",Ne),Me.connected&&A&&Number.isFinite(Number(A))&&Me.emit("joinUserRoom",{userId:Number(A)}),()=>{Me.off("connect",ze),Me.off("disconnect",Ue),Me.off("priceUpdate",We),Me.off("tradeClosed",Ne),Ut.current&&(clearTimeout(Ut.current),Ut.current=null),Kt.current.clear()}},[He,nt,St]),Y.useEffect(()=>{try{const Me=document.documentElement;if(!Me)return;Me.dataset.theme=ve}catch{}},[ve]);const tt=Y.useMemo(()=>U.find(Me=>Me.symbol===B)||{bid:"0.00000",ask:"0.00000",change:0},[U,B]),Je=Y.useMemo(()=>({selectedSymbol:B,setSelectedSymbol:v,selectedTimeframe:b,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:S,orders:G,setOrders:M,ordersLoading:W,fetchOrders:nt,fetchUserBalance:St,userBalance:J,setUserBalance:V,accountSummary:$e,currentSymbolData:tt,activeTool:ie,setActiveTool:re,chartObjects:ce,setChartObjects:Z,showGrid:Ae,setShowGrid:oe,snapToGrid:le,setSnapToGrid:se,drawingsVisible:ae,setDrawingsVisible:pe,chartType:we,setChartType:Qe,chartLocked:Fe,setChartLocked:Be,theme:ve,setTheme:Ce,candleColors:be,setCandleColors:Le,showTradeOrders:Ge,setShowTradeOrders:Ke,showTradePosition:Te,setShowTradePosition:_e,showTradeHistory:ye,setShowTradeHistory:de,showSLTP:Pe,setShowSLTP:et,showAskPrice:it,setShowAskPrice:rt,showChartControls:dt,setShowChartControls:fA,showTradeNotification:Ze,setShowTradeNotification:Oe,showCrosshair:at,setShowCrosshair:At,showOHLC:Ct,setShowOHLC:xt,baseUrl:l,endpoints:u,endpointParams:g,accountId:A,isShow:GA,setIsShow:$A,historyOrders:Gt,setHistoryOrders:mA,fetchHistoryOrders:It,indicators:s,indicatorSettings:o}),[B,b,U,S,G,W,nt,St,J,$e,tt,ie,ce,Ae,le,ae,we,Fe,ve,be,Ge,Te,ye,Pe,it,dt,Ze,at,Ct,l,u,g,GA,Gt,It,s,o]);return a.jsx(kh.Provider,{value:Je,children:i})};var Kh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Vh=Y.createContext&&Y.createContext(Kh),N1=["attr","size","title"];function O1(i,e){if(i==null)return{};var t=k1(i,e),A,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)A=n[r],!(e.indexOf(A)>=0)&&Object.prototype.propertyIsEnumerable.call(i,A)&&(t[A]=i[A])}return t}function k1(i,e){if(i==null)return{};var t={};for(var A in i)if(Object.prototype.hasOwnProperty.call(i,A)){if(e.indexOf(A)>=0)continue;t[A]=i[A]}return t}function Kn(){return Kn=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(i[A]=t[A])}return i},Kn.apply(this,arguments)}function zh(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(i);e&&(A=A.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,A)}return t}function Vn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zh(Object(t),!0).forEach(function(A){K1(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):zh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function K1(i,e,t){return e=V1(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function V1(i){var e=z1(i,"string");return typeof e=="symbol"?e:e+""}function z1(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var A=t.call(i,e);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Wh(i){return i&&i.map((e,t)=>Y.createElement(e.tag,Vn({key:t},e.attr),Wh(e.child)))}function eA(i){return e=>Y.createElement(W1,Kn({attr:Vn({},i.attr)},e),Wh(i.child))}function W1(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=O1(i,N1),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),Y.createElement("svg",Kn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Vn(Vn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),i.children)};return Vh!==void 0?Y.createElement(Vh.Consumer,null,t=>e(t)):e(Kh)}function R1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(i)}function G1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(i)}function $1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(i)}function X1(i){return eA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(i)}function Rh(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(i)}function J1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(i)}function Z1(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(i)}function Y1(i){return eA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(i)}function q1(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(i)}function j1(i){return eA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(i)}const ew={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Gh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=zt(),c=r==="light",[u,g]=Y.useState("0.01"),[B,v]=Y.useState(""),[b,C]=Y.useState(!1),U=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",S=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",K=M=>{const W=parseFloat(u)||.01,ne=Math.max(.01,W+M);g(ne.toFixed(2))},G=async M=>{v("");const W=M,ne=parseFloat(W==="BUY"?e:i),J=parseFloat(u);if(!J||J<=0||isNaN(J)){v("Please enter a valid volume (minimum 0.01)");return}if(J<.01){v("Volume must be at least 0.01");return}if(!ne||ne<=0||isNaN(ne)){v("Invalid price. Please refresh and try again.");return}const V=localStorage.getItem("token")??localStorage.getItem("authToken");if(!V){v("Please login to place trades");return}C(!0);const ie=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:ie,type:W,volume:J,openPrice:ne,takeProfit:null,stopLoss:null};try{const ce=o||ew?.VITE_BASE_URL||"http://localhost:8000",Z=l?.trades||"/api/trades",Ae=await gt.post(`${ce}${Z}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(Ae.status<200||Ae.status>=300){v(Ae.data?.message||`Failed to place trade (${Ae.status})`);return}s&&s(),A&&A()}catch(ce){const Z=ce?.response?.data?.message||ce?.message||"Network error. Please try again.";v(Z)}finally{C(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>G("SELL"),disabled:b,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:i?Number(i).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${U}`,children:[a.jsx("button",{type:"button",onClick:()=>K(-.01),className:`w-5 flex items-center justify-center ${F} ${S} transition-colors`,children:a.jsx(Rh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:M=>{const W=M.target.value;(W===""||/^\d*\.?\d{0,2}$/.test(W))&&g(W)},onBlur:()=>{const M=parseFloat(u);g(isNaN(M)||M<.01?"0.01":M.toFixed(2))},className:`w-14 text-center focus:outline-none ${U} ${F}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>K(.01),className:`w-5 flex items-center justify-center ${F} ${S} transition-colors`,children:a.jsx(J1,{size:8})})]}),a.jsxs("button",{onClick:()=>G("BUY"),disabled:b,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),B&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:B})]})},tw={},$h=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:g,selectedTimeframe:B,setOrders:v,symbols:b,fetchOrders:C,theme:U,baseUrl:F,endpoints:S}=zt(),K=U==="light",G={getContractSpec:Ze=>{const Oe=String(Ze||"").toUpperCase();return Oe.includes("BTC")||Oe.includes("ETH")||Oe.includes("SOL")||Oe.includes("XRP")||Oe.includes("ADA")||Oe.includes("DOGE")||Oe.includes("BNB")||Oe.includes("AVAX")||Oe.includes("DOT")||Oe.includes("LINK")||Oe.endsWith("USDT")?{contractSize:1}:Oe.includes("XAU")||Oe.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Ze,volume:Oe})=>{const at=G.getContractSpec(Ze);return(parseFloat(Oe)||0)*(at.contractSize||1)}},M=u||G,[W,ne]=Y.useState("0.01"),[J,V]=Y.useState(""),[ie,re]=Y.useState(""),[ce,Z]=Y.useState(""),[Ae,oe]=Y.useState(!1),[le,se]=Y.useState(null),[ae,pe]=Y.useState(""),[we,Qe]=Y.useState(t||"BUY"),[Fe,Be]=Y.useState(parseFloat(A)||0),[ve,Ce]=Y.useState(parseFloat(r)||0),[be,Le]=Y.useState("text-white"),[Ge,Ke]=Y.useState("text-white"),Te=Y.useRef(parseFloat(A)||0),_e=Y.useRef(parseFloat(r)||0);Y.useEffect(()=>{if(!i)return;const Ze=kn.getSocket(),Oe=At=>{if(!(!At||!At.symbol)&&At.symbol.toUpperCase()===g?.toUpperCase()){const Ct=parseFloat(At.bid)||0,xt=parseFloat(At.ask)||0;Ct>0&&(Ct>Te.current?(Le("text-green-400"),setTimeout(()=>Le("text-white"),500)):Ct<Te.current&&Te.current>0&&(Le("text-red-400"),setTimeout(()=>Le("text-white"),500)),Be(Ct),Te.current=Ct),xt>0&&(xt>_e.current?(Ke("text-green-400"),setTimeout(()=>Ke("text-white"),500)):xt<_e.current&&_e.current>0&&(Ke("text-red-400"),setTimeout(()=>Ke("text-white"),500)),Ce(xt),_e.current=xt)}};Ze.on("priceUpdate",Oe);const at=b.find(At=>At.symbol===g);if(at){const At=parseFloat(at.bid)||0,Ct=parseFloat(at.ask)||0;At>0&&(Be(At),Te.current=At),Ct>0&&(Ce(Ct),_e.current=Ct)}return()=>{Ze.off("priceUpdate",Oe)}},[i,g,b]),Y.useEffect(()=>{if(i){ne(o?String(o):"0.01"),V(""),re(""),Z(""),pe(""),Qe(t||"BUY");const Ze=parseFloat(A)||0,Oe=parseFloat(r)||0;Ze>0&&(Be(Ze),Te.current=Ze),Oe>0&&(Ce(Oe),_e.current=Oe)}},[i,t,A,r,o]);const ye=Fe||0,de=ve||0,Pe=Ze=>{const Oe=parseFloat(W)||.01,at=Math.max(.01,Oe+Ze);ne(at.toFixed(2))},et=Ze=>{const Oe=parseFloat(J)||0,at=parseFloat(we==="BUY"?ve:Fe)||0;if(!at){pe("Current price not available. Please wait...");return}let At=Oe+Ze;we==="BUY"?At=Math.max(1e-5,Math.min(At,at-1e-5)):At=Math.max(at+1e-5,At),V(At>0?At.toFixed(5):""),pe("")},it=Ze=>{const Oe=parseFloat(ie)||0,at=parseFloat(we==="BUY"?ve:Fe)||0;if(!at){pe("Current price not available. Please wait...");return}let At=Oe+Ze;we==="BUY"?At=Math.max(at+1e-5,At):At=Math.max(1e-5,Math.min(At,at-1e-5)),re(At>0?At.toFixed(5):""),pe("")},rt=async Ze=>{pe("");const Oe=Ze||we,at=parseFloat(Oe==="BUY"?ve:Fe),At=parseFloat(W),Ct=J?parseFloat(J):null,xt=ie?parseFloat(ie):null;if(!At||At<=0||isNaN(At)){pe("Please enter a valid volume (minimum 0.01)");return}if(At<.01){pe("Volume must be at least 0.01");return}if(!at||at<=0||isNaN(at)){pe("Invalid price. Please refresh and try again.");return}if(Ct!==null&&Ct!==""){if(isNaN(Ct)||Ct<=0){pe("Stop Loss must be a valid positive number");return}if(Oe==="BUY"&&Ct>=at){pe("Stop Loss must be below the current price for BUY orders");return}if(Oe==="SELL"&&Ct<=at){pe("Stop Loss must be above the current price for SELL orders");return}}if(xt!==null&&xt!==""){if(isNaN(xt)||xt<=0){pe("Take Profit must be a valid positive number");return}if(Oe==="BUY"){if(xt<=at){pe(`Take Profit must be above the entry price (${at.toFixed(5)}) for BUY orders`);return}}else if(Oe==="SELL"&&xt>=at){pe(`Take Profit must be below the entry price (${at.toFixed(5)}) for SELL orders`);return}}Qe(Oe),se(Oe),oe(!0);const GA=new Date,$A=GA.toLocaleTimeString(),Gt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,mA=localStorage.getItem("token")??localStorage.getItem("authToken");if(!mA){pe("Please login to place trades"),oe(!1),se(null);return}const XA={accountId:s,symbol:g,type:Oe,volume:At,price:at,takeProfit:xt,stopLoss:Ct,comment:ce.trim()||null},Kt={ticket:Gt.substring(0,8),symbol:g,type:Oe,volume:parseFloat(At),price:parseFloat(at),time:$A,stopLoss:Ct?parseFloat(Ct):null,takeProfit:xt?parseFloat(xt):null,swap:0,profit:0,profitCurrency:"USD",comment:ce.trim()||"",id:Gt,status:"OPEN",openAt:GA.toISOString()};if(!l&&v&&v(Ut=>[...Ut,Kt]),c&&!n){pe("Execution handler is required in forceParentExecution mode"),oe(!1),se(null);return}if(n){oe(!1),se(null),e();const Ut={symbol:g,type:Oe,lotSize:At,entryPrice:at,stopLoss:Ct,takeProfit:xt,comment:ce.trim()||null};Promise.resolve(n(Ut)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(gA=>{console.error("❌ Trade execution failed:",gA),!l&&v&&v(nt=>nt.filter(mt=>mt.id!==Gt))})}else{if(c){pe("Fallback API path disabled in forceParentExecution mode"),oe(!1),se(null);return}oe(!1),se(null),e();const Ut=F||tw?.VITE_BASE_URL||"http://localhost:8000",gA=S?.trades||"/api/trades";gt.post(`${Ut}${gA}`,XA,{headers:{Authorization:`Bearer ${mA}`,"Content-Type":"application/json"}}).then(nt=>{if(nt.data&&nt.data.data){const mt=nt.data.data.trade;!l&&v&&v(St=>St.map(It=>It.id===Gt?{...It,id:mt.id,ticket:mt.id.substring(0,8),time:$A,openAt:mt.openAt}:It)),console.log("✅ Trade saved successfully:",mt),window.notify&&window.notify(`Trade placed successfully: ${mt.symbol} ${mt.type}`,"success")}else{!l&&v&&v(St=>St.filter(It=>It.id!==Gt));const mt=nt.data?.message||"Failed to place trade";window.notify&&window.notify(mt,"error")}}).catch(nt=>{console.error("Error placing trade:",nt),!l&&v&&v(St=>St.filter(It=>It.id!==Gt));let mt="Failed to place trade";if(nt.response){const St=nt.response.status,It=nt.response.data;St===400?mt=It?.message||"Invalid trade data. Please check your inputs.":St===401?mt="Authentication failed. Please login again.":St===404?mt=It?.message||"Symbol not found. Please select a valid symbol.":St===500?mt="Server error. Please try again later.":mt=It?.message||`Error: ${St}`}else nt.request&&(mt="Network error. Please check your internet connection.");window.notify&&window.notify(mt,"error")})}},fA=(M?.calculateVolumeUnits?.({symbol:g,volume:parseFloat(W)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return i?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${K?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${K?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${K?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${K?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${K?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[ae&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:ae}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${K?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${K?"text-slate-700":"text-white"}`,children:[fA," ",g]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>Pe(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:W,onChange:Ze=>{const Oe=Ze.target.value;(Oe===""||/^\d*\.?\d{0,2}$/.test(Oe))&&(ne(Oe),pe(""))},onBlur:()=>{const Ze=parseFloat(W);ne(isNaN(Ze)||Ze<.01?"0.01":Ze.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>Pe(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${K?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>et(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:J,onChange:Ze=>{const Oe=Ze.target.value;(Oe===""||/^\d*\.?\d*$/.test(Oe))&&(V(Oe),pe(""))},onBlur:Ze=>{const Oe=parseFloat(Ze.target.value);!isNaN(Oe)&&Oe>0?V(Oe.toFixed(5)):Ze.target.value===""&&V("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>et(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${K?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>it(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:ie,onChange:Ze=>{const Oe=Ze.target.value;(Oe===""||/^\d*\.?\d*$/.test(Oe))&&(re(Oe),pe(""))},onBlur:Ze=>{const Oe=parseFloat(Ze.target.value);!isNaN(Oe)&&Oe>0?re(Oe.toFixed(5)):Ze.target.value===""&&re("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>it(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${K?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:ce,onChange:Ze=>Z(Ze.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${K?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:K?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${be} font-medium transition-colors duration-400`,children:ye>0?ye.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:K?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Ge} font-medium transition-colors duration-400`,children:de>0?de.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>rt("SELL"),disabled:Ae,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:Ae&&le==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>rt("BUY"),disabled:Ae,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:Ae&&le==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},Aw={text:"Text",trendline:"Trend Line",parallellines:"Parallel Channel",fibonacci:"Fibonacci Retracement",rectangle:"Rectangle",pricelevel:"Horizontal Line",horizontalray:"Horizontal Ray",verticalline:"Vertical Line",infoline:"Info Line",rulerline:"Ruler Line",arrowedline:"Arrowed Line",rayline:"Ray",extendedline:"Extended Line",crossline:"Cross Line",trendbyangle:"Trend By Angle",disjointchannel:"Disjoint Channel",flattopbottom:"Flat Top/Bottom",regressionchannel:"Regression Channel",stddevchannel:"StdDev Channel",andrewspitchfork:"Andrew's Pitchfork",gannline:"Gann Line",gannfan:"Gann Fan",ganngrid:"Gann Grid",circle:"Circle",triangle:"Triangle",ellipse:"Ellipse",equidistantchannel:"Equidistant Channel"},iw=[10,11,12,14,16,20,24,28,30,40],zn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],oi={width:"78%",height:"78%",display:"block"},Xh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function rw(i){return i?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function OA(i,e="#5f8f96"){if(typeof i!="string")return e;const t=i.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const nw=()=>a.jsx(q1,{style:oi}),sw=()=>a.jsx(j1,{style:oi}),ow=()=>a.jsx(X1,{style:oi}),aw=()=>a.jsx(Y1,{style:oi}),lw=()=>a.jsx(G1,{style:oi}),cw=()=>a.jsx(R1,{style:oi}),hw=()=>a.jsx($1,{style:oi}),uw=()=>a.jsx(Rh,{style:oi}),ra=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function Qr({checked:i,onClick:e,hideLeftBorder:t,tokens:A,children:r,title:n}){return a.jsx("button",{type:"button",onClick:e,title:n,style:{display:"flex",width:30,height:30,alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,borderLeftWidth:t?0:1,background:i?A.activeFill:"transparent",color:i?A.activeText:A.text,cursor:"pointer",padding:0},children:a.jsx(ra,{size:"18px",children:r})})}function qe({checked:i,onChange:e,label:t,tokens:A,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:i,onChange:n=>e(n.target.checked),disabled:r,style:Xh}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,background:A.fieldBg},children:i&&a.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Ot({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=OA(i,"#5f8f96"),s=(i||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:A?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:u=>e(u.target.value),disabled:A,style:{...Xh,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:u=>{const g=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(g?`#${g}`:"")},onBlur:t,disabled:A,style:c})]})}function CA({tokens:i,disabled:e=!1,style:t={},...A}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?i.fieldDisabledBg:i.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?i.fieldDisabledBg:i.fieldBg,color:e?i.fieldDisabledText:i.text,...t},...A})}function Fi({value:i,onChange:e,tokens:t,disabled:A=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:i,onChange:e,disabled:A,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${A?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:A?t.fieldDisabledBg:t.fieldBg,color:A?t.fieldDisabledText:t.text,cursor:A?"default":"pointer",opacity:A?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(uw,{})})]})}function dw({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===zn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:zn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(qe,{checked:A,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:zn.map(s=>a.jsx(qe,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function pw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,OA(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(Fi,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:iw.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(ow,{})}),a.jsx(Qr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(aw,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(lw,{})}),a.jsx(Qr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(cw,{})}),a.jsx(Qr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(hw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(qe,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(qe,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(Ot,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(CA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.borderEnabled,value:i.borderOpacity??.1,onChange:n=>A("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!i.borderEnabled,value:i.borderWidth??1,onChange:n=>A("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:i.borderWidth??1})]}),a.jsx(qe,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Ot,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(CA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.bgEnabled,value:i.bgOpacity??.1,onChange:n=>A("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:i.text||"",onChange:n=>A("text",n.target.value),placeholder:"Your text",rows:4,style:{width:"100%",resize:"none",border:`1px solid ${t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text}})]})}function Wn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#22c55e",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(qe,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(qe,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(qe,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(qe,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(qe,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function fw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:i.showArea!==!1,onChange:n=>A("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(qe,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function mw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(qe,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(qe,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(qe,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function gw({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Ui(i){if(!i)return"";const e=new Date(i*1e3),t=A=>String(A).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function Si({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point1Time),style:n}),a.jsx(CA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point2Time),style:n}),a.jsx(CA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Jh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,OA(o,l)),n=!i.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:s=>A("lineColor",s),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:s=>A("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(qe,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(Ot,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(Fi,{value:i.textHAlign??"center",onChange:s=>A("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(Fi,{value:i.textVAlign??"top",onChange:s=>A("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:i.textContent||"",onChange:s=>A("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function ww({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"Price"}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Bw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.originTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function yw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function Cw({draft:i,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.rawTime),style:t})]})})}function vw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#7aa6ae",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(qe,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(qe,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Tw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#06a0e3",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(qe,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function bw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.rawTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Zh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#129f5c",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(qe,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Ot,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(CA,{tokens:t,value:i.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&A("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(qe,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Ot,{value:i.pricesColor||"#129f5c",onChange:n=>A("pricesColor",n),onBlur:()=>r("pricesColor",i.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(qe,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(qe,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Yh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point1Time),style:n}),a.jsx(CA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point2Time),style:n}),a.jsx(CA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(CA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function xw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||zn.map(t=>t.key)};if(i.type==="trendline"){const t=typeof i.series?.options=="function"?i.series.options():{};return{...e,lineColor:t.color??i.lineColor??"#22c55e",lineWidth:t.lineWidth??i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.point1?.price??0,point1Time:i.point1?.rawTime??i.point1?.time??0,point2Price:i.point2?.price??0,point2Time:i.point2?.rawTime??i.point2?.time??0}}return i.type==="text"?{...e,text:i.primitive?.text??i.text??"Text",color:i.primitive?.color??"#5f8f96",fontSize:i.primitive?.fontSize??12,fontWeight:i.primitive?.fontWeight??"normal",fontStyle:i.primitive?.fontStyle??"normal",textAlign:i.primitive?.textAlign??"center",textWrap:i.primitive?.textWrap??!1,borderEnabled:i.primitive?.borderEnabled??!1,borderColor:i.primitive?.borderColor??"#5f8f96",borderOpacity:i.primitive?.borderOpacity??.1,borderWidth:i.primitive?.borderWidth??1,bgEnabled:i.primitive?.bgEnabled??!1,bgColor:i.primitive?.bgColor??"#5f8f96",bgOpacity:i.primitive?.bgOpacity??.1,price:i.price}:i.type==="pricelevel"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price}:i.type==="horizontalray"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price,originTime:i.rawOriginTime??i.originTime}:i.type==="verticalline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showDate:i.showDate!==!1,rawTime:i.rawTime}:i.type==="infoline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!0,statsPriceRange:i.statsPriceRange??!0,statsBarsRange:i.statsBarsRange??!0,statsDateRange:i.statsDateRange??!0,statsAngle:i.statsAngle??!0,statsDistance:i.statsDistance??!0,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="arrowedline"?{...e,lineColor:i.lineColor??"#f59e0b",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight!==!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="rayline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="extendedline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft!==!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="crossline"?{...e,lineColor:i.lineColor??"#06a0e3",lineWidth:i.lineWidth??2,showTime:i.showTime??!1,showPrice:i.showPrice??!1,rawTime:i.p?.rawTime??0,price:i.p?.price??0}:i.type==="trendbyangle"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="disjointchannel"?{...e,lineColor:i.lineColor??"#129f5c",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#6aa84f",fillOpacity:i.fillOpacity??.1,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#129f5c",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="flattopbottom"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#3b82f6",fillOpacity:i.fillOpacity??.12,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#3b82f6",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="rulerline"?{...e,lineColor:i.lineColor??"#3b82f6",showArea:i.showArea!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways!==!1,statsPriceRange:i.statsPriceRange!==!1,statsBarsRange:i.statsBarsRange!==!1,statsDateRange:i.statsDateRange!==!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:e}const qh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=zt(),s=rw(r==="light"),[o,l]=Y.useState("style"),[c,u]=Y.useState({}),[g,B]=Y.useState(null),v=Y.useRef(null),b=Y.useRef(null);Y.useEffect(()=>{t&&(u(xw(t)),l("style"))},[t]),Y.useEffect(()=>{i||B(null)},[i]);const C=M=>{if(M.button!==0)return;M.preventDefault();const W=v.current;if(!W)return;const ne=W.offsetParent,J=ne?ne.getBoundingClientRect():{left:0,top:0},V=W.getBoundingClientRect(),ie=V.left-J.left,re=V.top-J.top;b.current={startMX:M.clientX,startMY:M.clientY,startX:ie,startY:re},B({x:ie,y:re});const ce=Ae=>{const{startMX:oe,startMY:le,startX:se,startY:ae}=b.current;B({x:se+Ae.clientX-oe,y:ae+Ae.clientY-le})},Z=()=>{b.current=null,document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Z)};document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Z)};if(!i||!t)return null;const U=Aw[t.type]||t.type,F=["style","coordinates","visualization"],S=()=>{if(o==="visualization")return a.jsx(dw,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(pw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(gw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Jh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ww,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Jh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Bw,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(yw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Cw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(mw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(fw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(Tw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(bw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(vw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Yh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Yh,{draft:c,setDraft:u,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},K=()=>{A(c),e()};return a.jsxs("div",{ref:v,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...g===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:g.y,left:g.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:C,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(ra,{size:"18px",children:a.jsx(nw,{})})})]})}),a.jsx("button",{type:"button",onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",background:s.headerBlue,color:s.headerText,border:"none",cursor:"pointer"},children:a.jsx(ra,{size:"20px",children:a.jsx(sw,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(M=>{const W=o===M;return a.jsxs("button",{type:"button",onClick:()=>l(M),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:W?s.text:s.mutedText,cursor:"pointer"},children:[M.charAt(0).toUpperCase()+M.slice(1),W&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},M)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:S()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:K,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var na=function(i,e){return na=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(t[r]=A[r])},na(i,e)};function EA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");na(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var sa=function(){return sa=Object.assign||function(e){for(var t,A=1,r=arguments.length;A<r;A++){t=arguments[A];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},sa.apply(this,arguments)};function tA(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(u){try{c(A.next(u))}catch(g){s(g)}}function l(u){try{c(A.throw(u))}catch(g){s(g)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Zt(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},A,r,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(u){return l([c,u])}}function l(c){if(A)throw new TypeError("Generator is already executing.");for(;t;)try{if(A=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(u){c=[6,u],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Rn(i,e,t){if(arguments.length===2)for(var A=0,r=e.length,n;A<r;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return i.concat(n||e)}for(var qA=(function(){function i(e,t,A,r){this.left=e,this.top=t,this.width=A,this.height=r}return i.prototype.add=function(e,t,A,r){return new i(this.left+e,this.top+t,this.width+A,this.height+r)},i.fromClientRect=function(e,t){return new i(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},i.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(r){return r.width!==0});return A?new i(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):i.EMPTY},i.EMPTY=new i(0,0,0,0),i})(),Gn=function(i,e){return qA.fromClientRect(i,e.getBoundingClientRect())},Qw=function(i){var e=i.body,t=i.documentElement;if(!e||!t)throw new Error("Unable to get document size");var A=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new qA(0,0,A,r)},$n=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},Mt=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},jh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<jh.length;Xn++)Fw[jh.charCodeAt(Xn)]=Xn;for(var eu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Jn=0;Jn<eu.length;Jn++)Fr[eu.charCodeAt(Jn)]=Jn;for(var Uw=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Fr[i.charCodeAt(A)],s=Fr[i.charCodeAt(A+1)],o=Fr[i.charCodeAt(A+2)],l=Fr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Sw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Ew=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Ei=5,oa=11,aa=2,Lw=oa-Ei,tu=65536>>Ei,Mw=1<<Ei,la=Mw-1,Hw=1024>>Ei,Iw=tu+Hw,Dw=Iw,_w=32,Pw=Dw+_w,Nw=65536>>oa,Ow=1<<Lw,kw=Ow-1,Au=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Kw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Vw=function(i,e){var t=Uw(i),A=Array.isArray(t)?Ew(t):new Uint32Array(t),r=Array.isArray(t)?Sw(t):new Uint16Array(t),n=24,s=Au(r,n/2,A[4]/2),o=A[5]===2?Au(r,(n+A[4])/2):Kw(A,Math.ceil((n+A[4])/4));return new zw(A[0],A[1],A[2],A[3],s,o)},zw=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ei],t=(t<<aa)+(e&la),this.data[t];if(e<=65535)return t=this.index[tu+(e-55296>>Ei)],t=(t<<aa)+(e&la),this.data[t];if(e<this.highStart)return t=Pw-Nw+(e>>oa),t=this.index[t],t+=e>>Ei&kw,t=this.index[t],t=(t<<aa)+(e&la),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),iu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ww=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<iu.length;Zn++)Ww[iu.charCodeAt(Zn)]=Zn;var Rw="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",ru=50,Gw=1,nu=2,su=3,$w=4,Xw=5,ou=7,au=8,lu=9,ai=10,ca=11,cu=12,ha=13,Jw=14,Ur=15,ua=16,Yn=17,Sr=18,Zw=19,hu=20,da=21,Er=22,pa=23,Ri=24,pA=25,Lr=26,Mr=27,Gi=28,Yw=29,Li=30,qw=31,qn=32,jn=33,fa=34,ma=35,ga=36,Hr=37,wa=38,es=39,ts=40,Ba=41,uu=42,jw=43,eB=[9001,65288],du="!",ct="×",As="÷",ya=Vw(Rw),jA=[Li,ga],Ca=[Gw,nu,su,Xw],pu=[ai,au],fu=[Mr,Lr],tB=Ca.concat(pu),mu=[wa,es,ts,fa,ma],AB=[Ur,ha],iB=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ya.get(n);if(o>ru?(r.push(!0),o-=ru):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(ua);if(o===$w||o===ca){if(s===0)return A.push(s),t.push(Li);var l=t[s-1];return tB.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(Li))}if(A.push(s),o===qw)return t.push(e==="strict"?da:Hr);if(o===uu||o===Yw)return t.push(Li);if(o===jw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Hr):t.push(Li);t.push(o)}),[A,t,r]},va=function(i,e,t,A){var r=A[t];if(Array.isArray(i)?i.indexOf(r)!==-1:i===r)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==ai)break}if(r===ai)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(i)?i.indexOf(o)!==-1:i===o)for(var l=t;l<=A.length;){l++;var s=A[l];if(s===e)return!0;if(s!==ai)break}if(o!==ai)break}return!1},gu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===ai)t--;else return A}return 0},rB=function(i,e,t,A,r){if(t[A]===0)return ct;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return ct;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===nu&&u===su)return ct;if(Ca.indexOf(l)!==-1)return du;if(Ca.indexOf(u)!==-1||pu.indexOf(u)!==-1)return ct;if(gu(n,e)===au)return As;if(ya.get(i[n])===ca||(l===qn||l===jn)&&ya.get(i[o])===ca||l===ou||u===ou||l===lu||[ai,ha,Ur].indexOf(l)===-1&&u===lu||[Yn,Sr,Zw,Ri,Gi].indexOf(u)!==-1||gu(n,e)===Er||va(pa,Er,n,e)||va([Yn,Sr],da,n,e)||va(cu,cu,n,e))return ct;if(l===ai)return As;if(l===pa||u===pa)return ct;if(u===ua||l===ua)return As;if([ha,Ur,da].indexOf(u)!==-1||l===Jw||c===ga&&AB.indexOf(l)!==-1||l===Gi&&u===ga||u===hu||jA.indexOf(u)!==-1&&l===pA||jA.indexOf(l)!==-1&&u===pA||l===Mr&&[Hr,qn,jn].indexOf(u)!==-1||[Hr,qn,jn].indexOf(l)!==-1&&u===Lr||jA.indexOf(l)!==-1&&fu.indexOf(u)!==-1||fu.indexOf(l)!==-1&&jA.indexOf(u)!==-1||[Mr,Lr].indexOf(l)!==-1&&(u===pA||[Er,Ur].indexOf(u)!==-1&&e[o+1]===pA)||[Er,Ur].indexOf(l)!==-1&&u===pA||l===pA&&[pA,Gi,Ri].indexOf(u)!==-1)return ct;if([pA,Gi,Ri,Yn,Sr].indexOf(u)!==-1)for(var g=n;g>=0;){var B=e[g];if(B===pA)return ct;if([Gi,Ri].indexOf(B)!==-1)g--;else break}if([Mr,Lr].indexOf(u)!==-1)for(var g=[Yn,Sr].indexOf(l)!==-1?s:n;g>=0;){var B=e[g];if(B===pA)return ct;if([Gi,Ri].indexOf(B)!==-1)g--;else break}if(wa===l&&[wa,es,fa,ma].indexOf(u)!==-1||[es,fa].indexOf(l)!==-1&&[es,ts].indexOf(u)!==-1||[ts,ma].indexOf(l)!==-1&&u===ts||mu.indexOf(l)!==-1&&[hu,Lr].indexOf(u)!==-1||mu.indexOf(u)!==-1&&l===Mr||jA.indexOf(l)!==-1&&jA.indexOf(u)!==-1||l===Ri&&jA.indexOf(u)!==-1||jA.concat(pA).indexOf(l)!==-1&&u===Er&&eB.indexOf(i[o])===-1||jA.concat(pA).indexOf(u)!==-1&&l===Sr)return ct;if(l===Ba&&u===Ba){for(var v=t[n],b=1;v>0&&(v--,e[v]===Ba);)b++;if(b%2!==0)return ct}return l===qn&&u===jn?ct:As},nB=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=iB(i,e.lineBreak),A=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[pA,Li,uu].indexOf(o)!==-1?Hr:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&i[l]>=19968&&i[l]<=40959}):void 0;return[A,r,s]},sB=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===du,this.start=A,this.end=r}return i.prototype.slice=function(){return Mt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),oB=function(i,e){var t=$n(i),A=nB(t,e),r=A[0],n=A[1],s=A[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var u=ct;c<o&&(u=rB(t,n,r,++c,s))===ct;);if(u!==ct||c===o){var g=new sB(t,u,l,c);return l=c,{value:g,done:!1}}return{done:!0,value:null}}}},aB=1,lB=2,Ir=4,wu=8,is=10,Bu=47,Dr=92,cB=9,hB=32,rs=34,_r=61,uB=35,dB=36,pB=37,ns=39,ss=40,Pr=41,fB=95,oA=45,mB=33,gB=60,wB=62,BB=64,yB=91,CB=93,vB=61,TB=123,os=63,bB=125,yu=124,xB=126,QB=128,Cu=65533,Ta=42,Mi=43,FB=44,UB=58,SB=59,Nr=46,EB=0,LB=8,MB=11,HB=14,IB=31,DB=127,kA=-1,vu=48,Tu=97,bu=101,_B=102,PB=117,NB=122,xu=65,Qu=69,Fu=70,OB=85,kB=90,Yt=function(i){return i>=vu&&i<=57},KB=function(i){return i>=55296&&i<=57343},$i=function(i){return Yt(i)||i>=xu&&i<=Fu||i>=Tu&&i<=_B},VB=function(i){return i>=Tu&&i<=NB},zB=function(i){return i>=xu&&i<=kB},WB=function(i){return VB(i)||zB(i)},RB=function(i){return i>=QB},as=function(i){return i===is||i===cB||i===hB},ls=function(i){return WB(i)||RB(i)||i===fB},Uu=function(i){return ls(i)||Yt(i)||i===oA},GB=function(i){return i>=EB&&i<=LB||i===MB||i>=HB&&i<=IB||i===DB},li=function(i,e){return i!==Dr?!1:e!==is},cs=function(i,e,t){return i===oA?ls(e)||li(e,t):ls(i)?!0:!!(i===Dr&&li(i,e))},ba=function(i,e,t){return i===Mi||i===oA?Yt(e)?!0:e===Nr&&Yt(t):Yt(i===Nr?e:i)},$B=function(i){var e=0,t=1;(i[e]===Mi||i[e]===oA)&&(i[e]===oA&&(t=-1),e++);for(var A=[];Yt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Mt.apply(void 0,A),10):0;i[e]===Nr&&e++;for(var n=[];Yt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Mt.apply(void 0,n),10):0;(i[e]===Qu||i[e]===bu)&&e++;var l=1;(i[e]===Mi||i[e]===oA)&&(i[e]===oA&&(l=-1),e++);for(var c=[];Yt(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Mt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},XB={type:2},JB={type:3},ZB={type:4},YB={type:13},qB={type:8},jB={type:21},e2={type:9},t2={type:10},A2={type:11},i2={type:12},r2={type:14},hs={type:23},n2={type:1},s2={type:25},o2={type:24},a2={type:26},l2={type:27},c2={type:28},h2={type:29},u2={type:31},xa={type:32},Su=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat($n(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==xa;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case rs:return this.consumeStringToken(rs);case uB:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Uu(t)||li(A,r)){var n=cs(t,A,r)?lB:aB,s=this.consumeName();return{type:5,value:s,flags:n}}break;case dB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),YB;break;case ns:return this.consumeStringToken(ns);case ss:return XB;case Pr:return JB;case Ta:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),r2;break;case Mi:if(ba(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case FB:return ZB;case oA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(ba(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(cs(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===oA&&c===wB)return this.consumeCodePoint(),this.consumeCodePoint(),o2;break;case Nr:if(ba(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Bu:if(this.peekCodePoint(0)===Ta)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===Ta&&(u=this.consumeCodePoint(),u===Bu))return this.consumeToken();if(u===kA)return this.consumeToken()}break;case UB:return a2;case SB:return l2;case gB:if(this.peekCodePoint(0)===mB&&this.peekCodePoint(1)===oA&&this.peekCodePoint(2)===oA)return this.consumeCodePoint(),this.consumeCodePoint(),s2;break;case BB:var g=this.peekCodePoint(0),B=this.peekCodePoint(1),v=this.peekCodePoint(2);if(cs(g,B,v)){var s=this.consumeName();return{type:7,value:s}}break;case yB:return c2;case Dr:if(li(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case CB:return h2;case vB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),qB;break;case TB:return A2;case bB:return i2;case PB:case OB:var b=this.peekCodePoint(0),C=this.peekCodePoint(1);return b===Mi&&($i(C)||C===os)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case yu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),e2;if(this.peekCodePoint(0)===yu)return this.consumeCodePoint(),jB;break;case xB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),t2;break;case kA:return xa}return as(e)?(this.consumeWhiteSpace(),u2):Yt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ls(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Mt(e)}},i.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},i.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},i.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},i.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();$i(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===os&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Mt.apply(void 0,e.map(function(l){return l===os?vu:l})),16),n=parseInt(Mt.apply(void 0,e.map(function(l){return l===os?Fu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Mt.apply(void 0,e),16);if(this.peekCodePoint(0)===oA&&$i(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];$i(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Mt.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},i.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ss?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ss?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===kA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ns||t===rs){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===kA||this.peekCodePoint(0)===Pr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),hs)}for(;;){var r=this.consumeCodePoint();if(r===kA||r===Pr)return{type:22,value:Mt.apply(void 0,e)};if(as(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===kA||this.peekCodePoint(0)===Pr?(this.consumeCodePoint(),{type:22,value:Mt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),hs);if(r===rs||r===ns||r===ss||GB(r))return this.consumeBadUrlRemnants(),hs;if(r===Dr)if(li(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),hs;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;as(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Pr||e===kA)return;li(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},i.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var r=Math.min(t,e);A+=Mt.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),A},i.prototype.consumeStringToken=function(e){var t="",A=0;do{var r=this._value[A];if(r===kA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===is)return this._value.splice(0,A),n2;if(r===Dr){var n=this._value[A+1];n!==kA&&n!==void 0&&(n===is?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):li(r,n)&&(t+=this.consumeStringSlice(A),t+=Mt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Ir,A=this.peekCodePoint(0);for((A===Mi||A===oA)&&e.push(this.consumeCodePoint());Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Nr&&Yt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=wu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===Qu||A===bu)&&((r===Mi||r===oA)&&Yt(n)||Yt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=wu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[$B(e),t]},i.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(cs(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===pB?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if($i(e)){for(var t=Mt(e);$i(this.peekCodePoint(0))&&t.length<6;)t+=Mt(this.consumeCodePoint());as(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||KB(A)||A>1114111?Cu:A}return e===kA?Cu:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Uu(t))e+=Mt(t);else if(li(t,this.peekCodePoint(0)))e+=Mt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),Eu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new Su;return t.write(e),new i(t.read())},i.parseValue=function(e){return i.create(e).parseComponentValue()},i.parseValues=function(e){return i.create(e).parseComponentValues()},i.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},i.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},i.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},i.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},A=this.consumeToken();;){if(A.type===32||p2(A,e))return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue()),A=this.consumeToken()}},i.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var A=this.consumeToken();if(A.type===32||A.type===3)return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue())}},i.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?xa:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),Or=function(i){return i.type===15},Xi=function(i){return i.type===17},wt=function(i){return i.type===20},d2=function(i){return i.type===0},Qa=function(i,e){return wt(i)&&i.value===e},Lu=function(i){return i.type!==31},Ji=function(i){return i.type!==31&&i.type!==4},KA=function(i){var e=[],t=[];return i.forEach(function(A){if(A.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}A.type!==31&&t.push(A)}),t.length&&e.push(t),e},p2=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},ci=function(i){return i.type===17||i.type===15},Pt=function(i){return i.type===16||ci(i)},Mu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},Wt={type:17,number:0,flags:Ir},Fa={type:16,number:50,flags:Ir},hi={type:16,number:100,flags:Ir},kr=function(i,e,t){var A=i[0],r=i[1];return[Tt(A,e),Tt(typeof r<"u"?r:A,t)]},Tt=function(i,e){if(i.type===16)return i.number/100*e;if(Or(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},Hu="deg",Iu="grad",Du="rad",_u="turn",us={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case Hu:return Math.PI*e.number/180;case Iu:return Math.PI/200*e.number;case Du:return e.number;case _u:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Pu=function(i){return i.type===15&&(i.unit===Hu||i.unit===Iu||i.unit===Du||i.unit===_u)},Nu=function(i){var e=i.filter(wt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Wt,Wt];case"to top":case"bottom":return vA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Wt,hi];case"to right":case"left":return vA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[hi,hi];case"to bottom":case"top":return vA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[hi,Wt];case"to left":case"right":return vA(270)}return 0},vA=function(i){return Math.PI*i/180},ui={name:"color",parse:function(i,e){if(e.type===18){var t=f2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(i,e.values)}if(e.type===5){if(e.value.length===3){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return pi(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return pi(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return pi(parseInt(A,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return pi(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ei[e.value.toUpperCase()];if(typeof o<"u")return o}return ei.TRANSPARENT}},di=function(i){return(255&i)===0},kt=function(i){var e=255&i,t=255&i>>8,A=255&i>>16,r=255&i>>24;return e<255?"rgba("+r+","+A+","+t+","+e/255+")":"rgb("+r+","+A+","+t+")"},pi=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},Ou=function(i,e){if(i.type===17)return i.number;if(i.type===16){var t=e===3?1:255;return e===3?i.number/100*t:Math.round(i.number/100*t)}return 0},ku=function(i,e){var t=e.filter(Ji);if(t.length===3){var A=t.map(Ou),r=A[0],n=A[1],s=A[2];return pi(r,n,s,1)}if(t.length===4){var o=t.map(Ou),r=o[0],n=o[1],s=o[2],l=o[3];return pi(r,n,s,l)}return 0};function Ua(i,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-i)*t*6+i:t<1/2?e:t<2/3?(e-i)*6*(2/3-t)+i:i}var Ku=function(i,e){var t=e.filter(Ji),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?vA(A.number):us.parse(i,A))/(Math.PI*2),l=Pt(r)?r.number/100:0,c=Pt(n)?n.number/100:0,u=typeof s<"u"&&Pt(s)?Tt(s,1):1;if(l===0)return pi(c*255,c*255,c*255,1);var g=c<=.5?c*(l+1):c+l-c*l,B=c*2-g,v=Ua(B,g,o+1/3),b=Ua(B,g,o),C=Ua(B,g,o-1/3);return pi(v*255,b*255,C*255,u)},f2={hsl:Ku,hsla:Ku,rgb:ku,rgba:ku},Kr=function(i,e){return ui.parse(i,Eu.create(e).parseComponentValue())},ei={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},m2={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},g2={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ds=function(i,e){var t=ui.parse(i,e[0]),A=e[1];return A&&Pt(A)?{color:t,stop:A}:{color:t,stop:null}},Vu=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=Wt),A.stop===null&&(A.stop=hi);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=Tt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var g=s-c,B=r[c-1],v=(u-B)/(g+1),b=1;b<=g;b++)r[c+b-1]=v*b;c=null}}return i.map(function(C,U){var F=C.color;return{color:F,stop:Math.max(Math.min(1,r[U]/e),0)}})},w2=function(i,e,t){var A=e/2,r=t/2,n=Tt(i[0],e)-A,s=r-Tt(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},B2=function(i,e,t){var A=typeof i=="number"?i:w2(i,e,t),r=Math.abs(e*Math.sin(A))+Math.abs(t*Math.cos(A)),n=e/2,s=t/2,o=r/2,l=Math.sin(A-Math.PI/2)*o,c=Math.cos(A-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},LA=function(i,e){return Math.sqrt(i*i+e*e)},zu=function(i,e,t,A,r){var n=[[0,0],[0,e],[i,0],[i,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],u=LA(t-l,A-c);return(r?u<s.optimumDistance:u>s.optimumDistance)?{optimumCorner:o,optimumDistance:u}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},y2=function(i,e,t,A,r){var n=0,s=0;switch(i.size){case 0:i.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-A)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(i.shape===0)n=s=Math.min(LA(e,t),LA(e,t-r),LA(e-A,t),LA(e-A,t-r));else if(i.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-A)),l=zu(A,r,e,t,!0),c=l[0],u=l[1];n=LA(c-e,(u-t)/o),s=o*n}break;case 1:i.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-A)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(i.shape===0)n=s=Math.max(LA(e,t),LA(e,t-r),LA(e-A,t),LA(e-A,t-r));else if(i.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-A)),g=zu(A,r,e,t,!1),c=g[0],u=g[1];n=LA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=Tt(i.size[0],A),s=i.size.length===2?Tt(i.size[1],r):n),[n,s]},C2=function(i,e){var t=vA(180),A=[];return KA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Nu(r);return}else if(Pu(s)){t=us.parse(i,s);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},ps=function(i,e){var t=vA(180),A=[];return KA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=Nu(r);return}else if(Pu(s)){t=(us.parse(i,s)+vA(270))%vA(360);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},v2=function(i,e){var t=vA(180),A=[],r=1,n=0,s=3,o=[];return KA(e).forEach(function(l,c){var u=l[0];if(c===0){if(wt(u)&&u.value==="linear"){r=1;return}else if(wt(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var g=ui.parse(i,u.values[0]);A.push({stop:Wt,color:g})}else if(u.name==="to"){var g=ui.parse(i,u.values[0]);A.push({stop:hi,color:g})}else if(u.name==="color-stop"){var B=u.values.filter(Ji);if(B.length===2){var g=ui.parse(i,B[1]),v=B[0];Xi(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:g})}}}}),r===1?{angle:(t+vA(180))%vA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},Wu="closest-side",Ru="farthest-side",Gu="closest-corner",$u="farthest-corner",Xu="circle",Ju="ellipse",Zu="cover",Yu="contain",T2=function(i,e){var t=0,A=3,r=[],n=[];return KA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(g,B){if(c)if(wt(B))switch(B.value){case"center":return n.push(Fa),g;case"top":case"left":return n.push(Wt),g;case"right":case"bottom":return n.push(hi),g}else(Pt(B)||ci(B))&&n.push(B);else if(wt(B))switch(B.value){case Xu:return t=0,!1;case Ju:return t=1,!1;case"at":return c=!0,!1;case Wu:return A=0,!1;case Zu:case Ru:return A=1,!1;case Yu:case Gu:return A=2,!1;case $u:return A=3,!1}else if(ci(B)||Pt(B))return Array.isArray(A)||(A=[]),A.push(B),!1;return g},l)}if(l){var u=ds(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},fs=function(i,e){var t=0,A=3,r=[],n=[];return KA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,g){if(wt(g))switch(g.value){case"center":return n.push(Fa),!1;case"top":case"left":return n.push(Wt),!1;case"right":case"bottom":return n.push(hi),!1}else if(Pt(g)||ci(g))return n.push(g),!1;return u},l):o===1&&(l=s.reduce(function(u,g){if(wt(g))switch(g.value){case Xu:return t=0,!1;case Ju:return t=1,!1;case Yu:case Wu:return A=0,!1;case Ru:return A=1,!1;case Gu:return A=2,!1;case Zu:case $u:return A=3,!1}else if(ci(g)||Pt(g))return Array.isArray(A)||(A=[]),A.push(g),!1;return u},l)),l){var c=ds(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},b2=function(i){return i.type===1},x2=function(i){return i.type===2},Sa={name:"image",parse:function(i,e){if(e.type===22){var t={url:e.value,type:0};return i.cache.addImage(e.value),t}if(e.type===18){var A=qu[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return A(i,e.values)}throw new Error("Unsupported image type "+e.type)}};function Q2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!qu[i.name])}var qu={"linear-gradient":C2,"-moz-linear-gradient":ps,"-ms-linear-gradient":ps,"-o-linear-gradient":ps,"-webkit-linear-gradient":ps,"radial-gradient":T2,"-moz-radial-gradient":fs,"-ms-radial-gradient":fs,"-o-radial-gradient":fs,"-webkit-radial-gradient":fs,"-webkit-gradient":v2},F2={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(A){return Ji(A)&&Q2(A)}).map(function(A){return Sa.parse(i,A)})}},U2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},S2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return KA(e).map(function(t){return t.filter(Pt)}).map(Mu)}},E2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return KA(e).map(function(t){return t.filter(wt).map(function(A){return A.value}).join(" ")}).map(L2)}},L2=function(i){switch(i){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},Zi;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Zi||(Zi={}));var M2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return KA(e).map(function(t){return t.filter(H2)})}},H2=function(i){return wt(i)||Pt(i)},ms=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},I2=ms("top"),D2=ms("right"),_2=ms("bottom"),P2=ms("left"),gs=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Mu(t.filter(Pt))}}},N2=gs("top-left"),O2=gs("top-right"),k2=gs("bottom-right"),K2=gs("bottom-left"),ws=function(i){return{name:"border-"+i+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},V2=ws("top"),z2=ws("right"),W2=ws("bottom"),R2=ws("left"),Bs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Or(t)?t.number:0}}},G2=Bs("top"),$2=Bs("right"),X2=Bs("bottom"),J2=Bs("left"),Z2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Y2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},q2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).reduce(function(t,A){return t|j2(A.value)},0)}},j2=function(i){switch(i){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},ey={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},ty={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(i,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},ys;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ys||(ys={}));var Ay={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ys.STRICT:ys.NORMAL}},iy={name:"line-height",initialValue:"normal",prefix:!1,type:4},ju=function(i,e){return wt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Pt(i)?Tt(i,e):e},ry={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:Sa.parse(i,e)}},ny={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},Ea={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Cs=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},sy=Cs("top"),oy=Cs("right"),ay=Cs("bottom"),ly=Cs("left"),cy={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},hy={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},vs=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},uy=vs("top"),dy=vs("right"),py=vs("bottom"),fy=vs("left"),my={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(i,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},gy={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(i,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},wy={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Qa(e[0],"none")?[]:KA(e).map(function(t){for(var A={color:ei.TRANSPARENT,offsetX:Wt,offsetY:Wt,blur:Wt},r=0,n=0;n<t.length;n++){var s=t[n];ci(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=ui.parse(i,s)}return A})}},By={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},yy={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(i,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=Ty[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Cy=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},vy=function(i){var e=i.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],A=e[1];e[2],e[3];var r=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,A,r,n,s,o]:null},Ty={matrix:Cy,matrix3d:vy},ed={type:16,number:50,flags:Ir},by=[ed,ed],xy={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Pt);return t.length!==2?by:[t[0],t[1]]}},Qy={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Vr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var Fy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},Uy={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Xi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},td={name:"time",parse:function(i,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Sy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:1}},Ey={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ly={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},My={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(i,e){var t=[],A=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:A.push(t.join(" ")),t.length=0;break}}),t.length&&A.push(t.join(" ")),A.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},Hy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Iy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:wt(e)&&e.value==="bold"?700:400}},Dy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(wt).map(function(t){return t.value})}},_y={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Nt=function(i,e){return(i&e)!==0},Py={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},Ny={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var A=[],r=e.filter(Lu),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Xi(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},Oy={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(Lu),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(wt(n)&&n.value!=="none"){var o=s&&Xi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},ky={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(Or).map(function(t){return td.parse(i,t)})}},Ky={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var A=[],r=e.filter(d2);if(r.length%2!==0)return null;for(var n=0;n<r.length;n+=2){var s=r[n].value,o=r[n+1].value;A.push({open:s,close:o})}return A}},Ad=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},Vy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Qa(e[0],"none")?[]:KA(e).map(function(t){for(var A={color:255,offsetX:Wt,offsetY:Wt,blur:Wt,spread:Wt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];Qa(s,"inset")?A.inset=!0:ci(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=ui.parse(i,s)}return A})}},zy={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(wt).forEach(function(r){switch(r.value){case"stroke":A.push(1);break;case"fill":A.push(0);break;case"markers":A.push(2);break}}),t.forEach(function(r){A.indexOf(r)===-1&&A.push(r)}),A}},Wy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Ry={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return Or(e)?e.number:0}},Gy=(function(){function i(e,t){var A,r;this.animationDuration=De(e,ky,t.animationDuration),this.backgroundClip=De(e,m2,t.backgroundClip),this.backgroundColor=De(e,g2,t.backgroundColor),this.backgroundImage=De(e,F2,t.backgroundImage),this.backgroundOrigin=De(e,U2,t.backgroundOrigin),this.backgroundPosition=De(e,S2,t.backgroundPosition),this.backgroundRepeat=De(e,E2,t.backgroundRepeat),this.backgroundSize=De(e,M2,t.backgroundSize),this.borderTopColor=De(e,I2,t.borderTopColor),this.borderRightColor=De(e,D2,t.borderRightColor),this.borderBottomColor=De(e,_2,t.borderBottomColor),this.borderLeftColor=De(e,P2,t.borderLeftColor),this.borderTopLeftRadius=De(e,N2,t.borderTopLeftRadius),this.borderTopRightRadius=De(e,O2,t.borderTopRightRadius),this.borderBottomRightRadius=De(e,k2,t.borderBottomRightRadius),this.borderBottomLeftRadius=De(e,K2,t.borderBottomLeftRadius),this.borderTopStyle=De(e,V2,t.borderTopStyle),this.borderRightStyle=De(e,z2,t.borderRightStyle),this.borderBottomStyle=De(e,W2,t.borderBottomStyle),this.borderLeftStyle=De(e,R2,t.borderLeftStyle),this.borderTopWidth=De(e,G2,t.borderTopWidth),this.borderRightWidth=De(e,$2,t.borderRightWidth),this.borderBottomWidth=De(e,X2,t.borderBottomWidth),this.borderLeftWidth=De(e,J2,t.borderLeftWidth),this.boxShadow=De(e,Vy,t.boxShadow),this.color=De(e,Z2,t.color),this.direction=De(e,Y2,t.direction),this.display=De(e,q2,t.display),this.float=De(e,ey,t.cssFloat),this.fontFamily=De(e,My,t.fontFamily),this.fontSize=De(e,Hy,t.fontSize),this.fontStyle=De(e,_y,t.fontStyle),this.fontVariant=De(e,Dy,t.fontVariant),this.fontWeight=De(e,Iy,t.fontWeight),this.letterSpacing=De(e,ty,t.letterSpacing),this.lineBreak=De(e,Ay,t.lineBreak),this.lineHeight=De(e,iy,t.lineHeight),this.listStyleImage=De(e,ry,t.listStyleImage),this.listStylePosition=De(e,ny,t.listStylePosition),this.listStyleType=De(e,Ea,t.listStyleType),this.marginTop=De(e,sy,t.marginTop),this.marginRight=De(e,oy,t.marginRight),this.marginBottom=De(e,ay,t.marginBottom),this.marginLeft=De(e,ly,t.marginLeft),this.opacity=De(e,Sy,t.opacity);var n=De(e,cy,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=De(e,hy,t.overflowWrap),this.paddingTop=De(e,uy,t.paddingTop),this.paddingRight=De(e,dy,t.paddingRight),this.paddingBottom=De(e,py,t.paddingBottom),this.paddingLeft=De(e,fy,t.paddingLeft),this.paintOrder=De(e,zy,t.paintOrder),this.position=De(e,gy,t.position),this.textAlign=De(e,my,t.textAlign),this.textDecorationColor=De(e,Ey,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=De(e,Ly,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=De(e,wy,t.textShadow),this.textTransform=De(e,By,t.textTransform),this.transform=De(e,yy,t.transform),this.transformOrigin=De(e,xy,t.transformOrigin),this.visibility=De(e,Qy,t.visibility),this.webkitTextStrokeColor=De(e,Wy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=De(e,Ry,t.webkitTextStrokeWidth),this.wordBreak=De(e,Fy,t.wordBreak),this.zIndex=De(e,Uy,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return di(this.backgroundColor)},i.prototype.isTransformed=function(){return this.transform!==null},i.prototype.isPositioned=function(){return this.position!==0},i.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},i.prototype.isFloating=function(){return this.float!==0},i.prototype.isInlineLevel=function(){return Nt(this.display,4)||Nt(this.display,33554432)||Nt(this.display,268435456)||Nt(this.display,536870912)||Nt(this.display,67108864)||Nt(this.display,134217728)},i})(),$y=(function(){function i(e,t){this.content=De(e,Py,t.content),this.quotes=De(e,Ky,t.quotes)}return i})(),id=(function(){function i(e,t){this.counterIncrement=De(e,Ny,t.counterIncrement),this.counterReset=De(e,Oy,t.counterReset)}return i})(),De=function(i,e,t){var A=new Su,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new Eu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,wt(s)?s.value:e.initialValue);case 0:return e.parse(i,n.parseComponentValue());case 1:return e.parse(i,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return us.parse(i,n.parseComponentValue());case"color":return ui.parse(i,n.parseComponentValue());case"image":return Sa.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return ci(o)?o:Wt;case"length-percentage":var l=n.parseComponentValue();return Pt(l)?l:Wt;case"time":return td.parse(i,n.parseComponentValue())}break}},Xy="data-html2canvas-debug",Jy=function(i){var e=i.getAttribute(Xy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},La=function(i,e){var t=Jy(i);return t===1||e===t},VA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,La(t,3))debugger;this.styles=new Gy(e,window.getComputedStyle(t,null)),Ra(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Gn(this.context,t),La(t,4)&&(this.flags|=16)}return i})(),Zy="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",rd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<rd.length;Ts++)zr[rd.charCodeAt(Ts)]=Ts;for(var Yy=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=zr[i.charCodeAt(A)],s=zr[i.charCodeAt(A+1)],o=zr[i.charCodeAt(A+2)],l=zr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},qy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},jy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Hi=5,Ma=11,Ha=2,eC=Ma-Hi,nd=65536>>Hi,tC=1<<Hi,Ia=tC-1,AC=1024>>Hi,iC=nd+AC,rC=iC,nC=32,sC=rC+nC,oC=65536>>Ma,aC=1<<eC,lC=aC-1,sd=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},cC=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},hC=function(i,e){var t=Yy(i),A=Array.isArray(t)?jy(t):new Uint32Array(t),r=Array.isArray(t)?qy(t):new Uint16Array(t),n=24,s=sd(r,n/2,A[4]/2),o=A[5]===2?sd(r,(n+A[4])/2):cC(A,Math.ceil((n+A[4])/4));return new uC(A[0],A[1],A[2],A[3],s,o)},uC=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Hi],t=(t<<Ha)+(e&Ia),this.data[t];if(e<=65535)return t=this.index[nd+(e-55296>>Hi)],t=(t<<Ha)+(e&Ia),this.data[t];if(e<this.highStart)return t=sC-oC+(e>>Ma),t=this.index[t],t+=e>>Hi&lC,t=this.index[t],t=(t<<Ha)+(e&Ia),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),od="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dC=typeof Uint8Array>"u"?[]:new Uint8Array(256),bs=0;bs<od.length;bs++)dC[od.charCodeAt(bs)]=bs;var pC=1,Da=2,_a=3,ad=4,ld=5,fC=7,cd=8,Pa=9,Na=10,hd=11,ud=12,dd=13,pd=14,Oa=15,mC=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},gC=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},wC=hC(Zy),TA="×",ka="÷",BC=function(i){return wC.get(i)},yC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===Da&&s===_a)return TA;if(n===Da||n===_a||n===ad||s===Da||s===_a||s===ad)return ka;if(n===cd&&[cd,Pa,hd,ud].indexOf(s)!==-1||(n===hd||n===Pa)&&(s===Pa||s===Na)||(n===ud||n===Na)&&s===Na||s===dd||s===ld||s===fC||n===pC)return TA;if(n===dd&&s===pd){for(;r===ld;)r=e[--A];if(r===pd)return TA}if(n===Oa&&s===Oa){for(var o=0;r===Oa;)o++,r=e[--A];if(o%2===0)return TA}return ka},CC=function(i){var e=mC(i),t=e.length,A=0,r=0,n=e.map(BC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=TA;A<t&&(s=yC(e,n,++A))===TA;);if(s!==TA||A===t){var o=gC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},vC=function(i){for(var e=CC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},TC=function(i){var e=123;if(i.createRange){var t=i.createRange();if(t.getBoundingClientRect){var A=i.createElement("boundtest");A.style.height=e+"px",A.style.display="block",i.body.appendChild(A),t.selectNode(A);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(i.body.removeChild(A),n===e)return!0}}return!1},bC=function(i){var e=i.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",i.body.appendChild(e);var t=i.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var A=e.firstChild,r=$n(A.data).map(function(l){return Mt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var g=u.x>s.x||u.y>s.y;return s=u,c===0?!0:g});return i.body.removeChild(e),o},xC=function(){return typeof new Image().crossOrigin<"u"},QC=function(){return typeof new XMLHttpRequest().responseType=="string"},FC=function(i){var e=new Image,t=i.createElement("canvas"),A=t.getContext("2d");if(!A)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{A.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},fd=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},UC=function(i){var e=i.createElement("canvas"),t=100;e.width=t,e.height=t;var A=e.getContext("2d");if(!A)return Promise.reject(!1);A.fillStyle="rgb(0, 255, 0)",A.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Ka(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),md(s).then(function(o){A.drawImage(o,0,0);var l=A.getImageData(0,0,t,t).data;A.fillStyle="red",A.fillRect(0,0,t,t);var c=i.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",fd(l)?md(Ka(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),fd(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ka=function(i,e,t,A,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",i.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",A.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},md=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){return e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Rt={get SUPPORT_RANGE_BOUNDS(){var i=TC(document);return Object.defineProperty(Rt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Rt.SUPPORT_RANGE_BOUNDS&&bC(document);return Object.defineProperty(Rt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=FC(document);return Object.defineProperty(Rt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?UC(document):Promise.resolve(!1);return Object.defineProperty(Rt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=xC();return Object.defineProperty(Rt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=QC();return Object.defineProperty(Rt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Rt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Rt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Wr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),SC=function(i,e,t,A){var r=MC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Rt.SUPPORT_RANGE_BOUNDS){var l=gd(A,s,o.length).getClientRects();if(l.length>1){var c=Va(o),u=0;c.forEach(function(B){n.push(new Wr(B,qA.fromDOMRectList(i,gd(A,u+s,B.length).getClientRects()))),u+=B.length})}else n.push(new Wr(o,qA.fromDOMRectList(i,l)))}else{var g=A.splitText(o.length);n.push(new Wr(o,EC(i,A))),A=g}else Rt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},EC=function(i,e){var t=e.ownerDocument;if(t){var A=t.createElement("html2canvaswrapper");A.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(A,e);var n=Gn(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return qA.EMPTY},gd=function(i,e,t){var A=i.ownerDocument;if(!A)throw new Error("Node has no owner document");var r=A.createRange();return r.setStart(i,e),r.setEnd(i,e+t),r},Va=function(i){if(Rt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(i)).map(function(t){return t.segment})}return vC(i)},LC=function(i,e){if(Rt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(i)).map(function(A){return A.segment})}return IC(i,e)},MC=function(i,e){return e.letterSpacing!==0?Va(i):LC(i,e)},HC=[32,160,4961,65792,65793,4153,4241],IC=function(i,e){for(var t=oB(i,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),A=[],r,n=function(){if(r.value){var s=r.value.slice(),o=$n(s),l="";o.forEach(function(c){HC.indexOf(c)===-1?l+=Mt(c):(l.length&&A.push(l),A.push(Mt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},DC=(function(){function i(e,t,A){this.text=_C(t.data,A.textTransform),this.textBounds=SC(e,this.text,A,t)}return i})(),_C=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(PC,NC);case 2:return i.toUpperCase();default:return i}},PC=/(^|\s|:|-|\(|\))([a-z])/g,NC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},wd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.src=A.currentSrc||A.src,r.intrinsicWidth=A.naturalWidth,r.intrinsicHeight=A.naturalHeight,r.context.cache.addImage(r.src),r}return e})(VA),Bd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A,r.intrinsicWidth=A.width,r.intrinsicHeight=A.height,r}return e})(VA),yd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Gn(t,A);return A.setAttribute("width",s.width+"px"),A.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),r.intrinsicWidth=A.width.baseVal.value,r.intrinsicHeight=A.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})(VA),Cd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(VA),za=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.start=A.start,r.reversed=typeof A.reversed=="boolean"&&A.reversed===!0,r}return e})(VA),OC=[{type:15,flags:0,unit:"px",number:3}],kC=[{type:16,flags:0,number:50}],KC=function(i){return i.width>i.height?new qA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new qA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},VC=function(i){var e=i.type===zC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},xs="checkbox",Qs="radio",zC="password",vd=707406591,Wa=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;switch(r.type=A.type.toLowerCase(),r.checked=A.checked,r.value=VC(A),(r.type===xs||r.type===Qs)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=KC(r.bounds)),r.type){case xs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=OC;break;case Qs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=kC;break}return r}return e})(VA),Td=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=A.options[A.selectedIndex||0];return r.value=n&&n.text||"",r}return e})(VA),bd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(VA),xd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;r.src=A.src,r.width=parseInt(A.width,10)||0,r.height=parseInt(A.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(A.contentWindow&&A.contentWindow.document&&A.contentWindow.document.documentElement){r.tree=Fd(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Kr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):ei.TRANSPARENT,s=A.contentWindow.document.body?Kr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):ei.TRANSPARENT;r.backgroundColor=di(n)?di(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(VA),WC=["OL","UL","MENU"],Fs=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,Ud(r)&&r.data.trim().length>0)t.textNodes.push(new DC(i,r,t.styles));else if(Yi(r))if(Id(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Fs(i,o,t,A)});else{var s=Qd(i,r);s.styles.isVisible()&&(RC(r,s,A)?s.flags|=4:GC(s.styles)&&(s.flags|=2),WC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Fs(i,r.shadowRoot,s,A):!Ss(r)&&!Sd(r)&&!Es(r)&&Fs(i,r,s,A))}},Qd=function(i,e){return $a(e)?new wd(i,e):Ed(e)?new Bd(i,e):Sd(e)?new yd(i,e):$C(e)?new Cd(i,e):XC(e)?new za(i,e):JC(e)?new Wa(i,e):Es(e)?new Td(i,e):Ss(e)?new bd(i,e):Md(e)?new xd(i,e):new VA(i,e)},Fd=function(i,e){var t=Qd(i,e);return t.flags|=4,Fs(i,e,t,t),t},RC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ga(i)&&t.styles.isTransparent()},GC=function(i){return i.isPositioned()||i.isFloating()},Ud=function(i){return i.nodeType===Node.TEXT_NODE},Yi=function(i){return i.nodeType===Node.ELEMENT_NODE},Ra=function(i){return Yi(i)&&typeof i.style<"u"&&!Us(i)},Us=function(i){return typeof i.className=="object"},$C=function(i){return i.tagName==="LI"},XC=function(i){return i.tagName==="OL"},JC=function(i){return i.tagName==="INPUT"},ZC=function(i){return i.tagName==="HTML"},Sd=function(i){return i.tagName==="svg"},Ga=function(i){return i.tagName==="BODY"},Ed=function(i){return i.tagName==="CANVAS"},Ld=function(i){return i.tagName==="VIDEO"},$a=function(i){return i.tagName==="IMG"},Md=function(i){return i.tagName==="IFRAME"},Hd=function(i){return i.tagName==="STYLE"},YC=function(i){return i.tagName==="SCRIPT"},Ss=function(i){return i.tagName==="TEXTAREA"},Es=function(i){return i.tagName==="SELECT"},Id=function(i){return i.tagName==="SLOT"},Dd=function(i){return i.tagName.indexOf("-")>0},qC=(function(){function i(){this.counters={}}return i.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},i.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},i.prototype.pop=function(e){var t=this;e.forEach(function(A){return t.counters[A].pop()})},i.prototype.parse=function(e){var t=this,A=e.counterIncrement,r=e.counterReset,n=!0;A!==null&&A.forEach(function(o){var l=t.counters[o.counter];l&&o.increment!==0&&(n=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var s=[];return n&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},i})(),_d={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Pd={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},jC={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},ev={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},qi=function(i,e,t,A,r,n){return i<e||i>t?Gr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Nd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},Ht=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Nd(Math.abs(i),n,A,function(s){return Mt(Math.floor(s%n)+e)})+r)},Ii=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Nd(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},ji=1,fi=2,mi=4,Rr=8,ti=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Gr(i,4,r.length>0);var s=Math.abs(i),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&Nt(n,ji)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Nt(n,fi)||c===1&&l===1&&Nt(n,mi)&&i>100||c===1&&l>1&&Nt(n,Rr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(i<0?A:"")+o},Od="十百千萬",kd="拾佰仟萬",Kd="マイナス",Xa="마이너스",Gr=function(i,e,t){var A=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=Ht(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Ii(i,"〇一二三四五六七八九",r);case 6:return qi(i,1,3999,_d,3,A).toLowerCase();case 7:return qi(i,1,3999,_d,3,A);case 8:return Ht(i,945,969,!1,A);case 9:return Ht(i,97,122,!1,A);case 10:return Ht(i,65,90,!1,A);case 11:return Ht(i,1632,1641,!0,A);case 12:case 49:return qi(i,1,9999,Pd,3,A);case 35:return qi(i,1,9999,Pd,3,A).toLowerCase();case 13:return Ht(i,2534,2543,!0,A);case 14:case 30:return Ht(i,6112,6121,!0,A);case 15:return Ii(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Ii(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ti(i,"零一二三四五六七八九",Od,"負",r,fi|mi|Rr);case 47:return ti(i,"零壹貳參肆伍陸柒捌玖",kd,"負",r,ji|fi|mi|Rr);case 42:return ti(i,"零一二三四五六七八九",Od,"负",r,fi|mi|Rr);case 41:return ti(i,"零壹贰叁肆伍陆柒捌玖",kd,"负",r,ji|fi|mi|Rr);case 26:return ti(i,"〇一二三四五六七八九","十百千万",Kd,r,0);case 25:return ti(i,"零壱弐参四伍六七八九","拾百千万",Kd,r,ji|fi|mi);case 31:return ti(i,"영일이삼사오육칠팔구","십백천만",Xa,n,ji|fi|mi);case 33:return ti(i,"零一二三四五六七八九","十百千萬",Xa,n,0);case 32:return ti(i,"零壹貳參四五六七八九","拾百千",Xa,n,ji|fi|mi);case 18:return Ht(i,2406,2415,!0,A);case 20:return qi(i,1,19999,ev,3,A);case 21:return Ht(i,2790,2799,!0,A);case 22:return Ht(i,2662,2671,!0,A);case 22:return qi(i,1,10999,jC,3,A);case 23:return Ii(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Ii(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ht(i,3302,3311,!0,A);case 28:return Ii(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Ii(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Ht(i,3792,3801,!0,A);case 37:return Ht(i,6160,6169,!0,A);case 38:return Ht(i,4160,4169,!0,A);case 39:return Ht(i,2918,2927,!0,A);case 40:return Ht(i,1776,1785,!0,A);case 43:return Ht(i,3046,3055,!0,A);case 44:return Ht(i,3174,3183,!0,A);case 45:return Ht(i,3664,3673,!0,A);case 46:return Ht(i,3872,3881,!0,A);default:return Ht(i,48,57,!0,A)}},Vd="data-html2canvas-ignore",zd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new qC,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return i.prototype.toIFrame=function(e,t){var A=this,r=tv(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=r.contentWindow,l=o.document,c=rv(r).then(function(){return tA(A,void 0,void 0,function(){var u,g;return Zt(this,function(B){switch(B.label){case 0:return this.scrolledElements.forEach(av),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,g=this.clonedReferenceElement,typeof g>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:B.sent(),B.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,iv(l)]:[3,4];case 3:B.sent(),B.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,g)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(sv(document.doctype)+"<html></html>"),ov(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(La(e,2))debugger;if(Ed(e))return this.createCanvasClone(e);if(Ld(e))return this.createVideoClone(e);if(Hd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return $a(t)&&($a(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Dd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ja(e.style,t),t},i.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var A=[].slice.call(t.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),r=e.cloneNode(!1);return r.textContent=A,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},i.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var A=e.ownerDocument.createElement("img");try{return A.src=e.toDataURL(),A}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var l=o.getContextAttributes();l?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},i.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var A=t.getContext("2d");try{return A&&(A.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||A.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},i.prototype.appendChildNode=function(e,t,A){(!Yi(t)||!YC(t)&&!t.hasAttribute(Vd)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Yi(t)||!Hd(t))&&e.appendChild(this.cloneNode(t,A))},i.prototype.cloneChildNodes=function(e,t,A){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(Yi(n)&&Id(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,A)})}else this.appendChildNode(t,n,A)},i.prototype.cloneNode=function(e,t){if(Ud(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Yi(e)&&(Ra(e)||Us(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),o=A.getComputedStyle(e,":after");this.referenceElement===e&&Ra(r)&&(this.clonedReferenceElement=r),Ga(r)&&hv(r);var l=this.counters.parse(new id(this.context,n)),c=this.resolvePseudoContent(e,r,s,$r.BEFORE);Dd(e)&&(t=!0),Ld(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,o,$r.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||Us(e))&&!Md(e)||t)&&Ja(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ss(e)||Es(e))&&(Ss(r)||Es(r))&&(r.value=e.value),r}return e.cloneNode(!1)},i.prototype.resolvePseudoContent=function(e,t,A,r){var n=this;if(A){var s=A.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||A.display==="none")){this.counters.parse(new id(this.context,A));var l=new $y(this.context,A),c=o.createElement("html2canvaspseudoelement");Ja(A,c),l.content.forEach(function(g){if(g.type===0)c.appendChild(o.createTextNode(g.value));else if(g.type===22){var B=o.createElement("img");B.src=g.value,B.style.opacity="1",c.appendChild(B)}else if(g.type===18){if(g.name==="attr"){var v=g.values.filter(wt);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(g.name==="counter"){var b=g.values.filter(Ji),C=b[0],U=b[1];if(C&&wt(C)){var F=n.counters.getCounterValue(C.value),S=U&&wt(U)?Ea.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Gr(F,S,!1)))}}else if(g.name==="counters"){var K=g.values.filter(Ji),C=K[0],G=K[1],U=K[2];if(C&&wt(C)){var M=n.counters.getCounterValues(C.value),W=U&&wt(U)?Ea.parse(n.context,U.value):3,ne=G&&G.type===0?G.value:"",J=M.map(function(re){return Gr(re,W,!1)}).join(ne);c.appendChild(o.createTextNode(J))}}}else if(g.type===20)switch(g.value){case"open-quote":c.appendChild(o.createTextNode(Ad(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Ad(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(g.value))}}),c.className=Za+" "+Ya;var u=r===$r.BEFORE?" "+Za:" "+Ya;return Us(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),$r;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})($r||($r={}));var tv=function(i,e){var t=i.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(Vd,"true"),i.body.appendChild(t),t},Av=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},iv=function(i){return Promise.all([].slice.call(i.images,0).map(Av))},rv=function(i){return new Promise(function(e,t){var A=i.contentWindow;if(!A)return t("No window assigned for iframe");var r=A.document;A.onload=i.onload=function(){A.onload=i.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(i))},50)}})},nv=["all","d","content"],Ja=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);nv.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},sv=function(i){var e="";return i&&(e+="<!DOCTYPE ",i.name&&(e+=i.name),i.internalSubset&&(e+=i.internalSubset),i.publicId&&(e+='"'+i.publicId+'"'),i.systemId&&(e+='"'+i.systemId+'"'),e+=">"),e},ov=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},av=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},lv=":before",cv=":after",Za="___html2canvas___pseudoelement_before",Ya="___html2canvas___pseudoelement_after",Wd=`{
|
|
7
7
|
content: "" !important;
|
|
8
8
|
display: none !important;
|
|
9
|
-
}`,
|
|
10
|
-
.`+$a+tv+kd)},iv=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Nd=(function(){function i(){}return i.getOrigin=function(e){var t=i._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},i.isSameOrigin=function(e){return i.getOrigin(e)===i._origin},i.setContext=function(e){i._link=e.document.createElement("a"),i._origin=i.getOrigin(e.location.href)},i._origin="about:blank",i})(),rv=(function(){function i(e,t){this.context=e,this._options=t,this._cache={}}return i.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(Ja(e)||av(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},i.prototype.match=function(e){return this._cache[e]},i.prototype.loadImage=function(e){return tA(this,void 0,void 0,function(){var t,A,r,n,s=this;return Jt(this,function(o){switch(o.label){case 0:return t=Nd.isSameOrigin(e),A=!Xa(e)&&this._options.useCORS===!0&&Wt.SUPPORT_CORS_IMAGES&&!t,r=!Xa(e)&&!t&&!Ja(e)&&typeof this._options.proxy=="string"&&Wt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Xa(e)&&!Ja(e)&&!r&&!A?[2]:(n=e,r?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,c){var u=new Image;u.onload=function(){return l(u)},u.onerror=c,(lv(n)||A)&&(u.crossOrigin="anonymous"),u.src=n,u.complete===!0&&setTimeout(function(){return l(u)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},i.prototype.has=function(e){return typeof this._cache[e]<"u"},i.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},i.prototype.proxy=function(e){var t=this,A=this._options.proxy;if(!A)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var o=Wt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var m=new FileReader;m.addEventListener("load",function(){return n(m.result)},!1),m.addEventListener("error",function(y){return s(y)},!1),m.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),nv=/^data:image\/svg\+xml/i,sv=/^data:image\/.*;base64,/i,ov=/^data:image\/.*/i,av=function(i){return Wt.SUPPORT_SVG_DRAWING||!cv(i)},Xa=function(i){return ov.test(i)},lv=function(i){return sv.test(i)},Ja=function(i){return i.substr(0,4)==="blob"},cv=function(i){return i.substr(-3).toLowerCase()==="svg"||nv.test(i)},Me=(function(){function i(e,t){this.type=0,this.x=e,this.y=t}return i.prototype.add=function(e,t){return new i(this.x+e,this.y+t)},i})(),ji=function(i,e,t){return new Me(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},Ls=(function(){function i(e,t,A,r){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=r}return i.prototype.subdivide=function(e,t){var A=ji(this.start,this.startControl,e),r=ji(this.startControl,this.endControl,e),n=ji(this.endControl,this.end,e),s=ji(A,r,e),o=ji(r,n,e),l=ji(s,o,e);return t?new i(this.start,A,s,l):new i(l,o,n,this.end)},i.prototype.add=function(e,t){return new i(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},i.prototype.reverse=function(){return new i(this.end,this.endControl,this.startControl,this.start)},i})(),xA=function(i){return i.type===1},hv=(function(){function i(e){var t=e.styles,A=e.bounds,r=Or(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=Or(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=Or(t.borderBottomRightRadius,A.width,A.height),m=u[0],y=u[1],v=Or(t.borderBottomLeftRadius,A.width,A.height),T=v[0],C=v[1],U=[];U.push((n+l)/A.width),U.push((T+m)/A.width),U.push((s+C)/A.height),U.push((c+y)/A.height);var F=Math.max.apply(Math,U);F>1&&(n/=F,s/=F,l/=F,c/=F,m/=F,y/=F,T/=F,C/=F);var E=A.width-l,N=A.height-y,R=A.width-m,M=A.height-C,z=t.borderTopWidth,ne=t.borderRightWidth,$=t.borderBottomWidth,V=t.borderLeftWidth,Ae=vt(t.paddingTop,e.bounds.width),re=vt(t.paddingRight,e.bounds.width),he=vt(t.paddingBottom,e.bounds.width),Z=vt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?Qt(A.left+V/3,A.top+z/3,n-V/3,s-z/3,pt.TOP_LEFT):new Me(A.left+V/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?Qt(A.left+E,A.top+z/3,l-ne/3,c-z/3,pt.TOP_RIGHT):new Me(A.left+A.width-ne/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||y>0?Qt(A.left+R,A.top+N,m-ne/3,y-$/3,pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne/3,A.top+A.height-$/3),this.bottomLeftBorderDoubleOuterBox=T>0||C>0?Qt(A.left+V/3,A.top+M,T-V/3,C-$/3,pt.BOTTOM_LEFT):new Me(A.left+V/3,A.top+A.height-$/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?Qt(A.left+V*2/3,A.top+z*2/3,n-V*2/3,s-z*2/3,pt.TOP_LEFT):new Me(A.left+V*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?Qt(A.left+E,A.top+z*2/3,l-ne*2/3,c-z*2/3,pt.TOP_RIGHT):new Me(A.left+A.width-ne*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||y>0?Qt(A.left+R,A.top+N,m-ne*2/3,y-$*2/3,pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne*2/3,A.top+A.height-$*2/3),this.bottomLeftBorderDoubleInnerBox=T>0||C>0?Qt(A.left+V*2/3,A.top+M,T-V*2/3,C-$*2/3,pt.BOTTOM_LEFT):new Me(A.left+V*2/3,A.top+A.height-$*2/3),this.topLeftBorderStroke=n>0||s>0?Qt(A.left+V/2,A.top+z/2,n-V/2,s-z/2,pt.TOP_LEFT):new Me(A.left+V/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?Qt(A.left+E,A.top+z/2,l-ne/2,c-z/2,pt.TOP_RIGHT):new Me(A.left+A.width-ne/2,A.top+z/2),this.bottomRightBorderStroke=m>0||y>0?Qt(A.left+R,A.top+N,m-ne/2,y-$/2,pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne/2,A.top+A.height-$/2),this.bottomLeftBorderStroke=T>0||C>0?Qt(A.left+V/2,A.top+M,T-V/2,C-$/2,pt.BOTTOM_LEFT):new Me(A.left+V/2,A.top+A.height-$/2),this.topLeftBorderBox=n>0||s>0?Qt(A.left,A.top,n,s,pt.TOP_LEFT):new Me(A.left,A.top),this.topRightBorderBox=l>0||c>0?Qt(A.left+E,A.top,l,c,pt.TOP_RIGHT):new Me(A.left+A.width,A.top),this.bottomRightBorderBox=m>0||y>0?Qt(A.left+R,A.top+N,m,y,pt.BOTTOM_RIGHT):new Me(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=T>0||C>0?Qt(A.left,A.top+M,T,C,pt.BOTTOM_LEFT):new Me(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?Qt(A.left+V,A.top+z,Math.max(0,n-V),Math.max(0,s-z),pt.TOP_LEFT):new Me(A.left+V,A.top+z),this.topRightPaddingBox=l>0||c>0?Qt(A.left+Math.min(E,A.width-ne),A.top+z,E>A.width+ne?0:Math.max(0,l-ne),Math.max(0,c-z),pt.TOP_RIGHT):new Me(A.left+A.width-ne,A.top+z),this.bottomRightPaddingBox=m>0||y>0?Qt(A.left+Math.min(R,A.width-V),A.top+Math.min(N,A.height-$),Math.max(0,m-ne),Math.max(0,y-$),pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne,A.top+A.height-$),this.bottomLeftPaddingBox=T>0||C>0?Qt(A.left+V,A.top+Math.min(M,A.height-$),Math.max(0,T-V),Math.max(0,C-$),pt.BOTTOM_LEFT):new Me(A.left+V,A.top+A.height-$),this.topLeftContentBox=n>0||s>0?Qt(A.left+V+Z,A.top+z+Ae,Math.max(0,n-(V+Z)),Math.max(0,s-(z+Ae)),pt.TOP_LEFT):new Me(A.left+V+Z,A.top+z+Ae),this.topRightContentBox=l>0||c>0?Qt(A.left+Math.min(E,A.width+V+Z),A.top+z+Ae,E>A.width+V+Z?0:l-V+Z,c-(z+Ae),pt.TOP_RIGHT):new Me(A.left+A.width-(ne+re),A.top+z+Ae),this.bottomRightContentBox=m>0||y>0?Qt(A.left+Math.min(R,A.width-(V+Z)),A.top+Math.min(N,A.height+z+Ae),Math.max(0,m-(ne+re)),y-($+he),pt.BOTTOM_RIGHT):new Me(A.left+A.width-(ne+re),A.top+A.height-($+he)),this.bottomLeftContentBox=T>0||C>0?Qt(A.left+V+Z,A.top+M,Math.max(0,T-(V+Z)),C-($+he),pt.BOTTOM_LEFT):new Me(A.left+V+Z,A.top+A.height-($+he))}return i})(),pt;(function(i){i[i.TOP_LEFT=0]="TOP_LEFT",i[i.TOP_RIGHT=1]="TOP_RIGHT",i[i.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",i[i.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(pt||(pt={}));var Qt=function(i,e,t,A,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,l=i+t,c=e+A;switch(r){case pt.TOP_LEFT:return new Ls(new Me(i,c),new Me(i,c-o),new Me(l-s,e),new Me(l,e));case pt.TOP_RIGHT:return new Ls(new Me(i,e),new Me(i+s,e),new Me(l,c-o),new Me(l,c));case pt.BOTTOM_RIGHT:return new Ls(new Me(l,e),new Me(l,e+o),new Me(i+s,c),new Me(i,c));case pt.BOTTOM_LEFT:default:return new Ls(new Me(l,c),new Me(l-s,c),new Me(i,e+o),new Me(i,e))}},Ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},uv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Hs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},dv=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),Is=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),pv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),fv=function(i){return i.type===0},Od=function(i){return i.type===1},gv=function(i){return i.type===2},Kd=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},mv=function(i,e,t,A,r){return i.map(function(n,s){switch(s){case 0:return n.add(e,t);case 1:return n.add(e+A,t);case 2:return n.add(e+A,t+r);case 3:return n.add(e,t+r)}return n})},Vd=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),zd=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new hv(this.container),this.container.styles.opacity<1&&this.effects.push(new pv(this.container.styles.opacity)),this.container.styles.transform!==null){var A=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new dv(A,r,n))}if(this.container.styles.overflowX!==0){var s=Ms(this.curves),o=Hs(this.curves);Kd(s,o)?this.effects.push(new Is(s,6)):(this.effects.push(new Is(s,2)),this.effects.push(new Is(o,4)))}}return i.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,A=this.parent,r=this.effects.slice(0);A;){var n=A.effects.filter(function(l){return!Od(l)});if(t||A.container.styles.position!==0||!A.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(A.container.styles.position)===-1,A.container.styles.overflowX!==0){var s=Ms(A.curves),o=Hs(A.curves);Kd(s,o)||r.unshift(new Is(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return kt(l.target,e)})},i})(),Za=function(i,e,t,A){i.container.elements.forEach(function(r){var n=kt(r.flags,4),s=kt(r.flags,2),o=new zd(r,i);kt(r.styles.display,2048)&&A.push(o);var l=kt(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Vd(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var y=0;c.negativeZIndex.some(function(T,C){return m>T.element.container.styles.zIndex.order?(y=C,!1):y>0}),c.negativeZIndex.splice(y,0,u)}else if(m>0){var v=0;c.positiveZIndex.some(function(T,C){return m>=T.element.container.styles.zIndex.order?(v=C+1,!1):v>0}),c.positiveZIndex.splice(v,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Za(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Za(o,e,t,l);kt(r.flags,8)&&Wd(r,l)})},Wd=function(i,e){for(var t=i instanceof Na?i.start:1,A=i instanceof Na?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof fd&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Gr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},wv=function(i){var e=new zd(i,null),t=new Vd(e),A=[];return Za(e,t,t,A),Wd(e.container,A),t},Rd=function(i,e){switch(e){case 0:return bA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return bA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return bA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return bA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},Bv=function(i,e){switch(e){case 0:return bA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return bA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return bA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return bA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},yv=function(i,e){switch(e){case 0:return bA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return bA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return bA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return bA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},Cv=function(i,e){switch(e){case 0:return Ds(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return Ds(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return Ds(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return Ds(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},Ds=function(i,e){var t=[];return xA(i)?t.push(i.subdivide(.5,!1)):t.push(i),xA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},bA=function(i,e,t,A){var r=[];return xA(i)?r.push(i.subdivide(.5,!1)):r.push(i),xA(t)?r.push(t.subdivide(.5,!0)):r.push(t),xA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),xA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},Gd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},_s=function(i){var e=i.styles,t=i.bounds,A=vt(e.paddingLeft,t.width),r=vt(e.paddingRight,t.width),n=vt(e.paddingTop,t.width),s=vt(e.paddingBottom,t.width);return t.add(A+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},vv=function(i,e){return i===0?e.bounds:i===2?_s(e):Gd(e)},Tv=function(i,e){return i===0?e.bounds:i===2?_s(e):Gd(e)},Ya=function(i,e,t){var A=vv(tr(i.styles.backgroundOrigin,e),i),r=Tv(tr(i.styles.backgroundClip,e),i),n=xv(tr(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=Or(tr(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=bv(tr(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),m=Math.round(A.top+l[1]);return[c,u,m,s,o]},er=function(i){return mt(i)&&i.value===Ji.AUTO},Ps=function(i){return typeof i=="number"},xv=function(i,e,t){var A=e[0],r=e[1],n=e[2],s=i[0],o=i[1];if(!s)return[0,0];if(Pt(s)&&o&&Pt(o))return[vt(s,t.width),vt(o,t.height)];var l=Ps(n);if(mt(s)&&(s.value===Ji.CONTAIN||s.value===Ji.COVER)){if(Ps(n)){var c=t.width/t.height;return c<n!=(s.value===Ji.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=Ps(A),m=Ps(r),y=u||m;if(er(s)&&(!o||er(o))){if(u&&m)return[A,r];if(!l&&!y)return[t.width,t.height];if(y&&l){var v=u?A:r*n,T=m?r:A/n;return[v,T]}var C=u?A:t.width,U=m?r:t.height;return[C,U]}if(l){var F=0,E=0;return Pt(s)?F=vt(s,t.width):Pt(o)&&(E=vt(o,t.height)),er(s)?F=E*n:(!o||er(o))&&(E=F/n),[F,E]}var N=null,R=null;if(Pt(s)?N=vt(s,t.width):o&&Pt(o)&&(R=vt(o,t.height)),N!==null&&(!o||er(o))&&(R=u&&m?N/A*r:t.height),R!==null&&er(s)&&(N=u&&m?R/r*A:t.width),N!==null&&R!==null)return[N,R];throw new Error("Unable to calculate background-size for element")},tr=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},bv=function(i,e,t,A,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(i){case 2:return[new Me(Math.round(A.left),Math.round(A.top+s)),new Me(Math.round(A.left+A.width),Math.round(A.top+s)),new Me(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Me(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Me(Math.round(A.left+n),Math.round(A.top)),new Me(Math.round(A.left+n+o),Math.round(A.top)),new Me(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Me(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Me(Math.round(A.left+n),Math.round(A.top+s)),new Me(Math.round(A.left+n+o),Math.round(A.top+s)),new Me(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Me(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Me(Math.round(r.left),Math.round(r.top)),new Me(Math.round(r.left+r.width),Math.round(r.top)),new Me(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Me(Math.round(r.left),Math.round(r.height+r.top))]}},Qv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",$d="Hidden Text",Fv=(function(){function i(e){this._data={},this._document=e}return i.prototype.parseMetrics=function(e,t){var A=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;A.style.visibility="hidden",A.style.fontFamily=e,A.style.fontSize=t,A.style.margin="0",A.style.padding="0",A.style.whiteSpace="nowrap",s.appendChild(A),r.src=Qv,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode($d)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode($d)),A.style.lineHeight="normal",r.style.verticalAlign="super";var l=r.offsetTop-A.offsetTop+2;return s.removeChild(A),{baseline:o,middle:l}},i.prototype.getMetrics=function(e,t){var A=e+" "+t;return typeof this._data[A]>"u"&&(this._data[A]=this.parseMetrics(e,t)),this._data[A]},i})(),Xd=(function(){function i(e,t){this.context=e,this.options=t}return i})(),Uv=1e4,Sv=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r._activeEffects=[],r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),A.canvas||(r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px"),r.fontMetrics=new Fv(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+A.width+"x"+A.height+") with scale "+A.scale),r}return e.prototype.applyEffects=function(t){for(var A=this;this._activeEffects.length;)this.popEffect();t.forEach(function(r){return A.applyEffect(r)})},e.prototype.applyEffect=function(t){this.ctx.save(),gv(t)&&(this.ctx.globalAlpha=t.opacity),fv(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Od(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return tA(this,void 0,void 0,function(){var A;return Jt(this,function(r){switch(r.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return tA(this,void 0,void 0,function(){return Jt(this,function(A){switch(A.label){case 0:if(kt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return A.sent(),[4,this.renderNodeContent(t)];case 2:A.sent(),A.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,A,r){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=ka(t.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,t.bounds.top+r),o+n.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var A=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=Iv(t.fontFamily).join(", "),n=Nr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,A){return tA(this,void 0,void 0,function(){var r,n,s,o,l,c,u,m,y=this;return Jt(this,function(v){return r=this.createFontStyle(A),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,u=l.middle,m=A.paintOrder,t.textBounds.forEach(function(T){m.forEach(function(C){switch(C){case 0:y.ctx.fillStyle=Ot(A.color),y.renderTextWithLetterSpacing(T,A.letterSpacing,c);var U=A.textShadow;U.length&&T.text.trim().length&&(U.slice(0).reverse().forEach(function(F){y.ctx.shadowColor=Ot(F.color),y.ctx.shadowOffsetX=F.offsetX.number*y.options.scale,y.ctx.shadowOffsetY=F.offsetY.number*y.options.scale,y.ctx.shadowBlur=F.blur.number,y.renderTextWithLetterSpacing(T,A.letterSpacing,c)}),y.ctx.shadowColor="",y.ctx.shadowOffsetX=0,y.ctx.shadowOffsetY=0,y.ctx.shadowBlur=0),A.textDecorationLine.length&&(y.ctx.fillStyle=Ot(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top+c),T.bounds.width,1);break;case 2:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top),T.bounds.width,1);break;case 3:y.ctx.fillRect(T.bounds.left,Math.ceil(T.bounds.top+u),T.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&T.text.trim().length&&(y.ctx.strokeStyle=Ot(A.webkitTextStrokeColor),y.ctx.lineWidth=A.webkitTextStrokeWidth,y.ctx.lineJoin=window.chrome?"miter":"round",y.ctx.strokeText(T.text,T.bounds.left,T.bounds.top+c)),y.ctx.strokeStyle="",y.ctx.lineWidth=0,y.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=_s(t),s=Hs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,E,E,c,u,m,y,R,v,T,M,C,U,F,E,N,R,M;return Jt(this,function(z){switch(z.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,r=t.curves,n=A.styles,s=0,o=A.textNodes,z.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,n)]):[3,4];case 2:z.sent(),z.label=3;case 3:return s++,[3,1];case 4:if(!(A instanceof ud))return[3,8];z.label=5;case 5:return z.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof dd&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof pd))return[3,12];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,12];case 11:return z.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof Bd&&A.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:A.backgroundColor,x:0,y:0,width:A.width,height:A.height}),[4,c.render(A.tree)]):[3,14];case 13:u=z.sent(),A.width&&A.height&&this.ctx.drawImage(u,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),z.label=14;case 14:if(A instanceof Oa&&(m=Math.min(A.bounds.width,A.bounds.height),A.type===bs?A.checked&&(this.ctx.save(),this.path([new Me(A.bounds.left+m*.39363,A.bounds.top+m*.79),new Me(A.bounds.left+m*.16,A.bounds.top+m*.5549),new Me(A.bounds.left+m*.27347,A.bounds.top+m*.44071),new Me(A.bounds.left+m*.39694,A.bounds.top+m*.5649),new Me(A.bounds.left+m*.72983,A.bounds.top+m*.23),new Me(A.bounds.left+m*.84,A.bounds.top+m*.34085),new Me(A.bounds.left+m*.39363,A.bounds.top+m*.79)]),this.ctx.fillStyle=Ot(gd),this.ctx.fill(),this.ctx.restore()):A.type===Qs&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+m/2,A.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ot(gd),this.ctx.fill(),this.ctx.restore())),Ev(A)&&A.value.length){switch(y=this.createFontStyle(n),R=y[0],v=y[1],T=this.fontMetrics.getMetrics(R,v).baseline,this.ctx.font=R,this.ctx.fillStyle=Ot(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Mv(A.styles.textAlign),M=_s(A),C=0,A.styles.textAlign){case 1:C+=M.width/2;break;case 2:C+=M.width;break}U=M.add(C,0,0,-M.height/2+1),this.ctx.save(),this.path([new Me(M.left,M.top),new Me(M.left+M.width,M.top),new Me(M.left+M.width,M.top+M.height),new Me(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Wr(A.value,U),n.letterSpacing,T),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!kt(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(F=A.styles.listStyleImage,F.type!==0)return[3,18];E=void 0,N=F.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return E=z.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.bounds.top),[3,18];case 17:return z.sent(),this.context.logger.error("Error loading list-style-image "+N),[3,18];case 18:return[3,20];case 19:t.listValue&&A.styles.listStyleType!==-1&&(R=this.createFontStyle(n)[0],this.ctx.font=R,this.ctx.fillStyle=Ot(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new jA(A.bounds.left,A.bounds.top+vt(A.styles.paddingTop,A.bounds.width),A.bounds.width,$u(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Wr(t.listValue,M),n.letterSpacing,$u(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),z.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return tA(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,m,y,F,v,T,F,C,U,F;return Jt(this,function(E){switch(E.label){case 0:if(kt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:E.sent(),A=0,r=t.negativeZIndex,E.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:E.sent(),E.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:E.sent(),n=0,s=t.nonInlineLevel,E.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:E.sent(),E.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,E.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,E.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:m=0,y=t.inlineLevel,E.label=19;case 19:return m<y.length?(F=y[m],[4,this.renderNode(F)]):[3,22];case 20:E.sent(),E.label=21;case 21:return m++,[3,19];case 22:v=0,T=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return v<T.length?(F=T[v],[4,this.renderStack(F)]):[3,26];case 24:E.sent(),E.label=25;case 25:return v++,[3,23];case 26:C=0,U=t.positiveZIndex,E.label=27;case 27:return C<U.length?(F=U[C],[4,this.renderStack(F)]):[3,30];case 28:E.sent(),E.label=29;case 29:return C++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var A=this;t.forEach(function(r,n){var s=xA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),xA(r)&&A.ctx.bezierCurveTo(r.startControl.x,r.startControl.y,r.endControl.x,r.endControl.y,r.end.x,r.end.y)})},e.prototype.renderRepeat=function(t,A,r,n){this.path(t),this.ctx.fillStyle=A,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,A,r){var n;if(t.width===A&&t.height===r)return t;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,A),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,A,r),o},e.prototype.renderBackgroundImage=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l;return Jt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var m,y,v,Ae,ce,se,Z,te,$,T,Ae,ce,se,Z,te,C,U,F,E,N,R,M,z,ne,$,V,Ae,re,he,Z,te,ae,ce,se,le,pe,Be,Fe,Ue,ye,Te,ve;return Jt(this,function(be){switch(be.label){case 0:if(u.type!==0)return[3,5];m=void 0,y=u.url,be.label=1;case 1:return be.trys.push([1,3,,4]),[4,n.context.cache.match(y)];case 2:return m=be.sent(),[3,4];case 3:return be.sent(),n.context.logger.error("Error loading background-image "+y),[3,4];case 4:return m&&(v=Ya(t,A,[m.width,m.height,m.width/m.height]),Ae=v[0],ce=v[1],se=v[2],Z=v[3],te=v[4],$=n.ctx.createPattern(n.resizeImage(m,Z,te),"repeat"),n.renderRepeat(Ae,$,ce,se)),[3,6];case 5:f2(u)?(T=Ya(t,A,[null,null,null]),Ae=T[0],ce=T[1],se=T[2],Z=T[3],te=T[4],C=c2(u.angle,Z,te),U=C[0],F=C[1],E=C[2],N=C[3],R=C[4],M=document.createElement("canvas"),M.width=Z,M.height=te,z=M.getContext("2d"),ne=z.createLinearGradient(F,N,E,R),_u(u.stops,U).forEach(function(Le){return ne.addColorStop(Le.stop,Ot(Le.color))}),z.fillStyle=ne,z.fillRect(0,0,Z,te),Z>0&&te>0&&($=n.ctx.createPattern(M,"repeat"),n.renderRepeat(Ae,$,ce,se))):g2(u)&&(V=Ya(t,A,[null,null,null]),Ae=V[0],re=V[1],he=V[2],Z=V[3],te=V[4],ae=u.position.length===0?[Ta]:u.position,ce=vt(ae[0],Z),se=vt(ae[ae.length-1],te),le=h2(u,ce,se,Z,te),pe=le[0],Be=le[1],pe>0&&Be>0&&(Fe=n.ctx.createRadialGradient(re+ce,he+se,0,re+ce,he+se,pe),_u(u.stops,pe*2).forEach(function(Le){return Fe.addColorStop(Le.stop,Ot(Le.color))}),n.path(Ae),n.ctx.fillStyle=Fe,pe!==Be?(Ue=t.bounds.left+.5*t.bounds.width,ye=t.bounds.top+.5*t.bounds.height,Te=Be/pe,ve=1/Te,n.ctx.save(),n.ctx.translate(Ue,ye),n.ctx.transform(1,0,0,Te,0,0),n.ctx.translate(-Ue,-ye),n.ctx.fillRect(re,ve*(he-ye)+ye,Z,te*ve),n.ctx.restore()):n.ctx.fill())),be.label=6;case 6:return A--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,A,r){return tA(this,void 0,void 0,function(){return Jt(this,function(n){return this.path(Rd(r,A)),this.ctx.fillStyle=Ot(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return tA(this,void 0,void 0,function(){var s,o;return Jt(this,function(l){switch(l.label){case 0:return A<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=Bv(n,r),this.path(s),this.ctx.fillStyle=Ot(t),this.ctx.fill(),o=yv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,m=this;return Jt(this,function(y){switch(y.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!ui(A.backgroundColor)||A.backgroundImage.length,n=[{style:A.borderTopStyle,color:A.borderTopColor,width:A.borderTopWidth},{style:A.borderRightStyle,color:A.borderRightColor,width:A.borderRightWidth},{style:A.borderBottomStyle,color:A.borderBottomColor,width:A.borderBottomWidth},{style:A.borderLeftStyle,color:A.borderLeftColor,width:A.borderLeftWidth}],s=Lv(tr(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),ui(A.backgroundColor)||(this.ctx.fillStyle=Ot(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:y.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){m.ctx.save();var T=Ms(t.curves),C=v.inset?0:Uv,U=mv(T,-C+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(m.path(T),m.ctx.clip(),m.mask(U)):(m.mask(T),m.ctx.clip(),m.path(U)),m.ctx.shadowOffsetX=v.offsetX.number+C,m.ctx.shadowOffsetY=v.offsetY.number,m.ctx.shadowColor=Ot(v.color),m.ctx.shadowBlur=v.blur.number,m.ctx.fillStyle=v.inset?Ot(v.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),y.label=2;case 2:o=0,l=0,c=n,y.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!ui(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return y.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return y.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return y.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:y.sent(),y.label=11;case 11:o++,y.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return tA(this,void 0,void 0,function(){var o,l,c,u,m,y,v,T,C,U,F,E,N,R,M,z,M,z;return Jt(this,function(ne){return this.ctx.save(),o=Cv(n,r),l=Rd(n,r),s===2&&(this.path(l),this.ctx.clip()),xA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),xA(l[1])?(m=l[1].end.x,y=l[1].end.y):(m=l[1].x,y=l[1].y),r===0||r===2?v=Math.abs(c-m):v=Math.abs(u-y),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),T=A<3?A*3:A*2,C=A<3?A*2:A,s===3&&(T=A,C=A),U=!0,v<=T*2?U=!1:v<=T*2+C?(F=v/(2*T+C),T*=F,C*=F):(E=Math.floor((v+C)/(T+C)),N=(v-E*T)/(E-1),R=(v-(E+1)*T)/E,C=R<=0||Math.abs(C-N)<Math.abs(C-R)?N:R),U&&(s===3?this.ctx.setLineDash([0,T+C]):this.ctx.setLineDash([T,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=Ot(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(xA(l[0])&&(M=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Me(M.end.x,M.end.y),new Me(z.start.x,z.start.y)]),this.ctx.stroke()),xA(l[1])&&(M=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Me(M.end.x,M.end.y),new Me(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A;return Jt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ot(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=wv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Xd),Ev=function(i){return i instanceof wd||i instanceof md?!0:i instanceof Oa&&i.type!==Qs&&i.type!==bs},Lv=function(i,e){switch(i){case 0:return Ms(e);case 2:return uv(e);default:return Hs(e)}},Mv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},Hv=["-apple-system","system-ui"],Iv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return Hv.indexOf(e)===-1}):i},Dv=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=A,r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale),r}return e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A,r;return Jt(this,function(n){switch(n.label){case 0:return A=Pa(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,_v(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ot(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(Xd),_v=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Pv=(function(){function i(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return i.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.getTime=function(){return Date.now()-this.start},i.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Rn([this.id,this.getTime()+"ms"],e))},i.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),kv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Pv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new rv(this,e)}return i.instanceCount=1,i})(),Nv=function(i,e){return e===void 0&&(e={}),Ov(i,e)};typeof window<"u"&&Nd.setContext(window);var Ov=function(i,e){return tA(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,m,y,v,T,C,U,F,E,N,R,M,ne,z,ne,$,V,Ae,re,he,Z,te,ae,ce,se,le,pe,Be,Fe,Ue,ye,Te;return Jt(this,function(ve){switch(ve.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:($=e.allowTaint)!==null&&$!==void 0?$:!1,imageTimeout:(V=e.imageTimeout)!==null&&V!==void 0?V:15e3,proxy:e.proxy,useCORS:(Ae=e.useCORS)!==null&&Ae!==void 0?Ae:!1},n=Aa({logging:(re=e.logging)!==null&&re!==void 0?re:!0,cache:e.cache},r),s={windowWidth:(he=e.windowWidth)!==null&&he!==void 0?he:A.innerWidth,windowHeight:(Z=e.windowHeight)!==null&&Z!==void 0?Z:A.innerHeight,scrollX:(te=e.scrollX)!==null&&te!==void 0?te:A.pageXOffset,scrollY:(ae=e.scrollY)!==null&&ae!==void 0?ae:A.pageYOffset},o=new jA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new kv(n,o),c=(ce=e.foreignObjectRendering)!==null&&ce!==void 0?ce:!1,u={allowTaint:(se=e.allowTaint)!==null&&se!==void 0?se:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),m=new Pd(l,i,u),y=m.clonedReferenceElement,y?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=ve.sent(),T=Va(y)||KC(y)?mw(y.ownerDocument):Gn(l,y),C=T.width,U=T.height,F=T.left,E=T.top,N=Kv(l,y,e.backgroundColor),R={canvas:e.canvas,backgroundColor:N,scale:(pe=(le=e.scale)!==null&&le!==void 0?le:A.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((Be=e.x)!==null&&Be!==void 0?Be:0)+F,y:((Fe=e.y)!==null&&Fe!==void 0?Fe:0)+E,width:(Ue=e.width)!==null&&Ue!==void 0?Ue:Math.ceil(C),height:(ye=e.height)!==null&&ye!==void 0?ye:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),ne=new Dv(l,R),[4,ne.render(y)]):[3,3];case 2:return M=ve.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+E+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=Cd(l,y),N===z.styles.backgroundColor&&(z.styles.backgroundColor=ti.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),ne=new Sv(l,R),[4,ne.render(z)];case 4:M=ve.sent(),ve.label=5;case 5:return(!((Te=e.removeContainer)!==null&&Te!==void 0)||Te)&&(Pd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Kv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Kr(i,getComputedStyle(A.documentElement).backgroundColor):ti.TRANSPARENT,n=A.body?Kr(i,getComputedStyle(A.body).backgroundColor):ti.TRANSPARENT,s=typeof t=="string"?Kr(i,t):t===null?ti.TRANSPARENT:4294967295;return e===A.documentElement?ui(r)?ui(n)?s:n:r:s};const Vv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class zv{constructor(e,t,A="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=r,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=o.context,c=n._chart,u=n._series;if(!c||!u)return;const m=u.priceToCoordinate(n.price);if(m==null)return;const y=Math.round(m*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),T=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(T>=C)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(T,y),l.lineTo(C,y),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(T,y,U,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Jd{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!A.visible||!A.text||!A._series)return;const c=A._series.priceToCoordinate(A.price);if(c==null)return;const u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),y=Math.round(14*l),v=s.width;let T;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);T=F!=null?Math.round(F*o):m,n.textAlign="right"}else T=m,n.textAlign="left";else A.hAlign==="right"?(T=v-m,n.textAlign="right"):(T=v/2,n.textAlign="center");const C=Math.round(c*l);let U;A.vAlign==="top"?U=C-y:A.vAlign==="bottom"?U=C+y:U=C,n.fillStyle=A.textColor,n.fillText(A.text,T,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Wv{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),N=Math.round(T*m),R=Math.round(U*y),M=l.context;if(M.save(),M.beginPath(),M.strokeStyle=s.color,M.lineWidth=s.lineWidth*y,M.setLineDash([]),M.moveTo(F,E),M.lineTo(N,R),M.stroke(),M.beginPath(),M.fillStyle=s.color,M.arc(F,E,3*y,0,Math.PI*2),M.fill(),M.beginPath(),M.arc(N,R,3*y,0,Math.PI*2),M.fill(),!s.statsShowAlways&&!s.isActive){M.restore();return}const{priceDiff:z,pricePct:ne,bars:$,days:V,angle:Ae}=s.info,re=z>=0?"+":"",he=[];if(s.statsPriceRange!==!1&&he.push(`${re}${z.toFixed(5)} (${re}${ne.toFixed(2)}%)`),s.statsBarsRange!==!1&&he.push(`${$} bars`),s.statsDateRange!==!1&&he.push(`${V} days`),s.statsAngle!==!1&&he.push(`∠ ${Ae.toFixed(1)}°`),s.statsDistance&&he.push(`Δ ${Math.abs(z).toFixed(5)}`),he.length===0){M.restore();return}const Z=Math.round(11*y);M.font=`${Z}px sans-serif`;const te=Z*1.6,ae=8*y,ce=Math.max(...he.map(Re=>M.measureText(Re).width))+ae*2,se=he.length*te+ae*2,le=s.statsPosition??"right";let pe,Be;le==="left"?(pe=F,Be=E):le==="center"?(pe=Math.round((F+N)/2),Be=Math.round((E+R)/2)):(pe=N,Be=R);let Fe,Ue;le==="left"?(Fe=pe-ce-10*m,Ue=Be-se-4*y):le==="center"?(Fe=pe-ce/2,Ue=Be-se-8*y):(Fe=pe+10*m,Ue=Be-se-4*y);const ye=l.bitmapSize.width,Te=l.bitmapSize.height,ve=Math.min(Math.max(0,Fe),ye-ce-4*m),be=Math.min(Math.max(4*y,Ue),Te-se-4*y),Le=4*y;M.beginPath(),M.moveTo(ve+Le,be),M.lineTo(ve+ce-Le,be),M.quadraticCurveTo(ve+ce,be,ve+ce,be+Le),M.lineTo(ve+ce,be+se-Le),M.quadraticCurveTo(ve+ce,be+se,ve+ce-Le,be+se),M.lineTo(ve+Le,be+se),M.quadraticCurveTo(ve,be+se,ve,be+se-Le),M.lineTo(ve,be+Le),M.quadraticCurveTo(ve,be,ve+Le,be),M.closePath(),M.fillStyle="rgba(30, 41, 59, 0.92)",M.fill(),M.strokeStyle=s.statsColor||s.color,M.lineWidth=1*y,M.stroke(),M.fillStyle="#e2e8f0",M.textAlign="left",he.forEach((Re,Ke)=>{M.fillText(Re,ve+ae,be+ae+Z+Ke*te)}),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Zd{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),N=Math.round(T*m),R=Math.round(U*y),M=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,N),Math.min(E,R),Math.abs(N-F),Math.abs(R-E)),z.strokeStyle=M,z.lineWidth=1*y,z.setLineDash([]),z.strokeRect(Math.min(F,N),Math.min(E,R),Math.abs(N-F),Math.abs(R-E))),z.beginPath(),z.strokeStyle=M,z.lineWidth=2*y,z.moveTo(F,E),z.lineTo(N,R),z.stroke(),z.fillStyle=M,z.beginPath(),z.arc(F,E,3*y,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(N,R,3*y,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:ne,pricePct:$,bars:V,days:Ae}=s.info,re=ne>=0?"+":"",he=[];if(s.statsPriceRange&&he.push(re+ne.toFixed(5)+" ("+re+$.toFixed(2)+"%)"),s.statsBarsRange&&he.push(V+" bars"),s.statsDateRange&&he.push(Ae+" days"),he.length===0){z.restore();return}const Z=Math.round(11*y);z.font=Z+"px sans-serif";const te=Z*1.6,ae=8*y,ce=Math.max(...he.map(ve=>z.measureText(ve).width))+ae*2,se=he.length*te+ae*2,le=l.bitmapSize.width,pe=l.bitmapSize.height;let Be,Fe;if(s.statsPosition==="left")Be=F-ce-10*m,Fe=E-se-4*y;else if(s.statsPosition==="center"){const ve=(F+N)/2,be=(E+R)/2;Be=ve-ce/2,Fe=be-se-4*y}else Be=N+10*m,Fe=R-se-4*y;const Ue=Math.min(Math.max(0,Be),le-ce-4*m),ye=Math.min(Math.max(4*y,Fe),pe-se-4*y),Te=4*y;z.beginPath(),z.moveTo(Ue+Te,ye),z.lineTo(Ue+ce-Te,ye),z.quadraticCurveTo(Ue+ce,ye,Ue+ce,ye+Te),z.lineTo(Ue+ce,ye+se-Te),z.quadraticCurveTo(Ue+ce,ye+se,Ue+ce-Te,ye+se),z.lineTo(Ue+Te,ye+se),z.quadraticCurveTo(Ue,ye+se,Ue,ye+se-Te),z.lineTo(Ue,ye+Te),z.quadraticCurveTo(Ue,ye,Ue+Te,ye),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||M,z.lineWidth=1*y,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",he.forEach((ve,be)=>{z.fillText(ve,Ue+ae,ye+ae+Z+be*te)}),z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Rv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.fillColor=A.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.min(m,y)*c,U=Math.max(m,y)*c,F=Math.min(v,T)*u,E=Math.max(v,T)*u,N=U-C,R=E-F;if(N<.5||R<.5)return;const M=s.context;M.save(),M.fillStyle=r.fillColor,M.fillRect(C,F,N,R),M.strokeStyle=r.strokeColor,M.lineWidth=r.lineWidth*u,M.setLineDash([]),M.strokeRect(C,F,N,R),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Gv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,N=Math.hypot(F-C,E-U);if(N<.5)return;const R=s.context;R.save(),R.strokeStyle=r.strokeColor,R.lineWidth=r.lineWidth*u,R.setLineDash([]),R.beginPath(),R.arc(C,U,N,0,Math.PI*2),R.stroke(),R.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class $v{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,c=n._series;if(!l||!c)return;const u=o.horizontalPixelRatio,m=o.verticalPixelRatio,y=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),T=l.timeScale().timeToCoordinate(n.p2.rawTime),C=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*u,N=v*m,R=T*u,M=C*m,z=U*u,ne=F*m,$=o.context;$.save(),$.beginPath(),$.moveTo(E,N),$.lineTo(R,M),$.lineTo(z,ne),$.closePath(),$.fillStyle=n.fillColor,$.fill(),$.strokeStyle=n.strokeColor,$.lineWidth=n.lineWidth*m,$.setLineDash([]),$.stroke(),$.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Xv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.minorRatio=A.minorRatio??.45,this.previewAsLine=A.previewAsLine??!1,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,N=F-C,R=E-U,M=Math.hypot(N,R);if(M<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*u,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(C,U),z.lineTo(F,E),z.stroke();else{const ne=(C+F)/2,$=(U+E)/2,V=Math.atan2(R,N),Ae=M/2,re=Math.max(1,Ae*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(ne,$,Ae,re,V,0,Math.PI*2),z.stroke()}z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Yd{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#f59e0b",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight!==!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const he=U+z*(0-C);M.beginPath(),M.moveTo(0,he),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const ne=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(ne-V),he=E-$*Math.sin(ne-V),Z=F-$*Math.cos(ne+V),te=E-$*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Z,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),te=C-$*Math.cos(re+V),ae=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(he,Z),M.lineTo(te,ae),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,Z=r.p1.price,te=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(te-Z),le=Z!==0?Math.abs((te-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;ae.push("↕ "+se.toFixed(pe)+" ("+le.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),le=o.timeScale().timeToCoordinate(he);if(se!=null&&le!=null){const pe=o.timeScale().coordinateToLogical(se),Be=o.timeScale().coordinateToLogical(le);pe!=null&&Be!=null&&ce.push("↔ "+Math.abs(Math.round(Be-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),Be=Math.floor(se%3600/60);let Fe=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(Fe+=(Fe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(Fe=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=N/c,le=R/u;ce.push("distance: "+Math.sqrt(se*se+le*le).toFixed(2))}if(ce.length>0&&ae.push(ce.join(", ")),r.statsAngle){const se=N/c,le=R/u,pe=Math.atan2(le,se)*180/Math.PI;ae.push("∠ "+pe.toFixed(0)+"°")}if(ae.length>0){const se=Math.min(c,u),le=11*se,pe=le*1.5,Be=5*se;M.font=le+"px sans-serif";const Ue=ae.reduce((Ce,de)=>Math.max(Ce,M.measureText(de).width),0)+Be*2,ye=ae.length*pe+Be*2,[Te,ve,be,Le]=C<=F?[C,U,F,E]:[F,E,C,U];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=ve):r.statsPosition==="center"?(Re=(Te+be)/2,Ke=(ve+Le)/2):(Re=be,Ke=Le);const xe=Re-Ue/2,De=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(xe,De,Ue,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(xe,De,Ue,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((Ce,de)=>{M.fillText(Ce,xe+Be,De+Be+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Jv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const he=U+z*(0-C);M.beginPath(),M.moveTo(0,he),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const ne=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(ne-V),he=E-$*Math.sin(ne-V),Z=F-$*Math.cos(ne+V),te=E-$*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Z,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),te=C-$*Math.cos(re+V),ae=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(he,Z),M.lineTo(te,ae),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,Z=r.p1.price,te=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(te-Z),le=Z!==0?Math.abs((te-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;ae.push("↕ "+se.toFixed(pe)+" ("+le.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),le=o.timeScale().timeToCoordinate(he);if(se!=null&&le!=null){const pe=o.timeScale().coordinateToLogical(se),Be=o.timeScale().coordinateToLogical(le);pe!=null&&Be!=null&&ce.push("↔ "+Math.abs(Math.round(Be-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),Be=Math.floor(se%3600/60);let Fe=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(Fe+=(Fe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(Fe=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=N/c,le=R/u;ce.push("distance: "+Math.sqrt(se*se+le*le).toFixed(2))}if(ce.length>0&&ae.push(ce.join(", ")),r.statsAngle){const se=N/c,le=R/u,pe=Math.atan2(le,se)*180/Math.PI;ae.push("∠ "+pe.toFixed(0)+"°")}if(ae.length>0){const se=Math.min(c,u),le=11*se,pe=le*1.5,Be=5*se;M.font=le+"px sans-serif";const Ue=ae.reduce((Ce,de)=>Math.max(Ce,M.measureText(de).width),0)+Be*2,ye=ae.length*pe+Be*2,[Te,ve,be,Le]=C<=F?[C,U,F,E]:[F,E,C,U];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=ve):r.statsPosition==="center"?(Re=(Te+be)/2,Ke=(ve+Le)/2):(Re=be,Ke=Le);const xe=Re-Ue/2,De=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(xe,De,Ue,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(xe,De,Ue,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((Ce,de)=>{M.fillText(Ce,xe+Be,De+Be+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Zv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft!==!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const he=U+z*(0-C);M.beginPath(),M.moveTo(0,he),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const ne=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(ne-V),he=E-$*Math.sin(ne-V),Z=F-$*Math.cos(ne+V),te=E-$*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Z,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),te=C-$*Math.cos(re+V),ae=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(he,Z),M.lineTo(te,ae),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,Z=r.p1.price,te=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(te-Z),le=Z!==0?Math.abs((te-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;ae.push("↕ "+se.toFixed(pe)+" ("+le.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),le=o.timeScale().timeToCoordinate(he);if(se!=null&&le!=null){const pe=o.timeScale().coordinateToLogical(se),Be=o.timeScale().coordinateToLogical(le);pe!=null&&Be!=null&&ce.push("↔ "+Math.abs(Math.round(Be-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),Be=Math.floor(se%3600/60);let Fe=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(Fe+=(Fe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(Fe=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=N/c,le=R/u;ce.push("distance: "+Math.sqrt(se*se+le*le).toFixed(2))}if(ce.length>0&&ae.push(ce.join(", ")),r.statsAngle){const se=N/c,le=R/u,pe=Math.atan2(le,se)*180/Math.PI;ae.push("∠ "+pe.toFixed(0)+"°")}if(ae.length>0){const se=Math.min(c,u),le=11*se,pe=le*1.5,Be=5*se;M.font=le+"px sans-serif";const Ue=ae.reduce((Ce,de)=>Math.max(Ce,M.measureText(de).width),0)+Be*2,ye=ae.length*pe+Be*2,[Te,ve,be,Le]=C<=F?[C,U,F,E]:[F,E,C,U];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=ve):r.statsPosition==="center"?(Re=(Te+be)/2,Ke=(ve+Le)/2):(Re=be,Ke=Le);const xe=Re-Ue/2,De=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(xe,De,Ue,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(xe,De,Ue,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((Ce,de)=>{M.fillText(Ce,xe+Be,De+Be+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Yv{constructor(e,t,A="#22c55e",r=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const u=n._chart,m=n._series;if(!u||!m)return;const y=o.horizontalPixelRatio,v=o.verticalPixelRatio,T=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),C=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=m.priceToCoordinate(n.p1.price),F=m.priceToCoordinate(n.p2.price);if(T==null||C==null||U==null||F==null)return;const E=T*y,N=U*v,R=C*y,M=F*v,[z,ne,$,V]=E<=R?[E,N,R,M]:[R,M,E,N];let Ae=$-z,re=V-ne;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,Z=o.context;if(Z.save(),Z.strokeStyle=n.color,Z.fillStyle=n.color,Z.lineWidth=n.lineWidth*v,Z.setLineDash([]),n.rayLeft){const le=ne+he*(0-z);Z.beginPath(),Z.moveTo(0,le),Z.lineTo(z,ne),Z.stroke()}if(n.rayRight){const se=o.bitmapSize.width,le=V+he*(se-$);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,le),Z.stroke()}const te=Math.atan2(re,Ae),ae=(n.lineWidth*4+4)*v,ce=Math.PI/7;if(n.arrowRight){const se=$-ae*Math.cos(te-ce),le=V-ae*Math.sin(te-ce),pe=$-ae*Math.cos(te+ce),Be=V-ae*Math.sin(te+ce);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,le),Z.lineTo(pe,Be),Z.closePath(),Z.fill()}if(n.arrowLeft){const se=te+Math.PI,le=z-ae*Math.cos(se-ce),pe=ne-ae*Math.sin(se-ce),Be=z-ae*Math.cos(se+ce),Fe=ne-ae*Math.sin(se+ce);Z.beginPath(),Z.moveTo(z,ne),Z.lineTo(le,pe),Z.lineTo(Be,Fe),Z.closePath(),Z.fill()}if(c){const se=n.p1.rawTime??n.p1.time,le=n.p2.rawTime??n.p2.time,pe=n.p1.price,Be=n.p2.price,Fe=[];if(n.statsPriceRange){const ye=Math.abs(Be-pe),Te=pe!==0?Math.abs((Be-pe)/pe*100):0,ve=ye<1e-4?6:ye<.01?5:ye<1?4:2;Fe.push("↕ "+ye.toFixed(ve)+" ("+Te.toFixed(2)+"%)")}const Ue=[];if(n.statsBarsRange)try{const ye=u.timeScale().timeToCoordinate(se),Te=u.timeScale().timeToCoordinate(le);if(ye!=null&&Te!=null){const ve=u.timeScale().coordinateToLogical(ye),be=u.timeScale().coordinateToLogical(Te);ve!=null&&be!=null&&Ue.push("↔ "+Math.abs(Math.round(be-ve))+" bars")}}catch{}if(n.statsDateRange){const ye=Math.abs(le-se),Te=Math.floor(ye/86400),ve=Math.floor(ye%86400/3600),be=Math.floor(ye%3600/60);let Le=Te>0?Te+" day"+(Te!==1?"s":""):"";ve>0&&(Le+=(Le?" ":"")+ve+" hour"+(ve!==1?"s":"")),!Te&&!ve&&(Le=be+" min"+(be!==1?"s":"")),n.statsBarsRange&&Ue.length>0?Ue[Ue.length-1]+=" ("+Le+")":Ue.push(Le)}if(n.statsDistance){const ye=(R-E)/y,Te=(M-N)/v;Ue.push("distance: "+Math.sqrt(ye*ye+Te*Te).toFixed(2))}if(Ue.length>0&&Fe.push(Ue.join(", ")),n.statsAngle){const ye=Ae/y,Te=re/v,ve=Math.atan2(Te,ye)*180/Math.PI;Fe.push("∠ "+ve.toFixed(0)+"°")}if(Fe.length>0){const ye=Math.min(y,v),Te=11*ye,ve=Te*1.5,be=5*ye;Z.font=Te+"px sans-serif";const Re=Fe.reduce((_e,et)=>Math.max(_e,Z.measureText(et).width),0)+be*2,Ke=Fe.length*ve+be*2;let xe,De;n.statsPosition==="left"?(xe=z,De=ne):n.statsPosition==="center"?(xe=(z+$)/2,De=(ne+V)/2):(xe=$,De=V);const Ce=xe-Re/2,de=De-Ke-12*ye;Z.fillStyle="rgba(20, 20, 30, 0.72)",Z.fillRect(Ce,de,Re,Ke),Z.strokeStyle=n.statsColor,Z.lineWidth=1*ye,Z.strokeRect(Ce,de,Re,Ke),Z.fillStyle=n.statsColor,Z.textBaseline="top",Z.textAlign="left",Fe.forEach((_e,et)=>{Z.fillText(_e,Ce+be,de+be+et*ve)})}}Z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class qv{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=s.timeScale().timeToCoordinate(A.center.rawTime),m=o.priceToCoordinate(A.center.price);if(u==null||m==null)return;const y=Math.round(u*l),v=Math.round(m*c),T=n.bitmapSize.width,C=n.bitmapSize.height,U=n.context;if(U.save(),U.strokeStyle=A.color,U.lineWidth=A.lineWidth*c,U.setLineDash([]),U.beginPath(),U.moveTo(0,v),U.lineTo(T,v),U.stroke(),U.beginPath(),U.moveTo(y,0),U.lineTo(y,C),U.stroke(),A.showPrice){const F=A.center.price.toFixed(5),E=Math.round(11*c);U.font=E+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="left";const N=U.measureText(F).width,R=Math.round(6*l),M=Math.round(3*c),z=E+2*M,ne=N+2*R,$=T-ne-Math.round(2*l),V=v-z/2;U.fillStyle=A.color,U.fillRect($,V,ne,z),U.fillStyle="#ffffff",U.fillText(F,$+R,v)}if(A.showTime){const F=A.center.rawTime,E=new Date(F*1e3),N=Z=>String(Z).padStart(2,"0"),R=N(E.getUTCDate())+"."+N(E.getUTCMonth()+1)+"."+E.getUTCFullYear()+" "+N(E.getUTCHours())+":"+N(E.getUTCMinutes())+":"+N(E.getUTCSeconds()),M=Math.round(11*c);U.font=M+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const z=U.measureText(R).width,ne=Math.round(6*l),$=Math.round(3*c),V=M+2*$,Ae=z+2*ne,re=y-Ae/2,he=C-V-Math.round(4*c);U.fillStyle=A.color,U.fillRect(re,he,Ae,V),U.fillStyle="#ffffff",U.fillText(R,y,he+V/2)}U.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class jv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=v*u,F=y*c,E=T*u,N=C-F,R=U-E,M=F-C,z=E-U;if(Math.hypot(N,R)<1e-4)return;const $=Math.atan2(R,N),V=Math.round(Math.abs($*180/Math.PI)),Ae=s.context;Ae.save(),Ae.strokeStyle=r.color,Ae.fillStyle=r.color,Ae.lineWidth=r.lineWidth*u,Ae.setLineDash([]);const re=Math.abs(M)<1e-4?0:z/M;if(r.rayLeft){const Be=U+re*(0-C);Ae.beginPath(),Ae.moveTo(0,Be),Ae.lineTo(C,U),Ae.stroke()}if(r.rayRight){const pe=s.bitmapSize.width,Be=E+re*(pe-F);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(pe,Be),Ae.stroke()}Ae.beginPath(),Ae.moveTo(C,U),Ae.lineTo(F,E),Ae.stroke();const he=Math.atan2(z,M),Z=(r.lineWidth*4+4)*u,te=Math.PI/7;if(r.arrowRight){const pe=F-Z*Math.cos(he-te),Be=E-Z*Math.sin(he-te),Fe=F-Z*Math.cos(he+te),Ue=E-Z*Math.sin(he+te);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(pe,Be),Ae.lineTo(Fe,Ue),Ae.closePath(),Ae.fill()}if(r.arrowLeft){const pe=he+Math.PI,Be=C-Z*Math.cos(pe-te),Fe=U-Z*Math.sin(pe-te),Ue=C-Z*Math.cos(pe+te),ye=U-Z*Math.sin(pe+te);Ae.beginPath(),Ae.moveTo(C,U),Ae.lineTo(Be,Fe),Ae.lineTo(Ue,ye),Ae.closePath(),Ae.fill()}const ae=28*u;Ae.strokeStyle="rgba(122,166,174,0.55)",Ae.fillStyle=r.color,Ae.lineWidth=1*u,Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(F+ae,E),Ae.stroke(),Ae.beginPath(),Ae.strokeStyle="rgba(122,166,174,0.45)",Ae.arc(F,E,ae,0,$,$<0),Ae.stroke(),Ae.fillStyle="#4b7c86",Ae.font=`${Math.round(10*u)}px sans-serif`,Ae.textAlign="left",Ae.textBaseline="middle";const ce=F+(ae+10*u)*Math.cos($/2),se=E+(ae+10*u)*Math.sin($/2);if(Ae.fillText(`${V}°`,ce,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const pe=r.p1.price,Be=r.p2.price,Fe=[];if(r.statsPriceRange){const ye=Math.abs(Be-pe),Te=pe!==0?Math.abs((Be-pe)/pe*100):0,ve=ye<1e-4?6:ye<.01?5:ye<1?4:2;Fe.push("↕ "+ye.toFixed(ve)+" ("+Te.toFixed(2)+"%)")}const Ue=[];if(r.statsDistance){const ye=M/c,Te=z/u;Ue.push("distance: "+Math.sqrt(ye*ye+Te*Te).toFixed(2))}if(Ue.length>0&&Fe.push(Ue.join(", ")),Fe.length>0){const ye=Math.min(c,u),Te=11*ye,ve=Te*1.5,be=5*ye;Ae.font=Te+"px sans-serif";const Re=Fe.reduce((ut,fA)=>Math.max(ut,Ae.measureText(fA).width),0)+be*2,Ke=Fe.length*ve+be*2,[xe,De,Ce,de]=C<=F?[C,U,F,E]:[F,E,C,U];let _e,et;r.statsPosition==="left"?(_e=xe,et=De):r.statsPosition==="center"?(_e=(xe+Ce)/2,et=(De+de)/2):(_e=Ce,et=de);const rt=_e-Re/2,nt=et-Ke-12*ye;Ae.fillStyle="rgba(20, 20, 30, 0.72)",Ae.fillRect(rt,nt,Re,Ke),Ae.strokeStyle=r.statsColor,Ae.lineWidth=1*ye,Ae.strokeRect(rt,nt,Re,Ke),Ae.fillStyle=r.statsColor,Ae.textBaseline="top",Ae.textAlign="left",Fe.forEach((ut,fA)=>{Ae.fillText(ut,rt+be,nt+be+fA*ve)})}}Ae.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class eT{constructor(e,t,A){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*c,N=v*u,R=T*c,M=C*u,z=U*c,ne=F*u,$=(R+z)/2,V=(M+ne)/2;let Ae=$-E,re=V-N;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,Z=s.bitmapSize.width,te=(R-z)/2,ae=(M-ne)/2,ce=ye=>({x:$+te*ye,y:V+ae*ye}),se=(ye,Te)=>({x:Z,y:Te+he*(Z-ye)}),le=ce(1),pe=ce(-1),Be=se(le.x,le.y),Fe=se(pe.x,pe.y);m.save(),m.beginPath(),m.moveTo(le.x,le.y),m.lineTo(Be.x,Be.y),m.lineTo(Fe.x,Fe.y),m.lineTo(pe.x,pe.y),m.closePath(),m.fillStyle="rgba(148, 163, 184, 0.2)",m.fill(),m.beginPath(),m.strokeStyle="rgba(148, 163, 184, 0.9)",m.lineWidth=1*u,m.moveTo(R,M),m.lineTo(z,ne),m.stroke(),r._levels.forEach(ye=>{const Te=ce(ye.k),ve=se(Te.x,Te.y);m.beginPath(),m.strokeStyle=ye.color,m.lineWidth=ye.width*u,m.moveTo(Te.x,Te.y),m.lineTo(ve.x,ve.y),m.stroke()});const Ue=se(E,N);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*u,m.moveTo(E,N),m.lineTo(Ue.x,Ue.y),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tT{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,m=s.timeScale().timeToCoordinate(A.p1.rawTime),y=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),T=o.priceToCoordinate(A.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*l,U=y*c,F=v*l,E=T*c,N=n.bitmapSize.width,R=Math.abs(F-C)<1e-4?1:F-C,M=(E-U)/R,z=F>=C?1:-1,ne=z>0?N:0,$=C+z*Math.min(220*l,Math.max(80*l,N*.35)),V=A._rays.map(re=>{const he=M*re.ratio;return{...re,yEnd:U+he*(ne-C),yLabel:U+he*($-C)}});u.save();const Ae=(re,he,Z)=>{!re||!he||(u.beginPath(),u.moveTo(C,U),u.lineTo(ne,re.yEnd),u.lineTo(ne,he.yEnd),u.closePath(),u.fillStyle=Z,u.fill())};Ae(V[0],V[3],"rgba(161, 98, 7, 0.10)"),Ae(V[3],V[4],"rgba(5, 150, 105, 0.10)"),Ae(V[4],V[5],"rgba(107, 114, 128, 0.12)"),V.forEach(re=>{u.beginPath(),u.strokeStyle=re.color,u.lineWidth=1*c,u.moveTo(C,U),u.lineTo(ne,re.yEnd),u.stroke()}),u.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,u.textAlign=z>0?"left":"right",u.textBaseline="middle",V.forEach(re=>{u.fillStyle=re.color;const he=$+(z>0?4*l:-4*l),Z=re.yLabel;Z<-20||Z>n.bitmapSize.height+20||u.fillText(re.label,he,Z)}),u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class AT{constructor(e,t,A=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,A),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price);if(y==null||v==null||T==null||C==null)return;const U=y*c,F=v*u,E=T*c,N=C*u,R=E-U,M=N-F,z=Math.hypot(R,M);if(z<1e-4)return;const ne=R/z,$=M/z,V=-$,Ae=ne,re=E+V*z,he=N+Ae*z,Z=U+V*z,te=F+Ae*z,ae=(se,le)=>({x:U+ne*z*se+V*z*le,y:F+$*z*se+Ae*z*le});m.save();const ce=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let se=0;se<r.divisions;se++){const le=se/r.divisions,pe=(se+1)/r.divisions,Be=ae(0,le),Fe=ae(1,le),Ue=ae(1,pe),ye=ae(0,pe);m.beginPath(),m.moveTo(Be.x,Be.y),m.lineTo(Fe.x,Fe.y),m.lineTo(Ue.x,Ue.y),m.lineTo(ye.x,ye.y),m.closePath(),m.fillStyle=ce[se%ce.length],m.fill()}m.lineWidth=1*u,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const le=se/r.divisions,pe=ae(0,le),Be=ae(1,le),Fe=ae(le,0),Ue=ae(le,1);m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(Be.x,Be.y),m.stroke(),m.beginPath(),m.moveTo(Fe.x,Fe.y),m.lineTo(Ue.x,Ue.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*u,m.beginPath(),m.moveTo(U,F),m.lineTo(re,he),m.stroke(),m.beginPath(),m.moveTo(E,N),m.lineTo(Z,te),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*u,m.beginPath(),m.moveTo(U,F),m.lineTo(E,N),m.lineTo(re,he),m.lineTo(Z,te),m.closePath(),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class qa{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:m=!0,pricesColor:y="#129f5c",rayLeft:v=!1,rayRight:T=!1,arrowLeft:C=!1,arrowRight:U=!1}=n;this.p1=e,this.p2=t,this.p3=A,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=u,this.showPrices=m,this.pricesColor=y,this.rayLeft=v,this.rayRight=T,this.arrowLeft=C,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(E){E.useBitmapCoordinateSpace(N=>{if(!F.visible)return;const R=F._chart,M=F._series;if(!R||!M)return;const z=N.horizontalPixelRatio,ne=N.verticalPixelRatio,$=[F.p1,F.p3,F.p4,F.p2].map(Ke=>{const xe=R.timeScale().timeToCoordinate(Ke.rawTime),De=M.priceToCoordinate(Ke.price);return xe==null||De==null?null:{x:xe*z,y:De*ne}}).filter(Boolean);if($.length!==4)return;const[V,Ae,re,he]=$,Z=N.context;Z.save();const te=Ae.x-V.x,ae=Ae.y-V.y,ce=Math.sqrt(te*te+ae*ae)||1,se=te/ce,le=ae/ce,pe=re.x-he.x,Be=re.y-he.y,Fe=Math.sqrt(pe*pe+Be*Be)||1,Ue=pe/Fe,ye=Be/Fe,Te=1e5,ve=F.rayLeft?{x:V.x-se*Te,y:V.y-le*Te}:V,be=F.rayRight?{x:Ae.x+se*Te,y:Ae.y+le*Te}:Ae,Le=F.rayLeft?{x:he.x-Ue*Te,y:he.y-ye*Te}:he,Re=F.rayRight?{x:re.x+Ue*Te,y:re.y+ye*Te}:re;if(F.showBackground){const Ke=F.fillColor||"#6aa84f",xe=parseInt(Ke.slice(1,3),16),De=parseInt(Ke.slice(3,5),16),Ce=parseInt(Ke.slice(5,7),16);Z.beginPath(),Z.moveTo(V.x,V.y),Z.lineTo(Ae.x,Ae.y),Z.lineTo(re.x,re.y),Z.lineTo(he.x,he.y),Z.closePath(),Z.fillStyle=`rgba(${xe},${De},${Ce},${F.fillOpacity??.1})`,Z.fill()}if(Z.strokeStyle=F.lineColor,Z.lineWidth=F.lineWidth*ne,Z.setLineDash([]),Z.beginPath(),Z.moveTo(ve.x,ve.y),Z.lineTo(be.x,be.y),Z.moveTo(Le.x,Le.y),Z.lineTo(Re.x,Re.y),Z.moveTo(V.x,V.y),Z.lineTo(he.x,he.y),Z.moveTo(Ae.x,Ae.y),Z.lineTo(re.x,re.y),Z.stroke(),F.arrowLeft||F.arrowRight){const Ke=8*ne,xe=(De,Ce,de)=>{Z.save(),Z.translate(De,Ce),Z.rotate(de),Z.beginPath(),Z.moveTo(0,0),Z.lineTo(-Ke,-Ke/2),Z.lineTo(-Ke,Ke/2),Z.closePath(),Z.fillStyle=F.lineColor,Z.fill(),Z.restore()};F.arrowLeft&&(xe(ve.x,ve.y,Math.atan2(-le,-se)),xe(Le.x,Le.y,Math.atan2(-ye,-Ue))),F.arrowRight&&(xe(be.x,be.y,Math.atan2(le,se)),xe(Re.x,Re.y,Math.atan2(ye,Ue)))}if(Z.fillStyle="#ffffff",Z.strokeStyle="#3b82f6",Z.lineWidth=2*ne,[V,Ae,re,he].forEach(Ke=>{Z.beginPath(),Z.arc(Ke.x,Ke.y,6*ne,0,Math.PI*2),Z.fill(),Z.stroke()}),F.showPrices){const Ke=[F.p1,F.p3,F.p2,F.p4],xe=[V,Ae,he,re];Z.fillStyle=F.pricesColor||F.lineColor,Z.font=`${Math.round(10*ne)}px sans-serif`,Z.textAlign="left",Z.textBaseline="middle",xe.forEach((De,Ce)=>{const de=Ke[Ce]?.price;typeof de=="number"&&Z.fillText(de.toFixed(5),De.x+8*z,De.y)})}Z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class qd extends qa{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class jd{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const u=o._chart,m=o._series;if(!u||!m)return;const y=c.horizontalPixelRatio,v=c.verticalPixelRatio,T=c.context,C=R=>{const M=u.timeScale().timeToCoordinate(R.rawTime),z=m.priceToCoordinate(R.price);return M==null||z==null?null:{x:M*y,y:z*v}},U=C(o.p1),F=C(o.p2),E=C(o.b2),N=C(o.b1);!U||!F||!E||!N||(T.save(),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.lineTo(E.x,E.y),T.lineTo(N.x,N.y),T.closePath(),T.fillStyle=o.fillColor,T.fill(),T.strokeStyle=o.strokeColor,T.lineWidth=o.lineWidth*v,T.setLineDash([]),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.stroke(),T.beginPath(),T.moveTo(N.x,N.y),T.lineTo(E.x,E.y),T.stroke(),T.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ja{constructor(e,t,A,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=r,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(u=>{if(!l.visible)return;const m=l._chart,y=l._series;if(!m||!y)return;const v=u.horizontalPixelRatio,T=u.verticalPixelRatio,C=u.context,U=$=>{const V=m.timeScale().timeToCoordinate($.rawTime),Ae=y.priceToCoordinate($.price);return V==null||Ae==null?null:{x:V*v,y:Ae*T}},F=U(l.mid1),E=U(l.mid2),N=U(l.top1),R=U(l.top2),M=U(l.bot1),z=U(l.bot2);if(!F||!E||!N||!R||!M||!z)return;C.save(),C.beginPath(),C.moveTo(F.x,F.y),C.lineTo(E.x,E.y),C.lineTo(R.x,R.y),C.lineTo(N.x,N.y),C.closePath(),C.fillStyle=l.upperFillColor,C.fill(),C.beginPath(),C.moveTo(M.x,M.y),C.lineTo(z.x,z.y),C.lineTo(E.x,E.y),C.lineTo(F.x,F.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const ne=($,V,Ae)=>{C.beginPath(),C.strokeStyle=Ae,C.lineWidth=l.lineWidth*T,C.setLineDash([]),C.moveTo($.x,$.y),C.lineTo(V.x,V.y),C.stroke()};if(ne(N,R,l.upperStrokeColor),ne(F,E,l.centerStrokeColor),ne(M,z,l.lowerStrokeColor),l.showDeviationLabel){const $=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite($)?$.toFixed(5):null;if(V){const Ae=Math.max(10,Math.round(10*T));C.fillStyle=l.labelColor,C.font=`${Ae}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(V,M.x+2*v,M.y+10*T)}}C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ep extends ja{}class tp{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,m=n.bitmapSize.width;n.bitmapSize.height;const y=A.p1.price,v=A.p2.price,T=y-v,C=$=>v+T*$,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(y),N=o.priceToCoordinate(v),R=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,M=U!=null&&F!=null?Math.round(Math.max(U,F)*l):m,z=M-R;u.save(),A._zoneFills.forEach(({from:$,to:V,color:Ae})=>{const re=C($),he=C(V),Z=o.priceToCoordinate(re),te=o.priceToCoordinate(he);if(Z==null||te==null)return;const ae=Math.round(Z*c),ce=Math.round(te*c);u.fillStyle=Ae,u.fillRect(R,Math.min(ae,ce),z,Math.abs(ce-ae))}),A._levels.forEach(({ratio:$,label:V})=>{const Ae=C($),re=o.priceToCoordinate(Ae);if(re==null)return;const he=Math.round(re*c),Z=A._levelColors[$]||"#888888";u.beginPath(),u.strokeStyle=Z,u.lineWidth=$===0||$===1?1.5*c:1*c,$!==0&&$!==1&&$<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(R,he),u.lineTo(M,he),u.stroke(),u.setLineDash([])});const ne=Math.round(11*c);if(u.font=`${ne}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:$,label:V})=>{const Ae=C($),re=o.priceToCoordinate(Ae);if(re==null)return;const he=Math.round(re*c),Z=A._levelColors[$]||"#888888",te=`${V} (${Ae.toFixed(5)})`;u.fillStyle=Z,u.textAlign="right",u.fillText(te,R-4*l,he-4*c)}),U!=null&&F!=null&&E!=null&&N!=null){const $=Math.round(U*l),V=Math.round(E*c),Ae=Math.round(F*l),re=Math.round(N*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo($,V),u.lineTo(Ae,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc($,V,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(Ae,re,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke()}u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class iT{constructor(e,t="#3b82f6",A=2,r=!0){this.time=e,this.color=t,this.lineWidth=A,this.showDate=r,this.showDot=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const u=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,y=o.context;y.save(),y.beginPath(),y.strokeStyle=n.color,y.lineWidth=n.lineWidth*o.horizontalPixelRatio,y.setLineDash([]),y.moveTo(u,0),y.lineTo(u,m),y.stroke();const v=Math.round(m/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){y.beginPath(),y.strokeStyle=n.color,y.lineWidth=1.5*o.horizontalPixelRatio;const T=5*o.horizontalPixelRatio;y.arc(u,v,T,0,Math.PI*2),y.stroke()}if(n.showDate!==!1){const T=n.time,C=new Date(typeof T=="number"?T*1e3:T),U=Ae=>String(Ae).padStart(2,"0"),F=`${U(C.getUTCDate())}.${U(C.getUTCMonth()+1)}.${C.getUTCFullYear()} ${U(C.getUTCHours())}:${U(C.getUTCMinutes())}:${U(C.getUTCSeconds())}`,E=Math.round(11*o.verticalPixelRatio);y.font=`${E}px ui-sans-serif, system-ui, sans-serif`,y.textBaseline="middle",y.textAlign="center";const N=y.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),z=E+2*M,ne=N+2*R,$=u-ne/2,V=m-z-Math.round(4*o.verticalPixelRatio);y.fillStyle=n.color,y.fillRect($,V,ne,z),y.fillStyle="#ffffff",y.fillText(F,u,V+z/2)}y.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Ap(i,e){const t=typeof i=="string"?i.trim():"",A=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(A))return`rgba(95, 143, 150, ${e})`;const r=parseInt(A.slice(0,2),16),n=parseInt(A.slice(2,4),16),s=parseInt(A.slice(4,6),16);return`rgba(${r}, ${n}, ${s}, ${e})`}function rT(i,e,t){const A=`${i??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let u=c;for(;u.length>s;){let m=u.lastIndexOf(" ",s);m<=0&&(m=s),o.push(u.slice(0,m)),u=u.slice(m).trimStart()}o.push(u)};return A.split(`
|
|
11
|
-
`).forEach(l),o.length===0&&o.push(""),o}function
|
|
12
|
-
`).forEach(R),N.length===0&&N.push("");const M=N.map(le=>C.measureText(le).width),z=Math.max(...M,20*m),ne=8*m,$=5*y,V=z+ne*2,Ae=U*1.2,re=Ae*N.length+$*2,he=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Z=v-V/2,te=T-re;r.bgEnabled&&(C.fillStyle=Ap(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(Z,te,V,re),C.fill()),r.borderEnabled&&(C.strokeStyle=Ap(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),C.lineWidth=Math.max(.5,(r.borderWidth??1)*y),C.beginPath(),C.rect(Z,te,V,re),C.stroke()),C.fillStyle=r.color,C.textAlign=he,C.textBaseline="middle";const ae=he==="left"?Z+ne:he==="right"?Z+V-ne:Z+V/2;for(let le=0;le<N.length;le++)C.fillText(N[le],ae,te+$+Ae*(le+.5));const ce=5*y,se=T+10*y;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*y,C.arc(v,se,ce,0,Math.PI*2),C.stroke(),C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const sT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function rp(i){if(!i)return 7;const e=String(i).toUpperCase();return sT[e]??7}function oT(i,e){const t=String(i||"").toUpperCase(),A=e||rp(i),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(A*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const WA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:j(A.time)})).filter(A=>A.time!=null);e.sort((A,r)=>A.time-r.time);const t=new Map;for(const A of e)t.set(A.time,A);return Array.from(t.values()).sort((A,r)=>A.time-r.time)};function ht(i,e,t,A,r,n){const s=r-t,o=n-A,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/(l*l);c=Math.max(0,Math.min(1,c));const u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function aT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/l;c<0&&(c=0);const u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function lT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);const c=((i-t)*s+(e-A)*o)/l,u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function gi(i,e,t){let A=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r].x,o=t[r].y,l=t[n].x,c=t[n].y;o>e!=c>e&&i<(l-s)*(e-o)/(c-o+1e-7)+s&&(A=!A)}return A}function np(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??j(i.rawTime),r=e.normalizedTime??j(e.rawTime),n=t.normalizedTime??j(t.rawTime);if(A==null||r==null||n==null)return null;const s=r-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-i.price)/s,l=t.price+o*(A-n),c=t.price+o*(r-n),u=j((A+r)/2),m=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:m}}}function Ar(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??j(e.rawTime),n=t.normalizedTime??j(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map($=>({time:j($.time),close:typeof $.close=="number"?$.close:parseFloat($.close)})).filter($=>$.time!=null&&Number.isFinite($.close)&&$.time>=s&&$.time<=o).sort(($,V)=>$.time-V.time);if(l.length<2)return null;const c=l.length;let u=0,m=0,y=0,v=0;for(let $=0;$<c;$++){const V=$,Ae=l[$].close;u+=V,m+=Ae,y+=V*Ae,v+=V*V}const T=c*v-u*u,C=Math.abs(T)<1e-12?0:(c*y-u*m)/T,U=(m-C*u)/c;let F=0;for(let $=0;$<c;$++){const V=U+C*$,Ae=l[$].close-V;F+=Ae*Ae}const E=Math.sqrt(F/c),N=Math.max(E*A,1e-8),R=l[0].time,M=l[c-1].time,z=U,ne=U+C*(c-1);return{slope:C,intercept:U,stdDev:E,offset:N,barCount:c,p1:{rawTime:R,normalizedTime:R,price:z},p2:{rawTime:M,normalizedTime:M,price:ne},top1:{rawTime:R,normalizedTime:R,price:z+N},top2:{rawTime:M,normalizedTime:M,price:ne+N},bot1:{rawTime:R,normalizedTime:R,price:z-N},bot2:{rawTime:M,normalizedTime:M,price:ne-N}}}function Xr(i,e,t,A=1){return Ar(i,e,t,A)}const cT={trendline:{requiredKeys:["point1","point2"],handleCount:2},gannline:{requiredKeys:["point1","point2"],handleCount:3},rectangle:{requiredKeys:["p1","p2"],handleCount:8},circle:{requiredKeys:["p1","p2"],handleCount:2},triangle:{requiredKeys:["p1","p2","p3"],handleCount:3},ellipse:{requiredKeys:["p1","p2"],handleCount:4},infoline:{requiredKeys:["p1","p2"],handleCount:2},arrowedline:{requiredKeys:["p1","p2"],handleCount:2},rayline:{requiredKeys:["p1","p2"],handleCount:2},extendedline:{requiredKeys:["p1","p2"],handleCount:2},crossline:{requiredKeys:["p"],handleCount:1},trendbyangle:{requiredKeys:["p1","p2"],handleCount:2},equidistantchannel:{requiredKeys:["p1","p2","p3"],handleCount:3},regressionchannel:{requiredKeys:["p1","p2"],handleCount:2},stddevchannel:{requiredKeys:["p1","p2"],handleCount:2},gannfan:{requiredKeys:["p1","p2"],handleCount:2},ganngrid:{requiredKeys:["p1","p2"],handleCount:2},andrewspitchfork:{requiredKeys:["p1","p2","p3"],handleCount:3},disjointchannel:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},flattopbottom:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},rulerline:{requiredKeys:["p1","p2"],handleCount:3},horizontalray:{requiredKeys:["primitive"],handleCount:1},verticalline:{requiredKeys:["primitive"],handleCount:1},pricelevel:{requiredKeys:["priceLine"],handleCount:1}},hT={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6",pricelevel:"#3b82f6"};function uT(i,e){if(!i||!i.type)return!1;const t=cT[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function dT(i){return i?hT[i]??"#22c55e":"#22c55e"}const pT=300,sp=24,fT=150,op=150;function el(i,e,t=pT){if(!Array.isArray(i)||i.length===0)return[];const A=uA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=j(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function gT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=j(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function mT(i,e){let t=0,A=i.length;for(;t<A;){const r=t+A>>1;i[r]<e?t=r+1:A=r}return t}function ks(i,e,t,A){const r=j(e),n=j(t),s=uA(A)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(i)||i.length===0)return l;if(r==null||n==null)return 1;const c=y=>{const v=mT(i,y);if(v<=0)return 0;if(v>=i.length)return i.length-1;const T=i[v-1],C=i[v];return Math.abs(y-T)<=Math.abs(C-y)?v-1:v},u=c(r),m=c(n);return Math.max(1,Math.abs(m-u)+1)}function ap(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=gT(e);if(r==null)return!1;const n=A.timeToCoordinate(r);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const u=A.getVisibleLogicalRange(),m=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,y=Number.isFinite(m)&&m>20?m:120,v=Math.min(op,y/2),T=Math.max(20,y-v),C={from:c-T,to:c+v};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=uA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-fT*o,to:r+op*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const wT=q.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=q.useRef(null),l=q.useRef(null),c=q.useRef(null),u=q.useRef(null),m=q.useRef(null),y=q.useRef(null),v=q.useRef([]),T=q.useRef(!1),C=q.useRef(null),U=q.useRef(null),F=q.useRef(null),E=q.useRef(null),N=q.useRef([]),[R,M]=q.useState(null),[z,ne]=q.useState(null),[$,V]=q.useState([]),[Ae,re]=q.useState(null),[he,Z]=q.useState([]),te=q.useRef(null),ae=q.useRef(null),ce=q.useRef(null),se=q.useRef(!1),le=q.useRef(!1);q.useEffect(()=>{ce.current=R;let p=!1;v.current.forEach(f=>{if(f.type==="trendline"&&f.decoration){const k=f===R;f.decoration.isSelected!==k&&(f.decoration.isSelected=k,p=!0)}}),p&&c.current?.applyOptions({})},[R]);const pe=q.useRef(new Map),Be=q.useRef(null),Fe=q.useRef(null),Ue=(p,f)=>`${p}_${f}`,ye=()=>{const p=Ue(Ce,de);return pe.current.get(p)||null},Te=p=>{if(!p)return;const f=Ue(Ce,de);pe.current.set(f,p)},{activeTool:ve,setActiveTool:be,showGrid:Le,snapToGrid:Re,chartObjects:Ke,setChartObjects:xe,orders:De,selectedSymbol:Ce,selectedTimeframe:de,drawingsVisible:_e,chartType:et,chartLocked:rt,theme:nt,candleColors:ut,showTradeOrders:fA,showTradePosition:Xe,showTradeHistory:ke,showSLTP:at,showAskPrice:it,showChartControls:Ct,showCrosshair:bt,showOHLC:$A,currentSymbolData:XA,baseUrl:Rt,endpoints:gA,endpointParams:JA,indicators:Yt,indicatorSettings:Et}=Vt(),QA=q.useRef({}),[st,ft]=q.useState({}),Ut=q.useRef(0),Tt=q.useRef([]),[Je,Ie]=q.useState(!1),[tt,$e]=q.useState(null),[me,ze]=q.useState([]),[Pe,At]=q.useState(!0),[Ne,Ye]=q.useState(null),[wt,Lt]=q.useState(0),cA=q.useMemo(()=>{const p=me.map(f=>j(f?.time)).filter(f=>Number.isFinite(f));return p.sort((f,k)=>f-k),p},[me]),mA=q.useRef(null),ir=q.useRef(new Map);q.useRef(null);const fp=q.useRef(0),HA=q.useRef(null),rr=q.useRef(!1),jr=q.useRef(!1);q.useEffect(()=>{const p=m.current;p&&p.setData(el(me,de))},[me,de]),q.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*.8;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*1.25;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const f=p.querySelectorAll("canvas"),k=nt==="light"?"#ffffff":"#12161d";let ge=null,H=0;if(f.forEach(X=>{if(X.width>0&&X.height>0){const J=X.width*X.height;J>H&&(H=J,ge=X)}}),ge)try{const X=document.createElement("canvas");X.width=ge.width,X.height=ge.height;const J=X.getContext("2d");J.fillStyle=k,J.fillRect(0,0,X.width,X.height),J.drawImage(ge,0,0);const ie=document.createElement("a");ie.download=`chart-${Ce}-${de}-${Date.now()}.png`,ie.href=X.toDataURL("image/png"),ie.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(X){console.warn("Canvas export failed, trying html2canvas",X)}Nv(p,{useCORS:!0,allowTaint:!0,backgroundColor:k,scale:2,logging:!1}).then(X=>{const J=document.createElement("a");J.download=`chart-${Ce}-${de}-${Date.now()}.png`,J.href=X.toDataURL("image/png"),J.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(X=>{console.error("Chart screenshot failed",X),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Ce,de,nt]);const il=q.useMemo(()=>me.length===0?[]:et==="line"||et==="area"?me.map(p=>({time:p.time,value:p.close})):me,[me,et]),KT=p=>{r?r(p):($e("BUY"),Ie(!0))},VT=p=>{n?n(p):($e("SELL"),Ie(!0))},zT=()=>{Ie(!1),$e(null)},WT=p=>{const f=z;if(!f||!p)return;const k=(X,J)=>{if(typeof X!="string")return J;const ie=X.trim(),oe=ie.startsWith("#")?ie:`#${ie}`;return/^#[0-9A-Fa-f]{6}$/.test(oe)?oe.toLowerCase():J},ge=(X,J)=>{const ie=Number(X);return Number.isFinite(ie)?Math.max(0,Math.min(1,ie)):J};let H={...f,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:f.visibleTimeframes};if(f.type==="text"){const X=Number.isFinite(Number(p.price))?Number(p.price):f.price,J=f.primitive;J&&(J.text=typeof p.text=="string"?p.text:J.text,J.color=k(p.color,J.color??"#5f8f96"),J.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):J.fontSize,J.fontWeight=p.fontWeight==="bold"?"bold":"normal",J.fontStyle=p.fontStyle==="italic"?"italic":"normal",J.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:J.textAlign,J.textWrap=!!p.textWrap,J.borderEnabled=!!p.borderEnabled,J.borderColor=k(p.borderColor,J.borderColor??"#5f8f96"),J.borderOpacity=ge(p.borderOpacity,J.borderOpacity??.1),J.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),J.bgEnabled=!!p.bgEnabled,J.bgColor=k(p.bgColor,J.bgColor??"#5f8f96"),J.bgOpacity=ge(p.bgOpacity,J.bgOpacity??.1),J.price=X),H={...H,price:X,text:typeof p.text=="string"?p.text:f.text}}if(f.type==="trendline"){const X=k(p.lineColor,"#22c55e"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(f.series)try{f.series.applyOptions({color:X,lineWidth:J})}catch{}const ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.point1?.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.point2?.price;if(f.series&&f.point1&&f.point2){const Y=f.point1.time??f.point1.rawTime,B=f.point2.time??f.point2.rawTime;try{const h=WA([{time:Y,value:ie},{time:B,value:oe}]);h.length>0&&f.series.setData(h)}catch{}}const S={...f.point1,price:ie},O={...f.point2,price:oe};f.decoration&&(f.decoration.color=X,f.decoration.lineWidth=J,f.decoration.arrowLeft=!!p.arrowLeft,f.decoration.arrowRight=!!p.arrowRight,f.decoration.rayLeft=!!p.rayLeft,f.decoration.rayRight=!!p.rayRight,f.decoration.statsColor=k(p.statsColor,"#5f8f96"),f.decoration.statsPosition=p.statsPosition??"right",f.decoration.statsShowAlways=!!p.statsShowAlways,f.decoration.statsPriceRange=!!p.statsPriceRange,f.decoration.statsBarsRange=!!p.statsBarsRange,f.decoration.statsDateRange=!!p.statsDateRange,f.decoration.statsAngle=!!p.statsAngle,f.decoration.statsDistance=!!p.statsDistance,f.decoration.p1=S,f.decoration.p2=O),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsShowAlways:!!p.statsShowAlways,statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,point1:S,point2:O,decoration:f.decoration}}if(f.type==="pricelevel"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.showPrice!==!1,oe=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=k(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):f.price;if(f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,lineWidth:J,axisLabelVisible:ie,title:ie&&typeof h=="number"?h.toFixed(5):""})}catch{}const b=u.current;if(oe&&S&&b)if(f.textPrimitive)f.textPrimitive.text=S,f.textPrimitive.textColor=O,f.textPrimitive.hAlign=Y,f.textPrimitive.vAlign=B,f.textPrimitive.price=h;else{const I=new Jd(h,{text:S,textColor:O,hAlign:Y,vAlign:B});try{b.attachPrimitive(I)}catch{}f.textPrimitive=I}else if(f.textPrimitive&&b){try{b.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ie,showText:oe,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:f.textPrimitive}}if(f.type==="horizontalray"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.showPrice!==!1,oe=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=k(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):f.price,b=f.primitive;if(b&&(b.price=h,b.color=X,b.lineWidth=J),f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,axisLabelVisible:ie,title:ie&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(oe&&S&&I)if(f.textPrimitive)f.textPrimitive.text=S,f.textPrimitive.textColor=O,f.textPrimitive.hAlign=Y,f.textPrimitive.vAlign=B,f.textPrimitive.price=h,f.textPrimitive.originTime=f.rawOriginTime;else{const w=new Jd(h,{text:S,textColor:O,hAlign:Y,vAlign:B,originTime:f.rawOriginTime});try{I.attachPrimitive(w)}catch{}f.textPrimitive=w}else if(f.textPrimitive&&I){try{I.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ie,showText:oe,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:f.textPrimitive}}if(f.type==="verticalline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.showDate!==!1,oe=f.primitive;oe&&(oe.color=X,oe.lineWidth=J,oe.showDate=ie),H={...H,lineColor:X,lineWidth:J,showDate:ie}}if(f.type==="infoline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.statsShowAlways!==!1,oe=k(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=!!p.statsAngle,b=!!p.statsDistance,I=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,d=f.p1.rawTime,_=f.p2.rawTime,Q=w-I,L=I!==0?Q/Math.abs(I)*100:0,x=f.p1.normalizedTime??0,g=f.p2.normalizedTime??0,D=uA(de)||3600,P=Math.abs(g-x),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=c.current,ee=u.current,ue=G?G.timeScale().timeToCoordinate(d):null,we=ee?ee.priceToCoordinate(I):null,Qe=G?G.timeScale().timeToCoordinate(_):null,Ee=ee?ee.priceToCoordinate(w):null,We=ue!=null&&we!=null&&Qe!=null&&Ee!=null?Math.atan2(-(Ee-we),Qe-ue)*(180/Math.PI):f.primitive?.info?.angle??0,qe={priceDiff:Q,pricePct:L,bars:K,days:W,angle:We},Ve=f.primitive;Ve&&(Ve.color=X,Ve.lineWidth=J,Ve.statsShowAlways=ie,Ve.statsColor=oe,Ve.statsPosition=S,Ve.statsPriceRange=O,Ve.statsBarsRange=Y,Ve.statsDateRange=B,Ve.statsAngle=h,Ve.statsDistance=b,Ve.p1={...f.p1,price:I},Ve.p2={...f.p2,price:w},Ve.info=qe),H={...H,lineColor:X,lineWidth:J,statsShowAlways:ie,statsColor:oe,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B,statsAngle:h,statsDistance:b,p1:{...f.p1,price:I},p2:{...f.p2,price:w}}}if(f.type==="rulerline"){const X=k(p.lineColor,"#3b82f6"),J=p.showArea!==!1,ie=!!p.statsShowAlways,oe=k(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=f.primitive;h&&(h.lineColor=X,h.showArea=J,h.statsShowAlways=ie,h.statsColor=oe,h.statsPosition=S,h.statsPriceRange=O,h.statsBarsRange=Y,h.statsDateRange=B),H={...H,lineColor:X,showArea:J,statsShowAlways:ie,statsColor:oe,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B}}if(f.type==="arrowedline"){const X=k(p.lineColor,"#f59e0b"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:ie},S.p2={...f.p2,price:oe}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="rayline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:ie},S.p2={...f.p2,price:oe}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="extendedline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:ie},S.p2={...f.p2,price:oe}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="crossline"){const X=k(p.lineColor,"#06a0e3"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.price))?Number(p.price):f.p.price,oe=f.primitive;oe&&(oe.color=X,oe.lineWidth=J,oe.showTime=!!p.showTime,oe.showPrice=!!p.showPrice,oe.center={...f.p,price:ie}),H={...H,lineColor:X,lineWidth:J,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...f.p,price:ie}}}if(f.type==="trendbyangle"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:ie},S.p2={...f.p2,price:oe}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsDistance:!!p.statsDistance,p1:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="disjointchannel"){const X=k(p.lineColor,"#129f5c"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=k(p.fillColor,"#6aa84f"),oe=ge(p.fillOpacity,.1),S=k(p.pricesColor,"#129f5c"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ie,h.fillOpacity=oe,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...f.p1,price:O},h.p3={...f.p3,price:Y},h.p2={...f.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ie,fillOpacity:oe,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:O},p3:{...f.p3,price:Y},p2:{...f.p2,price:B}}}if(f.type==="flattopbottom"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=k(p.fillColor,"#3b82f6"),oe=ge(p.fillOpacity,.12),S=k(p.pricesColor,"#3b82f6"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ie,h.fillOpacity=oe,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...f.p1,price:O},h.p3={...f.p3,price:Y},h.p2={...f.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ie,fillOpacity:oe,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:O},p3:{...f.p3,price:Y},p2:{...f.p2,price:B}}}xe(X=>{const J=X.map(ie=>ie===f?H:ie);return v.current=J,J}),ce.current===f&&(ce.current=H),M(X=>X===f?H:X),re(X=>X===f?H:X),ne(H);try{c.current?.applyOptions({})}catch{}};q.useEffect(()=>{const p=o.current;if(!p)return;const f=p.getBoundingClientRect(),k=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},ge=nt==="light",H=s1(p,{width:f.width||p.clientWidth,height:f.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:k},layout:{background:{color:ge?"#FFFFFF":"#0d1117",type:"solid"},textColor:ge?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Le,color:Le?ge?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?ge?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}},rightPriceScale:{borderColor:ge?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:ge?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:ge?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:ve===1?1:0,vertLine:{width:1,color:ge?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ge?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:ge?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ge?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:ve===1,horzLineVisible:ve===1},handleScroll:{mouseWheel:!0,pressedMouseMove:ve===null||ve===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),X=(typeof Ce=="string"?Ce:Ce?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),J=X.includes("JPY"),ie=tn(X),oe=en(X);let S,O;J?(S=.001,O=w=>Math.abs(Number(w)).toFixed(3)):ie?X.startsWith("BTC")||X.startsWith("ETH")?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(4)):oe&&(X.startsWith("XAU")||X.startsWith("XAG"))?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(5));const Y=H.addCandlestickSeries({upColor:ge?"#089981":"#26a69a",downColor:ge?"#f23645":"#ef5350",wickUpColor:ge?"#089981":"#26a69a",wickDownColor:ge?"#f23645":"#ef5350",borderUpColor:ge?"#089981":"#26a69a",borderDownColor:ge?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:S,formatter:O}}),B=H.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=H,u.current=Y,m.current=B,B.setData(el(me,de)),requestAnimationFrame(()=>{if(p&&H){const w=p.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),b=()=>{if(le.current&&ir.current.size>0){const w=h.getVisibleRange();w&&Te(w)}};h.subscribeVisibleTimeRangeChange(b);const I=new ResizeObserver(w=>{for(const d of w){const{width:_,height:Q}=d.contentRect;if(_>0&&Q>0&&H){const L=h.getVisibleRange();H.resize(_,Q),L&&setTimeout(()=>{try{h.setVisibleRange(L)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(b),I.disconnect(),H.remove(),c.current=null,u.current=null,m.current=null,y.current=null,v.current=[],HA.current&&clearTimeout(HA.current)}},[]),q.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}}})},[Le]),q.useEffect(()=>{const p=c.current;if(!p)return;const f=nt==="light";p.applyOptions({layout:{background:{color:f?"#FFFFFF":"#12161d"},textColor:f?"#020617":"#fff"},grid:{vertLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:f?"#e5e7eb":"#1e293b"},timeScale:{borderColor:f?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1},horzLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1}}})},[nt,Le]),q.useEffect(()=>{const p=u.current;!p||!ut||p.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor})},[ut]),q.useEffect(()=>{if(!c.current)return;const f=!rt&&!(ve!==null&&ve!==1&&ve!==0),k=!rt;c.current.applyOptions({crosshair:{mode:ve===1?1:0,vertLine:{visible:ve===1||bt,width:1,color:nt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:nt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:ve===1||bt,width:1,color:nt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:nt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:k,pressedMouseMove:f,horzTouchDrag:f,vertTouchDrag:f},handleScale:{axisPressedMouseMove:{time:f,price:f},axisDoubleClickReset:{time:!1,price:k},axisTouch:{time:f,price:f},mouseWheel:k,pinch:k}})},[ve,rt,bt,nt]);const RT=()=>{const p=u.current;v.current.forEach(f=>{if(f.primitive){try{p&&p.detachPrimitive(f.primitive)}catch{}if(f.series&&f.series!==p)try{f.series.detachPrimitive(f.primitive)}catch{}}if(f.priceLine&&p)try{p.removePriceLine(f.priceLine)}catch{}if(f.textPrimitive&&p)try{p.detachPrimitive(f.textPrimitive)}catch{}}),v.current=[],xe([]),be(null)},gp=(p,f=!1)=>{p&&v.current.forEach(k=>{if(k.primitive){try{p.detachPrimitive(k.primitive)}catch{}try{p.attachPrimitive(k.primitive)}catch{}}if(f&&k.type==="pricelevel"&&k.priceLine)try{const ge=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,axisLabelVisible:ge,title:ge&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}if(f&&k.type==="horizontalray"&&k.priceLine)try{const ge=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:ge,title:ge&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}})};q.useEffect(()=>{(async()=>{if(!Ce||!de){ze([]),le.current=!1;return}try{if(HA.current&&(clearTimeout(HA.current),HA.current=null),rr.current=!0,At(!0),Ye(null),ze([]),le.current=!1,jr.current=!1,Fe.current!==null&&Fe.current!==Ce&&RT(),Fe.current=Ce,u.current)try{u.current.setData([])}catch{}const f=rp(de),k=oT(de,f),ge=Rt||Vv?.VITE_BASE_URL||"http://localhost:5002",H=gA?.candles||"/api/chart/candles",X=JA?.candles||{},J={symbol:X.symbol||"symbol",timeframe:X.timeframe||"timeframe",limit:X.limit||"limit",daysBack:X.daysBack||"daysBack"},ie={};ie[J.symbol]=Ce,ie[J.timeframe]=de,ie[J.limit]=k,X.daysBack!==!1&&(ie[J.daysBack]=f);const oe=await gt.get(`${ge}${H}`,{params:ie,timeout:1e4});let S=[];if(Array.isArray(oe.data)?S=oe.data:oe.data&&oe.data.data&&Array.isArray(oe.data.data)?S=oe.data.data:oe.data&&Array.isArray(oe.data)&&(S=oe.data),S&&S.length>0){const{candles:O,stats:Y}=cl(S,Ce,de);O.length>0?(ze(O),ir.current=new Map,O.forEach(B=>{ir.current.set(B.time,B)}),jr.current=!0,rr.current=!1,mA.current?.connected&&Ce&&de&&mA.current.emit("subscribeCandles",{symbol:Ce,timeframe:de})):(console.warn(`⚠️ No valid candles after processing for ${Ce}`),rr.current=!1,ze([]))}else console.warn(`⚠️ No candle data returned for ${Ce}`),rr.current=!1,ze([])}catch(f){console.error(`❌ Error fetching ${Ce}:`,f.message);const k=f.code==="ECONNABORTED"||f.message&&f.message.includes("timeout");Ye(k?"Request timed out. No data available for this symbol.":f.message||"Failed to load candles."),rr.current=!1,ze([]),At(!1)}})()},[Ce,de,wt]),q.useEffect(()=>{mA.current=On.getSocket();const p=mA.current,f=()=>{if(jr.current&&Ce&&de&&p.connected){const ie={symbol:Ce,timeframe:de};p.emit("subscribeCandles",ie)}},k=()=>{setTimeout(()=>{Ce&&de&&f()},200)},ge=ie=>{},H=ie=>{};p.on("connect",k),p.on("disconnect",ge),p.on("connect_error",H),p.on("subscription:confirmed",ie=>{ie.type});const X=ie=>{if(!jr.current||!ie||!ie.candle||!ie.symbol)return;const oe=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(oe(ie.symbol)!==oe(Ce)||ie.timeframe&&ie.timeframe!==de)return;const{candle:S}=ie,O=hl(S,Ce,de);if(!O)return;const Y=Date.now();if(Y-fp.current<200)return;fp.current=Y;const B=c.current?.timeScale(),h=B?.getVisibleRange(),b=u.current,I=c.current;if(!(!b||!I||!le.current&&!jr.current||b?.seriesType?.()!==(et==="line"?"Line":et==="area"?"Area":et==="bars"?"Bar":"Candlestick")))try{const _=ir.current.get(O.time),Q=!_,L=_?{time:O.time,open:_.open,high:Math.max(_.high,O.high),low:Math.min(_.low,O.low),close:O.close}:O;ir.current.set(O.time,L),Q&&m.current&&m.current.setData(el(Array.from(ir.current.values()),de));try{et==="line"||et==="area"?b.update({time:L.time,value:L.close}):b.update(L),B&&h&&Te(h)}catch(x){throw x}}catch{}};p.on("candleUpdate",X);const J=()=>{p.connected&&Ce&&de&&f()};if(p.connected)J();else{const ie=()=>{setTimeout(J,200)};p.once("connect",ie),setTimeout(()=>{p.connected&&J()},500)}return()=>{p.off("candleUpdate",X),p.off("connect",k),p.off("disconnect",ge),p.off("connect_error",H),p.off("subscription:confirmed"),Ce&&de&&p.connected&&p.emit("unsubscribeCandles",{symbol:Ce,timeframe:de})}},[Ce,de,Rt]),q.useEffect(()=>{const p=u.current,f=c.current;if(!(!p||!f)&&!(rr.current&&me.length>0)&&!(me.length===0&&le.current)){if(me.length===0&&!le.current){if(Pe)return;const k=f.timeScale();p.setData([]),k.fitContent(),HA.current&&clearTimeout(HA.current),HA.current=setTimeout(()=>requestAnimationFrame(()=>At(!1)),400);return}if(!le.current){const k=(typeof Ce=="string"?Ce:Ce?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),ge=k.includes("JPY"),H=en(k),X=tn(k);let J,ie;ge?(J=.001,ie=h=>Math.abs(Number(h)).toFixed(3)):X?k.startsWith("BTC")||k.startsWith("ETH")?(J=.01,ie=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ie=h=>Math.abs(Number(h)).toFixed(4)):H&&(k.startsWith("XAU")||k.startsWith("XAG"))?(J=.01,ie=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ie=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:J,formatter:ie}})}catch{}const oe=f.timeScale(),S=Ue(Ce,de);Be.current,Be.current=S;const O=[...me].sort((h,b)=>h.time-b.time);if(et==="line"||et==="area"){const h=O?.map(b=>({time:b.time,value:b.close})).filter(b=>b.time!=null);h.length>0&&p.setData(h)}else O?.length>0&&p.setData(O);ut&&p.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor}),gp(p);const Y=uA(de)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,L=Oe(Q,Y);h.primitive.originTime=L,h.originTime=L;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,L=Oe(Q,Y);h.primitive.time=L,h.time=j(L);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,g=O.length>0?O[O.length-1].time:null,D=W=>{const G=Oe(W,Y);return x==null||g==null?G:Math.min(Math.max(G,x),g)},P=D(Q),K=D(L);h.p1.rawTime=P,h.p1.normalizedTime=j(P),h.p2.rawTime=K,h.p2.normalizedTime=j(K),h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,g=O.length>0?O[O.length-1].time:null,D=ue=>{const we=Oe(ue,Y);return x==null||g==null?we:Math.min(Math.max(we,x),g)},P=D(Q),K=D(L);h.p1.rawTime=P,h.p2.rawTime=K,h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};const W=j(P),G=j(K),ee=Math.abs((G??0)-(W??0));h.primitive.info={priceDiff:h.p2.price-h.p1.price,pricePct:(h.p2.price-h.p1.price)/Math.abs(h.p1.price||1)*100,bars:ks(cA,P,K,de),days:Math.max(1,Math.round(ee/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,price:h.p2.price};return}if(h.type==="rayline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,price:h.p2.price};return}if(h.type==="extendedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,price:h.p2.price};return}if(h.type==="trendbyangle"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=Oe(L.rawTime,Y);L.rawTime=x,L.normalizedTime=j(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="flattopbottom"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=Oe(L.rawTime,Y);L.rawTime=x,L.normalizedTime=j(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="regressionchannel"&&h.primitive&&h.p1&&h.p2){const Q=Ar(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.intercept=Q.intercept,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="stddevchannel"&&h.primitive&&h.p1&&h.p2){const Q=Xr(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="andrewspitchfork"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=Oe(h.p1.rawTime,Y),L=Oe(h.p2.rawTime,Y),x=Oe(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.p3.rawTime=x,h.p3.normalizedTime=j(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="gannfan"||h.type==="ganngrid")&&h.primitive&&h.p1&&h.p2){const Q=Oe(h.p1.rawTime,Y),L=Oe(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if((h.type==="circle"||h.type==="ellipse")&&h.primitive&&h.p1&&h.p2){const Q=Oe(h.p1.rawTime,Y),L=Oe(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type==="triangle"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=Oe(h.p1.rawTime,Y),L=Oe(h.p2.rawTime,Y),x=Oe(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.p3.rawTime=x,h.p3.normalizedTime=j(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="fibonacci"||h.type==="rectangle")&&h.primitive&&h.p1&&h.p2){const Q=Oe(h.p1.rawTime,Y),L=Oe(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type!=="trendline"&&h.type!=="gannline"||!h.series||!h.point1||!h.point2)return;const b=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=Oe(b,Y),d=Oe(I,Y);h.point1.time=w,h.point2.time=d;const _=WA([{time:w,value:h.point1.price},{time:d,value:h.point2.price}]);try{_.length>0&&h.series.setData(_)}catch{}}),O?.length>0){const h=O[O?.length-1].time,b=uA(de)||60,w=h-(de==="M1"?150:de==="M5"?120:100)*b;try{oe.setVisibleRange({from:w,to:h+b*sp})}catch{oe.fitContent()}}else oe.fitContent();try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}le.current=!0;const B=oe.getVisibleRange();Te(B),HA.current&&clearTimeout(HA.current),HA.current=setTimeout(()=>requestAnimationFrame(()=>At(!1)),400)}}},[me.length,et,Ce,de]),q.useEffect(()=>{const p=c.current;if(!p||!le.current||me.length===0)return;const f=p.timeScale(),k=f.getVisibleRange()||ye();if(u.current)try{p.removeSeries(u.current)}catch{}if(y.current)try{p.removeSeries(y.current),y.current=null}catch{}let ge;const H=(typeof Ce=="string"?Ce:Ce?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=H.includes("JPY"),J=en(H),ie=tn(H);let oe,S;X?(oe=.001,S=B=>Math.abs(Number(B)).toFixed(3)):ie?H.startsWith("BTC")||H.startsWith("ETH")?(oe=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(oe=1e-4,S=B=>Math.abs(Number(B)).toFixed(4)):J&&(H.startsWith("XAU")||H.startsWith("XAG"))?(oe=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(oe=1e-4,S=B=>Math.abs(Number(B)).toFixed(5));const O={type:"custom",minMove:oe,formatter:S};if(et==="bars"){const B=nt==="light";ge=p.addBarSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...me].sort((b,I)=>b.time-I.time);h?.length>0&&ge.setData(h)}else if(et==="line"){ge=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=WA(il);B.length>0&&ge.setData(B)}else if(et==="area"){ge=p.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=WA(il);B.length>0&&ge.setData(B)}else if(et==="volume ticks"||et==="volume"){const B=nt==="light";ge=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,priceScaleId:"right"});const h=[...me].sort((w,d)=>w.time-d.time);h?.length>0&&ge.setData(h);const b=p.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),p.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const I=h?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));I.length>0&&b.setData(I),y.current=b}else{const B=nt==="light";ge=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...me].sort((b,I)=>b.time-I.time);h?.length>0&&ge.setData(h)}if(u.current=ge,ut&&ge)try{ge.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor})}catch{}gp(ge,!0);const Y=uA(de)||60;if(v.current.forEach(B=>{if(B.type==="horizontalray"&&B.primitive){const L=B.rawOriginTime??B.primitive.originTime,x=Oe(L,Y);B.primitive.originTime=x,B.originTime=x;return}if(B.type==="verticalline"&&B.primitive){const L=B.rawTime??B.primitive.time,x=Oe(L,Y);B.primitive.time=x,B.time=j(x);return}if(B.type==="infoline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,g=[...me].sort((ee,ue)=>ee.time-ue.time),D=g.length>0?g[0].time:null,P=g.length>0?g[g.length-1].time:null,K=ee=>{const ue=Oe(ee,Y);return D==null||P==null?ue:Math.min(Math.max(ue,D),P)},W=K(L),G=K(x);B.p1.rawTime=W,B.p1.normalizedTime=j(W),B.p2.rawTime=G,B.p2.normalizedTime=j(G),B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:G,price:B.p2.price};return}if(B.type==="rulerline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,g=[...me].sort((Qe,Ee)=>Qe.time-Ee.time),D=g.length>0?g[0].time:null,P=g.length>0?g[g.length-1].time:null,K=Qe=>{const Ee=Oe(Qe,Y);return D==null||P==null?Ee:Math.min(Math.max(Ee,D),P)},W=K(L),G=K(x);B.p1.rawTime=W,B.p2.rawTime=G,B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:G,price:B.p2.price};const ee=j(W),ue=j(G),we=Math.abs((ue??0)-(ee??0));B.primitive.info={priceDiff:B.p2.price-B.p1.price,pricePct:(B.p2.price-B.p1.price)/Math.abs(B.p1.price||1)*100,bars:ks(cA,W,G,de),days:Math.max(1,Math.round(we/86400))};return}if(B.type==="arrowedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="rayline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="extendedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="trendbyangle"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="disjointchannel"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const g=Oe(x.rawTime,Y);x.rawTime=g,x.normalizedTime=j(g)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="flattopbottom"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const g=Oe(x.rawTime,Y);x.rawTime=g,x.normalizedTime=j(g)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="regressionchannel"&&B.primitive&&B.p1&&B.p2){const L=[...me].sort((D,P)=>D.time-P.time),x=Ar(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const g=B.primitive;g.mid1={rawTime:x.p1.rawTime,price:x.p1.price},g.mid2={rawTime:x.p2.rawTime,price:x.p2.price},g.top1={rawTime:x.top1.rawTime,price:x.top1.price},g.top2={rawTime:x.top2.rawTime,price:x.top2.price},g.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},g.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.intercept=x.intercept,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="stddevchannel"&&B.primitive&&B.p1&&B.p2){const L=[...me].sort((D,P)=>D.time-P.time),x=Xr(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const g=B.primitive;g.mid1={rawTime:x.p1.rawTime,price:x.p1.price},g.mid2={rawTime:x.p2.rawTime,price:x.p2.price},g.top1={rawTime:x.top1.rawTime,price:x.top1.price},g.top2={rawTime:x.top2.rawTime,price:x.top2.price},g.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},g.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="andrewspitchfork"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=Oe(B.p1.rawTime,Y),x=Oe(B.p2.rawTime,Y),g=Oe(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.p3.rawTime=g,B.p3.normalizedTime=j(g),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:g,price:B.p3.price};return}if((B.type==="gannfan"||B.type==="ganngrid")&&B.primitive&&B.p1&&B.p2){const L=Oe(B.p1.rawTime,Y),x=Oe(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if((B.type==="circle"||B.type==="ellipse")&&B.primitive&&B.p1&&B.p2){const L=Oe(B.p1.rawTime,Y),x=Oe(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type==="triangle"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=Oe(B.p1.rawTime,Y),x=Oe(B.p2.rawTime,Y),g=Oe(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.p3.rawTime=g,B.p3.normalizedTime=j(g),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:g,price:B.p3.price};return}if((B.type==="fibonacci"||B.type==="rectangle")&&B.primitive&&B.p1&&B.p2){const L=Oe(B.p1.rawTime,Y),x=Oe(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type!=="trendline"&&B.type!=="gannline"||!B.series||!B.point1||!B.point2)return;const h=B.type==="gannline"?"#7aa6ae":"#22c55e";try{p.removeSeries(B.series)}catch{}const b=p.addLineSeries({color:B.lineColor??h,lineWidth:B.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),I=B.point1.rawTime??B.point1.time,w=B.point2.rawTime??B.point2.time,d=Oe(I,Y),_=Oe(w,Y);B.point1.time=d,B.point2.time=_;const Q=WA([{time:d,value:B.point1.price},{time:_,value:B.point2.price}]);try{Q.length>0&&b.setData(Q)}catch{}if(B.decoration)try{b.attachPrimitive(B.decoration)}catch{}B.series=b}),k&&le.current)setTimeout(()=>{try{f.setVisibleRange(k),Te(k)}catch{if(me.length>0)try{const h=me[me.length-1].time,b=uA(de)||60,I=h-100*b;f.setVisibleRange({from:I,to:h+b*sp}),Te(f.getVisibleRange())}catch{f.fitContent(),Te(f.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!le.current){f.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}le.current=!0,Te(f.getVisibleRange())}},[et,me.length,il.length,Ce,ut]),q.useEffect(()=>{const p=c.current,f=y.current;if(!p||!f||!le.current||me.length===0||et!=="volume"&&et!=="volume ticks")return;const ge=[...me].sort((H,X)=>H.time-X.time)?.map(H=>({time:H.time,value:H.volume||0,color:H.close>=H.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ge.length>0&&f.setData(ge)},[me,et]),q.useEffect(()=>{if(!Ce||!de||!Yt)return;const f=Object.entries(Yt).filter(([J,ie])=>ie).map(([J])=>J).filter(J=>J.startsWith("sma")||J.startsWith("ema")||J==="rsi"||J==="macd");if(f.length===0){ft({});return}const k=f.map(J=>J==="sma20"?`sma:${Et?.smaPeriod||20}`:J==="sma50"?"sma:50":J==="ema12"?`ema:${Et?.emaPeriod||12}`:J==="rsi"?`rsi:${Et?.rsiPeriod||14}`:J==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!k)return;const ge=++Ut.current,H=Rt||"http://localhost:5002",X=gA?.indicators||"/api/market-data/indicators";gt.get(`${H}${X}`,{params:{symbol:Ce,timeframe:de,indicators:k}}).then(J=>{ge===Ut.current&&ft(J.data?.data||{})}).catch(J=>{console.error("[ChartArea] Indicator fetch error:",J?.message),ge===Ut.current&&ft({})})},[Ce,de,Yt,Et,Rt,gA]),q.useEffect(()=>{const p=c.current;if(!p||!le.current)return;const f=QA.current,k=(oe,S)=>(f[oe]||(f[oe]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...S})),f[oe]),ge=oe=>{if(f[oe]){try{p.removeSeries(f[oe])}catch{}delete f[oe]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(ge)},X=Yt||{};if(X.sma20&&st.sma20?.data?.length?k("sma20",{color:"#2196F3",lineWidth:1.5}).setData(st.sma20.data.map(S=>({time:S.time,value:S.value}))):ge("sma20"),X.sma50&&st.sma50?.data?.length?k("sma50",{color:"#FF9800",lineWidth:1.5}).setData(st.sma50.data.map(S=>({time:S.time,value:S.value}))):ge("sma50"),X.ema12&&st.ema12?.data?.length?k("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(st.ema12.data.map(S=>({time:S.time,value:S.value}))):ge("ema12"),X.rsi&&st.rsi?.data?.length){const oe=k("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:B=>B.toFixed(1)}});p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),oe.setData(st.rsi.data.map(B=>({time:B.time,value:B.value}))),f.rsi70||(f.rsi70=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),f.rsi30||(f.rsi30=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const S=st.rsi.data,O=S[0]?.time,Y=S[S.length-1]?.time;O&&Y&&(f.rsi70.setData([{time:O,value:70},{time:Y,value:70}]),f.rsi30.setData([{time:O,value:30},{time:Y,value:30}]))}else ge("rsi"),ge("rsi70"),ge("rsi30");if(X.macd&&st.macd?.data?.length){const oe=k("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}),S=k("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});f.macdHist||(f.macdHist=p.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}));const O=X.rsi?.65:.8;p.priceScale("macd").applyOptions({scaleMargins:{top:O,bottom:0},borderVisible:!1,autoScale:!0}),X.rsi&&p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const Y=st.macd.data;oe.setData(Y.map(B=>({time:B.time,value:B.value}))),S.setData(Y.map(B=>({time:B.time,value:B.signal}))),f.macdHist.setData(Y.map(B=>({time:B.time,value:B.histogram,color:B.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else H();const J=X.rsi&&st.rsi?.data?.length||X.macd&&st.macd?.data?.length,ie=X.rsi&&st.rsi?.data?.length&&X.macd&&st.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:ie?.4:J?.25:.05}})}catch{}},[st,Yt,me.length]),q.useEffect(()=>()=>{const p=c.current;if(!p)return;const f=QA.current;Object.keys(f).forEach(k=>{try{p.removeSeries(f[k])}catch{}}),QA.current={}},[Ce,de]),q.useEffect(()=>{const p=c.current,f=u.current,k=o.current;if(!p||!f||!k)return;const H=ve!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][ve]:null,X=(S,O)=>{const Y=Math.min(S.time,O.time),B=Math.max(S.time,O.time),h=S.time<=O.time?S.rawTime:O.rawTime,b=S.time<=O.time?O.rawTime:S.rawTime,I=Math.max(S.price,O.price),w=Math.min(S.price,O.price),d=j(Math.round((Y+B)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:Y,price:w},p3:{rawTime:b,normalizedTime:B,price:w}}};if(!H){if(T.current=!1,C.current=null,U.current=null,E.current=null,F.current?.series)try{p.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const d={type:"pricelevel",priceLine:f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};xe(_=>[..._,d]),v.current.push(d),be(null)};return k.addEventListener("click",S),()=>{k.removeEventListener("click",S)}}if(H==="horizontalray"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=new zv(I,b);f.attachPrimitive(w);const d=f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),_=j(b),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:_,rawOriginTime:b,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};xe(L=>[...L,Q]),v.current.push(Q),be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="verticalline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=p.timeScale().coordinateToTime(B);if(h==null)return;const b=new iT(h);f.attachPrimitive(b);const I=j(h),w={type:"verticalline",primitive:b,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};xe(d=>[...d,w]),v.current.push(w),be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="text"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=new nT(b,I);f.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:b,price:I,text:"Text"};xe(_=>[..._,d]),v.current.push(d),be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="infoline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;O||(O=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=S.normalizedTime,L=j(d);if(Q==null||L==null||Q===L)return;const x=Q<=L?[{time:Q,value:S.price},{time:L,value:_}]:[{time:L,value:_},{time:Q,value:S.price}];try{O.setData(x)}catch{}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d),x:I,y:w};return}if(O){try{p.removeSeries(O)}catch{}O=null}const Q=S.normalizedTime,L=j(d);if(Q==null||L==null)return;const x=_-S.price,g=x/Math.abs(S.price)*100,D=uA(de)||3600,P=Math.abs(L-Q),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=S.x,ee=S.y,ue=I,Qe=Math.atan2(-(w-ee),ue-G)*(180/Math.PI),Ee={priceDiff:x,pricePct:g,bars:K,days:W,angle:Qe},We=new Wv({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_},Ee);f.attachPrimitive(We);const qe={type:"infoline",primitive:We,rawP1Time:S.rawTime,rawP2Time:d,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};xe(Ve=>[...Ve,qe]),v.current.push(qe),S=null,be(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{p.removeSeries(O)}catch{}}}if(H==="rulerline"){let S=null,O=null;const Y=(b,I,w,d)=>{const _=j(b),Q=j(w),L=d-I,x=L/Math.abs(I)*100,g=ks(cA,b,w,de),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:L,pricePct:x,bars:g,days:P}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null||L===S.normalizedTime)return;const x=Y(S.rawTime,S.price,_,Q);if(!O)O=new Zd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},x),f.attachPrimitive(O);else{O.p2={rawTime:_,price:Q},O.info=x;const g=Q>=S.price;O.color=g?"#3b82f6":"#ef5350",O.fillColor=g?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;if(!S){S={rawTime:_,price:Q,normalizedTime:j(_)};return}if(O){try{f.detachPrimitive(O)}catch{}O=null}const L=S.normalizedTime,x=j(_);if(L==null||x==null)return;const g=Y(S.rawTime,S.price,_,Q),D=new Zd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},g);f.attachPrimitive(D);const P={type:"rulerline",primitive:D,rawP1Time:S.rawTime,rawP2Time:_,p1:{rawTime:S.rawTime,normalizedTime:L,price:S.price},p2:{rawTime:_,normalizedTime:x,price:Q},lineColor:Q>=S.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};xe(K=>[...K,P]),v.current.push(P),S=null,be(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{f.detachPrimitive(O)}catch{}}}if(H==="arrowedline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;const Q=j(d);if(!(Q==null||Q===S.normalizedTime))if(!O)O=new Yd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),f.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{c.current?.applyOptions({})}catch{}}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d)};return}if(O){try{f.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=j(d);if(Q==null||L==null||Q===L)return;const x=new Yd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});f.attachPrimitive(x);const g={type:"arrowedline",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};xe(D=>[...D,g]),v.current.push(g),S=null,be(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{f.detachPrimitive(O)}catch{}}}if(H==="rayline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=j(b),Q=j(d);if(_==null||Q==null)return;const L=new Jv({rawTime:b,price:I},{rawTime:d,price:I});f.attachPrimitive(L);const x={type:"rayline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};xe(g=>[...g,x]),v.current.push(x),be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="extendedline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=j(b),Q=j(d);if(_==null||Q==null)return;const L=new Zv({rawTime:b,price:I},{rawTime:d,price:I});f.attachPrimitive(L);const x={type:"extendedline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};xe(g=>[...g,x]),v.current.push(x),be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="crossline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d=new qv({rawTime:b,price:I});f.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:b,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};xe(Q=>[...Q,_]),v.current.push(_),be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="trendbyangle"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=j(b),Q=j(d);if(_==null||Q==null)return;const L=new jv({rawTime:b,price:I},{rawTime:d,price:I});f.attachPrimitive(L);const x={type:"trendbyangle",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};xe(g=>[...g,x]),v.current.push(x),be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="disjointchannel"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new qa(_,Q,L,x),f.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const g=f.coordinateToPrice(x);if(g==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:g},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P==null)return;const K=(S.price+O.price)/2;D>=K?(Y={rawTime:g,normalizedTime:P,price:D},B={rawTime:g,normalizedTime:P,price:2*K-D}):(B={rawTime:g,normalizedTime:P,price:D},Y={rawTime:g,normalizedTime:P,price:2*K-D}),I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P!=null){if(h===0){S={rawTime:g,normalizedTime:P,price:D},O={rawTime:g,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const K=f.coordinateToPrice(x);if(K==null||Math.abs(K-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:K},h=2;return}if(h===2&&b){try{f.detachPrimitive(b)}catch{}const K=new qa(b.p1,b.p2,b.p3,b.p4);f.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:j(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:j(b.p4.rawTime),price:b.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};xe(G=>[...G,W]),v.current.push(W),be(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{f.detachPrimitive(b)}catch{}}}if(H==="flattopbottom"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new qd(_,Q,L,x),f.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const g=f.coordinateToPrice(x);if(g==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:g},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P==null)return;Y={rawTime:g,normalizedTime:P,price:D},B={rawTime:g,normalizedTime:P,price:O.price},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P!=null){if(h===0){S={rawTime:g,normalizedTime:P,price:D},O={rawTime:g,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const K=f.coordinateToPrice(x);if(K==null||Math.abs(K-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:K},h=2;return}if(h===2&&b){try{f.detachPrimitive(b)}catch{}const K=new qd(b.p1,b.p2,b.p3,b.p4);f.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:j(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:j(b.p4.rawTime),price:b.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};xe(G=>[...G,W]),v.current.push(W),be(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{f.detachPrimitive(b)}catch{}}}if(H==="regressionchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;const g=Ar(me,S,{rawTime:_,normalizedTime:L},1);if(g)if(!O)O=new ja({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),f.attachPrimitive(O);else{Y(O,g);try{p.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const g=Ar(me,S,{rawTime:_,normalizedTime:L},1);if(!g)return;if(O){try{f.detachPrimitive(O)}catch{}O=null}const D=new ja({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});f.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,intercept:g.intercept,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};xe(K=>[...K,P]),v.current.push(P),S=null,be(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{f.detachPrimitive(O)}catch{}}}if(H==="stddevchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;const g=Xr(me,S,{rawTime:_,normalizedTime:L},1);if(g)if(!O)O=new ep({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),f.attachPrimitive(O);else{Y(O,g);try{p.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const g=Xr(me,S,{rawTime:_,normalizedTime:L},1);if(!g)return;if(O){try{f.detachPrimitive(O)}catch{}O=null}const D=new ep({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});f.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};xe(K=>[...K,P]),v.current.push(P),S=null,be(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{f.detachPrimitive(O)}catch{}}}if(H==="andrewspitchfork"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d=B+140,_=p.timeScale().coordinateToTime(d);if(_==null)return;const Q=j(_);if(Q==null)return;const L={rawTime:b,normalizedTime:w,price:I},x={rawTime:_,normalizedTime:Q,price:I},g={rawTime:b,normalizedTime:w,price:I},D=new eT({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:g.rawTime,price:g.price});f.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:L,p2:x,p3:g};xe(K=>[...K,P]),v.current.push(P),M(P),ce.current=P,be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="gannfan"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new tT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const L={type:"gannfan",primitive:Q,p1:d,p2:_};xe(x=>[...x,L]),v.current.push(L),M(L),ce.current=L,be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="ganngrid"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=f.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new AT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const L={type:"ganngrid",primitive:Q,p1:d,p2:_};xe(x=>[...x,L]),v.current.push(L),M(L),ce.current=L,be(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="trendline"||H==="gannline"){const S=H,O=S==="gannline"?"#7aa6ae":"#22c55e",Y=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=f.coordinateToPrice(_);if(!(Q==null||L==null)&&(Q=j(Q),Q!=null))if(E.current===null){E.current={time:Q,price:L};const x=p.addLineSeries({color:O,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:S,series:x},x.setData([{time:Q,value:L}])}else{const x=E.current,g={time:Q,price:L},D=1,P=1e-5,K=Math.abs(g.time-x.time),W=Math.abs(g.price-x.price);if(K<D&&W<P){try{p.removeSeries(F.current.series)}catch{}E.current=null,F.current=null;return}const G={time:x.time,rawTime:x.time,price:x.price},ee={time:g.time,rawTime:g.time,price:g.price},ue=WA([{time:G.time,value:G.price},{time:ee.time,value:ee.price}]);if(ue.length>0){F.current.series.setData(ue);const we=new Yv(G,ee,O,2);try{F.current.series.attachPrimitive(we)}catch{}const Qe={type:S,series:F.current.series,point1:G,point2:ee,decoration:we};xe(Ee=>[...Ee,Qe]),v.current.push(Qe)}be(null),E.current=null,F.current=null}},B=I=>{if(E.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=f.coordinateToPrice(_);if(Q==null||L==null||(Q=j(Q),Q==null))return;const x=E.current,g=WA([{time:x.time,value:x.price},{time:Q,value:L}]);g.length>0&&F.current.series.setData(g)},h=I=>{I.stopPropagation()},b={capture:!0,passive:!1};return k.addEventListener("click",Y,b),k.addEventListener("mousemove",B,b),k.addEventListener("mousemove",h,b),()=>{if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}k.removeEventListener("click",Y,b),k.removeEventListener("mousemove",B,b),k.removeEventListener("mousemove",h,b)}}if(H==="parallellines"){let S=null,O=null,Y=null,B=0,h=null;const b=(L,x,g,D)=>{L.p1={rawTime:x.rawTime,price:x.price},L.p2={rawTime:g.rawTime,price:g.price},L.b1={rawTime:D.b1.rawTime,price:D.b1.price},L.b2={rawTime:D.b2.rawTime,price:D.b2.price},L.p3={rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}},I=(L,x,g)=>{const D=np(L,x,g);if(!D)return null;if(!h)h=new jd({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:D.b1.rawTime,price:D.b1.price},{rawTime:D.b2.rawTime,price:D.b2.price},{rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}),f.attachPrimitive(h);else{b(h,L,x,D);try{p.applyOptions({})}catch{}}return D},w=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const x=k.getBoundingClientRect(),g=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(g),K=f.coordinateToPrice(D);if(P==null||K==null)return;const W=j(P);if(W!=null){if(B===0){S={rawTime:P,normalizedTime:W,price:K},B=1;return}if(B===1){if(O={rawTime:P,normalizedTime:W,price:K},Math.abs(O.normalizedTime-S.normalizedTime)<1)return;const G=j((S.normalizedTime+O.normalizedTime)/2);if(G==null)return;const ee=(S.price+O.price)/2;Y={rawTime:G,normalizedTime:G,price:ee},I(S,O,Y),B=2;return}if(B===2&&S&&O){Y={rawTime:P,normalizedTime:W,price:K};const G=I(S,O,Y);if(!G||!h)return;try{f.detachPrimitive(h)}catch{}const ee=new jd({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:G.b1.rawTime,price:G.b1.price},{rawTime:G.b2.rawTime,price:G.b2.price},{rawTime:G.bottomMid.rawTime,price:G.bottomMid.price});f.attachPrimitive(ee);const ue={type:"equidistantchannel",primitive:ee,p1:S,p2:O,p3:G.bottomMid,b1:G.b1,b2:G.b2,bottomMid:G.bottomMid};xe(we=>[...we,ue]),v.current.push(ue),be(null),B=0,S=null,O=null,Y=null,h=null}}},d=L=>{if(B===0||!S)return;const x=k.getBoundingClientRect(),g=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(g),K=f.coordinateToPrice(D);if(P==null||K==null)return;const W=j(P);if(W!=null){if(B===1){const G={rawTime:P,normalizedTime:W,price:K},ee=j((S.normalizedTime+G.normalizedTime)/2);if(ee==null)return;const ue=(S.price+G.price)/2;I(S,G,{rawTime:ee,normalizedTime:ee,price:ue});return}B===2&&O&&I(S,O,{rawTime:P,normalizedTime:W,price:K})}},_=L=>{L.stopPropagation()},Q={capture:!0,passive:!1};return k.addEventListener("click",w,Q),k.addEventListener("mousemove",d,Q),k.addEventListener("mousemove",_,Q),()=>{if(B=0,S=null,O=null,Y=null,N.current=[],h)try{f.detachPrimitive(h)}catch{}h=null,k.removeEventListener("click",w,Q),k.removeEventListener("mousemove",d,Q),k.removeEventListener("mousemove",_,Q)}}if(H==="fibonacci"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(!(d==null||_==null))if(!O)O=new tp({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),f.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{p.applyOptions({})}catch{}}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d)};return}if(O){try{f.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=j(d);if(Q==null||L==null)return;if(Math.abs(_-S.price)<1e-5){S=null;return}const x=new tp({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});f.attachPrimitive(x);const g={type:"fibonacci",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_}};xe(D=>[...D,g]),v.current.push(g),S=null,be(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{f.detachPrimitive(O)}catch{}}}if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}const J=S=>{if(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const O=k.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=f.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=j(h),h!=null){if(T.current=!0,C.current={time:h,normalizedTime:h,rawTime:I,price:b},U.current=null,H==="rectangle"){const w=new Rv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new Gv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1});f.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new $v({rawTime:I,price:b},{rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new Xv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});f.attachPrimitive(w),F.current={type:"ellipse",primitive:w}}if(H==="parallellines"){const w=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},ie=S=>{if(!T.current||!C.current||!F.current)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();const O=k.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=f.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=j(h),h==null)return;U.current={time:h,normalizedTime:h,rawTime:I,price:b};const w=C.current;if(F.current.type==="rectangle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const d=F.current.primitive,_=X(w,{time:h,rawTime:I,price:b});if(!_)return;d.p1={rawTime:_.p1.rawTime,price:_.p1.price},d.p2={rawTime:_.p2.rawTime,price:_.p2.price},d.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const d=F.current.firstLine;d.endTime-d.startTime;const _=d.endPrice-d.startPrice,Q=b,L=Q+_;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:L}]);else{const x=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});x.setData([{time:w.time,value:Q},{time:h,value:L}]),F.current.secondLine=x}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:b}])},oe=S=>{if(S&&(S.preventDefault(),S.stopPropagation()),!T.current||!F.current||!C.current)return;const O=C.current,Y=U.current||O;if(F.current.type==="parallellines")if(F.current.firstLine){const B={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};xe(h=>[...h,B]),v.current.push(B),be(null),F.current=null,T.current=!1,C.current=null,U.current=null;return}else{F.current.firstLine={startTime:O.time,startPrice:O.price,endTime:Y.time,endPrice:Y.price},T.current=!1,C.current=null,U.current=null;return}if(F.current.type==="rectangle"){const B=C.current,h=U.current||B,b=Math.max(B.price,h.price),I=Math.min(B.price,h.price),w=j(Math.min(B.time,h.time)),d=j(Math.max(B.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(b-I)>=1e-5){const _=F.current.primitive,Q=B.time<=h.time?B.rawTime:h.rawTime,L=B.time<=h.time?h.rawTime:B.rawTime,x={rawTime:Q,normalizedTime:w,price:b},g={rawTime:L,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:g.rawTime,price:g.price};const D={type:"rectangle",primitive:_,p1:x,p2:g};xe(P=>[...P,D]),v.current.push(D),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=f.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=3){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price};const L={type:"circle",primitive:B,p1:h,p2:b};xe(x=>[...x,L]),v.current.push(L),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const B=F.current.primitive,h=X(O,Y);if(h){const b=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(b>=1&&I>=1e-5){B.p1={rawTime:h.p1.rawTime,price:h.p1.price},B.p2={rawTime:h.p2.rawTime,price:h.p2.price},B.p3={rawTime:h.p3.rawTime,price:h.p3.price};const w={type:"triangle",primitive:B,p1:h.p1,p2:h.p2,p3:h.p3};xe(d=>[...d,w]),v.current.push(w),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=f.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=4){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price},B.previewAsLine=!1,B.minorRatio=.45;const L={type:"ellipse",primitive:B,p1:h,p2:b,minorRatio:.45};xe(x=>[...x,L]),v.current.push(L),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}T.current=!1,C.current=null,U.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const S={capture:!0,passive:!1},O=Y=>{T.current||Y.stopPropagation()};return k.addEventListener("mousedown",J,S),k.addEventListener("mousemove",ie,S),k.addEventListener("mousemove",O,S),k.addEventListener("mouseup",oe,S),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null,T.current=!1,C.current=null,U.current=null,k.removeEventListener("mousedown",J,S),k.removeEventListener("mousemove",ie,S),k.removeEventListener("mousemove",O,S),k.removeEventListener("mouseup",oe,S)}}},[ve,me,xe,be]),q.useEffect(()=>{const p=c.current,f=u.current,k=o.current,ge=ve===null||ve===1;if(!ge||!p||!f||!k){ge||(M(null),V([]),re(null),Z([]));return}const H=10,X=8;function J(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="gannline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="rectangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=Math.min(b,w),Q=Math.max(b,w),L=Math.min(I,d),x=Math.max(I,d),g=(_+Q)/2,D=(L+x)/2;return[{x:_,y:L},{x:g,y:L},{x:Q,y:L},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:g,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=(b+w)/2,Q=(I+d)/2,L=w-b,x=d-I,g=Math.hypot(L,x);if(g<.001)return[];const D=L/g,P=x/g,K=-P,W=D,G=g/2,ee=G*Math.max(.05,h.minorRatio??.45);return[{x:_-D*G,y:Q-P*G},{x:_+K*ee,y:Q+W*ee},{x:_+D*G,y:Q+P*G},{x:_-K*ee,y:Q-W*ee}]}if(h.type==="gannfan"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="rayline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="extendedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="crossline"&&h.p){const b=p.timeScale().timeToCoordinate(h.p.rawTime),I=f.priceToCoordinate(h.p.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const b=f.priceToCoordinate(h.price);return b==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:b}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const b=p.timeScale().timeToCoordinate(h.rawTime),I=f.priceToCoordinate(h.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=f.priceToCoordinate(h.b1.price),L=p.timeScale().timeToCoordinate(h.b2.rawTime),x=f.priceToCoordinate(h.b2.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:(_+L)/2,y:(Q+x)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="flattopbottom"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="infoline"&&h.p1&&h.p2){const b=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=p.timeScale().timeToCoordinate(b),d=f.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=f.priceToCoordinate(h.p2.price);return w==null||d==null||_==null||Q==null?[]:[{x:w,y:d},{x:_,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="horizontalray"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.originTime),w=f.priceToCoordinate(b.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.time);if(I==null)return[];const w=b.midYCss??200;return[{x:I,y:w}]}return[]}function ie(h,b){for(let I=Ke.length-1;I>=0;I--){const w=Ke[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,g=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"line"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.min(d,Q),g=Math.max(d,Q),D=Math.min(_,L),P=Math.max(_,L),K=(x+g)/2,W=(D+P)/2,G=[{x,y:D,mode:"handle1"},{x:K,y:D,mode:"handle2"},{x:g,y:D,mode:"handle3"},{x,y:W,mode:"handle4"},{x:g,y:W,mode:"handle5"},{x,y:P,mode:"handle6"},{x:K,y:P,mode:"handle7"},{x:g,y:P,mode:"handle8"}];for(const Ee of G)if(Math.hypot(h-Ee.x,b-Ee.y)<H)return{object:w,mode:Ee.mode};const ee=ht(h,b,x,D,g,D),ue=ht(h,b,x,P,g,P),we=ht(h,b,x,D,x,P),Qe=ht(h,b,g,D,g,P);if(ee<X||ue<X||we<X||Qe<X||gi(h,b,[{x,y:D},{x:g,y:D},{x:g,y:P},{x,y:P}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(Q-d,L-_);if(x<2)continue;const g=Math.hypot(h-d,b-_),D=Math.hypot(h-Q,b-L);if(g<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(g-x)<X||g<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||g==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=ht(h,b,d,_,Q,L),G=ht(h,b,Q,L,x,g),ee=ht(h,b,x,g,d,_);if(W<X||G<X||ee<X||gi(h,b,[{x:d,y:_},{x:Q,y:L},{x,y:g}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,g=(_+L)/2,D=Q-d,P=L-_,K=Math.hypot(D,P);if(K<2)continue;const W=D/K,G=P/K,ee=-G,ue=W,we=K/2,Qe=we*Math.max(.05,w.minorRatio??.45);if(we<2||Qe<2)continue;const Ee=x-W*we,We=g-G*we,qe=x+ee*Qe,Ve=g+ue*Qe,Bt=x+W*we,dt=g+G*we,yt=x-ee*Qe,Dt=g-ue*Qe,qt=Math.hypot(h-Ee,b-We),iA=Math.hypot(h-qe,b-Ve),hA=Math.hypot(h-Bt,b-dt),ZA=Math.hypot(h-yt,b-Dt);if(qt<H)return{object:w,mode:"handle1"};if(iA<H)return{object:w,mode:"handle2"};if(hA<H)return{object:w,mode:"handle3"};if(ZA<H)return{object:w,mode:"handle4"};const Ii=(h-x)*W+(b-g)*G,Os=(h-x)*ee+(b-g)*ue,Bp=Ii/we,yp=Os/Qe,Cp=Bp*Bp+yp*yp;if(Math.abs(Cp-1)<.2||Cp<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),g=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(g<H)return{object:w,mode:"handle1"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),g=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(g<H)return{object:w,mode:"handle1"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(aT(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(lT(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),_=f.priceToCoordinate(w.p.price);if(d==null||_==null)continue;if(Math.hypot(h-d,b-_)<H)return{object:w,mode:"handle1"};const L=Math.abs(b-_),x=Math.abs(h-d);if(L<X||x<X)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),_=f.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=ip(w,d,_);if(h>=Q.left&&h<=Q.right&&b>=Q.top&&b<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),g=f.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=f.priceToCoordinate(w.b2.price),K=x!=null&&D!=null?(x+D)/2:null,W=g!=null&&P!=null?(g+P)/2:null;if(d==null||_==null||Q==null||L==null||K==null||W==null||x==null||g==null||D==null||P==null)continue;const G=Math.hypot(h-d,b-_),ee=Math.hypot(h-Q,b-L),ue=Math.hypot(h-K,b-W),we=Math.hypot(d-K,_-W)<H*1.5;if(we&&Math.min(G,ue)<H*1.5)return{object:w,mode:"handle3"};if(ue<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle2"};if(we)continue;if(G<H)return{object:w,mode:"handle1"};const Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P);if(Qe<X||Ee<X||gi(h,b,[{x:d,y:_},{x:Q,y:L},{x:D,y:P},{x,y:g}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),g=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=f.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),ee=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||g==null||D==null||P==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-d,b-_),we=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(we<H)return{object:w,mode:"handle2"};const Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P),We=ht(h,b,K,W,G,ee);if(Qe<X||Ee<X||We<X||gi(h,b,[{x,y:g},{x:D,y:P},{x:G,y:ee},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),g=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=f.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),ee=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||g==null||D==null||P==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-d,b-_),we=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(we<H)return{object:w,mode:"handle2"};const Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P),We=ht(h,b,K,W,G,ee);if(Qe<X||Ee<X||We<X||gi(h,b,[{x,y:g},{x:D,y:P},{x:G,y:ee},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||g==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=(Q+x)/2,G=(L+g)/2;let ee=W-d,ue=G-_;Math.abs(ee)<1e-4&&(ee=1e-4);const we=ue/ee,Qe=k.clientWidth,Ee=L+we*(Qe-Q),We=g+we*(Qe-x),qe=ht(h,b,Q,L,Qe,Ee),Ve=ht(h,b,x,g,Qe,We);if(qe<X||Ve<X||gi(h,b,[{x:Q,y:L},{x:Qe,y:Ee},{x:Qe,y:We},{x,y:g}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||g==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),G=Math.hypot(h-x,b-g),ee=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle4"};const ue=ht(h,b,d,_,x,g),we=ht(h,b,Q,L,D,P),Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P);if(ue<X||we<X||Qe<X||Ee<X||gi(h,b,[{x:d,y:_},{x,y:g},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||g==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),G=Math.hypot(h-x,b-g),ee=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle4"};const ue=ht(h,b,d,_,x,g),we=ht(h,b,Q,L,D,P),Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P);if(ue<X||we<X||Qe<X||Ee<X||gi(h,b,[{x:d,y:_},{x,y:g},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,g=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"line"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const d=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,Q=p.timeScale().timeToCoordinate(d),L=f.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),g=f.priceToCoordinate(w.p2.price);if(Q==null||L==null||x==null||g==null)continue;const D=Math.hypot(h-Q,b-L),P=Math.hypot(h-x,b-g);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ht(h,b,Q,L,x,g)<X)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.originTime),Q=f.priceToCoordinate(d.price);if(Q==null)continue;if(_!=null&&Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};const L=_==null?0:Math.max(0,_);if(h>=L&&Math.abs(b-Q)<X)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.time);if(_==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-_)<X)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const d=f.priceToCoordinate(w.price);if(d==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,b-d)<H)return{object:w,mode:"line"};if(Math.abs(b-d)<X)return{object:w,mode:"line"}}}return null}const oe=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=ie(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,ne(d.object),te.current=null,ae.current=null;return}M(d.object),re(null),Z([]),te.current=d.mode,d.object.type==="rayline"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="extendedline"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="crossline"&&(d.mode==="handle1"||d.mode==="line")&&(ae.current={x:I,y:w,p:{...d.object.p}}),d.object.type==="text"&&d.mode==="line"&&(ae.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}),d.object.type==="trendbyangle"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="equidistantchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="andrewspitchfork"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="regressionchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="stddevchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="disjointchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="flattopbottom"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="fibonacci"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="gannfan"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="ganngrid"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="rectangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4"||d.mode==="handle5"||d.mode==="handle6"||d.mode==="handle7"||d.mode==="handle8")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="circle"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="triangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="ellipse"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}),d.object.type==="horizontalray"&&(d.mode==="handle1"||d.mode==="line")&&(ae.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}),d.object.type==="verticalline"&&(d.mode==="handle1"||d.mode==="line")&&(ae.current={x:I,y:w,time:d.object.primitive.time}),d.mode==="line"&&(d.object.type==="rulerline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="infoline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="arrowedline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rayline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="extendedline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="crossline"?ae.current={x:I,y:w,p:{...d.object.p}}:d.object.type==="text"?ae.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}:d.object.type==="trendbyangle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="equidistantchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="andrewspitchfork"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="regressionchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="stddevchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="disjointchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="flattopbottom"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="fibonacci"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="gannfan"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rectangle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="circle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="triangle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="ellipse"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}:d.object.type==="ganngrid"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="horizontalray"?ae.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}:d.object.type==="verticalline"?ae.current={x:I,y:w,time:d.object.primitive.time}:d.object.type==="pricelevel"?ae.current={y:w,price:d.object.price}:ae.current={x:I,y:w,point1:{...d.object.point1},point2:{...d.object.point2}})}else M(null),te.current=null,V([]),re(null),Z([])},S=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top;if(!te.current){const x=ie(I,w);if(x?.object&&!ce.current){const g=J(x.object);re(D=>D===x.object?D:x.object),Z(D=>D.length===g.length&&D.every((P,K)=>P.x===g[K].x&&P.y===g[K].y)?D:g)}else re(g=>g==null?g:null),Z(g=>g.length===0?g:[]);return}const d=ce.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=f.coordinateToPrice(w);if(_==null||Q==null)return;let L=j(_);if(L!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=K=>{const W=K.rawTime??K.time,G=K.normalizedTime??j(W);return{rawTime:W,normalizedTime:G,price:K.price}},g=(K,W)=>{const G=K.normalizedTime??j(K.rawTime),ee=W.normalizedTime??j(W.rawTime);if(G==null||ee==null)return;const ue=W.price-K.price,we=ue/Math.abs(K.price)*100,Qe=uA(de)||3600,Ee=Math.abs(ee-G),We=Math.max(1,Math.round(Ee/Qe)),qe=Math.max(1,Math.round(Ee/86400)),Ve=p.timeScale().timeToCoordinate(K.rawTime),Bt=f.priceToCoordinate(K.price),dt=p.timeScale().timeToCoordinate(W.rawTime),yt=f.priceToCoordinate(W.price),Dt=Ve!=null&&Bt!=null&&dt!=null&&yt!=null?Math.atan2(-(yt-Bt),dt-Ve)*(180/Math.PI):d.primitive?.info?.angle??0,qt={priceDiff:ue,pricePct:we,bars:We,days:qe,angle:Dt},iA=d.primitive;if(iA){iA.p1={rawTime:K.rawTime,price:K.price},iA.p2={rawTime:W.rawTime,price:W.price},iA.info=qt;try{c.current?.applyOptions({})}catch{}}const hA={...d,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:G,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:ee,price:W.price}};xe(ZA=>{const Ii=ZA.map(Os=>Os===d?hA:Os);return v.current=Ii,Ii}),M(hA),ce.current=hA,Ve!=null&&Bt!=null&&dt!=null&&yt!=null&&V([{x:Ve,y:Bt},{x:dt,y:yt}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(te.current==="handle1"){const K=p.timeScale().coordinateToTime(I)??_;g({rawTime:K,normalizedTime:L,price:Q},P)}else if(te.current==="handle2"){const K=p.timeScale().coordinateToTime(I)??_;g(D,{rawTime:K,normalizedTime:L,price:Q})}else if(te.current==="line"){const K=ae.current;if(!K)return;const W=x(K.p1),G=x(K.p2);if(W.rawTime==null||W.normalizedTime==null||G.rawTime==null||G.normalizedTime==null)return;const ee=p.timeScale().coordinateToTime(K.x)??W.rawTime,ue=f.coordinateToPrice(K.y);if(ee==null||ue==null)return;const we=j(ee)??W.normalizedTime;if(we==null)return;const Qe=L-we,Ee=Q-ue,We=j(W.normalizedTime+Qe),qe=j(G.normalizedTime+Qe);if(We==null||qe==null)return;const Ve=_-ee;g({rawTime:W.rawTime+Ve,normalizedTime:We,price:W.price+Ee},{rawTime:G.rawTime+Ve,normalizedTime:qe,price:G.price+Ee})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(g,D)=>{const P=g.normalizedTime??g.rawTime,K=D.normalizedTime??D.rawTime,W=D.price-g.price,G=W/Math.abs(g.price)*100,ee=ks(cA,g.rawTime,D.rawTime,de),ue=Math.abs(K-P),we=Math.max(1,Math.round(ue/86400)),Qe={priceDiff:W,pricePct:G,bars:ee,days:we},Ee=d.primitive;if(Ee){Ee.p1={rawTime:g.rawTime,price:g.price},Ee.p2={rawTime:D.rawTime,price:D.price},Ee.info=Qe;const yt=D.price>=g.price;Ee.color=yt?"#3b82f6":"#ef5350",Ee.fillColor=yt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const We={...d,rawP1Time:g.rawTime,rawP2Time:D.rawTime,p1:g,p2:D};xe(yt=>{const Dt=yt.map(qt=>qt===d?We:qt);return v.current=Dt,Dt}),M(We),ce.current=We;const qe=p.timeScale().timeToCoordinate(g.rawTime),Ve=f.priceToCoordinate(g.price),Bt=p.timeScale().timeToCoordinate(D.rawTime),dt=f.priceToCoordinate(D.price);qe!=null&&Ve!=null&&Bt!=null&&dt!=null&&V([{x:qe,y:Ve},{x:(qe+Bt)/2,y:(Ve+dt)/2},{x:Bt,y:dt}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;const D=j(g);if(D==null)return;x(d.p1,{rawTime:g,normalizedTime:D,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="crossline"&&d.p){const x=D=>{const P=d.primitive;if(P){P.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p:D};xe(ee=>{const ue=ee.map(we=>we===d?K:we);return v.current=ue,ue}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(D.rawTime),G=f.priceToCoordinate(D.price);W!=null&&G!=null&&V([{x:W,y:G}])},g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=f.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const g=c.current?c.current.paneSize().width:400,D=f.priceToCoordinate(x);D!=null&&V([{x:g/2,y:D}]);const P={...d,price:x};xe(K=>{const W=K.map(G=>G===d?P:G);return v.current=W,W}),M(P),ce.current=P;return}if(d.type==="text"){const x=p.timeScale().coordinateToTime(I);if(x==null)return;const g=d.primitive;if(g){g.rawTime=x,g.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"||te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(g,D,P)=>{const K=np(g,D,P);if(!K)return;const W=d.primitive;if(W){W.p1={rawTime:g.rawTime,price:g.price},W.p2={rawTime:D.rawTime,price:D.price},W.b1={rawTime:K.b1.rawTime,price:K.b1.price},W.b2={rawTime:K.b2.rawTime,price:K.b2.price},W.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const G={...d,p1:g,p2:D,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};xe(ee=>{const ue=ee.map(we=>we===d?G:we);return v.current=ue,ue}),M(G),ce.current=G};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2,d.p3);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q},d.p3);return}if(te.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??j(d.p3.rawTime),price:Q});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K),ue=j(g.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const we=_-D;x({rawTime:g.p1.rawTime+we,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+we,normalizedTime:ee,price:g.p2.price+W},{rawTime:g.p3.rawTime+we,normalizedTime:ue,price:g.p3.price+W});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(g,D)=>{const P=Ar(me,g,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,intercept:P.intercept,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};xe(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L},d.p2);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(g,D)=>{const P=Xr(me,g,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};xe(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L},d.p2);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(g,D,P)=>{const K=d.primitive;if(K){K.p1={rawTime:g.rawTime,price:g.price},K.p2={rawTime:D.rawTime,price:D.price},K.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:g,p2:D,p3:P};xe(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2,d.p3);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q},d.p3);return}if(te.current==="handle3"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,d.p2,{rawTime:g,normalizedTime:L,price:Q});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K),ue=j(g.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const we=_-D;x({rawTime:g.p1.rawTime+we,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+we,normalizedTime:ee,price:g.p2.price+W},{rawTime:g.p3.rawTime+we,normalizedTime:ue,price:g.p3.price+W});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,ee,ue)=>{const we=d.primitive;if(we){we.p1={rawTime:W.rawTime,price:W.price},we.p2={rawTime:G.rawTime,price:G.price},we.p3={rawTime:ee.rawTime,price:ee.price},we.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Qe={...d,p1:W,p2:G,p3:ee,p4:ue};xe(Ee=>{const We=Ee.map(qe=>qe===d?Qe:qe);return v.current=We,We}),M(Qe),ce.current=Qe},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;const K=(W,G,ee,ue)=>{const we=W.normalizedTime??j(W.rawTime);if(we==null)return null;const Qe=j(we+ee);return Qe==null?null:{rawTime:W.rawTime+G,normalizedTime:Qe,price:W.price+ue}};if(te.current==="line"){const W=p.timeScale().coordinateToTime(g.x),G=f.coordinateToPrice(g.y);if(W==null||G==null)return;const ee=j(W);if(ee==null)return;const ue=D-W,we=P-ee,Qe=Q-G,Ee=K(g.p1,ue,we,Qe),We=K(g.p2,ue,we,Qe),qe=K(g.p3,ue,we,Qe),Ve=K(g.p4,ue,we,Qe);if(!Ee||!We||!qe||!Ve)return;x(Ee,We,qe,Ve);return}if(te.current==="handle1"){const W=(g.p1.price+g.p2.price)/2,G={rawTime:D,normalizedTime:P,price:Q},ee={rawTime:D,normalizedTime:P,price:2*W-Q};x(G,ee,g.p3,g.p4);return}if(te.current==="handle3"){const W=(g.p3.price+g.p4.price)/2,G={rawTime:D,normalizedTime:P,price:Q},ee={rawTime:D,normalizedTime:P,price:2*W-Q};x(g.p1,g.p2,G,ee);return}if(te.current==="handle2"){const W=(g.p1.price+g.p2.price)/2,G={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:Q};if(G.normalizedTime==null)return;const ee={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:2*W-Q};if(ee.normalizedTime==null)return;x(ee,G,g.p3,g.p4);return}if(te.current==="handle4"){const W=Q-g.p4.price,G={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??j(g.p3.rawTime),price:g.p4.price+W};if(G.normalizedTime==null)return;const ee={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:g.p2.price+W};if(ee.normalizedTime==null)return;x(g.p1,ee,g.p3,G);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,ee,ue)=>{const we=d.primitive;if(we){we.p1={rawTime:W.rawTime,price:W.price},we.p2={rawTime:G.rawTime,price:G.price},we.p3={rawTime:ee.rawTime,price:ee.price},we.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Qe={...d,p1:W,p2:G,p3:ee,p4:ue};xe(Ee=>{const We=Ee.map(qe=>qe===d?Qe:qe);return v.current=We,We}),M(Qe),ce.current=Qe},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;const K=(W,G,ee,ue)=>{const we=W.normalizedTime??j(W.rawTime);if(we==null)return null;const Qe=j(we+ee);return Qe==null?null:{rawTime:W.rawTime+G,normalizedTime:Qe,price:W.price+ue}};if(te.current==="line"){const W=p.timeScale().coordinateToTime(g.x),G=f.coordinateToPrice(g.y);if(W==null||G==null)return;const ee=j(W);if(ee==null)return;const ue=D-W,we=P-ee,Qe=Q-G,Ee=K(g.p1,ue,we,Qe),We=K(g.p2,ue,we,Qe),qe=K(g.p3,ue,we,Qe),Ve=K(g.p4,ue,we,Qe);if(!Ee||!We||!qe||!Ve)return;x(Ee,We,qe,Ve);return}if(te.current==="handle1"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:g.p2.price};x(W,G,g.p3,g.p4);return}if(te.current==="handle3"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:g.p4.price};x(g.p1,g.p2,W,G);return}if(te.current==="handle2"||te.current==="handle4"){const W=te.current==="handle2"?g.p2:g.p4,G=Q-W.price,ee={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:g.p2.price+G},ue={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??j(g.p3.rawTime),price:g.p4.price+G};if(ee.normalizedTime==null||ue.normalizedTime==null)return;x(g.p1,ee,g.p3,ue);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(dt,yt)=>{const Dt=d.primitive;if(Dt){Dt.p1={rawTime:dt.rawTime,price:dt.price},Dt.p2={rawTime:yt.rawTime,price:yt.price};try{c.current?.applyOptions({})}catch{}}const qt={...d,p1:dt,p2:yt};xe(iA=>{const hA=iA.map(ZA=>ZA===d?qt:ZA);return v.current=hA,hA}),M(qt),ce.current=qt},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;if(te.current==="line"){const dt=p.timeScale().coordinateToTime(g.x),yt=f.coordinateToPrice(g.y);if(dt==null||yt==null)return;const Dt=j(dt);if(Dt==null)return;const qt=P-Dt,iA=Q-yt,hA=j(g.p1.normalizedTime+qt),ZA=j(g.p2.normalizedTime+qt);if(hA==null||ZA==null)return;const Ii=_-dt;x({rawTime:g.p1.rawTime+Ii,normalizedTime:hA,price:g.p1.price+iA},{rawTime:g.p2.rawTime+Ii,normalizedTime:ZA,price:g.p2.price+iA});return}const K=Math.min(g.p1.normalizedTime,g.p2.normalizedTime),W=Math.max(g.p1.normalizedTime,g.p2.normalizedTime),G=Math.max(g.p1.price,g.p2.price),ee=Math.min(g.p1.price,g.p2.price),ue=g.p1.normalizedTime<=g.p2.normalizedTime?g.p1.rawTime:g.p2.rawTime,we=g.p1.normalizedTime<=g.p2.normalizedTime?g.p2.rawTime:g.p1.rawTime;let Qe=K,Ee=W,We=G,qe=ee,Ve=ue,Bt=we;if((te.current==="handle1"||te.current==="handle4"||te.current==="handle6")&&(Qe=P,Ve=D),(te.current==="handle3"||te.current==="handle5"||te.current==="handle8")&&(Ee=P,Bt=D),(te.current==="handle1"||te.current==="handle2"||te.current==="handle3")&&(We=Q),(te.current==="handle6"||te.current==="handle7"||te.current==="handle8")&&(qe=Q),Qe>Ee){const dt=Qe,yt=Ve;Qe=Ee,Ve=Bt,Ee=dt,Bt=yt}if(We<qe){const dt=We;We=qe,qe=dt}x({rawTime:Ve,normalizedTime:Qe,price:We},{rawTime:Bt,normalizedTime:Ee,price:qe});return}if(d.type==="circle"&&d.p1&&d.p2){const x=(We,qe)=>{const Ve=d.primitive;if(Ve){Ve.p1={rawTime:We.rawTime,price:We.price},Ve.p2={rawTime:qe.rawTime,price:qe.price};try{c.current?.applyOptions({})}catch{}}const Bt={...d,p1:We,p2:qe};xe(dt=>{const yt=dt.map(Dt=>Dt===d?Bt:Dt);return v.current=yt,yt}),M(Bt),ce.current=Bt},g=p.timeScale().coordinateToTime(I);if(g==null)return;const D=j(g);if(D==null)return;if(te.current==="handle2"){x(d.p1,{rawTime:g,normalizedTime:D,price:Q});return}const P=ae.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=f.coordinateToPrice(P.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=D-G,ue=Q-W,we=j(P.p1.normalizedTime+ee),Qe=j(P.p2.normalizedTime+ee);if(we==null||Qe==null)return;const Ee=_-K;x({rawTime:P.p1.rawTime+Ee,normalizedTime:we,price:P.p1.price+ue},{rawTime:P.p2.rawTime+Ee,normalizedTime:Qe,price:P.p2.price+ue});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(Ve,Bt,dt)=>{const yt=d.primitive;if(yt){yt.p1={rawTime:Ve.rawTime,price:Ve.price},yt.p2={rawTime:Bt.rawTime,price:Bt.price},yt.p3={rawTime:dt.rawTime,price:dt.price};try{c.current?.applyOptions({})}catch{}}const Dt={...d,p1:Ve,p2:Bt,p3:dt};xe(qt=>{const iA=qt.map(hA=>hA===d?Dt:hA);return v.current=iA,iA}),M(Dt),ce.current=Dt},g=p.timeScale().coordinateToTime(I);if(g==null)return;const D=j(g);if(D==null)return;if(te.current==="handle1"){x({rawTime:g,normalizedTime:D,price:Q},d.p2,d.p3);return}if(te.current==="handle2"){x(d.p1,{rawTime:g,normalizedTime:D,price:Q},d.p3);return}if(te.current==="handle3"){x(d.p1,d.p2,{rawTime:g,normalizedTime:D,price:Q});return}const P=ae.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=f.coordinateToPrice(P.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=D-G,ue=Q-W,we=_-K,Qe=Ve=>{const Bt=Ve.normalizedTime??j(Ve.rawTime);if(Bt==null)return null;const dt=j(Bt+ee);return dt==null?null:{rawTime:Ve.rawTime+we,normalizedTime:dt,price:Ve.price+ue}},Ee=Qe(P.p1),We=Qe(P.p2),qe=Qe(P.p3);if(!Ee||!We||!qe)return;x(Ee,We,qe);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(K,W,G=d.minorRatio??.45)=>{const ee=d.primitive;if(ee){ee.p1={rawTime:K.rawTime,price:K.price},ee.p2={rawTime:W.rawTime,price:W.price},ee.minorRatio=Math.max(.05,G);try{c.current?.applyOptions({})}catch{}}const ue={...d,p1:K,p2:W,minorRatio:Math.max(.05,G)};xe(we=>{const Qe=we.map(Ee=>Ee===d?ue:Ee);return v.current=Qe,Qe}),M(ue),ce.current=ue},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;if(te.current==="line"){const K=p.timeScale().coordinateToTime(g.x),W=f.coordinateToPrice(g.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=P-G,ue=Q-W,we=j(g.p1.normalizedTime+ee),Qe=j(g.p2.normalizedTime+ee);if(we==null||Qe==null)return;const Ee=_-K;x({rawTime:g.p1.rawTime+Ee,normalizedTime:we,price:g.p1.price+ue},{rawTime:g.p2.rawTime+Ee,normalizedTime:Qe,price:g.p2.price+ue},g.minorRatio??d.minorRatio??.45);return}if(te.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(te.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(te.current==="handle2"||te.current==="handle4"){const K=p.timeScale().timeToCoordinate(d.p1.rawTime),W=f.priceToCoordinate(d.p1.price),G=p.timeScale().timeToCoordinate(d.p2.rawTime),ee=f.priceToCoordinate(d.p2.price);if(K==null||W==null||G==null||ee==null)return;const ue=(K+G)/2,we=(W+ee)/2,Qe=G-K,Ee=ee-W,We=Math.hypot(Qe,Ee);if(We<.001)return;const qe=-Ee/We,Ve=Qe/We,Bt=Math.abs((I-ue)*qe+(w-we)*Ve),dt=Math.max(.05,Bt*2/We);x(d.p1,d.p2,dt);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const g={...d,time:j(_),rawTime:_};xe(P=>{const K=P.map(W=>W===d?g:W);return v.current=K,K}),M(g),ce.current=g;const D=p.timeScale().timeToCoordinate(_);D!=null&&V([{x:D,y:x.midYCss??200}]),c.current?.applyOptions({});return}if(d.type==="horizontalray"&&d.primitive){const x=d.primitive,g=ae.current;if(!g)return;if(te.current==="handle1"){if(x.price=Q,x.originTime=_,d.priceLine)try{d.priceLine.applyOptions({price:Q,title:d.showPrice!==!1?Q.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=Q,d.textPrimitive.originTime=_);const D={...d,price:x.price,originTime:x.originTime,rawOriginTime:_};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D,c.current?.applyOptions({})}else if(te.current==="line"){const D=f.coordinateToPrice(g.y);if(D==null)return;const P=Q-D;if(x.price=g.price+P,d.priceLine)try{d.priceLine.applyOptions({price:x.price,title:d.showPrice!==!1?x.price.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=x.price);const K={...d,price:x.price};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(te.current==="handle1"){const x={time:L,price:Q},g=WA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);g.length>0&&d.series.setData(g),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D}else if(te.current==="handle2"){const x={time:L,price:Q},g=WA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);g.length>0&&d.series.setData(g),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D}else if(te.current==="line"){const x=ae.current;if(!x)return;const g=p.timeScale().coordinateToTime(x.x),D=f.coordinateToPrice(x.y);if(g==null||D==null)return;const P=L-g,K=Q-D,W={time:j(x.point1.time+P),price:x.point1.price+K},G={time:j(x.point2.time+P),price:x.point2.price+K},ee=WA([{time:W.time,value:W.price},{time:G.time,value:G.price}]);ee.length>0&&d.series.setData(ee),d.decoration&&(d.decoration.p1=W,d.decoration.p2=G);const ue={...d,point1:W,point2:G};xe(we=>{const Qe=we.map(Ee=>Ee===d?ue:Ee);return v.current=Qe,Qe}),M(ue),ce.current=ue}}}},O=()=>{te.current=null,ae.current=null},Y=()=>{te.current||ce.current||(re(null),Z([]))},B={capture:!0,passive:!1};return k.addEventListener("mousedown",oe,B),k.addEventListener("mousemove",S,B),k.addEventListener("mouseup",O,B),k.addEventListener("mouseleave",Y,B),()=>{k.removeEventListener("mousedown",oe,B),k.removeEventListener("mousemove",S,B),k.removeEventListener("mouseup",O,B),k.removeEventListener("mouseleave",Y,B)}},[ve,me,Ke,xe]),q.useEffect(()=>{const p=c.current,f=u.current;if(!p||!f)return;const k=()=>{const H=R;if(!H){V([]);return}const X=p.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const J=H.p1.rawTime??H.p1.time,ie=H.p2.rawTime??H.p2.time,oe=X.timeToCoordinate(J),S=f.priceToCoordinate(H.p1.price),O=X.timeToCoordinate(ie),Y=f.priceToCoordinate(H.p2.price);oe!=null&&S!=null&&O!=null&&Y!=null?V([{x:oe,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:(J+oe)/2,y:(ie+S)/2},{x:oe,y:S}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="crossline"&&H.p){const J=X.timeToCoordinate(H.p.rawTime),ie=f.priceToCoordinate(H.p.price);J!=null&&ie!=null?V([{x:J,y:ie}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const J=X.timeToCoordinate(H.rawTime),ie=f.priceToCoordinate(H.price);J!=null&&ie!=null?V([{x:J,y:ie}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.b1.rawTime),Y=f.priceToCoordinate(H.b1.price),B=X.timeToCoordinate(H.b2.rawTime),h=f.priceToCoordinate(H.b2.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ie},{x:oe,y:S},{x:(O+B)/2,y:(Y+h)/2}]):V([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ie},{x:oe,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ie},{x:oe,y:S},{x:O,y:Y},{x:B,y:h}]):V([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ie},{x:oe,y:S},{x:O,y:Y},{x:B,y:h}]):V([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ie=f.priceToCoordinate(H.point1.price),oe=X.timeToCoordinate(H.point2.time),S=f.priceToCoordinate(H.point2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ie=f.priceToCoordinate(H.point1.price),oe=X.timeToCoordinate(H.point2.time),S=f.priceToCoordinate(H.point2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:(J+oe)/2,y:(ie+S)/2},{x:oe,y:S}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);if(J!=null&&ie!=null&&oe!=null&&S!=null){const O=Math.min(J,oe),Y=Math.max(J,oe),B=Math.min(ie,S),h=Math.max(ie,S),b=(O+Y)/2,I=(B+h)/2;V([{x:O,y:B},{x:b,y:B},{x:Y,y:B},{x:O,y:I},{x:Y,y:I},{x:O,y:h},{x:b,y:h},{x:Y,y:h}])}else V([]);return}if(H.type==="circle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ie},{x:oe,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);if(J!=null&&ie!=null&&oe!=null&&S!=null){const O=(J+oe)/2,Y=(ie+S)/2,B=oe-J,h=S-ie,b=Math.hypot(B,h);if(b<.001){V([]);return}const I=B/b,w=h/b,d=-w,_=I,Q=b/2,L=Q*Math.max(.05,H.minorRatio??.45);V([{x:O-I*Q,y:Y-w*Q},{x:O+d*L,y:Y+_*L},{x:O+I*Q,y:Y+w*Q},{x:O-d*L,y:Y-_*L}])}else V([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const J=H.primitive,ie=X.timeToCoordinate(J.originTime),oe=f.priceToCoordinate(J.price);ie!=null&&oe!=null?V([{x:ie,y:oe}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const J=H.primitive,ie=X.timeToCoordinate(J.time);if(ie!=null){const oe=J.midYCss??200;V([{x:ie,y:oe}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const J=u.current?.priceToCoordinate(H.price);if(J!=null){const ie=c.current?c.current.paneSize().width:400;V([{x:ie/2,y:J}])}else V([]);return}V([])};k();const ge=p.timeScale();return ge.subscribeVisibleTimeRangeChange(k),()=>{ge.unsubscribeVisibleTimeRangeChange(k)}},[R]),q.useEffect(()=>{let p=!1;v.current.forEach(f=>{if(f.type==="verticalline"&&f.primitive){const k=f===R||f===Ae;f.primitive.showDot!==k&&(f.primitive.showDot=k,p=!0)}}),p&&c.current?.applyOptions({})},[R,Ae]),q.useEffect(()=>{let p=!1;v.current.forEach(f=>{if((f.type==="infoline"||f.type==="rulerline"||f.type==="arrowedline"||f.type==="rayline"||f.type==="extendedline"||f.type==="trendbyangle")&&f.primitive){const k=f===R||f===Ae;f.primitive.isActive!==k&&(f.primitive.isActive=k,p=!0)}}),p&&c.current?.applyOptions({})},[R,Ae]),q.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:_e}),p.priceLine){const f=_e&&p.showPrice!==!1;p.priceLine.applyOptions(_e?{color:p.lineColor??"#3b82f6",axisLabelVisible:f,title:f&&typeof p.price=="number"?p.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(p.type==="fibonacci"&&p.primitive){p.primitive.visible=_e;try{c.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=_e;try{c.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:_e}),p.parallelLine&&p.parallelLine.applyOptions({visible:_e}),p.firstLine&&p.firstLine.applyOptions({visible:_e}),p.secondLine&&p.secondLine.applyOptions({visible:_e})),(p.type==="horizontalray"||p.type==="verticalline"||p.type==="infoline"||p.type==="rulerline"||p.type==="arrowedline"||p.type==="rayline"||p.type==="extendedline"||p.type==="crossline"||p.type==="trendbyangle"||p.type==="equidistantchannel"||p.type==="regressionchannel"||p.type==="stddevchannel"||p.type==="gannfan"||p.type==="ganngrid"||p.type==="andrewspitchfork"||p.type==="disjointchannel"||p.type==="flattopbottom"||p.type==="circle"||p.type==="triangle"||p.type==="ellipse"||p.type==="text")&&p.primitive){p.primitive.visible=_e;try{c.current?.applyOptions({})}catch{}}})},[_e,Ke]),q.useEffect(()=>{!_e&&R&&(M(null),V([]))},[_e,R]),q.useEffect(()=>{if(v.current.length>Ke.length){const p=v.current.filter((f,k)=>!Ke.includes(f));R&&p.some(f=>f===R)&&(M(null),V([])),p.forEach(f=>{if(f.series&&c.current?.removeSeries(f.series),f.priceLine&&u.current?.removePriceLine(f.priceLine),f.textPrimitive)try{u.current?.detachPrimitive(f.textPrimitive)}catch{}if(f.type==="horizontalray"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="verticalline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="infoline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rulerline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="arrowedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rayline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="extendedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="crossline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="trendbyangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="equidistantchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="regressionchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="stddevchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="gannfan"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ganngrid"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="andrewspitchfork"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="disjointchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="flattopbottom"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="fibonacci"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rectangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="circle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="triangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ellipse"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="text"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="parallellines")try{f.baseLine&&c.current?.removeSeries(f.baseLine),f.parallelLine&&c.current?.removeSeries(f.parallelLine),f.firstLine&&c.current?.removeSeries(f.firstLine),f.secondLine&&c.current?.removeSeries(f.secondLine)}catch{}}),v.current=Ke}},[Ke,R]),q.useEffect(()=>{const p=u.current;return p?(Tt.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Tt.current=[],De.filter(k=>k.symbol===Ce).forEach(k=>{const ge=parseFloat(k.openPrice??k.price),X=k.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(fA&&!isNaN(ge)&&Tt.current.push(p.createPriceLine({price:ge,color:X,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${k.type} ${k.volume}`})),at){const J=parseFloat(k.stopLoss),ie=parseFloat(k.takeProfit);!isNaN(J)&&J>0&&Tt.current.push(p.createPriceLine({price:J,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(ie)&&ie>0&&Tt.current.push(p.createPriceLine({price:ie,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{Tt.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Tt.current=[]}):void 0},[De,Ce,fA,at]),q.useEffect(()=>{const p=u.current;if(!p||!it)return;const f=parseFloat(XA?.ask);if(isNaN(f)||f<=0)return;let k;try{k=p.createPriceLine({price:f,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(k)try{p.removePriceLine(k)}catch{}}},[it,XA]),q.useEffect(()=>{const p=o.current;if(!p)return;const f=k=>{if(se.current){se.current=!1;return}if(T.current||!c.current)return;const ge=c.current,H=u.current;if(ge&&H&&v.current.length>0){const X=p.getBoundingClientRect(),J=k.clientX-X.left,ie=k.clientY-X.top,oe=15;for(let S=v.current.length-1;S>=0;S--){const O=v.current[S];let Y=!1;if(O.type==="text"&&O.rawTime!=null&&O.price!=null){const B=ge.timeScale().timeToCoordinate(O.rawTime),h=H.priceToCoordinate(O.price);if(B!=null&&h!=null){const b=ip(O,B,h);J>=b.left&&J<=b.right&&ie>=b.top&&ie<=b.bottom&&(Y=!0)}}else if(O.point1&&O.point2){const B=ge.timeScale().timeToCoordinate(O.point1.time??O.point1.rawTime),h=H.priceToCoordinate(O.point1.price),b=ge.timeScale().timeToCoordinate(O.point2.time??O.point2.rawTime),I=H.priceToCoordinate(O.point2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.hypot(J-B,ie-h),d=Math.hypot(J-b,ie-I),_=(B+b)/2,Q=(h+I)/2,L=Math.hypot(J-_,ie-Q);(w<oe||d<oe||L<oe)&&(Y=!0)}}else if(O.p1&&O.p2){const B=ge.timeScale().timeToCoordinate(O.p1.rawTime),h=H.priceToCoordinate(O.p1.price),b=ge.timeScale().timeToCoordinate(O.p2.rawTime),I=H.priceToCoordinate(O.p2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.min(B,b),d=Math.max(B,b),_=Math.min(h,I),Q=Math.max(h,I);J>=w-5&&J<=d+5&&ie>=_-5&&ie<=Q+5&&(Y=!0)}}else if(O.p){const B=ge.timeScale().timeToCoordinate(O.p.rawTime),h=H.priceToCoordinate(O.p.price);B!=null&&h!=null&&Math.hypot(J-B,ie-h)<oe&&(Y=!0)}else if(O.type==="pricelevel"&&O.price!=null){const B=H.priceToCoordinate(O.price);B!=null&&Math.abs(ie-B)<oe&&(Y=!0)}if(Y){k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),ne(O);return}}}k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;ap(c.current,me,de)||c.current.timeScale().fitContent();const J=c.current.timeScale().getVisibleRange();Te(J)},80)};return p.addEventListener("dblclick",f,!0),()=>{p.removeEventListener("dblclick",f,!0)}},[me,de]);const mp=R??Ae,wp=R?$:he,GT=_e&&uT(mp,wp),$T=dT(mp?.type);q.useEffect(()=>{const p=o.current,f=l.current;if(!p||!f)return;const k=80,ge=X=>{const J=p.getBoundingClientRect();f.style.opacity=J.bottom-X.clientY<=k?"1":"0"},H=()=>{f.style.opacity="0"};return p.addEventListener("mousemove",ge),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",ge),p.removeEventListener("mouseleave",H)}},[]);const XT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*.8;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},[Te]),JT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*1.25;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},[Te]),ZT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const k=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from-k,to:f.to-k})}catch{}},[]),YT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const k=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from+k,to:f.to+k})}catch{}},[]),qT=q.useCallback(()=>{if(!c.current)return;ap(c.current,me,de)||c.current.timeScale().fitContent();const f=c.current.timeScale().getVisibleRange();Te(f)},[me,de,Te]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${nt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:ve===1||ve!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Pe&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof Ce=="object"?Ce?.symbol:Ce,"..."]})]})}),!Pe&&Ne&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:nt==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:nt==="light"?"#64748b":"#94a3b8"},children:Ne})]})}),!Pe&&!Ne&&me.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:nt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof Ce=="object"?Ce?.symbol:Ce]})})}),$A&&me.length>0&&(()=>{const p=me[me.length-1],f=k=>{const ge=Number(k);return Number.isFinite(ge)?ge>=100?ge.toFixed(2):ge.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:nt==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:nt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:f(p?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:f(p?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:nt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.close)})]})]})})(),(A||Ct)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Oh,{bidPrice:e,askPrice:t,onBuyClick:KT,onSellClick:VT})}),a.jsx(Kh,{isOpen:Je,onClose:zT,orderType:tt,bidPrice:e,askPrice:t}),a.jsx(Gh,{isOpen:z!==null,onClose:()=>ne(null),chartObject:z,onUpdate:WT}),Pe&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),GT&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:wp.map((p,f)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:p.x-5,top:p.y-5,backgroundColor:$T}},f))}),a.jsx("div",{ref:l,style:{position:"absolute",bottom:"50px",left:"50%",transform:"translateX(-50%)",zIndex:30,display:"flex",alignItems:"center",gap:"4px",opacity:0,pointerEvents:"all",transition:"opacity 200ms"},children:[{title:"Zoom out",onClick:JT,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})})},{title:"Zoom in",onClick:XT,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[a.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})},{title:"Scroll left",onClick:ZT,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"8,3 4,7 8,11"})})},{title:"Scroll right",onClick:YT,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:qT,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:p,onClick:f,icon:k})=>a.jsx("button",{title:p,onClick:f,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:nt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:nt==="light"?"#374151":"#94a3b8",border:"1px solid "+(nt==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:ge=>{ge.currentTarget.style.backgroundColor=nt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",ge.currentTarget.style.color=nt==="light"?"#111827":"#e2e8f0"},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=nt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",ge.currentTarget.style.color=nt==="light"?"#374151":"#94a3b8"},children:k},p))})]})})}),Ft={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function lp({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Vt(),[s,o]=q.useState(!1),[l,c]=q.useState(""),[u,m]=q.useState(-1),y=q.useRef(null),v=q.useRef(null);q.useEffect(()=>{const E=N=>{y.current&&!y.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),q.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const T=r.filter(E=>E.symbol.toLowerCase().includes(l.toLowerCase())),C=T.filter(E=>!E.symbol.endsWith("USDT")),U=T.filter(E=>E.symbol.endsWith("USDT")),F=E=>{A(E),o(!1),c("")};return r.find(E=>E.symbol===t),a.jsxs("div",{ref:y,style:{...Ft.container,...i},className:e,children:[a.jsxs("button",{style:Ft.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,Ft.buttonHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Ft.arrow,...s?Ft.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Ft.dropdown,children:[a.jsx("div",{style:Ft.searchContainer,children:a.jsx("input",{ref:v,style:Ft.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:E=>c(E.target.value)})}),a.jsx("div",{style:Ft.list,children:T.length===0?a.jsx("div",{style:Ft.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Forex & Metals"}),C.map(E=>a.jsxs("div",{style:{...Ft.item,...E.symbol===t?Ft.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(E.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Crypto"}),U.map(E=>a.jsxs("div",{style:{...Ft.item,...E.symbol===t?Ft.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(E.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const RA={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},BT=[.01,.05,.1,.5,1];function cp({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=BT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[m,y]=q.useState(.1),v=i!==void 0?i:m,T=q.useCallback(E=>{const N=Math.max(t,Math.min(A,parseFloat(E)||t)),R=Math.round(N/r)*r,M=parseFloat(R.toFixed(8));i!==void 0||y(M),e?.(M)},[t,A,r,i,e]),C=()=>T(v+r),U=()=>T(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...RA.container,...c},className:u,children:[o&&a.jsx("span",{style:RA.label,children:l}),a.jsx("button",{style:RA.btn,onClick:U,onMouseEnter:E=>Object.assign(E.currentTarget.style,RA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:RA.input,type:"text",value:F,onChange:E=>{const N=E.target.value;if(N===""||N==="."||N==="0.")return;const R=parseFloat(N);isNaN(R)||T(R)},onBlur:()=>T(v)}),a.jsx("button",{style:RA.btn,onClick:C,onMouseEnter:E=>Object.assign(E.currentTarget.style,RA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:RA.presets,children:n.map(E=>a.jsx("button",{style:{...RA.preset,...Math.abs(v-E)<1e-4?RA.presetActive:{}},onClick:()=>T(E),onMouseEnter:N=>{Math.abs(v-E)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(v-E)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:E},E))})]})}const aA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function hp({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:u,className:m}){const{currentSymbolData:y}=Vt(),[v,T]=q.useState(""),[C,U]=q.useState(!1),[F,E]=q.useState("price"),N=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=q.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ne=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){$(he);return}const Z=parseFloat(he);isNaN(Z)||$(he)},Ae=M==="price"?y?.bid?parseFloat(y.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...aA.container,...u},className:m,children:[l&&a.jsx("span",{style:aA.label,children:c}),s&&a.jsx("button",{style:{...aA.toggle,...R?aA.toggleOn:aA.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...aA.toggleKnob,...R?aA.knobOn:aA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:aA.inputGroup,children:[a.jsx("input",{style:aA.input,type:"text",value:N,onChange:V,placeholder:Ae,onFocus:re=>re.currentTarget.style.borderColor="#EF5350",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...aA.modeBtn,...M==="price"?aA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...aA.modeBtn,...M==="pips"?aA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const lA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function up({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:u,className:m}){const{currentSymbolData:y}=Vt(),[v,T]=q.useState(""),[C,U]=q.useState(!1),[F,E]=q.useState("price"),N=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=q.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ne=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){$(he);return}const Z=parseFloat(he);isNaN(Z)||$(he)},Ae=M==="price"?y?.ask?parseFloat(y.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...lA.container,...u},className:m,children:[l&&a.jsx("span",{style:lA.label,children:c}),s&&a.jsx("button",{style:{...lA.toggle,...R?lA.toggleOn:lA.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...lA.toggleKnob,...R?lA.knobOn:lA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:lA.inputGroup,children:[a.jsx("input",{style:lA.input,type:"text",value:N,onChange:V,placeholder:Ae,onFocus:re=>re.currentTarget.style.borderColor="#26A69A",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...lA.modeBtn,...M==="price"?lA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...lA.modeBtn,...M==="pips"?lA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const yT=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],GA={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function dp({showLabel:i=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:u,chartObjects:m,setChartObjects:y}=Vt(),[v,T]=q.useState(null),C=A||yT,U=N=>{l(o===N?null:N)},F=()=>{y([]),l(null)},E=()=>{u(!c)};return a.jsxs("div",{style:{...GA.container,...n},className:s,children:[i&&a.jsx("span",{style:GA.label,children:r}),C.map(N=>a.jsxs("button",{style:{...GA.btn,...o===N.id?GA.btnActive:{}},onClick:()=>U(N.id),onMouseEnter:R=>{T(N.id),o!==N.id&&Object.assign(R.currentTarget.style,GA.btnHover)},onMouseLeave:R=>{T(null),o!==N.id&&(R.currentTarget.style.borderColor="#334155",R.currentTarget.style.backgroundColor="#1e293b",R.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,v===N.id&&a.jsx("div",{style:GA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:GA.divider}),t&&a.jsx("button",{style:{...GA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:E,onMouseEnter:N=>{N.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:GA.deleteBtn,onClick:F,onMouseEnter:N=>Object.assign(N.currentTarget.style,GA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const pp={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function CT({showCoinSelector:i=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:u,onStopLossEnabledChange:m,takeProfit:y,onTakeProfitChange:v,takeProfitEnabled:T,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:E={},takeProfitProps:N={},drawingToolsProps:R={},style:M,className:z}){const ne=[];i&&ne.push(a.jsx(lp,{...U},"coin")),e&&ne.push(a.jsx(cp,{value:s,onChange:o,...F},"volume")),t&&ne.push(a.jsx(hp,{value:l,onChange:c,enabled:u,onEnabledChange:m,...E},"sl")),A&&ne.push(a.jsx(up,{value:y,onChange:v,enabled:T,onEnabledChange:C,...N},"tp")),r&&ne.push(a.jsx(dp,{...R},"draw"));const $=[];return ne.forEach((V,Ae)=>{$.push(V),n&&Ae<ne.length-1&&$.push(a.jsx("div",{style:pp.divider},`div-${Ae}`))}),a.jsx("div",{style:{...pp.toolbar,...M},className:z,children:$})}const vT=[{label:"M1",value:"M1"},{label:"M5",value:"M5"},{label:"M15",value:"M15"},{label:"M30",value:"M30"},{label:"H1",value:"H1"},{label:"H4",value:"H4"},{label:"D1",value:"D1"},{label:"W1",value:"W1"}],tl={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function TT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Vt();return a.jsx("div",{style:{...tl.container,...i},className:e,children:vT.map(r=>a.jsx("button",{style:{...tl.btn,...t===r.value?tl.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},children:r.label},r.value))})}const xT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Al={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function bT({style:i,className:e}){const{chartType:t,setChartType:A}=Vt();return a.jsx("div",{style:{...Al.container,...i},className:e,children:xT.map(r=>a.jsxs("button",{style:{...Al.btn,...t===r.value?Al.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const AA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function QT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Vt(),[u,m]=q.useState(null),y=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),T=v>0&&y>0?Math.abs(v-y):0,C=E=>!E||E===0?"-.-----":E>=1e3?E.toFixed(2):E>=1?E.toFixed(4):E.toFixed(5),U=E=>E===0?"-":E>=1?E.toFixed(1):E>=.01?E.toFixed(3):(E*1e4).toFixed(1)+"p",F=q.useCallback(E=>{if(!s)return;const N=E==="BUY"?v:y;if(!N||N<=0){m({type:"error",message:"No price available"});return}const R={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:E,volume:i,price:N,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(z=>[...z,R]);const M=i*N*.01;c(z=>z-M),m({type:"success",message:`${E} executed`}),A?.(R),setTimeout(()=>m(null),3e3)},[s,v,y,i,e,t,l,c,A]);return a.jsxs("div",{style:{...AA.container,...r},className:n,children:[a.jsx("button",{style:AA.sellBtn,onClick:()=>F("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,AA.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...AA.priceValue,color:"#EF5350"},children:C(y)})]}),a.jsxs("div",{style:AA.spread,children:[a.jsx("span",{style:AA.spreadLabel,children:"Spread"}),a.jsx("span",{style:AA.spreadValue,children:U(T)})]}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...AA.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:AA.buyBtn,onClick:()=>F("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,AA.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...AA.status,backgroundColor:u.type==="success"?"#14532d":"#7f1d1d",color:u.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${u.type==="success"?"#166534":"#991b1b"}`},children:u.message})]})}const ot={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function FT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Vt(),[l,c]=q.useState(null),u=A.filter(C=>C.status==="OPEN"||!C.closeAt),m=q.useCallback((C,U)=>{const F=n.find(E=>E.symbol===C);return F?U?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),y=q.useCallback(C=>{if(l)return;c(C.id);const U=m(C.symbol,C.type),E=(C.type?.toUpperCase()==="BUY"?U-C.price:C.price-U)*C.volume,N=C.volume*C.price*.01;r(R=>R.filter(M=>M.id!==C.id)),o(R=>R+N+E),c(null)},[l,m,r,o]),v=C=>{const U=parseFloat(C);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},T=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...i},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):u.map(C=>{const U=m(C.symbol,C.type),F=C.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...ot.td,...C.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:C.type}),a.jsx("td",{style:ot.td,children:C.volume}),a.jsx("td",{style:ot.td,children:v(C.price)}),a.jsx("td",{style:ot.td,children:v(U)}),a.jsx("td",{style:ot.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:T(F)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>y(C),disabled:l===C.id,onMouseEnter:E=>{l!==C.id&&(E.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d"},children:l===C.id?"...":"Close"})})]},C.id)})})]})})]})}function UT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(i)}function ST(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(i)}function ET(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(i)}function LT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(i)}const MT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:u,marketWatchOpen:m=!0,onToggleMarketWatch:y,buySellPanelOpen:v,onMove:T})=>{const{theme:C}=Vt(),U=C==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],E={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return a.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b min-w-max ${U?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${U?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
13
|
-
${A===
|
|
14
|
-
`,title:
|
|
15
|
-
${A===
|
|
16
|
-
`,title:N,children:E[N]},N))}),a.jsxs("div",{className:"flex items-center gap-2",children:[F.map(N=>a.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:N},N)),a.jsx("div",{className:`border-r h-6 mx-1 ${U?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:v?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${v?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 5v4H9c-1.054 0-1.918.816-1.995 1.85L7 11v2c0 1.105.895 2 2 2h2.5v4H4c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h7.5z"}),a.jsx("path",{fill:"#3687ED",d:"M20 5c1.105 0 2 .895 2 2v10c0 1.105-.895 2-2 2h-7.5v-4H15c1.054 0 1.918-.816 1.995-1.85L17 13v-2c0-1.105-.895-2-2-2h-2.5V5H20z"}),a.jsx("path",{fill:"#B0BEC5",d:"M10 10h4c1.105 0 2 .895 2 2s-.895 2-2 2h-4c-1.105 0-2-.895-2-2s.895-2 2-2z"})]})})}),a.jsxs("button",{onClick:n,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 4v2.02C8.42 6.276 6 8.856 6 12c0 3.145 2.42 5.725 5.5 5.98V20H10c-4.418 0-8-3.582-8-8s3.582-8 8-8h1.5z"}),a.jsx("path",{fill:"#3687ED",d:"M14 4c4.418 0 8 3.582 8 8s-3.582 8-8 8h-1.5v-2.02c3.08-.256 5.5-2.836 5.5-5.98 0-3.145-2.42-5.725-5.5-5.98V4H14z"}),a.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),a.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:s,className:`p-1 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(UT,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(ST,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:T,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>y?.(),title:m?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${m?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[a.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14Zm-1 2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h12Z"})]})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${U?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:a.jsx("path",{d:"M22 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0-4a1 1 0 0 1-1-1V4h-1a1 1 0 1 1 0-2h1a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Zm1 7v8a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-8l3.764-1s.45-.428.789-1.105l.171-.342a.998.998 0 0 1 .894-.553h4.764a1 1 0 0 1 .894.552l.171.342c.339.678.789 1.106.789 1.106L23 13Zm-8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm0 4.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3ZM16 4h-2a1 1 0 1 1 0-2h2a1 1 0 1 1 0 2Zm-6 0H8a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2ZM4 22H3a2 2 0 0 1-2-2v-1a1 1 0 1 1 2 0v1h1a1 1 0 1 1 0 2ZM4 4H3v1a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2h1a1 1 0 0 1 0 2ZM2 8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Zm0 5a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1Z"})})}),a.jsx("button",{type:"button",onClick:()=>u?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${U?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})})]})]})},Jr=[{label:"Trendline",toolId:2,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})},{label:"Horizontal Line",toolId:20,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M19 9l3 3-3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Vertical Line",toolId:22,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),a.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),a.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),a.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M5.054 17.988a2.988 2.988 0 0 1-1.31-.312 2.994 2.994 0 1 1 2.69 1.693 2.988 2.988 0 0 1-1.38-.381Zm-1 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),a.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),a.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Zr=[{label:"Regression Channel",toolId:40,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Equidistant Channel",toolId:3,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M15 8a2.966 2.966 0 0 1-1.308-.312l-6 6c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l6-6A2.992 2.992 0 1 1 15 8ZM5 14a1 1 0 1 0 0 2.001A1 1 0 0 0 5 14ZM15 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm6.714 6.666-7.026 7.026a3.03 3.03 0 1 1-1.381-1.381l7.026-7.026a.977.977 0 1 1 1.381 1.381ZM12 18a1 1 0 1 0 0 2.001A1 1 0 0 0 12 18Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"StdDev Channel",toolId:41,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.381-1.382ZM10 15H9v4a1 1 0 1 1-2 0v-1H6a1 1 0 0 1 0-2h1v-4a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm7-7h-1v4a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1V5a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm-4.714 12.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.382-1.382h.001Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Andrews Pitchfork",toolId:42,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m21.714 13.666-4.026 4.026c.203.406.31.854.312 1.308a3 3 0 0 1-6 0c.002-.454.11-.902.312-1.308L10 15.381l-2.312 2.311a3.03 3.03 0 1 1-1.381-1.381L8.619 14l-2.311-2.312a3 3 0 1 1-.001-5.377l4.026-4.026a.976.976 0 1 1 1.381 1.381L7.688 7.692a2.9 2.9 0 0 1 0 2.615L10 12.619l8.333-8.334a.976.976 0 1 1 1.381 1.381L11.381 14l2.312 2.312a2.9 2.9 0 0 1 2.614 0l4.026-4.026a.977.977 0 1 1 1.381 1.38ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],Yr=[{label:"Gann Line",toolId:43,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3 3 0 0 1-3 3 2.965 2.965 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l3-3a2.98 2.98 0 0 1 4-4l3-3A2.992 2.992 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2.001A1 1 0 0 0 5 18Zm7-7a1 1 0 1 0 0 2.001A1 1 0 0 0 12 11Zm7-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Fan",toolId:44,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M21.72 3.584 17.694 7.61c.202.407.31.854.312 1.308a3 3 0 0 1-3 3 2.967 2.967 0 0 1-1.308-.312l-4.45 4.45 10.109-4.042a.987.987 0 0 1 .834 1.79L8.167 18.61l7.75-.7a1.004 1.004 0 1 1 .18 2l-8.684.79a2.992 2.992 0 1 1-4.2-4.164l.794-8.7a1.004 1.004 0 1 1 2 .181L5.3 15.765 9.673 4.591a.969.969 0 0 1 1.3-.48 1 1 0 0 1 .47 1.32L7.79 14.77l4.538-4.538a2.98 2.98 0 0 1 4-4l4.026-4.026a.977.977 0 0 1 1.367 1.377ZM5.006 19.918a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm10-12a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Grid",toolId:45,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-.5.5L21 12l-3.809 3.809.5.5a3.034 3.034 0 1 1-1.381 1.381l-.5-.5L12 21l-3.809-3.809-.5.5c.202.407.308.855.309 1.309a3.03 3.03 0 1 1-1.693-2.689l.5-.5L3 12l3.81-3.81-.5-.5A2.966 2.966 0 0 1 5 8a3.031 3.031 0 1 1 2.689-1.693l.5.5L12 3l3.809 3.81.5-.5A2.993 2.993 0 1 1 19 8Zm0 12a1 1 0 1 0 0-2.002A1 1 0 0 0 19 20ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm7 14.452 2.536-2.536L12 13.381l-2.536 2.535L12 18.452ZM5.547 12l2.536 2.535L10.619 12 8.083 9.464 5.547 12ZM12 5.547 9.464 8.083 12 10.619l2.535-2.536L12 5.547Zm3.916 3.917L13.381 12l2.536 2.535L18.452 12l-2.536-2.536ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],qr=[{label:"Rectangle",toolId:5,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})},{label:"Circle",toolId:46,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12C22 10.2504 21.5507 8.60571 20.7611 7.17509C20.9149 6.81421 21 6.41704 21 6C21 4.34315 19.6569 3 18 3C17.583 3 17.1858 3.0851 16.8249 3.23888C15.3943 2.44933 13.7496 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12ZM12 20C16.4183 20 20 16.4183 20 12C20 10.8264 19.7473 9.7118 19.2933 8.70768C18.9017 8.89507 18.4631 9 18 9C17.5369 9 17.0983 8.89506 16.7066 8.70766L14.7077 10.7066C14.8951 11.0983 15 11.5369 15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.4632 9 12.9018 9.10496 13.2935 9.2924L15.2924 7.29348C15.105 6.90183 15 6.46317 15 6C15 5.5369 15.1049 5.09831 15.2923 4.7067C14.2882 4.25272 13.1736 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7Z",fill:"currentColor"})})},{label:"Triangle",toolId:47,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6C15 7.65685 13.6569 9 12 9C11.763 9 11.5324 8.97252 11.3113 8.92057L7.37081 16.1613C6.95686 15.6284 6.36717 15.2388 5.68872 15.0794L9.62925 7.83858C9.23484 7.33074 9 6.6928 9 6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6ZM13 6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.3708 7.83867C13.9569 8.37162 13.3672 8.76126 12.6887 8.9206L16.6292 16.1614C16.4344 16.4122 16.2786 16.6948 16.1707 17H7.82941C7.93996 17.3128 8.00012 17.6494 8.00012 18C8.00012 18.3506 7.93996 18.6872 7.8294 19H16.1707C16.5826 20.1652 17.6938 21 19 21C20.6569 21 22 19.6569 22 18C22 16.3431 20.6569 15 19 15C18.763 15 18.5324 15.0275 18.3113 15.0794L14.3708 7.83867ZM19 19C19.5523 19 20 18.5523 20 18C20 17.4477 19.5523 17 19 17C18.4477 17 18 17.4477 18 18C18 18.5523 18.4477 19 19 19Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00012 18C8.00012 19.6569 6.65685 21 5 21C3.34315 21 2 19.6569 2 18C2 16.3431 3.34315 15 5 15C6.65685 15 8.00012 16.3431 8.00012 18ZM6 18C6 18.5523 5.55228 19 5 19C4.44772 19 4 18.5523 4 18C4 17.4477 4.44772 17 5 17C5.55228 17 6 17.4477 6 18Z",fill:"currentColor"})]})},{label:"Ellipse",toolId:48,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3a3.001 3.001 0 0 0-2.935 2.378c-1.25.333-2.381.874-3.322 1.58a7.344 7.344 0 0 0-1.886 2.045 3 3 0 0 0 0 5.994 7.343 7.343 0 0 0 1.886 2.046C7.38 18.27 9.595 19 12 19s4.62-.73 6.257-1.957a7.343 7.343 0 0 0 1.886-2.046 3 3 0 0 0 0-5.994 7.344 7.344 0 0 0-1.886-2.046c-.94-.705-2.073-1.246-3.322-1.579A3.001 3.001 0 0 0 12 3Zm-1 3a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm7.156 3.634a5.584 5.584 0 0 0-1.1-1.077 7.61 7.61 0 0 0-2.391-1.177 3 3 0 0 1-5.33 0 7.61 7.61 0 0 0-2.392 1.177c-.437.328-.805.69-1.099 1.076A2.995 2.995 0 0 1 7 12c0 .962-.452 1.818-1.156 2.367.294.386.662.748 1.1 1.076C8.201 16.387 9.985 17 12 17c2.014 0 3.798-.613 5.057-1.557.437-.328.805-.69 1.099-1.077A2.995 2.995 0 0 1 17 12c0-.961.452-1.817 1.156-2.366ZM3 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm16 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z",fill:"currentColor"})})}],Ns=({children:i,top:e,panelRef:t,isLight:A})=>a.jsx("div",{ref:t,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${A?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:a.jsx("div",{className:"py-1",children:i})}),HT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:m,setDrawingsVisible:y,chartLocked:v,setChartLocked:T,theme:C,setTheme:U,setCandleColors:F,setShowTradeOrders:E,showTradeOrders:N,setShowTradePosition:R,showTradePosition:M,setShowTradeHistory:z,showTradeHistory:ne,setShowSLTP:$,showSLTP:V,setShowAskPrice:Ae,showAskPrice:re,setShowChartControls:he,showChartControls:Z,setShowTradeNotification:te,showTradeNotification:ae,setShowCrosshair:ce,showCrosshair:se,setShowOHLC:le,showOHLC:pe,setIsShow:Be}=Vt(),Fe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[Ue,ye]=q.useState(!1),[Te,ve]=q.useState(null),[be,Le]=q.useState(null),[Re,Ke]=q.useState(0),[xe,De]=q.useState(!1),[Ce,de]=q.useState(0),[_e,et]=q.useState(!1),[rt,nt]=q.useState(0),[ut,fA]=q.useState(!1),[Xe,ke]=q.useState(0),[at,it]=q.useState(!1),[Ct,bt]=q.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),$A=q.useRef(null),XA=q.useRef(null),Rt=q.useRef(null),gA=q.useRef(null),JA=q.useRef(null),Yt=q.useRef(null);q.useEffect(()=>{const Ie=tt=>{const $e=$A.current;Ue&&$e&&!$e.contains(tt.target)&&(ye(!1),ve(null));const me=XA.current;be==="line"&&me&&!me.contains(tt.target)&&Le(null);const ze=Rt.current;be==="channel"&&ze&&!ze.contains(tt.target)&&Le(null);const Pe=gA.current;be==="gann"&&Pe&&!Pe.contains(tt.target)&&Le(null);const At=JA.current;be==="shape"&&At&&!At.contains(tt.target)&&Le(null)};return window.addEventListener("mousedown",Ie),()=>window.removeEventListener("mousedown",Ie)},[Ue,be]),q.useEffect(()=>{const Ie=tt=>{tt.key==="Escape"&&(ye(!1),ve(null),Le(null))};return window.addEventListener("keydown",Ie),()=>window.removeEventListener("keydown",Ie)},[]);const Et=q.useMemo(()=>[{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 13H15.874C15.5122 14.4056 14.4056 15.5122 13 15.874V20C13 20.2652 12.8946 20.5196 12.7071 20.7071C12.5196 20.8946 12.2652 21 12 21C11.7348 21 11.4804 20.8946 11.2929 20.7071C11.1054 20.5196 11 20.2652 11 20V15.874C9.59439 15.5122 8.4878 14.4056 8.12602 13H4C3.73478 13 3.48043 12.8946 3.29289 12.7071C3.10536 12.5196 3 12.2652 3 12C3 11.7348 3.10536 11.4804 3.29289 11.2929C3.48043 11.1054 3.73478 11 4 11H8.12602C8.4878 9.59439 9.59439 8.4878 11 8.12602V4C11 3.73478 11.1054 3.48043 11.2929 3.29289C11.4804 3.10536 11.7348 3 12 3C12.2652 3 12.5196 3.10536 12.7071 3.29289C12.8946 3.48043 13 3.73478 13 4V8.12602C14.4056 8.4878 15.5122 9.59439 15.874 11H20C20.2652 11 20.5196 11.1054 20.7071 11.2929C20.8946 11.4804 21 11.7348 21 12C21 12.2652 20.8946 12.5196 20.7071 12.7071C20.5196 12.8946 20.2652 13 20 13ZM12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10Z",fill:"currentColor"})]})}),label:"Crosshair",description:"Precise cursor positioning for measurement on chart"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})}),label:"Trend Line",description:"Draw trend line (drag from first point to second point)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Parallel Lines",description:"Draw two parallel trend lines (draw first line, then second)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:a.jsx("path",{d:"M21 15H3a1 1 0 0 1 0-2h18a1 1 0 0 1 0 2Zm-2-3a2.99 2.99 0 0 1-2.816-2H3a1 1 0 0 1 0-2h13.184A2.995 2.995 0 1 1 19 12Zm0-4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2-3H3a1 1 0 0 1 0-2h18a1 1 0 1 1 0 2ZM5 16a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2H7.816A2.995 2.995 0 1 1 5 16Zm0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Fibonacci",description:"Draw Fibonacci retracement levels"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Rectangle",description:"Draw support/resistance zone (drag from corner to corner)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M12.76 17.958c-.504.07-1.016.07-1.52 0C6.07 17.532 2 12.932 2 12c0-.977 4.48-6 10-6s10 5.043 10 6c0 .912-4.07 5.529-9.24 5.958ZM3.63 12a11.724 11.724 0 0 0 3.03 2.741 5.963 5.963 0 0 1 .02-5.492A11.7 11.7 0 0 0 3.63 12ZM12 7.57a4.443 4.443 0 1 0-.006 8.886A4.443 4.443 0 0 0 12 7.57Zm5.31 1.652a5.954 5.954 0 0 1 .01 5.546A11.45 11.45 0 0 0 20.37 12a11.525 11.525 0 0 0-3.06-2.778ZM12 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Eye",description:"Show or hide all drawing objects on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M16 20H8a2 2 0 0 1-2-2v-7a2 2 0 0 1 1.05-1.749A1.044 1.044 0 0 1 7 9a5 5 0 0 1 8.75-3.3 1.008 1.008 0 0 1-.09 1.411 1 1 0 0 1-1.41-.09A3 3 0 0 0 9 9h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2Zm0-9H8v7h8v-7Zm-4 2a1 1 0 0 1 1 1v1a1 1 0 0 1-2 0v-1a1 1 0 0 1 1-1Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Lock",description:"Lock chart (disable pan and zoom)"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),label:"Delete",description:"Remove last drawn object from chart"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16M6 4v16M12 4v16M18 4v16"})}),label:"Grid",description:"Toggle grid display on/off for chart alignment"},{icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fill:"currentColor",d:"M12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C9.068 22 6.43 20.738 4.602 18.728L6.081 17.382C7.544 18.99 9.654 20 12 20C16.418 20 20 16.418 20 12C20 7.582 16.418 4 12 4C7.92 4 4.554 7.054 4.062 11H5.828L3 13.828L0.171997 11H2.049C2.551 5.947 6.815 2 12 2ZM13 7V12.186L16.657 15.843L15.243 17.257L11 13V7H13Z"})}),label:"History",description:"View trade history"},{icon:a.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),QA=Ie=>{const tt=Et[Ie].label;if(tt==="Menu"){ye($e=>!$e),ve(null);return}if(tt==="Grid"){s(!n);return}if(tt==="Magnet"){l(!o),r(o?null:Ie);return}if(tt==="Delete"){if(c.length>0){const $e=[...c];$e.pop(),u($e)}return}if(tt==="Eye"){y(!m);return}if(tt==="Lock"){T(!v);return}if(tt==="Light Theme"||tt==="Dark Theme"){U(C==="light"?"dark":"light"),ye(!1),ve(null);return}if(tt==="History"){Be(!0);return}r(A===Ie?null:Ie)};Et.slice(0,12);const st=Et.slice(12),ft=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],Ut=[{key:"accounts",label:"Trading accounts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 14a6 6 0 0 0-5 2 8 8 0 0 0 5 2l5-2a6 6 0 0 0-5-2zm0-12a8 8 0 0 0-6 13 8 8 0 0 1 6-3 8 8 0 0 1 6 3 8 8 0 0 0-6-13zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",fill:"currentColor"})})})}),submenu:[{label:"Connect to account",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.jsx("path",{fillRule:"evenodd","clip-rule":"evenodd",d:"M20 6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6zm-2 3V6h-3v3h3zm-4-3h-4v2.999h4V6zM9 6H6v3l3-.001V6zm-3 4v4l3-.001v-4H6zm0 5v3h3v-3.001H6zm4 3h4v-3.001h-4V18zm5 0h3v-3h-3v3zm3-4v-4h-3v4h3zm-8-.001v-4h4v4h-4z",fill:"currentColor"})})})},{label:"Trade Orders",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Trade Position",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),a.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),a.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 19L8 14L12 19H4Z",fill:"#3183FF"}),a.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),a.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP Levels",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.688 17.773-.375.91c.43.277.911.415 1.445.415.614 0 1.104-.15 1.469-.45.367-.299.55-.68.55-1.144 0-.258-.044-.491-.132-.7a1.568 1.568 0 0 0-.387-.55c-.17-.159-.446-.332-.828-.52-.727-.354-1.09-.695-1.09-1.023 0-.198.064-.358.191-.48.13-.126.313-.188.547-.188.396 0 .772.128 1.129.383l.309-.875c-.31-.248-.796-.371-1.457-.371-.508 0-.925.146-1.25.437a1.421 1.421 0 0 0-.485 1.102c0 .237.04.453.121.648.084.195.2.365.352.508.154.14.45.322.887.543.44.219.73.417.87.594.141.177.212.363.212.558 0 .417-.299.625-.895.625-.388 0-.782-.14-1.184-.422ZM8.68 13.277V19h3.601v-.902H9.695v-4.82H8.68ZM20 20H4v1h16v-1Z",fill:"#EA4C4C"}),a.jsx("path",{d:"M10.5 10V7.895c.193.018.346.027.46.027 1.548 0 2.321-.656 2.321-1.969 0-.588-.21-1.02-.629-1.297-.416-.278-1.076-.418-1.98-.418-.115 0-.51.015-1.188.043V10H10.5Zm0-3.008V5.16c.099-.013.202-.02.309-.02.955 0 1.433.298 1.433.891 0 .35-.107.602-.32.758-.214.154-.552.23-1.016.23-.099 0-.234-.009-.406-.027Z",fill:"#3183FF",fillRule:"evenodd","clip-rule":"evenodd"}),a.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m6.926 14-.418-1.16H4.547L4.148 14H3.02L5.3 8.2h.446l2.3 5.8h-1.12ZM5.523 9.95l-.687 2.113H6.21l-.688-2.114Zm2.86 3.734.375-.91c.4.28.795.421 1.183.421.597 0 .895-.208.895-.625a.886.886 0 0 0-.211-.558c-.14-.177-.431-.375-.871-.594-.438-.221-.733-.402-.887-.543a1.506 1.506 0 0 1-.351-.508 1.682 1.682 0 0 1-.121-.648c0-.443.161-.81.484-1.102.325-.291.742-.437 1.25-.437.661 0 1.147.123 1.457.37l-.309.876a1.909 1.909 0 0 0-1.129-.383c-.234 0-.416.062-.546.187a.635.635 0 0 0-.192.48c0 .33.363.67 1.09 1.024.383.188.659.361.828.52.17.156.298.34.387.55.088.209.133.442.133.7 0 .463-.184.845-.551 1.144-.365.3-.854.45-1.469.45a2.617 2.617 0 0 1-1.445-.414Zm7.613.316-1.594-2.438-.636.872V14H12.75V8.277h1.016v2.739l1.945-2.739h1.156l-1.793 2.5L17.211 14h-1.215ZM3 15h18v1H3z",fill:"#C96057"})})})})},{label:"Chart Controls",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),a.jsx("path",{d:"M11.2574 18.9959C11.1719 18.9986 11.0861 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11C19 11.0599 18.9993 11.1196 18.998 11.1791L16.9574 10.2813C16.6023 7.3064 14.0705 5 11 5C7.68629 5 5 7.68629 5 11C5 14.191 7.49101 16.8002 10.6345 16.9891L11.2574 18.9959Z",fill:"currentColor"})]})})})},{label:"Trade Notification",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Crosshair cursor",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"oneclick",label:"One Click Trading",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20.9914 12.3966L18.9885 11.5954C18.7789 7.91769 15.7302 5 12 5C8.13401 5 5 8.13401 5 12C5 15.7302 7.91769 18.7789 11.5954 18.9885L12.3966 20.9914C12.2651 20.9971 12.1329 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 12.1329 20.9971 12.2651 20.9914 12.3966ZM11 11L21 15L19 17L22 20L20 22L17 19L15 21L11 11Z",fill:"currentColor"})})})})},{key:"theme",label:C==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.408 12.954-2.265-.756a.209.209 0 0 1 0-.396l2.265-.755a.209.209 0 0 1 .276.198v1.51c0 .143-.14.244-.276.198ZM5.959 7.306 4.89 5.17c-.09-.18.1-.37.28-.28l2.136 1.068a.209.209 0 0 1 .054.334L6.293 7.36c-.1.101-.27.074-.334-.054ZM11.802 21.857l-.755-2.265a.209.209 0 0 1 .198-.276h1.51c.143 0 .244.14.198.276l-.755 2.265a.21.21 0 0 1-.396 0ZM11.802 2.143l-.755 2.265a.209.209 0 0 0 .198.276h1.51c.143 0 .244-.14.198-.276l-.755-2.265a.209.209 0 0 0-.396 0ZM18.83 19.11l-2.137-1.068a.209.209 0 0 1-.054-.335l1.068-1.068c.1-.1.27-.073.334.055l1.069 2.136c.09.18-.101.37-.28.28ZM16.693 5.958 18.83 4.89c.18-.09.37.1.28.28l-1.068 2.136a.209.209 0 0 1-.334.054l-1.068-1.068a.209.209 0 0 1 .054-.334ZM4.89 18.83l1.069-2.136a.209.209 0 0 1 .334-.055l1.068 1.068c.101.101.074.271-.054.335L5.171 19.11c-.18.09-.37-.1-.28-.28ZM21.857 12.198l-2.265.755a.209.209 0 0 1-.276-.198v-1.51c0-.143.14-.244.276-.198l2.265.755a.21.21 0 0 1 0 .396Z",fill:"#FEBC5A"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fillRule:"evenodd",d:"M20.775 8.992C20.922 9.638 21 10.31 21 11a8.354 8.354 0 0 0-.787 0c-1.467.072-2.422.564-3.082 1.283l-1.18-1.65c.761-.718 1.697-1.205 2.81-1.452A7 7 0 1 0 12 18c.396-.001.565-.082.63-.12.07-.042.17-.124.295-.34.218-.375.36-.835.534-1.49l1.518 1.822C14.485 19.102 13.705 20 12 20a9 9 0 1 1 8.775-11.008Z","clip-rule":"evenodd",fill:"currentColor"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M13.892 14.693c-2.034.46-2.59-1.07-2.892-4.693 3.85.352 5.232 1.05 4.697 3.012L20 17.192s.038 1.023-.361 1.447c-.463.49-1.687.361-1.687.361l-4.06-4.307Z",fill:"currentColor"})]})})}),submenu:[{label:"Green & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#26a69a"})]})})})},{label:"Blue & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#578cf2"})]})})})},{label:"Black & White",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#76ac85"})]})})})}]},{key:"lang",label:"Language",rightText:"EN",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.9 17.39C17.64 16.59 16.89 16 16 16H15V13C15 12.4477 14.5523 12 14 12H8V10H10C10.5523 10 11 9.55228 11 9V7H13C14.1046 7 15 6.10457 15 5V4.59C17.93 5.77 20 8.64 20 12C20 14.08 19.2 15.97 17.9 17.39ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.78 4.21 10.21L9 15V16C9 17.1046 9.89543 18 11 18V19.93ZM12 2C6.47715 2 2 6.47715 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C6.8043 20.9464 9.34784 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z",fill:"currentColor"})})})}),submenu:[{label:"English",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Arabic",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Bulgarian",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 18H13V16H11V18ZM12 6C9.79 6 8 7.79 8 10H10C10 8.9 10.9 8 12 8C13.1 8 14 8.9 14 10C14 12 11 11.75 11 15H13C13 12.75 16 12.5 16 10C16 7.79 14.21 6 12 6Z",fill:"currentColor"})})})})},{key:"contact",label:"Contact us",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M5 4C3.89543 4 3 4.89543 3 6V15C3 16.1046 3.89543 17 5 17H5.98719L6 21L13 17H19C20.1046 17 21 16.1046 21 15V6C21 4.89543 20.1046 4 19 4H5ZM6 6H18C18.5128 6 18.9355 6.38604 18.9933 6.88338L19 7V14C19 14.5128 18.614 14.9355 18.1166 14.9933L18 15H12.5339C12.4234 15 12.314 15.0183 12.21 15.0539L12.108 15.0952L8 17.0289V16C8 15.4872 7.61396 15.0645 7.11662 15.0067L7 15H6C5.48716 15 5.06449 14.614 5.00673 14.1166L5 14V7C5 6.48716 5.38604 6.06449 5.88338 6.00673L6 6Z",fillRule:"evenodd","clip-rule":"evenodd",fill:"currentColor"})})})})},{key:"about",label:"About program",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],Tt=({item:Ie})=>{const tt=!!Ie.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Yt.current&&(clearTimeout(Yt.current),Yt.current=null),tt&&ve(Ie.key)},onMouseLeave:()=>{tt&&(Yt.current=setTimeout(()=>ve(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{tt?ve($e=>$e===Ie.key?null:Ie.key):(Ie.key==="theme"&&U($e=>$e==="light"?"dark":"light"),ye(!1),ve(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:Ie.label}),Ie.rightText&&a.jsx("span",{className:`text-xs ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.rightText}),tt&&a.jsx("svg",{className:`w-4 h-4 ${Je?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),tt&&Te===Ie.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${Je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:Ie.submenu.map(($e,me)=>{const ze=Ct[Ie.key],Pe=Array.isArray(ze)?ze.includes($e.label):ze===$e.label||$e.selected&&ze==null;return a.jsxs("button",{type:"button",onClick:()=>{Ie.key==="chart"?(bt(Ne=>{const Ye=Array.isArray(Ne.chart)?Ne.chart:[Ne.chart],wt=Ye.includes($e.label)?Ye.filter(Lt=>Lt!==$e.label):[...Ye,$e.label];return{...Ne,chart:wt}}),{Grid:()=>s(!n),"Trade Orders":()=>E(!N),"Trade Position":()=>R(!M),"Trade History":()=>z(!ne),"SL/TP Levels":()=>$(!V),"Ask Price":()=>Ae(!re),"Chart Controls":()=>he(!Z),"Trade Notification":()=>te(!ae),"Crosshair cursor":()=>ce(!se),"Show OHLC":()=>le(!pe)}[$e.label]?.()):(bt(At=>({...At,[Ie.key]:$e.label})),Ie.key==="colors"&&Fe[$e.label]&&F(Fe[$e.label]))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:$e.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:$e.label}),Pe&&a.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},me)})})})]})},Je=C==="light";return a.jsxs("div",{className:"relative h-full",children:[a.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${Je?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:ft.map((Ie,tt)=>{const $e=Ie==="gann",me=$e?null:Et[Ie],ze=$e?-1:Ie;return a.jsxs(q.Fragment,{children:[ze===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Pe=Jr[Re].toolId;r(A===Pe?null:Pe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
17
|
-
${A===Jr[
|
|
18
|
-
${A===Zr[
|
|
19
|
-
${A===Yr[
|
|
20
|
-
${A===qr[
|
|
21
|
-
${
|
|
22
|
-
${
|
|
9
|
+
}`,hv=function(i){uv(i,"."+Za+lv+Wd+`
|
|
10
|
+
.`+Ya+cv+Wd)},uv=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Rd=(function(){function i(){}return i.getOrigin=function(e){var t=i._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},i.isSameOrigin=function(e){return i.getOrigin(e)===i._origin},i.setContext=function(e){i._link=e.document.createElement("a"),i._origin=i.getOrigin(e.location.href)},i._origin="about:blank",i})(),dv=(function(){function i(e,t){this.context=e,this._options=t,this._cache={}}return i.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(ja(e)||gv(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},i.prototype.match=function(e){return this._cache[e]},i.prototype.loadImage=function(e){return tA(this,void 0,void 0,function(){var t,A,r,n,s=this;return Zt(this,function(o){switch(o.label){case 0:return t=Rd.isSameOrigin(e),A=!qa(e)&&this._options.useCORS===!0&&Rt.SUPPORT_CORS_IMAGES&&!t,r=!qa(e)&&!t&&!ja(e)&&typeof this._options.proxy=="string"&&Rt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!qa(e)&&!ja(e)&&!r&&!A?[2]:(n=e,r?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,c){var u=new Image;u.onload=function(){return l(u)},u.onerror=c,(wv(n)||A)&&(u.crossOrigin="anonymous"),u.src=n,u.complete===!0&&setTimeout(function(){return l(u)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},i.prototype.has=function(e){return typeof this._cache[e]<"u"},i.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},i.prototype.proxy=function(e){var t=this,A=this._options.proxy;if(!A)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var o=Rt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var g=new FileReader;g.addEventListener("load",function(){return n(g.result)},!1),g.addEventListener("error",function(B){return s(B)},!1),g.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),pv=/^data:image\/svg\+xml/i,fv=/^data:image\/.*;base64,/i,mv=/^data:image\/.*/i,gv=function(i){return Rt.SUPPORT_SVG_DRAWING||!Bv(i)},qa=function(i){return mv.test(i)},wv=function(i){return fv.test(i)},ja=function(i){return i.substr(0,4)==="blob"},Bv=function(i){return i.substr(-3).toLowerCase()==="svg"||pv.test(i)},Ie=(function(){function i(e,t){this.type=0,this.x=e,this.y=t}return i.prototype.add=function(e,t){return new i(this.x+e,this.y+t)},i})(),er=function(i,e,t){return new Ie(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},Ls=(function(){function i(e,t,A,r){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=r}return i.prototype.subdivide=function(e,t){var A=er(this.start,this.startControl,e),r=er(this.startControl,this.endControl,e),n=er(this.endControl,this.end,e),s=er(A,r,e),o=er(r,n,e),l=er(s,o,e);return t?new i(this.start,A,s,l):new i(l,o,n,this.end)},i.prototype.add=function(e,t){return new i(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},i.prototype.reverse=function(){return new i(this.end,this.endControl,this.startControl,this.start)},i})(),bA=function(i){return i.type===1},yv=(function(){function i(e){var t=e.styles,A=e.bounds,r=kr(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=kr(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=kr(t.borderBottomRightRadius,A.width,A.height),g=u[0],B=u[1],v=kr(t.borderBottomLeftRadius,A.width,A.height),b=v[0],C=v[1],U=[];U.push((n+l)/A.width),U.push((b+g)/A.width),U.push((s+C)/A.height),U.push((c+B)/A.height);var F=Math.max.apply(Math,U);F>1&&(n/=F,s/=F,l/=F,c/=F,g/=F,B/=F,b/=F,C/=F);var S=A.width-l,K=A.height-B,G=A.width-g,M=A.height-C,W=t.borderTopWidth,ne=t.borderRightWidth,J=t.borderBottomWidth,V=t.borderLeftWidth,ie=Tt(t.paddingTop,e.bounds.width),re=Tt(t.paddingRight,e.bounds.width),ce=Tt(t.paddingBottom,e.bounds.width),Z=Tt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?Qt(A.left+V/3,A.top+W/3,n-V/3,s-W/3,ft.TOP_LEFT):new Ie(A.left+V/3,A.top+W/3),this.topRightBorderDoubleOuterBox=n>0||s>0?Qt(A.left+S,A.top+W/3,l-ne/3,c-W/3,ft.TOP_RIGHT):new Ie(A.left+A.width-ne/3,A.top+W/3),this.bottomRightBorderDoubleOuterBox=g>0||B>0?Qt(A.left+G,A.top+K,g-ne/3,B-J/3,ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne/3,A.top+A.height-J/3),this.bottomLeftBorderDoubleOuterBox=b>0||C>0?Qt(A.left+V/3,A.top+M,b-V/3,C-J/3,ft.BOTTOM_LEFT):new Ie(A.left+V/3,A.top+A.height-J/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?Qt(A.left+V*2/3,A.top+W*2/3,n-V*2/3,s-W*2/3,ft.TOP_LEFT):new Ie(A.left+V*2/3,A.top+W*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?Qt(A.left+S,A.top+W*2/3,l-ne*2/3,c-W*2/3,ft.TOP_RIGHT):new Ie(A.left+A.width-ne*2/3,A.top+W*2/3),this.bottomRightBorderDoubleInnerBox=g>0||B>0?Qt(A.left+G,A.top+K,g-ne*2/3,B-J*2/3,ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne*2/3,A.top+A.height-J*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||C>0?Qt(A.left+V*2/3,A.top+M,b-V*2/3,C-J*2/3,ft.BOTTOM_LEFT):new Ie(A.left+V*2/3,A.top+A.height-J*2/3),this.topLeftBorderStroke=n>0||s>0?Qt(A.left+V/2,A.top+W/2,n-V/2,s-W/2,ft.TOP_LEFT):new Ie(A.left+V/2,A.top+W/2),this.topRightBorderStroke=n>0||s>0?Qt(A.left+S,A.top+W/2,l-ne/2,c-W/2,ft.TOP_RIGHT):new Ie(A.left+A.width-ne/2,A.top+W/2),this.bottomRightBorderStroke=g>0||B>0?Qt(A.left+G,A.top+K,g-ne/2,B-J/2,ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne/2,A.top+A.height-J/2),this.bottomLeftBorderStroke=b>0||C>0?Qt(A.left+V/2,A.top+M,b-V/2,C-J/2,ft.BOTTOM_LEFT):new Ie(A.left+V/2,A.top+A.height-J/2),this.topLeftBorderBox=n>0||s>0?Qt(A.left,A.top,n,s,ft.TOP_LEFT):new Ie(A.left,A.top),this.topRightBorderBox=l>0||c>0?Qt(A.left+S,A.top,l,c,ft.TOP_RIGHT):new Ie(A.left+A.width,A.top),this.bottomRightBorderBox=g>0||B>0?Qt(A.left+G,A.top+K,g,B,ft.BOTTOM_RIGHT):new Ie(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=b>0||C>0?Qt(A.left,A.top+M,b,C,ft.BOTTOM_LEFT):new Ie(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?Qt(A.left+V,A.top+W,Math.max(0,n-V),Math.max(0,s-W),ft.TOP_LEFT):new Ie(A.left+V,A.top+W),this.topRightPaddingBox=l>0||c>0?Qt(A.left+Math.min(S,A.width-ne),A.top+W,S>A.width+ne?0:Math.max(0,l-ne),Math.max(0,c-W),ft.TOP_RIGHT):new Ie(A.left+A.width-ne,A.top+W),this.bottomRightPaddingBox=g>0||B>0?Qt(A.left+Math.min(G,A.width-V),A.top+Math.min(K,A.height-J),Math.max(0,g-ne),Math.max(0,B-J),ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne,A.top+A.height-J),this.bottomLeftPaddingBox=b>0||C>0?Qt(A.left+V,A.top+Math.min(M,A.height-J),Math.max(0,b-V),Math.max(0,C-J),ft.BOTTOM_LEFT):new Ie(A.left+V,A.top+A.height-J),this.topLeftContentBox=n>0||s>0?Qt(A.left+V+Z,A.top+W+ie,Math.max(0,n-(V+Z)),Math.max(0,s-(W+ie)),ft.TOP_LEFT):new Ie(A.left+V+Z,A.top+W+ie),this.topRightContentBox=l>0||c>0?Qt(A.left+Math.min(S,A.width+V+Z),A.top+W+ie,S>A.width+V+Z?0:l-V+Z,c-(W+ie),ft.TOP_RIGHT):new Ie(A.left+A.width-(ne+re),A.top+W+ie),this.bottomRightContentBox=g>0||B>0?Qt(A.left+Math.min(G,A.width-(V+Z)),A.top+Math.min(K,A.height+W+ie),Math.max(0,g-(ne+re)),B-(J+ce),ft.BOTTOM_RIGHT):new Ie(A.left+A.width-(ne+re),A.top+A.height-(J+ce)),this.bottomLeftContentBox=b>0||C>0?Qt(A.left+V+Z,A.top+M,Math.max(0,b-(V+Z)),C-(J+ce),ft.BOTTOM_LEFT):new Ie(A.left+V+Z,A.top+A.height-(J+ce))}return i})(),ft;(function(i){i[i.TOP_LEFT=0]="TOP_LEFT",i[i.TOP_RIGHT=1]="TOP_RIGHT",i[i.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",i[i.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ft||(ft={}));var Qt=function(i,e,t,A,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,l=i+t,c=e+A;switch(r){case ft.TOP_LEFT:return new Ls(new Ie(i,c),new Ie(i,c-o),new Ie(l-s,e),new Ie(l,e));case ft.TOP_RIGHT:return new Ls(new Ie(i,e),new Ie(i+s,e),new Ie(l,c-o),new Ie(l,c));case ft.BOTTOM_RIGHT:return new Ls(new Ie(l,e),new Ie(l,e+o),new Ie(i+s,c),new Ie(i,c));case ft.BOTTOM_LEFT:default:return new Ls(new Ie(l,c),new Ie(l-s,c),new Ie(i,e+o),new Ie(i,e))}},Ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},Cv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Hs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},vv=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),Is=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),Tv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),bv=function(i){return i.type===0},Gd=function(i){return i.type===1},xv=function(i){return i.type===2},$d=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},Qv=function(i,e,t,A,r){return i.map(function(n,s){switch(s){case 0:return n.add(e,t);case 1:return n.add(e+A,t);case 2:return n.add(e+A,t+r);case 3:return n.add(e,t+r)}return n})},Xd=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Jd=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new yv(this.container),this.container.styles.opacity<1&&this.effects.push(new Tv(this.container.styles.opacity)),this.container.styles.transform!==null){var A=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new vv(A,r,n))}if(this.container.styles.overflowX!==0){var s=Ms(this.curves),o=Hs(this.curves);$d(s,o)?this.effects.push(new Is(s,6)):(this.effects.push(new Is(s,2)),this.effects.push(new Is(o,4)))}}return i.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,A=this.parent,r=this.effects.slice(0);A;){var n=A.effects.filter(function(l){return!Gd(l)});if(t||A.container.styles.position!==0||!A.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(A.container.styles.position)===-1,A.container.styles.overflowX!==0){var s=Ms(A.curves),o=Hs(A.curves);$d(s,o)||r.unshift(new Is(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return Nt(l.target,e)})},i})(),el=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Nt(r.flags,4),s=Nt(r.flags,2),o=new Jd(r,i);Nt(r.styles.display,2048)&&A.push(o);var l=Nt(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Xd(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var g=r.styles.zIndex.order;if(g<0){var B=0;c.negativeZIndex.some(function(b,C){return g>b.element.container.styles.zIndex.order?(B=C,!1):B>0}),c.negativeZIndex.splice(B,0,u)}else if(g>0){var v=0;c.positiveZIndex.some(function(b,C){return g>=b.element.container.styles.zIndex.order?(v=C+1,!1):v>0}),c.positiveZIndex.splice(v,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);el(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),el(o,e,t,l);Nt(r.flags,8)&&Zd(r,l)})},Zd=function(i,e){for(var t=i instanceof za?i.start:1,A=i instanceof za?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Cd&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Gr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},Fv=function(i){var e=new Jd(i,null),t=new Xd(e),A=[];return el(e,t,t,A),Zd(e.container,A),t},Yd=function(i,e){switch(e){case 0:return xA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return xA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return xA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return xA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},Uv=function(i,e){switch(e){case 0:return xA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return xA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return xA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return xA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},Sv=function(i,e){switch(e){case 0:return xA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return xA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return xA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return xA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},Ev=function(i,e){switch(e){case 0:return Ds(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return Ds(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return Ds(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return Ds(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},Ds=function(i,e){var t=[];return bA(i)?t.push(i.subdivide(.5,!1)):t.push(i),bA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},xA=function(i,e,t,A){var r=[];return bA(i)?r.push(i.subdivide(.5,!1)):r.push(i),bA(t)?r.push(t.subdivide(.5,!0)):r.push(t),bA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),bA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},qd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},_s=function(i){var e=i.styles,t=i.bounds,A=Tt(e.paddingLeft,t.width),r=Tt(e.paddingRight,t.width),n=Tt(e.paddingTop,t.width),s=Tt(e.paddingBottom,t.width);return t.add(A+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},Lv=function(i,e){return i===0?e.bounds:i===2?_s(e):qd(e)},Mv=function(i,e){return i===0?e.bounds:i===2?_s(e):qd(e)},tl=function(i,e,t){var A=Lv(Ar(i.styles.backgroundOrigin,e),i),r=Mv(Ar(i.styles.backgroundClip,e),i),n=Hv(Ar(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=kr(Ar(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=Iv(Ar(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),g=Math.round(A.top+l[1]);return[c,u,g,s,o]},tr=function(i){return wt(i)&&i.value===Zi.AUTO},Ps=function(i){return typeof i=="number"},Hv=function(i,e,t){var A=e[0],r=e[1],n=e[2],s=i[0],o=i[1];if(!s)return[0,0];if(Pt(s)&&o&&Pt(o))return[Tt(s,t.width),Tt(o,t.height)];var l=Ps(n);if(wt(s)&&(s.value===Zi.CONTAIN||s.value===Zi.COVER)){if(Ps(n)){var c=t.width/t.height;return c<n!=(s.value===Zi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=Ps(A),g=Ps(r),B=u||g;if(tr(s)&&(!o||tr(o))){if(u&&g)return[A,r];if(!l&&!B)return[t.width,t.height];if(B&&l){var v=u?A:r*n,b=g?r:A/n;return[v,b]}var C=u?A:t.width,U=g?r:t.height;return[C,U]}if(l){var F=0,S=0;return Pt(s)?F=Tt(s,t.width):Pt(o)&&(S=Tt(o,t.height)),tr(s)?F=S*n:(!o||tr(o))&&(S=F/n),[F,S]}var K=null,G=null;if(Pt(s)?K=Tt(s,t.width):o&&Pt(o)&&(G=Tt(o,t.height)),K!==null&&(!o||tr(o))&&(G=u&&g?K/A*r:t.height),G!==null&&tr(s)&&(K=u&&g?G/r*A:t.width),K!==null&&G!==null)return[K,G];throw new Error("Unable to calculate background-size for element")},Ar=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},Iv=function(i,e,t,A,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(i){case 2:return[new Ie(Math.round(A.left),Math.round(A.top+s)),new Ie(Math.round(A.left+A.width),Math.round(A.top+s)),new Ie(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Ie(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Ie(Math.round(A.left+n),Math.round(A.top)),new Ie(Math.round(A.left+n+o),Math.round(A.top)),new Ie(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Ie(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Ie(Math.round(A.left+n),Math.round(A.top+s)),new Ie(Math.round(A.left+n+o),Math.round(A.top+s)),new Ie(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Ie(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Ie(Math.round(r.left),Math.round(r.top)),new Ie(Math.round(r.left+r.width),Math.round(r.top)),new Ie(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Ie(Math.round(r.left),Math.round(r.height+r.top))]}},Dv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",jd="Hidden Text",_v=(function(){function i(e){this._data={},this._document=e}return i.prototype.parseMetrics=function(e,t){var A=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;A.style.visibility="hidden",A.style.fontFamily=e,A.style.fontSize=t,A.style.margin="0",A.style.padding="0",A.style.whiteSpace="nowrap",s.appendChild(A),r.src=Dv,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(jd)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(jd)),A.style.lineHeight="normal",r.style.verticalAlign="super";var l=r.offsetTop-A.offsetTop+2;return s.removeChild(A),{baseline:o,middle:l}},i.prototype.getMetrics=function(e,t){var A=e+" "+t;return typeof this._data[A]>"u"&&(this._data[A]=this.parseMetrics(e,t)),this._data[A]},i})(),ep=(function(){function i(e,t){this.context=e,this.options=t}return i})(),Pv=1e4,Nv=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r._activeEffects=[],r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),A.canvas||(r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px"),r.fontMetrics=new _v(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+A.width+"x"+A.height+") with scale "+A.scale),r}return e.prototype.applyEffects=function(t){for(var A=this;this._activeEffects.length;)this.popEffect();t.forEach(function(r){return A.applyEffect(r)})},e.prototype.applyEffect=function(t){this.ctx.save(),xv(t)&&(this.ctx.globalAlpha=t.opacity),bv(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Gd(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return tA(this,void 0,void 0,function(){return Zt(this,function(A){switch(A.label){case 0:if(Nt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return A.sent(),[4,this.renderNodeContent(t)];case 2:A.sent(),A.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,A,r){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=Va(t.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,t.bounds.top+r),o+n.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var A=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=zv(t.fontFamily).join(", "),n=Or(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,A){return tA(this,void 0,void 0,function(){var r,n,s,o,l,c,u,g,B=this;return Zt(this,function(v){return r=this.createFontStyle(A),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,u=l.middle,g=A.paintOrder,t.textBounds.forEach(function(b){g.forEach(function(C){switch(C){case 0:B.ctx.fillStyle=kt(A.color),B.renderTextWithLetterSpacing(b,A.letterSpacing,c);var U=A.textShadow;U.length&&b.text.trim().length&&(U.slice(0).reverse().forEach(function(F){B.ctx.shadowColor=kt(F.color),B.ctx.shadowOffsetX=F.offsetX.number*B.options.scale,B.ctx.shadowOffsetY=F.offsetY.number*B.options.scale,B.ctx.shadowBlur=F.blur.number,B.renderTextWithLetterSpacing(b,A.letterSpacing,c)}),B.ctx.shadowColor="",B.ctx.shadowOffsetX=0,B.ctx.shadowOffsetY=0,B.ctx.shadowBlur=0),A.textDecorationLine.length&&(B.ctx.fillStyle=kt(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:B.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+c),b.bounds.width,1);break;case 2:B.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:B.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+u),b.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&b.text.trim().length&&(B.ctx.strokeStyle=kt(A.webkitTextStrokeColor),B.ctx.lineWidth=A.webkitTextStrokeWidth,B.ctx.lineJoin=window.chrome?"miter":"round",B.ctx.strokeText(b.text,b.bounds.left,b.bounds.top+c)),B.ctx.strokeStyle="",B.ctx.lineWidth=0,B.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=_s(t),s=Hs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,S,S,c,u,g,B,G,v,b,M,C,U,F,S,K,G,M;return Zt(this,function(W){switch(W.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,r=t.curves,n=A.styles,s=0,o=A.textNodes,W.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,n)]):[3,4];case 2:W.sent(),W.label=3;case 3:return s++,[3,1];case 4:if(!(A instanceof wd))return[3,8];W.label=5;case 5:return W.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return S=W.sent(),this.renderReplacedElement(A,r,S),[3,8];case 7:return W.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Bd&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof yd))return[3,12];W.label=9;case 9:return W.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return S=W.sent(),this.renderReplacedElement(A,r,S),[3,12];case 11:return W.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof xd&&A.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:A.backgroundColor,x:0,y:0,width:A.width,height:A.height}),[4,c.render(A.tree)]):[3,14];case 13:u=W.sent(),A.width&&A.height&&this.ctx.drawImage(u,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),W.label=14;case 14:if(A instanceof Wa&&(g=Math.min(A.bounds.width,A.bounds.height),A.type===xs?A.checked&&(this.ctx.save(),this.path([new Ie(A.bounds.left+g*.39363,A.bounds.top+g*.79),new Ie(A.bounds.left+g*.16,A.bounds.top+g*.5549),new Ie(A.bounds.left+g*.27347,A.bounds.top+g*.44071),new Ie(A.bounds.left+g*.39694,A.bounds.top+g*.5649),new Ie(A.bounds.left+g*.72983,A.bounds.top+g*.23),new Ie(A.bounds.left+g*.84,A.bounds.top+g*.34085),new Ie(A.bounds.left+g*.39363,A.bounds.top+g*.79)]),this.ctx.fillStyle=kt(vd),this.ctx.fill(),this.ctx.restore()):A.type===Qs&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+g/2,A.bounds.top+g/2,g/4,0,Math.PI*2,!0),this.ctx.fillStyle=kt(vd),this.ctx.fill(),this.ctx.restore())),Ov(A)&&A.value.length){switch(B=this.createFontStyle(n),G=B[0],v=B[1],b=this.fontMetrics.getMetrics(G,v).baseline,this.ctx.font=G,this.ctx.fillStyle=kt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Kv(A.styles.textAlign),M=_s(A),C=0,A.styles.textAlign){case 1:C+=M.width/2;break;case 2:C+=M.width;break}U=M.add(C,0,0,-M.height/2+1),this.ctx.save(),this.path([new Ie(M.left,M.top),new Ie(M.left+M.width,M.top),new Ie(M.left+M.width,M.top+M.height),new Ie(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Wr(A.value,U),n.letterSpacing,b),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Nt(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(F=A.styles.listStyleImage,F.type!==0)return[3,18];S=void 0,K=F.url,W.label=15;case 15:return W.trys.push([15,17,,18]),[4,this.context.cache.match(K)];case 16:return S=W.sent(),this.ctx.drawImage(S,A.bounds.left-(S.width+10),A.bounds.top),[3,18];case 17:return W.sent(),this.context.logger.error("Error loading list-style-image "+K),[3,18];case 18:return[3,20];case 19:t.listValue&&A.styles.listStyleType!==-1&&(G=this.createFontStyle(n)[0],this.ctx.font=G,this.ctx.fillStyle=kt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new qA(A.bounds.left,A.bounds.top+Tt(A.styles.paddingTop,A.bounds.width),A.bounds.width,ju(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Wr(t.listValue,M),n.letterSpacing,ju(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),W.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return tA(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,g,B,F,v,b,F,C,U,F;return Zt(this,function(S){switch(S.label){case 0:if(Nt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:S.sent(),A=0,r=t.negativeZIndex,S.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:S.sent(),S.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:S.sent(),n=0,s=t.nonInlineLevel,S.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:S.sent(),S.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,S.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:S.sent(),S.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,S.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:S.sent(),S.label=17;case 17:return c++,[3,15];case 18:g=0,B=t.inlineLevel,S.label=19;case 19:return g<B.length?(F=B[g],[4,this.renderNode(F)]):[3,22];case 20:S.sent(),S.label=21;case 21:return g++,[3,19];case 22:v=0,b=t.zeroOrAutoZIndexOrTransformedOrOpacity,S.label=23;case 23:return v<b.length?(F=b[v],[4,this.renderStack(F)]):[3,26];case 24:S.sent(),S.label=25;case 25:return v++,[3,23];case 26:C=0,U=t.positiveZIndex,S.label=27;case 27:return C<U.length?(F=U[C],[4,this.renderStack(F)]):[3,30];case 28:S.sent(),S.label=29;case 29:return C++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var A=this;t.forEach(function(r,n){var s=bA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),bA(r)&&A.ctx.bezierCurveTo(r.startControl.x,r.startControl.y,r.endControl.x,r.endControl.y,r.end.x,r.end.y)})},e.prototype.renderRepeat=function(t,A,r,n){this.path(t),this.ctx.fillStyle=A,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,A,r){var n;if(t.width===A&&t.height===r)return t;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,A),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,A,r),o},e.prototype.renderBackgroundImage=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l;return Zt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var g,B,v,ie,le,se,Z,Ae,J,b,ie,le,se,Z,Ae,C,U,F,S,K,G,M,W,ne,J,V,ie,re,ce,Z,Ae,oe,le,se,ae,pe,we,Qe,Fe,Be,ve,Ce;return Zt(this,function(be){switch(be.label){case 0:if(u.type!==0)return[3,5];g=void 0,B=u.url,be.label=1;case 1:return be.trys.push([1,3,,4]),[4,n.context.cache.match(B)];case 2:return g=be.sent(),[3,4];case 3:return be.sent(),n.context.logger.error("Error loading background-image "+B),[3,4];case 4:return g&&(v=tl(t,A,[g.width,g.height,g.width/g.height]),ie=v[0],le=v[1],se=v[2],Z=v[3],Ae=v[4],J=n.ctx.createPattern(n.resizeImage(g,Z,Ae),"repeat"),n.renderRepeat(ie,J,le,se)),[3,6];case 5:b2(u)?(b=tl(t,A,[null,null,null]),ie=b[0],le=b[1],se=b[2],Z=b[3],Ae=b[4],C=B2(u.angle,Z,Ae),U=C[0],F=C[1],S=C[2],K=C[3],G=C[4],M=document.createElement("canvas"),M.width=Z,M.height=Ae,W=M.getContext("2d"),ne=W.createLinearGradient(F,K,S,G),Vu(u.stops,U).forEach(function(Le){return ne.addColorStop(Le.stop,kt(Le.color))}),W.fillStyle=ne,W.fillRect(0,0,Z,Ae),Z>0&&Ae>0&&(J=n.ctx.createPattern(M,"repeat"),n.renderRepeat(ie,J,le,se))):x2(u)&&(V=tl(t,A,[null,null,null]),ie=V[0],re=V[1],ce=V[2],Z=V[3],Ae=V[4],oe=u.position.length===0?[Fa]:u.position,le=Tt(oe[0],Z),se=Tt(oe[oe.length-1],Ae),ae=y2(u,le,se,Z,Ae),pe=ae[0],we=ae[1],pe>0&&we>0&&(Qe=n.ctx.createRadialGradient(re+le,ce+se,0,re+le,ce+se,pe),Vu(u.stops,pe*2).forEach(function(Le){return Qe.addColorStop(Le.stop,kt(Le.color))}),n.path(ie),n.ctx.fillStyle=Qe,pe!==we?(Fe=t.bounds.left+.5*t.bounds.width,Be=t.bounds.top+.5*t.bounds.height,ve=we/pe,Ce=1/ve,n.ctx.save(),n.ctx.translate(Fe,Be),n.ctx.transform(1,0,0,ve,0,0),n.ctx.translate(-Fe,-Be),n.ctx.fillRect(re,Ce*(ce-Be)+Be,Z,Ae*Ce),n.ctx.restore()):n.ctx.fill())),be.label=6;case 6:return A--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,A,r){return tA(this,void 0,void 0,function(){return Zt(this,function(n){return this.path(Yd(r,A)),this.ctx.fillStyle=kt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return tA(this,void 0,void 0,function(){var s,o;return Zt(this,function(l){switch(l.label){case 0:return A<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=Uv(n,r),this.path(s),this.ctx.fillStyle=kt(t),this.ctx.fill(),o=Sv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,g=this;return Zt(this,function(B){switch(B.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!di(A.backgroundColor)||A.backgroundImage.length,n=[{style:A.borderTopStyle,color:A.borderTopColor,width:A.borderTopWidth},{style:A.borderRightStyle,color:A.borderRightColor,width:A.borderRightWidth},{style:A.borderBottomStyle,color:A.borderBottomColor,width:A.borderBottomWidth},{style:A.borderLeftStyle,color:A.borderLeftColor,width:A.borderLeftWidth}],s=kv(Ar(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),di(A.backgroundColor)||(this.ctx.fillStyle=kt(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:B.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){g.ctx.save();var b=Ms(t.curves),C=v.inset?0:Pv,U=Qv(b,-C+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(g.path(b),g.ctx.clip(),g.mask(U)):(g.mask(b),g.ctx.clip(),g.path(U)),g.ctx.shadowOffsetX=v.offsetX.number+C,g.ctx.shadowOffsetY=v.offsetY.number,g.ctx.shadowColor=kt(v.color),g.ctx.shadowBlur=v.blur.number,g.ctx.fillStyle=v.inset?kt(v.color):"rgba(0,0,0,1)",g.ctx.fill(),g.ctx.restore()}),B.label=2;case 2:o=0,l=0,c=n,B.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!di(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return B.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return B.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return B.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:B.sent(),B.label=11;case 11:o++,B.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return tA(this,void 0,void 0,function(){var o,l,c,u,g,B,v,b,C,U,F,S,K,G,M,W,M,W;return Zt(this,function(ne){return this.ctx.save(),o=Ev(n,r),l=Yd(n,r),s===2&&(this.path(l),this.ctx.clip()),bA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),bA(l[1])?(g=l[1].end.x,B=l[1].end.y):(g=l[1].x,B=l[1].y),r===0||r===2?v=Math.abs(c-g):v=Math.abs(u-B),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),b=A<3?A*3:A*2,C=A<3?A*2:A,s===3&&(b=A,C=A),U=!0,v<=b*2?U=!1:v<=b*2+C?(F=v/(2*b+C),b*=F,C*=F):(S=Math.floor((v+C)/(b+C)),K=(v-S*b)/(S-1),G=(v-(S+1)*b)/S,C=G<=0||Math.abs(C-K)<Math.abs(C-G)?K:G),U&&(s===3?this.ctx.setLineDash([0,b+C]):this.ctx.setLineDash([b,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=kt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(bA(l[0])&&(M=l[3],W=l[0],this.ctx.beginPath(),this.formatPath([new Ie(M.end.x,M.end.y),new Ie(W.start.x,W.start.y)]),this.ctx.stroke()),bA(l[1])&&(M=l[1],W=l[2],this.ctx.beginPath(),this.formatPath([new Ie(M.end.x,M.end.y),new Ie(W.start.x,W.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=kt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=Fv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(ep),Ov=function(i){return i instanceof bd||i instanceof Td?!0:i instanceof Wa&&i.type!==Qs&&i.type!==xs},kv=function(i,e){switch(i){case 0:return Ms(e);case 2:return Cv(e);default:return Hs(e)}},Kv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},Vv=["-apple-system","system-ui"],zv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return Vv.indexOf(e)===-1}):i},Wv=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=A,r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale),r}return e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A,r;return Zt(this,function(n){switch(n.label){case 0:return A=Ka(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Rv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=kt(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(ep),Rv=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Gv=(function(){function i(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return i.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.getTime=function(){return Date.now()-this.start},i.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Rn([this.id,this.getTime()+"ms"],e))},i.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),$v=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Gv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new dv(this,e)}return i.instanceCount=1,i})(),Xv=function(i,e){return e===void 0&&(e={}),Jv(i,e)};typeof window<"u"&&Rd.setContext(window);var Jv=function(i,e){return tA(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,g,B,v,b,C,U,F,S,K,G,M,ne,W,ne,J,V,ie,re,ce,Z,Ae,oe,le,se,ae,pe,we,Qe,Fe,Be,ve;return Zt(this,function(Ce){switch(Ce.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:(J=e.allowTaint)!==null&&J!==void 0?J:!1,imageTimeout:(V=e.imageTimeout)!==null&&V!==void 0?V:15e3,proxy:e.proxy,useCORS:(ie=e.useCORS)!==null&&ie!==void 0?ie:!1},n=sa({logging:(re=e.logging)!==null&&re!==void 0?re:!0,cache:e.cache},r),s={windowWidth:(ce=e.windowWidth)!==null&&ce!==void 0?ce:A.innerWidth,windowHeight:(Z=e.windowHeight)!==null&&Z!==void 0?Z:A.innerHeight,scrollX:(Ae=e.scrollX)!==null&&Ae!==void 0?Ae:A.pageXOffset,scrollY:(oe=e.scrollY)!==null&&oe!==void 0?oe:A.pageYOffset},o=new qA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new $v(n,o),c=(le=e.foreignObjectRendering)!==null&&le!==void 0?le:!1,u={allowTaint:(se=e.allowTaint)!==null&&se!==void 0?se:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),g=new zd(l,i,u),B=g.clonedReferenceElement,B?[4,g.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=Ce.sent(),b=Ga(B)||ZC(B)?Qw(B.ownerDocument):Gn(l,B),C=b.width,U=b.height,F=b.left,S=b.top,K=Zv(l,B,e.backgroundColor),G={canvas:e.canvas,backgroundColor:K,scale:(pe=(ae=e.scale)!==null&&ae!==void 0?ae:A.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((we=e.x)!==null&&we!==void 0?we:0)+F,y:((Qe=e.y)!==null&&Qe!==void 0?Qe:0)+S,width:(Fe=e.width)!==null&&Fe!==void 0?Fe:Math.ceil(C),height:(Be=e.height)!==null&&Be!==void 0?Be:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),ne=new Wv(l,G),[4,ne.render(B)]):[3,3];case 2:return M=Ce.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+S+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),W=Fd(l,B),K===W.styles.backgroundColor&&(W.styles.backgroundColor=ei.TRANSPARENT),l.logger.debug("Starting renderer for element at "+G.x+","+G.y+" with size "+G.width+"x"+G.height),ne=new Nv(l,G),[4,ne.render(W)];case 4:M=Ce.sent(),Ce.label=5;case 5:return(!((ve=e.removeContainer)!==null&&ve!==void 0)||ve)&&(zd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Zv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Kr(i,getComputedStyle(A.documentElement).backgroundColor):ei.TRANSPARENT,n=A.body?Kr(i,getComputedStyle(A.body).backgroundColor):ei.TRANSPARENT,s=typeof t=="string"?Kr(i,t):t===null?ei.TRANSPARENT:4294967295;return e===A.documentElement?di(r)?di(n)?s:n:r:s};const Yv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class qv{constructor(e,t,A="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=r,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=o.context,c=n._chart,u=n._series;if(!c||!u)return;const g=u.priceToCoordinate(n.price);if(g==null)return;const B=Math.round(g*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),b=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(b>=C)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(b,B),l.lineTo(C,B),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(b,B,U,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tp{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!A.visible||!A.text||!A._series)return;const c=A._series.priceToCoordinate(A.price);if(c==null)return;const u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const g=Math.round(8*o),B=Math.round(14*l),v=s.width;let b;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);b=F!=null?Math.round(F*o):g,n.textAlign="right"}else b=g,n.textAlign="left";else A.hAlign==="right"?(b=v-g,n.textAlign="right"):(b=v/2,n.textAlign="center");const C=Math.round(c*l);let U;A.vAlign==="top"?U=C-B:A.vAlign==="bottom"?U=C+B:U=C,n.fillStyle=A.textColor,n.fillText(A.text,b,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class jv{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const g=l.horizontalPixelRatio,B=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||b==null||C==null||U==null)return;const F=Math.round(v*g),S=Math.round(C*B),K=Math.round(b*g),G=Math.round(U*B),M=l.context;if(M.save(),M.beginPath(),M.strokeStyle=s.color,M.lineWidth=s.lineWidth*B,M.setLineDash([]),M.moveTo(F,S),M.lineTo(K,G),M.stroke(),M.beginPath(),M.fillStyle=s.color,M.arc(F,S,3*B,0,Math.PI*2),M.fill(),M.beginPath(),M.arc(K,G,3*B,0,Math.PI*2),M.fill(),!s.statsShowAlways&&!s.isActive){M.restore();return}const{priceDiff:W,pricePct:ne,bars:J,days:V,angle:ie}=s.info,re=W>=0?"+":"",ce=[];if(s.statsPriceRange!==!1&&ce.push(`${re}${W.toFixed(5)} (${re}${ne.toFixed(2)}%)`),s.statsBarsRange!==!1&&ce.push(`${J} bars`),s.statsDateRange!==!1&&ce.push(`${V} days`),s.statsAngle!==!1&&ce.push(`∠ ${ie.toFixed(1)}°`),s.statsDistance&&ce.push(`Δ ${Math.abs(W).toFixed(5)}`),ce.length===0){M.restore();return}const Z=Math.round(11*B);M.font=`${Z}px sans-serif`;const Ae=Z*1.6,oe=8*B,le=Math.max(...ce.map(Ge=>M.measureText(Ge).width))+oe*2,se=ce.length*Ae+oe*2,ae=s.statsPosition??"right";let pe,we;ae==="left"?(pe=F,we=S):ae==="center"?(pe=Math.round((F+K)/2),we=Math.round((S+G)/2)):(pe=K,we=G);let Qe,Fe;ae==="left"?(Qe=pe-le-10*g,Fe=we-se-4*B):ae==="center"?(Qe=pe-le/2,Fe=we-se-8*B):(Qe=pe+10*g,Fe=we-se-4*B);const Be=l.bitmapSize.width,ve=l.bitmapSize.height,Ce=Math.min(Math.max(0,Qe),Be-le-4*g),be=Math.min(Math.max(4*B,Fe),ve-se-4*B),Le=4*B;M.beginPath(),M.moveTo(Ce+Le,be),M.lineTo(Ce+le-Le,be),M.quadraticCurveTo(Ce+le,be,Ce+le,be+Le),M.lineTo(Ce+le,be+se-Le),M.quadraticCurveTo(Ce+le,be+se,Ce+le-Le,be+se),M.lineTo(Ce+Le,be+se),M.quadraticCurveTo(Ce,be+se,Ce,be+se-Le),M.lineTo(Ce,be+Le),M.quadraticCurveTo(Ce,be,Ce+Le,be),M.closePath(),M.fillStyle="rgba(30, 41, 59, 0.92)",M.fill(),M.strokeStyle=s.statsColor||s.color,M.lineWidth=1*B,M.stroke(),M.fillStyle="#e2e8f0",M.textAlign="left",ce.forEach((Ge,Ke)=>{M.fillText(Ge,Ce+oe,be+oe+Z+Ke*Ae)}),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ap{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const g=l.horizontalPixelRatio,B=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||b==null||C==null||U==null)return;const F=Math.round(v*g),S=Math.round(C*B),K=Math.round(b*g),G=Math.round(U*B),M=s.lineColor??s.color,W=l.context;if(W.save(),s.showArea&&(W.fillStyle=s.fillColor,W.fillRect(Math.min(F,K),Math.min(S,G),Math.abs(K-F),Math.abs(G-S)),W.strokeStyle=M,W.lineWidth=1*B,W.setLineDash([]),W.strokeRect(Math.min(F,K),Math.min(S,G),Math.abs(K-F),Math.abs(G-S))),W.beginPath(),W.strokeStyle=M,W.lineWidth=2*B,W.moveTo(F,S),W.lineTo(K,G),W.stroke(),W.fillStyle=M,W.beginPath(),W.arc(F,S,3*B,0,Math.PI*2),W.fill(),W.beginPath(),W.arc(K,G,3*B,0,Math.PI*2),W.fill(),!s.statsShowAlways&&!s.isActive){W.restore();return}const{priceDiff:ne,pricePct:J,bars:V,days:ie}=s.info,re=ne>=0?"+":"",ce=[];if(s.statsPriceRange&&ce.push(re+ne.toFixed(5)+" ("+re+J.toFixed(2)+"%)"),s.statsBarsRange&&ce.push(V+" bars"),s.statsDateRange&&ce.push(ie+" days"),ce.length===0){W.restore();return}const Z=Math.round(11*B);W.font=Z+"px sans-serif";const Ae=Z*1.6,oe=8*B,le=Math.max(...ce.map(Ce=>W.measureText(Ce).width))+oe*2,se=ce.length*Ae+oe*2,ae=l.bitmapSize.width,pe=l.bitmapSize.height;let we,Qe;if(s.statsPosition==="left")we=F-le-10*g,Qe=S-se-4*B;else if(s.statsPosition==="center"){const Ce=(F+K)/2,be=(S+G)/2;we=Ce-le/2,Qe=be-se-4*B}else we=K+10*g,Qe=G-se-4*B;const Fe=Math.min(Math.max(0,we),ae-le-4*g),Be=Math.min(Math.max(4*B,Qe),pe-se-4*B),ve=4*B;W.beginPath(),W.moveTo(Fe+ve,Be),W.lineTo(Fe+le-ve,Be),W.quadraticCurveTo(Fe+le,Be,Fe+le,Be+ve),W.lineTo(Fe+le,Be+se-ve),W.quadraticCurveTo(Fe+le,Be+se,Fe+le-ve,Be+se),W.lineTo(Fe+ve,Be+se),W.quadraticCurveTo(Fe,Be+se,Fe,Be+se-ve),W.lineTo(Fe,Be+ve),W.quadraticCurveTo(Fe,Be,Fe+ve,Be),W.closePath(),W.fillStyle="rgba(30, 41, 59, 0.92)",W.fill(),W.strokeStyle=s.statsColor||M,W.lineWidth=1*B,W.stroke(),W.fillStyle="#e2e8f0",W.textAlign="left",ce.forEach((Ce,be)=>{W.fillText(Ce,Fe+oe,Be+oe+Z+be*Ae)}),W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class eT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.fillColor=A.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.min(g,B)*c,U=Math.max(g,B)*c,F=Math.min(v,b)*u,S=Math.max(v,b)*u,K=U-C,G=S-F;if(K<.5||G<.5)return;const M=s.context;M.save(),M.fillStyle=r.fillColor,M.fillRect(C,F,K,G),M.strokeStyle=r.strokeColor,M.lineWidth=r.lineWidth*u,M.setLineDash([]),M.strokeRect(C,F,K,G),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*c,U=B*u,F=v*c,S=b*u,K=Math.hypot(F-C,S-U);if(K<.5)return;const G=s.context;G.save(),G.strokeStyle=r.strokeColor,G.lineWidth=r.lineWidth*u,G.setLineDash([]),G.beginPath(),G.arc(C,U,K,0,Math.PI*2),G.stroke(),G.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class AT{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,c=n._series;if(!l||!c)return;const u=o.horizontalPixelRatio,g=o.verticalPixelRatio,B=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),b=l.timeScale().timeToCoordinate(n.p2.rawTime),C=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(B==null||v==null||b==null||C==null||U==null||F==null)return;const S=B*u,K=v*g,G=b*u,M=C*g,W=U*u,ne=F*g,J=o.context;J.save(),J.beginPath(),J.moveTo(S,K),J.lineTo(G,M),J.lineTo(W,ne),J.closePath(),J.fillStyle=n.fillColor,J.fill(),J.strokeStyle=n.strokeColor,J.lineWidth=n.lineWidth*g,J.setLineDash([]),J.stroke(),J.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class iT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.minorRatio=A.minorRatio??.45,this.previewAsLine=A.previewAsLine??!1,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*c,U=B*u,F=v*c,S=b*u,K=F-C,G=S-U,M=Math.hypot(K,G);if(M<.5)return;const W=s.context;if(W.save(),W.strokeStyle=r.strokeColor,W.lineWidth=r.lineWidth*u,W.setLineDash([]),r.previewAsLine)W.beginPath(),W.moveTo(C,U),W.lineTo(F,S),W.stroke();else{const ne=(C+F)/2,J=(U+S)/2,V=Math.atan2(G,K),ie=M/2,re=Math.max(1,ie*Math.max(.05,r.minorRatio));W.beginPath(),W.ellipse(ne,J,ie,re,V,0,Math.PI*2),W.stroke()}W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ip{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#f59e0b",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight!==!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.round(g*c),U=Math.round(v*u),F=Math.round(B*c),S=Math.round(b*u),K=F-C,G=S-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const W=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const ce=U+W*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=S+W*(re-F);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,S),M.stroke();const ne=Math.atan2(S-U,F-C),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),ce=S-J*Math.sin(ne-V),Z=F-J*Math.cos(ne+V),Ae=S-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.lineTo(Z,Ae),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,ce=C-J*Math.cos(re-V),Z=U-J*Math.sin(re-V),Ae=C-J*Math.cos(re+V),oe=U-J*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(Ae,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,Ae=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(Ae-Z),ae=Z!==0?Math.abs((Ae-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+ae.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(ce);if(se!=null&&ae!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);pe!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),ae=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ae>0?ae+" day"+(ae!==1?"s":""):"";pe>0&&(Qe+=(Qe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!ae&&!pe&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+Qe+")":le.push(Qe)}if(r.statsDistance){const se=K/c,ae=G/u;le.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=K/c,ae=G/u,pe=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,pe=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Fe=oe.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Be=oe.length*pe+we*2,[ve,Ce,be,Le]=C<=F?[C,U,F,S]:[F,S,C,U];let Ge,Ke;r.statsPosition==="left"?(Ge=ve,Ke=Ce):r.statsPosition==="center"?(Ge=(ve+be)/2,Ke=(Ce+Le)/2):(Ge=be,Ke=Le);const Te=Ge-Fe/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,_e,Fe,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,_e,Fe,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,de)=>{M.fillText(ye,Te+we,_e+we+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class rT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.round(g*c),U=Math.round(v*u),F=Math.round(B*c),S=Math.round(b*u),K=F-C,G=S-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const W=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const ce=U+W*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=S+W*(re-F);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,S),M.stroke();const ne=Math.atan2(S-U,F-C),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),ce=S-J*Math.sin(ne-V),Z=F-J*Math.cos(ne+V),Ae=S-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.lineTo(Z,Ae),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,ce=C-J*Math.cos(re-V),Z=U-J*Math.sin(re-V),Ae=C-J*Math.cos(re+V),oe=U-J*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(Ae,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,Ae=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(Ae-Z),ae=Z!==0?Math.abs((Ae-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+ae.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(ce);if(se!=null&&ae!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);pe!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),ae=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ae>0?ae+" day"+(ae!==1?"s":""):"";pe>0&&(Qe+=(Qe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!ae&&!pe&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+Qe+")":le.push(Qe)}if(r.statsDistance){const se=K/c,ae=G/u;le.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=K/c,ae=G/u,pe=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,pe=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Fe=oe.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Be=oe.length*pe+we*2,[ve,Ce,be,Le]=C<=F?[C,U,F,S]:[F,S,C,U];let Ge,Ke;r.statsPosition==="left"?(Ge=ve,Ke=Ce):r.statsPosition==="center"?(Ge=(ve+be)/2,Ke=(Ce+Le)/2):(Ge=be,Ke=Le);const Te=Ge-Fe/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,_e,Fe,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,_e,Fe,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,de)=>{M.fillText(ye,Te+we,_e+we+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class nT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft!==!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.round(g*c),U=Math.round(v*u),F=Math.round(B*c),S=Math.round(b*u),K=F-C,G=S-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const W=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const ce=U+W*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=S+W*(re-F);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,S),M.stroke();const ne=Math.atan2(S-U,F-C),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),ce=S-J*Math.sin(ne-V),Z=F-J*Math.cos(ne+V),Ae=S-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.lineTo(Z,Ae),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,ce=C-J*Math.cos(re-V),Z=U-J*Math.sin(re-V),Ae=C-J*Math.cos(re+V),oe=U-J*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(Ae,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,Ae=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(Ae-Z),ae=Z!==0?Math.abs((Ae-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+ae.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(ce);if(se!=null&&ae!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);pe!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),ae=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ae>0?ae+" day"+(ae!==1?"s":""):"";pe>0&&(Qe+=(Qe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!ae&&!pe&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+Qe+")":le.push(Qe)}if(r.statsDistance){const se=K/c,ae=G/u;le.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=K/c,ae=G/u,pe=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,pe=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Fe=oe.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Be=oe.length*pe+we*2,[ve,Ce,be,Le]=C<=F?[C,U,F,S]:[F,S,C,U];let Ge,Ke;r.statsPosition==="left"?(Ge=ve,Ke=Ce):r.statsPosition==="center"?(Ge=(ve+be)/2,Ke=(Ce+Le)/2):(Ge=be,Ke=Le);const Te=Ge-Fe/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,_e,Fe,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,_e,Fe,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,de)=>{M.fillText(ye,Te+we,_e+we+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class sT{constructor(e,t,A="#22c55e",r=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const u=n._chart,g=n._series;if(!u||!g)return;const B=o.horizontalPixelRatio,v=o.verticalPixelRatio,b=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),C=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=g.priceToCoordinate(n.p1.price),F=g.priceToCoordinate(n.p2.price);if(b==null||C==null||U==null||F==null)return;const S=b*B,K=U*v,G=C*B,M=F*v,[W,ne,J,V]=S<=G?[S,K,G,M]:[G,M,S,K];let ie=J-W,re=V-ne;Math.abs(ie)<1e-4&&(ie=1e-4);const ce=re/ie,Z=o.context;if(Z.save(),Z.strokeStyle=n.color,Z.fillStyle=n.color,Z.lineWidth=n.lineWidth*v,Z.setLineDash([]),n.rayLeft){const ae=ne+ce*(0-W);Z.beginPath(),Z.moveTo(0,ae),Z.lineTo(W,ne),Z.stroke()}if(n.rayRight){const se=o.bitmapSize.width,ae=V+ce*(se-J);Z.beginPath(),Z.moveTo(J,V),Z.lineTo(se,ae),Z.stroke()}const Ae=Math.atan2(re,ie),oe=(n.lineWidth*4+4)*v,le=Math.PI/7;if(n.arrowRight){const se=J-oe*Math.cos(Ae-le),ae=V-oe*Math.sin(Ae-le),pe=J-oe*Math.cos(Ae+le),we=V-oe*Math.sin(Ae+le);Z.beginPath(),Z.moveTo(J,V),Z.lineTo(se,ae),Z.lineTo(pe,we),Z.closePath(),Z.fill()}if(n.arrowLeft){const se=Ae+Math.PI,ae=W-oe*Math.cos(se-le),pe=ne-oe*Math.sin(se-le),we=W-oe*Math.cos(se+le),Qe=ne-oe*Math.sin(se+le);Z.beginPath(),Z.moveTo(W,ne),Z.lineTo(ae,pe),Z.lineTo(we,Qe),Z.closePath(),Z.fill()}if(c){const se=n.p1.rawTime??n.p1.time,ae=n.p2.rawTime??n.p2.time,pe=n.p1.price,we=n.p2.price,Qe=[];if(n.statsPriceRange){const Be=Math.abs(we-pe),ve=pe!==0?Math.abs((we-pe)/pe*100):0,Ce=Be<1e-4?6:Be<.01?5:Be<1?4:2;Qe.push("↕ "+Be.toFixed(Ce)+" ("+ve.toFixed(2)+"%)")}const Fe=[];if(n.statsBarsRange)try{const Be=u.timeScale().timeToCoordinate(se),ve=u.timeScale().timeToCoordinate(ae);if(Be!=null&&ve!=null){const Ce=u.timeScale().coordinateToLogical(Be),be=u.timeScale().coordinateToLogical(ve);Ce!=null&&be!=null&&Fe.push("↔ "+Math.abs(Math.round(be-Ce))+" bars")}}catch{}if(n.statsDateRange){const Be=Math.abs(ae-se),ve=Math.floor(Be/86400),Ce=Math.floor(Be%86400/3600),be=Math.floor(Be%3600/60);let Le=ve>0?ve+" day"+(ve!==1?"s":""):"";Ce>0&&(Le+=(Le?" ":"")+Ce+" hour"+(Ce!==1?"s":"")),!ve&&!Ce&&(Le=be+" min"+(be!==1?"s":"")),n.statsBarsRange&&Fe.length>0?Fe[Fe.length-1]+=" ("+Le+")":Fe.push(Le)}if(n.statsDistance){const Be=(G-S)/B,ve=(M-K)/v;Fe.push("distance: "+Math.sqrt(Be*Be+ve*ve).toFixed(2))}if(Fe.length>0&&Qe.push(Fe.join(", ")),n.statsAngle){const Be=ie/B,ve=re/v,Ce=Math.atan2(ve,Be)*180/Math.PI;Qe.push("∠ "+Ce.toFixed(0)+"°")}if(Qe.length>0){const Be=Math.min(B,v),ve=11*Be,Ce=ve*1.5,be=5*Be;Z.font=ve+"px sans-serif";const Ge=Qe.reduce((Pe,et)=>Math.max(Pe,Z.measureText(et).width),0)+be*2,Ke=Qe.length*Ce+be*2;let Te,_e;n.statsPosition==="left"?(Te=W,_e=ne):n.statsPosition==="center"?(Te=(W+J)/2,_e=(ne+V)/2):(Te=J,_e=V);const ye=Te-Ge/2,de=_e-Ke-12*Be;Z.fillStyle="rgba(20, 20, 30, 0.72)",Z.fillRect(ye,de,Ge,Ke),Z.strokeStyle=n.statsColor,Z.lineWidth=1*Be,Z.strokeRect(ye,de,Ge,Ke),Z.fillStyle=n.statsColor,Z.textBaseline="top",Z.textAlign="left",Qe.forEach((Pe,et)=>{Z.fillText(Pe,ye+be,de+be+et*Ce)})}}Z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class oT{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=s.timeScale().timeToCoordinate(A.center.rawTime),g=o.priceToCoordinate(A.center.price);if(u==null||g==null)return;const B=Math.round(u*l),v=Math.round(g*c),b=n.bitmapSize.width,C=n.bitmapSize.height,U=n.context;if(U.save(),U.strokeStyle=A.color,U.lineWidth=A.lineWidth*c,U.setLineDash([]),U.beginPath(),U.moveTo(0,v),U.lineTo(b,v),U.stroke(),U.beginPath(),U.moveTo(B,0),U.lineTo(B,C),U.stroke(),A.showPrice){const F=A.center.price.toFixed(5),S=Math.round(11*c);U.font=S+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="left";const K=U.measureText(F).width,G=Math.round(6*l),M=Math.round(3*c),W=S+2*M,ne=K+2*G,J=b-ne-Math.round(2*l),V=v-W/2;U.fillStyle=A.color,U.fillRect(J,V,ne,W),U.fillStyle="#ffffff",U.fillText(F,J+G,v)}if(A.showTime){const F=A.center.rawTime,S=new Date(F*1e3),K=Z=>String(Z).padStart(2,"0"),G=K(S.getUTCDate())+"."+K(S.getUTCMonth()+1)+"."+S.getUTCFullYear()+" "+K(S.getUTCHours())+":"+K(S.getUTCMinutes())+":"+K(S.getUTCSeconds()),M=Math.round(11*c);U.font=M+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const W=U.measureText(G).width,ne=Math.round(6*l),J=Math.round(3*c),V=M+2*J,ie=W+2*ne,re=B-ie/2,ce=C-V-Math.round(4*c);U.fillStyle=A.color,U.fillRect(re,ce,ie,V),U.fillStyle="#ffffff",U.fillText(G,B,ce+V/2)}U.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class aT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*c,U=v*u,F=B*c,S=b*u,K=C-F,G=U-S,M=F-C,W=S-U;if(Math.hypot(K,G)<1e-4)return;const J=Math.atan2(G,K),V=Math.round(Math.abs(J*180/Math.PI)),ie=s.context;ie.save(),ie.strokeStyle=r.color,ie.fillStyle=r.color,ie.lineWidth=r.lineWidth*u,ie.setLineDash([]);const re=Math.abs(M)<1e-4?0:W/M;if(r.rayLeft){const we=U+re*(0-C);ie.beginPath(),ie.moveTo(0,we),ie.lineTo(C,U),ie.stroke()}if(r.rayRight){const pe=s.bitmapSize.width,we=S+re*(pe-F);ie.beginPath(),ie.moveTo(F,S),ie.lineTo(pe,we),ie.stroke()}ie.beginPath(),ie.moveTo(C,U),ie.lineTo(F,S),ie.stroke();const ce=Math.atan2(W,M),Z=(r.lineWidth*4+4)*u,Ae=Math.PI/7;if(r.arrowRight){const pe=F-Z*Math.cos(ce-Ae),we=S-Z*Math.sin(ce-Ae),Qe=F-Z*Math.cos(ce+Ae),Fe=S-Z*Math.sin(ce+Ae);ie.beginPath(),ie.moveTo(F,S),ie.lineTo(pe,we),ie.lineTo(Qe,Fe),ie.closePath(),ie.fill()}if(r.arrowLeft){const pe=ce+Math.PI,we=C-Z*Math.cos(pe-Ae),Qe=U-Z*Math.sin(pe-Ae),Fe=C-Z*Math.cos(pe+Ae),Be=U-Z*Math.sin(pe+Ae);ie.beginPath(),ie.moveTo(C,U),ie.lineTo(we,Qe),ie.lineTo(Fe,Be),ie.closePath(),ie.fill()}const oe=28*u;ie.strokeStyle="rgba(122,166,174,0.55)",ie.fillStyle=r.color,ie.lineWidth=1*u,ie.beginPath(),ie.moveTo(F,S),ie.lineTo(F+oe,S),ie.stroke(),ie.beginPath(),ie.strokeStyle="rgba(122,166,174,0.45)",ie.arc(F,S,oe,0,J,J<0),ie.stroke(),ie.fillStyle="#4b7c86",ie.font=`${Math.round(10*u)}px sans-serif`,ie.textAlign="left",ie.textBaseline="middle";const le=F+(oe+10*u)*Math.cos(J/2),se=S+(oe+10*u)*Math.sin(J/2);if(ie.fillText(`${V}°`,le,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const pe=r.p1.price,we=r.p2.price,Qe=[];if(r.statsPriceRange){const Be=Math.abs(we-pe),ve=pe!==0?Math.abs((we-pe)/pe*100):0,Ce=Be<1e-4?6:Be<.01?5:Be<1?4:2;Qe.push("↕ "+Be.toFixed(Ce)+" ("+ve.toFixed(2)+"%)")}const Fe=[];if(r.statsDistance){const Be=M/c,ve=W/u;Fe.push("distance: "+Math.sqrt(Be*Be+ve*ve).toFixed(2))}if(Fe.length>0&&Qe.push(Fe.join(", ")),Qe.length>0){const Be=Math.min(c,u),ve=11*Be,Ce=ve*1.5,be=5*Be;ie.font=ve+"px sans-serif";const Ge=Qe.reduce((dt,fA)=>Math.max(dt,ie.measureText(fA).width),0)+be*2,Ke=Qe.length*Ce+be*2,[Te,_e,ye,de]=C<=F?[C,U,F,S]:[F,S,C,U];let Pe,et;r.statsPosition==="left"?(Pe=Te,et=_e):r.statsPosition==="center"?(Pe=(Te+ye)/2,et=(_e+de)/2):(Pe=ye,et=de);const it=Pe-Ge/2,rt=et-Ke-12*Be;ie.fillStyle="rgba(20, 20, 30, 0.72)",ie.fillRect(it,rt,Ge,Ke),ie.strokeStyle=r.statsColor,ie.lineWidth=1*Be,ie.strokeRect(it,rt,Ge,Ke),ie.fillStyle=r.statsColor,ie.textBaseline="top",ie.textAlign="left",Qe.forEach((dt,fA)=>{ie.fillText(dt,it+be,rt+be+fA*Ce)})}}ie.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class lT{constructor(e,t,A){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=s.context,B=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(B==null||v==null||b==null||C==null||U==null||F==null)return;const S=B*c,K=v*u,G=b*c,M=C*u,W=U*c,ne=F*u,J=(G+W)/2,V=(M+ne)/2;let ie=J-S,re=V-K;Math.abs(ie)<1e-4&&(ie=1e-4);const ce=re/ie,Z=s.bitmapSize.width,Ae=(G-W)/2,oe=(M-ne)/2,le=Be=>({x:J+Ae*Be,y:V+oe*Be}),se=(Be,ve)=>({x:Z,y:ve+ce*(Z-Be)}),ae=le(1),pe=le(-1),we=se(ae.x,ae.y),Qe=se(pe.x,pe.y);g.save(),g.beginPath(),g.moveTo(ae.x,ae.y),g.lineTo(we.x,we.y),g.lineTo(Qe.x,Qe.y),g.lineTo(pe.x,pe.y),g.closePath(),g.fillStyle="rgba(148, 163, 184, 0.2)",g.fill(),g.beginPath(),g.strokeStyle="rgba(148, 163, 184, 0.9)",g.lineWidth=1*u,g.moveTo(G,M),g.lineTo(W,ne),g.stroke(),r._levels.forEach(Be=>{const ve=le(Be.k),Ce=se(ve.x,ve.y);g.beginPath(),g.strokeStyle=Be.color,g.lineWidth=Be.width*u,g.moveTo(ve.x,ve.y),g.lineTo(Ce.x,Ce.y),g.stroke()});const Fe=se(S,K);g.beginPath(),g.strokeStyle="rgba(161, 98, 7, 0.9)",g.lineWidth=1.1*u,g.moveTo(S,K),g.lineTo(Fe.x,Fe.y),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cT{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,g=s.timeScale().timeToCoordinate(A.p1.rawTime),B=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),b=o.priceToCoordinate(A.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*l,U=B*c,F=v*l,S=b*c,K=n.bitmapSize.width,G=Math.abs(F-C)<1e-4?1:F-C,M=(S-U)/G,W=F>=C?1:-1,ne=W>0?K:0,J=C+W*Math.min(220*l,Math.max(80*l,K*.35)),V=A._rays.map(re=>{const ce=M*re.ratio;return{...re,yEnd:U+ce*(ne-C),yLabel:U+ce*(J-C)}});u.save();const ie=(re,ce,Z)=>{!re||!ce||(u.beginPath(),u.moveTo(C,U),u.lineTo(ne,re.yEnd),u.lineTo(ne,ce.yEnd),u.closePath(),u.fillStyle=Z,u.fill())};ie(V[0],V[3],"rgba(161, 98, 7, 0.10)"),ie(V[3],V[4],"rgba(5, 150, 105, 0.10)"),ie(V[4],V[5],"rgba(107, 114, 128, 0.12)"),V.forEach(re=>{u.beginPath(),u.strokeStyle=re.color,u.lineWidth=1*c,u.moveTo(C,U),u.lineTo(ne,re.yEnd),u.stroke()}),u.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,u.textAlign=W>0?"left":"right",u.textBaseline="middle",V.forEach(re=>{u.fillStyle=re.color;const ce=J+(W>0?4*l:-4*l),Z=re.yLabel;Z<-20||Z>n.bitmapSize.height+20||u.fillText(re.label,ce,Z)}),u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hT{constructor(e,t,A=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,A),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=s.context,B=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price);if(B==null||v==null||b==null||C==null)return;const U=B*c,F=v*u,S=b*c,K=C*u,G=S-U,M=K-F,W=Math.hypot(G,M);if(W<1e-4)return;const ne=G/W,J=M/W,V=-J,ie=ne,re=S+V*W,ce=K+ie*W,Z=U+V*W,Ae=F+ie*W,oe=(se,ae)=>({x:U+ne*W*se+V*W*ae,y:F+J*W*se+ie*W*ae});g.save();const le=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let se=0;se<r.divisions;se++){const ae=se/r.divisions,pe=(se+1)/r.divisions,we=oe(0,ae),Qe=oe(1,ae),Fe=oe(1,pe),Be=oe(0,pe);g.beginPath(),g.moveTo(we.x,we.y),g.lineTo(Qe.x,Qe.y),g.lineTo(Fe.x,Fe.y),g.lineTo(Be.x,Be.y),g.closePath(),g.fillStyle=le[se%le.length],g.fill()}g.lineWidth=1*u,g.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const ae=se/r.divisions,pe=oe(0,ae),we=oe(1,ae),Qe=oe(ae,0),Fe=oe(ae,1);g.beginPath(),g.moveTo(pe.x,pe.y),g.lineTo(we.x,we.y),g.stroke(),g.beginPath(),g.moveTo(Qe.x,Qe.y),g.lineTo(Fe.x,Fe.y),g.stroke()}g.strokeStyle="rgba(100, 116, 139, 0.85)",g.lineWidth=1*u,g.beginPath(),g.moveTo(U,F),g.lineTo(re,ce),g.stroke(),g.beginPath(),g.moveTo(S,K),g.lineTo(Z,Ae),g.stroke(),g.strokeStyle="rgba(122, 166, 174, 0.95)",g.lineWidth=1.2*u,g.beginPath(),g.moveTo(U,F),g.lineTo(S,K),g.lineTo(re,ce),g.lineTo(Z,Ae),g.closePath(),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Al{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:g=!0,pricesColor:B="#129f5c",rayLeft:v=!1,rayRight:b=!1,arrowLeft:C=!1,arrowRight:U=!1}=n;this.p1=e,this.p2=t,this.p3=A,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=u,this.showPrices=g,this.pricesColor=B,this.rayLeft=v,this.rayRight=b,this.arrowLeft=C,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(S){S.useBitmapCoordinateSpace(K=>{if(!F.visible)return;const G=F._chart,M=F._series;if(!G||!M)return;const W=K.horizontalPixelRatio,ne=K.verticalPixelRatio,J=[F.p1,F.p3,F.p4,F.p2].map(Ke=>{const Te=G.timeScale().timeToCoordinate(Ke.rawTime),_e=M.priceToCoordinate(Ke.price);return Te==null||_e==null?null:{x:Te*W,y:_e*ne}}).filter(Boolean);if(J.length!==4)return;const[V,ie,re,ce]=J,Z=K.context;Z.save();const Ae=ie.x-V.x,oe=ie.y-V.y,le=Math.sqrt(Ae*Ae+oe*oe)||1,se=Ae/le,ae=oe/le,pe=re.x-ce.x,we=re.y-ce.y,Qe=Math.sqrt(pe*pe+we*we)||1,Fe=pe/Qe,Be=we/Qe,ve=1e5,Ce=F.rayLeft?{x:V.x-se*ve,y:V.y-ae*ve}:V,be=F.rayRight?{x:ie.x+se*ve,y:ie.y+ae*ve}:ie,Le=F.rayLeft?{x:ce.x-Fe*ve,y:ce.y-Be*ve}:ce,Ge=F.rayRight?{x:re.x+Fe*ve,y:re.y+Be*ve}:re;if(F.showBackground){const Ke=F.fillColor||"#6aa84f",Te=parseInt(Ke.slice(1,3),16),_e=parseInt(Ke.slice(3,5),16),ye=parseInt(Ke.slice(5,7),16);Z.beginPath(),Z.moveTo(V.x,V.y),Z.lineTo(ie.x,ie.y),Z.lineTo(re.x,re.y),Z.lineTo(ce.x,ce.y),Z.closePath(),Z.fillStyle=`rgba(${Te},${_e},${ye},${F.fillOpacity??.1})`,Z.fill()}if(Z.strokeStyle=F.lineColor,Z.lineWidth=F.lineWidth*ne,Z.setLineDash([]),Z.beginPath(),Z.moveTo(Ce.x,Ce.y),Z.lineTo(be.x,be.y),Z.moveTo(Le.x,Le.y),Z.lineTo(Ge.x,Ge.y),Z.moveTo(V.x,V.y),Z.lineTo(ce.x,ce.y),Z.moveTo(ie.x,ie.y),Z.lineTo(re.x,re.y),Z.stroke(),F.arrowLeft||F.arrowRight){const Ke=8*ne,Te=(_e,ye,de)=>{Z.save(),Z.translate(_e,ye),Z.rotate(de),Z.beginPath(),Z.moveTo(0,0),Z.lineTo(-Ke,-Ke/2),Z.lineTo(-Ke,Ke/2),Z.closePath(),Z.fillStyle=F.lineColor,Z.fill(),Z.restore()};F.arrowLeft&&(Te(Ce.x,Ce.y,Math.atan2(-ae,-se)),Te(Le.x,Le.y,Math.atan2(-Be,-Fe))),F.arrowRight&&(Te(be.x,be.y,Math.atan2(ae,se)),Te(Ge.x,Ge.y,Math.atan2(Be,Fe)))}if(Z.fillStyle="#ffffff",Z.strokeStyle="#3b82f6",Z.lineWidth=2*ne,[V,ie,re,ce].forEach(Ke=>{Z.beginPath(),Z.arc(Ke.x,Ke.y,6*ne,0,Math.PI*2),Z.fill(),Z.stroke()}),F.showPrices){const Ke=[F.p1,F.p3,F.p2,F.p4],Te=[V,ie,ce,re];Z.fillStyle=F.pricesColor||F.lineColor,Z.font=`${Math.round(10*ne)}px sans-serif`,Z.textAlign="left",Z.textBaseline="middle",Te.forEach((_e,ye)=>{const de=Ke[ye]?.price;typeof de=="number"&&Z.fillText(de.toFixed(5),_e.x+8*W,_e.y)})}Z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class rp extends Al{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class np{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const u=o._chart,g=o._series;if(!u||!g)return;const B=c.horizontalPixelRatio,v=c.verticalPixelRatio,b=c.context,C=G=>{const M=u.timeScale().timeToCoordinate(G.rawTime),W=g.priceToCoordinate(G.price);return M==null||W==null?null:{x:M*B,y:W*v}},U=C(o.p1),F=C(o.p2),S=C(o.b2),K=C(o.b1);!U||!F||!S||!K||(b.save(),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(F.x,F.y),b.lineTo(S.x,S.y),b.lineTo(K.x,K.y),b.closePath(),b.fillStyle=o.fillColor,b.fill(),b.strokeStyle=o.strokeColor,b.lineWidth=o.lineWidth*v,b.setLineDash([]),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(F.x,F.y),b.stroke(),b.beginPath(),b.moveTo(K.x,K.y),b.lineTo(S.x,S.y),b.stroke(),b.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class il{constructor(e,t,A,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=r,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(u=>{if(!l.visible)return;const g=l._chart,B=l._series;if(!g||!B)return;const v=u.horizontalPixelRatio,b=u.verticalPixelRatio,C=u.context,U=J=>{const V=g.timeScale().timeToCoordinate(J.rawTime),ie=B.priceToCoordinate(J.price);return V==null||ie==null?null:{x:V*v,y:ie*b}},F=U(l.mid1),S=U(l.mid2),K=U(l.top1),G=U(l.top2),M=U(l.bot1),W=U(l.bot2);if(!F||!S||!K||!G||!M||!W)return;C.save(),C.beginPath(),C.moveTo(F.x,F.y),C.lineTo(S.x,S.y),C.lineTo(G.x,G.y),C.lineTo(K.x,K.y),C.closePath(),C.fillStyle=l.upperFillColor,C.fill(),C.beginPath(),C.moveTo(M.x,M.y),C.lineTo(W.x,W.y),C.lineTo(S.x,S.y),C.lineTo(F.x,F.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const ne=(J,V,ie)=>{C.beginPath(),C.strokeStyle=ie,C.lineWidth=l.lineWidth*b,C.setLineDash([]),C.moveTo(J.x,J.y),C.lineTo(V.x,V.y),C.stroke()};if(ne(K,G,l.upperStrokeColor),ne(F,S,l.centerStrokeColor),ne(M,W,l.lowerStrokeColor),l.showDeviationLabel){const J=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite(J)?J.toFixed(5):null;if(V){const ie=Math.max(10,Math.round(10*b));C.fillStyle=l.labelColor,C.font=`${ie}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(V,M.x+2*v,M.y+10*b)}}C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class sp extends il{}class op{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,g=n.bitmapSize.width;n.bitmapSize.height;const B=A.p1.price,v=A.p2.price,b=B-v,C=J=>v+b*J,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),S=o.priceToCoordinate(B),K=o.priceToCoordinate(v),G=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,M=U!=null&&F!=null?Math.round(Math.max(U,F)*l):g,W=M-G;u.save(),A._zoneFills.forEach(({from:J,to:V,color:ie})=>{const re=C(J),ce=C(V),Z=o.priceToCoordinate(re),Ae=o.priceToCoordinate(ce);if(Z==null||Ae==null)return;const oe=Math.round(Z*c),le=Math.round(Ae*c);u.fillStyle=ie,u.fillRect(G,Math.min(oe,le),W,Math.abs(le-oe))}),A._levels.forEach(({ratio:J,label:V})=>{const ie=C(J),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[J]||"#888888";u.beginPath(),u.strokeStyle=Z,u.lineWidth=J===0||J===1?1.5*c:1*c,J!==0&&J!==1&&J<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(G,ce),u.lineTo(M,ce),u.stroke(),u.setLineDash([])});const ne=Math.round(11*c);if(u.font=`${ne}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:J,label:V})=>{const ie=C(J),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[J]||"#888888",Ae=`${V} (${ie.toFixed(5)})`;u.fillStyle=Z,u.textAlign="right",u.fillText(Ae,G-4*l,ce-4*c)}),U!=null&&F!=null&&S!=null&&K!=null){const J=Math.round(U*l),V=Math.round(S*c),ie=Math.round(F*l),re=Math.round(K*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo(J,V),u.lineTo(ie,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(J,V,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(ie,re,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke()}u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class uT{constructor(e,t="#3b82f6",A=2,r=!0){this.time=e,this.color=t,this.lineWidth=A,this.showDate=r,this.showDot=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const u=Math.round(c*o.horizontalPixelRatio),g=o.bitmapSize.height,B=o.context;B.save(),B.beginPath(),B.strokeStyle=n.color,B.lineWidth=n.lineWidth*o.horizontalPixelRatio,B.setLineDash([]),B.moveTo(u,0),B.lineTo(u,g),B.stroke();const v=Math.round(g/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){B.beginPath(),B.strokeStyle=n.color,B.lineWidth=1.5*o.horizontalPixelRatio;const b=5*o.horizontalPixelRatio;B.arc(u,v,b,0,Math.PI*2),B.stroke()}if(n.showDate!==!1){const b=n.time,C=new Date(typeof b=="number"?b*1e3:b),U=ie=>String(ie).padStart(2,"0"),F=`${U(C.getUTCDate())}.${U(C.getUTCMonth()+1)}.${C.getUTCFullYear()} ${U(C.getUTCHours())}:${U(C.getUTCMinutes())}:${U(C.getUTCSeconds())}`,S=Math.round(11*o.verticalPixelRatio);B.font=`${S}px ui-sans-serif, system-ui, sans-serif`,B.textBaseline="middle",B.textAlign="center";const K=B.measureText(F).width,G=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),W=S+2*M,ne=K+2*G,J=u-ne/2,V=g-W-Math.round(4*o.verticalPixelRatio);B.fillStyle=n.color,B.fillRect(J,V,ne,W),B.fillStyle="#ffffff",B.fillText(F,u,V+W/2)}B.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function ap(i,e){const t=typeof i=="string"?i.trim():"",A=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(A))return`rgba(95, 143, 150, ${e})`;const r=parseInt(A.slice(0,2),16),n=parseInt(A.slice(2,4),16),s=parseInt(A.slice(4,6),16);return`rgba(${r}, ${n}, ${s}, ${e})`}function dT(i,e,t){const A=`${i??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let u=c;for(;u.length>s;){let g=u.lastIndexOf(" ",s);g<=0&&(g=s),o.push(u.slice(0,g)),u=u.slice(g).trimStart()}o.push(u)};return A.split(`
|
|
11
|
+
`).forEach(l),o.length===0&&o.push(""),o}function lp(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=dT(A.text??i?.text??"Text",r,n),o=s.reduce((b,C)=>Math.max(b,C.length),1),c=Math.max(20,o*r*.58)+16,u=r*1.2,g=s.length*u+10,B=e-c/2,v=t-g;return{left:B,right:B+c,top:v,bottom:v+g+12}}class pT{constructor(e,t,A={}){this.rawTime=e,this.price=t,this.text=A.text??"Text",this.color=A.color??"#5f8f96",this.fontSize=A.fontSize??12,this.fontWeight=A.fontWeight??"normal",this.fontStyle=A.fontStyle??"normal",this.textAlign=A.textAlign??"center",this.textWrap=A.textWrap??!1,this.borderEnabled=A.borderEnabled??!1,this.borderColor=A.borderColor??"#5f8f96",this.borderOpacity=A.borderOpacity??.1,this.borderWidth=A.borderWidth??1,this.bgEnabled=A.bgEnabled??!1,this.bgColor=A.bgColor??"#5f8f96",this.bgOpacity=A.bgOpacity??.1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=o.timeScale().timeToCoordinate(r.rawTime),u=l.priceToCoordinate(r.price);if(c==null||u==null)return;const g=s.horizontalPixelRatio,B=s.verticalPixelRatio,v=Math.round(c*g),b=Math.round(u*B),C=s.context;C.save();const U=Math.round(r.fontSize*B);C.font=`${r.fontStyle} ${r.fontWeight} ${U}px sans-serif`;const F=`${r.text??""}`,S=220*g,K=[],G=ae=>{if(!r.textWrap||ae.length===0){K.push(ae);return}const pe=ae.split(/\s+/);let we="";for(const Qe of pe){const Fe=we?`${we} ${Qe}`:Qe;C.measureText(Fe).width<=S||!we?we=Fe:(K.push(we),we=Qe)}K.push(we)};F.split(`
|
|
12
|
+
`).forEach(G),K.length===0&&K.push("");const M=K.map(ae=>C.measureText(ae).width),W=Math.max(...M,20*g),ne=8*g,J=5*B,V=W+ne*2,ie=U*1.2,re=ie*K.length+J*2,ce=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Z=v-V/2,Ae=b-re;r.bgEnabled&&(C.fillStyle=ap(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(Z,Ae,V,re),C.fill()),r.borderEnabled&&(C.strokeStyle=ap(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),C.lineWidth=Math.max(.5,(r.borderWidth??1)*B),C.beginPath(),C.rect(Z,Ae,V,re),C.stroke()),C.fillStyle=r.color,C.textAlign=ce,C.textBaseline="middle";const oe=ce==="left"?Z+ne:ce==="right"?Z+V-ne:Z+V/2;for(let ae=0;ae<K.length;ae++)C.fillText(K[ae],oe,Ae+J+ie*(ae+.5));const le=5*B,se=b+10*B;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*B,C.arc(v,se,le,0,Math.PI*2),C.stroke(),C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const fT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function cp(i){if(!i)return 7;const e=String(i).toUpperCase();return fT[e]??7}function mT(i,e){const t=String(i||"").toUpperCase(),A=e||cp(i),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(A*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const zA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:ee(A.time)})).filter(A=>A.time!=null);e.sort((A,r)=>A.time-r.time);const t=new Map;for(const A of e)t.set(A.time,A);return Array.from(t.values()).sort((A,r)=>A.time-r.time)};function ut(i,e,t,A,r,n){const s=r-t,o=n-A,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/(l*l);c=Math.max(0,Math.min(1,c));const u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function gT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/l;c<0&&(c=0);const u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function wT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);const c=((i-t)*s+(e-A)*o)/l,u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function gi(i,e,t){let A=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r].x,o=t[r].y,l=t[n].x,c=t[n].y;o>e!=c>e&&i<(l-s)*(e-o)/(c-o+1e-7)+s&&(A=!A)}return A}function hp(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??ee(i.rawTime),r=e.normalizedTime??ee(e.rawTime),n=t.normalizedTime??ee(t.rawTime);if(A==null||r==null||n==null)return null;const s=r-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-i.price)/s,l=t.price+o*(A-n),c=t.price+o*(r-n),u=ee((A+r)/2),g=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:g}}}function ir(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??ee(e.rawTime),n=t.normalizedTime??ee(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map(J=>({time:ee(J.time),close:typeof J.close=="number"?J.close:parseFloat(J.close)})).filter(J=>J.time!=null&&Number.isFinite(J.close)&&J.time>=s&&J.time<=o).sort((J,V)=>J.time-V.time);if(l.length<2)return null;const c=l.length;let u=0,g=0,B=0,v=0;for(let J=0;J<c;J++){const V=J,ie=l[J].close;u+=V,g+=ie,B+=V*ie,v+=V*V}const b=c*v-u*u,C=Math.abs(b)<1e-12?0:(c*B-u*g)/b,U=(g-C*u)/c;let F=0;for(let J=0;J<c;J++){const V=U+C*J,ie=l[J].close-V;F+=ie*ie}const S=Math.sqrt(F/c),K=Math.max(S*A,1e-8),G=l[0].time,M=l[c-1].time,W=U,ne=U+C*(c-1);return{slope:C,intercept:U,stdDev:S,offset:K,barCount:c,p1:{rawTime:G,normalizedTime:G,price:W},p2:{rawTime:M,normalizedTime:M,price:ne},top1:{rawTime:G,normalizedTime:G,price:W+K},top2:{rawTime:M,normalizedTime:M,price:ne+K},bot1:{rawTime:G,normalizedTime:G,price:W-K},bot2:{rawTime:M,normalizedTime:M,price:ne-K}}}function Xr(i,e,t,A=1){return ir(i,e,t,A)}const BT={trendline:{requiredKeys:["point1","point2"],handleCount:2},gannline:{requiredKeys:["point1","point2"],handleCount:3},rectangle:{requiredKeys:["p1","p2"],handleCount:8},circle:{requiredKeys:["p1","p2"],handleCount:2},triangle:{requiredKeys:["p1","p2","p3"],handleCount:3},ellipse:{requiredKeys:["p1","p2"],handleCount:4},infoline:{requiredKeys:["p1","p2"],handleCount:2},arrowedline:{requiredKeys:["p1","p2"],handleCount:2},rayline:{requiredKeys:["p1","p2"],handleCount:2},extendedline:{requiredKeys:["p1","p2"],handleCount:2},crossline:{requiredKeys:["p"],handleCount:1},trendbyangle:{requiredKeys:["p1","p2"],handleCount:2},equidistantchannel:{requiredKeys:["p1","p2","p3"],handleCount:3},regressionchannel:{requiredKeys:["p1","p2"],handleCount:2},stddevchannel:{requiredKeys:["p1","p2"],handleCount:2},gannfan:{requiredKeys:["p1","p2"],handleCount:2},ganngrid:{requiredKeys:["p1","p2"],handleCount:2},andrewspitchfork:{requiredKeys:["p1","p2","p3"],handleCount:3},disjointchannel:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},flattopbottom:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},rulerline:{requiredKeys:["p1","p2"],handleCount:3},horizontalray:{requiredKeys:["primitive"],handleCount:1},verticalline:{requiredKeys:["primitive"],handleCount:1},pricelevel:{requiredKeys:["priceLine"],handleCount:1}},yT={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6",pricelevel:"#3b82f6"};function CT(i,e){if(!i||!i.type)return!1;const t=BT[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function vT(i){return i?yT[i]??"#22c55e":"#22c55e"}const TT=300,up=24,bT=150,dp=150;function rl(i,e,t=TT){if(!Array.isArray(i)||i.length===0)return[];const A=uA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=ee(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function xT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=ee(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function QT(i,e){let t=0,A=i.length;for(;t<A;){const r=t+A>>1;i[r]<e?t=r+1:A=r}return t}function Ns(i,e,t,A){const r=ee(e),n=ee(t),s=uA(A)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(i)||i.length===0)return l;if(r==null||n==null)return 1;const c=B=>{const v=QT(i,B);if(v<=0)return 0;if(v>=i.length)return i.length-1;const b=i[v-1],C=i[v];return Math.abs(B-b)<=Math.abs(C-B)?v-1:v},u=c(r),g=c(n);return Math.max(1,Math.abs(g-u)+1)}function pp(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=xT(e);if(r==null)return!1;const n=A.timeToCoordinate(r);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const u=A.getVisibleLogicalRange(),g=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,B=Number.isFinite(g)&&g>20?g:120,v=Math.min(dp,B/2),b=Math.max(20,B-v),C={from:c-b,to:c+v};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=uA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-bT*o,to:r+dp*o};try{return A.setVisibleRange(l),!0}catch{return!1}}function nl(i,e){if(i.length<e)return[];const t=2/(e+1);let A=i.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:i[e-1].time,value:A}];for(let n=e;n<i.length;n++)A=i[n].close*t+A*(1-t),r.push({time:i[n].time,value:A});return r}function Os(i,e){if(i.length<e)return null;const t=i[i.length-1],A=i.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:A}}function fp(i,e){const t=nl(i,e);return t.length?t[t.length-1]:null}function mp(i,e){if(i.length<e+1)return null;let t=0,A=0;for(let s=1;s<=e;s++){const o=i[s].close-i[s-1].close;o>0?t+=o:A-=o}t/=e,A/=e;for(let s=e+1;s<i.length;s++){const o=i[s].close-i[s-1].close;t=(t*(e-1)+Math.max(o,0))/e,A=(A*(e-1)+Math.max(-o,0))/e}const r=i[i.length-1],n=A===0?100:100-100/(1+t/A);return{time:r.time,value:n}}function gp(i,e=12,t=26,A=9){if(i.length<t+A)return null;const r=nl(i,e),n=nl(i,t);if(!r.length||!n.length)return null;const s=n.map((u,g)=>{const B=r[r.length-n.length+g];return{time:u.time,value:B.value-u.value}});if(s.length<A)return null;const o=2/(A+1);let l=s.slice(0,A).reduce((u,g)=>u+g.value,0)/A;for(let u=A;u<s.length;u++)l=s[u].value*o+l*(1-o);const c=s[s.length-1];return{time:c.time,value:c.value,signal:l,histogram:c.value-l}}const FT=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=Y.useRef(null),l=Y.useRef(null),c=Y.useRef(null),u=Y.useRef(null),g=Y.useRef(null),B=Y.useRef(null),v=Y.useRef([]),b=Y.useRef(!1),C=Y.useRef(null),U=Y.useRef(null),F=Y.useRef(null),S=Y.useRef(null),K=Y.useRef([]),[G,M]=Y.useState(null),[W,ne]=Y.useState(null),[J,V]=Y.useState([]),[ie,re]=Y.useState(null),[ce,Z]=Y.useState([]),Ae=Y.useRef(null),oe=Y.useRef(null),le=Y.useRef(null),se=Y.useRef(!1),ae=Y.useRef(!1);Y.useEffect(()=>{le.current=G;let p=!1;v.current.forEach(f=>{if(f.type==="trendline"&&f.decoration){const O=f===G;f.decoration.isSelected!==O&&(f.decoration.isSelected=O,p=!0)}}),p&&c.current?.applyOptions({})},[G]);const pe=Y.useRef(new Map),we=Y.useRef(null),Qe=Y.useRef(null),Fe=(p,f)=>`${p}_${f}`,Be=()=>{const p=Fe(ye,de);return pe.current.get(p)||null},ve=p=>{if(!p)return;const f=Fe(ye,de);pe.current.set(f,p)},{activeTool:Ce,setActiveTool:be,showGrid:Le,snapToGrid:Ge,chartObjects:Ke,setChartObjects:Te,orders:_e,selectedSymbol:ye,selectedTimeframe:de,drawingsVisible:Pe,chartType:et,chartLocked:it,theme:rt,candleColors:dt,showTradeOrders:fA,showTradePosition:Ze,showTradeHistory:Oe,showSLTP:at,showAskPrice:At,showChartControls:Ct,showCrosshair:xt,showOHLC:GA,currentSymbolData:$A,baseUrl:Gt,endpoints:mA,endpointParams:XA,indicators:Kt,indicatorSettings:Ut}=zt(),gA=Y.useRef({}),[nt,mt]=Y.useState({}),St=Y.useRef(0),It=Y.useRef(Kt),$e=Y.useRef(Ut);It.current=Kt,$e.current=Ut;const He=Y.useRef([]),[tt,Je]=Y.useState(!1),[Me,ze]=Y.useState(null),[Ue,We]=Y.useState([]),[Ne,st]=Y.useState(!0),[lt,vt]=Y.useState(null),[cA,Ai]=Y.useState(0),Ks=Y.useMemo(()=>{const p=Ue.map(f=>ee(f?.time)).filter(f=>Number.isFinite(f));return p.sort((f,O)=>f-O),p},[Ue]),Vs=Y.useRef(null),ii=Y.useRef(new Map);Y.useRef(null);const bp=Y.useRef(0),MA=Y.useRef(null),rr=Y.useRef(!1),jr=Y.useRef(!1);Y.useEffect(()=>{const p=g.current;p&&p.setData(rl(Ue,de))},[Ue,de]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*.8;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*1.25;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const f=p.querySelectorAll("canvas"),O=rt==="light"?"#ffffff":"#12161d";let me=null,H=0;if(f.forEach(X=>{if(X.width>0&&X.height>0){const j=X.width*X.height;j>H&&(H=j,me=X)}}),me)try{const X=document.createElement("canvas");X.width=me.width,X.height=me.height;const j=X.getContext("2d");j.fillStyle=O,j.fillRect(0,0,X.width,X.height),j.drawImage(me,0,0);const q=document.createElement("a");q.download=`chart-${ye}-${de}-${Date.now()}.png`,q.href=X.toDataURL("image/png"),q.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(X){console.warn("Canvas export failed, trying html2canvas",X)}Xv(p,{useCORS:!0,allowTaint:!0,backgroundColor:O,scale:2,logging:!1}).then(X=>{const j=document.createElement("a");j.download=`chart-${ye}-${de}-${Date.now()}.png`,j.href=X.toDataURL("image/png"),j.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(X=>{console.error("Chart screenshot failed",X),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,de,rt]);const al=Y.useMemo(()=>Ue.length===0?[]:et==="line"||et==="area"?Ue.map(p=>({time:p.time,value:p.close})):Ue,[Ue,et]),ZT=p=>{r?r(p):(ze("BUY"),Je(!0))},YT=p=>{n?n(p):(ze("SELL"),Je(!0))},qT=()=>{Je(!1),ze(null)},jT=p=>{const f=W;if(!f||!p)return;const O=(X,j)=>{if(typeof X!="string")return j;const q=X.trim(),ue=q.startsWith("#")?q:`#${q}`;return/^#[0-9A-Fa-f]{6}$/.test(ue)?ue.toLowerCase():j},me=(X,j)=>{const q=Number(X);return Number.isFinite(q)?Math.max(0,Math.min(1,q)):j};let H={...f,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:f.visibleTimeframes};if(f.type==="text"){const X=Number.isFinite(Number(p.price))?Number(p.price):f.price,j=f.primitive;j&&(j.text=typeof p.text=="string"?p.text:j.text,j.color=O(p.color,j.color??"#5f8f96"),j.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):j.fontSize,j.fontWeight=p.fontWeight==="bold"?"bold":"normal",j.fontStyle=p.fontStyle==="italic"?"italic":"normal",j.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:j.textAlign,j.textWrap=!!p.textWrap,j.borderEnabled=!!p.borderEnabled,j.borderColor=O(p.borderColor,j.borderColor??"#5f8f96"),j.borderOpacity=me(p.borderOpacity,j.borderOpacity??.1),j.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),j.bgEnabled=!!p.bgEnabled,j.bgColor=O(p.bgColor,j.bgColor??"#5f8f96"),j.bgOpacity=me(p.bgOpacity,j.bgOpacity??.1),j.price=X),H={...H,price:X,text:typeof p.text=="string"?p.text:f.text}}if(f.type==="trendline"){const X=O(p.lineColor,"#22c55e"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(f.series)try{f.series.applyOptions({color:X,lineWidth:j})}catch{}const q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.point1?.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.point2?.price;if(f.series&&f.point1&&f.point2){const R=f.point1.time??f.point1.rawTime,y=f.point2.time??f.point2.rawTime;try{const h=zA([{time:R,value:q},{time:y,value:ue}]);h.length>0&&f.series.setData(h)}catch{}}const L={...f.point1,price:q},N={...f.point2,price:ue};f.decoration&&(f.decoration.color=X,f.decoration.lineWidth=j,f.decoration.arrowLeft=!!p.arrowLeft,f.decoration.arrowRight=!!p.arrowRight,f.decoration.rayLeft=!!p.rayLeft,f.decoration.rayRight=!!p.rayRight,f.decoration.statsColor=O(p.statsColor,"#5f8f96"),f.decoration.statsPosition=p.statsPosition??"right",f.decoration.statsShowAlways=!!p.statsShowAlways,f.decoration.statsPriceRange=!!p.statsPriceRange,f.decoration.statsBarsRange=!!p.statsBarsRange,f.decoration.statsDateRange=!!p.statsDateRange,f.decoration.statsAngle=!!p.statsAngle,f.decoration.statsDistance=!!p.statsDistance,f.decoration.p1=L,f.decoration.p2=N),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsShowAlways:!!p.statsShowAlways,statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,point1:L,point2:N,decoration:f.decoration}}if(f.type==="pricelevel"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.showPrice!==!1,ue=!!p.showText,L=typeof p.textContent=="string"?p.textContent:"",N=O(p.textColor,"#ffffff"),R=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",y=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):f.price;if(f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,lineWidth:j,axisLabelVisible:q,title:q&&typeof h=="number"?h.toFixed(5):""})}catch{}const T=u.current;if(ue&&L&&T)if(f.textPrimitive)f.textPrimitive.text=L,f.textPrimitive.textColor=N,f.textPrimitive.hAlign=R,f.textPrimitive.vAlign=y,f.textPrimitive.price=h;else{const I=new tp(h,{text:L,textColor:N,hAlign:R,vAlign:y});try{T.attachPrimitive(I)}catch{}f.textPrimitive=I}else if(f.textPrimitive&&T){try{T.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:j,showPrice:q,showText:ue,textContent:L,textColor:N,textHAlign:R,textVAlign:y,textPrimitive:f.textPrimitive}}if(f.type==="horizontalray"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.showPrice!==!1,ue=!!p.showText,L=typeof p.textContent=="string"?p.textContent:"",N=O(p.textColor,"#ffffff"),R=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",y=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):f.price,T=f.primitive;if(T&&(T.price=h,T.color=X,T.lineWidth=j),f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,axisLabelVisible:q,title:q&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(ue&&L&&I)if(f.textPrimitive)f.textPrimitive.text=L,f.textPrimitive.textColor=N,f.textPrimitive.hAlign=R,f.textPrimitive.vAlign=y,f.textPrimitive.price=h,f.textPrimitive.originTime=f.rawOriginTime;else{const w=new tp(h,{text:L,textColor:N,hAlign:R,vAlign:y,originTime:f.rawOriginTime});try{I.attachPrimitive(w)}catch{}f.textPrimitive=w}else if(f.textPrimitive&&I){try{I.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:j,showPrice:q,showText:ue,textContent:L,textColor:N,textHAlign:R,textVAlign:y,textPrimitive:f.textPrimitive}}if(f.type==="verticalline"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.showDate!==!1,ue=f.primitive;ue&&(ue.color=X,ue.lineWidth=j,ue.showDate=q),H={...H,lineColor:X,lineWidth:j,showDate:q}}if(f.type==="infoline"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.statsShowAlways!==!1,ue=O(p.statsColor,"#5f8f96"),L=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,R=!!p.statsBarsRange,y=!!p.statsDateRange,h=!!p.statsAngle,T=!!p.statsDistance,I=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,d=f.p1.rawTime,_=f.p2.rawTime,Q=w-I,E=I!==0?Q/Math.abs(I)*100:0,x=f.p1.normalizedTime??0,m=f.p2.normalizedTime??0,D=uA(de)||3600,P=Math.abs(m-x),k=Math.max(1,Math.round(P/D)),z=Math.max(1,Math.round(P/86400)),$=c.current,te=u.current,he=$?$.timeScale().timeToCoordinate(d):null,ge=te?te.priceToCoordinate(I):null,xe=$?$.timeScale().timeToCoordinate(_):null,Ee=te?te.priceToCoordinate(w):null,Re=he!=null&&ge!=null&&xe!=null&&Ee!=null?Math.atan2(-(Ee-ge),xe-he)*(180/Math.PI):f.primitive?.info?.angle??0,je={priceDiff:Q,pricePct:E,bars:k,days:z,angle:Re},Ve=f.primitive;Ve&&(Ve.color=X,Ve.lineWidth=j,Ve.statsShowAlways=q,Ve.statsColor=ue,Ve.statsPosition=L,Ve.statsPriceRange=N,Ve.statsBarsRange=R,Ve.statsDateRange=y,Ve.statsAngle=h,Ve.statsDistance=T,Ve.p1={...f.p1,price:I},Ve.p2={...f.p2,price:w},Ve.info=je),H={...H,lineColor:X,lineWidth:j,statsShowAlways:q,statsColor:ue,statsPosition:L,statsPriceRange:N,statsBarsRange:R,statsDateRange:y,statsAngle:h,statsDistance:T,p1:{...f.p1,price:I},p2:{...f.p2,price:w}}}if(f.type==="rulerline"){const X=O(p.lineColor,"#3b82f6"),j=p.showArea!==!1,q=!!p.statsShowAlways,ue=O(p.statsColor,"#5f8f96"),L=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,R=!!p.statsBarsRange,y=!!p.statsDateRange,h=f.primitive;h&&(h.lineColor=X,h.showArea=j,h.statsShowAlways=q,h.statsColor=ue,h.statsPosition=L,h.statsPriceRange=N,h.statsBarsRange=R,h.statsDateRange=y),H={...H,lineColor:X,showArea:j,statsShowAlways:q,statsColor:ue,statsPosition:L,statsPriceRange:N,statsBarsRange:R,statsDateRange:y}}if(f.type==="arrowedline"){const X=O(p.lineColor,"#f59e0b"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsBarsRange=!!p.statsBarsRange,L.statsDateRange=!!p.statsDateRange,L.statsAngle=!!p.statsAngle,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="rayline"){const X=O(p.lineColor,"#7aa6ae"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsBarsRange=!!p.statsBarsRange,L.statsDateRange=!!p.statsDateRange,L.statsAngle=!!p.statsAngle,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="extendedline"){const X=O(p.lineColor,"#7aa6ae"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsBarsRange=!!p.statsBarsRange,L.statsDateRange=!!p.statsDateRange,L.statsAngle=!!p.statsAngle,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="crossline"){const X=O(p.lineColor,"#06a0e3"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.price))?Number(p.price):f.p.price,ue=f.primitive;ue&&(ue.color=X,ue.lineWidth=j,ue.showTime=!!p.showTime,ue.showPrice=!!p.showPrice,ue.center={...f.p,price:q}),H={...H,lineColor:X,lineWidth:j,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...f.p,price:q}}}if(f.type==="trendbyangle"){const X=O(p.lineColor,"#7aa6ae"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="disjointchannel"){const X=O(p.lineColor,"#129f5c"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=O(p.fillColor,"#6aa84f"),ue=me(p.fillOpacity,.1),L=O(p.pricesColor,"#129f5c"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,R=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,y=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=j,h.fillColor=q,h.fillOpacity=ue,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=L,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...f.p1,price:N},h.p3={...f.p3,price:R},h.p2={...f.p2,price:y}),H={...H,lineColor:X,lineWidth:j,fillColor:q,fillOpacity:ue,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:L,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:N},p3:{...f.p3,price:R},p2:{...f.p2,price:y}}}if(f.type==="flattopbottom"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=O(p.fillColor,"#3b82f6"),ue=me(p.fillOpacity,.12),L=O(p.pricesColor,"#3b82f6"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,R=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,y=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=j,h.fillColor=q,h.fillOpacity=ue,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=L,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...f.p1,price:N},h.p3={...f.p3,price:R},h.p2={...f.p2,price:y}),H={...H,lineColor:X,lineWidth:j,fillColor:q,fillOpacity:ue,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:L,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:N},p3:{...f.p3,price:R},p2:{...f.p2,price:y}}}Te(X=>{const j=X.map(q=>q===f?H:q);return v.current=j,j}),le.current===f&&(le.current=H),M(X=>X===f?H:X),re(X=>X===f?H:X),ne(H);try{c.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const p=o.current;if(!p)return;const f=p.getBoundingClientRect(),O=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},me=rt==="light",H=fm(p,{width:f.width||p.clientWidth,height:f.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:me?"#FFFFFF":"#0d1117",type:"solid"},textColor:me?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Le,color:Le?me?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?me?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}},rightPriceScale:{borderColor:me?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:me?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:me?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:Ce===1?1:0,vertLine:{width:1,color:me?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:me?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:me?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:me?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Ce===1,horzLineVisible:Ce===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Ce===null||Ce===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),X=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),j=X.includes("JPY"),q=tn(X),ue=en(X);let L,N;j?(L=.001,N=w=>Math.abs(Number(w)).toFixed(3)):q?X.startsWith("BTC")||X.startsWith("ETH")?(L=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(L=1e-4,N=w=>Math.abs(Number(w)).toFixed(4)):ue&&(X.startsWith("XAU")||X.startsWith("XAG"))?(L=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(L=1e-4,N=w=>Math.abs(Number(w)).toFixed(5));const R=H.addCandlestickSeries({upColor:me?"#089981":"#26a69a",downColor:me?"#f23645":"#ef5350",wickUpColor:me?"#089981":"#26a69a",wickDownColor:me?"#f23645":"#ef5350",borderUpColor:me?"#089981":"#26a69a",borderDownColor:me?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:L,formatter:N}}),y=H.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=H,u.current=R,g.current=y,y.setData(rl(Ue,de)),requestAnimationFrame(()=>{if(p&&H){const w=p.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),T=()=>{if(ae.current&&ii.current.size>0){const w=h.getVisibleRange();w&&ve(w)}};h.subscribeVisibleTimeRangeChange(T);const I=new ResizeObserver(w=>{for(const d of w){const{width:_,height:Q}=d.contentRect;if(_>0&&Q>0&&H){const E=h.getVisibleRange();H.resize(_,Q),E&&setTimeout(()=>{try{h.setVisibleRange(E)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(T),I.disconnect(),H.remove(),c.current=null,u.current=null,g.current=null,B.current=null,v.current=[],MA.current&&clearTimeout(MA.current)}},[]),Y.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}}})},[Le]),Y.useEffect(()=>{const p=c.current;if(!p)return;const f=rt==="light";p.applyOptions({layout:{background:{color:f?"#FFFFFF":"#12161d"},textColor:f?"#020617":"#fff"},grid:{vertLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:f?"#e5e7eb":"#1e293b"},timeScale:{borderColor:f?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1},horzLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1}}})},[rt,Le]),Y.useEffect(()=>{const p=u.current;!p||!dt||p.applyOptions({upColor:dt.upColor,downColor:dt.downColor,wickUpColor:dt.upColor,wickDownColor:dt.downColor,borderUpColor:dt.upColor,borderDownColor:dt.downColor})},[dt]),Y.useEffect(()=>{if(!c.current)return;const f=!it&&!(Ce!==null&&Ce!==1&&Ce!==0),O=!it;c.current.applyOptions({crosshair:{mode:Ce===1?1:0,vertLine:{visible:Ce===1||xt,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Ce===1||xt,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:f,horzTouchDrag:f,vertTouchDrag:f},handleScale:{axisPressedMouseMove:{time:f,price:f},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:f,price:f},mouseWheel:O,pinch:O}})},[Ce,it,xt,rt]);const eb=()=>{const p=u.current;v.current.forEach(f=>{if(f.primitive){try{p&&p.detachPrimitive(f.primitive)}catch{}if(f.series&&f.series!==p)try{f.series.detachPrimitive(f.primitive)}catch{}}if(f.priceLine&&p)try{p.removePriceLine(f.priceLine)}catch{}if(f.textPrimitive&&p)try{p.detachPrimitive(f.textPrimitive)}catch{}}),v.current=[],Te([]),be(null)},xp=(p,f=!1)=>{p&&v.current.forEach(O=>{if(O.primitive){try{p.detachPrimitive(O.primitive)}catch{}try{p.attachPrimitive(O.primitive)}catch{}}if(f&&O.type==="pricelevel"&&O.priceLine)try{const me=O.showPrice!==!1,H=p.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:me,title:me&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}if(f&&O.type==="horizontalray"&&O.priceLine)try{const me=O.showPrice!==!1,H=p.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:me,title:me&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}})};Y.useEffect(()=>{(async()=>{if(!ye||!de){We([]),ae.current=!1;return}try{if(MA.current&&(clearTimeout(MA.current),MA.current=null),rr.current=!0,st(!0),vt(null),We([]),ae.current=!1,jr.current=!1,Qe.current!==null&&Qe.current!==ye&&eb(),Qe.current=ye,u.current)try{u.current.setData([])}catch{}const f=cp(de),O=mT(de,f),me=Gt||Yv?.VITE_BASE_URL||"http://localhost:5002",H=mA?.candles||"/api/chart/candles",X=XA?.candles||{},j={symbol:X.symbol||"symbol",timeframe:X.timeframe||"timeframe",limit:X.limit||"limit",daysBack:X.daysBack||"daysBack"},q={};q[j.symbol]=ye,q[j.timeframe]=de,q[j.limit]=O,X.daysBack!==!1&&(q[j.daysBack]=f);const ue=localStorage.getItem("token")??localStorage.getItem("authToken"),L=await gt.get(`${me}${H}`,{params:q,timeout:1e4,headers:ue?{Authorization:`Bearer ${ue}`}:{}});let N=[];if(Array.isArray(L.data)?N=L.data:L.data&&L.data.data&&Array.isArray(L.data.data)?N=L.data.data:L.data&&Array.isArray(L.data)&&(N=L.data),N&&N.length>0){const{candles:R,stats:y}=fl(N,ye,de);R.length>0?(We(R),ii.current=new Map,R.forEach(h=>{ii.current.set(h.time,h)}),jr.current=!0,rr.current=!1,Vs.current?.connected&&ye&&de&&Vs.current.emit("subscribeCandles",{symbol:ye,timeframe:de})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),rr.current=!1,We([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),rr.current=!1,We([])}catch(f){console.error(`❌ Error fetching ${ye}:`,f.message);const O=f.code==="ECONNABORTED"||f.message&&f.message.includes("timeout");vt(O?"Request timed out. No data available for this symbol.":f.message||"Failed to load candles."),rr.current=!1,We([]),st(!1)}})()},[ye,de,cA]),Y.useEffect(()=>{Vs.current=kn.getSocket();const p=Vs.current,f=()=>{if(jr.current&&ye&&de&&p.connected){const q={symbol:ye,timeframe:de};p.emit("subscribeCandles",q)}},O=()=>{setTimeout(()=>{ye&&de&&f()},200)},me=q=>{},H=q=>{};p.on("connect",O),p.on("disconnect",me),p.on("connect_error",H),p.on("subscription:confirmed",q=>{q.type});const X=q=>{if(!jr.current||!q||!q.candle||!q.symbol)return;const ue=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(ue(q.symbol)!==ue(ye)||q.timeframe&&q.timeframe!==de)return;const{candle:L}=q,N=ml(L,ye,de);if(!N)return;const R=Date.now();if(R-bp.current<200)return;bp.current=R;const y=c.current?.timeScale(),h=y?.getVisibleRange(),T=u.current,I=c.current;if(!(!T||!I||!ae.current&&!jr.current||T?.seriesType?.()!==(et==="line"?"Line":et==="area"?"Area":et==="bars"?"Bar":"Candlestick")))try{const _=ii.current.get(N.time),Q=!_,E=_?{time:N.time,open:_.open,high:Math.max(_.high,N.high),low:Math.min(_.low,N.low),close:N.close}:N;ii.current.set(N.time,E),Q&&g.current&&g.current.setData(rl(Array.from(ii.current.values()),de));try{et==="line"||et==="area"?T.update({time:E.time,value:E.close}):T.update(E),y&&h&&ve(h)}catch(P){throw P}const x=It.current||{},m=$e.current||{},D=gA.current;if(Object.keys(D).length>0){const P=Array.from(ii.current.values()).sort((k,z)=>k.time-z.time);if(x.sma20&&D.sma20){const k=Os(P,m.smaPeriod||20);if(k)try{D.sma20.update(k)}catch{}}if(x.sma50&&D.sma50){const k=Os(P,50);if(k)try{D.sma50.update(k)}catch{}}if(x.ema12&&D.ema12){const k=fp(P,m.emaPeriod||12);if(k)try{D.ema12.update(k)}catch{}}if(x.rsi&&D.rsi){const k=mp(P,m.rsiPeriod||14);if(k){try{D.rsi.update(k)}catch{}if(D.rsi70)try{D.rsi70.update({time:k.time,value:70})}catch{}if(D.rsi30)try{D.rsi30.update({time:k.time,value:30})}catch{}}}if(x.macd&&D.macdLine){const k=gp(P,12,26,9);if(k){try{D.macdLine.update({time:k.time,value:k.value})}catch{}try{D.macdSignal.update({time:k.time,value:k.signal})}catch{}try{D.macdHist.update({time:k.time,value:k.histogram,color:k.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(x.bollinger&&D.bbMiddle){const k=Rs(P,m.bbPeriod||20,m.bbStdDev||2);if(k){try{D.bbUpper.update({time:k.time,value:k.upper})}catch{}try{D.bbMiddle.update({time:k.time,value:k.middle})}catch{}try{D.bbLower.update({time:k.time,value:k.lower})}catch{}}}}}catch{}};p.on("candleUpdate",X);const j=()=>{p.connected&&ye&&de&&f()};if(p.connected)j();else{const q=()=>{setTimeout(j,200)};p.once("connect",q),setTimeout(()=>{p.connected&&j()},500)}return()=>{p.off("candleUpdate",X),p.off("connect",O),p.off("disconnect",me),p.off("connect_error",H),p.off("subscription:confirmed"),ye&&de&&p.connected&&p.emit("unsubscribeCandles",{symbol:ye,timeframe:de})}},[ye,de,Gt]),Y.useEffect(()=>{const p=u.current,f=c.current;if(!(!p||!f)&&!(rr.current&&Ue.length>0)&&!(Ue.length===0&&ae.current)){if(Ue.length===0&&!ae.current){if(Ne)return;const O=f.timeScale();p.setData([]),O.fitContent(),MA.current&&clearTimeout(MA.current),MA.current=setTimeout(()=>requestAnimationFrame(()=>st(!1)),400);return}if(!ae.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),me=O.includes("JPY"),H=en(O),X=tn(O);let j,q;me?(j=.001,q=h=>Math.abs(Number(h)).toFixed(3)):X?O.startsWith("BTC")||O.startsWith("ETH")?(j=.01,q=h=>Math.abs(Number(h)).toFixed(2)):(j=1e-4,q=h=>Math.abs(Number(h)).toFixed(4)):H&&(O.startsWith("XAU")||O.startsWith("XAG"))?(j=.01,q=h=>Math.abs(Number(h)).toFixed(2)):(j=1e-4,q=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:j,formatter:q}})}catch{}const ue=f.timeScale(),L=Fe(ye,de);we.current,we.current=L;const N=[...Ue].sort((h,T)=>h.time-T.time);if(et==="line"||et==="area"){const h=N?.map(T=>({time:T.time,value:T.close})).filter(T=>T.time!=null);h.length>0&&p.setData(h)}else N?.length>0&&p.setData(N);dt&&p.applyOptions({upColor:dt.upColor,downColor:dt.downColor,wickUpColor:dt.upColor,wickDownColor:dt.downColor,borderUpColor:dt.upColor,borderDownColor:dt.downColor}),xp(p);const R=uA(de)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,E=ke(Q,R);h.primitive.originTime=E,h.originTime=E;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,E=ke(Q,R);h.primitive.time=E,h.time=ee(E);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,E=h.rawP2Time??h.p2.rawTime,x=N.length>0?N[0].time:null,m=N.length>0?N[N.length-1].time:null,D=z=>{const $=ke(z,R);return x==null||m==null?$:Math.min(Math.max($,x),m)},P=D(Q),k=D(E);h.p1.rawTime=P,h.p1.normalizedTime=ee(P),h.p2.rawTime=k,h.p2.normalizedTime=ee(k),h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:k,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,E=h.rawP2Time??h.p2.rawTime,x=N.length>0?N[0].time:null,m=N.length>0?N[N.length-1].time:null,D=he=>{const ge=ke(he,R);return x==null||m==null?ge:Math.min(Math.max(ge,x),m)},P=D(Q),k=D(E);h.p1.rawTime=P,h.p2.rawTime=k,h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:k,price:h.p2.price};const z=ee(P),$=ee(k),te=Math.abs(($??0)-(z??0));h.primitive.info={priceDiff:h.p2.price-h.p1.price,pricePct:(h.p2.price-h.p1.price)/Math.abs(h.p1.price||1)*100,bars:Ns(Ks,P,k,de),days:Math.max(1,Math.round(te/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="rayline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="extendedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="trendbyangle"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=E=>{const x=ke(E.rawTime,R);E.rawTime=x,E.normalizedTime=ee(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="flattopbottom"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=E=>{const x=ke(E.rawTime,R);E.rawTime=x,E.normalizedTime=ee(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="regressionchannel"&&h.primitive&&h.p1&&h.p2){const Q=ir(N,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const E=h.primitive;E.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},E.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},E.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},E.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},E.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},E.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.intercept=Q.intercept,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="stddevchannel"&&h.primitive&&h.p1&&h.p2){const Q=Xr(N,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const E=h.primitive;E.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},E.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},E.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},E.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},E.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},E.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="andrewspitchfork"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R),x=ke(h.p3.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.p3.rawTime=x,h.p3.normalizedTime=ee(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="gannfan"||h.type==="ganngrid")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price};return}if((h.type==="circle"||h.type==="ellipse")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price};return}if(h.type==="triangle"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R),x=ke(h.p3.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.p3.rawTime=x,h.p3.normalizedTime=ee(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="fibonacci"||h.type==="rectangle")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price};return}if(h.type!=="trendline"&&h.type!=="gannline"||!h.series||!h.point1||!h.point2)return;const T=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=ke(T,R),d=ke(I,R);h.point1.time=w,h.point2.time=d;const _=zA([{time:w,value:h.point1.price},{time:d,value:h.point2.price}]);try{_.length>0&&h.series.setData(_)}catch{}}),N?.length>0){const h=N[N?.length-1].time,T=uA(de)||60,w=h-(de==="M1"?150:de==="M5"?120:100)*T;try{ue.setVisibleRange({from:w,to:h+T*up})}catch{ue.fitContent()}}else ue.fitContent();try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0;const y=ue.getVisibleRange();ve(y),MA.current&&clearTimeout(MA.current),MA.current=setTimeout(()=>requestAnimationFrame(()=>st(!1)),400)}}},[Ue.length,et,ye,de]),Y.useEffect(()=>{const p=c.current;if(!p||!ae.current||Ue.length===0)return;const f=p.timeScale(),O=f.getVisibleRange()||Be();if(u.current)try{p.removeSeries(u.current)}catch{}if(B.current)try{p.removeSeries(B.current),B.current=null}catch{}let me;const H=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=H.includes("JPY"),j=en(H),q=tn(H);let ue,L;X?(ue=.001,L=y=>Math.abs(Number(y)).toFixed(3)):q?H.startsWith("BTC")||H.startsWith("ETH")?(ue=.01,L=y=>Math.abs(Number(y)).toFixed(2)):(ue=1e-4,L=y=>Math.abs(Number(y)).toFixed(4)):j&&(H.startsWith("XAU")||H.startsWith("XAG"))?(ue=.01,L=y=>Math.abs(Number(y)).toFixed(2)):(ue=1e-4,L=y=>Math.abs(Number(y)).toFixed(5));const N={type:"custom",minMove:ue,formatter:L};if(et==="bars"){const y=rt==="light";me=p.addBarSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const h=[...Ue].sort((T,I)=>T.time-I.time);h?.length>0&&me.setData(h)}else if(et==="line"){me=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const y=zA(al);y.length>0&&me.setData(y)}else if(et==="area"){me=p.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const y=zA(al);y.length>0&&me.setData(y)}else if(et==="volume ticks"||et==="volume"){const y=rt==="light";me=p.addCandlestickSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",wickUpColor:y?"#089981":"#26A69A",wickDownColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",borderVisible:!0,priceFormat:N,priceScaleId:"right"});const h=[...Ue].sort((w,d)=>w.time-d.time);h?.length>0&&me.setData(h);const T=p.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),p.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const I=h?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));I.length>0&&T.setData(I),B.current=T}else{const y=rt==="light";me=p.addCandlestickSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",wickUpColor:y?"#089981":"#26A69A",wickDownColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",borderVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const h=[...Ue].sort((T,I)=>T.time-I.time);h?.length>0&&me.setData(h)}if(u.current=me,dt&&me)try{me.applyOptions({upColor:dt.upColor,downColor:dt.downColor,wickUpColor:dt.upColor,wickDownColor:dt.downColor,borderUpColor:dt.upColor,borderDownColor:dt.downColor})}catch{}xp(me,!0);const R=uA(de)||60;if(v.current.forEach(y=>{if(y.type==="horizontalray"&&y.primitive){const E=y.rawOriginTime??y.primitive.originTime,x=ke(E,R);y.primitive.originTime=x,y.originTime=x;return}if(y.type==="verticalline"&&y.primitive){const E=y.rawTime??y.primitive.time,x=ke(E,R);y.primitive.time=x,y.time=ee(x);return}if(y.type==="infoline"&&y.primitive&&y.p1&&y.p2){const E=y.rawP1Time??y.p1.rawTime,x=y.rawP2Time??y.p2.rawTime,m=[...Ue].sort((te,he)=>te.time-he.time),D=m.length>0?m[0].time:null,P=m.length>0?m[m.length-1].time:null,k=te=>{const he=ke(te,R);return D==null||P==null?he:Math.min(Math.max(he,D),P)},z=k(E),$=k(x);y.p1.rawTime=z,y.p1.normalizedTime=ee(z),y.p2.rawTime=$,y.p2.normalizedTime=ee($),y.primitive.p1={rawTime:z,price:y.p1.price},y.primitive.p2={rawTime:$,price:y.p2.price};return}if(y.type==="rulerline"&&y.primitive&&y.p1&&y.p2){const E=y.rawP1Time??y.p1.rawTime,x=y.rawP2Time??y.p2.rawTime,m=[...Ue].sort((xe,Ee)=>xe.time-Ee.time),D=m.length>0?m[0].time:null,P=m.length>0?m[m.length-1].time:null,k=xe=>{const Ee=ke(xe,R);return D==null||P==null?Ee:Math.min(Math.max(Ee,D),P)},z=k(E),$=k(x);y.p1.rawTime=z,y.p2.rawTime=$,y.primitive.p1={rawTime:z,price:y.p1.price},y.primitive.p2={rawTime:$,price:y.p2.price};const te=ee(z),he=ee($),ge=Math.abs((he??0)-(te??0));y.primitive.info={priceDiff:y.p2.price-y.p1.price,pricePct:(y.p2.price-y.p1.price)/Math.abs(y.p1.price||1)*100,bars:Ns(Ks,z,$,de),days:Math.max(1,Math.round(ge/86400))};return}if(y.type==="arrowedline"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="rayline"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="extendedline"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="trendbyangle"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="disjointchannel"&&y.primitive&&y.p1&&y.p2&&y.p3&&y.p4){const E=x=>{const m=ke(x.rawTime,R);x.rawTime=m,x.normalizedTime=ee(m)};E(y.p1),E(y.p2),E(y.p3),E(y.p4),y.primitive.p1={rawTime:y.p1.rawTime,price:y.p1.price},y.primitive.p2={rawTime:y.p2.rawTime,price:y.p2.price},y.primitive.p3={rawTime:y.p3.rawTime,price:y.p3.price},y.primitive.p4={rawTime:y.p4.rawTime,price:y.p4.price};return}if(y.type==="flattopbottom"&&y.primitive&&y.p1&&y.p2&&y.p3&&y.p4){const E=x=>{const m=ke(x.rawTime,R);x.rawTime=m,x.normalizedTime=ee(m)};E(y.p1),E(y.p2),E(y.p3),E(y.p4),y.primitive.p1={rawTime:y.p1.rawTime,price:y.p1.price},y.primitive.p2={rawTime:y.p2.rawTime,price:y.p2.price},y.primitive.p3={rawTime:y.p3.rawTime,price:y.p3.price},y.primitive.p4={rawTime:y.p4.rawTime,price:y.p4.price};return}if(y.type==="regressionchannel"&&y.primitive&&y.p1&&y.p2){const E=[...Ue].sort((D,P)=>D.time-P.time),x=ir(E,y.p1,y.p2,y.stdMultiplier??1);if(!x)return;const m=y.primitive;m.mid1={rawTime:x.p1.rawTime,price:x.p1.price},m.mid2={rawTime:x.p2.rawTime,price:x.p2.price},m.top1={rawTime:x.top1.rawTime,price:x.top1.price},m.top2={rawTime:x.top2.rawTime,price:x.top2.price},m.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},m.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},y.p1=x.p1,y.p2=x.p2,y.top1=x.top1,y.top2=x.top2,y.bot1=x.bot1,y.bot2=x.bot2,y.slope=x.slope,y.intercept=x.intercept,y.stdDev=x.stdDev,y.offset=x.offset,y.barCount=x.barCount;return}if(y.type==="stddevchannel"&&y.primitive&&y.p1&&y.p2){const E=[...Ue].sort((D,P)=>D.time-P.time),x=Xr(E,y.p1,y.p2,y.stdMultiplier??1);if(!x)return;const m=y.primitive;m.mid1={rawTime:x.p1.rawTime,price:x.p1.price},m.mid2={rawTime:x.p2.rawTime,price:x.p2.price},m.top1={rawTime:x.top1.rawTime,price:x.top1.price},m.top2={rawTime:x.top2.rawTime,price:x.top2.price},m.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},m.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},y.p1=x.p1,y.p2=x.p2,y.top1=x.top1,y.top2=x.top2,y.bot1=x.bot1,y.bot2=x.bot2,y.slope=x.slope,y.stdDev=x.stdDev,y.offset=x.offset,y.barCount=x.barCount;return}if(y.type==="andrewspitchfork"&&y.primitive&&y.p1&&y.p2&&y.p3){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R),m=ke(y.p3.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.p3.rawTime=m,y.p3.normalizedTime=ee(m),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price},y.primitive.p3={rawTime:m,price:y.p3.price};return}if((y.type==="gannfan"||y.type==="ganngrid")&&y.primitive&&y.p1&&y.p2){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price};return}if((y.type==="circle"||y.type==="ellipse")&&y.primitive&&y.p1&&y.p2){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price};return}if(y.type==="triangle"&&y.primitive&&y.p1&&y.p2&&y.p3){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R),m=ke(y.p3.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.p3.rawTime=m,y.p3.normalizedTime=ee(m),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price},y.primitive.p3={rawTime:m,price:y.p3.price};return}if((y.type==="fibonacci"||y.type==="rectangle")&&y.primitive&&y.p1&&y.p2){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price};return}if(y.type!=="trendline"&&y.type!=="gannline"||!y.series||!y.point1||!y.point2)return;const h=y.type==="gannline"?"#7aa6ae":"#22c55e";try{p.removeSeries(y.series)}catch{}const T=p.addLineSeries({color:y.lineColor??h,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),I=y.point1.rawTime??y.point1.time,w=y.point2.rawTime??y.point2.time,d=ke(I,R),_=ke(w,R);y.point1.time=d,y.point2.time=_;const Q=zA([{time:d,value:y.point1.price},{time:_,value:y.point2.price}]);try{Q.length>0&&T.setData(Q)}catch{}if(y.decoration)try{T.attachPrimitive(y.decoration)}catch{}y.series=T}),O&&ae.current)setTimeout(()=>{try{f.setVisibleRange(O),ve(O)}catch{if(Ue.length>0)try{const h=Ue[Ue.length-1].time,T=uA(de)||60,I=h-100*T;f.setVisibleRange({from:I,to:h+T*up}),ve(f.getVisibleRange())}catch{f.fitContent(),ve(f.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!ae.current){f.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0,ve(f.getVisibleRange())}},[et,Ue.length,al.length,ye,dt]),Y.useEffect(()=>{const p=c.current,f=B.current;if(!p||!f||!ae.current||Ue.length===0||et!=="volume"&&et!=="volume ticks")return;const me=[...Ue].sort((H,X)=>H.time-X.time)?.map(H=>({time:H.time,value:H.volume||0,color:H.close>=H.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));me.length>0&&f.setData(me)},[Ue,et]),Y.useEffect(()=>{if(!ye||!de||!Kt)return;const f=Object.entries(Kt).filter(([q,ue])=>ue).map(([q])=>q).filter(q=>q.startsWith("sma")||q.startsWith("ema")||q==="rsi"||q==="macd");if(f.length===0){mt({});return}const O=f.map(q=>q==="sma20"?`sma:${Ut?.smaPeriod||20}`:q==="sma50"?"sma:50":q==="ema12"?`ema:${Ut?.emaPeriod||12}`:q==="rsi"?`rsi:${Ut?.rsiPeriod||14}`:q==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const me=++St.current,H=Gt||"http://localhost:5002",X=mA?.indicators||"/api/market-data/indicators",j=localStorage.getItem("token")??localStorage.getItem("authToken");gt.get(`${H}${X}`,{params:{symbol:ye,timeframe:de,indicators:O},headers:j?{Authorization:`Bearer ${j}`}:{}}).then(q=>{me===St.current&&mt(q.data?.data||{})}).catch(q=>{console.error("[ChartArea] Indicator fetch error:",q?.message),me===St.current&&mt({})})},[ye,de,Kt,Ut,Gt,mA]),Y.useEffect(()=>{const p=c.current;if(!p||!ae.current)return;const f=gA.current,O=(N,R)=>(f[N]||(f[N]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...R})),f[N]),me=N=>{if(f[N]){try{p.removeSeries(f[N])}catch{}delete f[N]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(me)},X=Kt||{};if(X.sma20&&nt.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(nt.sma20.data.map(R=>({time:R.time,value:R.value}))):me("sma20"),X.sma50&&nt.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(nt.sma50.data.map(R=>({time:R.time,value:R.value}))):me("sma50"),X.ema12&&nt.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(nt.ema12.data.map(R=>({time:R.time,value:R.value}))):me("ema12"),X.rsi&&nt.rsi?.data?.length){const N=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:T=>T.toFixed(1)}});p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),N.setData(nt.rsi.data.map(T=>({time:T.time,value:T.value}))),f.rsi70||(f.rsi70=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),f.rsi30||(f.rsi30=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const R=nt.rsi.data,y=R[0]?.time,h=R[R.length-1]?.time;y&&h&&(f.rsi70.setData([{time:y,value:70},{time:h,value:70}]),f.rsi30.setData([{time:y,value:30},{time:h,value:30}]))}else me("rsi"),me("rsi70"),me("rsi30");if(X.macd&&nt.macd?.data?.length){const N=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:T=>T.toFixed(4)}}),R=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});f.macdHist||(f.macdHist=p.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:T=>T.toFixed(4)}}));const y=X.rsi?.65:.8;p.priceScale("macd").applyOptions({scaleMargins:{top:y,bottom:0},borderVisible:!1,autoScale:!0}),X.rsi&&p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const h=nt.macd.data;N.setData(h.map(T=>({time:T.time,value:T.value}))),R.setData(h.map(T=>({time:T.time,value:T.signal}))),f.macdHist.setData(h.map(T=>({time:T.time,value:T.histogram,color:T.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else H();const j=()=>{["bbUpper","bbMiddle","bbLower"].forEach(me)};if(X.bollinger){const N=Array.from(ii.current.values()).sort((T,I)=>T.time-I.time),R=$e.current?.bbPeriod||20,y=$e.current?.bbStdDev||2,h=gl(N,R,y);if(h){const T=O("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),I=O("bbMiddle",{color:"rgba(33,150,243,0.8)",lineWidth:1.5}),w=O("bbLower",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2});T.setData(h.upper),I.setData(h.middle),w.setData(h.lower)}}else j();const q=Array.from(ii.current.values()).sort((N,R)=>N.time-R.time);if(q.length>0){const N=$e.current||{};if(X.sma20&&f.sma20){const R=Os(q,N.smaPeriod||20);if(R)try{f.sma20.update(R)}catch{}}if(X.sma50&&f.sma50){const R=Os(q,50);if(R)try{f.sma50.update(R)}catch{}}if(X.ema12&&f.ema12){const R=fp(q,N.emaPeriod||12);if(R)try{f.ema12.update(R)}catch{}}if(X.rsi&&f.rsi){const R=mp(q,N.rsiPeriod||14);if(R){try{f.rsi.update(R)}catch{}if(f.rsi70)try{f.rsi70.update({time:R.time,value:70})}catch{}if(f.rsi30)try{f.rsi30.update({time:R.time,value:30})}catch{}}}if(X.macd&&f.macdLine){const R=gp(q,12,26,9);if(R){try{f.macdLine.update({time:R.time,value:R.value})}catch{}try{f.macdSignal.update({time:R.time,value:R.signal})}catch{}try{f.macdHist.update({time:R.time,value:R.histogram,color:R.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(X.bollinger&&f.bbMiddle){const R=Rs(q,N.bbPeriod||20,N.bbStdDev||2);if(R){try{f.bbUpper.update({time:R.time,value:R.upper})}catch{}try{f.bbMiddle.update({time:R.time,value:R.middle})}catch{}try{f.bbLower.update({time:R.time,value:R.lower})}catch{}}}}const ue=X.rsi&&nt.rsi?.data?.length||X.macd&&nt.macd?.data?.length,L=X.rsi&&nt.rsi?.data?.length&&X.macd&&nt.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:L?.4:ue?.25:.05}})}catch{}},[nt,Kt,Ue.length]),Y.useEffect(()=>()=>{const p=c.current;if(!p)return;const f=gA.current;Object.keys(f).forEach(O=>{try{p.removeSeries(f[O])}catch{}}),gA.current={}},[ye,de]),Y.useEffect(()=>{const p=c.current,f=u.current,O=o.current;if(!p||!f||!O)return;const H=Ce!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][Ce]:null,X=(L,N)=>{const R=Math.min(L.time,N.time),y=Math.max(L.time,N.time),h=L.time<=N.time?L.rawTime:N.rawTime,T=L.time<=N.time?N.rawTime:L.rawTime,I=Math.max(L.price,N.price),w=Math.min(L.price,N.price),d=ee(Math.round((R+y)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:R,price:w},p3:{rawTime:T,normalizedTime:y,price:w}}};if(!H){if(b.current=!1,C.current=null,U.current=null,S.current=null,F.current?.series)try{p.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const d={type:"pricelevel",priceLine:f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};Te(_=>[..._,d]),v.current.push(d),be(null)};return O.addEventListener("click",L),()=>{O.removeEventListener("click",L)}}if(H==="horizontalray"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=new qv(I,T);f.attachPrimitive(w);const d=f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),_=ee(T),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:_,rawOriginTime:T,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};Te(E=>[...E,Q]),v.current.push(Q),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="verticalline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=p.timeScale().coordinateToTime(y);if(h==null)return;const T=new uT(h);f.attachPrimitive(T);const I=ee(h),w={type:"verticalline",primitive:T,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};Te(d=>[...d,w]),v.current.push(w),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="text"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=new pT(T,I);f.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:T,price:I,text:"Text"};Te(_=>[..._,d]),v.current.push(d),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="infoline"){let L=null,N=null;const R=h=>{if(!L)return;const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;N||(N=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null||Q===E)return;const x=Q<=E?[{time:Q,value:L.price},{time:E,value:_}]:[{time:E,value:_},{time:Q,value:L.price}];try{N.setData(x)}catch{}},y=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!L){L={rawTime:d,price:_,normalizedTime:ee(d),x:I,y:w};return}if(N){try{p.removeSeries(N)}catch{}N=null}const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null)return;const x=_-L.price,m=x/Math.abs(L.price)*100,D=uA(de)||3600,P=Math.abs(E-Q),k=Math.max(1,Math.round(P/D)),z=Math.max(1,Math.round(P/86400)),$=L.x,te=L.y,he=I,xe=Math.atan2(-(w-te),he-$)*(180/Math.PI),Ee={priceDiff:x,pricePct:m,bars:k,days:z,angle:xe},Re=new jv({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_},Ee);f.attachPrimitive(Re);const je={type:"infoline",primitive:Re,rawP1Time:L.rawTime,rawP2Time:d,p1:{rawTime:L.rawTime,normalizedTime:Q,price:L.price},p2:{rawTime:d,normalizedTime:E,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};Te(Ve=>[...Ve,je]),v.current.push(je),L=null,be(null)};return O.addEventListener("mousemove",R),O.addEventListener("click",y),()=>{if(O.removeEventListener("mousemove",R),O.removeEventListener("click",y),N)try{p.removeSeries(N)}catch{}}}if(H==="rulerline"){let L=null,N=null;const R=(T,I,w,d)=>{const _=ee(T),Q=ee(w),E=d-I,x=E/Math.abs(I)*100,m=Ns(Ks,T,w,de),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:E,pricePct:x,bars:m,days:P}},y=T=>{if(!L)return;const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null||E===L.normalizedTime)return;const x=R(L.rawTime,L.price,_,Q);if(!N)N=new Ap({rawTime:L.rawTime,price:L.price},{rawTime:_,price:Q},x),f.attachPrimitive(N);else{N.p2={rawTime:_,price:Q},N.info=x;const m=Q>=L.price;N.color=m?"#3b82f6":"#ef5350",N.fillColor=m?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=T=>{const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;if(!L){L={rawTime:_,price:Q,normalizedTime:ee(_)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const E=L.normalizedTime,x=ee(_);if(E==null||x==null)return;const m=R(L.rawTime,L.price,_,Q),D=new Ap({rawTime:L.rawTime,price:L.price},{rawTime:_,price:Q},m);f.attachPrimitive(D);const P={type:"rulerline",primitive:D,rawP1Time:L.rawTime,rawP2Time:_,p1:{rawTime:L.rawTime,normalizedTime:E,price:L.price},p2:{rawTime:_,normalizedTime:x,price:Q},lineColor:Q>=L.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};Te(k=>[...k,P]),v.current.push(P),L=null,be(null)};return O.addEventListener("mousemove",y),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",y),O.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="arrowedline"){let L=null,N=null;const R=h=>{if(!L)return;const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;const Q=ee(d);if(!(Q==null||Q===L.normalizedTime))if(!N)N=new ip({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_}),f.attachPrimitive(N);else{N.p2={rawTime:d,price:_};try{c.current?.applyOptions({})}catch{}}},y=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!L){L={rawTime:d,price:_,normalizedTime:ee(d)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null||Q===E)return;const x=new ip({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_});f.attachPrimitive(x);const m={type:"arrowedline",primitive:x,p1:{rawTime:L.rawTime,normalizedTime:Q,price:L.price},p2:{rawTime:d,normalizedTime:E,price:_},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(D=>[...D,m]),v.current.push(m),L=null,be(null)};return O.addEventListener("mousemove",R),O.addEventListener("click",y),()=>{if(O.removeEventListener("mousemove",R),O.removeEventListener("click",y),N)try{f.detachPrimitive(N)}catch{}}}if(H==="rayline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=y+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=ee(T),Q=ee(d);if(_==null||Q==null)return;const E=new rT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(E);const x={type:"rayline",primitive:E,p1:{rawTime:T,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(m=>[...m,x]),v.current.push(x),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="extendedline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=y+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=ee(T),Q=ee(d);if(_==null||Q==null)return;const E=new nT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(E);const x={type:"extendedline",primitive:E,p1:{rawTime:T,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(m=>[...m,x]),v.current.push(x),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="crossline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d=new oT({rawTime:T,price:I});f.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:T,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};Te(Q=>[...Q,_]),v.current.push(_),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="trendbyangle"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=y+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=ee(T),Q=ee(d);if(_==null||Q==null)return;const E=new aT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(E);const x={type:"trendbyangle",primitive:E,p1:{rawTime:T,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};Te(m=>[...m,x]),v.current.push(x),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="disjointchannel"){let L=null,N=null,R=null,y=null,h=0,T=null;const I=(_,Q,E,x)=>{if(!T)T=new Al(_,Q,E,x),f.attachPrimitive(T);else{T.p1=_,T.p2=Q,T.p3=E,T.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!L)return;const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const m=f.coordinateToPrice(x);if(m==null)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:m},I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P==null)return;const k=(L.price+N.price)/2;D>=k?(R={rawTime:m,normalizedTime:P,price:D},y={rawTime:m,normalizedTime:P,price:2*k-D}):(y={rawTime:m,normalizedTime:P,price:D},R={rawTime:m,normalizedTime:P,price:2*k-D}),I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:R.rawTime,price:R.price},{rawTime:y.rawTime,price:y.price})}},d=_=>{const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top,m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P!=null){if(h===0){L={rawTime:m,normalizedTime:P,price:D},N={rawTime:m,normalizedTime:P,price:D},h=1,I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const k=f.coordinateToPrice(x);if(k==null||Math.abs(k-L.price)<1e-7)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:k},h=2;return}if(h===2&&T){try{f.detachPrimitive(T)}catch{}const k=new Al(T.p1,T.p2,T.p3,T.p4);f.attachPrimitive(k);const z={type:"disjointchannel",primitive:k,p1:L,p2:N,p3:{rawTime:T.p3.rawTime,normalizedTime:ee(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:ee(T.p4.rawTime),price:T.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Te($=>[...$,z]),v.current.push(z),be(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",d),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",d),T)try{f.detachPrimitive(T)}catch{}}}if(H==="flattopbottom"){let L=null,N=null,R=null,y=null,h=0,T=null;const I=(_,Q,E,x)=>{if(!T)T=new rp(_,Q,E,x),f.attachPrimitive(T);else{T.p1=_,T.p2=Q,T.p3=E,T.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!L)return;const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const m=f.coordinateToPrice(x);if(m==null)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:m},I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P==null)return;R={rawTime:m,normalizedTime:P,price:D},y={rawTime:m,normalizedTime:P,price:N.price},I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:R.rawTime,price:R.price},{rawTime:y.rawTime,price:y.price})}},d=_=>{const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top,m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P!=null){if(h===0){L={rawTime:m,normalizedTime:P,price:D},N={rawTime:m,normalizedTime:P,price:D},h=1,I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const k=f.coordinateToPrice(x);if(k==null||Math.abs(k-L.price)<1e-7)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:k},h=2;return}if(h===2&&T){try{f.detachPrimitive(T)}catch{}const k=new rp(T.p1,T.p2,T.p3,T.p4);f.attachPrimitive(k);const z={type:"flattopbottom",primitive:k,p1:L,p2:N,p3:{rawTime:T.p3.rawTime,normalizedTime:ee(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:ee(T.p4.rawTime),price:T.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Te($=>[...$,z]),v.current.push(z),be(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",d),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",d),T)try{f.detachPrimitive(T)}catch{}}}if(H==="regressionchannel"){let L=null,N=null;const R=(T,I)=>{T.mid1={rawTime:I.p1.rawTime,price:I.p1.price},T.mid2={rawTime:I.p2.rawTime,price:I.p2.price},T.top1={rawTime:I.top1.rawTime,price:I.top1.price},T.top2={rawTime:I.top2.rawTime,price:I.top2.price},T.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},T.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},y=T=>{if(!L)return;const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;const m=ir(Ue,L,{rawTime:_,normalizedTime:E},1);if(m)if(!N)N=new il({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(N);else{R(N,m);try{p.applyOptions({})}catch{}}},h=T=>{const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;if(!L){L={rawTime:_,normalizedTime:E,price:Q};return}const m=ir(Ue,L,{rawTime:_,normalizedTime:E},1);if(!m)return;if(N){try{f.detachPrimitive(N)}catch{}N=null}const D=new il({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,intercept:m.intercept,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Te(k=>[...k,P]),v.current.push(P),L=null,be(null)};return O.addEventListener("mousemove",y),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",y),O.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="stddevchannel"){let L=null,N=null;const R=(T,I)=>{T.mid1={rawTime:I.p1.rawTime,price:I.p1.price},T.mid2={rawTime:I.p2.rawTime,price:I.p2.price},T.top1={rawTime:I.top1.rawTime,price:I.top1.price},T.top2={rawTime:I.top2.rawTime,price:I.top2.price},T.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},T.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},y=T=>{if(!L)return;const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;const m=Xr(Ue,L,{rawTime:_,normalizedTime:E},1);if(m)if(!N)N=new sp({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(N);else{R(N,m);try{p.applyOptions({})}catch{}}},h=T=>{const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;if(!L){L={rawTime:_,normalizedTime:E,price:Q};return}const m=Xr(Ue,L,{rawTime:_,normalizedTime:E},1);if(!m)return;if(N){try{f.detachPrimitive(N)}catch{}N=null}const D=new sp({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Te(k=>[...k,P]),v.current.push(P),L=null,be(null)};return O.addEventListener("mousemove",y),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",y),O.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="andrewspitchfork"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d=y+140,_=p.timeScale().coordinateToTime(d);if(_==null)return;const Q=ee(_);if(Q==null)return;const E={rawTime:T,normalizedTime:w,price:I},x={rawTime:_,normalizedTime:Q,price:I},m={rawTime:T,normalizedTime:w,price:I},D=new lT({rawTime:E.rawTime,price:E.price},{rawTime:x.rawTime,price:x.price},{rawTime:m.rawTime,price:m.price});f.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:E,p2:x,p3:m};Te(k=>[...k,P]),v.current.push(P),M(P),le.current=P,be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="gannfan"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d={rawTime:T,normalizedTime:w,price:I},_={rawTime:T,normalizedTime:w,price:I},Q=new cT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const E={type:"gannfan",primitive:Q,p1:d,p2:_};Te(x=>[...x,E]),v.current.push(E),M(E),le.current=E,be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="ganngrid"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d={rawTime:T,normalizedTime:w,price:I},_={rawTime:T,normalizedTime:w,price:I},Q=new hT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const E={type:"ganngrid",primitive:Q,p1:d,p2:_};Te(x=>[...x,E]),v.current.push(E),M(E),le.current=E,be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="trendline"||H==="gannline"){const L=H,N=L==="gannline"?"#7aa6ae":"#22c55e",R=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=O.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const E=f.coordinateToPrice(_);if(!(Q==null||E==null)&&(Q=ee(Q),Q!=null))if(S.current===null){S.current={time:Q,price:E};const x=p.addLineSeries({color:N,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:L,series:x},x.setData([{time:Q,value:E}])}else{const x=S.current,m={time:Q,price:E},D=1,P=1e-5,k=Math.abs(m.time-x.time),z=Math.abs(m.price-x.price);if(k<D&&z<P){try{p.removeSeries(F.current.series)}catch{}S.current=null,F.current=null;return}const $={time:x.time,rawTime:x.time,price:x.price},te={time:m.time,rawTime:m.time,price:m.price},he=zA([{time:$.time,value:$.price},{time:te.time,value:te.price}]);if(he.length>0){F.current.series.setData(he);const ge=new sT($,te,N,2);try{F.current.series.attachPrimitive(ge)}catch{}const xe={type:L,series:F.current.series,point1:$,point2:te,decoration:ge};Te(Ee=>[...Ee,xe]),v.current.push(xe)}be(null),S.current=null,F.current=null}},y=I=>{if(S.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=O.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const E=f.coordinateToPrice(_);if(Q==null||E==null||(Q=ee(Q),Q==null))return;const x=S.current,m=zA([{time:x.time,value:x.price},{time:Q,value:E}]);m.length>0&&F.current.series.setData(m)},h=I=>{I.stopPropagation()},T={capture:!0,passive:!1};return O.addEventListener("click",R,T),O.addEventListener("mousemove",y,T),O.addEventListener("mousemove",h,T),()=>{if(S.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}O.removeEventListener("click",R,T),O.removeEventListener("mousemove",y,T),O.removeEventListener("mousemove",h,T)}}if(H==="parallellines"){let L=null,N=null,R=null,y=0,h=null;const T=(E,x,m,D)=>{E.p1={rawTime:x.rawTime,price:x.price},E.p2={rawTime:m.rawTime,price:m.price},E.b1={rawTime:D.b1.rawTime,price:D.b1.price},E.b2={rawTime:D.b2.rawTime,price:D.b2.price},E.p3={rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}},I=(E,x,m)=>{const D=hp(E,x,m);if(!D)return null;if(!h)h=new np({rawTime:E.rawTime,price:E.price},{rawTime:x.rawTime,price:x.price},{rawTime:D.b1.rawTime,price:D.b1.price},{rawTime:D.b2.rawTime,price:D.b2.price},{rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}),f.attachPrimitive(h);else{T(h,E,x,D);try{p.applyOptions({})}catch{}}return D},w=E=>{E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const x=O.getBoundingClientRect(),m=E.clientX-x.left,D=E.clientY-x.top,P=p.timeScale().coordinateToTime(m),k=f.coordinateToPrice(D);if(P==null||k==null)return;const z=ee(P);if(z!=null){if(y===0){L={rawTime:P,normalizedTime:z,price:k},y=1;return}if(y===1){if(N={rawTime:P,normalizedTime:z,price:k},Math.abs(N.normalizedTime-L.normalizedTime)<1)return;const $=ee((L.normalizedTime+N.normalizedTime)/2);if($==null)return;const te=(L.price+N.price)/2;R={rawTime:$,normalizedTime:$,price:te},I(L,N,R),y=2;return}if(y===2&&L&&N){R={rawTime:P,normalizedTime:z,price:k};const $=I(L,N,R);if(!$||!h)return;try{f.detachPrimitive(h)}catch{}const te=new np({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:$.b1.rawTime,price:$.b1.price},{rawTime:$.b2.rawTime,price:$.b2.price},{rawTime:$.bottomMid.rawTime,price:$.bottomMid.price});f.attachPrimitive(te);const he={type:"equidistantchannel",primitive:te,p1:L,p2:N,p3:$.bottomMid,b1:$.b1,b2:$.b2,bottomMid:$.bottomMid};Te(ge=>[...ge,he]),v.current.push(he),be(null),y=0,L=null,N=null,R=null,h=null}}},d=E=>{if(y===0||!L)return;const x=O.getBoundingClientRect(),m=E.clientX-x.left,D=E.clientY-x.top,P=p.timeScale().coordinateToTime(m),k=f.coordinateToPrice(D);if(P==null||k==null)return;const z=ee(P);if(z!=null){if(y===1){const $={rawTime:P,normalizedTime:z,price:k},te=ee((L.normalizedTime+$.normalizedTime)/2);if(te==null)return;const he=(L.price+$.price)/2;I(L,$,{rawTime:te,normalizedTime:te,price:he});return}y===2&&N&&I(L,N,{rawTime:P,normalizedTime:z,price:k})}},_=E=>{E.stopPropagation()},Q={capture:!0,passive:!1};return O.addEventListener("click",w,Q),O.addEventListener("mousemove",d,Q),O.addEventListener("mousemove",_,Q),()=>{if(y=0,L=null,N=null,R=null,K.current=[],h)try{f.detachPrimitive(h)}catch{}h=null,O.removeEventListener("click",w,Q),O.removeEventListener("mousemove",d,Q),O.removeEventListener("mousemove",_,Q)}}if(H==="fibonacci"){let L=null,N=null;const R=h=>{if(!L)return;const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(!(d==null||_==null))if(!N)N=new op({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_}),f.attachPrimitive(N);else{N.p2={rawTime:d,price:_};try{p.applyOptions({})}catch{}}},y=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!L){L={rawTime:d,price:_,normalizedTime:ee(d)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null)return;if(Math.abs(_-L.price)<1e-5){L=null;return}const x=new op({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_});f.attachPrimitive(x);const m={type:"fibonacci",primitive:x,p1:{rawTime:L.rawTime,normalizedTime:Q,price:L.price},p2:{rawTime:d,normalizedTime:E,price:_}};Te(D=>[...D,m]),v.current.push(m),L=null,be(null)};return O.addEventListener("mousemove",R),O.addEventListener("click",y),()=>{if(O.removeEventListener("mousemove",R),O.removeEventListener("click",y),N)try{f.detachPrimitive(N)}catch{}}}if(S.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}const j=L=>{if(L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const N=O.getBoundingClientRect(),R=L.clientX-N.left,y=L.clientY-N.top;let h=p.timeScale().coordinateToTime(R);const T=f.coordinateToPrice(y);if(h==null||T==null)return;const I=h;if(h=ee(h),h!=null){if(b.current=!0,C.current={time:h,normalizedTime:h,rawTime:I,price:T},U.current=null,H==="rectangle"){const w=new eT({rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new tT({rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",lineWidth:1});f.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new AT({rawTime:I,price:T},{rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new iT({rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});f.attachPrimitive(w),F.current={type:"ellipse",primitive:w}}if(H==="parallellines"){const w=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},q=L=>{if(!b.current||!C.current||!F.current)return;L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const N=O.getBoundingClientRect(),R=L.clientX-N.left,y=L.clientY-N.top;let h=p.timeScale().coordinateToTime(R);const T=f.coordinateToPrice(y);if(h==null||T==null)return;const I=h;if(h=ee(h),h==null)return;U.current={time:h,normalizedTime:h,rawTime:I,price:T};const w=C.current;if(F.current.type==="rectangle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:T};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:T};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const d=F.current.primitive,_=X(w,{time:h,rawTime:I,price:T});if(!_)return;d.p1={rawTime:_.p1.rawTime,price:_.p1.price},d.p2={rawTime:_.p2.rawTime,price:_.p2.price},d.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:T};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const d=F.current.firstLine;d.endTime-d.startTime;const _=d.endPrice-d.startPrice,Q=T,E=Q+_;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:E}]);else{const x=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});x.setData([{time:w.time,value:Q},{time:h,value:E}]),F.current.secondLine=x}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:T}])},ue=L=>{if(L&&(L.preventDefault(),L.stopPropagation()),!b.current||!F.current||!C.current)return;const N=C.current,R=U.current||N;if(F.current.type==="parallellines")if(F.current.firstLine){const y={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};Te(h=>[...h,y]),v.current.push(y),be(null),F.current=null,b.current=!1,C.current=null,U.current=null;return}else{F.current.firstLine={startTime:N.time,startPrice:N.price,endTime:R.time,endPrice:R.price},b.current=!1,C.current=null,U.current=null;return}if(F.current.type==="rectangle"){const y=C.current,h=U.current||y,T=Math.max(y.price,h.price),I=Math.min(y.price,h.price),w=ee(Math.min(y.time,h.time)),d=ee(Math.max(y.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(T-I)>=1e-5){const _=F.current.primitive,Q=y.time<=h.time?y.rawTime:h.rawTime,E=y.time<=h.time?h.rawTime:y.rawTime,x={rawTime:Q,normalizedTime:w,price:T},m={rawTime:E,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:m.rawTime,price:m.price};const D={type:"rectangle",primitive:_,p1:x,p2:m};Te(P=>[...P,D]),v.current.push(D),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const y=F.current.primitive,h={rawTime:N.rawTime,normalizedTime:N.time,price:N.price},T={rawTime:R.rawTime,normalizedTime:R.time,price:R.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(T.rawTime),_=f.priceToCoordinate(T.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=3){y.p1={rawTime:h.rawTime,price:h.price},y.p2={rawTime:T.rawTime,price:T.price};const E={type:"circle",primitive:y,p1:h,p2:T};Te(x=>[...x,E]),v.current.push(E),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const y=F.current.primitive,h=X(N,R);if(h){const T=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(T>=1&&I>=1e-5){y.p1={rawTime:h.p1.rawTime,price:h.p1.price},y.p2={rawTime:h.p2.rawTime,price:h.p2.price},y.p3={rawTime:h.p3.rawTime,price:h.p3.price};const w={type:"triangle",primitive:y,p1:h.p1,p2:h.p2,p3:h.p3};Te(d=>[...d,w]),v.current.push(w),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const y=F.current.primitive,h={rawTime:N.rawTime,normalizedTime:N.time,price:N.price},T={rawTime:R.rawTime,normalizedTime:R.time,price:R.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(T.rawTime),_=f.priceToCoordinate(T.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=4){y.p1={rawTime:h.rawTime,price:h.price},y.p2={rawTime:T.rawTime,price:T.price},y.previewAsLine=!1,y.minorRatio=.45;const E={type:"ellipse",primitive:y,p1:h,p2:T,minorRatio:.45};Te(x=>[...x,E]),v.current.push(E),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}b.current=!1,C.current=null,U.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const L={capture:!0,passive:!1},N=R=>{b.current||R.stopPropagation()};return O.addEventListener("mousedown",j,L),O.addEventListener("mousemove",q,L),O.addEventListener("mousemove",N,L),O.addEventListener("mouseup",ue,L),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null,b.current=!1,C.current=null,U.current=null,O.removeEventListener("mousedown",j,L),O.removeEventListener("mousemove",q,L),O.removeEventListener("mousemove",N,L),O.removeEventListener("mouseup",ue,L)}}},[Ce,Ue,Te,be]),Y.useEffect(()=>{const p=c.current,f=u.current,O=o.current,me=Ce===null||Ce===1;if(!me||!p||!f||!O){me||(M(null),V([]),re(null),Z([]));return}const H=10,X=8;function j(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const T=p.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.priceToCoordinate(h.point2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="gannline"&&h.point1&&h.point2){const T=p.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.priceToCoordinate(h.point2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:(T+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="rectangle"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);if(T==null||I==null||w==null||d==null)return[];const _=Math.min(T,w),Q=Math.max(T,w),E=Math.min(I,d),x=Math.max(I,d),m=(_+Q)/2,D=(E+x)/2;return[{x:_,y:E},{x:m,y:E},{x:Q,y:E},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:m,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return T==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);if(T==null||I==null||w==null||d==null)return[];const _=(T+w)/2,Q=(I+d)/2,E=w-T,x=d-I,m=Math.hypot(E,x);if(m<.001)return[];const D=E/m,P=x/m,k=-P,z=D,$=m/2,te=$*Math.max(.05,h.minorRatio??.45);return[{x:_-D*$,y:Q-P*$},{x:_+k*te,y:Q+z*te},{x:_+D*$,y:Q+P*$},{x:_-k*te,y:Q-z*te}]}if(h.type==="gannfan"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="rayline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="extendedline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="crossline"&&h.p){const T=p.timeScale().timeToCoordinate(h.p.rawTime),I=f.priceToCoordinate(h.p.price);return T==null||I==null?[]:[{x:T,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const T=f.priceToCoordinate(h.price);return T==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:T}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const T=p.timeScale().timeToCoordinate(h.rawTime),I=f.priceToCoordinate(h.price);return T==null||I==null?[]:[{x:T,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return T==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=f.priceToCoordinate(h.b1.price),E=p.timeScale().timeToCoordinate(h.b2.rawTime),x=f.priceToCoordinate(h.b2.price);return T==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:(_+E)/2,y:(Q+x)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),E=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return T==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q},{x:E,y:x}]}if(h.type==="flattopbottom"&&h.p1&&h.p2&&h.p3&&h.p4){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),E=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return T==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q},{x:E,y:x}]}if(h.type==="infoline"&&h.p1&&h.p2){const T=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=p.timeScale().timeToCoordinate(T),d=f.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=f.priceToCoordinate(h.p2.price);return w==null||d==null||_==null||Q==null?[]:[{x:w,y:d},{x:_,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:(T+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="horizontalray"&&h.primitive){const T=h.primitive,I=p.timeScale().timeToCoordinate(T.originTime),w=f.priceToCoordinate(T.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const T=h.primitive,I=p.timeScale().timeToCoordinate(T.time);if(I==null)return[];const w=T.midYCss??200;return[{x:I,y:w}]}return[]}function q(h,T){for(let I=Ke.length-1;I>=0;I--){const w=Ke[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),E=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),E=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,m=(_+E)/2,D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"line"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.min(d,Q),m=Math.max(d,Q),D=Math.min(_,E),P=Math.max(_,E),k=(x+m)/2,z=(D+P)/2,$=[{x,y:D,mode:"handle1"},{x:k,y:D,mode:"handle2"},{x:m,y:D,mode:"handle3"},{x,y:z,mode:"handle4"},{x:m,y:z,mode:"handle5"},{x,y:P,mode:"handle6"},{x:k,y:P,mode:"handle7"},{x:m,y:P,mode:"handle8"}];for(const Ee of $)if(Math.hypot(h-Ee.x,T-Ee.y)<H)return{object:w,mode:Ee.mode};const te=ut(h,T,x,D,m,D),he=ut(h,T,x,P,m,P),ge=ut(h,T,x,D,x,P),xe=ut(h,T,m,D,m,P);if(te<X||he<X||ge<X||xe<X||gi(h,T,[{x,y:D},{x:m,y:D},{x:m,y:P},{x,y:P}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(Q-d,E-_);if(x<2)continue;const m=Math.hypot(h-d,T-_),D=Math.hypot(h-Q,T-E);if(m<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(m-x)<X||m<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||E==null||x==null||m==null)continue;const D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"handle3"};const z=ut(h,T,d,_,Q,E),$=ut(h,T,Q,E,x,m),te=ut(h,T,x,m,d,_);if(z<X||$<X||te<X||gi(h,T,[{x:d,y:_},{x:Q,y:E},{x,y:m}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,m=(_+E)/2,D=Q-d,P=E-_,k=Math.hypot(D,P);if(k<2)continue;const z=D/k,$=P/k,te=-$,he=z,ge=k/2,xe=ge*Math.max(.05,w.minorRatio??.45);if(ge<2||xe<2)continue;const Ee=x-z*ge,Re=m-$*ge,je=x+te*xe,Ve=m+he*xe,Bt=x+z*ge,pt=m+$*ge,yt=x-te*xe,Dt=m-he*xe,qt=Math.hypot(h-Ee,T-Re),iA=Math.hypot(h-je,T-Ve),hA=Math.hypot(h-Bt,T-pt),JA=Math.hypot(h-yt,T-Dt);if(qt<H)return{object:w,mode:"handle1"};if(iA<H)return{object:w,mode:"handle2"};if(hA<H)return{object:w,mode:"handle3"};if(JA<H)return{object:w,mode:"handle4"};const Di=(h-x)*z+(T-m)*$,zs=(h-x)*te+(T-m)*he,Up=Di/ge,Sp=zs/xe,Ep=Up*Up+Sp*Sp;if(Math.abs(Ep-1)<.2||Ep<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-Q,T-E),m=Math.hypot(h-d,T-_);if(x<H)return{object:w,mode:"handle2"};if(m<H)return{object:w,mode:"handle1"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-Q,T-E),m=Math.hypot(h-d,T-_);if(x<H)return{object:w,mode:"handle2"};if(m<H)return{object:w,mode:"handle1"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(gT(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(wT(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),_=f.priceToCoordinate(w.p.price);if(d==null||_==null)continue;if(Math.hypot(h-d,T-_)<H)return{object:w,mode:"handle1"};const E=Math.abs(T-_),x=Math.abs(h-d);if(E<X||x<X)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),_=f.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=lp(w,d,_);if(h>=Q.left&&h<=Q.right&&T>=Q.top&&T<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),m=f.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=f.priceToCoordinate(w.b2.price),k=x!=null&&D!=null?(x+D)/2:null,z=m!=null&&P!=null?(m+P)/2:null;if(d==null||_==null||Q==null||E==null||k==null||z==null||x==null||m==null||D==null||P==null)continue;const $=Math.hypot(h-d,T-_),te=Math.hypot(h-Q,T-E),he=Math.hypot(h-k,T-z),ge=Math.hypot(d-k,_-z)<H*1.5;if(ge&&Math.min($,he)<H*1.5)return{object:w,mode:"handle3"};if(he<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle2"};if(ge)continue;if($<H)return{object:w,mode:"handle1"};const xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P);if(xe<X||Ee<X||gi(h,T,[{x:d,y:_},{x:Q,y:E},{x:D,y:P},{x,y:m}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),k=p.timeScale().timeToCoordinate(w.bot1.rawTime),z=f.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null||k==null||z==null||$==null||te==null)continue;const he=Math.hypot(h-d,T-_),ge=Math.hypot(h-Q,T-E);if(he<H)return{object:w,mode:"handle1"};if(ge<H)return{object:w,mode:"handle2"};const xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P),Re=ut(h,T,k,z,$,te);if(xe<X||Ee<X||Re<X||gi(h,T,[{x,y:m},{x:D,y:P},{x:$,y:te},{x:k,y:z}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),k=p.timeScale().timeToCoordinate(w.bot1.rawTime),z=f.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null||k==null||z==null||$==null||te==null)continue;const he=Math.hypot(h-d,T-_),ge=Math.hypot(h-Q,T-E);if(he<H)return{object:w,mode:"handle1"};if(ge<H)return{object:w,mode:"handle2"};const xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P),Re=ut(h,T,k,z,$,te);if(xe<X||Ee<X||Re<X||gi(h,T,[{x,y:m},{x:D,y:P},{x:$,y:te},{x:k,y:z}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||E==null||x==null||m==null)continue;const D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"handle3"};const z=(Q+x)/2,$=(E+m)/2;let te=z-d,he=$-_;Math.abs(te)<1e-4&&(te=1e-4);const ge=he/te,xe=O.clientWidth,Ee=E+ge*(xe-Q),Re=m+ge*(xe-x),je=ut(h,T,Q,E,xe,Ee),Ve=ut(h,T,x,m,xe,Re);if(je<X||Ve<X||gi(h,T,[{x:Q,y:E},{x:xe,y:Ee},{x:xe,y:Re},{x,y:m}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null)continue;const k=Math.hypot(h-d,T-_),z=Math.hypot(h-Q,T-E),$=Math.hypot(h-x,T-m),te=Math.hypot(h-D,T-P);if(k<H)return{object:w,mode:"handle1"};if(z<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const he=ut(h,T,d,_,x,m),ge=ut(h,T,Q,E,D,P),xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P);if(he<X||ge<X||xe<X||Ee<X||gi(h,T,[{x:d,y:_},{x,y:m},{x:D,y:P},{x:Q,y:E}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null)continue;const k=Math.hypot(h-d,T-_),z=Math.hypot(h-Q,T-E),$=Math.hypot(h-x,T-m),te=Math.hypot(h-D,T-P);if(k<H)return{object:w,mode:"handle1"};if(z<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const he=ut(h,T,d,_,x,m),ge=ut(h,T,Q,E,D,P),xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P);if(he<X||ge<X||xe<X||Ee<X||gi(h,T,[{x:d,y:_},{x,y:m},{x:D,y:P},{x:Q,y:E}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,m=(_+E)/2,D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"line"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const d=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,Q=p.timeScale().timeToCoordinate(d),E=f.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),m=f.priceToCoordinate(w.p2.price);if(Q==null||E==null||x==null||m==null)continue;const D=Math.hypot(h-Q,T-E),P=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ut(h,T,Q,E,x,m)<X)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.originTime),Q=f.priceToCoordinate(d.price);if(Q==null)continue;if(_!=null&&Math.hypot(h-_,T-Q)<H)return{object:w,mode:"handle1"};const E=_==null?0:Math.max(0,_);if(h>=E&&Math.abs(T-Q)<X)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.time);if(_==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-_,T-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-_)<X)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const d=f.priceToCoordinate(w.price);if(d==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,T-d)<H)return{object:w,mode:"line"};if(Math.abs(T-d)<X)return{object:w,mode:"line"}}}return null}const ue=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=q(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,ne(d.object),Ae.current=null,oe.current=null;return}M(d.object),re(null),Z([]),Ae.current=d.mode,d.object.type==="rayline"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="extendedline"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="crossline"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,p:{...d.object.p}}),d.object.type==="text"&&d.mode==="line"&&(oe.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}),d.object.type==="trendbyangle"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="equidistantchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="andrewspitchfork"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="regressionchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="stddevchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="disjointchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="flattopbottom"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="fibonacci"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="gannfan"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="ganngrid"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="rectangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4"||d.mode==="handle5"||d.mode==="handle6"||d.mode==="handle7"||d.mode==="handle8")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="circle"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="triangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="ellipse"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}),d.object.type==="horizontalray"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}),d.object.type==="verticalline"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,time:d.object.primitive.time}),d.mode==="line"&&(d.object.type==="rulerline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="infoline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="arrowedline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rayline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="extendedline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="crossline"?oe.current={x:I,y:w,p:{...d.object.p}}:d.object.type==="text"?oe.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}:d.object.type==="trendbyangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="equidistantchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="andrewspitchfork"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="regressionchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="stddevchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="disjointchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="flattopbottom"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="fibonacci"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="gannfan"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rectangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="circle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="triangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="ellipse"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}:d.object.type==="ganngrid"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="horizontalray"?oe.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}:d.object.type==="verticalline"?oe.current={x:I,y:w,time:d.object.primitive.time}:d.object.type==="pricelevel"?oe.current={y:w,price:d.object.price}:oe.current={x:I,y:w,point1:{...d.object.point1},point2:{...d.object.point2}})}else M(null),Ae.current=null,V([]),re(null),Z([])},L=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top;if(!Ae.current){const x=q(I,w);if(x?.object&&!le.current){const m=j(x.object);re(D=>D===x.object?D:x.object),Z(D=>D.length===m.length&&D.every((P,k)=>P.x===m[k].x&&P.y===m[k].y)?D:m)}else re(m=>m==null?m:null),Z(m=>m.length===0?m:[]);return}const d=le.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=f.coordinateToPrice(w);if(_==null||Q==null)return;let E=ee(_);if(E!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=k=>{const z=k.rawTime??k.time,$=k.normalizedTime??ee(z);return{rawTime:z,normalizedTime:$,price:k.price}},m=(k,z)=>{const $=k.normalizedTime??ee(k.rawTime),te=z.normalizedTime??ee(z.rawTime);if($==null||te==null)return;const he=z.price-k.price,ge=he/Math.abs(k.price)*100,xe=uA(de)||3600,Ee=Math.abs(te-$),Re=Math.max(1,Math.round(Ee/xe)),je=Math.max(1,Math.round(Ee/86400)),Ve=p.timeScale().timeToCoordinate(k.rawTime),Bt=f.priceToCoordinate(k.price),pt=p.timeScale().timeToCoordinate(z.rawTime),yt=f.priceToCoordinate(z.price),Dt=Ve!=null&&Bt!=null&&pt!=null&&yt!=null?Math.atan2(-(yt-Bt),pt-Ve)*(180/Math.PI):d.primitive?.info?.angle??0,qt={priceDiff:he,pricePct:ge,bars:Re,days:je,angle:Dt},iA=d.primitive;if(iA){iA.p1={rawTime:k.rawTime,price:k.price},iA.p2={rawTime:z.rawTime,price:z.price},iA.info=qt;try{c.current?.applyOptions({})}catch{}}const hA={...d,rawP1Time:k.rawTime,rawP2Time:z.rawTime,p1:{rawTime:k.rawTime,normalizedTime:$,price:k.price},p2:{rawTime:z.rawTime,normalizedTime:te,price:z.price}};Te(JA=>{const Di=JA.map(zs=>zs===d?hA:zs);return v.current=Di,Di}),M(hA),le.current=hA,Ve!=null&&Bt!=null&&pt!=null&&yt!=null&&V([{x:Ve,y:Bt},{x:pt,y:yt}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(Ae.current==="handle1"){const k=p.timeScale().coordinateToTime(I)??_;m({rawTime:k,normalizedTime:E,price:Q},P)}else if(Ae.current==="handle2"){const k=p.timeScale().coordinateToTime(I)??_;m(D,{rawTime:k,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const k=oe.current;if(!k)return;const z=x(k.p1),$=x(k.p2);if(z.rawTime==null||z.normalizedTime==null||$.rawTime==null||$.normalizedTime==null)return;const te=p.timeScale().coordinateToTime(k.x)??z.rawTime,he=f.coordinateToPrice(k.y);if(te==null||he==null)return;const ge=ee(te)??z.normalizedTime;if(ge==null)return;const xe=E-ge,Ee=Q-he,Re=ee(z.normalizedTime+xe),je=ee($.normalizedTime+xe);if(Re==null||je==null)return;const Ve=_-te;m({rawTime:z.rawTime+Ve,normalizedTime:Re,price:z.price+Ee},{rawTime:$.rawTime+Ve,normalizedTime:je,price:$.price+Ee})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(m,D)=>{const P=m.normalizedTime??m.rawTime,k=D.normalizedTime??D.rawTime,z=D.price-m.price,$=z/Math.abs(m.price)*100,te=Ns(Ks,m.rawTime,D.rawTime,de),he=Math.abs(k-P),ge=Math.max(1,Math.round(he/86400)),xe={priceDiff:z,pricePct:$,bars:te,days:ge},Ee=d.primitive;if(Ee){Ee.p1={rawTime:m.rawTime,price:m.price},Ee.p2={rawTime:D.rawTime,price:D.price},Ee.info=xe;const yt=D.price>=m.price;Ee.color=yt?"#3b82f6":"#ef5350",Ee.fillColor=yt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const Re={...d,rawP1Time:m.rawTime,rawP2Time:D.rawTime,p1:m,p2:D};Te(yt=>{const Dt=yt.map(qt=>qt===d?Re:qt);return v.current=Dt,Dt}),M(Re),le.current=Re;const je=p.timeScale().timeToCoordinate(m.rawTime),Ve=f.priceToCoordinate(m.price),Bt=p.timeScale().timeToCoordinate(D.rawTime),pt=f.priceToCoordinate(D.price);je!=null&&Ve!=null&&Bt!=null&&pt!=null&&V([{x:je,y:Ve},{x:(je+Bt)/2,y:(Ve+pt)/2},{x:Bt,y:pt}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;const D=ee(m);if(D==null)return;x(d.p1,{rawTime:m,normalizedTime:D,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="crossline"&&d.p){const x=D=>{const P=d.primitive;if(P){P.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p:D};Te(te=>{const he=te.map(ge=>ge===d?k:ge);return v.current=he,he}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(D.rawTime),$=f.priceToCoordinate(D.price);z!=null&&$!=null&&V([{x:z,y:$}])},m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=f.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const m=c.current?c.current.paneSize().width:400,D=f.priceToCoordinate(x);D!=null&&V([{x:m/2,y:D}]);const P={...d,price:x};Te(k=>{const z=k.map($=>$===d?P:$);return v.current=z,z}),M(P),le.current=P;return}if(d.type==="text"){const x=p.timeScale().coordinateToTime(I);if(x==null)return;const m=d.primitive;if(m){m.rawTime=x,m.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"||Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(m,D,P)=>{const k=hp(m,D,P);if(!k)return;const z=d.primitive;if(z){z.p1={rawTime:m.rawTime,price:m.price},z.p2={rawTime:D.rawTime,price:D.price},z.b1={rawTime:k.b1.rawTime,price:k.b1.price},z.b2={rawTime:k.b2.rawTime,price:k.b2.price},z.p3={rawTime:k.bottomMid.rawTime,price:k.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const $={...d,p1:m,p2:D,p3:k.bottomMid,b1:k.b1,b2:k.b2,bottomMid:k.bottomMid};Te(te=>{const he=te.map(ge=>ge===d?$:ge);return v.current=he,he}),M($),le.current=$};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2,d.p3);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q},d.p3);return}if(Ae.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??ee(d.p3.rawTime),price:Q});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k),he=ee(m.p3.normalizedTime+k);if($==null||te==null||he==null)return;const ge=_-D;x({rawTime:m.p1.rawTime+ge,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+ge,normalizedTime:te,price:m.p2.price+z},{rawTime:m.p3.rawTime+ge,normalizedTime:he,price:m.p3.price+z});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(m,D)=>{const P=ir(Ue,m,D,d.stdMultiplier??1);if(!P)return;const k=d.primitive;if(k){k.mid1={rawTime:P.p1.rawTime,price:P.p1.price},k.mid2={rawTime:P.p2.rawTime,price:P.p2.price},k.top1={rawTime:P.top1.rawTime,price:P.top1.price},k.top2={rawTime:P.top2.rawTime,price:P.top2.price},k.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},k.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const z={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,intercept:P.intercept,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};Te($=>{const te=$.map(he=>he===d?z:he);return v.current=te,te}),M(z),le.current=z};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E},d.p2);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(m,D)=>{const P=Xr(Ue,m,D,d.stdMultiplier??1);if(!P)return;const k=d.primitive;if(k){k.mid1={rawTime:P.p1.rawTime,price:P.p1.price},k.mid2={rawTime:P.p2.rawTime,price:P.p2.price},k.top1={rawTime:P.top1.rawTime,price:P.top1.price},k.top2={rawTime:P.top2.rawTime,price:P.top2.price},k.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},k.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const z={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};Te($=>{const te=$.map(he=>he===d?z:he);return v.current=te,te}),M(z),le.current=z};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E},d.p2);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(m,D,P)=>{const k=d.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:D.rawTime,price:D.price},k.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const z={...d,p1:m,p2:D,p3:P};Te($=>{const te=$.map(he=>he===d?z:he);return v.current=te,te}),M(z),le.current=z};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2,d.p3);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q},d.p3);return}if(Ae.current==="handle3"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,d.p2,{rawTime:m,normalizedTime:E,price:Q});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k),he=ee(m.p3.normalizedTime+k);if($==null||te==null||he==null)return;const ge=_-D;x({rawTime:m.p1.rawTime+ge,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+ge,normalizedTime:te,price:m.p2.price+z},{rawTime:m.p3.rawTime+ge,normalizedTime:he,price:m.p3.price+z});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(z,$,te,he)=>{const ge=d.primitive;if(ge){ge.p1={rawTime:z.rawTime,price:z.price},ge.p2={rawTime:$.rawTime,price:$.price},ge.p3={rawTime:te.rawTime,price:te.price},ge.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:z,p2:$,p3:te,p4:he};Te(Ee=>{const Re=Ee.map(je=>je===d?xe:je);return v.current=Re,Re}),M(xe),le.current=xe},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;const k=(z,$,te,he)=>{const ge=z.normalizedTime??ee(z.rawTime);if(ge==null)return null;const xe=ee(ge+te);return xe==null?null:{rawTime:z.rawTime+$,normalizedTime:xe,price:z.price+he}};if(Ae.current==="line"){const z=p.timeScale().coordinateToTime(m.x),$=f.coordinateToPrice(m.y);if(z==null||$==null)return;const te=ee(z);if(te==null)return;const he=D-z,ge=P-te,xe=Q-$,Ee=k(m.p1,he,ge,xe),Re=k(m.p2,he,ge,xe),je=k(m.p3,he,ge,xe),Ve=k(m.p4,he,ge,xe);if(!Ee||!Re||!je||!Ve)return;x(Ee,Re,je,Ve);return}if(Ae.current==="handle1"){const z=(m.p1.price+m.p2.price)/2,$={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*z-Q};x($,te,m.p3,m.p4);return}if(Ae.current==="handle3"){const z=(m.p3.price+m.p4.price)/2,$={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*z-Q};x(m.p1,m.p2,$,te);return}if(Ae.current==="handle2"){const z=(m.p1.price+m.p2.price)/2,$={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:Q};if($.normalizedTime==null)return;const te={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:2*z-Q};if(te.normalizedTime==null)return;x(te,$,m.p3,m.p4);return}if(Ae.current==="handle4"){const z=Q-m.p4.price,$={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??ee(m.p3.rawTime),price:m.p4.price+z};if($.normalizedTime==null)return;const te={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:m.p2.price+z};if(te.normalizedTime==null)return;x(m.p1,te,m.p3,$);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(z,$,te,he)=>{const ge=d.primitive;if(ge){ge.p1={rawTime:z.rawTime,price:z.price},ge.p2={rawTime:$.rawTime,price:$.price},ge.p3={rawTime:te.rawTime,price:te.price},ge.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:z,p2:$,p3:te,p4:he};Te(Ee=>{const Re=Ee.map(je=>je===d?xe:je);return v.current=Re,Re}),M(xe),le.current=xe},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;const k=(z,$,te,he)=>{const ge=z.normalizedTime??ee(z.rawTime);if(ge==null)return null;const xe=ee(ge+te);return xe==null?null:{rawTime:z.rawTime+$,normalizedTime:xe,price:z.price+he}};if(Ae.current==="line"){const z=p.timeScale().coordinateToTime(m.x),$=f.coordinateToPrice(m.y);if(z==null||$==null)return;const te=ee(z);if(te==null)return;const he=D-z,ge=P-te,xe=Q-$,Ee=k(m.p1,he,ge,xe),Re=k(m.p2,he,ge,xe),je=k(m.p3,he,ge,xe),Ve=k(m.p4,he,ge,xe);if(!Ee||!Re||!je||!Ve)return;x(Ee,Re,je,Ve);return}if(Ae.current==="handle1"){const z={rawTime:D,normalizedTime:P,price:Q},$={rawTime:D,normalizedTime:P,price:m.p2.price};x(z,$,m.p3,m.p4);return}if(Ae.current==="handle3"){const z={rawTime:D,normalizedTime:P,price:Q},$={rawTime:D,normalizedTime:P,price:m.p4.price};x(m.p1,m.p2,z,$);return}if(Ae.current==="handle2"||Ae.current==="handle4"){const z=Ae.current==="handle2"?m.p2:m.p4,$=Q-z.price,te={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:m.p2.price+$},he={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??ee(m.p3.rawTime),price:m.p4.price+$};if(te.normalizedTime==null||he.normalizedTime==null)return;x(m.p1,te,m.p3,he);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(pt,yt)=>{const Dt=d.primitive;if(Dt){Dt.p1={rawTime:pt.rawTime,price:pt.price},Dt.p2={rawTime:yt.rawTime,price:yt.price};try{c.current?.applyOptions({})}catch{}}const qt={...d,p1:pt,p2:yt};Te(iA=>{const hA=iA.map(JA=>JA===d?qt:JA);return v.current=hA,hA}),M(qt),le.current=qt},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;if(Ae.current==="line"){const pt=p.timeScale().coordinateToTime(m.x),yt=f.coordinateToPrice(m.y);if(pt==null||yt==null)return;const Dt=ee(pt);if(Dt==null)return;const qt=P-Dt,iA=Q-yt,hA=ee(m.p1.normalizedTime+qt),JA=ee(m.p2.normalizedTime+qt);if(hA==null||JA==null)return;const Di=_-pt;x({rawTime:m.p1.rawTime+Di,normalizedTime:hA,price:m.p1.price+iA},{rawTime:m.p2.rawTime+Di,normalizedTime:JA,price:m.p2.price+iA});return}const k=Math.min(m.p1.normalizedTime,m.p2.normalizedTime),z=Math.max(m.p1.normalizedTime,m.p2.normalizedTime),$=Math.max(m.p1.price,m.p2.price),te=Math.min(m.p1.price,m.p2.price),he=m.p1.normalizedTime<=m.p2.normalizedTime?m.p1.rawTime:m.p2.rawTime,ge=m.p1.normalizedTime<=m.p2.normalizedTime?m.p2.rawTime:m.p1.rawTime;let xe=k,Ee=z,Re=$,je=te,Ve=he,Bt=ge;if((Ae.current==="handle1"||Ae.current==="handle4"||Ae.current==="handle6")&&(xe=P,Ve=D),(Ae.current==="handle3"||Ae.current==="handle5"||Ae.current==="handle8")&&(Ee=P,Bt=D),(Ae.current==="handle1"||Ae.current==="handle2"||Ae.current==="handle3")&&(Re=Q),(Ae.current==="handle6"||Ae.current==="handle7"||Ae.current==="handle8")&&(je=Q),xe>Ee){const pt=xe,yt=Ve;xe=Ee,Ve=Bt,Ee=pt,Bt=yt}if(Re<je){const pt=Re;Re=je,je=pt}x({rawTime:Ve,normalizedTime:xe,price:Re},{rawTime:Bt,normalizedTime:Ee,price:je});return}if(d.type==="circle"&&d.p1&&d.p2){const x=(Re,je)=>{const Ve=d.primitive;if(Ve){Ve.p1={rawTime:Re.rawTime,price:Re.price},Ve.p2={rawTime:je.rawTime,price:je.price};try{c.current?.applyOptions({})}catch{}}const Bt={...d,p1:Re,p2:je};Te(pt=>{const yt=pt.map(Dt=>Dt===d?Bt:Dt);return v.current=yt,yt}),M(Bt),le.current=Bt},m=p.timeScale().coordinateToTime(I);if(m==null)return;const D=ee(m);if(D==null)return;if(Ae.current==="handle2"){x(d.p1,{rawTime:m,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const k=p.timeScale().coordinateToTime(P.x),z=f.coordinateToPrice(P.y);if(k==null||z==null)return;const $=ee(k);if($==null)return;const te=D-$,he=Q-z,ge=ee(P.p1.normalizedTime+te),xe=ee(P.p2.normalizedTime+te);if(ge==null||xe==null)return;const Ee=_-k;x({rawTime:P.p1.rawTime+Ee,normalizedTime:ge,price:P.p1.price+he},{rawTime:P.p2.rawTime+Ee,normalizedTime:xe,price:P.p2.price+he});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(Ve,Bt,pt)=>{const yt=d.primitive;if(yt){yt.p1={rawTime:Ve.rawTime,price:Ve.price},yt.p2={rawTime:Bt.rawTime,price:Bt.price},yt.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const Dt={...d,p1:Ve,p2:Bt,p3:pt};Te(qt=>{const iA=qt.map(hA=>hA===d?Dt:hA);return v.current=iA,iA}),M(Dt),le.current=Dt},m=p.timeScale().coordinateToTime(I);if(m==null)return;const D=ee(m);if(D==null)return;if(Ae.current==="handle1"){x({rawTime:m,normalizedTime:D,price:Q},d.p2,d.p3);return}if(Ae.current==="handle2"){x(d.p1,{rawTime:m,normalizedTime:D,price:Q},d.p3);return}if(Ae.current==="handle3"){x(d.p1,d.p2,{rawTime:m,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const k=p.timeScale().coordinateToTime(P.x),z=f.coordinateToPrice(P.y);if(k==null||z==null)return;const $=ee(k);if($==null)return;const te=D-$,he=Q-z,ge=_-k,xe=Ve=>{const Bt=Ve.normalizedTime??ee(Ve.rawTime);if(Bt==null)return null;const pt=ee(Bt+te);return pt==null?null:{rawTime:Ve.rawTime+ge,normalizedTime:pt,price:Ve.price+he}},Ee=xe(P.p1),Re=xe(P.p2),je=xe(P.p3);if(!Ee||!Re||!je)return;x(Ee,Re,je);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(k,z,$=d.minorRatio??.45)=>{const te=d.primitive;if(te){te.p1={rawTime:k.rawTime,price:k.price},te.p2={rawTime:z.rawTime,price:z.price},te.minorRatio=Math.max(.05,$);try{c.current?.applyOptions({})}catch{}}const he={...d,p1:k,p2:z,minorRatio:Math.max(.05,$)};Te(ge=>{const xe=ge.map(Ee=>Ee===d?he:Ee);return v.current=xe,xe}),M(he),le.current=he},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;if(Ae.current==="line"){const k=p.timeScale().coordinateToTime(m.x),z=f.coordinateToPrice(m.y);if(k==null||z==null)return;const $=ee(k);if($==null)return;const te=P-$,he=Q-z,ge=ee(m.p1.normalizedTime+te),xe=ee(m.p2.normalizedTime+te);if(ge==null||xe==null)return;const Ee=_-k;x({rawTime:m.p1.rawTime+Ee,normalizedTime:ge,price:m.p1.price+he},{rawTime:m.p2.rawTime+Ee,normalizedTime:xe,price:m.p2.price+he},m.minorRatio??d.minorRatio??.45);return}if(Ae.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(Ae.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(Ae.current==="handle2"||Ae.current==="handle4"){const k=p.timeScale().timeToCoordinate(d.p1.rawTime),z=f.priceToCoordinate(d.p1.price),$=p.timeScale().timeToCoordinate(d.p2.rawTime),te=f.priceToCoordinate(d.p2.price);if(k==null||z==null||$==null||te==null)return;const he=(k+$)/2,ge=(z+te)/2,xe=$-k,Ee=te-z,Re=Math.hypot(xe,Ee);if(Re<.001)return;const je=-Ee/Re,Ve=xe/Re,Bt=Math.abs((I-he)*je+(w-ge)*Ve),pt=Math.max(.05,Bt*2/Re);x(d.p1,d.p2,pt);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const m={...d,time:ee(_),rawTime:_};Te(P=>{const k=P.map(z=>z===d?m:z);return v.current=k,k}),M(m),le.current=m;const D=p.timeScale().timeToCoordinate(_);D!=null&&V([{x:D,y:x.midYCss??200}]),c.current?.applyOptions({});return}if(d.type==="horizontalray"&&d.primitive){const x=d.primitive,m=oe.current;if(!m)return;if(Ae.current==="handle1"){if(x.price=Q,x.originTime=_,d.priceLine)try{d.priceLine.applyOptions({price:Q,title:d.showPrice!==!1?Q.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=Q,d.textPrimitive.originTime=_);const D={...d,price:x.price,originTime:x.originTime,rawOriginTime:_};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D,c.current?.applyOptions({})}else if(Ae.current==="line"){const D=f.coordinateToPrice(m.y);if(D==null)return;const P=Q-D;if(x.price=m.price+P,d.priceLine)try{d.priceLine.applyOptions({price:x.price,title:d.showPrice!==!1?x.price.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=x.price);const k={...d,price:x.price};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(Ae.current==="handle1"){const x={time:E,price:Q},m=zA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);m.length>0&&d.series.setData(m),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D}else if(Ae.current==="handle2"){const x={time:E,price:Q},m=zA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);m.length>0&&d.series.setData(m),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D}else if(Ae.current==="line"){const x=oe.current;if(!x)return;const m=p.timeScale().coordinateToTime(x.x),D=f.coordinateToPrice(x.y);if(m==null||D==null)return;const P=E-m,k=Q-D,z={time:ee(x.point1.time+P),price:x.point1.price+k},$={time:ee(x.point2.time+P),price:x.point2.price+k},te=zA([{time:z.time,value:z.price},{time:$.time,value:$.price}]);te.length>0&&d.series.setData(te),d.decoration&&(d.decoration.p1=z,d.decoration.p2=$);const he={...d,point1:z,point2:$};Te(ge=>{const xe=ge.map(Ee=>Ee===d?he:Ee);return v.current=xe,xe}),M(he),le.current=he}}}},N=()=>{Ae.current=null,oe.current=null},R=()=>{Ae.current||le.current||(re(null),Z([]))},y={capture:!0,passive:!1};return O.addEventListener("mousedown",ue,y),O.addEventListener("mousemove",L,y),O.addEventListener("mouseup",N,y),O.addEventListener("mouseleave",R,y),()=>{O.removeEventListener("mousedown",ue,y),O.removeEventListener("mousemove",L,y),O.removeEventListener("mouseup",N,y),O.removeEventListener("mouseleave",R,y)}},[Ce,Ue,Ke,Te]),Y.useEffect(()=>{const p=c.current,f=u.current;if(!p||!f)return;const O=()=>{const H=G;if(!H){V([]);return}const X=p.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const j=H.p1.rawTime??H.p1.time,q=H.p2.rawTime??H.p2.time,ue=X.timeToCoordinate(j),L=f.priceToCoordinate(H.p1.price),N=X.timeToCoordinate(q),R=f.priceToCoordinate(H.p2.price);ue!=null&&L!=null&&N!=null&&R!=null?V([{x:ue,y:L},{x:N,y:R}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:(j+ue)/2,y:(q+L)/2},{x:ue,y:L}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="crossline"&&H.p){const j=X.timeToCoordinate(H.p.rawTime),q=f.priceToCoordinate(H.p.price);j!=null&&q!=null?V([{x:j,y:q}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const j=X.timeToCoordinate(H.rawTime),q=f.priceToCoordinate(H.price);j!=null&&q!=null?V([{x:j,y:q}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.b1.rawTime),R=f.priceToCoordinate(H.b1.price),y=X.timeToCoordinate(H.b2.rawTime),h=f.priceToCoordinate(H.b2.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null&&y!=null&&h!=null?V([{x:j,y:q},{x:ue,y:L},{x:(N+y)/2,y:(R+h)/2}]):V([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R}]):V([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price),y=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null&&y!=null&&h!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R},{x:y,y:h}]):V([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price),y=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null&&y!=null&&h!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R},{x:y,y:h}]):V([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const j=X.timeToCoordinate(H.point1.time),q=f.priceToCoordinate(H.point1.price),ue=X.timeToCoordinate(H.point2.time),L=f.priceToCoordinate(H.point2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const j=X.timeToCoordinate(H.point1.time),q=f.priceToCoordinate(H.point1.price),ue=X.timeToCoordinate(H.point2.time),L=f.priceToCoordinate(H.point2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:(j+ue)/2,y:(q+L)/2},{x:ue,y:L}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);if(j!=null&&q!=null&&ue!=null&&L!=null){const N=Math.min(j,ue),R=Math.max(j,ue),y=Math.min(q,L),h=Math.max(q,L),T=(N+R)/2,I=(y+h)/2;V([{x:N,y},{x:T,y},{x:R,y},{x:N,y:I},{x:R,y:I},{x:N,y:h},{x:T,y:h},{x:R,y:h}])}else V([]);return}if(H.type==="circle"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);if(j!=null&&q!=null&&ue!=null&&L!=null){const N=(j+ue)/2,R=(q+L)/2,y=ue-j,h=L-q,T=Math.hypot(y,h);if(T<.001){V([]);return}const I=y/T,w=h/T,d=-w,_=I,Q=T/2,E=Q*Math.max(.05,H.minorRatio??.45);V([{x:N-I*Q,y:R-w*Q},{x:N+d*E,y:R+_*E},{x:N+I*Q,y:R+w*Q},{x:N-d*E,y:R-_*E}])}else V([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const j=H.primitive,q=X.timeToCoordinate(j.originTime),ue=f.priceToCoordinate(j.price);q!=null&&ue!=null?V([{x:q,y:ue}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const j=H.primitive,q=X.timeToCoordinate(j.time);if(q!=null){const ue=j.midYCss??200;V([{x:q,y:ue}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const j=u.current?.priceToCoordinate(H.price);if(j!=null){const q=c.current?c.current.paneSize().width:400;V([{x:q/2,y:j}])}else V([]);return}V([])};O();const me=p.timeScale();return me.subscribeVisibleTimeRangeChange(O),()=>{me.unsubscribeVisibleTimeRangeChange(O)}},[G]),Y.useEffect(()=>{let p=!1;v.current.forEach(f=>{if(f.type==="verticalline"&&f.primitive){const O=f===G||f===ie;f.primitive.showDot!==O&&(f.primitive.showDot=O,p=!0)}}),p&&c.current?.applyOptions({})},[G,ie]),Y.useEffect(()=>{let p=!1;v.current.forEach(f=>{if((f.type==="infoline"||f.type==="rulerline"||f.type==="arrowedline"||f.type==="rayline"||f.type==="extendedline"||f.type==="trendbyangle")&&f.primitive){const O=f===G||f===ie;f.primitive.isActive!==O&&(f.primitive.isActive=O,p=!0)}}),p&&c.current?.applyOptions({})},[G,ie]),Y.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:Pe}),p.priceLine){const f=Pe&&p.showPrice!==!1;p.priceLine.applyOptions(Pe?{color:p.lineColor??"#3b82f6",axisLabelVisible:f,title:f&&typeof p.price=="number"?p.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(p.type==="fibonacci"&&p.primitive){p.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:Pe}),p.parallelLine&&p.parallelLine.applyOptions({visible:Pe}),p.firstLine&&p.firstLine.applyOptions({visible:Pe}),p.secondLine&&p.secondLine.applyOptions({visible:Pe})),(p.type==="horizontalray"||p.type==="verticalline"||p.type==="infoline"||p.type==="rulerline"||p.type==="arrowedline"||p.type==="rayline"||p.type==="extendedline"||p.type==="crossline"||p.type==="trendbyangle"||p.type==="equidistantchannel"||p.type==="regressionchannel"||p.type==="stddevchannel"||p.type==="gannfan"||p.type==="ganngrid"||p.type==="andrewspitchfork"||p.type==="disjointchannel"||p.type==="flattopbottom"||p.type==="circle"||p.type==="triangle"||p.type==="ellipse"||p.type==="text")&&p.primitive){p.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}})},[Pe,Ke]),Y.useEffect(()=>{!Pe&&G&&(M(null),V([]))},[Pe,G]),Y.useEffect(()=>{if(v.current.length>Ke.length){const p=v.current.filter((f,O)=>!Ke.includes(f));G&&p.some(f=>f===G)&&(M(null),V([])),p.forEach(f=>{if(f.series&&c.current?.removeSeries(f.series),f.priceLine&&u.current?.removePriceLine(f.priceLine),f.textPrimitive)try{u.current?.detachPrimitive(f.textPrimitive)}catch{}if(f.type==="horizontalray"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="verticalline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="infoline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rulerline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="arrowedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rayline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="extendedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="crossline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="trendbyangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="equidistantchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="regressionchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="stddevchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="gannfan"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ganngrid"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="andrewspitchfork"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="disjointchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="flattopbottom"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="fibonacci"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rectangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="circle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="triangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ellipse"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="text"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="parallellines")try{f.baseLine&&c.current?.removeSeries(f.baseLine),f.parallelLine&&c.current?.removeSeries(f.parallelLine),f.firstLine&&c.current?.removeSeries(f.firstLine),f.secondLine&&c.current?.removeSeries(f.secondLine)}catch{}}),v.current=Ke}},[Ke,G]),Y.useEffect(()=>{const p=u.current;return p?(He.current.forEach(O=>{try{p.removePriceLine(O)}catch{}}),He.current=[],_e.filter(O=>O.symbol===ye).forEach(O=>{const me=parseFloat(O.openPrice??O.price),X=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(fA&&!isNaN(me)&&He.current.push(p.createPriceLine({price:me,color:X,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),at){const j=parseFloat(O.stopLoss),q=parseFloat(O.takeProfit);!isNaN(j)&&j>0&&He.current.push(p.createPriceLine({price:j,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(q)&&q>0&&He.current.push(p.createPriceLine({price:q,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{He.current.forEach(O=>{try{p.removePriceLine(O)}catch{}}),He.current=[]}):void 0},[_e,ye,fA,at]),Y.useEffect(()=>{const p=u.current;if(!p||!At)return;const f=parseFloat($A?.ask);if(isNaN(f)||f<=0)return;let O;try{O=p.createPriceLine({price:f,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{p.removePriceLine(O)}catch{}}},[At,$A]),Y.useEffect(()=>{const p=o.current;if(!p)return;const f=O=>{if(se.current){se.current=!1;return}if(b.current||!c.current)return;const me=c.current,H=u.current;if(me&&H&&v.current.length>0){const X=p.getBoundingClientRect(),j=O.clientX-X.left,q=O.clientY-X.top,ue=15;for(let L=v.current.length-1;L>=0;L--){const N=v.current[L];let R=!1;if(N.type==="text"&&N.rawTime!=null&&N.price!=null){const y=me.timeScale().timeToCoordinate(N.rawTime),h=H.priceToCoordinate(N.price);if(y!=null&&h!=null){const T=lp(N,y,h);j>=T.left&&j<=T.right&&q>=T.top&&q<=T.bottom&&(R=!0)}}else if(N.point1&&N.point2){const y=me.timeScale().timeToCoordinate(N.point1.time??N.point1.rawTime),h=H.priceToCoordinate(N.point1.price),T=me.timeScale().timeToCoordinate(N.point2.time??N.point2.rawTime),I=H.priceToCoordinate(N.point2.price);if(y!=null&&h!=null&&T!=null&&I!=null){const w=Math.hypot(j-y,q-h),d=Math.hypot(j-T,q-I),_=(y+T)/2,Q=(h+I)/2,E=Math.hypot(j-_,q-Q);(w<ue||d<ue||E<ue)&&(R=!0)}}else if(N.p1&&N.p2){const y=me.timeScale().timeToCoordinate(N.p1.rawTime),h=H.priceToCoordinate(N.p1.price),T=me.timeScale().timeToCoordinate(N.p2.rawTime),I=H.priceToCoordinate(N.p2.price);if(y!=null&&h!=null&&T!=null&&I!=null){const w=Math.min(y,T),d=Math.max(y,T),_=Math.min(h,I),Q=Math.max(h,I);j>=w-5&&j<=d+5&&q>=_-5&&q<=Q+5&&(R=!0)}}else if(N.p){const y=me.timeScale().timeToCoordinate(N.p.rawTime),h=H.priceToCoordinate(N.p.price);y!=null&&h!=null&&Math.hypot(j-y,q-h)<ue&&(R=!0)}else if(N.type==="pricelevel"&&N.price!=null){const y=H.priceToCoordinate(N.price);y!=null&&Math.abs(q-y)<ue&&(R=!0)}if(R){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),ne(N);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;pp(c.current,Ue,de)||c.current.timeScale().fitContent();const j=c.current.timeScale().getVisibleRange();ve(j)},80)};return p.addEventListener("dblclick",f,!0),()=>{p.removeEventListener("dblclick",f,!0)}},[Ue,de]);const Qp=G??ie,Fp=G?J:ce,tb=Pe&&CT(Qp,Fp),Ab=vT(Qp?.type);Y.useEffect(()=>{const p=o.current,f=l.current;if(!p||!f)return;const O=80,me=X=>{const j=p.getBoundingClientRect();f.style.opacity=j.bottom-X.clientY<=O?"1":"0"},H=()=>{f.style.opacity="0"};return p.addEventListener("mousemove",me),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",me),p.removeEventListener("mouseleave",H)}},[]);const ib=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*.8;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},[ve]),rb=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*1.25;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},[ve]),nb=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const O=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from-O,to:f.to-O})}catch{}},[]),sb=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const O=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from+O,to:f.to+O})}catch{}},[]),ob=Y.useCallback(()=>{if(!c.current)return;pp(c.current,Ue,de)||c.current.timeScale().fitContent();const f=c.current.timeScale().getVisibleRange();ve(f)},[Ue,de,ve]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${rt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:Ce===1||Ce!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Ne&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof ye=="object"?ye?.symbol:ye,"..."]})]})}),!Ne&<&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:rt==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:rt==="light"?"#64748b":"#94a3b8"},children:lt})]})}),!Ne&&!lt&&Ue.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:rt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),GA&&Ue.length>0&&(()=>{const p=Ue[Ue.length-1],f=O=>{const me=Number(O);return Number.isFinite(me)?me>=100?me.toFixed(2):me.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:rt==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:rt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:f(p?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:f(p?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:rt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.close)})]})]})})(),(A||Ct)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Gh,{bidPrice:e,askPrice:t,onBuyClick:ZT,onSellClick:YT})}),a.jsx($h,{isOpen:tt,onClose:qT,orderType:Me,bidPrice:e,askPrice:t}),a.jsx(qh,{isOpen:W!==null,onClose:()=>ne(null),chartObject:W,onUpdate:jT}),Ne&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),tb&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:Fp.map((p,f)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:p.x-5,top:p.y-5,backgroundColor:Ab}},f))}),a.jsx("div",{ref:l,style:{position:"absolute",bottom:"50px",left:"50%",transform:"translateX(-50%)",zIndex:30,display:"flex",alignItems:"center",gap:"4px",opacity:0,pointerEvents:"all",transition:"opacity 200ms"},children:[{title:"Zoom out",onClick:rb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})})},{title:"Zoom in",onClick:ib,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[a.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})},{title:"Scroll left",onClick:nb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"8,3 4,7 8,11"})})},{title:"Scroll right",onClick:sb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:ob,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:p,onClick:f,icon:O})=>a.jsx("button",{title:p,onClick:f,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:rt==="light"?"#374151":"#94a3b8",border:"1px solid "+(rt==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",me.currentTarget.style.color=rt==="light"?"#111827":"#e2e8f0"},onMouseLeave:me=>{me.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",me.currentTarget.style.color=rt==="light"?"#374151":"#94a3b8"},children:O},p))})]})})}),Ft={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function wp({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=zt(),[s,o]=Y.useState(!1),[l,c]=Y.useState(""),[u,g]=Y.useState(-1),B=Y.useRef(null),v=Y.useRef(null);Y.useEffect(()=>{const S=K=>{B.current&&!B.current.contains(K.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),Y.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const b=r.filter(S=>S.symbol.toLowerCase().includes(l.toLowerCase())),C=b.filter(S=>!S.symbol.endsWith("USDT")),U=b.filter(S=>S.symbol.endsWith("USDT")),F=S=>{A(S),o(!1),c("")};return r.find(S=>S.symbol===t),a.jsxs("div",{ref:B,style:{...Ft.container,...i},className:e,children:[a.jsxs("button",{style:Ft.button,onClick:()=>o(!s),onMouseEnter:S=>Object.assign(S.currentTarget.style,Ft.buttonHover),onMouseLeave:S=>{S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Ft.arrow,...s?Ft.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Ft.dropdown,children:[a.jsx("div",{style:Ft.searchContainer,children:a.jsx("input",{ref:v,style:Ft.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:S=>c(S.target.value)})}),a.jsx("div",{style:Ft.list,children:b.length===0?a.jsx("div",{style:Ft.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Forex & Metals"}),C.map(S=>a.jsxs("div",{style:{...Ft.item,...S.symbol===t?Ft.itemSelected:{}},onClick:()=>F(S.symbol),onMouseEnter:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="#334155")},onMouseLeave:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:S.symbol}),S.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(S.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(S.bid).toFixed(5)})]},S.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Crypto"}),U.map(S=>a.jsxs("div",{style:{...Ft.item,...S.symbol===t?Ft.itemSelected:{}},onClick:()=>F(S.symbol),onMouseEnter:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="#334155")},onMouseLeave:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:S.symbol}),S.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(S.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(S.bid).toFixed(2)})]},S.symbol))]})]})})]})]})}const WA={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},UT=[.01,.05,.1,.5,1];function Bp({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=UT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[g,B]=Y.useState(.1),v=i!==void 0?i:g,b=Y.useCallback(S=>{const K=Math.max(t,Math.min(A,parseFloat(S)||t)),G=Math.round(K/r)*r,M=parseFloat(G.toFixed(8));i!==void 0||B(M),e?.(M)},[t,A,r,i,e]),C=()=>b(v+r),U=()=>b(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...WA.container,...c},className:u,children:[o&&a.jsx("span",{style:WA.label,children:l}),a.jsx("button",{style:WA.btn,onClick:U,onMouseEnter:S=>Object.assign(S.currentTarget.style,WA.btnHover),onMouseLeave:S=>{S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:WA.input,type:"text",value:F,onChange:S=>{const K=S.target.value;if(K===""||K==="."||K==="0.")return;const G=parseFloat(K);isNaN(G)||b(G)},onBlur:()=>b(v)}),a.jsx("button",{style:WA.btn,onClick:C,onMouseEnter:S=>Object.assign(S.currentTarget.style,WA.btnHover),onMouseLeave:S=>{S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:WA.presets,children:n.map(S=>a.jsx("button",{style:{...WA.preset,...Math.abs(v-S)<1e-4?WA.presetActive:{}},onClick:()=>b(S),onMouseEnter:K=>{Math.abs(v-S)>=1e-4&&Object.assign(K.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:K=>{Math.abs(v-S)>=1e-4&&(K.currentTarget.style.borderColor="#334155")},children:S},S))})]})}const aA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function yp({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:u,className:g}){const{currentSymbolData:B}=zt(),[v,b]=Y.useState(""),[C,U]=Y.useState(!1),[F,S]=Y.useState("price"),K=i!==void 0?i:v,G=t!==void 0?t:C,M=r!==void 0?r:F,W=Y.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ne=Y.useCallback(re=>{r!==void 0||S(re),n?.(re)},[r,n]),J=Y.useCallback(re=>{i!==void 0||b(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){J(ce);return}const Z=parseFloat(ce);isNaN(Z)||J(ce)},ie=M==="price"?B?.bid?parseFloat(B.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...aA.container,...u},className:g,children:[l&&a.jsx("span",{style:aA.label,children:c}),s&&a.jsx("button",{style:{...aA.toggle,...G?aA.toggleOn:aA.toggleOff},onClick:()=>W(!G),children:a.jsx("div",{style:{...aA.toggleKnob,...G?aA.knobOn:aA.knobOff}})}),(G||!s)&&a.jsxs("div",{style:aA.inputGroup,children:[a.jsx("input",{style:aA.input,type:"text",value:K,onChange:V,placeholder:ie,onFocus:re=>re.currentTarget.style.borderColor="#EF5350",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...aA.modeBtn,...M==="price"?aA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...aA.modeBtn,...M==="pips"?aA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const lA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Cp({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:u,className:g}){const{currentSymbolData:B}=zt(),[v,b]=Y.useState(""),[C,U]=Y.useState(!1),[F,S]=Y.useState("price"),K=i!==void 0?i:v,G=t!==void 0?t:C,M=r!==void 0?r:F,W=Y.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ne=Y.useCallback(re=>{r!==void 0||S(re),n?.(re)},[r,n]),J=Y.useCallback(re=>{i!==void 0||b(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){J(ce);return}const Z=parseFloat(ce);isNaN(Z)||J(ce)},ie=M==="price"?B?.ask?parseFloat(B.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...lA.container,...u},className:g,children:[l&&a.jsx("span",{style:lA.label,children:c}),s&&a.jsx("button",{style:{...lA.toggle,...G?lA.toggleOn:lA.toggleOff},onClick:()=>W(!G),children:a.jsx("div",{style:{...lA.toggleKnob,...G?lA.knobOn:lA.knobOff}})}),(G||!s)&&a.jsxs("div",{style:lA.inputGroup,children:[a.jsx("input",{style:lA.input,type:"text",value:K,onChange:V,placeholder:ie,onFocus:re=>re.currentTarget.style.borderColor="#26A69A",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...lA.modeBtn,...M==="price"?lA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...lA.modeBtn,...M==="pips"?lA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const ST=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],RA={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function vp({showLabel:i=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:u,chartObjects:g,setChartObjects:B}=zt(),[v,b]=Y.useState(null),C=A||ST,U=K=>{l(o===K?null:K)},F=()=>{B([]),l(null)},S=()=>{u(!c)};return a.jsxs("div",{style:{...RA.container,...n},className:s,children:[i&&a.jsx("span",{style:RA.label,children:r}),C.map(K=>a.jsxs("button",{style:{...RA.btn,...o===K.id?RA.btnActive:{}},onClick:()=>U(K.id),onMouseEnter:G=>{b(K.id),o!==K.id&&Object.assign(G.currentTarget.style,RA.btnHover)},onMouseLeave:G=>{b(null),o!==K.id&&(G.currentTarget.style.borderColor="#334155",G.currentTarget.style.backgroundColor="#1e293b",G.currentTarget.style.color="#94a3b8")},title:K.name,children:[K.icon,v===K.id&&a.jsx("div",{style:RA.tooltip,children:K.name})]},K.id)),(e||t)&&a.jsx("div",{style:RA.divider}),t&&a.jsx("button",{style:{...RA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:S,onMouseEnter:K=>{K.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:K=>{K.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:RA.deleteBtn,onClick:F,onMouseEnter:K=>Object.assign(K.currentTarget.style,RA.deleteBtnHover),onMouseLeave:K=>{K.currentTarget.style.borderColor="#334155",K.currentTarget.style.backgroundColor="#1e293b",K.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Tp={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function ET({showCoinSelector:i=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:u,onStopLossEnabledChange:g,takeProfit:B,onTakeProfitChange:v,takeProfitEnabled:b,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:S={},takeProfitProps:K={},drawingToolsProps:G={},style:M,className:W}){const ne=[];i&&ne.push(a.jsx(wp,{...U},"coin")),e&&ne.push(a.jsx(Bp,{value:s,onChange:o,...F},"volume")),t&&ne.push(a.jsx(yp,{value:l,onChange:c,enabled:u,onEnabledChange:g,...S},"sl")),A&&ne.push(a.jsx(Cp,{value:B,onChange:v,enabled:b,onEnabledChange:C,...K},"tp")),r&&ne.push(a.jsx(vp,{...G},"draw"));const J=[];return ne.forEach((V,ie)=>{J.push(V),n&&ie<ne.length-1&&J.push(a.jsx("div",{style:Tp.divider},`div-${ie}`))}),a.jsx("div",{style:{...Tp.toolbar,...M},className:W,children:J})}const LT=[{label:"M1",value:"M1"},{label:"M5",value:"M5"},{label:"M15",value:"M15"},{label:"M30",value:"M30"},{label:"H1",value:"H1"},{label:"H4",value:"H4"},{label:"D1",value:"D1"},{label:"W1",value:"W1"}],sl={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function MT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=zt();return a.jsx("div",{style:{...sl.container,...i},className:e,children:LT.map(r=>a.jsx("button",{style:{...sl.btn,...t===r.value?sl.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},children:r.label},r.value))})}const HT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],ol={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function IT({style:i,className:e}){const{chartType:t,setChartType:A}=zt();return a.jsx("div",{style:{...ol.container,...i},className:e,children:HT.map(r=>a.jsxs("button",{style:{...ol.btn,...t===r.value?ol.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const AA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function DT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=zt(),[u,g]=Y.useState(null),B=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),b=v>0&&B>0?Math.abs(v-B):0,C=S=>!S||S===0?"-.-----":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5),U=S=>S===0?"-":S>=1?S.toFixed(1):S>=.01?S.toFixed(3):(S*1e4).toFixed(1)+"p",F=Y.useCallback(S=>{if(!s)return;const K=S==="BUY"?v:B;if(!K||K<=0){g({type:"error",message:"No price available"});return}const G={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:S,volume:i,price:K,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(W=>[...W,G]);const M=i*K*.01;c(W=>W-M),g({type:"success",message:`${S} executed`}),A?.(G),setTimeout(()=>g(null),3e3)},[s,v,B,i,e,t,l,c,A]);return a.jsxs("div",{style:{...AA.container,...r},className:n,children:[a.jsx("button",{style:AA.sellBtn,onClick:()=>F("SELL"),onMouseEnter:S=>{Object.assign(S.currentTarget.style,AA.sellBtnHover)},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#7f1d1d",S.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...AA.priceValue,color:"#EF5350"},children:C(B)})]}),a.jsxs("div",{style:AA.spread,children:[a.jsx("span",{style:AA.spreadLabel,children:"Spread"}),a.jsx("span",{style:AA.spreadValue,children:U(b)})]}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...AA.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:AA.buyBtn,onClick:()=>F("BUY"),onMouseEnter:S=>{Object.assign(S.currentTarget.style,AA.buyBtnHover)},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#14532d",S.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...AA.status,backgroundColor:u.type==="success"?"#14532d":"#7f1d1d",color:u.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${u.type==="success"?"#166534":"#991b1b"}`},children:u.message})]})}const ot={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function _T({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=zt(),[l,c]=Y.useState(null),u=A.filter(C=>C.status==="OPEN"||!C.closeAt),g=Y.useCallback((C,U)=>{const F=n.find(S=>S.symbol===C);return F?U?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),B=Y.useCallback(C=>{if(l)return;c(C.id);const U=g(C.symbol,C.type),S=(C.type?.toUpperCase()==="BUY"?U-C.price:C.price-U)*C.volume,K=C.volume*C.price*.01;r(G=>G.filter(M=>M.id!==C.id)),o(G=>G+K+S),c(null)},[l,g,r,o]),v=C=>{const U=parseFloat(C);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},b=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...i},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):u.map(C=>{const U=g(C.symbol,C.type),F=C.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...ot.td,...C.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:C.type}),a.jsx("td",{style:ot.td,children:C.volume}),a.jsx("td",{style:ot.td,children:v(C.price)}),a.jsx("td",{style:ot.td,children:v(U)}),a.jsx("td",{style:ot.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:b(F)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>B(C),disabled:l===C.id,onMouseEnter:S=>{l!==C.id&&(S.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#7f1d1d"},children:l===C.id?"...":"Close"})})]},C.id)})})]})})]})}function PT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(i)}function NT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(i)}function OT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(i)}function kT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(i)}const KT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:u,marketWatchOpen:g=!0,onToggleMarketWatch:B,buySellPanelOpen:v,onMove:b})=>{const{theme:C}=zt(),U=C==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],S={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return a.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b min-w-max ${U?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${U?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(K=>a.jsx("button",{onClick:()=>r(K),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
13
|
+
${A===K?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
|
|
14
|
+
`,title:K,children:S[K]},K))}),a.jsx("div",{className:`flex items-center gap-1 border-r ${U?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(K=>a.jsx("button",{onClick:()=>r(K),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
15
|
+
${A===K?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
|
|
16
|
+
`,title:K,children:S[K]},K))}),a.jsxs("div",{className:"flex items-center gap-2",children:[F.map(K=>a.jsx("button",{onClick:()=>t(K),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===K?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:K},K)),a.jsx("div",{className:`border-r h-6 mx-1 ${U?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:v?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${v?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 5v4H9c-1.054 0-1.918.816-1.995 1.85L7 11v2c0 1.105.895 2 2 2h2.5v4H4c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h7.5z"}),a.jsx("path",{fill:"#3687ED",d:"M20 5c1.105 0 2 .895 2 2v10c0 1.105-.895 2-2 2h-7.5v-4H15c1.054 0 1.918-.816 1.995-1.85L17 13v-2c0-1.105-.895-2-2-2h-2.5V5H20z"}),a.jsx("path",{fill:"#B0BEC5",d:"M10 10h4c1.105 0 2 .895 2 2s-.895 2-2 2h-4c-1.105 0-2-.895-2-2s.895-2 2-2z"})]})})}),a.jsxs("button",{onClick:n,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 4v2.02C8.42 6.276 6 8.856 6 12c0 3.145 2.42 5.725 5.5 5.98V20H10c-4.418 0-8-3.582-8-8s3.582-8 8-8h1.5z"}),a.jsx("path",{fill:"#3687ED",d:"M14 4c4.418 0 8 3.582 8 8s-3.582 8-8 8h-1.5v-2.02c3.08-.256 5.5-2.836 5.5-5.98 0-3.145-2.42-5.725-5.5-5.98V4H14z"}),a.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),a.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:s,className:`p-1 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(PT,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(NT,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:b,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>B?.(),title:g?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${g?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[a.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14Zm-1 2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h12Z"})]})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${U?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:a.jsx("path",{d:"M22 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0-4a1 1 0 0 1-1-1V4h-1a1 1 0 1 1 0-2h1a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Zm1 7v8a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-8l3.764-1s.45-.428.789-1.105l.171-.342a.998.998 0 0 1 .894-.553h4.764a1 1 0 0 1 .894.552l.171.342c.339.678.789 1.106.789 1.106L23 13Zm-8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm0 4.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3ZM16 4h-2a1 1 0 1 1 0-2h2a1 1 0 1 1 0 2Zm-6 0H8a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2ZM4 22H3a2 2 0 0 1-2-2v-1a1 1 0 1 1 2 0v1h1a1 1 0 1 1 0 2ZM4 4H3v1a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2h1a1 1 0 0 1 0 2ZM2 8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Zm0 5a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1Z"})})}),a.jsx("button",{type:"button",onClick:()=>u?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${U?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})})]})]})},Jr=[{label:"Trendline",toolId:2,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})},{label:"Horizontal Line",toolId:20,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M19 9l3 3-3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Vertical Line",toolId:22,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),a.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),a.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),a.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M5.054 17.988a2.988 2.988 0 0 1-1.31-.312 2.994 2.994 0 1 1 2.69 1.693 2.988 2.988 0 0 1-1.38-.381Zm-1 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),a.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),a.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Zr=[{label:"Regression Channel",toolId:40,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Equidistant Channel",toolId:3,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M15 8a2.966 2.966 0 0 1-1.308-.312l-6 6c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l6-6A2.992 2.992 0 1 1 15 8ZM5 14a1 1 0 1 0 0 2.001A1 1 0 0 0 5 14ZM15 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm6.714 6.666-7.026 7.026a3.03 3.03 0 1 1-1.381-1.381l7.026-7.026a.977.977 0 1 1 1.381 1.381ZM12 18a1 1 0 1 0 0 2.001A1 1 0 0 0 12 18Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"StdDev Channel",toolId:41,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.381-1.382ZM10 15H9v4a1 1 0 1 1-2 0v-1H6a1 1 0 0 1 0-2h1v-4a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm7-7h-1v4a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1V5a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm-4.714 12.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.382-1.382h.001Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Andrews Pitchfork",toolId:42,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m21.714 13.666-4.026 4.026c.203.406.31.854.312 1.308a3 3 0 0 1-6 0c.002-.454.11-.902.312-1.308L10 15.381l-2.312 2.311a3.03 3.03 0 1 1-1.381-1.381L8.619 14l-2.311-2.312a3 3 0 1 1-.001-5.377l4.026-4.026a.976.976 0 1 1 1.381 1.381L7.688 7.692a2.9 2.9 0 0 1 0 2.615L10 12.619l8.333-8.334a.976.976 0 1 1 1.381 1.381L11.381 14l2.312 2.312a2.9 2.9 0 0 1 2.614 0l4.026-4.026a.977.977 0 1 1 1.381 1.38ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],Yr=[{label:"Gann Line",toolId:43,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3 3 0 0 1-3 3 2.965 2.965 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l3-3a2.98 2.98 0 0 1 4-4l3-3A2.992 2.992 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2.001A1 1 0 0 0 5 18Zm7-7a1 1 0 1 0 0 2.001A1 1 0 0 0 12 11Zm7-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Fan",toolId:44,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M21.72 3.584 17.694 7.61c.202.407.31.854.312 1.308a3 3 0 0 1-3 3 2.967 2.967 0 0 1-1.308-.312l-4.45 4.45 10.109-4.042a.987.987 0 0 1 .834 1.79L8.167 18.61l7.75-.7a1.004 1.004 0 1 1 .18 2l-8.684.79a2.992 2.992 0 1 1-4.2-4.164l.794-8.7a1.004 1.004 0 1 1 2 .181L5.3 15.765 9.673 4.591a.969.969 0 0 1 1.3-.48 1 1 0 0 1 .47 1.32L7.79 14.77l4.538-4.538a2.98 2.98 0 0 1 4-4l4.026-4.026a.977.977 0 0 1 1.367 1.377ZM5.006 19.918a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm10-12a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Grid",toolId:45,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-.5.5L21 12l-3.809 3.809.5.5a3.034 3.034 0 1 1-1.381 1.381l-.5-.5L12 21l-3.809-3.809-.5.5c.202.407.308.855.309 1.309a3.03 3.03 0 1 1-1.693-2.689l.5-.5L3 12l3.81-3.81-.5-.5A2.966 2.966 0 0 1 5 8a3.031 3.031 0 1 1 2.689-1.693l.5.5L12 3l3.809 3.81.5-.5A2.993 2.993 0 1 1 19 8Zm0 12a1 1 0 1 0 0-2.002A1 1 0 0 0 19 20ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm7 14.452 2.536-2.536L12 13.381l-2.536 2.535L12 18.452ZM5.547 12l2.536 2.535L10.619 12 8.083 9.464 5.547 12ZM12 5.547 9.464 8.083 12 10.619l2.535-2.536L12 5.547Zm3.916 3.917L13.381 12l2.536 2.535L18.452 12l-2.536-2.536ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],qr=[{label:"Rectangle",toolId:5,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})},{label:"Circle",toolId:46,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12C22 10.2504 21.5507 8.60571 20.7611 7.17509C20.9149 6.81421 21 6.41704 21 6C21 4.34315 19.6569 3 18 3C17.583 3 17.1858 3.0851 16.8249 3.23888C15.3943 2.44933 13.7496 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12ZM12 20C16.4183 20 20 16.4183 20 12C20 10.8264 19.7473 9.7118 19.2933 8.70768C18.9017 8.89507 18.4631 9 18 9C17.5369 9 17.0983 8.89506 16.7066 8.70766L14.7077 10.7066C14.8951 11.0983 15 11.5369 15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.4632 9 12.9018 9.10496 13.2935 9.2924L15.2924 7.29348C15.105 6.90183 15 6.46317 15 6C15 5.5369 15.1049 5.09831 15.2923 4.7067C14.2882 4.25272 13.1736 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7Z",fill:"currentColor"})})},{label:"Triangle",toolId:47,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6C15 7.65685 13.6569 9 12 9C11.763 9 11.5324 8.97252 11.3113 8.92057L7.37081 16.1613C6.95686 15.6284 6.36717 15.2388 5.68872 15.0794L9.62925 7.83858C9.23484 7.33074 9 6.6928 9 6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6ZM13 6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.3708 7.83867C13.9569 8.37162 13.3672 8.76126 12.6887 8.9206L16.6292 16.1614C16.4344 16.4122 16.2786 16.6948 16.1707 17H7.82941C7.93996 17.3128 8.00012 17.6494 8.00012 18C8.00012 18.3506 7.93996 18.6872 7.8294 19H16.1707C16.5826 20.1652 17.6938 21 19 21C20.6569 21 22 19.6569 22 18C22 16.3431 20.6569 15 19 15C18.763 15 18.5324 15.0275 18.3113 15.0794L14.3708 7.83867ZM19 19C19.5523 19 20 18.5523 20 18C20 17.4477 19.5523 17 19 17C18.4477 17 18 17.4477 18 18C18 18.5523 18.4477 19 19 19Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00012 18C8.00012 19.6569 6.65685 21 5 21C3.34315 21 2 19.6569 2 18C2 16.3431 3.34315 15 5 15C6.65685 15 8.00012 16.3431 8.00012 18ZM6 18C6 18.5523 5.55228 19 5 19C4.44772 19 4 18.5523 4 18C4 17.4477 4.44772 17 5 17C5.55228 17 6 17.4477 6 18Z",fill:"currentColor"})]})},{label:"Ellipse",toolId:48,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3a3.001 3.001 0 0 0-2.935 2.378c-1.25.333-2.381.874-3.322 1.58a7.344 7.344 0 0 0-1.886 2.045 3 3 0 0 0 0 5.994 7.343 7.343 0 0 0 1.886 2.046C7.38 18.27 9.595 19 12 19s4.62-.73 6.257-1.957a7.343 7.343 0 0 0 1.886-2.046 3 3 0 0 0 0-5.994 7.344 7.344 0 0 0-1.886-2.046c-.94-.705-2.073-1.246-3.322-1.579A3.001 3.001 0 0 0 12 3Zm-1 3a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm7.156 3.634a5.584 5.584 0 0 0-1.1-1.077 7.61 7.61 0 0 0-2.391-1.177 3 3 0 0 1-5.33 0 7.61 7.61 0 0 0-2.392 1.177c-.437.328-.805.69-1.099 1.076A2.995 2.995 0 0 1 7 12c0 .962-.452 1.818-1.156 2.367.294.386.662.748 1.1 1.076C8.201 16.387 9.985 17 12 17c2.014 0 3.798-.613 5.057-1.557.437-.328.805-.69 1.099-1.077A2.995 2.995 0 0 1 17 12c0-.961.452-1.817 1.156-2.366ZM3 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm16 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z",fill:"currentColor"})})}],ks=({children:i,top:e,panelRef:t,isLight:A})=>a.jsx("div",{ref:t,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${A?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:a.jsx("div",{className:"py-1",children:i})}),VT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:g,setDrawingsVisible:B,chartLocked:v,setChartLocked:b,theme:C,setTheme:U,setCandleColors:F,setShowTradeOrders:S,showTradeOrders:K,setShowTradePosition:G,showTradePosition:M,setShowTradeHistory:W,showTradeHistory:ne,setShowSLTP:J,showSLTP:V,setShowAskPrice:ie,showAskPrice:re,setShowChartControls:ce,showChartControls:Z,setShowTradeNotification:Ae,showTradeNotification:oe,setShowCrosshair:le,showCrosshair:se,setShowOHLC:ae,showOHLC:pe,setIsShow:we}=zt(),Qe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[Fe,Be]=Y.useState(!1),[ve,Ce]=Y.useState(null),[be,Le]=Y.useState(null),[Ge,Ke]=Y.useState(0),[Te,_e]=Y.useState(!1),[ye,de]=Y.useState(0),[Pe,et]=Y.useState(!1),[it,rt]=Y.useState(0),[dt,fA]=Y.useState(!1),[Ze,Oe]=Y.useState(0),[at,At]=Y.useState(!1),[Ct,xt]=Y.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),GA=Y.useRef(null),$A=Y.useRef(null),Gt=Y.useRef(null),mA=Y.useRef(null),XA=Y.useRef(null),Kt=Y.useRef(null);Y.useEffect(()=>{const He=tt=>{const Je=GA.current;Fe&&Je&&!Je.contains(tt.target)&&(Be(!1),Ce(null));const Me=$A.current;be==="line"&&Me&&!Me.contains(tt.target)&&Le(null);const ze=Gt.current;be==="channel"&&ze&&!ze.contains(tt.target)&&Le(null);const Ue=mA.current;be==="gann"&&Ue&&!Ue.contains(tt.target)&&Le(null);const We=XA.current;be==="shape"&&We&&!We.contains(tt.target)&&Le(null)};return window.addEventListener("mousedown",He),()=>window.removeEventListener("mousedown",He)},[Fe,be]),Y.useEffect(()=>{const He=tt=>{tt.key==="Escape"&&(Be(!1),Ce(null),Le(null))};return window.addEventListener("keydown",He),()=>window.removeEventListener("keydown",He)},[]);const Ut=Y.useMemo(()=>[{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 13H15.874C15.5122 14.4056 14.4056 15.5122 13 15.874V20C13 20.2652 12.8946 20.5196 12.7071 20.7071C12.5196 20.8946 12.2652 21 12 21C11.7348 21 11.4804 20.8946 11.2929 20.7071C11.1054 20.5196 11 20.2652 11 20V15.874C9.59439 15.5122 8.4878 14.4056 8.12602 13H4C3.73478 13 3.48043 12.8946 3.29289 12.7071C3.10536 12.5196 3 12.2652 3 12C3 11.7348 3.10536 11.4804 3.29289 11.2929C3.48043 11.1054 3.73478 11 4 11H8.12602C8.4878 9.59439 9.59439 8.4878 11 8.12602V4C11 3.73478 11.1054 3.48043 11.2929 3.29289C11.4804 3.10536 11.7348 3 12 3C12.2652 3 12.5196 3.10536 12.7071 3.29289C12.8946 3.48043 13 3.73478 13 4V8.12602C14.4056 8.4878 15.5122 9.59439 15.874 11H20C20.2652 11 20.5196 11.1054 20.7071 11.2929C20.8946 11.4804 21 11.7348 21 12C21 12.2652 20.8946 12.5196 20.7071 12.7071C20.5196 12.8946 20.2652 13 20 13ZM12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10Z",fill:"currentColor"})]})}),label:"Crosshair",description:"Precise cursor positioning for measurement on chart"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})}),label:"Trend Line",description:"Draw trend line (drag from first point to second point)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Parallel Lines",description:"Draw two parallel trend lines (draw first line, then second)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:a.jsx("path",{d:"M21 15H3a1 1 0 0 1 0-2h18a1 1 0 0 1 0 2Zm-2-3a2.99 2.99 0 0 1-2.816-2H3a1 1 0 0 1 0-2h13.184A2.995 2.995 0 1 1 19 12Zm0-4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2-3H3a1 1 0 0 1 0-2h18a1 1 0 1 1 0 2ZM5 16a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2H7.816A2.995 2.995 0 1 1 5 16Zm0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Fibonacci",description:"Draw Fibonacci retracement levels"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Rectangle",description:"Draw support/resistance zone (drag from corner to corner)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M12.76 17.958c-.504.07-1.016.07-1.52 0C6.07 17.532 2 12.932 2 12c0-.977 4.48-6 10-6s10 5.043 10 6c0 .912-4.07 5.529-9.24 5.958ZM3.63 12a11.724 11.724 0 0 0 3.03 2.741 5.963 5.963 0 0 1 .02-5.492A11.7 11.7 0 0 0 3.63 12ZM12 7.57a4.443 4.443 0 1 0-.006 8.886A4.443 4.443 0 0 0 12 7.57Zm5.31 1.652a5.954 5.954 0 0 1 .01 5.546A11.45 11.45 0 0 0 20.37 12a11.525 11.525 0 0 0-3.06-2.778ZM12 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Eye",description:"Show or hide all drawing objects on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M16 20H8a2 2 0 0 1-2-2v-7a2 2 0 0 1 1.05-1.749A1.044 1.044 0 0 1 7 9a5 5 0 0 1 8.75-3.3 1.008 1.008 0 0 1-.09 1.411 1 1 0 0 1-1.41-.09A3 3 0 0 0 9 9h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2Zm0-9H8v7h8v-7Zm-4 2a1 1 0 0 1 1 1v1a1 1 0 0 1-2 0v-1a1 1 0 0 1 1-1Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Lock",description:"Lock chart (disable pan and zoom)"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),label:"Delete",description:"Remove last drawn object from chart"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16M6 4v16M12 4v16M18 4v16"})}),label:"Grid",description:"Toggle grid display on/off for chart alignment"},{icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fill:"currentColor",d:"M12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C9.068 22 6.43 20.738 4.602 18.728L6.081 17.382C7.544 18.99 9.654 20 12 20C16.418 20 20 16.418 20 12C20 7.582 16.418 4 12 4C7.92 4 4.554 7.054 4.062 11H5.828L3 13.828L0.171997 11H2.049C2.551 5.947 6.815 2 12 2ZM13 7V12.186L16.657 15.843L15.243 17.257L11 13V7H13Z"})}),label:"History",description:"View trade history"},{icon:a.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),gA=He=>{const tt=Ut[He].label;if(tt==="Menu"){Be(Je=>!Je),Ce(null);return}if(tt==="Grid"){s(!n);return}if(tt==="Magnet"){l(!o),r(o?null:He);return}if(tt==="Delete"){if(c.length>0){const Je=[...c];Je.pop(),u(Je)}return}if(tt==="Eye"){B(!g);return}if(tt==="Lock"){b(!v);return}if(tt==="Light Theme"||tt==="Dark Theme"){U(C==="light"?"dark":"light"),Be(!1),Ce(null);return}if(tt==="History"){we(!0);return}r(A===He?null:He)};Ut.slice(0,12);const nt=Ut.slice(12),mt=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],St=[{key:"accounts",label:"Trading accounts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 14a6 6 0 0 0-5 2 8 8 0 0 0 5 2l5-2a6 6 0 0 0-5-2zm0-12a8 8 0 0 0-6 13 8 8 0 0 1 6-3 8 8 0 0 1 6 3 8 8 0 0 0-6-13zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",fill:"currentColor"})})})}),submenu:[{label:"Connect to account",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.jsx("path",{fillRule:"evenodd","clip-rule":"evenodd",d:"M20 6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6zm-2 3V6h-3v3h3zm-4-3h-4v2.999h4V6zM9 6H6v3l3-.001V6zm-3 4v4l3-.001v-4H6zm0 5v3h3v-3.001H6zm4 3h4v-3.001h-4V18zm5 0h3v-3h-3v3zm3-4v-4h-3v4h3zm-8-.001v-4h4v4h-4z",fill:"currentColor"})})})},{label:"Trade Orders",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m6.926 14-.418-1.16H4.547L4.148 14H3.02L5.3 8.2h.446l2.3 5.8h-1.12ZM5.523 9.95l-.687 2.113H6.21l-.688-2.114Zm2.86 3.734.375-.91c.4.28.795.421 1.183.421.597 0 .895-.208.895-.625a.886.886 0 0 0-.211-.558c-.14-.177-.431-.375-.871-.594-.438-.221-.733-.402-.887-.543a1.506 1.506 0 0 1-.351-.508 1.682 1.682 0 0 1-.121-.648c0-.443.161-.81.484-1.102.325-.291.742-.437 1.25-.437.661 0 1.147.123 1.457.37l-.309.876a1.909 1.909 0 0 0-1.129-.383c-.234 0-.416.062-.546.187a.635.635 0 0 0-.192.48c0 .33.363.67 1.09 1.024.383.188.659.361.828.52.17.156.298.34.387.55.088.209.133.442.133.7 0 .463-.184.845-.551 1.144-.365.3-.854.45-1.469.45a2.617 2.617 0 0 1-1.445-.414Zm7.613.316-1.594-2.438-.636.872V14H12.75V8.277h1.016v2.739l1.945-2.739h1.156l-1.793 2.5L17.211 14h-1.215ZM3 15h18v1H3z",fill:"#C96057"})})})})},{label:"Chart Controls",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),a.jsx("path",{d:"M11.2574 18.9959C11.1719 18.9986 11.0861 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11C19 11.0599 18.9993 11.1196 18.998 11.1791L16.9574 10.2813C16.6023 7.3064 14.0705 5 11 5C7.68629 5 5 7.68629 5 11C5 14.191 7.49101 16.8002 10.6345 16.9891L11.2574 18.9959Z",fill:"currentColor"})]})})})},{label:"Crosshair cursor",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"theme",label:C==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.408 12.954-2.265-.756a.209.209 0 0 1 0-.396l2.265-.755a.209.209 0 0 1 .276.198v1.51c0 .143-.14.244-.276.198ZM5.959 7.306 4.89 5.17c-.09-.18.1-.37.28-.28l2.136 1.068a.209.209 0 0 1 .054.334L6.293 7.36c-.1.101-.27.074-.334-.054ZM11.802 21.857l-.755-2.265a.209.209 0 0 1 .198-.276h1.51c.143 0 .244.14.198.276l-.755 2.265a.21.21 0 0 1-.396 0ZM11.802 2.143l-.755 2.265a.209.209 0 0 0 .198.276h1.51c.143 0 .244-.14.198-.276l-.755-2.265a.209.209 0 0 0-.396 0ZM18.83 19.11l-2.137-1.068a.209.209 0 0 1-.054-.335l1.068-1.068c.1-.1.27-.073.334.055l1.069 2.136c.09.18-.101.37-.28.28ZM16.693 5.958 18.83 4.89c.18-.09.37.1.28.28l-1.068 2.136a.209.209 0 0 1-.334.054l-1.068-1.068a.209.209 0 0 1 .054-.334ZM4.89 18.83l1.069-2.136a.209.209 0 0 1 .334-.055l1.068 1.068c.101.101.074.271-.054.335L5.171 19.11c-.18.09-.37-.1-.28-.28ZM21.857 12.198l-2.265.755a.209.209 0 0 1-.276-.198v-1.51c0-.143.14-.244.276-.198l2.265.755a.21.21 0 0 1 0 .396Z",fill:"#FEBC5A"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fillRule:"evenodd",d:"M20.775 8.992C20.922 9.638 21 10.31 21 11a8.354 8.354 0 0 0-.787 0c-1.467.072-2.422.564-3.082 1.283l-1.18-1.65c.761-.718 1.697-1.205 2.81-1.452A7 7 0 1 0 12 18c.396-.001.565-.082.63-.12.07-.042.17-.124.295-.34.218-.375.36-.835.534-1.49l1.518 1.822C14.485 19.102 13.705 20 12 20a9 9 0 1 1 8.775-11.008Z","clip-rule":"evenodd",fill:"currentColor"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M13.892 14.693c-2.034.46-2.59-1.07-2.892-4.693 3.85.352 5.232 1.05 4.697 3.012L20 17.192s.038 1.023-.361 1.447c-.463.49-1.687.361-1.687.361l-4.06-4.307Z",fill:"currentColor"})]})})}),submenu:[{label:"Green & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#26a69a"})]})})})},{label:"Blue & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#578cf2"})]})})})},{label:"Black & White",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#76ac85"})]})})})}]},{key:"lang",label:"Language",rightText:"EN",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.9 17.39C17.64 16.59 16.89 16 16 16H15V13C15 12.4477 14.5523 12 14 12H8V10H10C10.5523 10 11 9.55228 11 9V7H13C14.1046 7 15 6.10457 15 5V4.59C17.93 5.77 20 8.64 20 12C20 14.08 19.2 15.97 17.9 17.39ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.78 4.21 10.21L9 15V16C9 17.1046 9.89543 18 11 18V19.93ZM12 2C6.47715 2 2 6.47715 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C6.8043 20.9464 9.34784 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z",fill:"currentColor"})})})}),submenu:[{label:"English",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}]}],It=({item:He})=>{const tt=!!He.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Kt.current&&(clearTimeout(Kt.current),Kt.current=null),tt&&Ce(He.key)},onMouseLeave:()=>{tt&&(Kt.current=setTimeout(()=>Ce(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{tt?Ce(Je=>Je===He.key?null:He.key):(He.key==="theme"&&U(Je=>Je==="light"?"dark":"light"),Be(!1),Ce(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:He.label}),He.rightText&&a.jsx("span",{className:`text-xs ${$e?"text-slate-500":"text-slate-400"}`,children:He.rightText}),tt&&a.jsx("svg",{className:`w-4 h-4 ${$e?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),tt&&ve===He.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${$e?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:He.submenu.map((Je,Me)=>{const ze=Ct[He.key],Ue=Array.isArray(ze)?ze.includes(Je.label):ze===Je.label||Je.selected&&ze==null;return a.jsxs("button",{type:"button",onClick:()=>{He.key==="chart"?(xt(Ne=>{const st=Array.isArray(Ne.chart)?Ne.chart:[Ne.chart],lt=st.includes(Je.label)?st.filter(vt=>vt!==Je.label):[...st,Je.label];return{...Ne,chart:lt}}),{Grid:()=>s(!n),"Trade Orders":()=>S(!K),"Ask Price":()=>ie(!re),"Chart Controls":()=>ce(!Z),"Trade Notification":()=>Ae(!oe),"Crosshair cursor":()=>le(!se),"Show OHLC":()=>ae(!pe)}[Je.label]?.()):(xt(We=>({...We,[He.key]:Je.label})),He.key==="colors"&&Qe[Je.label]&&F(Qe[Je.label]))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:Je.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Je.label}),Ue&&a.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},Me)})})})]})},$e=C==="light";return a.jsxs("div",{className:"relative h-full",children:[a.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${$e?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:mt.map((He,tt)=>{const Je=He==="gann",Me=Je?null:Ut[He],ze=Je?-1:He;return a.jsxs(Y.Fragment,{children:[ze===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=Jr[Ge].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
17
|
+
${A===Jr[Ge].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Jr[Ge].label,children:Jr[Ge].icon}),a.jsx("span",{onMouseEnter:()=>_e(!0),onMouseLeave:()=>_e(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:Te?10:7,height:Te?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):ze===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=Zr[ye].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
18
|
+
${A===Zr[ye].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Zr[ye].label,children:Zr[ye].icon}),a.jsx("span",{onMouseEnter:()=>et(!0),onMouseLeave:()=>et(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:Pe?10:7,height:Pe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):Je?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=Yr[it].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
19
|
+
${A===Yr[it].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Yr[it].label,children:Yr[it].icon}),a.jsx("span",{onMouseEnter:()=>fA(!0),onMouseLeave:()=>fA(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:dt?10:7,height:dt?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):ze===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=qr[Ze].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
20
|
+
${A===qr[Ze].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:qr[Ze].label,children:qr[Ze].icon}),a.jsx("span",{onMouseEnter:()=>At(!0),onMouseLeave:()=>At(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:at?10:7,height:at?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>gA(ze),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
21
|
+
${Me.label==="Grid"&&n||Me.label==="Eye"&&!g||Me.label==="Lock"&&v||A===ze?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Me.label}: ${Me.description}`,children:Me.icon}),!Je&&Me.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${$e?"border-slate-200":"border-slate-700"}`})]},Je?"gann-slot":`${Me.label}-${He}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:nt.map((He,tt)=>{const Je=12+tt;return a.jsx("button",{onClick:()=>gA(Je),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
22
|
+
${He.label==="Grid"&&n||He.label==="Eye"&&!g||He.label==="Lock"&&v||A===Je?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${He.label}: ${He.description}`,children:He.icon},He.label)})})]}),be==="line"&&a.jsx(ks,{top:84,panelRef:$A,isLight:$e,children:Jr.map((He,tt)=>{const Je=Ge===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),Ke(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),be==="channel"&&a.jsx(ks,{top:128,panelRef:Gt,isLight:$e,children:Zr.map((He,tt)=>{const Je=ye===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),de(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),be==="gann"&&a.jsx(ks,{top:210,panelRef:mA,isLight:$e,children:Yr.map((He,tt)=>{const Je=it===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),rt(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),be==="shape"&&a.jsx(ks,{top:250,panelRef:XA,isLight:$e,children:qr.map((He,tt)=>{const Je=Ze===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),Oe(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),Fe&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{Be(!1),Ce(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:GA,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${$e?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${$e?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${$e?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),i!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${$e?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:St.map(He=>a.jsx(It,{item:He},He.key))})]})]})]})};function zT(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M337.509 305.372h-17.501l-6.571-5.486c20.791-25.232 33.922-57.054 33.922-93.257C347.358 127.632 283.896 64 205.135 64 127.452 64 64 127.632 64 206.629s63.452 142.628 142.225 142.628c35.011 0 67.831-13.167 92.991-34.008l6.561 5.487v17.551L415.18 448 448 415.086 337.509 305.372zm-131.284 0c-54.702 0-98.463-43.887-98.463-98.743 0-54.858 43.761-98.742 98.463-98.742 54.7 0 98.462 43.884 98.462 98.742 0 54.856-43.762 98.743-98.462 98.743z"},child:[]}]})(i)}const WT={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},RT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},GT={binance:"CRYPTO"},$T=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=zt(),o=s==="light",[l,c]=Y.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),g=Y.useMemo(()=>{const v={};for(const U of u){const F=(U.category||"other").toLowerCase();v[F]||(v[F]=[]),v[F].push(U)}const b=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(v).sort((U,F)=>{const S=b.indexOf(U),K=b.indexOf(F);return S!==-1&&K!==-1?S-K:S!==-1?-1:K!==-1?1:U.localeCompare(F)}).map(U=>({category:U,symbols:v[U]}))},[u]),B=v=>a.jsxs("tr",{onClick:()=>A(v.symbol),className:`cursor-pointer transition-colors ${t===v.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[a.jsxs("td",{className:`px-3 flex items-center justify-start gap-2 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:[v.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(kT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(OT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Z1,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:v.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${v.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[v.change>=0?"+":"",v.change,"%"]})]},v.symbol);return a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
|
|
23
23
|
.scrollbar-dark::-webkit-scrollbar {
|
|
24
24
|
width: 8px;
|
|
25
25
|
}
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
.scrollbar-light::-webkit-scrollbar-thumb:hover {
|
|
47
47
|
background: #94a3b8;
|
|
48
48
|
}
|
|
49
|
-
`}),a.jsxs("div",{style:{width:`${i}px`,minWidth:"220px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[a.jsx(IT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):u.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:m.map(({category:v,symbols:T})=>a.jsxs(q.Fragment,{children:[a.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:a.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?_T[v]||"text-slate-600":DT[v]||"text-slate-400"}`,children:PT[v]||v.toUpperCase()})}),T.map(y)]},v))})]})})]})]})},NT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:m}=Vt(),y=i||n,v=e||s,T=u||[],C=o==="light",U=l?"history":"trade";q.useEffect(()=>{l&&m&&m()},[l,m]);const F="#26A69A",E="#EF5350",N=C?"#f8fafc":"#12161D",R=C?"#e2e8f0":"#1e293b",M=C?"#f1f5f9":"#12161D",z=C?"#F0F5F9":"#2B3543",ne=C?"#f8fafc":"#131c2e",$=C?"#12161D":"#fff",V=C?"#64748b":"#fff",Ae=(v||[]).filter(de=>de.status==="OPEN"||!de.closeAt),re=y?.balance||0,he=y?.equity??re,Z=y?.margin||0,te=y?.freeMargin??he-Z,ae=Z>0?he/Z*100:0,ce=Ae.reduce((de,_e)=>de+(_e.livePnL??_e.profit??0),0),se=de=>{const _e=parseFloat(de);return Number.isFinite(_e)?_e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},le=de=>{const _e=parseFloat(de);return!_e||isNaN(_e)?"—":_e>=1e4?_e.toFixed(2):_e>=10?_e.toFixed(4):_e.toFixed(5)},pe=de=>{const _e=parseFloat(de);return isNaN(_e)?"—":(_e>=0?"+":"")+_e.toFixed(2)},Be=de=>{const _e=parseFloat(de);return isNaN(_e)?"—":_e.toFixed(2)},Fe=de=>{if(!de)return"—";const _e=new Date(de);return isNaN(_e.getTime())?String(de):`${_e.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${_e.toTimeString().slice(0,8)}`},Ue=q.useCallback((de,_e)=>{de.stopPropagation(),t&&t(_e.id,_e)},[t]),ye=q.useCallback((de,_e)=>{de.stopPropagation(),A&&A(_e)},[A]),Te={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:N,borderTop:`1px solid ${R}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:$},ve={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:z,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},be={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},Le={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Re={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ke={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:M},xe=de=>({padding:"5px 14px",fontSize:"11px",fontWeight:de?700:500,color:de?C?"#0ea5e9":"#38bdf8":V,borderBottom:de?`2px solid ${C?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),De={padding:"4px 8px",textAlign:"left",color:V,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",backgroundColor:M,position:"sticky",top:0,zIndex:1},Ce={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:$};return a.jsxs("div",{style:Te,children:[a.jsxs("div",{style:ve,children:[a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Balance:"}),a.jsxs("span",{style:{...Re,color:$},children:["$",se(re)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Equity:"}),a.jsxs("span",{style:{...Re,color:he>=re?F:E},children:["$",se(he)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Margin:"}),a.jsxs("span",{style:{...Re,color:$},children:["$",se(Z)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Free Margin:"}),a.jsxs("span",{style:{...Re,color:te>=0?$:E},children:["$",se(te)]})]}),a.jsxs("div",{style:{...be,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Le,children:"Margin Level:"}),a.jsx("span",{style:{...Re,color:ae>=100?F:E},children:Z>0?ae.toFixed(2)+"%":"—"})]}),Ae.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Le,children:"Float P/L:"}),a.jsxs("span",{style:{...Re,color:ce>=0?F:E,fontWeight:700},children:[ce>=0?"+":"",se(ce)]})]})]}),a.jsxs("div",{style:Ke,children:[a.jsx("button",{style:xe(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:xe(U==="history"),onClick:()=>c&&c(!0),children:"History"})]}),U==="trade"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:De,children:"Symbol"}),a.jsx("th",{style:De,children:"Ticket"}),a.jsx("th",{style:De,children:"Time"}),a.jsx("th",{style:De,children:"Type"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...De,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...De,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:Ae.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Ce,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):Ae.map(de=>{const _e=de.livePnL??de.profit??0,et=_e>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor=ne,onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Ce,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Ce,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Ce,color:V},children:Fe(de.openAt||de.time)}),a.jsx("td",{style:{...Ce,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:Be(de.volume)}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:le(de.price??de.openPrice)}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?le(de.stopLoss):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?le(de.takeProfit):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",color:V},children:de.currentPrice?le(de.currentPrice):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",fontWeight:700,color:et},children:pe(_e)}),a.jsx("td",{style:{...Ce,textAlign:"center"},children:a.jsx("button",{onClick:rt=>ye(rt,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:V,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:rt=>rt.currentTarget.style.color="#f59e0b",onMouseLeave:rt=>rt.currentTarget.style.color=V,children:"✎"})}),a.jsx("td",{style:{...Ce,textAlign:"right",fontWeight:700,color:et},children:a.jsx("button",{onClick:rt=>Ue(rt,de),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},de.id)})})]})}),U==="history"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:De,children:"Symbol"}),a.jsx("th",{style:De,children:"Ticket"}),a.jsx("th",{style:De,children:"Open Time"}),a.jsx("th",{style:De,children:"Type"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:De,children:"Close Time"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:T.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Ce,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):T.map(de=>{const _e=de.profit??0,et=_e>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor=ne,onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Ce,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Ce,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Ce,color:V},children:Fe(de.openAt)}),a.jsx("td",{style:{...Ce,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:Be(de.volume)}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:le(de.openPrice)}),a.jsx("td",{style:{...Ce,color:V},children:Fe(de.closeAt)}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:le(de.closePrice)}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?le(de.stopLoss):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?le(de.takeProfit):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",fontWeight:700,color:et},children:pe(_e)})]},de.id)})})]})})]})},OT="2.3.2";je.AccountPanel=NT,je.BuySellPanel=Oh,je.Chart=wT,je.ChartTypeSelector=bT,je.CoinSelector=lp,je.DrawingTools=dp,je.LeftSidebar=HT,je.MarketExecutionModal=Kh,je.MarketWatch=kT,je.PositionsPanel=FT,je.SYMBOL_CONFIG=rl,je.StopLoss=hp,je.TakeProfit=up,je.TimeframeSelector=TT,je.ToolCustomizationModal=Gh,je.TopBar=MT,je.TradePanel=QT,je.TradingProvider=Um,je.TradingToolbar=CT,je.VolumeControl=cp,je.alignToTimeframe=Oe,je.detectGaps=bp,je.getSymbolConfig=nr,je.is24x7Symbol=xp,je.isCryptoSymbol=tn,je.isForexSymbol=en,je.isWithinTradingSession=Qp,je.normalizeCandleTimes=sl,je.normalizeTime=j,je.processCandles=cl,je.processSingleCandle=hl,je.setSocketBaseUrl=Hh,je.timeframeToSeconds=uA,je.useTrading=Vt,je.validateTimeOrdering=Fp,je.version=OT,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"})}));
|
|
49
|
+
`}),a.jsxs("div",{style:{width:`${i}px`,minWidth:"220px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[a.jsx(zT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):u.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:g.map(({category:v,symbols:b})=>a.jsxs(Y.Fragment,{children:[a.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:a.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?RT[v]||"text-slate-600":WT[v]||"text-slate-400"}`,children:GT[v]||v.toUpperCase()})}),b.map(B)]},v))})]})})]})]})},XT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:g}=zt(),B=i||n,v=e||s,b=u||[],C=o==="light",U=l?"history":"trade";Y.useEffect(()=>{l&&g&&g()},[l,g]);const F="#26A69A",S="#EF5350",K=C?"#f8fafc":"#12161D",G=C?"#e2e8f0":"#1e293b",M=C?"#f1f5f9":"#12161D",W=C?"#F0F5F9":"#2B3543",ne=C?"#f8fafc":"#131c2e",J=C?"#12161D":"#fff",V=C?"#64748b":"#fff",ie=(v||[]).filter(de=>de.status==="OPEN"||!de.closeAt),re=B?.balance||0,ce=B?.equity??re,Z=B?.margin||0,Ae=B?.freeMargin??ce-Z,oe=Z>0?ce/Z*100:0,le=ie.reduce((de,Pe)=>de+(Pe.livePnL??Pe.profit??0),0),se=de=>{const Pe=parseFloat(de);return Number.isFinite(Pe)?Pe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},ae=de=>{const Pe=parseFloat(de);return!Pe||isNaN(Pe)?"—":Pe>=1e4?Pe.toFixed(2):Pe>=10?Pe.toFixed(4):Pe.toFixed(5)},pe=de=>{const Pe=parseFloat(de);return isNaN(Pe)?"—":(Pe>=0?"+":"")+Pe.toFixed(2)},we=de=>{const Pe=parseFloat(de);return isNaN(Pe)?"—":Pe.toFixed(2)},Qe=de=>{if(!de)return"—";const Pe=new Date(de);return isNaN(Pe.getTime())?String(de):`${Pe.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${Pe.toTimeString().slice(0,8)}`},Fe=Y.useCallback((de,Pe)=>{de.stopPropagation(),t&&t(Pe.id,Pe)},[t]),Be=Y.useCallback((de,Pe)=>{de.stopPropagation(),A&&A(Pe)},[A]),ve={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:K,borderTop:`1px solid ${G}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:J},Ce={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:W,borderBottom:`1px solid ${G}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},be={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${G}`,whiteSpace:"nowrap"},Le={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Ge={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ke={display:"flex",borderBottom:`1px solid ${G}`,flexShrink:0,backgroundColor:M},Te=de=>({padding:"5px 14px",fontSize:"11px",fontWeight:de?700:500,color:de?C?"#0ea5e9":"#38bdf8":V,borderBottom:de?`2px solid ${C?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),_e={padding:"4px 8px",textAlign:"left",color:V,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",backgroundColor:M,position:"sticky",top:0,zIndex:1},ye={padding:"3px 8px",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:J};return a.jsxs("div",{style:ve,children:[a.jsxs("div",{style:Ce,children:[a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Balance:"}),a.jsxs("span",{style:{...Ge,color:J},children:["$",se(re)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Equity:"}),a.jsxs("span",{style:{...Ge,color:ce>=re?F:S},children:["$",se(ce)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Margin:"}),a.jsxs("span",{style:{...Ge,color:J},children:["$",se(Z)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Free Margin:"}),a.jsxs("span",{style:{...Ge,color:Ae>=0?J:S},children:["$",se(Ae)]})]}),a.jsxs("div",{style:{...be,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Le,children:"Margin Level:"}),a.jsx("span",{style:{...Ge,color:oe>=100?F:S},children:Z>0?oe.toFixed(2)+"%":"—"})]}),ie.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Le,children:"Float P/L:"}),a.jsxs("span",{style:{...Ge,color:le>=0?F:S,fontWeight:700},children:[le>=0?"+":"",se(le)]})]})]}),a.jsxs("div",{style:Ke,children:[a.jsx("button",{style:Te(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:Te(U==="history"),onClick:()=>c&&c(!0),children:"History"})]}),U==="trade"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:_e,children:"Symbol"}),a.jsx("th",{style:_e,children:"Ticket"}),a.jsx("th",{style:_e,children:"Time"}),a.jsx("th",{style:_e,children:"Type"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:ie.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...ye,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):ie.map(de=>{const Pe=de.livePnL??de.profit??0,et=Pe>=0?F:S;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=ne,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:J,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...ye,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:V},children:Qe(de.openAt||de.time)}),a.jsx("td",{style:{...ye,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:S},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(de.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(de.price??de.openPrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.stopLoss?S:V},children:de.stopLoss?ae(de.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?ae(de.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:V},children:de.currentPrice?ae(de.currentPrice):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:et},children:pe(Pe)}),a.jsx("td",{style:{...ye,textAlign:"center"},children:a.jsx("button",{onClick:it=>Be(it,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:V,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:it=>it.currentTarget.style.color="#f59e0b",onMouseLeave:it=>it.currentTarget.style.color=V,children:"✎"})}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:et},children:a.jsx("button",{onClick:it=>Fe(it,de),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:it=>it.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:it=>it.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},de.id)})})]})}),U==="history"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:_e,children:"Symbol"}),a.jsx("th",{style:_e,children:"Ticket"}),a.jsx("th",{style:_e,children:"Open Time"}),a.jsx("th",{style:_e,children:"Type"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:_e,children:"Close Time"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:b.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...ye,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):b.map(de=>{const Pe=de.profit??0,et=Pe>=0?F:S;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=ne,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:J,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...ye,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:V},children:Qe(de.openAt)}),a.jsx("td",{style:{...ye,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:S},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(de.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(de.openPrice)}),a.jsx("td",{style:{...ye,color:V},children:Qe(de.closeAt)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(de.closePrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.stopLoss?S:V},children:de.stopLoss?ae(de.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?ae(de.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:et},children:pe(Pe)})]},de.id)})})]})})]})},JT="2.3.2";Ye.AccountPanel=XT,Ye.BuySellPanel=Gh,Ye.Chart=FT,Ye.ChartTypeSelector=IT,Ye.CoinSelector=wp,Ye.DrawingTools=vp,Ye.LeftSidebar=VT,Ye.MarketExecutionModal=$h,Ye.MarketWatch=$T,Ye.PositionsPanel=_T,Ye.SYMBOL_CONFIG=ll,Ye.StopLoss=yp,Ye.TakeProfit=Cp,Ye.TimeframeSelector=MT,Ye.ToolCustomizationModal=qh,Ye.TopBar=KT,Ye.TradePanel=DT,Ye.TradingProvider=P1,Ye.TradingToolbar=ET,Ye.VolumeControl=Bp,Ye.alignToTimeframe=ke,Ye.calcBollingerBands=gl,Ye.calcLiveBollingerBands=Rs,Ye.detectGaps=Ip,Ye.getSymbolConfig=nr,Ye.is24x7Symbol=Hp,Ye.isCryptoSymbol=tn,Ye.isForexSymbol=en,Ye.isWithinTradingSession=Dp,Ye.normalizeCandleTimes=hl,Ye.normalizeTime=ee,Ye.processCandles=fl,Ye.processSingleCandle=ml,Ye.setSocketBaseUrl=Oh,Ye.timeframeToSeconds=uA,Ye.useTrading=zt,Ye.validateTimeOrdering=_p,Ye.version=JT,Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"})}));
|