@nabeeltahirdeveloper/chart-sdk 2.3.23-beta → 2.3.25-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.
@@ -1,25 +1,25 @@
1
- (function(et,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):(et=typeof globalThis<"u"?globalThis:et||self,a(et.ChartSDK={},et.jsxRuntime,et.React))})(this,(function(et,a,Y){"use strict";var Ws=typeof document<"u"?document.currentScript:null;const Gt="17:00-17:00",$t="America/New_York",MA="24x7",HA="UTC",ll={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:MA,sessionTZ:HA,priceMode:"last"},ETHUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},BNBUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},SOLUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},ADAUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},XRPUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},DOTUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},MATICUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"},LINKUSDT:{type:"crypto",session:MA,sessionTZ:HA,priceMode:"last"}},cl={type:"forex",sessionTZ:$t,session:Gt,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 te(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 _p(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:te(e.time)})).filter(e=>e.time!=null):[]}function Dp(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 We(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!(te(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=te(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){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 B=l+e,v=0;for(B=We(B,e);B<c&&v<r;){const b=We(B,e);t.some(U=>U.time===b)||(t.push({time:b,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),v++),B+=e}if(B<c&&v>=r){const b=We(c-e,e);t.some(U=>U.time===b)||t.push({time:b,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 dA(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=dA(t),o=hl(i).map(L=>({...L,time:We(L.time,r)})).filter(L=>ul(L)).map(L=>dl(L)),l=pl(o);l.sort((L,K)=>L.time-K.time);const c=Math.floor(Date.now()/1e3),u=l.filter(L=>L.time<=c),B=u.filter((L,K)=>K===0?!0:L.time>u[K-1].time),v=pl(B);v.sort((L,K)=>L.time-K.time);const b=Pp(v,r),C=[];for(let L=1;L<b.length;L++){const K=b[L].time-b[L-1].time;K>r*2&&C.push({from:b[L-1].time,to:b[L].time,gapSeconds:K,gapMinutes:Math.round(K/60),fromDate:new Date(b[L-1].time*1e3).toISOString(),toDate:new Date(b[L].time*1e3).toISOString()})}const U=B.filter((L,K)=>K===0?!1:L.close===B[K-1].close&&L.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 gl(i,e,t="1m"){if(!i||!e||!ul(i))return null;const A=te(i.time);if(A==null)return null;const r=dA(t),n=We(A,r);return dl({...i,time:n})}function ml(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),m=i[s].time;r.push({time:m,value:l}),A.push({time:m,value:l+t*u}),n.push({time:m,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 Tt(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 Np=(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 Np(i)}var Op=(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=Tt({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 Tt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=Tt(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=Tt(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}Vp().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?zp(n[0],r):Tt({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=Tt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function Kp(i,e){return new Op(i,e.transform,e.options)}function wl(i){return i.ownerDocument.defaultView}function Vp(){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 zp(i,e){return Tt({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 Wp=(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 Wp(r,t,A)}const Rp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Gp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},$p={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Xp={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},Jp={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},Zp={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 eA(i){if(i===void 0)throw new Error("Value is undefined");return i}function Ue(i){if(i===null)throw new Error("Value is null");return i}function Di(i){return Ue(eA(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 mA(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 Yp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,qp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,jp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,ef=/^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=ef.exec(i)||jp.exec(i);if(e)return[mA(parseInt(e[1],10)),mA(parseInt(e[2],10)),mA(parseInt(e[3],10)),xl(e.length<5?1:parseFloat(e[4]))]}{const e=qp.exec(i);if(e)return[mA(parseInt(e[1],16)),mA(parseInt(e[2],16)),mA(parseInt(e[3],16)),1]}{const e=Yp.exec(i);if(e)return[mA(17*parseInt(e[1],16)),mA(17*parseInt(e[2],16)),mA(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 Et{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 xA(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]:xA(i[A],t[A]));return i}function IA(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 tf(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 Af{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 QA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class rf extends QA{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,B=u.st*A,v=l*A+s;e.moveTo(m,B),e.arc(m,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 nf(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const sf={from:0,to:1};class of{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(nf),this.ct=this.dt.map((A=>{const r=new rf;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=Ue(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=sf}))}}let af=class extends QA{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,m,B){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,m),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 lf{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 af(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=Ue(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 cf(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((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 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),m=u.Jt;return u.Qt?Ul(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):Ul(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,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,L=t.P,K=A.Mi(s,F),G=Math.ceil(A.xi(s,F)),E=L+v+b,z=t.C+C+U+G+m,ne=Math.max(1,Math.floor(u));let X=Math.round(E*u);X%2!=ne%2&&(X+=1);const R=B>0?Math.max(1,Math.floor(B*c)):0,re=Math.round(z*c),se=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),ee=Math.floor(Z+ne/2-X/2),ie=ee+X,ae=r==="right",oe=ae?l.width-B:B,le=ae?o.width-R:R;let de,we,be;return ae?(de=le-re,we=le-se,be=oe-m-C-B):(de=le+re,we=le+se,be=oe+m+C),{Qt:ae,Jt:{ii:ee,li:Z,ci:ie,ni:re,si:X,ht:2*c,ei:R,ti:de,ri:le,ai:we,oi:ne,ui:o.width},di:{ii:ee/u,ci:ie/u,fi:be,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 hf 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 uf=/[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,Ue(this.zt).Kt,uf)))));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:B,horizontalPixelRatio:v,verticalPixelRatio:b})=>{const C=Ue(this.zt);B.fillStyle=C.t;const U=Math.round(c*v),F=Math.round(0*b),L=Math.round(u*v),K=Math.round(m*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(L-G,K),B.arcTo(L,K,L,K-G,G),B.lineTo(L,F),B.fill(),C.hi){const E=Math.round(C.ki*v),z=F,ne=Math.round((z+t.T)*b);B.fillStyle=C.V;const X=Math.max(1,Math.floor(v)),R=Math.floor(.5*v);B.fillRect(E-R,z,X,ne-z)}})),e.useMediaCoordinateSpace((({context:B})=>{const v=Ue(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 df{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(Ue(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 pf 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 of(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Ue(this.tn).vn())return{_t:l,ki:o};{const c=Ue(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 df(this,e,A),this.wn=new lf(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(tf),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 hf(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 Hl=".";function YA(i,e){if(!IA(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),IA(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 ff{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 _l(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),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,m,b,C)}else{const v=(C,U)=>{s(i,m,B,U),o.beginPath(),m=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!==m&&(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,L]=gf(e,C-1,C);o.bezierCurveTo(F.nt*l,F.st*c,L.nt*l,L.st*c,b.nt*l,b.st*c);break}}t!==1&&U!==m&&(v(U,b),o.moveTo(b.nt*l,b.st*c))}(B!==b||B===b&&t===1)&&s(i,m,B,b)}}const Dl=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]),Dl),{nt:n.nt+s.nt,st:n.st+s.st}),Js(i[t],Pl(Js(i[r],i[e]),Dl))]}function mf(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 QA{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,_l(e,A,l,r,n,this.bs.bind(this),mf.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 kl(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 m=Zs(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 wf 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 Bf(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class Ol extends QA{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&&_l(e,t,n,A,r,u,Bf),l&&(function(m,B,v,b,C){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:L}=m;let K=null;const G=Math.max(1,Math.floor(U))%2/2,E=v*F+G;for(let z=b.to-1;z>=b.from;--z){const ne=B[z];if(ne){const X=C(m,ne);X!==K&&(L.beginPath(),K!==null&&L.fill(),L.fillStyle=X,K=X);const R=Math.round(ne.nt*U)+G,re=ne.st*F;L.moveTo(R,re),L.arc(R,re,E,0,2*Math.PI)}}L.fill()})(e,t,l,A,u)}}class Kl extends Ol{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 yf(i,e){return i.ot<e}function Cf(i,e){return e<i.ot}function Wl(i,e,t){const A=e.Os(),r=e.ui(),n=cr(i,A,yf),s=zl(i,r,Cf);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 vf extends cn{constructor(e,t){super(e,t),this.js=new $s,this.re=new wf,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 Tf extends QA{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,B=u+m-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,m,F);const L=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-L;let ne=Math.max(C,Math.round(o.pe*A)-l),X=ne+m-1;X>C+F-1&&(X=C+F-1,ne=X-m+1),e.fillRect(z,ne,u-z,X-ne+1)}const K=c+L;let G=Math.max(C,Math.round(o.me*A)-l),E=G+m-1;E>C+F-1&&(E=C+F-1,G=E-m+1),e.fillRect(B+1,G,K-B,E-G+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Ue(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 bf extends Rl{constructor(){super(...arguments),this.js=new Tf}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 xf 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 Qf extends Ol{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 Ff extends cn{constructor(e,t){super(e,t),this.js=new $s,this.Ve=new xf,this.Oe=new Qf,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 Uf extends QA{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 B=t[m];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 L=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,L));const K=L-F+1;r.fillRect(F,C,K,v-C),r.fillRect(F,b+1,K,U-b),u=L}}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 B=Math.round(m.nt*n)-Math.floor(.5*this.ae);const v=B+this.ae-1,b=Math.round(Math.min(m.pe,m.me)*s),C=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(B=Math.max(c+1,B),B=Math.min(B,v)),this.zt.le*n>2*l)cf(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 m=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,m+=l,b-=l,B-=l),m>B||r.fillRect(v,m,b-v+1,B-m+1)}}}class Sf extends Rl{constructor(){super(...arguments),this.js=new Uf}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 Ef{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 Ef(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(Lf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Lf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class Mf extends QA{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,B;e.fillStyle=l.ce,u<=n?(m=u,B=s):(m=n,B=u-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,B-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 Hf extends cn{constructor(){super(...arguments),this.js=new Mf}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,Ue(this.Es.Ct()).Vt)};this.js.J(e)}}class If 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 eA(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 Df{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 Df(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 Pf extends QA{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 Pf,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 Nf 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 QA{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 Of=[{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 Of)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 Kf{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 kl(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=(kl(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 Vf(i,e,t,A,r,n){return ql(e,t,A,r,n)}class zf extends QA{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(Rf(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),Wf(o,e,t,A)}}}}function Wf(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),m=(u-1)*l.Jr/2,B=l.nt-m,v=l.st-m;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 Rf(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 Vf(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,B=s-c,v=o-u;return Math.sqrt(B*B+v*v)<=m})(A.nt,A.st,A.Ks,r,n);case"square":return ql(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function Gf(i,e,t,A,r,n,s,o,l){const c=IA(t)?t:t.Se,u=IA(t)?t:t.Me,m=IA(t)?t:t.xe,B=IA(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(m,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 $f{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new zf,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 m=A[u];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const B=this.zt.it[u];B.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(B.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(m.time);v!==null&&Gf(B,m,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Xf 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 Jf 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 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 sA{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 sA(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 sA(ec(Math.min,this.Ph(),e.Ph(),-1/0),ec(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!IA(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){IA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new sA(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(sA.Ah(e.priceRange),e.margins)}}class Zf 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 Yf 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 qf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Zf(e,this),this.ur=new Yf(e,this),this.Hh=new Gl(this.ur,e,e.$t())}$h(e){xA(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 jf extends Xs{constructor(e){super(),this.$i=e}$t(){return this.$i}}const e0={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Ue(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,B=e.wickDownColor,v=Ue(i(t,A)),b=Di(v.Vt[0])<=Di(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?m:B}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Ue(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Ue(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=Ue(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=Ue(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=Ue(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class t0{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=e0[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 A0{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=Ue(this.el()),s=Ue(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 m=this.il.get(A);m===void 0&&(m=new Map,this.il.set(A,m));for(let B=Math.max(c+1,o);B<u;B+=ni){const v=Math.floor(B/ni);let b=m.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),m.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 i0{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 i0(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 r0{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 n0 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 s0{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 r0(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 n0(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 o0(i){return i.Bl()}function a0(i){return i.Al()}class ro extends jf{constructor(e,t,A,r,n){super(e),this.zt=new A0,this.jh=new Xf(this),this.zl=[],this.Ll=new Nf(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 Jf(this);this.rn=[s],this.Hh=new Gl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new Kf(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 t0(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),xA(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 qf(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(o0,e)}fa(e){return this.ca(a0,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 Ue(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 s0(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 sA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new sA(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 sA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,m,B;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((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 ff(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=Ue(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Ue(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Ue(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 $f(this,this.$t()),this.$l){case"Bar":this.wn=new bf(this,this.$t());break;case"Candlestick":this.wn=new Sf(this,this.$t());break;case"Line":this.wn=new If(this,this.$t());break;case"Custom":this.wn=new js(this,this.$t(),eA(e));break;case"Area":this.wn=new vf(this,this.$t());break;case"Baseline":this.wn=new Ff(this,this.$t());break;case"Histogram":this.wn=new Hf(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 l0{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,m)=>{if(A.vr(m)||!m.yt())return u;const B=m.Dt(),v=m.In();if(B.Ni()||!v.Kr(t))return u;const b=v.Gh(t);if(b===null)return u;const C=Di(m.Ct());return u.concat([B.Rt(b.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 c0 extends QA{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=Ue(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 h0{constructor(e){this.Wt=new c0,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 u0{constructor(e){this.wn=new h0(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 d0(i,e){const t=Ni(i.Ph(),e),A=Ni(i.Rh(),e);return new sA(t,A)}function pr(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function p0(i,e){const t=pr(i.Ph(),e),A=pr(i.Rh(),e);return new sA(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 sA(t,A)}function pn(i,e){if(i===null)return null;const t=fr(i.Ph(),e),A=fr(i.Rh(),e);return new sA(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 m=ln(n,r,1e-14)&&n>r+1e-14,B=ln(n,A*o,1e-14),v=ln(n,1,1e-14);if(!(m&&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 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),B=c%m;B+=B<0?m:0;const v=c>=u?1:-1;let b=null,C=0;for(let U=c-B;U>u;U-=m){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()&&(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 rc(i){return i.slice().sort(((e,t)=>Ue(e.Xi())-Ue(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 f0{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 Et,this.vo=new Et,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(xA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=eA(e.scaleMargins.top),A=eA(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=Ni(e,t):this.Oo()&&(e=pr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Ue(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,B=A===void 0?e.length:A.to,v=this.Ho();for(let b=m;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 L=r+u*(F-s),K=c?L:this.ho-1-L;C.st=K}}be(e,t,A){this.Wo();const r=this.Fo(),n=Ue(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,B=A===void 0?e.length:A.to,v=this.Ho();for(let b=m;b<B;b++){const C=e[b];let U=C.ge,F=C.Me,L=C.xe,K=C.Se;v!==null&&(U=v(C.ge,t),F=v(C.Me,t),L=v(C.xe,t),K=v(C.Se,t));let G=r+u*(U-s),E=c?G:this.ho-1-G;C.pe=E,G=r+u*(F-s),E=c?G:this.ho-1-G,C.de=E,G=r+u*(L-s),E=c?G:this.ho-1-G,C.fe=E,G=r+u*(K-s),E=c?G:this.ho-1-G,C.me=E}}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=Ue(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=Ue(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=Ue(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Ue(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Ue(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,Ue(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=Ue(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=Ue(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=d0(m,c.Vt);break;case 3:m=p0(m,c.Vt)}if(t=t===null?m:t.ts(Ue(m)),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 sA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=gr(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=gr(l,c),u!==null&&(this.ao=gr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new sA(-.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 Et,this.yl=e,this.$i=t,this.d_=new u0(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=Ue(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)?eA(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=Ue(e.Dt()).Pa();if(this.o_.has(A)){const n=eA(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 f0(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class m0{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(eA(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){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 w0{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=eA(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let m=0;m<l;m++){const B=o[m],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 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 B0(i,e){return i.weight>e.weight?i:e}class y0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new w0,this.du=new Map,this.fu=ki.ou(),this.vu=!0,this.pu=new Et,this.mu=new Et,this.bu=new Et,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){xA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;xA(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=Ue(this.Bu()),n=Ue(this.Au());return{from:Ue(this.Ui(Math.max(r,t))),to:Ue(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Ue(this.Va(e.from,!0)),to:Ue(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=Ue(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,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=m&&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.__-Ue(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=Ue(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 m0((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 C0{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 v0 extends C0{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 T0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new v0(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 b0 extends Xs{constructor(e,t){super(),this.cn=t,this.wn=new T0(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 x0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Et,this.Rc=new Et,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Af(this),this.yl=new y0(this,t.timeScale,this.cn.localization,A),this.vt=new pf(this,t.crosshair),this.Bc=new l0(t.crosshair),this.Ac=new b0(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){xA(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=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,Ue(n)),o=this.yl.Va(t,!0),l=this.yl.It(Ue(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,B=l&&(A!==void 0||m)&&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),Ue(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Ue(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),[B,v,b,C]=sr(s),U=[mA(l+o*(B-l)),mA(c+o*(v-c)),mA(u+o*(b-u)),xl(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 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!IA(i)&&!ar(i)}function pc(i){return IA(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 Q0(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 gc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return Q0(e,this.gd,this.Md)}}class F0{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 U0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class S0{constructor(e={}){const t=Object.assign(Object.assign({},U0),e);this.Td=new gc(t.Sd,t.Cd),this.Pd=new F0(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 gn=[{Dd:(mc=1,1e3*mc),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 mc;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=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 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 Ue((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 S0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new gc(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(B0,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 xA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const Oi=typeof window<"u";function vc(){return!!Oi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function uo(){return!!Oi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function po(i){return i+i%2}function fo(i,e){return i.zd-e.zd}function go(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class E0{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=go(this.Ld,this.Ed,this.Ud),n=fo(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=go(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 m=go(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const B=fo(this.Nd,this.Fd);s.push(m),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 m=Math.log(u);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Ue(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-Ue(this.Wd).ot;return Math.min(t,this.jd)}}class L0{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=Ue(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=Kp(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 mo(i,e,t,A){i.gl&&i.gl(e,t,A)}function mn(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 M0(i){Oi&&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,Ue(this.Of));if(t===null||(this.Vf=wn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(_A(t),Ue(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),Ue(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,Ue(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}),M0(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,Ue(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 H0(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],m=u.At(A,!1),B=c.Vi(),v=u.Vi();if(e===1?B>v-m:B<v+m){const b=v-m*e;c.Oi(b);const C=b-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 L=r;L<i.length;L++)i[L].Oi(i[L].Vi()+e*F);o-=F}}else r=l,o=e===1?v-m-B:B-(v+m)}}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,Tt({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,Tt({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=Ue(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 Ue(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,Ue(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),m=Math.round(r.T*o);s.beginPath();for(const B of t)s.rect(Math.floor(n*o),Math.round(B.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)}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(Ue(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(Ue(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 I0(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 D0(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=Tt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Et,this.Op=new Et,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,Tt({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,Tt({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 Ue(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 L0(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(Ue(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Ue(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=Ue(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 B,v;let b,C;for(const L of c){const K=(v=(B=L.va)===null||B===void 0?void 0:B.call(L,u,m))!==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=L)}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=H0(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){Ue(t==="left"?this.Cp:this.Tp).cp(Tt({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=Ue(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,I0),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,D0))}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=Ue(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,yn,mo,t),this.Mm(e,yn,mn,t)}bm(e){this.Mm(e,yn,mn,this.$i().Zc())}fm(e,t){const A=Ue(this.Np).Uo();for(const r of A)this.Mm(e,t,mo,r);for(const r of A)this.Mm(e,t,mn,r)}Mm(e,t,A,r){const n=Ue(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,Ue(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)Ue(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 E0(.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=Tt({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,Tt({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 P0=To("normal"),N0=To("top"),k0=To("bottom");class O0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=Tt({width:0,height:0}),this.Om=new Et,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,Tt({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,Tt({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(Tt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(Tt({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,P0)),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,N0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)wo(t,(n=>mo(n,e,!1,void 0)),r,void 0);for(const r of A)wo(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 B=Math.round(n.T*c);for(let v=A.length;v--;){const b=Math.round(A[v].coord*l);o.rect(b-m,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 K0=!!Oi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!Oi&&(!((bo=navigator?.userAgentData)===null||bo===void 0)&&bo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var bo;class V0{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 Et,this.Op=new Et,this.Rc=new Et,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 x0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new O0(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=[],Ue(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 Tt({width:l-l%2,height:c-c%2})})(Tt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Ue(this.Xd).style.height=n,Ue(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=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=Ue(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Ue(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 eA(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],B=Ue(o==="left"?m.wm():m.gm()),v=B.xp();e!==null&&B.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Ue(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+=Ue(r.gm()).xp().width);const s=(o,l,c)=>{Ue(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Ue(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=Ue(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return Tt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const b of this.Xm)this.xb()&&(t=Math.max(t,Ue(b.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Ue(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,m=n<u?0:n-u,B=m/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?m-v:Math.round(C.M_()*B),U=Math.max(F,2),v+=U,C.cp(Tt({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(Tt({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 K0?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=eA(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 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 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 z0(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 W0(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 R0(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 G0(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 $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),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function X0(i,e,t,A,r){const n=eA(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: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($0),Bar:Ti(G0),Area:Ti(W0),Baseline:Ti(R0),Histogram:Ti(Uc),Line:Ti(Uc),Custom:Ti(X0)}[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)})),eA(e)}class J0{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()),m=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 L=u(C,F.ee,v,l[b],m,B);return F.Hb.set(e,L),L}))}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 m=Mc(l,u),B=Mc(c,u);if(m!==void 0&&B!==void 0)return{ta:m.Ub>=B.Ub&&m.$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(),m=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,m),this.nw(e,m);const B={ta:Cn(m)};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 Z0(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 Y0(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 _c(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 q0(i){const e=_c(i);return i.V!==void 0&&(e.color=i.V),e}function j0(i){const e=_c(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:Z0,Line:Ic,Baseline:Y0,Histogram:Ic,Bar:q0,Candlestick:j0,Custom:eg}[i]}function eg(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const tg={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},Ag={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},ig={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},rg={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},ng={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Gs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Dc(){return{width:0,height:0,autoSize:!1,layout:ig,crosshair:tg,grid:Ag,overlayPriceScales:Object.assign({},So),leftPriceScale:Object.assign(Object.assign({},So),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},So),{visible:!0}),timeScale:rg,watermark:ng,localization:{locale:Oi?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 sg{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 Ue(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 og={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class ag{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class lg{constructor(e,t,A,r,n){this.uw=new Et,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=Ue(A.el()),o=Ue(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=xA(ZA(og),e),A=this.Es.ea(t);return new ag(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 cg{constructor(e,t,A){this.ww=new Et,this.mu=new Et,this.Om=new Et,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 hg(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 ug{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Et,this.Cw=new Et,this.Tw=new Et,this.Pw=new J0(t);const r=A===void 0?ZA(Dc()):xA(ZA(Dc()),Nc(A));this.q_=t,this.aw=new V0(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 cg(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({},Bl),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Xp,e)}addBaselineSeries(e){return this.Vw("Baseline",Jp,e)}addBarSeries(e){return this.Vw("Bar",Gp,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",Rp,e)}addHistogramSeries(e){return this.Vw("Histogram",Zp,e)}addLineSeries(e){return this.Vw("Line",$p,e)}removeSeries(e){const t=eA(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 sg(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){hg(A.priceFormat);const n=xA(ZA(yl),ZA(t),A),s=this.aw.$t().dd(e,n,r),o=new lg(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 eA(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(z0(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 dg(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 ug(A,e,t);return e.setOptions(r.options()),r}function pg(i,e){return dg(i,new Cc,Cc.Id(e))}Object.assign(Object.assign({},yl),Bl);function kc(i,e){return function(){return i.apply(e,arguments)}}const{toString:fg}=Object.prototype,{getPrototypeOf:Eo}=Object,{iterator:vn,toStringTag:Oc}=Symbol,Tn=(i=>e=>{const t=fg.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),FA=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)&&oA(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Kc=FA("ArrayBuffer");function gg(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Kc(i.buffer),e}const mg=bn("string"),oA=bn("function"),Vc=bn("number"),Br=i=>i!==null&&typeof i=="object",wg=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)&&!(Oc in i)&&!(vn in i)},Bg=i=>{if(!Br(i)||wr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},yg=FA("Date"),Cg=FA("File"),vg=FA("Blob"),Tg=FA("FileList"),bg=i=>Br(i)&&oA(i.pipe),xg=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||oA(i.append)&&((e=Tn(i))==="formdata"||e==="object"&&oA(i.toString)&&i.toString()==="[object FormData]"))},Qg=FA("URLSearchParams"),[Fg,Ug,Sg,Eg]=["ReadableStream","Request","Response","Headers"].map(FA),Lg=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 Mg=(i,e,t,{allOwnKeys:A}={})=>(yr(e,(r,n)=>{t&&oA(r)?Object.defineProperty(i,n,{value:kc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),Hg=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Ig=(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)},_g=(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},Dg=(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},Pg=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},Ng=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Eo(Uint8Array)),kg=(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])}},Og=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},Kg=FA("HTMLFormElement"),Vg=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),zg=FA("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)},Wg=i=>{Gc(i,(e,t)=>{if(oA(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(oA(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+"'")})}})},Rg=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Vi(i)?A(i):A(String(i).split(e)),t},Gg=()=>{},$g=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function Xg(i){return!!(i&&oA(i.append)&&i[Oc]==="FormData"&&i[vn])}const Jg=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)},Zg=FA("AsyncFunction"),Yg=i=>i&&(Br(i)||oA(i))&&oA(i.then)&&oA(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",oA(bi.postMessage)),qg=typeof queueMicrotask<"u"?queueMicrotask.bind(bi):typeof process<"u"&&process.nextTick||$c,pe={isArray:Vi,isArrayBuffer:Kc,isBuffer:wr,isFormData:xg,isArrayBufferView:gg,isString:mg,isNumber:Vc,isBoolean:wg,isObject:Br,isPlainObject:xn,isEmptyObject:Bg,isReadableStream:Fg,isRequest:Ug,isResponse:Sg,isHeaders:Eg,isUndefined:zi,isDate:yg,isFile:Cg,isBlob:vg,isRegExp:zg,isFunction:oA,isStream:bg,isURLSearchParams:Qg,isTypedArray:Ng,isFileList:Tg,forEach:yr,merge:Lo,extend:Mg,trim:Lg,stripBOM:Hg,inherits:Ig,toFlatObject:_g,kindOf:Tn,kindOfTest:FA,endsWith:Dg,toArray:Pg,forEachEntry:kg,matchAll:Og,isHTMLForm:Kg,hasOwnProperty:Rc,hasOwnProp:Rc,reduceDescriptors:Gc,freezeMethods:Wg,toObjectSet:Rg,toCamelCase:Vg,noop:Gg,toFiniteNumber:$g,findKey:zc,global:bi,isContextDefined:Wc,isSpecCompliantForm:Xg,toJSONObject:Jg,isAsyncFn:Zg,isThenable:Yg,setImmediate:$c,asap:qg,isIterable:i=>i!=null&&oA(i[vn])};let Ye=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:pe.toJSONObject(this.config),code:this.code,status:this.status}}};Ye.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ye.ERR_BAD_OPTION="ERR_BAD_OPTION",Ye.ECONNABORTED="ECONNABORTED",Ye.ETIMEDOUT="ETIMEDOUT",Ye.ERR_NETWORK="ERR_NETWORK",Ye.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ye.ERR_DEPRECATED="ERR_DEPRECATED",Ye.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ye.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ye.ERR_CANCELED="ERR_CANCELED",Ye.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ye.ERR_INVALID_URL="ERR_INVALID_URL";const jg=null;function Mo(i){return pe.isPlainObject(i)||pe.isArray(i)}function Xc(i){return pe.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 em(i){return pe.isArray(i)&&!i.some(Mo)}const tm=pe.toFlatObject(pe,{},null,function(e){return/^is[A-Z]/.test(e)});function Qn(i,e,t){if(!pe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=pe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!pe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&pe.isSpecCompliantForm(e);if(!pe.isFunction(r))throw new TypeError("visitor must be a function");function c(b){if(b===null)return"";if(pe.isDate(b))return b.toISOString();if(pe.isBoolean(b))return b.toString();if(!l&&pe.isBlob(b))throw new Ye("Blob is not supported. Use a Buffer instead.");return pe.isArrayBuffer(b)||pe.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(pe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),b=JSON.stringify(b);else if(pe.isArray(b)&&em(b)||(pe.isFileList(b)||pe.endsWith(C,"[]"))&&(F=pe.toArray(b)))return C=Xc(C),F.forEach(function(K,G){!(pe.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 m=[],B=Object.assign(tm,{defaultVisitor:u,convertValue:c,isVisitable:Mo});function v(b,C){if(!pe.isUndefined(b)){if(m.indexOf(b)!==-1)throw Error("Circular reference detected in "+C.join("."));m.push(b),pe.forEach(b,function(F,L){(!(pe.isUndefined(F)||F===null)&&r.call(e,F,pe.isString(L)?L.trim():L,C,B))===!0&&v(F,C?C.concat(L):[L])}),m.pop()}}if(!pe.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 Am(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||Am,r=pe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=pe.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){pe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const Io={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},im={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"]},_o=typeof window<"u"&&typeof document<"u",Do=typeof navigator=="object"&&navigator||void 0,rm=_o&&(!Do||["ReactNative","NativeScript","NS"].indexOf(Do.product)<0),nm=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",sm=_o&&window.location.href||"http://localhost",Xt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:_o,hasStandardBrowserEnv:rm,hasStandardBrowserWebWorkerEnv:nm,navigator:Do,origin:sm},Symbol.toStringTag,{value:"Module"})),...im};function om(i,e){return Qn(i,new Xt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Xt.isNode&&pe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function am(i){return pe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function lm(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&&pe.isArray(r)?r.length:s,l?(pe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!pe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&pe.isArray(r[s])&&(r[s]=lm(r[s])),!o)}if(pe.isFormData(i)&&pe.isFunction(i.entries)){const t={};return pe.forEachEntry(i,(A,r)=>{e(am(A),r,t,0)}),t}return null}function cm(i,e,t){if(pe.isString(i))try{return(e||JSON.parse)(i),pe.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=pe.isObject(e);if(n&&pe.isHTMLForm(e)&&(e=new FormData(e)),pe.isFormData(e))return r?JSON.stringify(eh(e)):e;if(pe.isArrayBuffer(e)||pe.isBuffer(e)||pe.isStream(e)||pe.isFile(e)||pe.isBlob(e)||pe.isReadableStream(e))return e;if(pe.isArrayBufferView(e))return e.buffer;if(pe.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 om(e,this.formSerializer).toString();if((o=pe.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),cm(e)):e}],transformResponse:[function(e){const t=this.transitional||Cr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(pe.isResponse(e)||pe.isReadableStream(e))return e;if(e&&pe.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"?Ye.from(o,Ye.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}}};pe.forEach(["delete","get","head","post","put","patch"],i=>{Cr.headers[i]={}});const hm=pe.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"]),um=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]&&hm[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:pe.isArray(i)?i.map(Fn):String(i)}function dm(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 pm=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Po(i,e,t,A,r){if(pe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!pe.isString(e)){if(pe.isString(A))return e.indexOf(A)!==-1;if(pe.isRegExp(A))return A.test(e)}}function fm(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function gm(i,e){const t=pe.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 aA=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 m=pe.findKey(r,u);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=Fn(o))}const s=(o,l)=>pe.forEach(o,(c,u)=>n(c,u,l));if(pe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(pe.isString(e)&&(e=e.trim())&&!pm(e))s(um(e),t);else if(pe.isObject(e)&&pe.isIterable(e)){let o={},l,c;for(const u of e){if(!pe.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[c=u[0]]=(l=o[c])?pe.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=pe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return dm(r);if(pe.isFunction(t))return t.call(this,r,A);if(pe.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=pe.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=pe.findKey(A,s);o&&(!t||Po(A,A[o],o,t))&&(delete A[o],r=!0)}}return pe.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 pe.forEach(this,(r,n)=>{const s=pe.findKey(A,n);if(s){t[s]=Fn(r),delete t[n];return}const o=e?fm(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 pe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&pe.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]||(gm(r,s),A[o]=!0)}return pe.isArray(e)?e.forEach(n):n(e),this}};aA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),pe.reduceDescriptors(aA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),pe.freezeMethods(aA);function No(i,e){const t=this||Cr,A=e||t,r=aA.from(A.headers);let n=A.data;return pe.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 Ye{constructor(e,t,A){super(e??"canceled",Ye.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 Ye("Request failed with status code "+t.status,[Ye.ERR_BAD_REQUEST,Ye.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function mm(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function wm(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,B=0;for(;m!==r;)B+=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(B*1e3/v):void 0}}function Bm(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=wm(50,250);return Bm(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)},rh=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},nh=i=>(...e)=>pe.asap(()=>i(...e)),ym=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,Cm=Xt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];pe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),pe.isString(A)&&o.push(`path=${A}`),pe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),pe.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 vm(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function Tm(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function sh(i,e,t){let A=!vm(e);return i&&(A||t==!1)?Tm(i,e):e}const oh=i=>i instanceof aA?{...i}:i;function xi(i,e){e=e||{};const t={};function A(c,u,m,B){return pe.isPlainObject(c)&&pe.isPlainObject(u)?pe.merge.call({caseless:B},c,u):pe.isPlainObject(u)?pe.merge({},u):pe.isArray(u)?u.slice():u}function r(c,u,m,B){if(pe.isUndefined(u)){if(!pe.isUndefined(c))return A(void 0,c,m,B)}else return A(c,u,m,B)}function n(c,u){if(!pe.isUndefined(u))return A(void 0,u)}function s(c,u){if(pe.isUndefined(u)){if(!pe.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(oh(c),oh(u),m,!0)};return pe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=pe.hasOwnProp(l,u)?l[u]:r,B=m(i[u],e[u],u);pe.isUndefined(B)&&m!==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=aA.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)):""))),pe.isFormData(t)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(pe.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&&pe.isFunction(A)&&(A=A(e)),A||A!==!1&&ym(e.url))){const l=r&&n&&Cm.read(n);l&&s.set(r,l)}return e},bm=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=ah(i);let n=r.data;const s=aA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,m,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=aA.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),E={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()},E),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 Ye("Request aborted",Ye.ECONNABORTED,i,U)),U=null)},U.onerror=function(G){const E=G&&G.message?G.message:"Network Error",z=new Ye(E,Ye.ERR_NETWORK,i,U);z.event=G||null,A(z),U=null},U.ontimeout=function(){let G=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const E=r.transitional||Io;r.timeoutErrorMessage&&(G=r.timeoutErrorMessage),A(new Ye(G,E.clarifyTimeoutError?Ye.ETIMEDOUT:Ye.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&pe.forEach(s.toJSON(),function(G,E){U.setRequestHeader(E,G)}),pe.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&&([m,v]=Un(l),U.upload.addEventListener("progress",m),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 L=mm(r.url);if(L&&Xt.protocols.indexOf(L)===-1){A(new Ye("Unsupported protocol "+L+":",Ye.ERR_BAD_REQUEST,i));return}U.send(n||null)})},xm=(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 Ye?u:new Tr(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Ye(`timeout of ${e}ms exceeded`,Ye.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=()=>pe.asap(o),l}},Qm=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},Fm=async function*(i,e){for await(const t of Um(i))yield*Qm(t,e)},Um=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=Fm(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 B=n+=m;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}=pe,Sm=(({Request:i,Response:e})=>({Request:i,Response:e}))(pe.global),{ReadableStream:hh,TextEncoder:uh}=pe.global,dh=(i,...e)=>{try{return!!i(...e)}catch{return!1}},Em=i=>{i=pe.merge.call({skipUndefined:!0},Sm,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(Xt.origin,{body:new hh,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!C}),u=s&&o&&dh(()=>pe.isReadableStream(new A("").body)),m={stream:u&&(b=>b.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!m[b]&&(m[b]=(C,U)=>{let F=C&&C[b];if(F)return F.call(C);throw new Ye(`Response type '${b}' is not supported`,Ye.ERR_NOT_SUPPORT,U)})});const B=async b=>{if(b==null)return 0;if(pe.isBlob(b))return b.size;if(pe.isSpecCompliantForm(b))return(await new t(Xt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(pe.isArrayBufferView(b)||pe.isArrayBuffer(b))return b.byteLength;if(pe.isURLSearchParams(b)&&(b=b+""),pe.isString(b))return(await l(b)).byteLength},v=async(b,C)=>{const U=pe.toFiniteNumber(b.getContentLength());return U??B(C)};return async b=>{let{url:C,method:U,data:F,signal:L,cancelToken:K,timeout:G,onDownloadProgress:E,onUploadProgress:z,responseType:ne,headers:X,withCredentials:R="same-origin",fetchOptions:re}=ah(b),se=e||fetch;ne=ne?(ne+"").toLowerCase():"text";let he=xm([L,K&&K.toAbortSignal()],G),Z=null;const ee=he&&he.unsubscribe&&(()=>{he.unsubscribe()});let ie;try{if(z&&c&&U!=="get"&&U!=="head"&&(ie=await v(X,F))!==0){let be=new t(C,{method:"POST",body:F,duplex:"half"}),xe;if(pe.isFormData(F)&&(xe=be.headers.get("content-type"))&&X.setContentType(xe),be.body){const[Be,ge]=rh(ie,Un(nh(z)));F=lh(be.body,ch,Be,ge)}}pe.isString(R)||(R=R?"include":"omit");const ae=n&&"credentials"in t.prototype,oe={...re,signal:he,method:U.toUpperCase(),headers:X.normalize().toJSON(),body:F,duplex:"half",credentials:ae?R:void 0};Z=n&&new t(C,oe);let le=await(n?se(Z,re):se(C,oe));const de=u&&(ne==="stream"||ne==="response");if(u&&(E||de&&ee)){const be={};["status","statusText","headers"].forEach(ve=>{be[ve]=le[ve]});const xe=pe.toFiniteNumber(le.headers.get("content-length")),[Be,ge]=E&&rh(xe,Un(nh(E),!0))||[];le=new A(lh(le.body,ch,Be,()=>{ge&&ge(),ee&&ee()}),be)}ne=ne||"text";let we=await m[pe.findKey(m,ne)||"text"](le,b);return!de&&ee&&ee(),await new Promise((be,xe)=>{ih(be,xe,{data:we,headers:aA.from(le.headers),status:le.status,statusText:le.statusText,config:b,request:Z})})}catch(ae){throw ee&&ee(),ae&&ae.name==="TypeError"&&/Load failed|fetch/i.test(ae.message)?Object.assign(new Ye("Network Error",Ye.ERR_NETWORK,b,Z,ae&&ae.response),{cause:ae.cause||ae}):Ye.from(ae,ae&&ae.code,b,Z,ae&&ae.response)}}},Lm=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=Lm;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:Em(e)),u=c;return c};ph();const ko={http:jg,xhr:bm,fetch:{get:ph}};pe.forEach(ko,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const fh=i=>`- ${i}`,Mm=i=>pe.isFunction(i)||i===null||i===!1;function Hm(i,e){i=pe.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,!Mm(A)&&(r=ko[(o=String(A)).toLowerCase()],r===void 0))throw new Ye(`Unknown adapter '${o}'`);if(r&&(pe.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 Ye("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const gh={getAdapter:Hm,adapters:ko};function Oo(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Tr(null,i)}function mh(i){return Oo(i),i.headers=aA.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),gh.getAdapter(i.adapter||Cr.adapter,i)(i).then(function(A){return Oo(i),A.data=No.call(i,i.transformResponse,A),A.headers=aA.from(A.headers),A},function(A){return Ah(A)||(Oo(i),A&&A.response&&(A.response.data=No.call(i,i.transformResponse,A.response),A.response.headers=aA.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 Ye(r(s," has been removed"+(t?" in "+t:"")),Ye.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 Im(i,e,t){if(typeof i!="object")throw new Ye("options must be an object",Ye.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 Ye("option "+n+" must be "+l,Ye.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Ye("Unknown option "+n,Ye.ERR_BAD_OPTION)}}const Ln={assertOptions:Im,validators:En},wA=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:wA.transitional(wA.boolean),forcedJSONParsing:wA.transitional(wA.boolean),clarifyTimeoutError:wA.transitional(wA.boolean),legacyInterceptorReqResOrdering:wA.transitional(wA.boolean)},!1),r!=null&&(pe.isFunction(r)?t.paramsSerializer={serialize:r}:Ln.assertOptions(r,{encode:wA.function,serialize:wA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ln.assertOptions(t,{baseUrl:wA.spelling("baseURL"),withXsrfToken:wA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&pe.merge(n.common,n[t.method]);n&&pe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete n[b]}),t.headers=aA.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,m=0,B;if(!l){const b=[mh.bind(this),void 0];for(b.unshift(...o),b.push(...c),B=b.length,u=Promise.resolve(t);m<B;)u=u.then(b[m++],b[m++]);return u}B=o.length;let v=t;for(;m<B;){const b=o[m++],C=o[m++];try{v=b(v)}catch(U){C.call(this,U);break}}try{u=mh.call(this,v)}catch(b){return Promise.reject(b)}for(m=0,B=c.length;m<B;)u=u.then(c[m++],c[m++]);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)}};pe.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}))}}),pe.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 _m=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 Dm(i){return function(t){return i.apply(null,t)}}function Pm(i){return pe.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=kc(Qi.prototype.request,e);return pe.extend(t,Qi.prototype,e,{allOwnKeys:!0}),pe.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=_m,gt.isCancel=Ah,gt.VERSION=wh,gt.toFormData=Qn,gt.AxiosError=Ye,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=Dm,gt.isAxiosError=Pm,gt.mergeConfig=xi,gt.AxiosHeaders=aA,gt.formToJSON=i=>eh(pe.isHTMLForm(i)?new FormData(i):i),gt.getAdapter=gh.getAdapter,gt.HttpStatusCode=Ko,gt.default=gt;const{Axios:db,AxiosError:pb,CanceledError:fb,isCancel:gb,CancelToken:mb,VERSION:wb,all:Bb,Cancel:yb,isAxiosError:Cb,spread:vb,toFormData:Tb,AxiosHeaders:bb,HttpStatusCode:xb,formToJSON:Qb,getAdapter:Fb,mergeConfig:Ub}=gt,DA=Object.create(null);DA.open="0",DA.close="1",DA.ping="2",DA.pong="3",DA.message="4",DA.upgrade="5",DA.noop="6";const Mn=Object.create(null);Object.keys(DA).forEach(i=>{Mn[DA[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(DA[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 Nm(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 km=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},Om=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:Km(i.substring(1),e)}:Mn[t]?i.length>1?{type:Mn[t],data:i.substring(1)}:{type:Mn[t]}:Vo},Km=(i,e)=>{if(Om){const t=km(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="",Vm=(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))})})},zm=(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 Wm(){return new TransformStream({transform(i,e){Nm(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 Rm(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 Gm(i)}function Gm(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 _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),BA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),$m="arraybuffer";function Sb(){}function Eh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Xm=BA.setTimeout,Jm=BA.clearTimeout;function Dn(i,e){e.useNativeTimers?(i.setTimeoutFn=Xm.bind(BA),i.clearTimeoutFn=Jm.bind(BA)):(i.setTimeoutFn=BA.setTimeout.bind(BA),i.clearTimeoutFn=BA.clearTimeout.bind(BA))}const Zm=1.33;function Ym(i){return typeof i=="string"?qm(i):Math.ceil((i.byteLength||i.size)*Zm)}function qm(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 jm(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function e1(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 t1 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,Dn(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 t1(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=jm(e);return t.length?"?"+t:""}}class A1 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)};zm(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,Vm(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 i1=Mh;function r1(){}class n1 extends A1{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 PA extends _t{constructor(e,t,A){super(),this.createRequest=e,Dn(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=PA.requestsCount++,PA.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=r1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete PA.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(PA.requestsCount=0,PA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Hh);else if(typeof addEventListener=="function"){const i="onpagehide"in BA?"pagehide":"unload";addEventListener(i,Hh,!1)}}function Hh(){for(let i in PA.requests)PA.requests.hasOwnProperty(i)&&PA.requests[i].abort()}const s1=(function(){const i=Ih({xdomain:!1});return i&&i.responseType!==null})();class o1 extends n1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=s1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new PA(Ih,this.uri(),e)}}function Ih(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||i1))return new XMLHttpRequest}catch{}if(!e)try{return new BA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const _h=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class a1 extends $o{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=_h?{}: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&&_n(()=>{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=BA.WebSocket||BA.MozWebSocket;class l1 extends a1{createSocket(e,t,A){return _h?new Xo(e,t,A):t?new Xo(e,t):new Xo(e)}doWrite(e,t){this.ws.send(t)}}class c1 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=Rm(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=Wm();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&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const h1={websocket:l1,webtransport:c1,polling:o1},u1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,d1=["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=u1.exec(i||""),n={},s=14;for(;s--;)n[d1[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=p1(n,n.path),n.queryKey=f1(n,n.query),n}function p1(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 f1(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=$m,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);Dn(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=e1(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+=Ym(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,_n(()=>{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",m=>{if(!A)if(m.type==="pong"&&m.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=m=>{const B=new Error("probe error: "+m);B.transport=t.name,n(),this.emitReserved("upgradeError",B)};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 m1=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=>h1[r]).filter(r=>!!r)),super(e,A)}};function w1(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 B1=typeof ArrayBuffer=="function",y1=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Dh=Object.prototype.toString,C1=typeof Blob=="function"||typeof Blob<"u"&&Dh.call(Blob)==="[object BlobConstructor]",v1=typeof File=="function"||typeof File<"u"&&Dh.call(File)==="[object FileConstructor]";function Yo(i){return B1&&(i instanceof ArrayBuffer||y1(i))||C1&&i instanceof Blob||v1&&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 T1(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 b1(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 x1=["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 Q1{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=T1(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 F1(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"&&x1.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 F1{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=b1(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 U1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ea,Encoder:Q1,get PacketType(){return ht}},Symbol.toStringTag,{value:"Module"}));function UA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const S1=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=[UA(e,"open",this.onopen.bind(this)),UA(e,"packet",this.onpacket.bind(this)),UA(e,"error",this.onerror.bind(this)),UA(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(S1.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++,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: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,Dn(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||U1;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 m1(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=UA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=UA(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(UA(e,"ping",this.onping.bind(this)),UA(e,"data",this.ondata.bind(this)),UA(e,"error",this.onerror.bind(this)),UA(e,"close",this.onclose.bind(this)),UA(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){_n(()=>{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 kn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=w1(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(kn,{Manager:ta,Socket:Nh,io:kn,connect:kn});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 pA=Aa("http://localhost:8000");function kh(i){const e=Aa(i);e&&e!==pA&&(pA=e,St&&(St.disconnect(),St.removeAllListeners(),St=null))}let St=null;function E1(){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:pA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=kn(pA,{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:pA,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:pA,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:pA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:pA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function ia(){const i=Aa(St?.io?.uri||null);return!St||St.io&&i&&pA&&i!==pA?(St&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:pA,wasConnected:St.connected,reason:"baseUrl changed"}),St.disconnect(),St.removeAllListeners(),St=null),St=E1()):St.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:St.id,connected:St.connected,baseUrl:pA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:St.id,baseUrl:pA}),St}function L1(i,e){const t=ia();return t.on(i,e),()=>t.off(i,e)}function M1(i,e){St&&St.off(i,e)}function H1(i,e){ia().emit(i,e)}function I1(){return St?St.connected?"connected":"connecting":"disconnected"}const On={getSocket:ia,on:L1,off:M1,emit:H1,getStatus:I1,setBaseUrl:kh},_1={},Oh=Y.createContext(),Vt=()=>{const i=Y.useContext(Oh);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},D1=({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";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||{},[B,v]=Y.useState(r||"BTC/USD"),[b,C]=Y.useState(n||"M1"),[U,F]=Y.useState([]),[L,K]=Y.useState(!0),[G,E]=Y.useState([]),[z,ne]=Y.useState(!1),[X,R]=Y.useState(1e5),[re,se]=Y.useState(null),[he,Z]=Y.useState([]),[ee,ie]=Y.useState(!0),[ae,oe]=Y.useState(!1),[le,de]=Y.useState(!0),[we,be]=Y.useState("candles"),[xe,Be]=Y.useState(!1),[ge,ve]=Y.useState("dark"),[Te,De]=Y.useState(null),[Xe,Ve]=Y.useState(!1),[Ce,je]=Y.useState(!1),[Le,Ee]=Y.useState(!1),[at,rt]=Y.useState(!1),[Pt,_e]=Y.useState(!1),[ke,Fe]=Y.useState(!1),[He,Ie]=Y.useState(!1),[$e,qe]=Y.useState(!1),[wt,Qt]=Y.useState(!1),[RA,GA]=Y.useState(!1),[Rt,gA]=Y.useState([]),$A=Y.useRef(null),Yt=Y.useRef(new Map),Ft=Y.useRef(null),rA=1e3,nt=Y.useCallback(async()=>{if(A)try{const Qe=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Qe)return;ne(!0);const Re=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Qe}`}});let Me=[];Array.isArray(Re.data)?Me=Re.data:Re.data?.data&&Array.isArray(Re.data.data)&&(Me=Re.data.data);const ze=Me.filter(Pe=>Pe.closePrice===null||Pe.closePrice===void 0).map(Pe=>({id:Pe.id,ticket:23,symbol:Pe.symbol,type:Pe.type,volume:Pe.volume,openPrice:Pe.openPrice??Pe.price,stopLoss:Pe.stopLoss,takeProfit:Pe.takeProfit,comment:Pe.comment||"",status:"OPEN",swap:0,profit:Pe.profit||0,profitCurrency:"USD",time:new Date(Pe.openedAt||Pe.openAt||Date.now()).toLocaleTimeString(),openAt:Pe.openedAt||Pe.openAt,closeAt:Pe.closedAt||Pe.closeAt}));E(ze)}catch(Qe){console.error("❌ Error fetching orders:",Qe.response?.data||Qe.message),E([])}finally{ne(!1)}},[l,A]),ft=Y.useCallback((Qe,Re)=>!Re||!Qe.price||isNaN(Re)||isNaN(Qe.price)?Qe.profit||0:(Qe?.type?.toUpperCase()==="BUY"?Re-Qe.price:Qe.price-Re)*Qe.volume,[]),Ut=Y.useCallback(async()=>{try{const Qe=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Qe)return;const Re=await gt.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${Qe}`}});if(Re.data&&Re.data.data){const Me=parseFloat(Re.data.data.balance);isNaN(Me)||R(Me)}}catch(Qe){console.error("❌ Error fetching user balance:",Qe.response?.data||Qe.message)}},[l]),Ht=Y.useCallback(async()=>{if(A)try{const Qe=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Qe)return;const Re=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Qe}`}});let Me=[];Array.isArray(Re.data)?Me=Re.data:Re.data?.data&&Array.isArray(Re.data.data)&&(Me=Re.data.data);const ze=Me.filter(Pe=>Pe.closePrice!==null&&Pe.closePrice!==void 0).map(Pe=>({id:Pe.id,ticket:23,symbol:Pe.symbol,type:Pe.type,volume:Pe.volume,openPrice:Pe.openPrice??Pe.price,closePrice:Pe.closePrice,stopLoss:Pe.stopLoss,takeProfit:Pe.takeProfit,profit:Pe.profit??Pe.profitLoss??0,profitCurrency:"USD",openAt:Pe.openedAt||Pe.openAt,closeAt:Pe.closedAt||Pe.closeAt,closeReason:Pe.closeReason||"",status:"CLOSED"}));gA(ze)}catch(Qe){console.error("❌ Error fetching history orders:",Qe.response?.data||Qe.message),gA([])}},[l,A]),XA=Y.useMemo(()=>{const Qe=X,Re=G.reduce((ot,Ct)=>ot+Ct.volume*Ct.price*.01,0),Me=G.reduce((ot,Ct)=>{const qt=U.find(Ai=>Ai.symbol===Ct.symbol);if(qt){const Ai=Ct.type?.toUpperCase()==="BUY"?parseFloat(qt.bid||0):parseFloat(qt.ask||0);if(Ai&&Ai>0&&!isNaN(Ai))return ot+ft(Ct,Ai)}return ot+(Ct.profit||0)},0),ze=Qe+Me,Pe=ze-Re,st=Re>0?ze/Re*100:0;return{balance:Qe,equity:ze,margin:Re,freeMargin:Pe,level:st.toFixed(2)}},[G,U,X,ft]);Y.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(nt(),Ut(),Ht())},[nt,Ut,Ht,A]),Y.useEffect(()=>{(async()=>{try{K(!0);const Re=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Me=localStorage.getItem("token")??localStorage.getItem("authToken"),ze=await gt.get(Re,{headers:Me?{Authorization:`Bearer ${Me}`}:{}});let Pe=[];Array.isArray(ze.data)?Pe=ze.data:ze.data&&ze.data.data&&Array.isArray(ze.data.data)?Pe=ze.data.data:ze.data&&ze.data.prices&&Array.isArray(ze.data.prices)?Pe=ze.data.prices:ze.data&&Array.isArray(ze.data)&&(Pe=ze.data);const st=Pe.map(ot=>{const Ct=ot.symbol||ot.name||"",qt=ot.category||null;return Ct&&(ot.bid!==void 0||ot.price!==void 0)?{symbol:Ct,bid:ot.bid??ot.price??0,ask:ot.ask??ot.price??0,change:ot.change??0,category:qt}:{...ot,symbol:Ct,category:qt}});st.length>0?(F(st),st.find(Ct=>Ct.symbol===B)||v(st[0].symbol)):F([])}catch(Re){console.error("❌ Error fetching symbols:",Re.response?.data||Re.message),F([])}finally{K(!1)}})()},[l,u.symbols]);const Je=Y.useCallback(()=>{const Qe=Yt.current;if(Qe.size===0)return;const Re=new Map(Qe);Qe.clear(),F(Me=>Me.map(ze=>{const Pe=Re.get(ze.symbol);return Pe?{...ze,...Pe}:ze})),E(Me=>{let ze=!1;const Pe=Me.map(st=>{const ot=Re.get(st.symbol);if(!ot)return st;const Ct=st.type?.toUpperCase()==="BUY"?parseFloat(ot.bid||0):parseFloat(ot.ask||0);if(!Ct||isNaN(Ct)||Ct<=0)return st;const qt=ft(st,Ct);return qt===st.profit?st:(ze=!0,{...st,profit:qt})});return ze?Pe:Me})},[ft]);Y.useEffect(()=>{$A.current||($A.current=On.getSocket());const Qe=$A.current,Re=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Qe.emit("joinUserRoom",{userId:Number(A)})},Me=()=>console.log("⚠️ TradingContext: Disconnected"),ze=st=>{st?.symbol&&(Yt.current.set(st.symbol,st),Ft.current||(Ft.current=setTimeout(()=>{Ft.current=null,Je()},rA)))},Pe=async st=>{if(st){if(st.newBalance!==void 0){const ot=parseFloat(st.newBalance);isNaN(ot)||R(ot)}if(window.notify){const ot=st.profitLoss||st.profit||0,Ct=ot>=0?`+${ot.toFixed(2)}`:ot.toFixed(2),qt=st.symbol||"Trade",Ai=st.reason||"Closed";window.notify(`Trade Closed: ${Ai} | ${qt} | P/L: ${Ct} USD`,ot>=0?"success":"error")}st.tradeId&&E(ot=>ot.filter(Ct=>Ct.id!==st.tradeId)),await nt(),await Ut()}};return Qe.on("connect",Re),Qe.on("disconnect",Me),Qe.on("priceUpdate",ze),Qe.on("tradeClosed",Pe),Qe.connected&&A&&Number.isFinite(Number(A))&&Qe.emit("joinUserRoom",{userId:Number(A)}),()=>{Qe.off("connect",Re),Qe.off("disconnect",Me),Qe.off("priceUpdate",ze),Qe.off("tradeClosed",Pe),Ft.current&&(clearTimeout(Ft.current),Ft.current=null),Yt.current.clear()}},[Je,nt,Ut]),Y.useEffect(()=>{try{const Qe=document.documentElement;if(!Qe)return;Qe.dataset.theme=ge}catch{}},[ge]);const Ke=Y.useMemo(()=>U.find(Qe=>Qe.symbol===B)||{bid:"0.00000",ask:"0.00000",change:0},[U,B]),At=Y.useMemo(()=>({selectedSymbol:B,setSelectedSymbol:v,selectedTimeframe:b,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:L,orders:G,setOrders:E,ordersLoading:z,fetchOrders:nt,fetchUserBalance:Ut,userBalance:X,setUserBalance:R,accountSummary:XA,currentSymbolData:Ke,activeTool:re,setActiveTool:se,chartObjects:he,setChartObjects:Z,showGrid:ee,setShowGrid:ie,snapToGrid:ae,setSnapToGrid:oe,drawingsVisible:le,setDrawingsVisible:de,chartType:we,setChartType:be,chartLocked:xe,setChartLocked:Be,theme:ge,setTheme:ve,candleColors:Te,setCandleColors:De,showTradeOrders:Xe,setShowTradeOrders:Ve,showTradePosition:Ce,setShowTradePosition:je,showTradeHistory:Le,setShowTradeHistory:Ee,showSLTP:at,setShowSLTP:rt,showAskPrice:Pt,setShowAskPrice:_e,showChartControls:ke,setShowChartControls:Fe,showTradeNotification:He,setShowTradeNotification:Ie,showCrosshair:$e,setShowCrosshair:qe,showOHLC:wt,setShowOHLC:Qt,baseUrl:l,endpoints:u,endpointParams:m,accountId:A,isShow:RA,setIsShow:GA,historyOrders:Rt,setHistoryOrders:gA,fetchHistoryOrders:Ht,indicators:s,indicatorSettings:o}),[B,b,U,L,G,z,nt,Ut,X,XA,Ke,re,he,ee,ae,le,we,xe,ge,Te,Xe,Ce,Le,at,Pt,ke,He,$e,wt,l,u,m,RA,Rt,Ht,s,o]);return a.jsx(Oh.Provider,{value:At,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),P1=["attr","size","title"];function N1(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){O1(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 O1(i,e,t){return e=K1(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function K1(i){var e=V1(i,"string");return typeof e=="symbol"?e:e+""}function V1(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 tA(i){return e=>Y.createElement(z1,Kn({attr:Vn({},i.attr)},e),Wh(i.child))}function z1(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=N1(i,P1),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 W1(i){return tA({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 R1(i){return tA({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 G1(i){return tA({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 $1(i){return tA({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 tA({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 X1(i){return tA({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 J1(i){return tA({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 Z1(i){return tA({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 Y1(i){return tA({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 q1(i){return tA({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 j1={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}=Vt(),c=r==="light",[u,m]=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",L=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",K=E=>{const z=parseFloat(u)||.01,ne=Math.max(.01,z+E);m(ne.toFixed(2))},G=async E=>{v("");const z=E,ne=parseFloat(z==="BUY"?e:i),X=parseFloat(u);if(!X||X<=0||isNaN(X)){v("Please enter a valid volume (minimum 0.01)");return}if(X<.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 R=localStorage.getItem("token")??localStorage.getItem("authToken");if(!R){v("Please login to place trades");return}C(!0);const re=typeof n=="object"?n?.symbol:n,se={accountId:t,symbol:re,type:z,volume:X,openPrice:ne,takeProfit:null,stopLoss:null};try{const he=o||j1?.VITE_BASE_URL||"http://localhost:8000",Z=l?.trades||"/api/trades",ee=await gt.post(`${he}${Z}`,se,{headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"}});if(ee.status<200||ee.status>=300){v(ee.data?.message||`Failed to place trade (${ee.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:()=>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} ${L} transition-colors`,children:a.jsx(Rh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:E=>{const z=E.target.value;(z===""||/^\d*\.?\d{0,2}$/.test(z))&&m(z)},onBlur:()=>{const E=parseFloat(u);m(isNaN(E)||E<.01?"0.01":E.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} ${L} transition-colors`,children:a.jsx(X1,{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})]})},ew={},$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:m,selectedTimeframe:B,setOrders:v,symbols:b,fetchOrders:C,theme:U,baseUrl:F,endpoints:L}=Vt(),K=U==="light",G={getContractSpec:He=>{const Ie=String(He||"").toUpperCase();return Ie.includes("BTC")||Ie.includes("ETH")||Ie.includes("SOL")||Ie.includes("XRP")||Ie.includes("ADA")||Ie.includes("DOGE")||Ie.includes("BNB")||Ie.includes("AVAX")||Ie.includes("DOT")||Ie.includes("LINK")||Ie.endsWith("USDT")?{contractSize:1}:Ie.includes("XAU")||Ie.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:He,volume:Ie})=>{const $e=G.getContractSpec(He);return(parseFloat(Ie)||0)*($e.contractSize||1)}},E=u||G,[z,ne]=Y.useState("0.01"),[X,R]=Y.useState(""),[re,se]=Y.useState(""),[he,Z]=Y.useState(""),[ee,ie]=Y.useState(!1),[ae,oe]=Y.useState(null),[le,de]=Y.useState(""),[we,be]=Y.useState(t||"BUY"),[xe,Be]=Y.useState(parseFloat(A)||0),[ge,ve]=Y.useState(parseFloat(r)||0),[Te,De]=Y.useState("text-white"),[Xe,Ve]=Y.useState("text-white"),Ce=Y.useRef(parseFloat(A)||0),je=Y.useRef(parseFloat(r)||0);Y.useEffect(()=>{if(!i)return;const He=On.getSocket(),Ie=qe=>{if(!(!qe||!qe.symbol)&&qe.symbol.toUpperCase()===m?.toUpperCase()){const wt=parseFloat(qe.bid)||0,Qt=parseFloat(qe.ask)||0;wt>0&&(wt>Ce.current?(De("text-green-400"),setTimeout(()=>De("text-white"),500)):wt<Ce.current&&Ce.current>0&&(De("text-red-400"),setTimeout(()=>De("text-white"),500)),Be(wt),Ce.current=wt),Qt>0&&(Qt>je.current?(Ve("text-green-400"),setTimeout(()=>Ve("text-white"),500)):Qt<je.current&&je.current>0&&(Ve("text-red-400"),setTimeout(()=>Ve("text-white"),500)),ve(Qt),je.current=Qt)}};He.on("priceUpdate",Ie);const $e=b.find(qe=>qe.symbol===m);if($e){const qe=parseFloat($e.bid)||0,wt=parseFloat($e.ask)||0;qe>0&&(Be(qe),Ce.current=qe),wt>0&&(ve(wt),je.current=wt)}return()=>{He.off("priceUpdate",Ie)}},[i,m,b]),Y.useEffect(()=>{if(i){ne(o?String(o):"0.01"),R(""),se(""),Z(""),de(""),be(t||"BUY");const He=parseFloat(A)||0,Ie=parseFloat(r)||0;He>0&&(Be(He),Ce.current=He),Ie>0&&(ve(Ie),je.current=Ie)}},[i,t,A,r,o]);const Le=xe||0,Ee=ge||0,at=He=>{const Ie=parseFloat(z)||.01,$e=Math.max(.01,Ie+He);ne($e.toFixed(2))},rt=He=>{const Ie=parseFloat(X)||0,$e=parseFloat(we==="BUY"?ge:xe)||0;if(!$e){de("Current price not available. Please wait...");return}let qe=Ie+He;we==="BUY"?qe=Math.max(1e-5,Math.min(qe,$e-1e-5)):qe=Math.max($e+1e-5,qe),R(qe>0?qe.toFixed(5):""),de("")},Pt=He=>{const Ie=parseFloat(re)||0,$e=parseFloat(we==="BUY"?ge:xe)||0;if(!$e){de("Current price not available. Please wait...");return}let qe=Ie+He;we==="BUY"?qe=Math.max($e+1e-5,qe):qe=Math.max(1e-5,Math.min(qe,$e-1e-5)),se(qe>0?qe.toFixed(5):""),de("")},_e=async He=>{de("");const Ie=He||we,$e=parseFloat(Ie==="BUY"?ge:xe),qe=parseFloat(z),wt=X?parseFloat(X):null,Qt=re?parseFloat(re):null;if(!qe||qe<=0||isNaN(qe)){de("Please enter a valid volume (minimum 0.01)");return}if(qe<.01){de("Volume must be at least 0.01");return}if(!$e||$e<=0||isNaN($e)){de("Invalid price. Please refresh and try again.");return}if(wt!==null&&wt!==""){if(isNaN(wt)||wt<=0){de("Stop Loss must be a valid positive number");return}if(Ie==="BUY"&&wt>=$e){de("Stop Loss must be below the current price for BUY orders");return}if(Ie==="SELL"&&wt<=$e){de("Stop Loss must be above the current price for SELL orders");return}}if(Qt!==null&&Qt!==""){if(isNaN(Qt)||Qt<=0){de("Take Profit must be a valid positive number");return}if(Ie==="BUY"){if(Qt<=$e){de(`Take Profit must be above the entry price (${$e.toFixed(5)}) for BUY orders`);return}}else if(Ie==="SELL"&&Qt>=$e){de(`Take Profit must be below the entry price (${$e.toFixed(5)}) for SELL orders`);return}}be(Ie),oe(Ie),ie(!0);const RA=new Date,GA=RA.toLocaleTimeString(),Rt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,gA=localStorage.getItem("token")??localStorage.getItem("authToken");if(!gA){de("Please login to place trades"),ie(!1),oe(null);return}const $A={accountId:s,symbol:m,type:Ie,volume:qe,price:$e,takeProfit:Qt,stopLoss:wt,comment:he.trim()||null},Yt={ticket:Rt.substring(0,8),symbol:m,type:Ie,volume:parseFloat(qe),price:parseFloat($e),time:GA,stopLoss:wt?parseFloat(wt):null,takeProfit:Qt?parseFloat(Qt):null,swap:0,profit:0,profitCurrency:"USD",comment:he.trim()||"",id:Rt,status:"OPEN",openAt:RA.toISOString()};if(!l&&v&&v(Ft=>[...Ft,Yt]),c&&!n){de("Execution handler is required in forceParentExecution mode"),ie(!1),oe(null);return}if(n){ie(!1),oe(null),e();const Ft={symbol:m,type:Ie,lotSize:qe,entryPrice:$e,stopLoss:wt,takeProfit:Qt,comment:he.trim()||null};Promise.resolve(n(Ft)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(rA=>{console.error("❌ Trade execution failed:",rA),!l&&v&&v(nt=>nt.filter(ft=>ft.id!==Rt))})}else{if(c){de("Fallback API path disabled in forceParentExecution mode"),ie(!1),oe(null);return}ie(!1),oe(null),e();const Ft=F||ew?.VITE_BASE_URL||"http://localhost:8000",rA=L?.trades||"/api/trades";gt.post(`${Ft}${rA}`,$A,{headers:{Authorization:`Bearer ${gA}`,"Content-Type":"application/json"}}).then(nt=>{if(nt.data&&nt.data.data){const ft=nt.data.data.trade;!l&&v&&v(Ut=>Ut.map(Ht=>Ht.id===Rt?{...Ht,id:ft.id,ticket:ft.id.substring(0,8),time:GA,openAt:ft.openAt}:Ht)),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(Ht=>Ht.id!==Rt));const ft=nt.data?.message||"Failed to place trade";window.notify&&window.notify(ft,"error")}}).catch(nt=>{console.error("Error placing trade:",nt),!l&&v&&v(Ut=>Ut.filter(Ht=>Ht.id!==Rt));let ft="Failed to place trade";if(nt.response){const Ut=nt.response.status,Ht=nt.response.data;Ut===400?ft=Ht?.message||"Invalid trade data. Please check your inputs.":Ut===401?ft="Authentication failed. Please login again.":Ut===404?ft=Ht?.message||"Symbol not found. Please select a valid symbol.":Ut===500?ft="Server error. Please try again later.":ft=Ht?.message||`Error: ${Ut}`}else nt.request&&(ft="Network error. Please check your internet connection.");window.notify&&window.notify(ft,"error")})}},Fe=(E?.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 ${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:[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 ${K?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${K?"text-slate-700":"text-white"}`,children:[Fe," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>at(-.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:z,onChange:He=>{const Ie=He.target.value;(Ie===""||/^\d*\.?\d{0,2}$/.test(Ie))&&(ne(Ie),de(""))},onBlur:()=>{const He=parseFloat(z);ne(isNaN(He)||He<.01?"0.01":He.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:()=>at(.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:()=>rt(-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:X,onChange:He=>{const Ie=He.target.value;(Ie===""||/^\d*\.?\d*$/.test(Ie))&&(R(Ie),de(""))},onBlur:He=>{const Ie=parseFloat(He.target.value);!isNaN(Ie)&&Ie>0?R(Ie.toFixed(5)):He.target.value===""&&R("")},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:()=>rt(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:()=>Pt(-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:re,onChange:He=>{const Ie=He.target.value;(Ie===""||/^\d*\.?\d*$/.test(Ie))&&(se(Ie),de(""))},onBlur:He=>{const Ie=parseFloat(He.target.value);!isNaN(Ie)&&Ie>0?se(Ie.toFixed(5)):He.target.value===""&&se("")},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:()=>Pt(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:he,onChange:He=>Z(He.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:`${Te} font-medium transition-colors duration-400`,children:Le>0?Le.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:`${Xe} font-medium transition-colors duration-400`,children:Ee>0?Ee.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>_e("SELL"),disabled:ee,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:ee&&ae==="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:()=>_e("BUY"),disabled:ee,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:ee&&ae==="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},tw={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"},Aw=[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 iw(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 NA(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 rw=()=>a.jsx(Y1,{style:oi}),nw=()=>a.jsx(q1,{style:oi}),sw=()=>a.jsx($1,{style:oi}),ow=()=>a.jsx(Z1,{style:oi}),aw=()=>a.jsx(R1,{style:oi}),lw=()=>a.jsx(W1,{style:oi}),cw=()=>a.jsx(G1,{style:oi}),hw=()=>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 tt({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 kt({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=NA(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 m=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:A,style:c})]})}function yA({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(hw,{})})]})}function uw({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(tt,{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(tt,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function dw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,NA(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(kt,{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:Aw.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(sw,{})}),a.jsx(Qr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(ow,{})})]}),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(aw,{})}),a.jsx(Qr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(lw,{})}),a.jsx(Qr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(cw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(tt,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(tt,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(kt,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(yA,{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(tt,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(kt,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(yA,{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,NA(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(kt,{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(tt,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(tt,{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(tt,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(tt,{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(kt,{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(tt,{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(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(tt,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(tt,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(tt,{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,NA(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(kt,{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(tt,{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(kt,{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(tt,{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(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(tt,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",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,NA(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(kt,{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(kt,{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(tt,{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(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(tt,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(tt,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(tt,{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(yA,{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(yA,{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(yA,{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,NA(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(kt,{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(tt,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(tt,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(kt,{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 mw({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(yA,{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 ww({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(yA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Bw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,NA(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(kt,{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(tt,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function yw({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 Cw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,NA(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(kt,{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(tt,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(tt,{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(tt,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(tt,{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(kt,{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(tt,{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(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function vw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,NA(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(kt,{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(tt,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(tt,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function Tw({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(yA,{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,NA(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(kt,{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(tt,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(kt,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(yA,{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(tt,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(kt,{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(tt,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(tt,{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(tt,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(tt,{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(yA,{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(yA,{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(yA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function bw(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}=Vt(),s=iw(r==="light"),[o,l]=Y.useState("style"),[c,u]=Y.useState({}),[m,B]=Y.useState(null),v=Y.useRef(null),b=Y.useRef(null);Y.useEffect(()=>{t&&(u(bw(t)),l("style"))},[t]),Y.useEffect(()=>{i||B(null)},[i]);const C=E=>{if(E.button!==0)return;E.preventDefault();const z=v.current;if(!z)return;const ne=z.offsetParent,X=ne?ne.getBoundingClientRect():{left:0,top:0},R=z.getBoundingClientRect(),re=R.left-X.left,se=R.top-X.top;b.current={startMX:E.clientX,startMY:E.clientY,startX:re,startY:se},B({x:re,y:se});const he=ee=>{const{startMX:ie,startMY:ae,startX:oe,startY:le}=b.current;B({x:oe+ee.clientX-ie,y:le+ee.clientY-ae})},Z=()=>{b.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=tw[t.type]||t.type,F=["style","coordinates","visualization"],L=()=>{if(o==="visualization")return a.jsx(uw,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(dw,{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(mw,{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(ww,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(Bw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(yw,{draft:c,tokens:s})}if(t.type==="infoline"){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==="rulerline"){if(o==="style")return a.jsx(pw,{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(vw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Tw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(Cw,{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",...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(ra,{size:"18px",children:a.jsx(rw,{})})})]})}),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(nw,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(E=>{const z=o===E;return a.jsxs("button",{type:"button",onClick:()=>l(E),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:[E.charAt(0).toUpperCase()+E.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},E)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:L()}),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 SA(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 AA(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 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())},xw=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},Lt=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+/",Qw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<jh.length;Xn++)Qw[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 Fw=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},Uw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Sw=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,Ew=oa-Ei,tu=65536>>Ei,Lw=1<<Ei,la=Lw-1,Mw=1024>>Ei,Hw=tu+Mw,Iw=Hw,_w=32,Dw=Iw+_w,Pw=65536>>oa,Nw=1<<Ew,kw=Nw-1,Au=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Ow=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Kw=function(i,e){var t=Fw(i),A=Array.isArray(t)?Sw(t):new Uint32Array(t),r=Array.isArray(t)?Uw(t):new Uint16Array(t),n=24,s=Au(r,n/2,A[4]/2),o=A[5]===2?Au(r,(n+A[4])/2):Ow(A,Math.ceil((n+A[4])/4));return new Vw(A[0],A[1],A[2],A[3],s,o)},Vw=(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=Dw-Pw+(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+/",zw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<iu.length;Zn++)zw[iu.charCodeAt(Zn)]=Zn;var Ww="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,Rw=1,nu=2,su=3,Gw=4,$w=5,ou=7,au=8,lu=9,ai=10,ca=11,cu=12,ha=13,Xw=14,Ur=15,ua=16,Yn=17,Sr=18,Jw=19,hu=20,da=21,Er=22,pa=23,Ri=24,fA=25,Lr=26,Mr=27,Gi=28,Zw=29,Li=30,Yw=31,qn=32,jn=33,fa=34,ga=35,ma=36,Hr=37,wa=38,es=39,ts=40,Ba=41,uu=42,qw=43,jw=[9001,65288],du="!",ct="×",As="÷",ya=Kw(Ww),jA=[Li,ma],Ca=[Rw,nu,su,$w],pu=[ai,au],fu=[Mr,Lr],eB=Ca.concat(pu),gu=[wa,es,ts,fa,ga],tB=[Ur,ha],AB=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===Gw||o===ca){if(s===0)return A.push(s),t.push(Li);var l=t[s-1];return eB.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(Li))}if(A.push(s),o===Yw)return t.push(e==="strict"?da:Hr);if(o===uu||o===Zw)return t.push(Li);if(o===qw)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},mu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===ai)t--;else return A}return 0},iB=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(mu(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,Jw,Ri,Gi].indexOf(u)!==-1||mu(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===Xw||c===ma&&tB.indexOf(l)!==-1||l===Gi&&u===ma||u===hu||jA.indexOf(u)!==-1&&l===fA||jA.indexOf(l)!==-1&&u===fA||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===fA||[Er,Ur].indexOf(u)!==-1&&e[o+1]===fA)||[Er,Ur].indexOf(l)!==-1&&u===fA||l===fA&&[fA,Gi,Ri].indexOf(u)!==-1)return ct;if([fA,Gi,Ri,Yn,Sr].indexOf(u)!==-1)for(var m=n;m>=0;){var B=e[m];if(B===fA)return ct;if([Gi,Ri].indexOf(B)!==-1)m--;else break}if([Mr,Lr].indexOf(u)!==-1)for(var m=[Yn,Sr].indexOf(l)!==-1?s:n;m>=0;){var B=e[m];if(B===fA)return ct;if([Gi,Ri].indexOf(B)!==-1)m--;else break}if(wa===l&&[wa,es,fa,ga].indexOf(u)!==-1||[es,fa].indexOf(l)!==-1&&[es,ts].indexOf(u)!==-1||[ts,ga].indexOf(l)!==-1&&u===ts||gu.indexOf(l)!==-1&&[hu,Lr].indexOf(u)!==-1||gu.indexOf(u)!==-1&&l===Mr||jA.indexOf(l)!==-1&&jA.indexOf(u)!==-1||l===Ri&&jA.indexOf(u)!==-1||jA.concat(fA).indexOf(l)!==-1&&u===Er&&jw.indexOf(i[o])===-1||jA.concat(fA).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},rB=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=AB(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[fA,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]},nB=(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 Lt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),sB=function(i,e){var t=$n(i),A=rB(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=iB(t,n,r,++c,s))===ct;);if(u!==ct||c===o){var m=new nB(t,u,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},oB=1,aB=2,Ir=4,wu=8,is=10,Bu=47,_r=92,lB=9,cB=32,rs=34,Dr=61,hB=35,uB=36,dB=37,ns=39,ss=40,Pr=41,pB=95,lA=45,fB=33,gB=60,mB=62,wB=64,BB=91,yB=93,CB=61,vB=123,os=63,TB=125,yu=124,bB=126,xB=128,Cu=65533,Ta=42,Mi=43,QB=44,FB=58,UB=59,Nr=46,SB=0,EB=8,LB=11,MB=14,HB=31,IB=127,kA=-1,vu=48,Tu=97,bu=101,_B=102,DB=117,PB=122,xu=65,Qu=69,Fu=70,NB=85,kB=90,Zt=function(i){return i>=vu&&i<=57},OB=function(i){return i>=55296&&i<=57343},$i=function(i){return Zt(i)||i>=xu&&i<=Fu||i>=Tu&&i<=_B},KB=function(i){return i>=Tu&&i<=PB},VB=function(i){return i>=xu&&i<=kB},zB=function(i){return KB(i)||VB(i)},WB=function(i){return i>=xB},as=function(i){return i===is||i===lB||i===cB},ls=function(i){return zB(i)||WB(i)||i===pB},Uu=function(i){return ls(i)||Zt(i)||i===lA},RB=function(i){return i>=SB&&i<=EB||i===LB||i>=MB&&i<=HB||i===IB},li=function(i,e){return i!==_r?!1:e!==is},cs=function(i,e,t){return i===lA?ls(e)||li(e,t):ls(i)?!0:!!(i===_r&&li(i,e))},ba=function(i,e,t){return i===Mi||i===lA?Zt(e)?!0:e===Nr&&Zt(t):Zt(i===Nr?e:i)},GB=function(i){var e=0,t=1;(i[e]===Mi||i[e]===lA)&&(i[e]===lA&&(t=-1),e++);for(var A=[];Zt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Lt.apply(void 0,A),10):0;i[e]===Nr&&e++;for(var n=[];Zt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Lt.apply(void 0,n),10):0;(i[e]===Qu||i[e]===bu)&&e++;var l=1;(i[e]===Mi||i[e]===lA)&&(i[e]===lA&&(l=-1),e++);for(var c=[];Zt(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Lt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},$B={type:2},XB={type:3},JB={type:4},ZB={type:13},YB={type:8},qB={type:21},jB={type:9},e2={type:10},t2={type:11},A2={type:12},i2={type:14},hs={type:23},r2={type:1},n2={type:25},s2={type:24},o2={type:26},a2={type:27},l2={type:28},c2={type:29},h2={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 hB: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)?aB:oB,s=this.consumeName();return{type:5,value:s,flags:n}}break;case uB:if(this.peekCodePoint(0)===Dr)return this.consumeCodePoint(),ZB;break;case ns:return this.consumeStringToken(ns);case ss:return $B;case Pr:return XB;case Ta:if(this.peekCodePoint(0)===Dr)return this.consumeCodePoint(),i2;break;case Mi:if(ba(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case QB:return JB;case lA: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===lA&&c===mB)return this.consumeCodePoint(),this.consumeCodePoint(),s2;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 FB:return o2;case UB:return a2;case gB:if(this.peekCodePoint(0)===fB&&this.peekCodePoint(1)===lA&&this.peekCodePoint(2)===lA)return this.consumeCodePoint(),this.consumeCodePoint(),n2;break;case wB:var m=this.peekCodePoint(0),B=this.peekCodePoint(1),v=this.peekCodePoint(2);if(cs(m,B,v)){var s=this.consumeName();return{type:7,value:s}}break;case BB:return l2;case _r:if(li(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case yB:return c2;case CB:if(this.peekCodePoint(0)===Dr)return this.consumeCodePoint(),YB;break;case vB:return t2;case TB:return A2;case DB:case NB: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)===Dr)return this.consumeCodePoint(),jB;if(this.peekCodePoint(0)===yu)return this.consumeCodePoint(),qB;break;case bB:if(this.peekCodePoint(0)===Dr)return this.consumeCodePoint(),e2;break;case kA:return xa}return as(e)?(this.consumeWhiteSpace(),h2):Zt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ls(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Lt(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(Lt.apply(void 0,e.map(function(l){return l===os?vu:l})),16),n=parseInt(Lt.apply(void 0,e.map(function(l){return l===os?Fu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Lt.apply(void 0,e),16);if(this.peekCodePoint(0)===lA&&$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(Lt.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:Lt.apply(void 0,e)};if(as(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===kA||this.peekCodePoint(0)===Pr?(this.consumeCodePoint(),{type:22,value:Lt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),hs);if(r===rs||r===ns||r===ss||RB(r))return this.consumeBadUrlRemnants(),hs;if(r===_r)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+=Lt.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),r2;if(r===_r){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+=Lt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Ir,A=this.peekCodePoint(0);for((A===Mi||A===lA)&&e.push(this.consumeCodePoint());Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Nr&&Zt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=wu;Zt(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===lA)&&Zt(n)||Zt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=wu;Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[GB(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===dB?(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=Lt(e);$i(this.peekCodePoint(0))&&t.length<6;)t+=Lt(this.consumeCodePoint());as(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||OB(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+=Lt(t);else if(li(t,this.peekCodePoint(0)))e+=Lt(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||d2(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})(),kr=function(i){return i.type===15},Xi=function(i){return i.type===17},mt=function(i){return i.type===20},u2=function(i){return i.type===0},Qa=function(i,e){return mt(i)&&i.value===e},Lu=function(i){return i.type!==31},Ji=function(i){return i.type!==31&&i.type!==4},OA=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},d2=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},Dt=function(i){return i.type===16||ci(i)},Mu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},zt={type:17,number:0,flags:Ir},Fa={type:16,number:50,flags:Ir},hi={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(kr(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},Hu="deg",Iu="grad",_u="rad",Du="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 _u:return e.number;case Du: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===_u||i.unit===Du)},Nu=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 CA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[zt,hi];case"to right":case"left":return CA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[hi,hi];case"to bottom":case"top":return CA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[hi,zt];case"to left":case"right":return CA(270)}return 0},CA=function(i){return Math.PI*i/180},ui={name:"color",parse:function(i,e){if(e.type===18){var t=p2[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},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+")"},pi=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},ku=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},Ou=function(i,e){var t=e.filter(Ji);if(t.length===3){var A=t.map(ku),r=A[0],n=A[1],s=A[2];return pi(r,n,s,1)}if(t.length===4){var o=t.map(ku),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?CA(A.number):us.parse(i,A))/(Math.PI*2),l=Dt(r)?r.number/100:0,c=Dt(n)?n.number/100:0,u=typeof s<"u"&&Dt(s)?vt(s,1):1;if(l===0)return pi(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,B=c*2-m,v=Ua(B,m,o+1/3),b=Ua(B,m,o),C=Ua(B,m,o-1/3);return pi(v*255,b*255,C*255,u)},p2={hsl:Ku,hsla:Ku,rgb:Ou,rgba:Ou},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},f2={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})}},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&&Dt(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=zt),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=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,B=r[c-1],v=(u-B)/(m+1),b=1;b<=m;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)}})},m2=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)},w2=function(i,e,t){var A=typeof i=="number"?i:m2(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]},EA=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=EA(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},B2=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(EA(e,t),EA(e,t-r),EA(e-A,t),EA(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=EA(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(EA(e,t),EA(e,t-r),EA(e-A,t),EA(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=zu(A,r,e,t,!1),c=m[0],u=m[1];n=EA(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]},y2=function(i,e){var t=CA(180),A=[];return OA(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=CA(180),A=[];return OA(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)+CA(270))%CA(360);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},C2=function(i,e){var t=CA(180),A=[],r=1,n=0,s=3,o=[];return OA(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=ui.parse(i,u.values[0]);A.push({stop:zt,color:m})}else if(u.name==="to"){var m=ui.parse(i,u.values[0]);A.push({stop:hi,color:m})}else if(u.name==="color-stop"){var B=u.values.filter(Ji);if(B.length===2){var m=ui.parse(i,B[1]),v=B[0];Xi(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:m})}}}}),r===1?{angle:(t+CA(180))%CA(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",v2=function(i,e){var t=0,A=3,r=[],n=[];return OA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,B){if(c)if(mt(B))switch(B.value){case"center":return n.push(Fa),m;case"top":case"left":return n.push(zt),m;case"right":case"bottom":return n.push(hi),m}else(Dt(B)||ci(B))&&n.push(B);else if(mt(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)||Dt(B))return Array.isArray(A)||(A=[]),A.push(B),!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 OA(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(Fa),!1;case"top":case"left":return n.push(zt),!1;case"right":case"bottom":return n.push(hi),!1}else if(Dt(m)||ci(m))return n.push(m),!1;return u},l):o===1&&(l=s.reduce(function(u,m){if(mt(m))switch(m.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(m)||Dt(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}},T2=function(i){return i.type===1},b2=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 x2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!qu[i.name])}var qu={"linear-gradient":y2,"-moz-linear-gradient":ps,"-ms-linear-gradient":ps,"-o-linear-gradient":ps,"-webkit-linear-gradient":ps,"radial-gradient":v2,"-moz-radial-gradient":fs,"-ms-radial-gradient":fs,"-o-radial-gradient":fs,"-webkit-radial-gradient":fs,"-webkit-gradient":C2},Q2={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)&&x2(A)}).map(function(A){return Sa.parse(i,A)})}},F2={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})}},U2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return OA(e).map(function(t){return t.filter(Dt)}).map(Mu)}},S2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return OA(e).map(function(t){return t.filter(mt).map(function(A){return A.value}).join(" ")}).map(E2)}},E2=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 L2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return OA(e).map(function(t){return t.filter(M2)})}},M2=function(i){return mt(i)||Dt(i)},gs=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},H2=gs("top"),I2=gs("right"),_2=gs("bottom"),D2=gs("left"),ms=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Mu(t.filter(Dt))}}},P2=ms("top-left"),N2=ms("top-right"),k2=ms("bottom-right"),O2=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}}},K2=ws("top"),V2=ws("right"),z2=ws("bottom"),W2=ws("left"),Bs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return kr(t)?t.number:0}}},R2=Bs("top"),G2=Bs("right"),$2=Bs("bottom"),X2=Bs("left"),J2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Z2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},Y2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(mt).reduce(function(t,A){return t|q2(A.value)},0)}},q2=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},j2={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}},ey={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 ty={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ys.STRICT:ys.NORMAL}},Ay={name:"line-height",initialValue:"normal",prefix:!1,type:4},ju=function(i,e){return mt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Dt(i)?vt(i,e):e},iy={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)}},ry={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}},ny=Cs("top"),sy=Cs("right"),oy=Cs("bottom"),ay=Cs("left"),ly={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}})}},cy={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"}},hy=vs("top"),uy=vs("right"),dy=vs("bottom"),py=vs("left"),fy={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}},my={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Qa(e[0],"none")?[]:OA(e).map(function(t){for(var A={color:ei.TRANSPARENT,offsetX:zt,offsetY:zt,blur:zt},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})}},wy={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}},By={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=vy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},yy=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Cy=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},vy={matrix:yy,matrix3d:Cy},ed={type:16,number:50,flags:Ir},Ty=[ed,ed],by={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Dt);return t.length!==2?Ty:[t[0],t[1]]}},xy={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 Qy={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}}},Fy={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")}},Uy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:1}},Sy={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ey={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})}},Ly={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+"'"})}},My={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Hy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:mt(e)&&e.value==="bold"?700:400}},Iy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(mt).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},Dy={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}},Py={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}},Ny={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(mt(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(kr).map(function(t){return td.parse(i,t)})}},Oy={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(u2);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:""},Ky={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Qa(e[0],"none")?[]:OA(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];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})}},Vy={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}},zy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Wy={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return kr(e)?e.number:0}},Ry=(function(){function i(e,t){var A,r;this.animationDuration=Oe(e,ky,t.animationDuration),this.backgroundClip=Oe(e,f2,t.backgroundClip),this.backgroundColor=Oe(e,g2,t.backgroundColor),this.backgroundImage=Oe(e,Q2,t.backgroundImage),this.backgroundOrigin=Oe(e,F2,t.backgroundOrigin),this.backgroundPosition=Oe(e,U2,t.backgroundPosition),this.backgroundRepeat=Oe(e,S2,t.backgroundRepeat),this.backgroundSize=Oe(e,L2,t.backgroundSize),this.borderTopColor=Oe(e,H2,t.borderTopColor),this.borderRightColor=Oe(e,I2,t.borderRightColor),this.borderBottomColor=Oe(e,_2,t.borderBottomColor),this.borderLeftColor=Oe(e,D2,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,P2,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,N2,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,k2,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,O2,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,K2,t.borderTopStyle),this.borderRightStyle=Oe(e,V2,t.borderRightStyle),this.borderBottomStyle=Oe(e,z2,t.borderBottomStyle),this.borderLeftStyle=Oe(e,W2,t.borderLeftStyle),this.borderTopWidth=Oe(e,R2,t.borderTopWidth),this.borderRightWidth=Oe(e,G2,t.borderRightWidth),this.borderBottomWidth=Oe(e,$2,t.borderBottomWidth),this.borderLeftWidth=Oe(e,X2,t.borderLeftWidth),this.boxShadow=Oe(e,Ky,t.boxShadow),this.color=Oe(e,J2,t.color),this.direction=Oe(e,Z2,t.direction),this.display=Oe(e,Y2,t.display),this.float=Oe(e,j2,t.cssFloat),this.fontFamily=Oe(e,Ly,t.fontFamily),this.fontSize=Oe(e,My,t.fontSize),this.fontStyle=Oe(e,_y,t.fontStyle),this.fontVariant=Oe(e,Iy,t.fontVariant),this.fontWeight=Oe(e,Hy,t.fontWeight),this.letterSpacing=Oe(e,ey,t.letterSpacing),this.lineBreak=Oe(e,ty,t.lineBreak),this.lineHeight=Oe(e,Ay,t.lineHeight),this.listStyleImage=Oe(e,iy,t.listStyleImage),this.listStylePosition=Oe(e,ry,t.listStylePosition),this.listStyleType=Oe(e,Ea,t.listStyleType),this.marginTop=Oe(e,ny,t.marginTop),this.marginRight=Oe(e,sy,t.marginRight),this.marginBottom=Oe(e,oy,t.marginBottom),this.marginLeft=Oe(e,ay,t.marginLeft),this.opacity=Oe(e,Uy,t.opacity);var n=Oe(e,ly,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,cy,t.overflowWrap),this.paddingTop=Oe(e,hy,t.paddingTop),this.paddingRight=Oe(e,uy,t.paddingRight),this.paddingBottom=Oe(e,dy,t.paddingBottom),this.paddingLeft=Oe(e,py,t.paddingLeft),this.paintOrder=Oe(e,Vy,t.paintOrder),this.position=Oe(e,gy,t.position),this.textAlign=Oe(e,fy,t.textAlign),this.textDecorationColor=Oe(e,Sy,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Oe(e,Ey,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,my,t.textShadow),this.textTransform=Oe(e,wy,t.textTransform),this.transform=Oe(e,By,t.transform),this.transformOrigin=Oe(e,by,t.transformOrigin),this.visibility=Oe(e,xy,t.visibility),this.webkitTextStrokeColor=Oe(e,zy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,Wy,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,Qy,t.wordBreak),this.zIndex=Oe(e,Fy,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})(),Gy=(function(){function i(e,t){this.content=Oe(e,Dy,t.content),this.quotes=Oe(e,Oy,t.quotes)}return i})(),id=(function(){function i(e,t){this.counterIncrement=Oe(e,Py,t.counterIncrement),this.counterReset=Oe(e,Ny,t.counterReset)}return i})(),Oe=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,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 ui.parse(i,n.parseComponentValue());case"image":return Sa.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return ci(o)?o:zt;case"length-percentage":var l=n.parseComponentValue();return Dt(l)?l:zt;case"time":return td.parse(i,n.parseComponentValue())}break}},$y="data-html2canvas-debug",Xy=function(i){var e=i.getAttribute($y);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=Xy(i);return t===1||e===t},KA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,La(t,3))debugger;this.styles=new Ry(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})(),Jy="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 Zy=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},Yy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},qy=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,jy=Ma-Hi,nd=65536>>Hi,eC=1<<Hi,Ia=eC-1,tC=1024>>Hi,AC=nd+tC,iC=AC,rC=32,nC=iC+rC,sC=65536>>Ma,oC=1<<jy,aC=oC-1,sd=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},lC=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},cC=function(i,e){var t=Zy(i),A=Array.isArray(t)?qy(t):new Uint32Array(t),r=Array.isArray(t)?Yy(t):new Uint16Array(t),n=24,s=sd(r,n/2,A[4]/2),o=A[5]===2?sd(r,(n+A[4])/2):lC(A,Math.ceil((n+A[4])/4));return new hC(A[0],A[1],A[2],A[3],s,o)},hC=(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=nC-sC+(e>>Ma),t=this.index[t],t+=e>>Hi&aC,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+/",uC=typeof Uint8Array>"u"?[]:new Uint8Array(256),bs=0;bs<od.length;bs++)uC[od.charCodeAt(bs)]=bs;var dC=1,_a=2,Da=3,ad=4,ld=5,pC=7,cd=8,Pa=9,Na=10,hd=11,ud=12,dd=13,pd=14,ka=15,fC=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},mC=cC(Jy),vA="×",Oa="÷",wC=function(i){return mC.get(i)},BC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===_a&&s===Da)return vA;if(n===_a||n===Da||n===ad||s===_a||s===Da||s===ad)return Oa;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===pC||n===dC)return vA;if(n===dd&&s===pd){for(;r===ld;)r=e[--A];if(r===pd)return vA}if(n===ka&&s===ka){for(var o=0;r===ka;)o++,r=e[--A];if(o%2===0)return vA}return Oa},yC=function(i){var e=fC(i),t=e.length,A=0,r=0,n=e.map(wC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=vA;A<t&&(s=BC(e,n,++A))===vA;);if(s!==vA||A===t){var o=gC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},CC=function(i){for(var e=yC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},vC=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},TC=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"?"&#128104;".repeat(10):"";var A=e.firstChild,r=$n(A.data).map(function(l){return Lt(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},bC=function(){return typeof new Image().crossOrigin<"u"},xC=function(){return typeof new XMLHttpRequest().responseType=="string"},QC=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},FC=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),gd(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)?gd(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},gd=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=vC(document);return Object.defineProperty(Wt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Wt.SUPPORT_RANGE_BOUNDS&&TC(document);return Object.defineProperty(Wt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=QC(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"?FC(document):Promise.resolve(!1);return Object.defineProperty(Wt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=bC();return Object.defineProperty(Wt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=xC();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})(),UC=function(i,e,t,A){var r=LC(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=md(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,md(A,u+s,B.length).getClientRects()))),u+=B.length})}else n.push(new Wr(o,qA.fromDOMRectList(i,l)))}else{var m=A.splitText(o.length);n.push(new Wr(o,SC(i,A))),A=m}else Wt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},SC=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},md=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(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 CC(i)},EC=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 HC(i,e)},LC=function(i,e){return e.letterSpacing!==0?Va(i):EC(i,e)},MC=[32,160,4961,65792,65793,4153,4241],HC=function(i,e){for(var t=sB(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){MC.indexOf(c)===-1?l+=Lt(c):(l.length&&A.push(l),A.push(Lt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},IC=(function(){function i(e,t,A){this.text=_C(t.data,A.textTransform),this.textBounds=UC(e,this.text,A,t)}return i})(),_C=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(DC,PC);case 2:return i.toUpperCase();default:return i}},DC=/(^|\s|:|-|\(|\))([a-z])/g,PC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},wd=(function(i){SA(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})(KA),Bd=(function(i){SA(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})(KA),yd=(function(i){SA(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})(KA),Cd=(function(i){SA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(KA),za=(function(i){SA(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})(KA),NC=[{type:15,flags:0,unit:"px",number:3}],kC=[{type:16,flags:0,number:50}],OC=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},KC=function(i){var e=i.type===VC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},xs="checkbox",Qs="radio",VC="password",vd=707406591,Wa=(function(i){SA(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=KC(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=OC(r.bounds)),r.type){case xs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=NC;break;case Qs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=kC;break}return r}return e})(KA),Td=(function(i){SA(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})(KA),bd=(function(i){SA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(KA),xd=(function(i){SA(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})(KA),zC=["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 IC(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()&&(WC(r,s,A)?s.flags|=4:RC(s.styles)&&(s.flags|=2),zC.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):GC(e)?new Cd(i,e):$C(e)?new za(i,e):XC(e)?new Wa(i,e):Es(e)?new Td(i,e):Ss(e)?new bd(i,e):Md(e)?new xd(i,e):new KA(i,e)},Fd=function(i,e){var t=Qd(i,e);return t.flags|=4,Fs(i,e,t,t),t},WC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ga(i)&&t.styles.isTransparent()},RC=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"},GC=function(i){return i.tagName==="LI"},$C=function(i){return i.tagName==="OL"},XC=function(i){return i.tagName==="INPUT"},JC=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"},ZC=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"},_d=function(i){return i.tagName.indexOf("-")>0},YC=(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})(),Dd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},qC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},jC={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},Mt=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Nd(Math.abs(i),n,A,function(s){return Lt(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,gi=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,gi)&&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},kd="十百千萬",Od="拾佰仟萬",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=Mt(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,Dd,3,A).toLowerCase();case 7:return qi(i,1,3999,Dd,3,A);case 8:return Mt(i,945,969,!1,A);case 9:return Mt(i,97,122,!1,A);case 10:return Mt(i,65,90,!1,A);case 11:return Mt(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 Mt(i,2534,2543,!0,A);case 14:case 30:return Mt(i,6112,6121,!0,A);case 15:return Ii(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Ii(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ti(i,"零一二三四五六七八九",kd,"負",r,fi|gi|Rr);case 47:return ti(i,"零壹貳參肆伍陸柒捌玖",Od,"負",r,ji|fi|gi|Rr);case 42:return ti(i,"零一二三四五六七八九",kd,"负",r,fi|gi|Rr);case 41:return ti(i,"零壹贰叁肆伍陆柒捌玖",Od,"负",r,ji|fi|gi|Rr);case 26:return ti(i,"〇一二三四五六七八九","十百千万",Kd,r,0);case 25:return ti(i,"零壱弐参四伍六七八九","拾百千万",Kd,r,ji|fi|gi);case 31:return ti(i,"영일이삼사오육칠팔구","십백천만",Xa,n,ji|fi|gi);case 33:return ti(i,"零一二三四五六七八九","十百千萬",Xa,n,0);case 32:return ti(i,"零壹貳參四五六七八九","拾百千",Xa,n,ji|fi|gi);case 18:return Mt(i,2406,2415,!0,A);case 20:return qi(i,1,19999,jC,3,A);case 21:return Mt(i,2790,2799,!0,A);case 22:return Mt(i,2662,2671,!0,A);case 22:return qi(i,1,10999,qC,3,A);case 23:return Ii(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Ii(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Mt(i,3302,3311,!0,A);case 28:return Ii(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Ii(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Mt(i,3792,3801,!0,A);case 37:return Mt(i,6160,6169,!0,A);case 38:return Mt(i,4160,4169,!0,A);case 39:return Mt(i,2918,2927,!0,A);case 40:return Mt(i,1776,1785,!0,A);case 43:return Mt(i,3046,3055,!0,A);case 44:return Mt(i,3174,3183,!0,A);case 45:return Mt(i,3664,3673,!0,A);case 46:return Mt(i,3872,3881,!0,A);default:return Mt(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 YC,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=ev(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=iv(r).then(function(){return AA(A,void 0,void 0,function(){var u,m;return Jt(this,function(B){switch(B.label){case 0:return this.scrolledElements.forEach(ov),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:B.sent(),B.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Av(l)]:[3,4];case 3:B.sent(),B.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(nv(document.doctype)+"<html></html>"),sv(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")),_d(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)||!ZC(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)&&cv(r);var l=this.counters.parse(new id(this.context,n)),c=this.resolvePseudoContent(e,r,s,$r.BEFORE);_d(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 Gy(this.context,A),c=o.createElement("html2canvaspseudoelement");Ja(A,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var B=o.createElement("img");B.src=m.value,B.style.opacity="1",c.appendChild(B)}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 b=m.values.filter(Ji),C=b[0],U=b[1];if(C&&mt(C)){var F=n.counters.getCounterValue(C.value),L=U&&mt(U)?Ea.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Gr(F,L,!1)))}}else if(m.name==="counters"){var K=m.values.filter(Ji),C=K[0],G=K[1],U=K[2];if(C&&mt(C)){var E=n.counters.getCounterValues(C.value),z=U&&mt(U)?Ea.parse(n.context,U.value):3,ne=G&&G.type===0?G.value:"",X=E.map(function(se){return Gr(se,z,!1)}).join(ne);c.appendChild(o.createTextNode(X))}}}else if(m.type===20)switch(m.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(m.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 ev=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},tv=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},Av=function(i){return Promise.all([].slice.call(i.images,0).map(tv))},iv=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)}})},rv=["all","d","content"],Ja=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);rv.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},nv=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},sv=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},ov=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},av=":before",lv=":after",Za="___html2canvas___pseudoelement_before",Ya="___html2canvas___pseudoelement_after",Wd=`{
1
+ (function(it,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):(it=typeof globalThis<"u"?globalThis:it||self,a(it.ChartSDK={},it.jsxRuntime,it.React))})(this,(function(it,a,Y){"use strict";var Ys=typeof document<"u"?document.currentScript:null;const qt="17:00-17:00",jt="America/New_York",OA="24x7",NA="UTC",bl={EURUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},BTCUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},ETHUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},BNBUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},SOLUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},ADAUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},XRPUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},DOTUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},MATICUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},LINKUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"}},xl={type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"};function sr(A){return A&&bl[A.toUpperCase()]||xl}function An(A){return sr(A).type==="forex"}function rn(A){return sr(A).type==="crypto"}function uf(A){return sr(A).session==="24x7"}function te(A){if(A==null)return null;if(typeof A=="number"){if(Number.isNaN(A)||!Number.isFinite(A))return null;let e;A>1e10?e=A/1e3:(A<1e9,e=A);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof A=="string"){const e=Date.parse(A);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof A=="object"&&"year"in A&&"month"in A&&"day"in A){const t=new Date(Date.UTC(A.year,A.month-1,A.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function pf(A,e){if(!A||A.length<2)return[];const t=[],i=2;for(let r=1;r<A.length;r++){const n=A[r-1].time,s=A[r].time,o=s-n;o>e*i&&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 df(A,e="America/New_York"){const t=new Date(A*1e3),i=new Date(t.toLocaleString("en-US",{timeZone:e})),r=i.getDay();return!(r===0||r===6||r===5&&i.getHours()>=17)}function Ql(A){return Array.isArray(A)?A.map(e=>({...e,time:te(e.time)})).filter(e=>e.time!=null):[]}function ff(A){if(!A||A.length<2)return!0;for(let e=1;e<A.length;e++)if(A[e].time<=A[e-1].time)return!1;return!0}function Re(A,e){return!Number.isFinite(A)||!Number.isFinite(e)||e<=0?A:Math.floor(A/e)*e}function Fl(A){if(!A||typeof A!="object")return!1;const{time:e,open:t,high:i,low:r,close:n,volume:s}=A;return!(te(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof i!="number"||!Number.isFinite(i)||typeof r!="number"||!Number.isFinite(r)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||i<t||i<n||i<r||r>t||r>n||r>i||t<=0||i<=0||r<=0||n<=0)}function Ul(A){const e=s=>Math.round(s*1e5)/1e5;let t=e(A.open),i=e(A.high),r=e(A.low),n=e(A.close);return i=Math.max(i,t,n,r),r=Math.min(r,t,n,i),{...A,open:t,high:i,low:r,close:n,volume:A.volume!=null?Math.round(A.volume):A.volume}}function Sl(A){if(!Array.isArray(A)||A.length===0)return[];const e=new Map;return A.forEach(t=>{const i=te(t.time);if(i!=null)if(e.has(i)){const r=e.get(i);e.set(i,{...t,time:i,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(i,{...t,time:i})}),Array.from(e.values())}function gf(A,e){if(!Array.isArray(A)||A.length===0)return A;const t=[],i=Math.max(e*10080,604800),r=1e4;for(let o=0;o<A.length;o++)if(t.push(A[o]),o<A.length-1){const l=A[o].time,c=A[o+1].time,h=c-l;if(h>i&&((h/3600).toFixed(1),(i/3600).toFixed(1)),h>e&&h<=i){const m=A[o];let v=l+e,x=0;for(v=Re(v,e);v<c&&x<r;){const F=Re(v,e);t.some(S=>S.time===F)||(t.push({time:F,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),x++),v+=e}if(v<c&&x>=r){const F=Re(c-e,e);t.some(S=>S.time===F)||t.push({time:F,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 BA(A){if(!A||typeof A!="string")return 60;const e=A.toUpperCase();if(e==="MN")return 2592e3;let t=e.match(/^([MHDW])(\d+)$/);if(t){const i=t[1];return parseInt(t[2],10)*({M:60,H:3600,D:86400,W:604800}[i]||60)}if(t=A.match(/^(\d+)([mhdwy])$/i),t){const i=parseInt(t[1],10),r=t[2].toLowerCase();return i*({m:60,h:3600,d:86400,w:604800,y:31536e3}[r]||60)}return 60}function El(A,e,t){if(!Array.isArray(A)||A.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const i=sr(e),r=BA(t),o=Ql(A).map(Q=>({...Q,time:Re(Q.time,r)})).filter(Q=>Fl(Q)).map(Q=>Ul(Q)),l=Sl(o);l.sort((Q,N)=>Q.time-N.time);const c=Math.floor(Date.now()/1e3),h=l.filter(Q=>Q.time<=c),v=h.filter((Q,N)=>N===0?!0:Q.time>h[N-1].time),x=Sl(v);x.sort((Q,N)=>Q.time-N.time);const F=gf(x,r),T=[];for(let Q=1;Q<F.length;Q++){const N=F[Q].time-F[Q-1].time;N>r*2&&T.push({from:F[Q-1].time,to:F[Q].time,gapSeconds:N,gapMinutes:Math.round(N/60),fromDate:new Date(F[Q-1].time*1e3).toISOString(),toDate:new Date(F[Q].time*1e3).toISOString()})}const S=v.filter((Q,N)=>N===0?!1:Q.close===v[N-1].close&&Q.open===v[N-1].close).length,I={original:A.length,processed:F.length,duplicates:A.length-l.length,outliers:S,gaps:T,filledGaps:F.length-x.length,symbolConfig:i};return{candles:F,stats:I}}function Ll(A,e,t="1m"){if(!A||!e||!Fl(A))return null;const i=te(A.time);if(i==null)return null;const r=BA(t),n=Re(i,r);return Ul({...A,time:n})}function Ml(A,e=20,t=2){if(!A||A.length<e)return null;const i=[],r=[],n=[];for(let s=e-1;s<A.length;s++){let o=0;for(let v=s-e+1;v<=s;v++)o+=A[v].close;const l=o/e;let c=0;for(let v=s-e+1;v<=s;v++){const x=A[v].close-l;c+=x*x}const h=Math.sqrt(c/e),m=A[s].time;r.push({time:m,value:l}),i.push({time:m,value:l+t*h}),n.push({time:m,value:l-t*h})}return{upper:i,middle:r,lower:n}}function qs(A,e=20,t=2){if(!A||A.length<e)return null;const i=A.slice(-e);let r=0;for(let c=0;c<i.length;c++)r+=i[c].close;const n=r/e;let s=0;for(let c=0;c<i.length;c++){const h=i[c].close-n;s+=h*h}const o=Math.sqrt(s/e);return{time:A[A.length-1].time,upper:n+t*o,middle:n,lower:n-t*o}}function Ft(A){var e=A.width,t=A.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 Ti(A,e){return A.width===e.width&&A.height===e.height}var mf=(function(){function A(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return A.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(A.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),A.prototype.subscribe=function(e){var t=this,i={next:e};return this._observers.push(i),{unsubscribe:function(){t._observers=t._observers.filter(function(r){return r!==i})}}},A.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)},A.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},A.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},A.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},A})();function wf(A){return new mf(A)}var Bf=(function(){function A(e,t,i){var r;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=Ft({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(r=i?.allowResizeObserver)!==null&&r!==void 0?r:!0,this._chooseAndInitObserver()}return A.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(A.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"bitmapSize",{get:function(){return Ft({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),A.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=Ft(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},A.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},A.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(A.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),A.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},A.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},A.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},A.prototype._resizeBitmap=function(e){var t=this.bitmapSize;Ti(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},A.prototype._emitBitmapSizeChanged=function(e,t){var i=this;this._bitmapSizeChangedListeners.forEach(function(r){return r.call(i,e,t)})},A.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,i=Ft(this._transformBitmapSize(e,this._canvasElementClientSize)),r=Ti(this.bitmapSize,i)?null:i;t===null&&r===null||t!==null&&r!==null&&Ti(t,r)||(this._suggestedBitmapSize=r,this._emitSuggestedBitmapSizeChanged(t,r))},A.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var i=this;this._suggestedBitmapSizeChangedListeners.forEach(function(r){return r.call(i,e,t)})},A.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}Cf().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},A.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=Hl(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=wf(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},A.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var i=Hl(this._canvasElement);if(i!==null){var r=(t=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:i.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?vf(n[0],r):Ft({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(s)}}},A.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var i=t.find(function(s){return s.target===e._canvasElement});if(!(!i||!i.devicePixelContentBoxSize||!i.devicePixelContentBoxSize[0])){var r=i.devicePixelContentBoxSize[0],n=Ft({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},A})();function yf(A,e){return new Bf(A,e.transform,e.options)}function Hl(A){return A.ownerDocument.defaultView}function Cf(){return new Promise(function(A){var e=new ResizeObserver(function(t){A(t.every(function(i){return"devicePixelContentBoxSize"in i})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function vf(A,e){return Ft({width:Math.round(A.left*e+A.width*e)-Math.round(A.left*e),height:Math.round(A.top*e+A.height*e)-Math.round(A.top*e)})}var Tf=(function(){function A(e,t,i){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,i.width===0||i.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=i,this._context=e}return A.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()}},A.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(A.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),A})();function bi(A,e){var t=A.canvasElementClientSize;if(t.width===0||t.height===0)return null;var i=A.bitmapSize;if(i.width===0||i.height===0)return null;var r=A.canvasElement.getContext("2d",e);return r===null?null:new Tf(r,t,i)}const bf={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},xf={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Qf={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Ff={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},Uf={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},Sf={color:"#26a69a",base:0},Il={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 Dl,_l;function xi(A,e){const t={0:[],1:[A.lineWidth,A.lineWidth],2:[2*A.lineWidth,2*A.lineWidth],3:[6*A.lineWidth,6*A.lineWidth],4:[A.lineWidth,4*A.lineWidth]}[e];A.setLineDash(t)}function kl(A,e,t,i){A.beginPath();const r=A.lineWidth%2?.5:0;A.moveTo(t,e+r),A.lineTo(i,e+r),A.stroke()}function ai(A,e){if(!A)throw new Error("Assertion failed"+(e?": "+e:""))}function rA(A){if(A===void 0)throw new Error("Value is undefined");return A}function Fe(A){if(A===null)throw new Error("Value is null");return A}function ki(A){return Fe(rA(A))}(function(A){A[A.Simple=0]="Simple",A[A.WithSteps=1]="WithSteps",A[A.Curved=2]="Curved"})(Dl||(Dl={})),(function(A){A[A.Solid=0]="Solid",A[A.Dotted=1]="Dotted",A[A.Dashed=2]="Dashed",A[A.LargeDashed=3]="LargeDashed",A[A.SparseDotted=4]="SparseDotted"})(_l||(_l={}));const Ol={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 vA(A){return A<0?0:A>255?255:Math.round(A)||0}function Nl(A){return A<=0||A>1?Math.min(Math.max(A,0),1):Math.round(1e4*A)/1e4}const Ef=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Lf=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Mf=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Hf=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function or(A){(A=A.toLowerCase())in Ol&&(A=Ol[A]);{const e=Hf.exec(A)||Mf.exec(A);if(e)return[vA(parseInt(e[1],10)),vA(parseInt(e[2],10)),vA(parseInt(e[3],10)),Nl(e.length<5?1:parseFloat(e[4]))]}{const e=Lf.exec(A);if(e)return[vA(parseInt(e[1],16)),vA(parseInt(e[2],16)),vA(parseInt(e[3],16)),1]}{const e=Ef.exec(A);if(e)return[vA(17*parseInt(e[1],16)),vA(17*parseInt(e[2],16)),vA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${A}`)}function Kl(A){return .199*A[0]+.687*A[1]+.114*A[2]}function nn(A){const e=or(A);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Kl(e)>160?"black":"white"}}class Ht{constructor(){this.h=[]}l(e,t,i){const r={o:e,_:t,u:i===!0};this.h.push(r)}v(e){const t=this.h.findIndex((i=>e===i.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,i){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,i)))}M(){return this.h.length>0}S(){this.h=[]}}function EA(A,...e){for(const t of e)for(const i in t)t[i]!==void 0&&Object.prototype.hasOwnProperty.call(t,i)&&!["__proto__","constructor","prototype"].includes(i)&&(typeof t[i]!="object"||A[i]===void 0||Array.isArray(t[i])?A[i]=t[i]:EA(A[i],t[i]));return A}function KA(A){return typeof A=="number"&&isFinite(A)}function ar(A){return typeof A=="number"&&A%1==0}function lr(A){return typeof A=="string"}function sn(A){return typeof A=="boolean"}function jA(A){const e=A;if(!e||typeof e!="object")return e;let t,i,r;for(i in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(i)&&(r=e[i],t[i]=r&&typeof r=="object"?jA(r):r);return t}function If(A){return A!==null}function cr(A){return A===null?void 0:A}const js="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Oi(A,e,t){return e===void 0&&(e=js),`${t=t!==void 0?`${t} `:""}${A}px ${e}`}class Pf{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(),i=this.H();return e.P===t&&e.D===i||(e.P=t,e.D=i,e.R=Oi(t,i),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 eo{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,i){this.Y.forEach((r=>{r.X(e,t,i)}))}}class LA{X(e,t,i){e.useBitmapCoordinateSpace((r=>this.K(r,t,i)))}}class Df extends LA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){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 h=n.it[c],m=Math.round(h.nt*t)+s,v=h.st*i,x=l*i+s;e.moveTo(m,v),e.arc(m,v,x,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 _f(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const kf={from:0,to:1};class Of{constructor(e,t){this.ut=new eo,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(_f),this.ct=this.dt.map((i=>{const r=new Df;return r.J(i),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(),i=this.vt.xt(),r=this.F.St();t.forEach(((n,s)=>{var o;const l=this.dt[s],c=n.kt(i);if(e||c===null||!n.yt())return void(l.tt=null);const h=Fe(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,h.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=i,l.it[0].nt=r.It(i),l.tt=kf}))}}let Nf=class extends LA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:i,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*i),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*i),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,xi(e,this.zt.Lt.Nt),(function(c,h,m,v){c.beginPath();const x=c.lineWidth%2?.5:0;c.moveTo(h+x,m),c.lineTo(h+x,v),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,xi(e,this.zt.Et.Nt),kl(e,l,0,t.width))}};class Kf{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 Nf(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=Fe(this.jt.Ht()),i=t.$t().W().crosshair,r=this.Ft;if(i.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=i.horzLine.width,r.Et.Nt=i.horzLine.style,r.Et.V=i.horzLine.color,r.Lt.et=i.vertLine.width,r.Lt.Nt=i.vertLine.style,r.Lt.V=i.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function zf(A,e,t,i,r,n){A.fillRect(e+n,t,i-2*n,n),A.fillRect(e+n,t+r-n,i-2*n,n),A.fillRect(e,t,n,r),A.fillRect(e+i-n,t,n,r)}function on(A,e,t,i,r,n){A.save(),A.globalCompositeOperation="copy",A.fillStyle=n,A.fillRect(e,t,i,r),A.restore()}function zl(A,e,t,i,r,n){A.beginPath(),A.roundRect?A.roundRect(e,t,i,r,n):(A.lineTo(e+i-n[1],t),n[1]!==0&&A.arcTo(e+i,t,e+i,t+n[1],n[1]),A.lineTo(e+i,t+r-n[2]),n[2]!==0&&A.arcTo(e+i,t+r,e+i-n[2],t+r,n[2]),A.lineTo(e+n[3],t+r),n[3]!==0&&A.arcTo(e,t+r,e,t+r-n[3],n[3]),A.lineTo(e,t+n[0]),n[0]!==0&&A.arcTo(e,t,e+n[0],t,n[0]))}function Vl(A,e,t,i,r,n,s=0,o=[0,0,0,0],l=""){if(A.save(),!s||!l||l===n)return zl(A,e,t,i,r,o),A.fillStyle=n,A.fill(),void A.restore();const c=s/2;var h;zl(A,e+c,t+c,i-s,r-s,(h=-c,o.map((m=>m===0?m:m+h)))),n!=="transparent"&&(A.fillStyle=n,A.fill()),l!=="transparent"&&(A.lineWidth=s,A.strokeStyle=l,A.closePath(),A.stroke()),A.restore()}function Wl(A,e,t,i,r,n,s){A.save(),A.globalCompositeOperation="copy";const o=A.createLinearGradient(0,0,0,r);o.addColorStop(0,n),o.addColorStop(1,s),A.fillStyle=o,A.fillRect(e,t,i,r),A.restore()}class Gl{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,i,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 h=this.Gt(l,t,i,r),m=h.Jt;return h.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(h.Qt?m.ui-m.ei:0,m.ii,m.ei,m.ci-m.ii)),h}));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,i,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:h}=e,m=this.zt.hi||!this.zt.mi?t.T:0,v=this.zt.bi?t.C:0,x=t.L+this.Xt.wi,F=t.B+this.Xt.gi,T=t.A,S=t.I,I=this.zt.Kt,Q=t.P,N=i.Mi(s,I),J=Math.ceil(i.xi(s,I)),H=Q+x+F,z=t.C+T+S+J+m,re=Math.max(1,Math.floor(h));let q=Math.round(H*h);q%2!=re%2&&(q+=1);const ie=v>0?Math.max(1,Math.floor(v*c)):0,G=Math.round(z*c),ne=Math.round(m*c),le=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,ee=Math.round(le*h)-Math.floor(.5*h),we=Math.floor(ee+re/2-q/2),j=we+q,ge=r==="right",ae=ge?l.width-v:v,pe=ge?o.width-ie:ie;let ue,oe,fe;return ge?(ue=pe-G,oe=pe-ne,fe=ae-m-T-v):(ue=pe+G,oe=pe+ne,fe=ae+m+T),{Qt:ge,Jt:{ii:we,li:ee,ci:j,ni:G,si:q,ht:2*c,ei:ie,ti:ue,ri:pe,ai:oe,oi:re,ui:o.width},di:{ii:we/h,ci:j/h,fi:fe,pi:N}}}}class an{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||Gl)(this.Ci,this.yi),this.Ri=new(e||Gl)(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 Vf extends an{constructor(e,t,i){super(),this.jt=e,this.Li=t,this.Ei=i}zi(e,t,i){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=nn(r.labelBackgroundColor);i.t=s.t,e.V=s.i;const o=2/12*this.Li.P();i.wi=o,i.gi=o;const l=this.Ei(this.Li);i.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const Wf=/[1-9]/g;class Rl{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 i=e.useMediaCoordinateSpace((({context:v})=>(v.font=t.R,Math.round(t.Wi.xi(v,Fe(this.zt).Kt,Wf)))));if(i<=0)return;const r=t.ji,n=i+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 h=c+n,m=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:v,horizontalPixelRatio:x,verticalPixelRatio:F})=>{const T=Fe(this.zt);v.fillStyle=T.t;const S=Math.round(c*x),I=Math.round(0*F),Q=Math.round(h*x),N=Math.round(m*F),J=Math.round(2*x);if(v.beginPath(),v.moveTo(S,I),v.lineTo(S,N-J),v.arcTo(S,N,S+J,N,J),v.lineTo(Q-J,N),v.arcTo(Q,N,Q,N-J,J),v.lineTo(Q,I),v.fill(),T.hi){const H=Math.round(T.ki*x),z=I,re=Math.round((z+t.T)*F);v.fillStyle=T.V;const q=Math.max(1,Math.floor(x)),ie=Math.floor(.5*x);v.fillRect(H-ie,z,q,re-z)}})),e.useMediaCoordinateSpace((({context:v})=>{const x=Fe(this.zt),F=0+t.C+t.T+t.L+t.P/2;v.font=t.R,v.textAlign="left",v.textBaseline="middle",v.fillStyle=x.V;const T=t.Wi.Mi(v,"Apr0");v.translate(c+r,F+T),v.fillText(x.Kt,0,0)}))}}class Gf{constructor(e,t,i){this.ft=!0,this.Wt=new Rl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=i}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const i=this.$i.St();if(i.Ni())return;e.Hi=i.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=i.Ui(this.vt.xt());e.Kt=i.qi(Fe(n)),e.yt=!0;const s=nn(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=i.W().ticksVisible}}class to{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 $l;(function(A){A[A.Normal=0]="Normal",A[A.Magnet=1]="Magnet",A[A.Hidden=2]="Hidden"})($l||($l={}));class Rf extends to{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 Of(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Fe(this.tn).vn())return{_t:l,ki:o};{const c=Fe(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const i=((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 Gf(this,e,i),this.wn=new Kf(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,i){this.hn||(this.hn=!0),this.en=!0,this.yn(e,t,i)}xt(){return this.sn}Yt(){return this.ln}Zt(){return this.an}yt(){return this.en}Cn(){this.en=!1,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn()}Pn(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 i=[];return this.tn===e&&i.push(this.Dn(this.rn,t,this.fn)),i}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,i){this.Bn(e,t,i)&&this.Vn()}Bn(e,t,i){const r=this.ln,n=this.an,s=this.nn,o=this.sn,l=this.tn,c=this.On(i);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=i;const h=c!==null?c.Ct():null;return c!==null&&h!==null?(this.nn=t,this.an=c.Rt(t,h)):(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((i=>i.In().An())).filter(If),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,i){let r=e.get(t);return r===void 0&&(r=new Vf(this,t,i),e.set(t,r)),r}}function ln(A){return A==="left"||A==="right"}class Rt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const i=(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,i)}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,i)=>{this.Nn(i,t)}))}static ss(){return new Rt(2)}static es(){return new Rt(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 Xl=".";function ei(A,e){if(!KA(A))return"n/a";if(!ar(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?A.toString():("0000000000000000"+A.toString()).slice(-e)}class cn{constructor(e,t){if(t||(t=1),KA(e)&&ar(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 i=Math.floor(e),r="";const n=this._s!==void 0?this._s:NaN;if(t>1){let s=+(Math.round(e*t)-i*t).toFixed(this._s);s>=t&&(s-=t,i+=1),r=Xl+ei(+s.toFixed(this._s)*this.rs,n)}else i=Math.round(i*t)/t,n>0&&(r=Xl+ei(0,n));return i.toFixed(0)+r}}class Jl extends cn{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class $f{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 i=Math.pow(10,this.us);return t=(e=Math.round(e*i)/i)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),t.replace(/(\.[1-9]*)0+$/,((r,n)=>n))}}function Zl(A,e,t,i,r,n,s){if(e.length===0||i.from>=e.length||i.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=A,h=e[i.from];let m=n(A,h),v=h;if(i.to-i.from<2){const x=r/2;o.beginPath();const F={nt:h.nt-x,st:h.st},T={nt:h.nt+x,st:h.st};o.moveTo(F.nt*l,F.st*c),o.lineTo(T.nt*l,T.st*c),s(A,m,F,T)}else{const x=(T,S)=>{s(A,m,v,S),o.beginPath(),m=T,v=S};let F=v;o.beginPath(),o.moveTo(h.nt*l,h.st*c);for(let T=i.from+1;T<i.to;++T){F=e[T];const S=n(A,F);switch(t){case 0:o.lineTo(F.nt*l,F.st*c);break;case 1:o.lineTo(F.nt*l,e[T-1].st*c),S!==m&&(x(S,F),o.lineTo(F.nt*l,e[T-1].st*c)),o.lineTo(F.nt*l,F.st*c);break;case 2:{const[I,Q]=Xf(e,T-1,T);o.bezierCurveTo(I.nt*l,I.st*c,Q.nt*l,Q.st*c,F.nt*l,F.st*c);break}}t!==1&&S!==m&&(x(S,F),o.moveTo(F.nt*l,F.st*c))}(v!==F||v===F&&t===1)&&s(A,m,v,F)}}const Yl=6;function Ao(A,e){return{nt:A.nt-e.nt,st:A.st-e.st}}function ql(A,e){return{nt:A.nt/e,st:A.st/e}}function Xf(A,e,t){const i=Math.max(0,e-1),r=Math.min(A.length-1,t+1);var n,s;return[(n=A[e],s=ql(Ao(A[t],A[i]),Yl),{nt:n.nt+s.nt,st:n.st+s.st}),Ao(A[t],ql(Ao(A[r],A[e]),Yl))]}function Jf(A,e,t,i,r){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(r.nt*s,A*o),n.lineTo(i.nt*s,A*o),n.closePath(),n.fillStyle=t,n.fill()}class jl extends LA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:i,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 h=e.context;h.lineCap="butt",h.lineJoin="round",h.lineWidth=s,xi(h,o),h.lineWidth=1,Zl(e,i,l,r,n,this.bs.bind(this),Jf.bind(null,c))}}function io(A,e,t){return Math.min(Math.max(A,e),t)}function hn(A,e,t){return e-A<=t}function ec(A){const e=Math.ceil(A);return e%2==0?e-1:e}class ro{ws(e,t){const i=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||i===void 0||i.Ms!==r||i.xs!==n||i.Ss!==s||i.ks!==o||i.vs!==c||i.ys!==l){const h=e.context.createLinearGradient(0,0,0,l);if(h.addColorStop(0,r),c!=null){const m=io(c*e.verticalPixelRatio/l,0,1);h.addColorStop(m,n),h.addColorStop(m,s)}h.addColorStop(1,o),this.Cs=h,this.gs=t}return this.Cs}}class Zf extends jl{constructor(){super(...arguments),this.Ts=new ro}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function Yf(A,e){const t=A.context;t.strokeStyle=e,t.stroke()}class tc extends LA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:i,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(i===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,xi(c,o),c.lineJoin="round";const h=this.Vs.bind(this);n!==void 0&&Zl(e,t,n,i,r,h,Yf),l&&(function(m,v,x,F,T){const{horizontalPixelRatio:S,verticalPixelRatio:I,context:Q}=m;let N=null;const J=Math.max(1,Math.floor(S))%2/2,H=x*I+J;for(let z=F.to-1;z>=F.from;--z){const re=v[z];if(re){const q=T(m,re);q!==N&&(Q.beginPath(),N!==null&&Q.fill(),Q.fillStyle=q,N=q);const ie=Math.round(re.nt*S)+J,G=re.st*I;Q.moveTo(ie,G),Q.arc(ie,G,H,0,2*Math.PI)}}Q.fill()})(e,t,l,i,h)}}class Ac extends tc{Vs(e,t){return t.lt}}function ic(A,e,t,i,r=0,n=e.length){let s=n-r;for(;0<s;){const o=s>>1,l=r+o;i(e[l],t)===A?(r=l+1,s-=o+1):s=o}return r}const hr=ic.bind(null,!0),rc=ic.bind(null,!1);function qf(A,e){return A.ot<e}function jf(A,e){return e<A.ot}function nc(A,e,t){const i=e.Os(),r=e.ui(),n=hr(A,i,qf),s=rc(A,r,jf);if(!t)return{from:n,to:s};let o=n,l=s;return n>0&&n<A.length&&A[n].ot>=i&&(o=n-1),s>0&&s<A.length&&A[s-1].ot<=r&&(l=s+1),{from:o,to:l}}class no{constructor(e,t,i){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=t,this.Fs=i}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 i=t.Xs();if(i===null||this.Es.In().Ks()===0)return;const r=this.Es.Ct();r!==null&&(this.Ls=nc(this.zs,i,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class un extends no{constructor(e,t){super(e,t,!0)}Gs(e,t,i){t.Qs(this.zs,cr(this.Ls)),e.te(this.zs,i,cr(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 i=t.Vt[3];return this.se(t.ee,i,e)}))}}class eg extends un{constructor(e,t){super(e,t),this.js=new eo,this.re=new Zf,this.he=new Ac,this.js.Z([this.re,this.he])}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$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 tg extends LA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){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),h=c-l,m=this.oe,v=h+m-1,x=Math.min(o.de,o.fe),F=Math.max(o.de,o.fe),T=Math.round(x*i)-l,S=Math.round(F*i)+l,I=Math.max(S-T,this.oe);e.fillRect(h,T,m,I);const Q=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-Q;let re=Math.max(T,Math.round(o.pe*i)-l),q=re+m-1;q>T+I-1&&(q=T+I-1,re=q-m+1),e.fillRect(z,re,h-z,q-re+1)}const N=c+Q;let J=Math.max(T,Math.round(o.me*i)-l),H=J+m-1;H>T+I-1&&(H=T+I-1,J=H-m+1),e.fillRect(v+1,J,N-v,H-J+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(i,r){return Math.floor(.3*i*r)})(Fe(this.zt).le,e)))}}class sc extends no{constructor(e,t){super(e,t,!1)}Gs(e,t,i){t.Qs(this.zs,cr(this.Ls)),e.be(this.zs,i,cr(this.Ls))}we(e,t,i){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 Ag extends sc{constructor(){super(...arguments),this.js=new tg}se(e,t,i){return Object.assign(Object.assign({},this.we(e,t,i)),i.$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 ig extends jl{constructor(){super(...arguments),this.Ts=new ro}bs(e,t){const i=this.G;return this.Ts.ws(e,{Ms:t.ke,xs:t.ye,Ss:t.Ce,ks:t.Te,ys:e.bitmapSize.height,vs:i.vs})}}class rg extends tc{constructor(){super(...arguments),this.Pe=new ro}Vs(e,t){const i=this.G;return this.Pe.ws(e,{Ms:t.Re,xs:t.Re,Ss:t.De,ks:t.De,ys:e.bitmapSize.height,vs:i.vs})}}class ng extends un{constructor(e,t){super(e,t),this.js=new eo,this.Ve=new ig,this.Oe=new rg,this.js.Z([this.Ve,this.Oe])}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const t=this.Es.W(),i=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:i,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:i,tt:this.Ls,ds:r})}}class sg extends LA{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),h=Math.min(l,c);return Math.max(Math.floor(s),h)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const i=this.zt.In;this.zt.Be&&this.Ae(e,i,this.zt.tt),this.zt._i&&this.Ie(e,i,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,i,this.zt.tt)}Ae(e,t,i){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 h=null;for(let m=i.from;m<i.to;m++){const v=t[m];v.Ee!==o&&(r.fillStyle=v.Ee,o=v.Ee);const x=Math.round(Math.min(v.pe,v.me)*s),F=Math.round(Math.max(v.pe,v.me)*s),T=Math.round(v.de*s),S=Math.round(v.fe*s);let I=Math.round(n*v.nt)-c;const Q=I+l-1;h!==null&&(I=Math.max(h+1,I),I=Math.min(I,Q));const N=Q-I+1;r.fillRect(I,T,N,x-T),r.fillRect(I,F+1,N,S-F),h=Q}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const i=Math.max(Math.floor(e),t);return this.ae<=2*i?Math.max(Math.floor(e),Math.floor(1*e)):i}Ie(e,t,i){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 h=i.from;h<i.to;h++){const m=t[h];m.Ne!==o&&(r.fillStyle=m.Ne,o=m.Ne);let v=Math.round(m.nt*n)-Math.floor(.5*this.ae);const x=v+this.ae-1,F=Math.round(Math.min(m.pe,m.me)*s),T=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(v=Math.max(c+1,v),v=Math.min(v,x)),this.zt.le*n>2*l)zf(r,v,F,x-v+1,T-F+1,l);else{const S=x-v+1;r.fillRect(v,F,S,T-F+1)}c=x}}Le(e,t,i){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=i.from;c<i.to;c++){const h=t[c];let m=Math.round(Math.min(h.pe,h.me)*s),v=Math.round(Math.max(h.pe,h.me)*s),x=Math.round(h.nt*n)-Math.floor(.5*this.ae),F=x+this.ae-1;if(h.ce!==o){const T=h.ce;r.fillStyle=T,o=T}this.zt._i&&(x+=l,m+=l,F-=l,v-=l),m>v||r.fillRect(x,m,F-x+1,v-m+1)}}}class og extends sc{constructor(){super(...arguments),this.js=new sg}se(e,t,i){return Object.assign(Object.assign({},this.we(e,t,i)),i.$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 ag{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,i){this.Fe.draw(e,this.Li,t,i)}}class so extends no{constructor(e,t,i){super(e,t,!1),this.wn=i,this.js=new ag(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,cr(this.Ls))}Js(){this.wn.update({bars:this.zs.map(lg),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function lg(A){return{x:A.nt,time:A.ot,originalData:A.He,barColor:A.ce}}class cg extends LA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){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(i)),n=Math.round(this.zt.Ye*i)-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],h=Math.round(l.st*i);let m,v;e.fillStyle=l.ce,h<=n?(m=h,v=s):(m=n,v=h-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,v-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)),i=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(i%2){const h=(i-1)/2;l=o-h,c=o+h}else{const h=i/2;l=o-h,c=o+h-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 hg extends un{constructor(){super(...arguments),this.js=new cg}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$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,Fe(this.Es.Ct()).Vt)};this.js.J(e)}}class ug extends un{constructor(){super(...arguments),this.js=new Ac}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$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 pg=/[2-9]/g;class ur{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,i){return this.sr(e,t,i).width}Mi(e,t,i){const r=this.sr(e,t,i);return((r.actualBoundingBoxAscent||0)-(r.actualBoundingBoxDescent||0))/2}sr(e,t,i){const r=i||pg,n=String(t).replace(r,"0");if(this.tr.has(n))return rA(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 dg{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,t,i){this.hr=e,this.k=t,this.lr=i}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class oc{constructor(e,t,i){this.ur=e,this.ar=new ur(50),this.cr=t,this.F=i,this.j=-1,this.Wt=new dg(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 i=e.mr(t);if(i==="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,i),this.Wt}}class fg extends LA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var i;if(!(!((i=this.zt)===null||i===void 0)&&i.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:i,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*i),xi(e,this.zt.Nt),kl(e,n,0,t.width))}}class oo{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new fg,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 gg extends oo{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 i=this.Es.W();if(!i.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=i.baseLineColor,this.Sr.et=i.baseLineWidth,this.Sr.Nt=i.baseLineStyle)}}class mg extends LA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){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*i;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 wg=[{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 ac(A,e,t,i){return(function(r,n){if(r==="transparent")return r;const s=or(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(A,t+(i-t)*e)}function lc(A,e){const t=A%2600/2600;let i;for(const l of wg)if(t>=l.Vr&&t<=l.Or){i=l;break}ai(i!==void 0,"Last price animation internal logic error");const r=(t-i.Vr)/(i.Or-i.Vr);return{Rr:ac(e,r,i.Ir,i.zr),Dr:ac(e,r,i.Lr,i.Er),ht:(n=r,s=i.Br,o=i.Ar,s+(o-s)*n)};var n,s,o}class Bg{constructor(e){this.Wt=new mg,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(),i=this.jr.Ct();if(t===null||i===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,i.Vt)},s=r.V,o=this.jr.W().lineWidth,l=lc(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=lc(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 pr(A,e){return ec(Math.min(Math.max(A,12),30)*e)}function dr(A,e){switch(A){case"arrowDown":case"arrowUp":return pr(e,1);case"circle":return pr(e,.8);case"square":return pr(e,.7)}}function cc(A){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(pr(A,1))}function hc(A){return Math.max(pr(A,.1),3)}function uc(A,e,t){return e?A:t?Math.ceil(A/2):0}function pc(A,e,t,i,r){const n=dr("square",t),s=(n-1)/2,o=A-s,l=e-s;return i>=o&&i<=o+n&&r>=l&&r<=l+n}function dc(A,e,t,i){const r=(dr("arrowUp",i)-1)/2*t.Jr,n=(ec(i/2)-1)/2*t.Jr;e.beginPath(),A?(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 yg(A,e,t,i,r,n){return pc(e,t,i,r,n)}class Cg extends LA{constructor(){super(...arguments),this.zt=null,this.ar=new ur,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=Oi(e,t),this.ar.nr())}wr(e,t){if(this.zt===null||this.zt.tt===null)return null;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const r=this.zt.it[i];if(Tg(r,e,t))return{Mr:r.th,gr:r.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i},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),vg(o,e,t,i)}}}}function vg(A,e,t,i){e.fillStyle=A.V,A.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,A.Kt.ih,A.Kt.nt,A.Kt.st,t,i),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void dc(!1,n,s,r.Ks);case"arrowUp":return void dc(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const h=(dr("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,h*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const h=dr("square",c),m=(h-1)*l.Jr/2,v=l.nt-m,x=l.st-m;o.fillRect(v,x,h*l.Jr,h*l.Jr)})(n,s,r.Ks)}r.nh}})(A,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}})(A,t,i))}function Tg(A,e,t){return!(A.Kt===void 0||!(function(i,r,n,s,o,l){const c=s/2;return o>=i&&o<=i+n&&l>=r-c&&l<=r+c})(A.Kt.nt,A.Kt.st,A.Kt.Hi,A.Kt.At,e,t))||(function(i,r,n){if(i.Ks===0)return!1;switch(i.nh){case"arrowDown":case"arrowUp":return yg(0,i.nt,i.st,i.Ks,r,n);case"circle":return(function(s,o,l,c,h){const m=2+dr("circle",l)/2,v=s-c,x=o-h;return Math.sqrt(v*v+x*x)<=m})(i.nt,i.st,i.Ks,r,n);case"square":return pc(i.nt,i.st,i.Ks,r,n)}})(A,e,t)}function bg(A,e,t,i,r,n,s,o,l){const c=KA(t)?t:t.Se,h=KA(t)?t:t.Me,m=KA(t)?t:t.xe,v=KA(e.size)?Math.max(e.size,0):1,x=cc(o.le())*v,F=x/2;switch(A.Ks=x,e.position){case"inBar":return A.st=s.Rt(c,l),void(A.Kt!==void 0&&(A.Kt.st=A.st+F+n+.6*r));case"aboveBar":return A.st=s.Rt(h,l)-F-i.sh,A.Kt!==void 0&&(A.Kt.st=A.st-F-.6*r,i.sh+=1.2*r),void(i.sh+=x+n);case"belowBar":return A.st=s.Rt(m,l)+F+i.eh,A.Kt!==void 0&&(A.Kt.st=A.st+F+n+.6*r,i.eh+=1.2*r),void(i.eh+=x+n)}e.position}class xg{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Cg,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=hc(e),i=1.5*cc(e)+2*t,r=this.fh();this.ah={above:uc(i,r.aboveBar,r.inBar),below:uc(i,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(),i=this.jr.dh();this.rh&&(this.zt.it=i.map((h=>({ot:h.time,nt:0,st:0,Ks:0,nh:h.shape,V:h.color,th:h.th,gr:h.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=hc(t.le()),c={sh:l,eh:l};this.zt.tt=nc(this.zt.it,n,!0);for(let h=this.zt.tt.from;h<this.zt.tt.to;h++){const m=i[h];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const v=this.zt.it[h];v.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(v.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const x=this.jr.ph(m.time);x!==null&&bg(v,m,x,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Qg extends oo{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 i=this.Es.Zr(t.priceLineSource===0);i.Xr||(e.yt=!0,e.st=i.ki,e.V=this.Es.mh(i.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class Fg extends an{constructor(e){super(),this.jt=e}zi(e,t,i){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 h=r.mh(c.V),m=nn(h);i.t=m.t,i.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=h,e.V=m.i,t.V=m.i}gh(e,t,i,r){let n="";const s=this.jt.bh();return i&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,i){return t?i?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function fc(A,e,t,i){const r=Number.isFinite(e),n=Number.isFinite(t);return r&&n?A(e,t):r||n?r?e:t:i}class hA{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 hA(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 hA(fc(Math.min,this.Ph(),e.Ph(),-1/0),fc(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!KA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let i=this.yh-t,r=this.kh-t;i*=e,r*=e,this.yh=t+i,this.kh=t+r}Oh(e){KA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new hA(e.minValue,e.maxValue)}}class pn{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 pn(hA.Ah(e.priceRange),e.margins)}}class Ug extends oo{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 i=this.Nh.Fh();i!==null&&(e.yt=!0,e.st=i,e.V=t.color,e.et=t.lineWidth,e.Nt=t.lineStyle,e.gr=this.Nh.W().id)}}class Sg extends an{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,i){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=nn(r.axisLabelColor||r.color);i.t=c.t;const h=r.axisLabelTextColor||c.i;e.V=h,t.V=h,i.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Eg{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Ug(e,this),this.ur=new Sg(e,this),this.Hh=new oc(this.ur,e,e.$t())}$h(e){EA(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 i=e.Ct();return i===null?null:t.Rt(this.cn.price,i.Vt)}}class Lg extends to{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Mg={Bar:(A,e,t,i)=>{var r;const n=e.upColor,s=e.downColor,o=Fe(A(t,i)),l=ki(o.Vt[0])<=ki(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(A,e,t,i)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,h=e.borderDownColor,m=e.wickUpColor,v=e.wickDownColor,x=Fe(A(t,i)),F=ki(x.Vt[0])<=ki(x.Vt[3]);return{ce:(r=x.V)!==null&&r!==void 0?r:F?o:l,Ne:(n=x.Ot)!==null&&n!==void 0?n:F?c:h,Ee:(s=x.Xh)!==null&&s!==void 0?s:F?m:v}},Custom:(A,e,t,i)=>{var r;return{ce:(r=Fe(A(t,i)).V)!==null&&r!==void 0?r:e.color}},Area:(A,e,t,i)=>{var r,n,s,o;const l=Fe(A(t,i));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:(A,e,t,i)=>{var r,n,s,o,l,c;const h=Fe(A(t,i));return{ce:h.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=h.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=h.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=h.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=h.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=h.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=h.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(A,e,t,i)=>{var r,n;const s=Fe(A(t,i));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(A,e,t,i)=>{var r;return{ce:(r=Fe(A(t,i)).V)!==null&&r!==void 0?r:e.color}}};class Hg{constructor(e){this.Kh=(t,i)=>i!==void 0?i.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Mg[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var gc;(function(A){A[A.NearestLeft=-1]="NearestLeft",A[A.None=0]="None",A[A.NearestRight=1]="NearestRight"})(gc||(gc={}));const li=30;class Ig{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 i=this.hl(e,t);return i===null?null:Object.assign(Object.assign({},this.al(i)),{ee:this.rl(i)})}ne(){return this.tl}ol(e,t,i){if(this.Ni())return null;let r=null;for(const n of i)r=dn(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 i=this.ul(e);if(i===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 i}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 hr(this.tl,e,((t,i)=>t.ee<i))}vl(e){return rc(this.tl,e,((t,i)=>t.ee>i))}pl(e,t,i){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[i];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,i){if(this.Ni())return null;let r=null;const n=Fe(this.el()),s=Fe(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/li)*li,h=Math.max(c,Math.floor(l/li)*li);{const v=this.fl(o),x=this.vl(Math.min(l,c,t));r=dn(r,this.pl(v,x,i))}let m=this.il.get(i);m===void 0&&(m=new Map,this.il.set(i,m));for(let v=Math.max(c+1,o);v<h;v+=li){const x=Math.floor(v/li);let F=m.get(x);if(F===void 0){const T=this.fl(x*li),S=this.vl((x+1)*li-1);F=this.pl(T,S,i),m.set(x,F)}r=dn(r,F)}{const v=this.fl(h),x=this.vl(l);r=dn(r,this.pl(v,x,i))}return r}}function dn(A,e){return A===null?e:e===null?A:{ml:Math.min(A.ml,e.ml),bl:Math.max(A.bl,e.bl)}}class Pg{constructor(e){this.wl=e}X(e,t,i){this.wl.draw(e)}gl(e,t,i){var r,n;(n=(r=this.wl).drawBackground)===null||n===void 0||n.call(r,e)}}class ao{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 i=new Pg(t);return this.tr={Ml:t,xl:i},i}Sl(){var e,t,i;return(i=(t=(e=this.wn).zOrder)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:"normal"}}function mc(A){var e,t,i,r,n;return{Kt:A.text(),ki:A.coordinate(),Si:(e=A.fixedCoordinate)===null||e===void 0?void 0:e.call(A),V:A.textColor(),t:A.backColor(),yt:(i=(t=A.visible)===null||t===void 0?void 0:t.call(A))===null||i===void 0||i,hi:(n=(r=A.tickVisible)===null||r===void 0?void 0:r.call(A))===null||n===void 0||n}}class Dg{constructor(e,t){this.Wt=new Rl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},mc(this.kl))),this.Wt}}class _g extends an{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,i){const r=mc(this.kl);i.t=r.t,e.V=r.V;const n=2/12*this.Li.P();i.wi=n,i.gi=n,i.ki=r.ki,i.Si=r.Si,e.Kt=r.Kt,e.yt=r.yt,e.hi=r.hi}}class kg{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,i,r;const n=(i=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Cl)===null||r===void 0?void 0:r.Ml)===n)return this.Cl.xl;const s=n.map((o=>new ao(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,t,i,r;const n=(i=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];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 Dg(l,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,i,r;const n=(i=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];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 _g(l,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,i,r;const n=(i=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Rl)===null||r===void 0?void 0:r.Ml)===n)return this.Rl.xl;const s=n.map((o=>new ao(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,t,i,r;const n=(i=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Dl)===null||r===void 0?void 0:r.Ml)===n)return this.Dl.xl;const s=n.map((o=>new ao(o)));return this.Dl={Ml:n,xl:s},s}Il(e,t){var i,r,n;return(n=(r=(i=this.Vl).autoscaleInfo)===null||r===void 0?void 0:r.call(i,e,t))!==null&&n!==void 0?n:null}wr(e,t){var i,r,n;return(n=(r=(i=this.Vl).hitTest)===null||r===void 0?void 0:r.call(i,e,t))!==null&&n!==void 0?n:null}}function lo(A,e,t,i){A.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&i.push(n)}))}))}function co(A){return A.Pn()}function Og(A){return A.Bl()}function Ng(A){return A.Al()}class ho extends Lg{constructor(e,t,i,r,n){super(e),this.zt=new Ig,this.jh=new Qg(this),this.zl=[],this.Ll=new gg(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=t,this.$l=i;const s=new Fg(this);this.rn=[s],this.Hh=new oc(s,this,e),i!=="Area"&&i!=="Line"&&i!=="Baseline"||(this.El=new Bg(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},i=this.Dt();if(this.$t().St().Ni()||i.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}),h=i.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:i.Fi(l,n.Vt),xh:i.Yl(l),Sh:i.Zl(l,n.Vt),V:c.ce,ki:h,ee:o}}Us(){return this.Nl!==null||(this.Nl=new Hg(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),EA(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 i=this.$t().dr(this);this.$t().ia(i),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 Eg(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=[];lo(this.Hl,co,"top",t);const i=this.El;return i!==null&&i.yt()&&(this.jl===null&&i.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),i.Ur(),t.unshift(i)),t}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const t=this.zl.map((i=>i.qh()));return e.push(...t),lo(this.Hl,co,"normal",e),e}ua(){return this.ca(co,"bottom")}da(e){return this.ca(Og,e)}fa(e){return this.ca(Ng,e)}va(e,t){return this.Hl.map((i=>i.wr(e,t))).filter((i=>i!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const i=[...this.rn];for(const r of this.zl)i.push(r.Zh());return this.Hl.forEach((r=>{i.push(...r.Rn())})),i}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const i=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return pn.Ah(i)}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 Fe(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 kg(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof so)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof so)return e=>this.wn.je(e)}_a(){return!ln(this.Dt().Pa())}pa(e,t){if(!ar(e)||!ar(t)||this.zt.Ni())return null;const i=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],r=this.zt.ol(e,t,i);let n=r!==null?new hA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new hA(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 x=new hA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(x):x}var c,h,m,v;l?.margins&&(c=s,h=l.margins,s={above:Math.max((m=c?.above)!==null&&m!==void 0?m:0,h.above),below:Math.max((v=c?.below)!==null&&v!==void 0?v:0,h.below)})})),new pn(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 $f(this.cn.priceFormat.precision);break;case"percent":this.wa=new Jl(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new cn(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=Fe(this.zt.el());this.Wl=this.Fl.map(((i,r)=>{const n=Fe(e.Va(i.time,!0)),s=n<t?1:-1;return{time:Fe(this.zt.ll(n,s)).ee,position:i.position,shape:i.shape,color:i.color,id:i.id,th:r,text:i.text,size:i.size,originalTime:i.originalTime}}))}ql(e){switch(this.dn=new xg(this,this.$t()),this.$l){case"Bar":this.wn=new Ag(this,this.$t());break;case"Candlestick":this.wn=new og(this,this.$t());break;case"Line":this.wn=new ug(this,this.$t());break;case"Custom":this.wn=new so(this,this.$t(),rA(e));break;case"Area":this.wn=new eg(this,this.$t());break;case"Baseline":this.wn=new ng(this,this.$t());break;case"Histogram":this.wn=new hg(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const i=[];return lo(this.Hl,e,t,i),i}}class Kg{constructor(e){this.cn=e}Oa(e,t,i){let r=e;if(this.cn.mode===0)return r;const n=i.vn(),s=n.Ct();if(s===null)return r;const o=n.Rt(e,s),l=i.Ba().filter((h=>h instanceof ho)).reduce(((h,m)=>{if(i.vr(m)||!m.yt())return h;const v=m.Dt(),x=m.In();if(v.Ni()||!x.Kr(t))return h;const F=x.Gh(t);if(F===null)return h;const T=ki(m.Ct());return h.concat([v.Rt(F.Vt[3],T.Vt)])}),[]);if(l.length===0)return r;l.sort(((h,m)=>Math.abs(h-o)-Math.abs(m-o)));const c=l[0];return r=n.pn(c,s),r}}class zg extends LA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:i,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(i));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Fe(this.zt);if(s.Aa){e.strokeStyle=s.Ia,xi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*i);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,xi(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 Vg{constructor(e){this.Wt=new zg,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((i=>({Ea:i.coord})))};this.Wt.J(t),this.ft=!1}return this.Wt}}class Wg{constructor(e){this.wn=new Vg(e)}qh(){return this.wn}}const uo={$a:4,Ua:1e-4};function Ni(A,e){const t=100*(A-e)/e;return e<0?-t:t}function Gg(A,e){const t=Ni(A.Ph(),e),i=Ni(A.Rh(),e);return new hA(t,i)}function fr(A,e){const t=100*(A-e)/e+100;return e<0?-t:t}function Rg(A,e){const t=fr(A.Ph(),e),i=fr(A.Rh(),e);return new hA(t,i)}function fn(A,e){const t=Math.abs(A);if(t<1e-15)return 0;const i=Math.log10(t+e.Ua)+e.$a;return A<0?-i:i}function gr(A,e){const t=Math.abs(A);if(t<1e-15)return 0;const i=Math.pow(10,t-e.$a)-e.Ua;return A<0?-i:i}function mr(A,e){if(A===null)return null;const t=fn(A.Ph(),e),i=fn(A.Rh(),e);return new hA(t,i)}function gn(A,e){if(A===null)return null;const t=gr(A.Ph(),e),i=gr(A.Rh(),e);return new hA(t,i)}function po(A){if(A===null)return uo;const e=Math.abs(A.Rh()-A.Ph());if(e>=1||e<1e-15)return uo;const t=Math.ceil(Math.abs(Math.log10(e))),i=uo.$a+t;return{$a:i,Ua:1/Math.pow(10,i)}}class fo{constructor(e,t){if(this.qa=e,this.Ya=t,(function(i){if(i<0)return!1;for(let r=i;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 i=this.qa;i!==1;){if(i%2==0)this.Za.push(2),i/=2;else{if(i%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),i/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,i){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=hn(n,r,1e-14)&&n>r+1e-14,v=hn(n,i*o,1e-14),x=hn(n,1,1e-14);if(!(m&&v&&x))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,h=1e-14,Math.abs(l-c)<h))for(s=0,o=this.Za[0];hn(n,i*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,h;return n}}class wc{constructor(e,t,i,r){this.Ka=[],this.Li=e,this.qa=t,this.Ga=i,this.Ja=r}Xa(e,t){if(e<t)throw new Error("high < low");const i=this.Li.At(),r=(e-t)*this.Qa()/i,n=new fo(this.qa,[2,2.5,2]),s=new fo(this.qa,[2,2,2.5]),o=new fo(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 h=c[0];for(let m=1;m<c.length;++m)c[m]<h&&(h=c[m]);return h})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const i=e.At(),r=this.Ga(i-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=i-1-s,c=Math.max(r,n),h=Math.min(r,n);if(c===h)return void(this.Ka=[]);let m=this.Xa(c,h),v=c%m;v+=v<0?m:0;const x=c>=h?1:-1;let F=null,T=0;for(let S=c-v;S>h;S-=m){const I=this.Ja(S,t,!0);F!==null&&Math.abs(I-F)<this.Qa()||I<o||I>l||(T<this.Ka.length?(this.Ka[T].Ea=I,this.Ka[T].so=e.eo(S)):this.Ka.push({Ea:I,so:e.eo(S)}),T++,F=I,e.ro()&&(m=this.Xa(S*x,h)))}this.Ka.length=T}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Bc(A){return A.slice().sort(((e,t)=>Fe(e.Xi())-Fe(t.Xi())))}var yc;(function(A){A[A.Normal=0]="Normal",A[A.Logarithmic=1]="Logarithmic",A[A.Percentage=2]="Percentage",A[A.IndexedTo100=3]="IndexedTo100"})(yc||(yc={}));const Cc=new Jl,vc=new cn(100,1);class $g{constructor(e,t,i,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 Ht,this.vo=new Ht,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=vc,this.xo=po(null),this.So=e,this.cn=t,this.ko=i,this.yo=r,this.Co=new wc(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(EA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=rA(e.scaleMargins.top),i=rA(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(i<0||i>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${i}`);if(t+i>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+i}`);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 i=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=gr(n.Ph(),s),l=gr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(i=gn(this.Ih,this.xo),i!==null&&this.Ao(i)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(i=mr(this.Ih,this.xo),i!==null&&this.Ao(i));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 i=this.Ih;(t||i===null&&e!==null||i!==null&&!i.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=fr(e,t)),this.Po(e,t)}te(e,t,i){this.Wo();const r=this.Fo(),n=Fe(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),m=i===void 0?0:i.from,v=i===void 0?e.length:i.to,x=this.Ho();for(let F=m;F<v;F++){const T=e[F],S=T._t;if(isNaN(S))continue;let I=S;x!==null&&(I=x(T._t,t));const Q=r+h*(I-s),N=c?Q:this.ho-1-Q;T.st=N}}be(e,t,i){this.Wo();const r=this.Fo(),n=Fe(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),m=i===void 0?0:i.from,v=i===void 0?e.length:i.to,x=this.Ho();for(let F=m;F<v;F++){const T=e[F];let S=T.ge,I=T.Me,Q=T.xe,N=T.Se;x!==null&&(S=x(T.ge,t),I=x(T.Me,t),Q=x(T.xe,t),N=x(T.Se,t));let J=r+h*(S-s),H=c?J:this.ho-1-J;T.pe=H,J=r+h*(I-s),H=c?J:this.ho-1-J,T.de=H,J=r+h*(Q-s),H=c?J:this.ho-1-J,T.fe=H,J=r+h*(N-s),H=c?J:this.ho-1-J,T.me=H}}pn(e,t){const i=this.To(e,t);return this.$o(i,t)}$o(e,t){let i=e;return this.Mh()?i=(function(r,n){return n<0&&(r=-r),r/100*n+n})(i,t):this.Oo()&&(i=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(i,t)),i}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const i=this.po[t];i.Xi()===null&&i.Ki(t+1),e.push(i)}return e=Bc(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 i=t.Ct();i!==null&&(e===null||i.la<e.la)&&(e=i)}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=Fe(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 i=Fe(this.ao).Th();t=Math.max(t,.1),i.Vh(t),this.Ao(i)}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=Fe(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Fe(this.Lh()).Dh()/(this.Eo()-1);let i=e-this.Mo;this.Bo()&&(i*=-1);const r=i*t,n=Fe(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(fr(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,Fe(this.e_()).ba())}Zl(e,t){return e=Ni(e,t),this.s_(e,Cc)}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=vc,this.Mh()?(this.wa=Cc,t=100):this.Oo()?(this.wa=new cn(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new wc(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?fn(e,this.xo):e;const i=Fe(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-i.Ph())/i.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const i=this.jo(e),r=Fe(this.Lh()),n=r.Ph()+r.Dh()*((i-this.Fo())/(this.Eo()-1));return this.ro()?gr(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 i=this.r_();let r=0,n=0;for(const l of i){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const h=l.Il(e.Os(),e.ui());let m=h&&h.Lh();if(m!==null){switch(this.cn.mode){case 1:m=mr(m,this.xo);break;case 2:m=Gg(m,c.Vt);break;case 3:m=Rg(m,c.Vt)}if(t=t===null?m:t.ts(Fe(m)),h!==null){const v=h.Eh();v!==null&&(r=Math.max(r,v.above),n=Math.max(n,v.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=gn(t,this.xo)),t=new hA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=mr(t,this.xo))}if(this.ro()){const l=gn(t,this.xo),c=po(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const h=this.ao!==null?gn(this.ao,this.xo):null;this.xo=c,t=mr(l,c),h!==null&&(this.ao=mr(h,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new hA(-.5,.5)),this.xo=po(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ni:this.Oo()?fr:this.ro()?e=>fn(e,this.xo):null}a_(e,t,i){return t===void 0?(i===void 0&&(i=this.ba()),i.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 Xg{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Ht,this.yl=e,this.$i=t,this.d_=new Wg(this);const i=t.W();this.f_=this.v_("left",i.leftPriceScale),this.p_=this.v_("right",i.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(i)}b_(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 i of t){const r=Fe(i[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)?rA(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 i=t.Dt();i!==null&&i.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,i){const r=i!==void 0?i:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ai(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const i=Fe(e.Dt()).Pa();if(this.o_.has(i)){const n=rA(this.o_.get(i)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(i))}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=Bc(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 i=this.yl.Xs();i!==null&&e.h_(i)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let t=0,i=0;for(let r=0;r<e.length;r++){const n=e[r].Xi();n!==null&&(n<t&&(t=n),n>i&&(i=n))}return{H_:t,y_:i}}T_(e,t,i){let r=this.w_(t);if(r===null&&(r=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!ln(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}r.qo(e),e.Gi(r),e.Ki(i),this.P_(r),this.mo=null}m_(e,t,i){t.Cr!==i.Cr&&this.L_(e)}v_(e,t){const i=Object.assign({visible:!0,autoScale:!0},jA(t)),r=new $g(e,i,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class Jg{constructor(e,t,i=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=i}Y_(e){const t=e.time,i=this.q_.cacheKey(t),r=this.tr.get(i);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(rA(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(i,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,i),this.Ke++,this.Ge++,n}}class wr{constructor(e,t){ai(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 Tc(A,e){return A===null||e===null?A===e:A.Ch(e)}class Zg{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 i=t;i<e.length;++i){const r=e[i];let n=this.J_.get(r.timeWeight);n===void 0&&(n=[],this.J_.set(r.timeWeight,n)),n.push({index:i,time:r.time,weight:r.timeWeight,originalTime:r.originalTime})}}su(e,t){const i=Math.ceil(t/e);return this.tr!==null&&this.tr.eu===i||(this.tr={Ha:this.ru(i),eu:i}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const t=[];this.J_.forEach(((i,r)=>{e<=i[0].index?t.push(r):i.splice(hr(i,e,(n=>n.index<e)),1/0)}));for(const i of t)this.J_.delete(i)}ru(e){let t=[];for(const i of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(i))continue;const r=t;t=[];const n=r.length;let s=0;const o=rA(this.J_.get(i)),l=o.length;let c=1/0,h=-1/0;for(let m=0;m<l;m++){const v=o[m],x=v.index;for(;s<n;){const F=r[s],T=F.index;if(!(T<x)){c=T;break}s++,t.push(F),h=T,c=1/0}if(c-x>=e&&x-h>=e)t.push(v),h=x;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 wr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Ki(null)}}function Yg(A,e){return A.weight>e.weight?A:e}class qg{constructor(e,t,i,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Zg,this.du=new Map,this.fu=Ki.ou(),this.vu=!0,this.pu=new Ht,this.mu=new Ht,this.bu=new Ht,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=i,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){EA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var i;EA(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((i=e.barSpacing)!==null&&i!==void 0?i:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var t,i;return(i=(t=this.uu[e])===null||t===void 0?void 0:t.time)!==null&&i!==void 0?i: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 i=hr(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[i].time)?t?i:null:i}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),i=Math.round(e.to),r=Fe(this.Bu()),n=Fe(this.Au());return{from:Fe(this.Ui(Math.max(r,t))),to:Fe(this.Ui(Math.min(n,i)))}}Iu(e){return{from:Fe(this.Va(e.from,!0)),to:Fe(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),i=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&i!==0){const r=this.Su*e/i;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=i-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!ar(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const i=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=i+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),i=Math.round(t/e),r=Fe(this.Xs()),n=Math.max(r.Os(),r.Os()-i),s=Math.max(r.ui(),r.ui()-i),o=this.cu.su(e,t),l=this.Bu()+i,c=this.Au()-i,h=this.$u(),m=this.cn.fixLeftEdge||h,v=this.cn.fixRightEdge||h;let x=0;for(const F of o){if(!(n<=F.index&&F.index<=s))continue;let T;x<this.Mu.length?(T=this.Mu[x],T.coord=this.It(F.index),T.label=this.Uu(F),T.weight=F.weight):(T={needAlignCoordinate:!1,coord:this.It(F.index),label:this.Uu(F),weight:F.weight},this.Mu.push(T)),this.Su>t/2&&!h?T.needAlignCoordinate=!1:T.needAlignCoordinate=m&&F.index<=l||v&&F.index>=c,x++}return this.Mu.length=x,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 i=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(i-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=io(this.__-e,0,this.__),i=io(this.__-Fe(this.wo),0,this.__);t!==0&&i!==0&&this.Gn(this.wu.le*t/i)}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=Fe(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 i=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:i+(e-i)*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 wr(e,t+this.cn.rightOffset))}lc(e){const t=new wr(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),i=this.Eu()+this.xu-t;return Math.round(1e6*i)/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,i=this.xu+e,r=new wr(i-t+1,i);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 Jg((i=>this.fc(i)),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,Tc(t.lu(),this.fu.lu())||this.pu.m(),Tc(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 i=t.Os()-e;if(i<0){const r=this.xu-i-1;this.Jn(r)}this.zu()}Pu(){this.Lu(),this.zu()}}class jg{X(e,t,i){e.useMediaCoordinateSpace((r=>this.K(r,t,i)))}gl(e,t,i){e.useMediaCoordinateSpace((r=>this.vc(r,t,i)))}vc(e,t,i){}}class e0 extends jg{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:t,mediaSize:i}=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>i.width?s.Zu=i.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((i.height-r)/2,0);break;case"bottom":n=Math.max(i.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=i.width/2;break;case"right":t.textAlign="right",o=i.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 i=this.kc(e.font);let r=i.get(t);return r===void 0&&(r=e.measureText(t).width,i.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 t0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new e0(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:Oi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class A0 extends to{constructor(e,t){super(),this.cn=t,this.wn=new t0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var bc,xc,Qc,Fc,Uc;(function(A){A[A.OnTouchEnd=0]="OnTouchEnd",A[A.OnNextTap=1]="OnNextTap"})(bc||(bc={}));class i0{constructor(e,t,i){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Ht,this.Rc=new Ht,this.Dc=null,this.Vc=e,this.cn=t,this.q_=i,this.Oc=new Pf(this),this.yl=new qg(this,t.timeScale,this.cn.localization,i),this.vt=new Rf(this,t.crosshair),this.Bc=new Kg(t.crosshair),this.Ac=new A0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Rt.es())}Uh(){this.Nc(Rt.ss())}oa(){this.Nc(new Rt(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){EA(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 i=this.Uc(e);i!==null&&(i.Dt.$h(t),this.Pc.m())}Uc(e){for(const t of this.yc){const i=t.w_(e);if(i!==null)return{Ht:t,Dt:i}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(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 Xg(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const i=e===void 0?this.yc.length-1:e,r=Rt.es();return r.Nn(i,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,i){e.V_(t,i)}O_(e,t,i){e.O_(t,i),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,i){t.Vo()||e.A_(t,i)}I_(e,t,i){t.Vo()||(e.I_(t,i),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 i=this.St();if(i.Ni()||t===0)return;const r=i.Hi();e=Math.max(1,Math.min(e,r)),i.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,i,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(),h=c.Ct();h!==null&&(s=c.pn(t,h)),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},i)}ad(e,t,i){const r=i.vn(),n=r.Ct(),s=r.Rt(e,Fe(n)),o=this.yl.Va(t,!0),l=this.yl.It(Fe(o));this.ld(l,s,null,i,!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(),i=this.vt.Sn();this.ld(t,i,null,e)}this.vt.Vn()}_d(e,t,i){const r=this.yl.mn(0);t!==void 0&&i!==void 0&&this.yl.bt(t,i);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),h=e!==null&&e>s&&!c,m=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,v=l&&(i!==void 0||m)&&this.yl.W().shiftVisibleRangeOnNewBar;if(h&&!v){const x=e-s;this.yl.Jn(this.yl.Hu()-x)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((i=>i.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,i){const r=this.yc[0],n=this.fd(t,e,r,i);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),i=this.Cc.indexOf(e);ai(i!==-1,"Series not found"),this.Cc.splice(i,1),Fe(t).Zo(e),e.S&&e.S()}Xl(e,t){const i=Fe(this.dr(e));i.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();i.qo(e,t,n)}else{const n=r.Ht===i?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Rt.ss();e.$n(),this.Nc(e)}pd(e){const t=Rt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Rt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Rt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Rt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Rt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Rt.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,i=this.zc;if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==i||this.Dc.Rs!==t)this.Dc={Ps:i,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,h,m]=or(n),[v,x,F,T]=or(s),S=[vA(l+o*(v-l)),vA(c+o*(x-c)),vA(h+o*(F-h)),Nl(m+o*(T-m))];return`rgba(${S[0]}, ${S[1]}, ${S[2]}, ${S[3]})`})(i,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const i=new Rt(t);if(e!==null){const r=this.yc.indexOf(e);i.Nn(r,{Fn:t})}return i}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,i,r){const n=new ho(this,e,t,i,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return i.qo(n,s),ln(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 go(A){return!KA(A)&&!lr(A)}function Sc(A){return KA(A)}(function(A){A[A.Disabled=0]="Disabled",A[A.Continuous=1]="Continuous",A[A.OnDataUpdate=2]="OnDataUpdate"})(xc||(xc={})),(function(A){A[A.LastBar=0]="LastBar",A[A.LastVisible=1]="LastVisible"})(Qc||(Qc={})),(function(A){A.Solid="solid",A.VerticalGradient="gradient"})(Fc||(Fc={})),(function(A){A[A.Year=0]="Year",A[A.Month=1]="Month",A[A.DayOfMonth=2]="DayOfMonth",A[A.Time=3]="Time",A[A.TimeWithSeconds=4]="TimeWithSeconds"})(Uc||(Uc={}));const Ec=A=>A.getUTCFullYear();function r0(A,e,t){return e.replace(/yyyy/g,(i=>ei(Ec(i),4))(A)).replace(/yy/g,(i=>ei(Ec(i)%100,2))(A)).replace(/MMMM/g,((i,r)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(r,{month:"long"}))(A,t)).replace(/MMM/g,((i,r)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(r,{month:"short"}))(A,t)).replace(/MM/g,(i=>ei((r=>r.getUTCMonth()+1)(i),2))(A)).replace(/dd/g,(i=>ei((r=>r.getUTCDate())(i),2))(A))}class Lc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return r0(e,this.gd,this.Md)}}class n0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",ei(e.getUTCHours(),2)).replace("%m",ei(e.getUTCMinutes(),2)).replace("%s",ei(e.getUTCSeconds(),2))}}const s0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class o0{constructor(e={}){const t=Object.assign(Object.assign({},s0),e);this.Td=new Lc(t.Sd,t.Cd),this.Pd=new n0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function mn(A){return 60*A*60*1e3}function mo(A){return 60*A*1e3}const wn=[{Dd:(Mc=1,1e3*Mc),Vd:10},{Dd:mo(1),Vd:20},{Dd:mo(5),Vd:21},{Dd:mo(30),Vd:22},{Dd:mn(1),Vd:30},{Dd:mn(3),Vd:31},{Dd:mn(6),Vd:32},{Dd:mn(12),Vd:33}];var Mc;function Hc(A,e){if(A.getUTCFullYear()!==e.getUTCFullYear())return 70;if(A.getUTCMonth()!==e.getUTCMonth())return 60;if(A.getUTCDate()!==e.getUTCDate())return 50;for(let t=wn.length-1;t>=0;--t)if(Math.floor(e.getTime()/wn[t].Dd)!==Math.floor(A.getTime()/wn[t].Dd))return wn[t].Vd;return 0}function wo(A){let e=A;if(lr(A)&&(e=Bo(A)),!go(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 Ic(A){if(!Sc(A))throw new Error("time must be of type isUTCTimestamp");return{Od:A}}function Bo(A){const e=new Date(A);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${A}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function Pc(A){lr(A.time)&&(A.time=Bo(A.time))}class Dc{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 Fe((function(t){return t.length===0?null:go(t[0].time)||lr(t[0].time)?wo:Ic})(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 Sc(t=e)?Ic(t):go(t)?wo(t):wo(Bo(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new o0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Lc(t,e.locale)}formatHorzItem(e){const t=e;return this.Ad.Y_(new Date(1e3*t.Od))}formatTickmark(e,t){const i=(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,i,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,i,t.locale)}maxTickMarkWeight(e){let t=e.reduce(Yg,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(i,r=0){if(i.length===0)return;let n=r===0?null:i[r-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let l=r;l<i.length;++l){const c=i[l],h=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=Hc(h,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=h}if(r===0&&i.length>1){const l=Math.ceil(o/(i.length-1)),c=new Date(1e3*(i[0].time.Od-l));i[0].timeWeight=Hc(new Date(1e3*i[0].time.Od),c)}})(e,t)}static Id(e){return EA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const zi=typeof window<"u";function _c(){return!!zi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function yo(){return!!zi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Co(A){return A+A%2}function vo(A,e){return A.zd-e.zd}function To(A,e,t){const i=(A.zd-e.zd)/(A.ot-e.ot);return Math.sign(i)*Math.min(Math.abs(i),t)}class a0{constructor(e,t,i,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=i,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 i=0;const r=To(this.Ld,this.Ed,this.Ud),n=vo(this.Ld,this.Ed),s=[r],o=[n];if(i+=n,this.Nd!==null){const c=To(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const h=vo(this.Ed,this.Nd);if(s.push(c),o.push(h),i+=h,this.Fd!==null){const m=To(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const v=vo(this.Nd,this.Fd);s.push(m),o.push(v),i+=v}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/i*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,h){const m=Math.log(h);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Fe(this.Wd),i=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,i)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Fe(this.Wd).ot;return Math.min(t,this.jd)}}class l0{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 Kl(or(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 Qi(A,e){const t=Fe(A.ownerDocument).createElement("canvas");A.appendChild(t);const i=yf(t,{options:{allowResizeObserver:!1},transform:(r,n)=>({width:Math.max(r.width,n.width),height:Math.max(r.height,n.height)})});return i.resizeCanvasElement(e),i}function Fi(A){var e;A.width=1,A.height=1,(e=A.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function bo(A,e,t,i){A.gl&&A.gl(e,t,i)}function Bn(A,e,t,i){A.X(e,t,i)}function xo(A,e,t,i){const r=A(t,i);for(const n of r){const s=n.gt();s!==null&&e(s)}}function c0(A){zi&&window.chrome!==void 0&&A.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Qo{constructor(e,t,i){this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.df=null,this.ff=!1,this.vf=null,this.pf=null,this.mf=!1,this.bf=!1,this.wf=!1,this.gf=null,this.Mf=null,this.xf=null,this.Sf=null,this.kf=null,this.yf=null,this.Cf=null,this.Tf=0,this.Pf=!1,this.Rf=!1,this.Df=!1,this.Vf=0,this.Of=null,this.Bf=!yo(),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(zA(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(zA(r),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=t,this.cn=i,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 i=this.Ef(e);this.Uf(i,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=Fo(e.changedTouches,Fe(this.Of));if(t===null||(this.Vf=yn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const i=this.Ff(zA(t),Fe(this.pf)),{nv:r,sv:n,Nf:s}=i;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),Vi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(zA(e),Fe(this.vf)),{Nf:i}=t;if(i>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const i=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:i,sv:r,Nf:i+r}}ov(e){let t=Fo(e.changedTouches,Fe(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=yn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const i=this.Ef(e,t);if(this.Wf(i,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(zA(t),this.cf);r<30&&!this.wf&&this.Wf(i,this.Hf.jf),this.$f()}else this.wf||(this.Wf(i,this.Hf.uv),this.Hf.uv&&Vi(e));this._f===0&&Vi(e),e.touches.length===0&&this.ff&&(this.ff=!1,Vi(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),_c()&&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:i}=this.Ff(zA(e),this.af);i<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=yn(e);const i=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=zA(t),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{i.removeEventListener("touchmove",n),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",n,{passive:!1}),i.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=zA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;_c()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=zA(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 i=this.Ef(e);this.Uf(i,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=zA(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,t=i=>{this.Hf.wv&&(i.composed&&this.Zf.contains(i.composedPath()[0])||i.target&&this.Zf.contains(i.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})}yo()&&(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}),c0(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=kc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Vi(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=kc(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=!yo()}vv(e){const t=Fo(e.touches,Fe(this.Of));if(t===null)return;const i=this.Ef(e,t);this.Wf(i,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:yn(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 i=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,localX:i.clientX-r.left,localY:i.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:i.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Vi(e)}}}}function kc(A,e){const t=A.clientX-e.clientX,i=A.clientY-e.clientY;return Math.sqrt(t*t+i*i)}function Vi(A){A.cancelable&&A.preventDefault()}function zA(A){return{nt:A.pageX,st:A.pageY}}function yn(A){return A.timeStamp||performance.now()}function Fo(A,e){for(let t=0;t<A.length;++t)if(A[t].identifier===e)return A[t];return null}function Cn(A){return{Hc:A.Hc,Iv:{gr:A.zv.externalId},Lv:A.zv.cursorStyle}}function h0(A,e,t){for(const i of A){const r=i.gt();if(r!==null&&r.wr){const n=r.wr(e,t);if(n!==null)return{Bv:i,Iv:n}}}return null}function Uo(A,e){return t=>{var i,r,n,s;return((r=(i=t.Dt())===null||i===void 0?void 0:i.Pa())!==null&&r!==void 0?r:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,A))!==null&&s!==void 0?s:[]}}function Oc(A,e,t,i){if(!A.length)return;let r=0;const n=t/2,s=A[0].At(i,!0);let o=e===1?n-(A[0].Vi()-s/2):A[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<A.length;l++){const c=A[l],h=A[l-1],m=h.At(i,!1),v=c.Vi(),x=h.Vi();if(e===1?v>x-m:v<x+m){const F=x-m*e;c.Oi(F);const T=F-e*m/2;if((e===1?T<0:T>t)&&o>0){const S=e===1?-1-T:T-t,I=Math.min(S,o);for(let Q=r;Q<A.length;Q++)A[Q].Oi(A[Q].Vi()+e*I);o-=I}}else r=l,o=e===1?x-m-v:v-(x+m)}}class Nc{constructor(e,t,i,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new ur(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=i,this.qv=r==="left",this.Yv=Uo("normal",r),this.Zv=Uo("top",r),this.Xv=Uo("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=Qi(this.Kv,Ft({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=Qi(this.Kv,Ft({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 Qo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Fi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(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(),i=Fe(this.Gv.canvasElement.getContext("2d"));i.save();const r=this.Li.Ha();i.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(i,r[0].so),this.Fv.xi(i,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const h=this.Fv.xi(i,n[c].Kt());h>e&&(e=h)}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),h=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(i,this.Li.Fi(Math.floor(Math.min(c,h))+.11111111111111,s)),this.Fv.xi(i,this.Li.Fi(Math.ceil(Math.max(c,h))-.11111111111111,s)))}var o;i.restore();const l=e||34;return Co(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&Ti(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 Fe(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,Fe(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const i=bi(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(i,this.Xv),this.wp(i),this.tn.bp(i,this.Yv),this.gp(i))}this.Jv.applySuggestedBitmapSize();const t=bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:i,bitmapSize:r})=>{i.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}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(),i=this.tn.fp();this.Nv=!0,t.V_(i,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),i=this.tn.fp(),r=this.Li;t.O_(i,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),i=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,i))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!1,t.B_(i,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(i=>{for(let r=0;r<i.length;++r){const n=i[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:i,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?on(e,0,0,i,r,s):Wl(e,0,0,i,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:i}){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*i));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(),i=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;i.borderVisible&&i.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=i.borderColor;const c=Math.max(1,Math.floor(l)),h=Math.floor(.5*l),m=Math.round(r.T*o);s.beginPath();for(const v of t)s.rect(Math.floor(n*o),Math.round(v.Ea*l)-h,m,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=i.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((h=>this.Fv.Mi(s,h.so)));for(let h=t.length;h--;){const m=t[h];s.fillText(m.so,l,m.Ea+c[h])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),i=this.tn.fp(),r=this.ap();this.Li===i.pr()&&this.tn.fp().Uo().forEach((s=>{i.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(i,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 i=this.Ev.height/2,r=e.filter((s=>s.ki()<=i)),n=e.filter((s=>s.ki()>i));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)}Oc(r,1,this.Ev.height,t),Oc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),i=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Fe(this.Li)).X(e,i,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),i=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&i.push(n);const s=this.ap(),o=this.qv?"right":"left";i.forEach((l=>{l.forEach((c=>{c.gt(Fe(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 Oi(this.ko.fontSize,this.ko.fontFamily)}}function u0(A,e){var t,i;return(i=(t=A.ua)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}function vn(A,e){var t,i;return(i=(t=A.Pn)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}function p0(A,e){var t,i;return(i=(t=A.Ji)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}function d0(A,e){var t,i;return(i=(t=A.aa)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}class So{constructor(e,t){this.Ev=Ft({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Ht,this.Op=new Ht,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 i=document.createElement("div");i.style.width="100%",i.style.height="100%",i.style.position="relative",i.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(i),this.Gv=Qi(i,Ft({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=Qi(i,Ft({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 Qo(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),Fi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Fe(this.Np)}qp(e){var t,i;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(So.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 l0(this.Wp,this.Qd),this.Pp.bt()):((i=this.Pp)===null||i===void 0||i.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(Fe(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Fe(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,i=e.localY;this.Gp(t,i,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 i=e.localX,r=e.localY;this.Gp(i,r,e);const n=this.wr(i,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 i=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,i)}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,i=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Fe(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(i-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 i=this.Np;return i===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,h,m){var v,x;let F,T;for(const Q of c){const N=(x=(v=Q.va)===null||v===void 0?void 0:v.call(Q,h,m))!==null&&x!==void 0?x:[];for(const J of N)S=J.zOrder,(!(I=F?.zOrder)||S==="top"&&I!=="top"||S==="normal"&&I==="bottom")&&(F=J,T=Q)}var S,I;return F&&T?{zv:F,Hc:T}:null})(o,n,s);if(l?.zv.zOrder==="top")return Cn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Cn(l);const h=h0(c.Pn(r),n,s);if(h!==null)return{Hc:c,Bv:h.Bv,Iv:h.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Cn(l)}return l?.zv?Cn(l):null})(i,e,t)}_m(e,t){Fe(t==="left"?this.Cp:this.Tp).cp(Ft({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){Ti(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=Fe(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const i=t.Dt();i!==null&&e.P_(i),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}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 i=bi(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(i,u0),this.vm(i),this.pm(i),this.fm(i,vn),this.fm(i,p0)))}this.Jv.applySuggestedBitmapSize();const t=bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:i,bitmapSize:r})=>{i.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,d0))}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 i=t.localX,r=t.localY;e.M()&&e.m(this.$i().St().Nu(i),{x:i,y:r},t)}mp({context:e,bitmapSize:t}){const{width:i,height:r}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?on(e,0,0,i,r,o):Wl(e,0,0,i,r,s,o)}vm(e){const t=Fe(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,vn,bo,t),this.Mm(e,vn,Bn,t)}bm(e){this.Mm(e,vn,Bn,this.$i().Zc())}fm(e,t){const i=Fe(this.Np).Uo();for(const r of i)this.Mm(e,t,bo,r);for(const r of i)this.Mm(e,t,Bn,r)}Mm(e,t,i,r){const n=Fe(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;xo(t,(c=>i(c,e,o,l)),r,n)}Zp(){if(this.Np===null)return;const e=this.Qd,t=this.Np.R_().W().visible,i=this.Np.D_().W().visible;t||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),i||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 Nc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),i&&this.Tp===null&&(this.Tp=new Nc(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,i){this.$i().ld(this.Sm(e),this.km(t),i,Fe(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,i){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,i);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(),i=this.fp();if(t.z_(i,i.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)Fe(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(),i=t.St();if(i.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=i.le();this.Ep=new a0(.2/c,7/c,.997,15/c),this.Ep.Yd(i.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(i.Hu(),l))}}class Kc{constructor(e,t,i,r,n){this.ft=!0,this.Ev=Ft({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=i.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=Qi(this.Kv,Ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){Ti(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((i=>{this.mp(i),this.Ie(i)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:i,verticalPixelRatio:r}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*i),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}){on(e,0,0,t.width,t.height,this.Pm())}}function Eo(A){return e=>{var t,i;return(i=(t=e.fa)===null||t===void 0?void 0:t.call(e,A))!==null&&i!==void 0?i:[]}}const f0=Eo("normal"),g0=Eo("top"),m0=Eo("bottom");class w0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=Ft({width:0,height:0}),this.Om=new Ht,this.Fv=new ur(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=Qi(this.Im,Ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const i=this.Gv.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jv=Qi(this.Im,Ft({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 Qo(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),Fi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(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,i){Ti(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(Ft({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(Ft({width:i,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,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const i=bi(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(i,m0)})),this.wp(i),this.$m(i,f0)),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:i,bitmapSize:r})=>{i.clearRect(0,0,r.width,r.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,g0))}$m(e,t){const i=this.Qd.$t().wt();for(const r of i)xo(t,(n=>bo(n,e,!1,void 0)),r,void 0);for(const r of i)xo(t,(n=>Bn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){on(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:i}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*i));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),i=t.Ha();if(!i||i.length===0)return;const r=this.q_.maxTickMarkWeight(i),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 h=Math.max(1,Math.floor(l)),m=Math.floor(.5*l);o.beginPath();const v=Math.round(n.T*c);for(let x=i.length;x--;){const F=Math.round(i[x].coord*l);o.rect(F-m,0,h,v)}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 i)if(c.weight<r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of i)if(c.weight>=r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}}))}Ym(e,t,i){const r=this.Fv.xi(e,i),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 i=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,i)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return Oi(this.j(),this.cn.fontFamily)}Zm(){return Oi(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 ur,Hm:0});const e=this.k,t=this._p();if(e.R!==t){const i=this.j();e.P=i,e.R=t,e.L=3*i/12,e.B=3*i/12,e.ji=9*i/12,e.N=0,e.Hm=4*i/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 i={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 Kc("left",t,i,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Kc("right",t,i,r,n),this.Am.appendChild(this.Dm.lp()))}}const B0=!!zi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((A=>A.brand.includes("Chromium")))&&!!zi&&(!((Lo=navigator?.userAgentData)===null||Lo===void 0)&&Lo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Lo;class y0{constructor(e,t,i){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 Ht,this.Op=new Ht,this.Rc=new Ht,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=i,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(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),Mo(this.cn)&&this.hb(!0),this.$i=new i0(this.Vc.bind(this),this.cn,i),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new w0(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=[],Fe(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,i=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return Ft({width:l-l%2,height:c-c%2})})(Ft({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Fe(this.Xd).style.height=n,Fe(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,i?this.mb(Rt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Rt.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=Mo(this.cn);this.$i.$h(e);const i=Mo(this.cn);i!==t&&this.hb(i),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 i=Fe(t.getContext("2d"));return this.gb(i),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Fe(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 rA(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,i=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let h=0;h<this.Xm.length;h++){const m=this.Xm[h],v=Fe(o==="left"?m.wm():m.gm()),x=v.xp();e!==null&&v.Sp(e,l,c),c+=x.height}};this.xb()&&(n("left",0),t+=Fe(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,i),i+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Fe(r.gm()).xp().width);const s=(o,l,c)=>{Fe(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Fe(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,i),l=Fe(r.wm()).xp().width),this.ab.Sp(e,l,i),l+=o.width,this.Sb()&&s("right",l,i)}i+=o.height}return Ft({width:t,height:i})}Pb(){let e=0,t=0,i=0;for(const F of this.Xm)this.xb()&&(t=Math.max(t,Fe(F.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(i=Math.max(i,Fe(F.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=F.M_();t=Co(t),i=Co(i);const r=this.__,n=this.ho,s=Math.max(r-t-i,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 h=0+l,m=n<h?0:n-h,v=m/e;let x=0;for(let F=0;F<this.Xm.length;++F){const T=this.Xm[F];T.qp(this.$i.qc()[F]);let S=0,I=0;I=F===this.Xm.length-1?m-x:Math.round(T.M_()*v),S=Math.max(I,2),x+=S,T.cp(Ft({width:s,height:S})),this.xb()&&T._m(t,"left"),this.Sb()&&T._m(i,"right"),T.fp()&&this.$i.Kc(T.fp(),S)}this.ab.Fm(Ft({width:o?s:0,height:l}),o?t:0,o?i:0),this.$i.S_(s),this.Gm!==t&&(this.Gm=t),this.Jm!==i&&(this.Jm=i)}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 B0?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),i=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)}i!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*i)}mb(e,t){var i;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()})),((i=this.Qm)===null||i===void 0?void 0:i.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 i of e.Qn())this.ns(i,t)}Vb(e){const t=this.$i.qc();for(let i=0;i<t.length;i++)e.Hn(i).Wn&&t[i].N_()}ns(e,t){const i=this.$i.St();switch(e.qn){case 0:i.hc();break;case 1:i.lc(e.Vt);break;case 2:i.Gn(e.Vt);break;case 3:i.Jn(e.Vt);break;case 4:i.qu();break;case 5:e.Vt.Qu(t)||i.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 i=this.Qm;this.Qm=null,this.mb(i,t);for(const r of i.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,i=this.Xm.length;for(let r=t;r<i;r++){const n=rA(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=i;r<t;r++){const n=new So(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,i){var r;const n=new Map;e!==null&&this.$i.wt().forEach((h=>{const m=h.In().ll(e);m!==null&&n.set(h,m)}));let s;if(e!==null){const h=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;h!==void 0&&(s=h)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof ho?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:i??void 0}}Bb(e,t,i){this.Vp.m((()=>this.Ib(e,t,i)))}Ab(e,t,i){this.Op.m((()=>this.Ib(e,t,i)))}lb(e,t,i){this.Rc.m((()=>this.Ib(e,t,i)))}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((i=>i.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 Mo(A){return!!(A.handleScroll.mouseWheel||A.handleScale.mouseWheel)}function C0(A){return(function(e){return e.open!==void 0})(A)||(function(e){return e.value!==void 0})(A)}function zc(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(A!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(i=Object.getOwnPropertySymbols(A);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(A,i[r])&&(t[i[r]]=A[i[r]])}return t}function Vc(A,e,t,i){const r=t.value,n={ee:e,ot:A,Vt:[r,r,r,r],zb:i};return t.color!==void 0&&(n.V=t.color),n}function v0(A,e,t,i){const r=t.value,n={ee:e,ot:A,Vt:[r,r,r,r],zb:i};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 T0(A,e,t,i){const r=t.value,n={ee:e,ot:A,Vt:[r,r,r,r],zb:i};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 b0(A,e,t,i){const r={ee:e,ot:A,Vt:[t.open,t.high,t.low,t.close],zb:i};return t.color!==void 0&&(r.V=t.color),r}function x0(A,e,t,i){const r={ee:e,ot:A,Vt:[t.open,t.high,t.low,t.close],zb:i};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 Q0(A,e,t,i,r){const n=rA(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],h=t,{time:m,color:v}=h;return{ee:e,ot:A,Vt:c,zb:i,$e:zc(h,["time","color"]),V:v}}function Tn(A){return A.Vt!==void 0}function Wc(A,e){return e.customValues!==void 0&&(A.jb=e.customValues),A}function Ui(A){return(e,t,i,r,n,s)=>(function(o,l){return l?l(o):(c=o).open===void 0&&c.value===void 0;var c})(i,s)?Wc({ot:e,ee:t,zb:r},i):Wc(A(e,t,i,r,n),i)}function Gc(A){return{Candlestick:Ui(x0),Bar:Ui(b0),Area:Ui(v0),Baseline:Ui(T0),Histogram:Ui(Vc),Line:Ui(Vc),Custom:Ui(Q0)}[A]}function Rc(A){return{ee:0,Hb:new Map,la:A}}function $c(A,e){if(A!==void 0&&A.length!==0)return{$b:e.key(A[0].ot),Ub:e.key(A[A.length-1].ot)}}function Xc(A){let e;return A.forEach((t=>{e===void 0&&(e=t.zb)})),rA(e)}class F0{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 i=this.qb.size!==0,r=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)i=!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((x=>x.time)),c=this.q_.createConverterToInternalObj(t),h=Gc(e.Qh()),m=e.Ca(),v=e.Ta();s=t.map(((x,F)=>{const T=c(x.time),S=this.q_.key(T);let I=this.qb.get(S);I===void 0&&(I=Rc(T),this.qb.set(S,I),r=!0);const Q=h(T,I.ee,x,l[F],m,v);return I.Hb.set(e,Q),Q}))}i&&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:Xc(c.Hb)})})),l.sort(((c,h)=>this.q_.key(c.time)-this.q_.key(h.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,h){const m=$c(l,h),v=$c(c,h);if(m!==void 0&&v!==void 0)return{ta:m.Ub>=v.Ub&&m.$b>=v.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const i=t;(function(T){T.zb===void 0&&(T.zb=T.time)})(i),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=Rc(r),this.qb.set(this.q_.key(r),s));const l=Gc(e.Qh()),c=e.Ca(),h=e.Ta(),m=l(r,s.ee,t,i.zb,c,h);s.Hb.set(e,m),this.nw(e,m);const v={ta:Tn(m)};if(!o)return this.tw(e,-1,v);const x={timeWeight:0,time:s.la,pointData:s,originalTime:Xc(s.Hb)},F=hr(this.Xb,this.q_.key(x.time),((T,S)=>this.q_.key(T.time)<S));this.Xb.splice(F,0,x);for(let T=F;T<this.Xb.length;++T)Ho(this.Xb[T].pointData,T);return this.q_.fillWeightsForPoints(this.Xb,F),this.tw(e,F,v)}nw(e,t){let i=this.Yb.get(e);i===void 0&&(i=[],this.Yb.set(e,i));const r=i.length!==0?i[i.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?Tn(t)&&i.push(t):Tn(t)?i[i.length-1]=t:i.splice(-1,1),this.Zb.set(e,t.ot)}Jb(e,t){t.length!==0?(this.Yb.set(e,t.filter(Tn)),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 i=0;i<this.Xb.length&&i<e.length;++i){const r=this.Xb[i],n=e[i];if(this.q_.key(r.time)!==this.q_.key(n.time)){t=i;break}n.timeWeight=r.timeWeight,Ho(n.pointData,i)}if(t===-1&&this.Xb.length!==e.length&&(t=Math.min(this.Xb.length,e.length)),t===-1)return-1;for(let i=t;i<e.length;++i)Ho(e[i].pointData,i);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,i){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?i:void 0})})),this.Yb.has(e)||r.ew.set(e,{$e:[],rw:i}),r.St.hw=this.Xb,r.St.lw=t;else{const n=this.Yb.get(e);r.ew.set(e,{$e:n||[],rw:i})}return r}}function Ho(A,e){A.ee=e,A.Hb.forEach((t=>{t.ee=e}))}function Io(A){const e={value:A.Vt[3],time:A.zb};return A.jb!==void 0&&(e.customValues=A.jb),e}function Jc(A){const e=Io(A);return A.V!==void 0&&(e.color=A.V),e}function U0(A){const e=Io(A);return A.lt!==void 0&&(e.lineColor=A.lt),A.Ps!==void 0&&(e.topColor=A.Ps),A.Rs!==void 0&&(e.bottomColor=A.Rs),e}function S0(A){const e=Io(A);return A.Re!==void 0&&(e.topLineColor=A.Re),A.De!==void 0&&(e.bottomLineColor=A.De),A.ke!==void 0&&(e.topFillColor1=A.ke),A.ye!==void 0&&(e.topFillColor2=A.ye),A.Ce!==void 0&&(e.bottomFillColor1=A.Ce),A.Te!==void 0&&(e.bottomFillColor2=A.Te),e}function Zc(A){const e={open:A.Vt[0],high:A.Vt[1],low:A.Vt[2],close:A.Vt[3],time:A.zb};return A.jb!==void 0&&(e.customValues=A.jb),e}function E0(A){const e=Zc(A);return A.V!==void 0&&(e.color=A.V),e}function L0(A){const e=Zc(A),{V:t,Ot:i,Xh:r}=A;return t!==void 0&&(e.color=t),i!==void 0&&(e.borderColor=i),r!==void 0&&(e.wickColor=r),e}function Po(A){return{Area:U0,Line:Jc,Baseline:S0,Histogram:Jc,Bar:E0,Candlestick:L0,Custom:M0}[A]}function M0(A){const e=A.zb;return Object.assign(Object.assign({},A.$e),{time:e})}const H0={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},I0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},P0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:js,attributionLogo:!0},Do={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},D0={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},_0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:js,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Yc(){return{width:0,height:0,autoSize:!1,layout:P0,crosshair:H0,grid:I0,overlayPriceScales:Object.assign({},Do),leftPriceScale:Object.assign(Object.assign({},Do),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Do),{visible:!0}),timeScale:D0,watermark:_0,localization:{locale:zi?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 k0{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 ln(this.ow)?this.aw.Mb(this.ow):0}Li(){return Fe(this.aw.$t().Uc(this.ow)).Dt}}function qc(A,e,t){const i=zc(A,["time","originalTime"]),r=Object.assign({time:e},i);return t!==void 0&&(r.originalTime=t),r}const O0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class N0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class K0{constructor(e,t,i,r,n){this.uw=new Ht,this.Es=e,this.cw=t,this.dw=i,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 wr(e.from,e.to)).lu(),i=this.Es.In();if(i.Ni())return null;const r=i.ll(t.Os(),1),n=i.ll(t.ui(),-1),s=Fe(i.el()),o=Fe(i.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 i=this.Es.In().ll(e,t);return i===null?null:Po(this.seriesType())(i)}data(){const e=Po(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((i=>qc(i,this.q_.convertHorzItemToInternal(i.time),i.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>qc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return jA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=EA(jA(O0),e),i=this.Es.ea(t);return new N0(i)}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 z0{constructor(e,t,i){this.ww=new Ht,this.mu=new Ht,this.Om=new Ht,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_=i}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(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)},i=this.yl.Iu(t);this.$i.pd(i)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ai(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),i=this.yl.Va(t,!1);return i===null?null:this.yl.It(i)}coordinateToTime(e){const t=this.$i.St(),i=t.Nu(e),r=t.Ui(i);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({},jA(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 V0(A){if(A===void 0||A.type==="custom")return;const e=A;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(t){if(t>=1)return 0;let i=0;for(;i<8;i++){const r=Math.round(t);if(Math.abs(r-t)<1e-8)return i;t*=10}return i})(e.minMove))}function jc(A){return(function(e){if(sn(e.handleScale)){const i=e.handleScale;e.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:i,axisDoubleClickReset:r}=e.handleScale;sn(i)&&(e.handleScale.axisPressedMouseMove={time:i,price:i}),sn(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;sn(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(A),A}class W0{constructor(e,t,i){this.Sw=new Map,this.kw=new Map,this.yw=new Ht,this.Cw=new Ht,this.Tw=new Ht,this.Pw=new F0(t);const r=i===void 0?jA(Yc()):EA(jA(Yc()),jc(i));this.q_=t,this.aw=new y0(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 z0(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,i){this.autoSizeActive()||this.aw._b(e,t,i)}addCustomSeries(e,t){const i=ki(e),r=Object.assign(Object.assign({},Il),i.defaultOptions());return this.Vw("Custom",r,t,i)}addAreaSeries(e){return this.Vw("Area",Ff,e)}addBaselineSeries(e){return this.Vw("Baseline",Uf,e)}addBarSeries(e){return this.Vw("Bar",xf,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",bf,e)}addHistogramSeries(e){return this.Vw("Histogram",Sf,e)}addLineSeries(e){return this.Vw("Line",Qf,e)}removeSeries(e){const t=rA(this.Sw.get(e)),i=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(i),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 k0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(jc(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,i){const r=this.Sw.get(i);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,i={},r){V0(i.priceFormat);const n=EA(jA(Pl),jA(t),i),s=this.aw.$t().dd(e,n,r),o=new K0(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(((i,r)=>r.J(i.$e,i.rw))),t.Wu()}Bw(e){return rA(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=Po(s)(r);if(s!=="Custom")ai(C0(o));else{const l=n.Ta();ai(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const i=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:i,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function G0(A,e,t){let i;if(lr(A)){const n=document.getElementById(A);ai(n!==null,`Cannot find element in DOM with id=${A}`),i=n}else i=A;const r=new W0(i,e,t);return e.setOptions(r.options()),r}function R0(A,e){return G0(A,new Dc,Dc.Id(e))}Object.assign(Object.assign({},Pl),Il);function eh(A,e){return function(){return A.apply(e,arguments)}}const{toString:$0}=Object.prototype,{getPrototypeOf:_o}=Object,{iterator:bn,toStringTag:th}=Symbol,xn=(A=>e=>{const t=$0.call(e);return A[t]||(A[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),MA=A=>(A=A.toLowerCase(),e=>xn(e)===A),Qn=A=>e=>typeof e===A,{isArray:Wi}=Array,Gi=Qn("undefined");function Br(A){return A!==null&&!Gi(A)&&A.constructor!==null&&!Gi(A.constructor)&&uA(A.constructor.isBuffer)&&A.constructor.isBuffer(A)}const Ah=MA("ArrayBuffer");function X0(A){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(A):e=A&&A.buffer&&Ah(A.buffer),e}const J0=Qn("string"),uA=Qn("function"),ih=Qn("number"),yr=A=>A!==null&&typeof A=="object",Z0=A=>A===!0||A===!1,Fn=A=>{if(xn(A)!=="object")return!1;const e=_o(A);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(th in A)&&!(bn in A)},Y0=A=>{if(!yr(A)||Br(A))return!1;try{return Object.keys(A).length===0&&Object.getPrototypeOf(A)===Object.prototype}catch{return!1}},q0=MA("Date"),j0=MA("File"),em=MA("Blob"),tm=MA("FileList"),Am=A=>yr(A)&&uA(A.pipe),im=A=>{let e;return A&&(typeof FormData=="function"&&A instanceof FormData||uA(A.append)&&((e=xn(A))==="formdata"||e==="object"&&uA(A.toString)&&A.toString()==="[object FormData]"))},rm=MA("URLSearchParams"),[nm,sm,om,am]=["ReadableStream","Request","Response","Headers"].map(MA),lm=A=>A.trim?A.trim():A.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Cr(A,e,{allOwnKeys:t=!1}={}){if(A===null||typeof A>"u")return;let i,r;if(typeof A!="object"&&(A=[A]),Wi(A))for(i=0,r=A.length;i<r;i++)e.call(null,A[i],i,A);else{if(Br(A))return;const n=t?Object.getOwnPropertyNames(A):Object.keys(A),s=n.length;let o;for(i=0;i<s;i++)o=n[i],e.call(null,A[o],o,A)}}function rh(A,e){if(Br(A))return null;e=e.toLowerCase();const t=Object.keys(A);let i=t.length,r;for(;i-- >0;)if(r=t[i],e===r.toLowerCase())return r;return null}const Si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nh=A=>!Gi(A)&&A!==Si;function ko(){const{caseless:A,skipUndefined:e}=nh(this)&&this||{},t={},i=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=A&&rh(t,n)||n;Fn(t[s])&&Fn(r)?t[s]=ko(t[s],r):Fn(r)?t[s]=ko({},r):Wi(r)?t[s]=r.slice():(!e||!Gi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&Cr(arguments[r],i);return t}const cm=(A,e,t,{allOwnKeys:i}={})=>(Cr(e,(r,n)=>{t&&uA(r)?Object.defineProperty(A,n,{value:eh(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(A,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),A),hm=A=>(A.charCodeAt(0)===65279&&(A=A.slice(1)),A),um=(A,e,t,i)=>{A.prototype=Object.create(e.prototype,i),Object.defineProperty(A.prototype,"constructor",{value:A,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(A,"super",{value:e.prototype}),t&&Object.assign(A.prototype,t)},pm=(A,e,t,i)=>{let r,n,s;const o={};if(e=e||{},A==null)return e;do{for(r=Object.getOwnPropertyNames(A),n=r.length;n-- >0;)s=r[n],(!i||i(s,A,e))&&!o[s]&&(e[s]=A[s],o[s]=!0);A=t!==!1&&_o(A)}while(A&&(!t||t(A,e))&&A!==Object.prototype);return e},dm=(A,e,t)=>{A=String(A),(t===void 0||t>A.length)&&(t=A.length),t-=e.length;const i=A.indexOf(e,t);return i!==-1&&i===t},fm=A=>{if(!A)return null;if(Wi(A))return A;let e=A.length;if(!ih(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=A[e];return t},gm=(A=>e=>A&&e instanceof A)(typeof Uint8Array<"u"&&_o(Uint8Array)),mm=(A,e)=>{const i=(A&&A[bn]).call(A);let r;for(;(r=i.next())&&!r.done;){const n=r.value;e.call(A,n[0],n[1])}},wm=(A,e)=>{let t;const i=[];for(;(t=A.exec(e))!==null;)i.push(t);return i},Bm=MA("HTMLFormElement"),ym=A=>A.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),sh=(({hasOwnProperty:A})=>(e,t)=>A.call(e,t))(Object.prototype),Cm=MA("RegExp"),oh=(A,e)=>{const t=Object.getOwnPropertyDescriptors(A),i={};Cr(t,(r,n)=>{let s;(s=e(r,n,A))!==!1&&(i[n]=s||r)}),Object.defineProperties(A,i)},vm=A=>{oh(A,(e,t)=>{if(uA(A)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=A[t];if(uA(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Tm=(A,e)=>{const t={},i=r=>{r.forEach(n=>{t[n]=!0})};return Wi(A)?i(A):i(String(A).split(e)),t},bm=()=>{},xm=(A,e)=>A!=null&&Number.isFinite(A=+A)?A:e;function Qm(A){return!!(A&&uA(A.append)&&A[th]==="FormData"&&A[bn])}const Fm=A=>{const e=new Array(10),t=(i,r)=>{if(yr(i)){if(e.indexOf(i)>=0)return;if(Br(i))return i;if(!("toJSON"in i)){e[r]=i;const n=Wi(i)?[]:{};return Cr(i,(s,o)=>{const l=t(s,r+1);!Gi(l)&&(n[o]=l)}),e[r]=void 0,n}}return i};return t(A,0)},Um=MA("AsyncFunction"),Sm=A=>A&&(yr(A)||uA(A))&&uA(A.then)&&uA(A.catch),ah=((A,e)=>A?setImmediate:e?((t,i)=>(Si.addEventListener("message",({source:r,data:n})=>{r===Si&&n===t&&i.length&&i.shift()()},!1),r=>{i.push(r),Si.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",uA(Si.postMessage)),Em=typeof queueMicrotask<"u"?queueMicrotask.bind(Si):typeof process<"u"&&process.nextTick||ah,de={isArray:Wi,isArrayBuffer:Ah,isBuffer:Br,isFormData:im,isArrayBufferView:X0,isString:J0,isNumber:ih,isBoolean:Z0,isObject:yr,isPlainObject:Fn,isEmptyObject:Y0,isReadableStream:nm,isRequest:sm,isResponse:om,isHeaders:am,isUndefined:Gi,isDate:q0,isFile:j0,isBlob:em,isRegExp:Cm,isFunction:uA,isStream:Am,isURLSearchParams:rm,isTypedArray:gm,isFileList:tm,forEach:Cr,merge:ko,extend:cm,trim:lm,stripBOM:hm,inherits:um,toFlatObject:pm,kindOf:xn,kindOfTest:MA,endsWith:dm,toArray:fm,forEachEntry:mm,matchAll:wm,isHTMLForm:Bm,hasOwnProperty:sh,hasOwnProp:sh,reduceDescriptors:oh,freezeMethods:vm,toObjectSet:Tm,toCamelCase:ym,noop:bm,toFiniteNumber:xm,findKey:rh,global:Si,isContextDefined:nh,isSpecCompliantForm:Qm,toJSONObject:Fm,isAsyncFn:Um,isThenable:Sm,setImmediate:ah,asap:Em,isIterable:A=>A!=null&&uA(A[bn])};let tt=class cf extends Error{static from(e,t,i,r,n,s){const o=new cf(e.message,t||e.code,i,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,i,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),i&&(this.config=i),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:de.toJSONObject(this.config),code:this.code,status:this.status}}};tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",tt.ERR_BAD_OPTION="ERR_BAD_OPTION",tt.ECONNABORTED="ECONNABORTED",tt.ETIMEDOUT="ETIMEDOUT",tt.ERR_NETWORK="ERR_NETWORK",tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",tt.ERR_DEPRECATED="ERR_DEPRECATED",tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",tt.ERR_CANCELED="ERR_CANCELED",tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",tt.ERR_INVALID_URL="ERR_INVALID_URL";const Lm=null;function Oo(A){return de.isPlainObject(A)||de.isArray(A)}function lh(A){return de.endsWith(A,"[]")?A.slice(0,-2):A}function ch(A,e,t){return A?A.concat(e).map(function(r,n){return r=lh(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function Mm(A){return de.isArray(A)&&!A.some(Oo)}const Hm=de.toFlatObject(de,{},null,function(e){return/^is[A-Z]/.test(e)});function Un(A,e,t){if(!de.isObject(A))throw new TypeError("target must be an object");e=e||new FormData,t=de.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,S){return!de.isUndefined(S[T])});const i=t.metaTokens,r=t.visitor||h,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&de.isSpecCompliantForm(e);if(!de.isFunction(r))throw new TypeError("visitor must be a function");function c(F){if(F===null)return"";if(de.isDate(F))return F.toISOString();if(de.isBoolean(F))return F.toString();if(!l&&de.isBlob(F))throw new tt("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(F)||de.isTypedArray(F)?l&&typeof Blob=="function"?new Blob([F]):Buffer.from(F):F}function h(F,T,S){let I=F;if(F&&!S&&typeof F=="object"){if(de.endsWith(T,"{}"))T=i?T:T.slice(0,-2),F=JSON.stringify(F);else if(de.isArray(F)&&Mm(F)||(de.isFileList(F)||de.endsWith(T,"[]"))&&(I=de.toArray(F)))return T=lh(T),I.forEach(function(N,J){!(de.isUndefined(N)||N===null)&&e.append(s===!0?ch([T],J,n):s===null?T:T+"[]",c(N))}),!1}return Oo(F)?!0:(e.append(ch(S,T,n),c(F)),!1)}const m=[],v=Object.assign(Hm,{defaultVisitor:h,convertValue:c,isVisitable:Oo});function x(F,T){if(!de.isUndefined(F)){if(m.indexOf(F)!==-1)throw Error("Circular reference detected in "+T.join("."));m.push(F),de.forEach(F,function(I,Q){(!(de.isUndefined(I)||I===null)&&r.call(e,I,de.isString(Q)?Q.trim():Q,T,v))===!0&&x(I,T?T.concat(Q):[Q])}),m.pop()}}if(!de.isObject(A))throw new TypeError("data must be an object");return x(A),e}function hh(A){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(A).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function No(A,e){this._pairs=[],A&&Un(A,this,e)}const uh=No.prototype;uh.append=function(e,t){this._pairs.push([e,t])},uh.toString=function(e){const t=e?function(i){return e.call(this,i,hh)}:hh;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Im(A){return encodeURIComponent(A).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ph(A,e,t){if(!e)return A;const i=t&&t.encode||Im,r=de.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=de.isURLSearchParams(e)?e.toString():new No(e,r).toString(i),s){const o=A.indexOf("#");o!==-1&&(A=A.slice(0,o)),A+=(A.indexOf("?")===-1?"?":"&")+s}return A}class dh{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){de.forEach(this.handlers,function(i){i!==null&&e(i)})}}const Ko={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Pm={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:No,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},zo=typeof window<"u"&&typeof document<"u",Vo=typeof navigator=="object"&&navigator||void 0,Dm=zo&&(!Vo||["ReactNative","NativeScript","NS"].indexOf(Vo.product)<0),_m=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",km=zo&&window.location.href||"http://localhost",eA={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zo,hasStandardBrowserEnv:Dm,hasStandardBrowserWebWorkerEnv:_m,navigator:Vo,origin:km},Symbol.toStringTag,{value:"Module"})),...Pm};function Om(A,e){return Un(A,new eA.classes.URLSearchParams,{visitor:function(t,i,r,n){return eA.isNode&&de.isBuffer(t)?(this.append(i,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function Nm(A){return de.matchAll(/\w+|\[(\w*)]/g,A).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Km(A){const e={},t=Object.keys(A);let i;const r=t.length;let n;for(i=0;i<r;i++)n=t[i],e[n]=A[n];return e}function fh(A){function e(t,i,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&de.isArray(r)?r.length:s,l?(de.hasOwnProp(r,s)?r[s]=[r[s],i]:r[s]=i,!o):((!r[s]||!de.isObject(r[s]))&&(r[s]=[]),e(t,i,r[s],n)&&de.isArray(r[s])&&(r[s]=Km(r[s])),!o)}if(de.isFormData(A)&&de.isFunction(A.entries)){const t={};return de.forEachEntry(A,(i,r)=>{e(Nm(i),r,t,0)}),t}return null}function zm(A,e,t){if(de.isString(A))try{return(e||JSON.parse)(A),de.trim(A)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(A)}const vr={transitional:Ko,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,n=de.isObject(e);if(n&&de.isHTMLForm(e)&&(e=new FormData(e)),de.isFormData(e))return r?JSON.stringify(fh(e)):e;if(de.isArrayBuffer(e)||de.isBuffer(e)||de.isStream(e)||de.isFile(e)||de.isBlob(e)||de.isReadableStream(e))return e;if(de.isArrayBufferView(e))return e.buffer;if(de.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Om(e,this.formSerializer).toString();if((o=de.isFileList(e))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Un(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),zm(e)):e}],transformResponse:[function(e){const t=this.transitional||vr.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(de.isResponse(e)||de.isReadableStream(e))return e;if(e&&de.isString(e)&&(i&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?tt.from(o,tt.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:eA.classes.FormData,Blob:eA.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],A=>{vr.headers[A]={}});const Vm=de.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"]),Wm=A=>{const e={};let t,i,r;return A&&A.split(`
2
+ `).forEach(function(s){r=s.indexOf(":"),t=s.substring(0,r).trim().toLowerCase(),i=s.substring(r+1).trim(),!(!t||e[t]&&Vm[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},gh=Symbol("internals");function Tr(A){return A&&String(A).trim().toLowerCase()}function Sn(A){return A===!1||A==null?A:de.isArray(A)?A.map(Sn):String(A)}function Gm(A){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(A);)e[i[1]]=i[2];return e}const Rm=A=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(A.trim());function Wo(A,e,t,i,r){if(de.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!de.isString(e)){if(de.isString(i))return e.indexOf(i)!==-1;if(de.isRegExp(i))return i.test(e)}}function $m(A){return A.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function Xm(A,e){const t=de.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(A,i+t,{value:function(r,n,s){return this[i].call(this,e,r,n,s)},configurable:!0})})}let pA=class{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function n(o,l,c){const h=Tr(l);if(!h)throw new Error("header name must be a non-empty string");const m=de.findKey(r,h);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=Sn(o))}const s=(o,l)=>de.forEach(o,(c,h)=>n(c,h,l));if(de.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(de.isString(e)&&(e=e.trim())&&!Rm(e))s(Wm(e),t);else if(de.isObject(e)&&de.isIterable(e)){let o={},l,c;for(const h of e){if(!de.isArray(h))throw TypeError("Object iterator must return a key-value pair");o[c=h[0]]=(l=o[c])?de.isArray(l)?[...l,h[1]]:[l,h[1]]:h[1]}s(o,t)}else e!=null&&n(t,e,i);return this}get(e,t){if(e=Tr(e),e){const i=de.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return Gm(r);if(de.isFunction(t))return t.call(this,r,i);if(de.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Tr(e),e){const i=de.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||Wo(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function n(s){if(s=Tr(s),s){const o=de.findKey(i,s);o&&(!t||Wo(i,i[o],o,t))&&(delete i[o],r=!0)}}return de.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const n=t[i];(!e||Wo(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,i={};return de.forEach(this,(r,n)=>{const s=de.findKey(i,n);if(s){t[s]=Sn(r),delete t[n];return}const o=e?$m(n):String(n).trim();o!==n&&delete t[n],t[o]=Sn(r),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return de.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&de.isArray(i)?i.join(", "):i)}),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 i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[gh]=this[gh]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=Tr(s);i[o]||(Xm(r,s),i[o]=!0)}return de.isArray(e)?e.forEach(n):n(e),this}};pA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(pA.prototype,({value:A},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>A,set(i){this[t]=i}}}),de.freezeMethods(pA);function Go(A,e){const t=this||vr,i=e||t,r=pA.from(i.headers);let n=i.data;return de.forEach(A,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function mh(A){return!!(A&&A.__CANCEL__)}let br=class extends tt{constructor(e,t,i){super(e??"canceled",tt.ERR_CANCELED,t,i),this.name="CanceledError",this.__CANCEL__=!0}};function wh(A,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?A(t):e(new tt("Request failed with status code "+t.status,[tt.ERR_BAD_REQUEST,tt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Jm(A){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(A);return e&&e[1]||""}function Zm(A,e){A=A||10;const t=new Array(A),i=new Array(A);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),h=i[n];s||(s=c),t[r]=l,i[r]=c;let m=n,v=0;for(;m!==r;)v+=t[m++],m=m%A;if(r=(r+1)%A,r===n&&(n=(n+1)%A),c-s<e)return;const x=h&&c-h;return x?Math.round(v*1e3/x):void 0}}function Ym(A,e){let t=0,i=1e3/e,r,n;const s=(c,h=Date.now())=>{t=h,r=null,n&&(clearTimeout(n),n=null),A(...c)};return[(...c)=>{const h=Date.now(),m=h-t;m>=i?s(c,h):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},i-m)))},()=>r&&s(r)]}const En=(A,e,t=3)=>{let i=0;const r=Zm(50,250);return Ym(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-i,c=r(l),h=s<=o;i=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};A(m)},t)},Bh=(A,e)=>{const t=A!=null;return[i=>e[0]({lengthComputable:t,total:A,loaded:i}),e[1]]},yh=A=>(...e)=>de.asap(()=>A(...e)),qm=eA.hasStandardBrowserEnv?((A,e)=>t=>(t=new URL(t,eA.origin),A.protocol===t.protocol&&A.host===t.host&&(e||A.port===t.port)))(new URL(eA.origin),eA.navigator&&/(msie|trident)/i.test(eA.navigator.userAgent)):()=>!0,jm=eA.hasStandardBrowserEnv?{write(A,e,t,i,r,n,s){if(typeof document>"u")return;const o=[`${A}=${encodeURIComponent(e)}`];de.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),de.isString(i)&&o.push(`path=${i}`),de.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),de.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(A){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+A+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(A){this.write(A,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function e1(A){return typeof A!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(A)}function t1(A,e){return e?A.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):A}function Ch(A,e,t){let i=!e1(e);return A&&(i||t==!1)?t1(A,e):e}const vh=A=>A instanceof pA?{...A}:A;function Ei(A,e){e=e||{};const t={};function i(c,h,m,v){return de.isPlainObject(c)&&de.isPlainObject(h)?de.merge.call({caseless:v},c,h):de.isPlainObject(h)?de.merge({},h):de.isArray(h)?h.slice():h}function r(c,h,m,v){if(de.isUndefined(h)){if(!de.isUndefined(c))return i(void 0,c,m,v)}else return i(c,h,m,v)}function n(c,h){if(!de.isUndefined(h))return i(void 0,h)}function s(c,h){if(de.isUndefined(h)){if(!de.isUndefined(c))return i(void 0,c)}else return i(void 0,h)}function o(c,h,m){if(m in e)return i(c,h);if(m in A)return i(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,h,m)=>r(vh(c),vh(h),m,!0)};return de.forEach(Object.keys({...A,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const m=de.hasOwnProp(l,h)?l[h]:r,v=m(A[h],e[h],h);de.isUndefined(v)&&m!==o||(t[h]=v)}),t}const Th=A=>{const e=Ei({},A);let{data:t,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=pA.from(s),e.url=ph(Ch(e.baseURL,e.url,e.allowAbsoluteUrls),A.params,A.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),de.isFormData(t)){if(eA.hasStandardBrowserEnv||eA.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(de.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([h,m])=>{c.includes(h.toLowerCase())&&s.set(h,m)})}}if(eA.hasStandardBrowserEnv&&(i&&de.isFunction(i)&&(i=i(e)),i||i!==!1&&qm(e.url))){const l=r&&n&&jm.read(n);l&&s.set(r,l)}return e},A1=typeof XMLHttpRequest<"u"&&function(A){return new Promise(function(t,i){const r=Th(A);let n=r.data;const s=pA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,h,m,v,x,F;function T(){x&&x(),F&&F(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(r.method.toUpperCase(),r.url,!0),S.timeout=r.timeout;function I(){if(!S)return;const N=pA.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),H={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:N,config:A,request:S};wh(function(re){t(re),T()},function(re){i(re),T()},H),S=null}"onloadend"in S?S.onloadend=I:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(I)},S.onabort=function(){S&&(i(new tt("Request aborted",tt.ECONNABORTED,A,S)),S=null)},S.onerror=function(J){const H=J&&J.message?J.message:"Network Error",z=new tt(H,tt.ERR_NETWORK,A,S);z.event=J||null,i(z),S=null},S.ontimeout=function(){let J=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const H=r.transitional||Ko;r.timeoutErrorMessage&&(J=r.timeoutErrorMessage),i(new tt(J,H.clarifyTimeoutError?tt.ETIMEDOUT:tt.ECONNABORTED,A,S)),S=null},n===void 0&&s.setContentType(null),"setRequestHeader"in S&&de.forEach(s.toJSON(),function(J,H){S.setRequestHeader(H,J)}),de.isUndefined(r.withCredentials)||(S.withCredentials=!!r.withCredentials),o&&o!=="json"&&(S.responseType=r.responseType),c&&([v,F]=En(c,!0),S.addEventListener("progress",v)),l&&S.upload&&([m,x]=En(l),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(r.cancelToken||r.signal)&&(h=N=>{S&&(i(!N||N.type?new br(null,A,S):N),S.abort(),S=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const Q=Jm(r.url);if(Q&&eA.protocols.indexOf(Q)===-1){i(new tt("Unsupported protocol "+Q+":",tt.ERR_BAD_REQUEST,A));return}S.send(n||null)})},i1=(A,e)=>{const{length:t}=A=A?A.filter(Boolean):[];if(e||t){let i=new AbortController,r;const n=function(c){if(!r){r=!0,o();const h=c instanceof Error?c:this.reason;i.abort(h instanceof tt?h:new br(h instanceof Error?h.message:h))}};let s=e&&setTimeout(()=>{s=null,n(new tt(`timeout of ${e}ms exceeded`,tt.ETIMEDOUT))},e);const o=()=>{A&&(s&&clearTimeout(s),s=null,A.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),A=null)};A.forEach(c=>c.addEventListener("abort",n));const{signal:l}=i;return l.unsubscribe=()=>de.asap(o),l}},r1=function*(A,e){let t=A.byteLength;if(t<e){yield A;return}let i=0,r;for(;i<t;)r=i+e,yield A.slice(i,r),i=r},n1=async function*(A,e){for await(const t of s1(A))yield*r1(t,e)},s1=async function*(A){if(A[Symbol.asyncIterator]){yield*A;return}const e=A.getReader();try{for(;;){const{done:t,value:i}=await e.read();if(t)break;yield i}}finally{await e.cancel()}},bh=(A,e,t,i)=>{const r=n1(A,e);let n=0,s,o=l=>{s||(s=!0,i&&i(l))};return new ReadableStream({async pull(l){try{const{done:c,value:h}=await r.next();if(c){o(),l.close();return}let m=h.byteLength;if(t){let v=n+=m;t(v)}l.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},xh=64*1024,{isFunction:Ln}=de,o1=(({Request:A,Response:e})=>({Request:A,Response:e}))(de.global),{ReadableStream:Qh,TextEncoder:Fh}=de.global,Uh=(A,...e)=>{try{return!!A(...e)}catch{return!1}},a1=A=>{A=de.merge.call({skipUndefined:!0},o1,A);const{fetch:e,Request:t,Response:i}=A,r=e?Ln(e):typeof fetch=="function",n=Ln(t),s=Ln(i);if(!r)return!1;const o=r&&Ln(Qh),l=r&&(typeof Fh=="function"?(F=>T=>F.encode(T))(new Fh):async F=>new Uint8Array(await new t(F).arrayBuffer())),c=n&&o&&Uh(()=>{let F=!1;const T=new t(eA.origin,{body:new Qh,method:"POST",get duplex(){return F=!0,"half"}}).headers.has("Content-Type");return F&&!T}),h=s&&o&&Uh(()=>de.isReadableStream(new i("").body)),m={stream:h&&(F=>F.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(F=>{!m[F]&&(m[F]=(T,S)=>{let I=T&&T[F];if(I)return I.call(T);throw new tt(`Response type '${F}' is not supported`,tt.ERR_NOT_SUPPORT,S)})});const v=async F=>{if(F==null)return 0;if(de.isBlob(F))return F.size;if(de.isSpecCompliantForm(F))return(await new t(eA.origin,{method:"POST",body:F}).arrayBuffer()).byteLength;if(de.isArrayBufferView(F)||de.isArrayBuffer(F))return F.byteLength;if(de.isURLSearchParams(F)&&(F=F+""),de.isString(F))return(await l(F)).byteLength},x=async(F,T)=>{const S=de.toFiniteNumber(F.getContentLength());return S??v(T)};return async F=>{let{url:T,method:S,data:I,signal:Q,cancelToken:N,timeout:J,onDownloadProgress:H,onUploadProgress:z,responseType:re,headers:q,withCredentials:ie="same-origin",fetchOptions:G}=Th(F),ne=e||fetch;re=re?(re+"").toLowerCase():"text";let le=i1([Q,N&&N.toAbortSignal()],J),ee=null;const we=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let j;try{if(z&&c&&S!=="get"&&S!=="head"&&(j=await x(q,I))!==0){let fe=new t(T,{method:"POST",body:I,duplex:"half"}),Qe;if(de.isFormData(I)&&(Qe=fe.headers.get("content-type"))&&q.setContentType(Qe),fe.body){const[me,xe]=Bh(j,En(yh(z)));I=bh(fe.body,xh,me,xe)}}de.isString(ie)||(ie=ie?"include":"omit");const ge=n&&"credentials"in t.prototype,ae={...G,signal:le,method:S.toUpperCase(),headers:q.normalize().toJSON(),body:I,duplex:"half",credentials:ge?ie:void 0};ee=n&&new t(T,ae);let pe=await(n?ne(ee,G):ne(T,ae));const ue=h&&(re==="stream"||re==="response");if(h&&(H||ue&&we)){const fe={};["status","statusText","headers"].forEach(Se=>{fe[Se]=pe[Se]});const Qe=de.toFiniteNumber(pe.headers.get("content-length")),[me,xe]=H&&Bh(Qe,En(yh(H),!0))||[];pe=new i(bh(pe.body,xh,me,()=>{xe&&xe(),we&&we()}),fe)}re=re||"text";let oe=await m[de.findKey(m,re)||"text"](pe,F);return!ue&&we&&we(),await new Promise((fe,Qe)=>{wh(fe,Qe,{data:oe,headers:pA.from(pe.headers),status:pe.status,statusText:pe.statusText,config:F,request:ee})})}catch(ge){throw we&&we(),ge&&ge.name==="TypeError"&&/Load failed|fetch/i.test(ge.message)?Object.assign(new tt("Network Error",tt.ERR_NETWORK,F,ee,ge&&ge.response),{cause:ge.cause||ge}):tt.from(ge,ge&&ge.code,F,ee,ge&&ge.response)}}},l1=new Map,Sh=A=>{let e=A&&A.env||{};const{fetch:t,Request:i,Response:r}=e,n=[i,r,t];let s=n.length,o=s,l,c,h=l1;for(;o--;)l=n[o],c=h.get(l),c===void 0&&h.set(l,c=o?new Map:a1(e)),h=c;return c};Sh();const Ro={http:Lm,xhr:A1,fetch:{get:Sh}};de.forEach(Ro,(A,e)=>{if(A){try{Object.defineProperty(A,"name",{value:e})}catch{}Object.defineProperty(A,"adapterName",{value:e})}});const Eh=A=>`- ${A}`,c1=A=>de.isFunction(A)||A===null||A===!1;function h1(A,e){A=de.isArray(A)?A:[A];const{length:t}=A;let i,r;const n={};for(let s=0;s<t;s++){i=A[s];let o;if(r=i,!c1(i)&&(r=Ro[(o=String(i)).toLowerCase()],r===void 0))throw new tt(`Unknown adapter '${o}'`);if(r&&(de.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(Eh).join(`
5
+ `):" "+Eh(s[0]):"as no adapter specified";throw new tt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const Lh={getAdapter:h1,adapters:Ro};function $o(A){if(A.cancelToken&&A.cancelToken.throwIfRequested(),A.signal&&A.signal.aborted)throw new br(null,A)}function Mh(A){return $o(A),A.headers=pA.from(A.headers),A.data=Go.call(A,A.transformRequest),["post","put","patch"].indexOf(A.method)!==-1&&A.headers.setContentType("application/x-www-form-urlencoded",!1),Lh.getAdapter(A.adapter||vr.adapter,A)(A).then(function(i){return $o(A),i.data=Go.call(A,A.transformResponse,i),i.headers=pA.from(i.headers),i},function(i){return mh(i)||($o(A),i&&i.response&&(i.response.data=Go.call(A,A.transformResponse,i.response),i.response.headers=pA.from(i.response.headers))),Promise.reject(i)})}const Hh="1.13.5",Mn={};["object","boolean","number","function","string","symbol"].forEach((A,e)=>{Mn[A]=function(i){return typeof i===A||"a"+(e<1?"n ":" ")+A}});const Ih={};Mn.transitional=function(e,t,i){function r(n,s){return"[Axios v"+Hh+"] Transitional option '"+n+"'"+s+(i?". "+i:"")}return(n,s,o)=>{if(e===!1)throw new tt(r(s," has been removed"+(t?" in "+t:"")),tt.ERR_DEPRECATED);return t&&!Ih[s]&&(Ih[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}},Mn.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function u1(A,e,t){if(typeof A!="object")throw new tt("options must be an object",tt.ERR_BAD_OPTION_VALUE);const i=Object.keys(A);let r=i.length;for(;r-- >0;){const n=i[r],s=e[n];if(s){const o=A[n],l=o===void 0||s(o,n,A);if(l!==!0)throw new tt("option "+n+" must be "+l,tt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new tt("Unknown option "+n,tt.ERR_BAD_OPTION)}}const Hn={assertOptions:u1,validators:Mn},TA=Hn.validators;let Li=class{constructor(e){this.defaults=e||{},this.interceptors={request:new dh,response:new dh}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?n&&!String(i.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(i.stack+=`
6
+ `+n):i.stack=n}catch{}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ei(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:n}=t;i!==void 0&&Hn.assertOptions(i,{silentJSONParsing:TA.transitional(TA.boolean),forcedJSONParsing:TA.transitional(TA.boolean),clarifyTimeoutError:TA.transitional(TA.boolean),legacyInterceptorReqResOrdering:TA.transitional(TA.boolean)},!1),r!=null&&(de.isFunction(r)?t.paramsSerializer={serialize:r}:Hn.assertOptions(r,{encode:TA.function,serialize:TA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Hn.assertOptions(t,{baseUrl:TA.spelling("baseURL"),withXsrfToken:TA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&de.merge(n.common,n[t.method]);n&&de.forEach(["delete","get","head","post","put","patch","common"],F=>{delete n[F]}),t.headers=pA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(T){if(typeof T.runWhen=="function"&&T.runWhen(t)===!1)return;l=l&&T.synchronous;const S=t.transitional||Ko;S&&S.legacyInterceptorReqResOrdering?o.unshift(T.fulfilled,T.rejected):o.push(T.fulfilled,T.rejected)});const c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});let h,m=0,v;if(!l){const F=[Mh.bind(this),void 0];for(F.unshift(...o),F.push(...c),v=F.length,h=Promise.resolve(t);m<v;)h=h.then(F[m++],F[m++]);return h}v=o.length;let x=t;for(;m<v;){const F=o[m++],T=o[m++];try{x=F(x)}catch(S){T.call(this,S);break}}try{h=Mh.call(this,x)}catch(F){return Promise.reject(F)}for(m=0,v=c.length;m<v;)h=h.then(c[m++],c[m++]);return h}getUri(e){e=Ei(this.defaults,e);const t=Ch(e.baseURL,e.url,e.allowAbsoluteUrls);return ph(t,e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){Li.prototype[e]=function(t,i){return this.request(Ei(i||{},{method:e,url:t,data:(i||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function t(i){return function(n,s,o){return this.request(Ei(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Li.prototype[e]=t(),Li.prototype[e+"Form"]=t(!0)});let p1=class hf{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 i=this;this.promise.then(r=>{if(!i._listeners)return;let n=i._listeners.length;for(;n-- >0;)i._listeners[n](r);i._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{i.subscribe(o),n=o}).then(r);return s.cancel=function(){i.unsubscribe(n)},s},e(function(n,s,o){i.reason||(i.reason=new br(n,s,o),t(i.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=i=>{e.abort(i)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new hf(function(r){e=r}),cancel:e}}};function d1(A){return function(t){return A.apply(null,t)}}function f1(A){return de.isObject(A)&&A.isAxiosError===!0}const Xo={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(Xo).forEach(([A,e])=>{Xo[e]=A});function Ph(A){const e=new Li(A),t=eh(Li.prototype.request,e);return de.extend(t,Li.prototype,e,{allOwnKeys:!0}),de.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Ph(Ei(A,r))},t}const Bt=Ph(vr);Bt.Axios=Li,Bt.CanceledError=br,Bt.CancelToken=p1,Bt.isCancel=mh,Bt.VERSION=Hh,Bt.toFormData=Un,Bt.AxiosError=tt,Bt.Cancel=Bt.CanceledError,Bt.all=function(e){return Promise.all(e)},Bt.spread=d1,Bt.isAxiosError=f1,Bt.mergeConfig=Ei,Bt.AxiosHeaders=pA,Bt.formToJSON=A=>fh(de.isHTMLForm(A)?new FormData(A):A),Bt.getAdapter=Lh.getAdapter,Bt.HttpStatusCode=Xo,Bt.default=Bt;const{Axios:Yb,AxiosError:qb,CanceledError:jb,isCancel:ex,CancelToken:tx,VERSION:Ax,all:ix,Cancel:rx,isAxiosError:nx,spread:sx,toFormData:ox,AxiosHeaders:ax,HttpStatusCode:lx,formToJSON:cx,getAdapter:hx,mergeConfig:ux}=Bt,VA=Object.create(null);VA.open="0",VA.close="1",VA.ping="2",VA.pong="3",VA.message="4",VA.upgrade="5",VA.noop="6";const In=Object.create(null);Object.keys(VA).forEach(A=>{In[VA[A]]=A});const Jo={type:"error",data:"parser error"},Dh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_h=typeof ArrayBuffer=="function",kh=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer,Zo=({type:A,data:e},t,i)=>Dh&&e instanceof Blob?t?i(e):Oh(e,i):_h&&(e instanceof ArrayBuffer||kh(e))?t?i(e):Oh(new Blob([e]),i):i(VA[A]+(e||"")),Oh=(A,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(A)};function Nh(A){return A instanceof Uint8Array?A:A instanceof ArrayBuffer?new Uint8Array(A):new Uint8Array(A.buffer,A.byteOffset,A.byteLength)}let Yo;function g1(A,e){if(Dh&&A.data instanceof Blob)return A.data.arrayBuffer().then(Nh).then(e);if(_h&&(A.data instanceof ArrayBuffer||kh(A.data)))return e(Nh(A.data));Zo(A,!1,t=>{Yo||(Yo=new TextEncoder),e(Yo.encode(t))})}const Kh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let A=0;A<Kh.length;A++)xr[Kh.charCodeAt(A)]=A;const m1=A=>{let e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);const c=new ArrayBuffer(e),h=new Uint8Array(c);for(i=0;i<t;i+=4)n=xr[A.charCodeAt(i)],s=xr[A.charCodeAt(i+1)],o=xr[A.charCodeAt(i+2)],l=xr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},w1=typeof ArrayBuffer=="function",qo=(A,e)=>{if(typeof A!="string")return{type:"message",data:zh(A,e)};const t=A.charAt(0);return t==="b"?{type:"message",data:B1(A.substring(1),e)}:In[t]?A.length>1?{type:In[t],data:A.substring(1)}:{type:In[t]}:Jo},B1=(A,e)=>{if(w1){const t=m1(A);return zh(t,e)}else return{base64:!0,data:A}},zh=(A,e)=>e==="blob"?A instanceof Blob?A:new Blob([A]):A instanceof ArrayBuffer?A:A.buffer,Vh="",y1=(A,e)=>{const t=A.length,i=new Array(t);let r=0;A.forEach((n,s)=>{Zo(n,!1,o=>{i[s]=o,++r===t&&e(i.join(Vh))})})},C1=(A,e)=>{const t=A.split(Vh),i=[];for(let r=0;r<t.length;r++){const n=qo(t[r],e);if(i.push(n),n.type==="error")break}return i};function v1(){return new TransformStream({transform(A,e){g1(A,t=>{const i=t.length;let r;if(i<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,i);else if(i<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}A.data&&typeof A.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let jo;function Pn(A){return A.reduce((e,t)=>e+t.length,0)}function Dn(A,e){if(A[0].length===e)return A.shift();const t=new Uint8Array(e);let i=0;for(let r=0;r<e;r++)t[r]=A[0][i++],i===A[0].length&&(A.shift(),i=0);return A.length&&i<A[0].length&&(A[0]=A[0].slice(i)),t}function T1(A,e){jo||(jo=new TextDecoder);const t=[];let i=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(i===0){if(Pn(t)<1)break;const l=Dn(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?i=3:r===126?i=1:i=2}else if(i===1){if(Pn(t)<2)break;const l=Dn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),i=3}else if(i===2){if(Pn(t)<8)break;const l=Dn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(Jo);break}r=h*Math.pow(2,32)+c.getUint32(4),i=3}else{if(Pn(t)<r)break;const l=Dn(t,r);o.enqueue(qo(n?l:jo.decode(l),e)),i=0}if(r===0||r>A){o.enqueue(Jo);break}}}})}const Wh=4;function kt(A){if(A)return b1(A)}function b1(A){for(var e in kt.prototype)A[e]=kt.prototype[e];return A}kt.prototype.on=kt.prototype.addEventListener=function(A,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+A]=this._callbacks["$"+A]||[]).push(e),this},kt.prototype.once=function(A,e){function t(){this.off(A,t),e.apply(this,arguments)}return t.fn=e,this.on(A,t),this},kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.prototype.removeEventListener=function(A,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+A];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+A],this;for(var i,r=0;r<t.length;r++)if(i=t[r],i===e||i.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+A],this},kt.prototype.emit=function(A){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+A],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(t){t=t.slice(0);for(var i=0,r=t.length;i<r;++i)t[i].apply(this,e)}return this},kt.prototype.emitReserved=kt.prototype.emit,kt.prototype.listeners=function(A){return this._callbacks=this._callbacks||{},this._callbacks["$"+A]||[]},kt.prototype.hasListeners=function(A){return!!this.listeners(A).length};const _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),bA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),x1="arraybuffer";function px(){}function Gh(A,...e){return e.reduce((t,i)=>(A.hasOwnProperty(i)&&(t[i]=A[i]),t),{})}const Q1=bA.setTimeout,F1=bA.clearTimeout;function kn(A,e){e.useNativeTimers?(A.setTimeoutFn=Q1.bind(bA),A.clearTimeoutFn=F1.bind(bA)):(A.setTimeoutFn=bA.setTimeout.bind(bA),A.clearTimeoutFn=bA.clearTimeout.bind(bA))}const U1=1.33;function S1(A){return typeof A=="string"?E1(A):Math.ceil((A.byteLength||A.size)*U1)}function E1(A){let e=0,t=0;for(let i=0,r=A.length;i<r;i++)e=A.charCodeAt(i),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(i++,t+=4);return t}function Rh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function L1(A){let e="";for(let t in A)A.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(A[t]));return e}function M1(A){let e={},t=A.split("&");for(let i=0,r=t.length;i<r;i++){let n=t[i].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class H1 extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class ea extends kt{constructor(e){super(),this.writable=!1,kn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new H1(e,t,i)),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=qo(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=L1(e);return t.length?"?"+t:""}}class I1 extends ea{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 i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};C1(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,y1(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]=Rh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let $h=!1;try{$h=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const P1=$h;function D1(){}class _1 extends I1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let i=location.port;i||(i=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.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,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}class WA extends kt{constructor(e,t,i){super(),this.createRequest=e,kn(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;const t=Gh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&i.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var r;i.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=WA.requestsCount++,WA.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=D1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete WA.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(WA.requestsCount=0,WA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xh);else if(typeof addEventListener=="function"){const A="onpagehide"in bA?"pagehide":"unload";addEventListener(A,Xh,!1)}}function Xh(){for(let A in WA.requests)WA.requests.hasOwnProperty(A)&&WA.requests[A].abort()}const k1=(function(){const A=Jh({xdomain:!1});return A&&A.responseType!==null})();class O1 extends _1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=k1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new WA(Jh,this.uri(),e)}}function Jh(A){const e=A.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||P1))return new XMLHttpRequest}catch{}if(!e)try{return new bA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Zh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class N1 extends ea{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,i=Zh?{}:Gh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}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 i=e[t],r=t===e.length-1;Zo(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}r&&_n(()=>{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]=Rh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ta=bA.WebSocket||bA.MozWebSocket;class K1 extends N1{createSocket(e,t,i){return Zh?new ta(e,t,i):t?new ta(e,t):new ta(e)}doWrite(e,t){this.ws.send(t)}}class z1 extends ea{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=T1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),r=v1();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{i.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 i=e[t],r=t===e.length-1;this._writer.write(i).then(()=>{r&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const V1={websocket:K1,webtransport:z1,polling:O1},W1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,G1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Aa(A){if(A.length>8e3)throw"URI too long";const e=A,t=A.indexOf("["),i=A.indexOf("]");t!=-1&&i!=-1&&(A=A.substring(0,t)+A.substring(t,i).replace(/:/g,";")+A.substring(i,A.length));let r=W1.exec(A||""),n={},s=14;for(;s--;)n[G1[s]]=r[s]||"";return t!=-1&&i!=-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=R1(n,n.path),n.queryKey=$1(n,n.query),n}function R1(A,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function $1(A,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,n){r&&(t[r]=n)}),t}const ia=typeof addEventListener=="function"&&typeof removeEventListener=="function",On=[];ia&&addEventListener("offline",()=>{On.forEach(A=>A())},!1);class ci extends kt{constructor(e,t){if(super(),this.binaryType=x1,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 i=Aa(e);t.hostname=i.host,t.secure=i.protocol==="https"||i.protocol==="wss",t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Aa(t.host).host);kn(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(i=>{const r=i.prototype.name;this.transports.push(r),this._transportsByName[r]=i}),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=M1(this.opts.query)),ia&&(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"})},On.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Wh,t.transport=e,this.id&&(t.sid=this.id);const i=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](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ci.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",ci.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 i=0;i<this.writeBuffer.length;i++){const r=this.writeBuffer[i].data;if(r&&(t+=S1(r)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_n(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const n={type:e,data:t,options:i};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()},i=()=>{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?i():e()}):this.upgrading?i():e()),this}_onError(e){if(ci.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(),ia&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=On.indexOf(this._offlineEventListener);i!==-1&&On.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Wh;class X1 extends ci{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),i=!1;ci.priorWebsocketSuccess=!1;const r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ci.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function n(){i||(i=!0,h(),t.close(),t=null)}const s=m=>{const v=new Error("probe error: "+m);v.transport=t.name,n(),this.emitReserved("upgradeError",v)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const h=()=>{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(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}let J1=class extends X1{constructor(e,t={}){const i=typeof e=="object"?e:t;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(r=>V1[r]).filter(r=>!!r)),super(e,i)}};function Z1(A,e="",t){let i=A;t=t||typeof location<"u"&&location,A==null&&(A=t.protocol+"//"+t.host),typeof A=="string"&&(A.charAt(0)==="/"&&(A.charAt(1)==="/"?A=t.protocol+A:A=t.host+A),/^(https?|wss?):\/\//.test(A)||(typeof t<"u"?A=t.protocol+"//"+A:A="https://"+A),i=Aa(A)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+e,i.href=i.protocol+"://"+n+(t&&t.port===i.port?"":":"+i.port),i}const Y1=typeof ArrayBuffer=="function",q1=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A.buffer instanceof ArrayBuffer,Yh=Object.prototype.toString,j1=typeof Blob=="function"||typeof Blob<"u"&&Yh.call(Blob)==="[object BlobConstructor]",ew=typeof File=="function"||typeof File<"u"&&Yh.call(File)==="[object FileConstructor]";function ra(A){return Y1&&(A instanceof ArrayBuffer||q1(A))||j1&&A instanceof Blob||ew&&A instanceof File}function Nn(A,e){if(!A||typeof A!="object")return!1;if(Array.isArray(A)){for(let t=0,i=A.length;t<i;t++)if(Nn(A[t]))return!0;return!1}if(ra(A))return!0;if(A.toJSON&&typeof A.toJSON=="function"&&arguments.length===1)return Nn(A.toJSON(),!0);for(const t in A)if(Object.prototype.hasOwnProperty.call(A,t)&&Nn(A[t]))return!0;return!1}function tw(A){const e=[],t=A.data,i=A;return i.data=na(t,e),i.attachments=e.length,{packet:i,buffers:e}}function na(A,e){if(!A)return A;if(ra(A)){const t={_placeholder:!0,num:e.length};return e.push(A),t}else if(Array.isArray(A)){const t=new Array(A.length);for(let i=0;i<A.length;i++)t[i]=na(A[i],e);return t}else if(typeof A=="object"&&!(A instanceof Date)){const t={};for(const i in A)Object.prototype.hasOwnProperty.call(A,i)&&(t[i]=na(A[i],e));return t}return A}function Aw(A,e){return A.data=sa(A.data,e),delete A.attachments,A}function sa(A,e){if(!A)return A;if(A&&A._placeholder===!0){if(typeof A.num=="number"&&A.num>=0&&A.num<e.length)return e[A.num];throw new Error("illegal attachments")}else if(Array.isArray(A))for(let t=0;t<A.length;t++)A[t]=sa(A[t],e);else if(typeof A=="object")for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(A[t]=sa(A[t],e));return A}const iw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ct;(function(A){A[A.CONNECT=0]="CONNECT",A[A.DISCONNECT=1]="DISCONNECT",A[A.EVENT=2]="EVENT",A[A.ACK=3]="ACK",A[A.CONNECT_ERROR=4]="CONNECT_ERROR",A[A.BINARY_EVENT=5]="BINARY_EVENT",A[A.BINARY_ACK=6]="BINARY_ACK"})(ct||(ct={}));class rw{constructor(e){this.replacer=e}encode(e){return(e.type===ct.EVENT||e.type===ct.ACK)&&Nn(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=tw(e),i=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(i),r}}class oa extends kt{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 i=t.type===ct.BINARY_EVENT;i||t.type===ct.BINARY_ACK?(t.type=i?ct.EVENT:ct.ACK,this.reconstructor=new nw(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ra(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 i={type:Number(e.charAt(0))};if(ct[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ct.BINARY_EVENT||i.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");i.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););i.nsp=e.substring(n,t)}else i.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}i.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(oa.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ct.CONNECT:return qh(t);case ct.DISCONNECT:return t===void 0;case ct.CONNECT_ERROR:return typeof t=="string"||qh(t);case ct.EVENT:case ct.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&iw.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 nw{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=Aw(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function qh(A){return Object.prototype.toString.call(A)==="[object Object]"}const sw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:oa,Encoder:rw,get PacketType(){return ct}},Symbol.toStringTag,{value:"Module"}));function HA(A,e,t){return A.on(e,t),function(){A.off(e,t)}}const ow=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class jh extends kt{constructor(e,t,i){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,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[HA(e,"open",this.onopen.bind(this)),HA(e,"packet",this.onpacket.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(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 i,r,n;if(ow.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 h=this.ids++,m=t.pop();this._registerAckCallback(h,m),s.id=h}const o=(r=(i=this.io.engine)===null||i===void 0?void 0:i.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 i;const r=(i=this.flags.timeout)!==null&&i!==void 0?i: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((i,r)=>{const n=(s,o)=>s?r(s):i(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 i={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?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),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(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.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 i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);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 i of t)i.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 i=!1;return function(...r){i||(i=!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 i=0;i<t.length;i++)if(e===t[i])return t.splice(i,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 i=0;i<t.length;i++)if(e===t[i])return t.splice(i,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 i of t)i.apply(this,e.data)}}}function Ri(A){A=A||{},this.ms=A.min||100,this.max=A.max||1e4,this.factor=A.factor||2,this.jitter=A.jitter>0&&A.jitter<=1?A.jitter:0,this.attempts=0}Ri.prototype.duration=function(){var A=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*A);A=(Math.floor(e*10)&1)==0?A-t:A+t}return Math.min(A,this.max)|0},Ri.prototype.reset=function(){this.attempts=0},Ri.prototype.setMin=function(A){this.ms=A},Ri.prototype.setMax=function(A){this.max=A},Ri.prototype.setJitter=function(A){this.jitter=A};class aa extends kt{constructor(e,t){var i;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,kn(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((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ri({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||sw;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 J1(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=HA(t,"open",function(){i.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=HA(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(HA(e,"ping",this.onping.bind(this)),HA(e,"data",this.ondata.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(e,"close",this.onclose.bind(this)),HA(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){_n(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new jh(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],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 i;this.cleanup(),(i=this.engine)===null||i===void 0||i.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 i=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&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Qr={};function Kn(A,e){typeof A=="object"&&(e=A,A=void 0),e=e||{};const t=Z1(A,e.path||"/socket.io"),i=t.source,r=t.id,n=t.path,s=Qr[r]&&n in Qr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new aa(i,e):(Qr[r]||(Qr[r]=new aa(i,e)),l=Qr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Kn,{Manager:aa,Socket:jh,io:Kn,connect:Kn});function la(A){if(!A)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(A,e),i=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${i}`}catch{return String(A).trim().replace(/\/+$/,"")}}let yA=la("http://localhost:8000");function eu(A){const e=la(A);e&&e!==yA&&(yA=e,Mt&&(Mt.disconnect(),Mt.removeAllListeners(),Mt=null))}let Mt=null;function aw(){const A=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=A();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:yA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=Kn(yA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),i=()=>{const r=A();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:yA,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:yA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=i();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:yA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:yA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function ca(){const A=la(Mt?.io?.uri||null);return!Mt||Mt.io&&A&&yA&&A!==yA?(Mt&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:A,newBaseUrl:yA,wasConnected:Mt.connected,reason:"baseUrl changed"}),Mt.disconnect(),Mt.removeAllListeners(),Mt=null),Mt=aw()):Mt.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Mt.id,connected:Mt.connected,baseUrl:yA,uri:A}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Mt.id,baseUrl:yA}),Mt}function lw(A,e){const t=ca();return t.on(A,e),()=>t.off(A,e)}function cw(A,e){Mt&&Mt.off(A,e)}function hw(A,e){ca().emit(A,e)}function uw(){return Mt?Mt.connected?"connected":"connecting":"disconnected"}const zn={getSocket:ca,on:lw,off:cw,emit:hw,getStatus:uw,setBaseUrl:eu},pw={},tu=Y.createContext(),$t=()=>{const A=Y.useContext(tu);if(!A)throw new Error("useTrading must be used within TradingProvider");return A},dw=({children:A,baseUrl:e,endpoints:t,accountId:i,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:Ys&&Ys.tagName.toUpperCase()==="SCRIPT"&&Ys.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&pw?.VITE_BASE_URL)??"http://localhost:5002";zn.setBaseUrl(l);const h={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[v,x]=Y.useState(r||"BTC/USD"),[F,T]=Y.useState(n||"M1"),[S,I]=Y.useState([]),[Q,N]=Y.useState(!0),[J,H]=Y.useState([]),[z,re]=Y.useState(!1),[q,ie]=Y.useState(1e5),[G,ne]=Y.useState(null),[le,ee]=Y.useState([]),[we,j]=Y.useState(!0),[ge,ae]=Y.useState(!1),[pe,ue]=Y.useState(!0),[oe,fe]=Y.useState("candles"),[Qe,me]=Y.useState(!1),[xe,Se]=Y.useState(null),[Me,$e]=Y.useState("dark"),[Ye,Ie]=Y.useState(null),[We,De]=Y.useState(!1),[Ze,nt]=Y.useState(!1),[dt,He]=Y.useState(!1),[zt,ye]=Y.useState(!1),[Te,ve]=Y.useState(!1),[be,Le]=Y.useState(!1),[Ee,Ke]=Y.useState(!1),[wt,Dt]=Y.useState(!1),[ni,ZA]=Y.useState(!1),[aA,si]=Y.useState(!1),[_A,YA]=Y.useState([]),Zt=Y.useRef(null),Yt=Y.useRef(new Map),Qt=Y.useRef(null),Lt=1e3,Ct=Y.useCallback(async()=>{if(i)try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;re(!0);const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice===null||Ge.closePrice===void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,stopLoss:Ge.stopLoss,takeProfit:Ge.takeProfit,comment:Ge.comment||"",status:"OPEN",swap:0,profit:Ge.profit||0,profitCurrency:"USD",time:new Date(Ge.openedAt||Ge.openAt||Date.now()).toLocaleTimeString(),openAt:Ge.openedAt||Ge.openAt,closeAt:Ge.closedAt||Ge.closeAt}));H(st)}catch(ze){console.error("❌ Error fetching orders:",ze.response?.data||ze.message),H([])}finally{re(!1)}},[l,i]),Ut=Y.useCallback((ze,Ve)=>!Ve||!ze.price||isNaN(Ve)||isNaN(ze.price)?ze.profit||0:(ze?.type?.toUpperCase()==="BUY"?Ve-ze.price:ze.price-Ve)*ze.volume,[]),Vt=Y.useCallback(async()=>{try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}${h.account}`,{headers:{Authorization:`Bearer ${ze}`}});if(Ve.data&&Ve.data.data){const At=parseFloat(Ve.data.data.balance);isNaN(At)||ie(At)}}catch(ze){console.error("❌ Error fetching user balance:",ze.response?.data||ze.message)}},[l]),je=Y.useCallback(async()=>{if(i)try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice!==null&&Ge.closePrice!==void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,closePrice:Ge.closePrice,stopLoss:Ge.stopLoss,takeProfit:Ge.takeProfit,profit:Ge.profit??Ge.profitLoss??0,profitCurrency:"USD",openAt:Ge.openedAt||Ge.openAt,closeAt:Ge.closedAt||Ge.closeAt,closeReason:Ge.closeReason||"",status:"CLOSED"}));YA(st)}catch(ze){console.error("❌ Error fetching history orders:",ze.response?.data||ze.message),YA([])}},[l,i]),_e=Y.useMemo(()=>{const ze=q,Ve=J.reduce((at,Ne)=>at+Ne.volume*Ne.price*.01,0),At=J.reduce((at,Ne)=>{const Wt=S.find(lA=>lA.symbol===Ne.symbol);if(Wt){const lA=Ne.type?.toUpperCase()==="BUY"?parseFloat(Wt.bid||0):parseFloat(Wt.ask||0);if(lA&&lA>0&&!isNaN(lA))return at+Ut(Ne,lA)}return at+(Ne.profit||0)},0),st=ze+At,Ge=st-Ve,ft=Ve>0?st/Ve*100:0;return{balance:ze,equity:st,margin:Ve,freeMargin:Ge,level:ft.toFixed(2)}},[J,S,q,Ut]);Y.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&i&&(Ct(),Vt(),je())},[Ct,Vt,je,i]),Y.useEffect(()=>{(async()=>{try{N(!0);const Ve=h.symbols.includes("?")?`${l}${h.symbols}`:`${l}${h.symbols}`,At=localStorage.getItem("token")??localStorage.getItem("authToken"),st=await Bt.get(Ve,{headers:At?{Authorization:`Bearer ${At}`}:{}});let Ge=[];Array.isArray(st.data)?Ge=st.data:st.data&&st.data.data&&Array.isArray(st.data.data)?Ge=st.data.data:st.data&&st.data.prices&&Array.isArray(st.data.prices)?Ge=st.data.prices:st.data&&Array.isArray(st.data)&&(Ge=st.data);const ft=Ge.map(at=>{const Ne=at.symbol||at.name||"",Wt=at.category||null;return Ne&&(at.bid!==void 0||at.price!==void 0)?{symbol:Ne,bid:at.bid??at.price??0,ask:at.ask??at.price??0,change:at.change??0,category:Wt}:{...at,symbol:Ne,category:Wt}});ft.length>0?(I(ft),ft.find(Ne=>Ne.symbol===v)||x(ft[0].symbol)):I([])}catch(Ve){console.error("❌ Error fetching symbols:",Ve.response?.data||Ve.message),I([])}finally{N(!1)}})()},[l,h.symbols]);const Je=Y.useCallback(()=>{const ze=Yt.current;if(ze.size===0)return;const Ve=new Map(ze);ze.clear(),I(At=>At.map(st=>{const Ge=Ve.get(st.symbol);return Ge?{...st,...Ge}:st})),H(At=>{let st=!1;const Ge=At.map(ft=>{const at=Ve.get(ft.symbol);if(!at)return ft;const Ne=ft.type?.toUpperCase()==="BUY"?parseFloat(at.bid||0):parseFloat(at.ask||0);if(!Ne||isNaN(Ne)||Ne<=0)return ft;const Wt=Ut(ft,Ne);return Wt===ft.profit?ft:(st=!0,{...ft,profit:Wt})});return st?Ge:At})},[Ut]);Y.useEffect(()=>{Zt.current||(Zt.current=zn.getSocket());const ze=Zt.current,Ve=()=>{console.log("✅ TradingContext: Connected"),i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)})},At=()=>console.log("⚠️ TradingContext: Disconnected"),st=ft=>{ft?.symbol&&(Yt.current.set(ft.symbol,ft),Qt.current||(Qt.current=setTimeout(()=>{Qt.current=null,Je()},Lt)))},Ge=async ft=>{if(ft){if(ft.newBalance!==void 0){const at=parseFloat(ft.newBalance);isNaN(at)||ie(at)}if(window.notify){const at=ft.profitLoss||ft.profit||0,Ne=at>=0?`+${at.toFixed(2)}`:at.toFixed(2),Wt=ft.symbol||"Trade",lA=ft.reason||"Closed";window.notify(`Trade Closed: ${lA} | ${Wt} | P/L: ${Ne} USD`,at>=0?"success":"error")}ft.tradeId&&H(at=>at.filter(Ne=>Ne.id!==ft.tradeId)),await Ct(),await Vt()}};return ze.on("connect",Ve),ze.on("disconnect",At),ze.on("priceUpdate",st),ze.on("tradeClosed",Ge),ze.connected&&i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)}),()=>{ze.off("connect",Ve),ze.off("disconnect",At),ze.off("priceUpdate",st),ze.off("tradeClosed",Ge),Qt.current&&(clearTimeout(Qt.current),Qt.current=null),Yt.current.clear()}},[Je,Ct,Vt]),Y.useEffect(()=>{try{const ze=document.documentElement;if(!ze)return;ze.dataset.theme=Me}catch{}},[Me]);const et=Y.useMemo(()=>S.find(ze=>ze.symbol===v)||{bid:"0.00000",ask:"0.00000",change:0},[S,v]),bt=Y.useMemo(()=>({selectedSymbol:v,setSelectedSymbol:x,selectedTimeframe:F,setSelectedTimeframe:T,symbols:S,setSymbols:I,symbolsLoading:Q,orders:J,setOrders:H,ordersLoading:z,fetchOrders:Ct,fetchUserBalance:Vt,userBalance:q,setUserBalance:ie,accountSummary:_e,currentSymbolData:et,activeTool:G,setActiveTool:ne,chartObjects:le,setChartObjects:ee,showGrid:we,setShowGrid:j,snapToGrid:ge,setSnapToGrid:ae,drawingsVisible:pe,setDrawingsVisible:ue,chartType:oe,setChartType:fe,chartLocked:Qe,setChartLocked:me,selectedTradeForModify:xe,setSelectedTradeForModify:Se,theme:Me,setTheme:$e,candleColors:Ye,setCandleColors:Ie,showTradeOrders:We,setShowTradeOrders:De,showTradePosition:Ze,setShowTradePosition:nt,showTradeHistory:dt,setShowTradeHistory:He,showSLTP:zt,setShowSLTP:ye,showAskPrice:Te,setShowAskPrice:ve,showChartControls:be,setShowChartControls:Le,showTradeNotification:Ee,setShowTradeNotification:Ke,showCrosshair:wt,setShowCrosshair:Dt,showOHLC:ni,setShowOHLC:ZA,baseUrl:l,endpoints:h,endpointParams:m,accountId:i,isShow:aA,setIsShow:si,historyOrders:_A,setHistoryOrders:YA,fetchHistoryOrders:je,indicators:s,indicatorSettings:o}),[v,F,S,Q,J,z,Ct,Vt,q,_e,et,G,le,we,ge,pe,oe,Qe,xe,Me,Ye,We,Ze,dt,zt,Te,be,Ee,wt,ni,l,h,m,aA,_A,je,s,o]);return a.jsx(tu.Provider,{value:bt,children:A})};var Au={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},iu=Y.createContext&&Y.createContext(Au),fw=["attr","size","title"];function gw(A,e){if(A==null)return{};var t=mw(A,e),i,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(A);for(r=0;r<n.length;r++)i=n[r],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(A,i)&&(t[i]=A[i])}return t}function mw(A,e){if(A==null)return{};var t={};for(var i in A)if(Object.prototype.hasOwnProperty.call(A,i)){if(e.indexOf(i)>=0)continue;t[i]=A[i]}return t}function Vn(){return Vn=Object.assign?Object.assign.bind():function(A){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(A[i]=t[i])}return A},Vn.apply(this,arguments)}function ru(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(A,r).enumerable})),t.push.apply(t,i)}return t}function Wn(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ru(Object(t),!0).forEach(function(i){ww(A,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):ru(Object(t)).forEach(function(i){Object.defineProperty(A,i,Object.getOwnPropertyDescriptor(t,i))})}return A}function ww(A,e,t){return e=Bw(e),e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function Bw(A){var e=yw(A,"string");return typeof e=="symbol"?e:e+""}function yw(A,e){if(typeof A!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var i=t.call(A,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function nu(A){return A&&A.map((e,t)=>Y.createElement(e.tag,Wn({key:t},e.attr),nu(e.child)))}function nA(A){return e=>Y.createElement(Cw,Vn({attr:Wn({},A.attr)},e),nu(A.child))}function Cw(A){var e=t=>{var{attr:i,size:r,title:n}=A,s=gw(A,fw),o=r||t.size||"1em",l;return t.className&&(l=t.className),A.className&&(l=(l?l+" ":"")+A.className),Y.createElement("svg",Vn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,i,s,{className:l,style:Wn(Wn({color:A.color||t.color},t.style),A.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),A.children)};return iu!==void 0?Y.createElement(iu.Consumer,null,t=>e(t)):e(Au)}function vw(A){return nA({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:[]}]})(A)}function Tw(A){return nA({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:[]}]})(A)}function bw(A){return nA({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:[]}]})(A)}function xw(A){return nA({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:[]}]})(A)}function su(A){return nA({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:[]}]})(A)}function Qw(A){return nA({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:[]}]})(A)}function Fw(A){return nA({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:[]}]})(A)}function Uw(A){return nA({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:[]}]})(A)}function Sw(A){return nA({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:[]}]})(A)}function Ew(A){return nA({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:[]}]})(A)}const Lw={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ou=({bidPrice:A,askPrice:e,userAccountId:t,onTradeExecuted:i,onExecuteTrade:r,forceParentExecution:n=!1})=>{const{theme:s,selectedSymbol:o,fetchOrders:l,baseUrl:c,endpoints:h}=$t(),m=s==="light",[v,x]=Y.useState("0.01"),[F,T]=Y.useState(""),[S,I]=Y.useState(!1),Q=m?"bg-slate-100":"bg-[#12161d]",N=m?"text-slate-700":"text-white",J=m?"hover:bg-slate-200":"hover:bg-[#1e2635]",H=re=>{const q=parseFloat(v)||.01,ie=Math.max(.01,q+re);x(ie.toFixed(2))},z=async re=>{T("");const q=re,ie=parseFloat(q==="BUY"?e:A),G=parseFloat(v);if(!G||G<=0||isNaN(G)){T("Please enter a valid volume (minimum 0.01)");return}if(G<.01){T("Volume must be at least 0.01");return}if(!ie||ie<=0||isNaN(ie)){T("Invalid price. Please refresh and try again.");return}const ne=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ne){T("Please login to place trades");return}I(!0);const le=typeof o=="object"?o?.symbol:o;if(r){try{await Promise.resolve(r({symbol:le,type:q,lotSize:G,entryPrice:ie,stopLoss:null,takeProfit:null})),l&&l(),i&&i()}catch(we){const j=we?.message||"Trade execution failed";T(j)}finally{I(!1)}return}if(n){T("Trade handler not configured"),I(!1);return}const ee={accountId:t,symbol:le,type:q,volume:G,openPrice:ie,takeProfit:null,stopLoss:null};try{const we=c||Lw?.VITE_BASE_URL||"http://localhost:8000",j=h?.trades||"/api/trades",ge=await Bt.post(`${we}${j}`,ee,{headers:{Authorization:`Bearer ${ne}`,"Content-Type":"application/json"}});if(ge.status<200||ge.status>=300){T(ge.data?.message||`Failed to place trade (${ge.status})`);return}l&&l(),i&&i()}catch(we){const j=we?.response?.data?.message||we?.message||"Network error. Please try again.";T(j)}finally{I(!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:()=>z("SELL"),disabled:S,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:A?Number(A).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 ${Q}`,children:[a.jsx("button",{type:"button",onClick:()=>H(-.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(su,{size:8})}),a.jsx("input",{type:"number",value:v,onChange:re=>{const q=re.target.value;(q===""||/^\d*\.?\d{0,2}$/.test(q))&&x(q)},onBlur:()=>{const re=parseFloat(v);x(isNaN(re)||re<.01?"0.01":re.toFixed(2))},className:`w-14 text-center focus:outline-none ${Q} ${N}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>H(.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(Qw,{size:8})})]}),a.jsxs("button",{onClick:()=>z("BUY"),disabled:S,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):"—"})]})]}),F&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:F})]})},Mw={},au=({isOpen:A,onClose:e,orderType:t,bidPrice:i,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:m,selectedTimeframe:v,setOrders:x,symbols:F,fetchOrders:T,theme:S,baseUrl:I,endpoints:Q}=$t(),N=S==="light",J={getContractSpec:be=>{const Le=String(be||"").toUpperCase();return Le.includes("BTC")||Le.includes("ETH")||Le.includes("SOL")||Le.includes("XRP")||Le.includes("ADA")||Le.includes("DOGE")||Le.includes("BNB")||Le.includes("AVAX")||Le.includes("DOT")||Le.includes("LINK")||Le.endsWith("USDT")?{contractSize:1}:Le.includes("XAU")||Le.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:be,volume:Le})=>{const Ee=J.getContractSpec(be);return(parseFloat(Le)||0)*(Ee.contractSize||1)}},H=h||J,[z,re]=Y.useState("0.01"),[q,ie]=Y.useState(""),[G,ne]=Y.useState(""),[le,ee]=Y.useState(""),[we,j]=Y.useState(!1),[ge,ae]=Y.useState(null),[pe,ue]=Y.useState(""),[oe,fe]=Y.useState(t||"BUY"),[Qe,me]=Y.useState(parseFloat(i)||0),[xe,Se]=Y.useState(parseFloat(r)||0),[Me,$e]=Y.useState("text-white"),[Ye,Ie]=Y.useState("text-white"),We=Y.useRef(parseFloat(i)||0),De=Y.useRef(parseFloat(r)||0);Y.useEffect(()=>{if(!A)return;const be=zn.getSocket(),Le=Ke=>{if(!(!Ke||!Ke.symbol)&&Ke.symbol.toUpperCase()===m?.toUpperCase()){const wt=parseFloat(Ke.bid)||0,Dt=parseFloat(Ke.ask)||0;wt>0&&(wt>We.current?($e("text-green-400"),setTimeout(()=>$e("text-white"),500)):wt<We.current&&We.current>0&&($e("text-red-400"),setTimeout(()=>$e("text-white"),500)),me(wt),We.current=wt),Dt>0&&(Dt>De.current?(Ie("text-green-400"),setTimeout(()=>Ie("text-white"),500)):Dt<De.current&&De.current>0&&(Ie("text-red-400"),setTimeout(()=>Ie("text-white"),500)),Se(Dt),De.current=Dt)}};be.on("priceUpdate",Le);const Ee=F.find(Ke=>Ke.symbol===m);if(Ee){const Ke=parseFloat(Ee.bid)||0,wt=parseFloat(Ee.ask)||0;Ke>0&&(me(Ke),We.current=Ke),wt>0&&(Se(wt),De.current=wt)}return()=>{be.off("priceUpdate",Le)}},[A,m,F]),Y.useEffect(()=>{if(A){re(o?String(o):"0.01"),ie(""),ne(""),ee(""),ue(""),fe(t||"BUY");const be=parseFloat(i)||0,Le=parseFloat(r)||0;be>0&&(me(be),We.current=be),Le>0&&(Se(Le),De.current=Le)}},[A,t,o]);const Ze=Qe||0,nt=xe||0,dt=be=>{const Le=parseFloat(z)||.01,Ee=Math.max(.01,Le+be);re(Ee.toFixed(2))},He=be=>{const Le=parseFloat(q)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)):Ke=Math.max(Ee+1e-5,Ke),ie(Ke>0?Ke.toFixed(5):""),ue("")},zt=be=>{const Le=parseFloat(G)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(Ee+1e-5,Ke):Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)),ne(Ke>0?Ke.toFixed(5):""),ue("")},ye=async be=>{ue("");const Le=be||oe,Ee=parseFloat(Le==="BUY"?xe:Qe),Ke=parseFloat(z),wt=q?parseFloat(q):null,Dt=G?parseFloat(G):null;if(!Ke||Ke<=0||isNaN(Ke)){ue("Please enter a valid volume (minimum 0.01)");return}if(Ke<.01){ue("Volume must be at least 0.01");return}if(!Ee||Ee<=0||isNaN(Ee)){ue("Invalid price. Please refresh and try again.");return}if(wt!==null&&wt!==""){if(isNaN(wt)||wt<=0){ue("Stop Loss must be a valid positive number");return}if(Le==="BUY"&&wt>=Ee){ue("Stop Loss must be below the current price for BUY orders");return}if(Le==="SELL"&&wt<=Ee){ue("Stop Loss must be above the current price for SELL orders");return}}if(Dt!==null&&Dt!==""){if(isNaN(Dt)||Dt<=0){ue("Take Profit must be a valid positive number");return}if(Le==="BUY"){if(Dt<=Ee){ue(`Take Profit must be above the entry price (${Ee.toFixed(5)}) for BUY orders`);return}}else if(Le==="SELL"&&Dt>=Ee){ue(`Take Profit must be below the entry price (${Ee.toFixed(5)}) for SELL orders`);return}}fe(Le),ae(Le),j(!0);const ni=new Date,ZA=ni.toLocaleTimeString(),aA=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,si=localStorage.getItem("token")??localStorage.getItem("authToken");if(!si){ue("Please login to place trades"),j(!1),ae(null);return}const _A={accountId:s,symbol:m,type:Le,volume:Ke,price:Ee,takeProfit:Dt,stopLoss:wt,comment:le.trim()||null},YA={ticket:aA.substring(0,8),symbol:m,type:Le,volume:parseFloat(Ke),price:parseFloat(Ee),time:ZA,stopLoss:wt?parseFloat(wt):null,takeProfit:Dt?parseFloat(Dt):null,swap:0,profit:0,profitCurrency:"USD",comment:le.trim()||"",id:aA,status:"OPEN",openAt:ni.toISOString()};if(!l&&x&&x(Zt=>[...Zt,YA]),c&&!n){ue("Execution handler is required in forceParentExecution mode"),j(!1),ae(null);return}if(n){j(!1),ae(null),e();const Zt={symbol:m,type:Le,lotSize:Ke,entryPrice:Ee,stopLoss:wt,takeProfit:Dt,comment:le.trim()||null};Promise.resolve(n(Zt)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),T&&T()}).catch(Yt=>{console.error("❌ Trade execution failed:",Yt),!l&&x&&x(Qt=>Qt.filter(Lt=>Lt.id!==aA))})}else{if(c){ue("Fallback API path disabled in forceParentExecution mode"),j(!1),ae(null);return}j(!1),ae(null),e();const Zt=I||Mw?.VITE_BASE_URL||"http://localhost:8000",Yt=Q?.trades||"/api/trades";Bt.post(`${Zt}${Yt}`,_A,{headers:{Authorization:`Bearer ${si}`,"Content-Type":"application/json"}}).then(Qt=>{if(Qt.data&&Qt.data.data){const Lt=Qt.data.data.trade;!l&&x&&x(Ct=>Ct.map(Ut=>Ut.id===aA?{...Ut,id:Lt.id,ticket:Lt.id.substring(0,8),time:ZA,openAt:Lt.openAt}:Ut)),console.log("✅ Trade saved successfully:",Lt),window.notify&&window.notify(`Trade placed successfully: ${Lt.symbol} ${Lt.type}`,"success")}else{!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));const Lt=Qt.data?.message||"Failed to place trade";window.notify&&window.notify(Lt,"error")}}).catch(Qt=>{console.error("Error placing trade:",Qt),!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));let Lt="Failed to place trade";if(Qt.response){const Ct=Qt.response.status,Ut=Qt.response.data;Ct===400?Lt=Ut?.message||"Invalid trade data. Please check your inputs.":Ct===401?Lt="Authentication failed. Please login again.":Ct===404?Lt=Ut?.message||"Symbol not found. Please select a valid symbol.":Ct===500?Lt="Server error. Please try again later.":Lt=Ut?.message||`Error: ${Ct}`}else Qt.request&&(Lt="Network error. Please check your internet connection.");window.notify&&window.notify(Lt,"error")})}},ve=(H?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return A?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:[pe&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:pe}),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:[ve," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>dt(-.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:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d{0,2}$/.test(Le))&&(re(Le),ue(""))},onBlur:()=>{const be=parseFloat(z);re(isNaN(be)||be<.01?"0.01":be.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:()=>dt(.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:()=>He(-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:q,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ie(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ie(Le.toFixed(5)):be.target.value===""&&ie("")},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:()=>He(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:()=>zt(-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:G,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ne(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ne(Le.toFixed(5)):be.target.value===""&&ne("")},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:()=>zt(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:le,onChange:be=>ee(be.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:`${Me} font-medium transition-colors duration-400`,children:Ze>0?Ze.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:`${Ye} font-medium transition-colors duration-400`,children:nt>0?nt.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>ye("SELL"),disabled:we,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:we&&ge==="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:()=>ye("BUY"),disabled:we,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:we&&ge==="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},Hw={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],Gn=[{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"}],hi={width:"78%",height:"78%",display:"block"},lu={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Pw(A){return A?{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 Nt(A,e="#5f8f96"){if(typeof A!="string")return e;const t=A.trim();if(!t)return e;const i=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(i)?i.toLowerCase():e}const Dw=()=>a.jsx(Sw,{style:hi}),_w=()=>a.jsx(Ew,{style:hi}),kw=()=>a.jsx(xw,{style:hi}),Ow=()=>a.jsx(Uw,{style:hi}),Nw=()=>a.jsx(Tw,{style:hi}),Kw=()=>a.jsx(vw,{style:hi}),zw=()=>a.jsx(bw,{style:hi}),Vw=()=>a.jsx(su,{style:hi}),ha=({size:A,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:A,height:A},children:e});function Fr({checked:A,onClick:e,hideLeftBorder:t,tokens:i,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 ${i.border}`,borderLeftWidth:t?0:1,background:A?i.activeFill:"transparent",color:A?i.activeText:i.text,cursor:"pointer",padding:0},children:a.jsx(ha,{size:"18px",children:r})})}function ke({checked:A,onChange:e,label:t,tokens:i,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:A,onChange:n=>e(n.target.checked),disabled:r,style:lu}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${i.border}`,background:i.fieldBg},children:A&&a.jsx("span",{style:{width:10,height:10,background:i.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:i.text},children:t})]})}function ht({value:A,onChange:e,onBlur:t,disabled:i=!1,tokens:r}){const n=Nt(A,"#5f8f96"),s=(A||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:i?.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:i?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:h=>e(h.target.value),disabled:i,style:{...lu,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:h=>{const m=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:i,style:c})]})}function mt({tokens:A,disabled:e=!1,style:t={},...i}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?A.fieldDisabledBg:A.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?A.fieldDisabledBg:A.fieldBg,color:e?A.fieldDisabledText:A.text,...t},...i})}function ui({value:A,onChange:e,tokens:t,disabled:i=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:A,onChange:e,disabled:i,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${i?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:i?t.fieldDisabledBg:t.fieldBg,color:i?t.fieldDisabledText:t.text,cursor:i?"default":"pointer",opacity:i?.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(Vw,{})})]})}function Ww({draft:A,setDraft:e,tokens:t}){const i=A.visibleTimeframes?.length===Gn.length,r=()=>{e(s=>({...s,visibleTimeframes:i?[]:Gn.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(ke,{checked:i,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:Gn.map(s=>a.jsx(ke,{checked:(A.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:i},s.key))})]})}function Gw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{i(n,Nt(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(ht,{value:A.color||"#5f8f96",onChange:n=>i("color",n),onBlur:()=>r("color",A.color,"#5f8f96"),tokens:t}),a.jsx(ui,{value:A.fontSize||12,onChange:n=>i("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(Fr,{checked:A.fontWeight==="bold",onClick:()=>i("fontWeight",A.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(kw,{})}),a.jsx(Fr,{checked:A.fontStyle==="italic",onClick:()=>i("fontStyle",A.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Ow,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Fr,{checked:A.textAlign==="left",onClick:()=>i("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(Nw,{})}),a.jsx(Fr,{checked:A.textAlign==="center",onClick:()=>i("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Kw,{})}),a.jsx(Fr,{checked:A.textAlign==="right",onClick:()=>i("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(zw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(ke,{checked:!!A.textWrap,onChange:n=>i("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.borderEnabled,onChange:n=>i("borderEnabled",n),label:"Border",tokens:t}),a.jsx(ht,{value:A.borderColor||"#5f8f96",onChange:n=>i("borderColor",n),onBlur:()=>r("borderColor",A.borderColor,"#5f8f96"),disabled:!A.borderEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.borderEnabled,value:A.borderOpacity??.1,onChange:n=>i("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:!A.borderEnabled,value:A.borderWidth??1,onChange:n=>i("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:A.borderWidth??1})]}),a.jsx(ke,{checked:!!A.bgEnabled,onChange:n=>i("bgEnabled",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.bgColor||"#5f8f96",onChange:n=>i("bgColor",n),onBlur:()=>r("bgColor",A.bgColor,"#5f8f96"),disabled:!A.bgEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.bgEnabled,value:A.bgOpacity??.1,onChange:n=>i("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:A.text||"",onChange:n=>i("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 Rw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:n=>i("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:A.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(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("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(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("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(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("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(ke,{checked:!!A.statsShowAlways,onChange:n=>i("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(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Rn({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#22c55e",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:n=>i("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:A.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(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("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(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("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(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("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(ke,{checked:!!A.statsShowAlways,onChange:n=>i("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(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function $w({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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(ke,{checked:A.showArea!==!1,onChange:n=>i("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(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("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(ke,{checked:!!A.statsShowAlways,onChange:n=>i("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(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Xw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:n=>i("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:A.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(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("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(ke,{checked:!!A.statsShowAlways,onChange:n=>i("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(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Jw({draft:A,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(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function dA(A){if(!A)return"";const e=new Date(A*1e3),t=i=>String(i).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function xA({draft:A,setDraft:e,tokens:t}){const i=(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:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("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:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]})]})}function cu({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=!A.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(ht,{value:A.lineColor||"#3b82f6",onChange:s=>i("lineColor",s),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:s=>i("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:A.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(ke,{checked:A.showPrice!==!1,onChange:s=>i("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.showText,onChange:s=>i("showText",s),label:"Show text",tokens:t}),a.jsx(ht,{value:A.textColor||"#ffffff",onChange:s=>i("textColor",s),onBlur:()=>r("textColor",A.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ui,{value:A.textHAlign??"center",onChange:s=>i("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(ui,{value:A.textVAlign??"top",onChange:s=>i("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:A.textContent||"",onChange:s=>i("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 Zw({draft:A,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(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Yw({draft:A,setDraft:e,tokens:t}){const i={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:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.originTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function qw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:n=>i("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:A.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(ke,{checked:A.showDate!==!1,onChange:n=>i("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function jw({draft:A,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:dA(A.rawTime),style:t})]})})}function eB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:n=>i("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:A.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(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("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(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("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(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("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(ke,{checked:!!A.statsShowAlways,onChange:n=>i("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(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function tB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#06a0e3",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:n=>i("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:A.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(ke,{checked:!!A.showTime,onChange:n=>i("showTime",n),label:"Show time",tokens:t}),a.jsx(ke,{checked:!!A.showPrice,onChange:n=>i("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function AB({draft:A,setDraft:e,tokens:t}){const i={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:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.rawTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function iB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l,c,h,m)=>a.jsxs(a.Fragment,{children:[a.jsx(ke,{checked:!!A[h],onChange:v=>i(h,v),label:s,tokens:t}),a.jsx(ht,{value:A[o]||m,onChange:v=>i(o,v),onBlur:()=>r(o,A[o],m),tokens:t}),a.jsx(mt,{tokens:t,value:A[l]??.35,onChange:v=>{const x=parseFloat(v.target.value);Number.isFinite(x)&&i(l,Math.max(0,Math.min(1,x)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A[c]??1,onChange:v=>i(c,Number(v.target.value)),style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A[c]??1})]})]});return a.jsxs("div",{style:{padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14,marginBottom:14},children:[n("Base line","baseLineColor","baseLineOpacity","baseLineWidth","showBaseLine","#ff0000"),n("Upper line","upperLineColor","upperLineOpacity","upperLineWidth","showUpperLine","#0000ff"),n("Lower line","lowerLineColor","lowerLineOpacity","lowerLineWidth","showLowerLine","#0000ff")]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Opacity"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:70},children:"Extension"}),a.jsx(ke,{checked:!!A.extendLeft,onChange:s=>i("extendLeft",s),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.extendRight,onChange:s=>i("extendRight",s),label:"Right",tokens:t})]}),a.jsx(ke,{checked:!!A.showPearsonsR,onChange:s=>i("showPearsonsR",s),label:"Show Pearson's R",tokens:t})]})]})}function rB({draft:A,tokens:e}){const t={height:30,width:"100%",border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},i={display:"grid",gridTemplateColumns:"100px 1fr",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:t})]}),a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:t})]})]})}function nB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||"#8b5cf6",onChange:n=>i("strokeColor",n),onBlur:()=>r("strokeColor",A.strokeColor,"#8b5cf6"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14},children:[a.jsx(ke,{checked:!!A.showMiddleLine,onChange:n=>i("showMiddleLine",n),label:"Middle line",tokens:t}),a.jsx(ht,{value:A.middleLineColor||"#8b5cf6",onChange:n=>i("middleLineColor",n),onBlur:()=>r("middleLineColor",A.middleLineColor,"#8b5cf6"),tokens:t,disabled:!A.showMiddleLine}),a.jsx(mt,{tokens:t,disabled:!A.showMiddleLine,value:A.middleLineOpacity??.5,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("middleLineOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.middleLineWidth??1,onChange:n=>i("middleLineWidth",Number(n.target.value)),disabled:!A.showMiddleLine,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.middleLineWidth??1})]}),a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||"#b4a7d6",onChange:n=>i("backgroundColor",n),onBlur:()=>r("backgroundColor",A.backgroundColor,"#b4a7d6"),tokens:t,disabled:!A.showBackground}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("backgroundOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsx("div",{})]}),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(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]})]})}function sB({draft:A,setDraft:e,tokens:t}){const i=(o,l)=>{const c=parseFloat(l);Number.isFinite(c)&&e(h=>({...h,[o]:c}))},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},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},s={display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:o=>i("point1Price",o.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:o=>i("point2Price",o.target.value)})]}),a.jsxs("div",{style:s,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:o=>i("point3Price",o.target.value)})]})]})}function oB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>e(c=>{const h=c.rays?[...c.rays]:[];return h[s]={...h[s],[o]:l},{...c,rays:h}}),n=[...A.rays??[]].reverse();return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"60px 1fr 2fr 1fr",gap:8,alignItems:"center"},children:n.map((s,o)=>{const l=(A.rays??[]).findIndex(c=>c.ratio===s.ratio);return a.jsxs(Y.Fragment,{children:[a.jsx(mt,{tokens:t,value:s.label,onChange:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&r(l,"ratio",h),r(l,"label",c.target.value)},onBlur:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&(r(l,"ratio",h),r(l,"label",h%1===0?h.toFixed(2):String(h)))},style:{width:60}}),a.jsx(ht,{value:s.color||"#888888",onChange:c=>r(l,"color",c),onBlur:()=>r(l,"color",Nt(s.color,"#888888")),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:c=>r(l,"width",Number(c.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]}),a.jsx("div",{})]},o)})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.backgroundColor||"#3b82f6",onChange:s=>i("backgroundColor",s),onBlur:()=>i("backgroundColor",Nt(A.backgroundColor,"#3b82f6")),tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Background"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]}),a.jsx(ke,{checked:!!A.showLabels,onChange:s=>i("showLabels",s),label:"Show labels",tokens:t})]})}function aB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Divisions"}),a.jsx(mt,{tokens:t,value:A.divisions??8,min:2,max:50,step:1,onChange:r=>i("divisions",Number(r.target.value)),onBlur:r=>i("divisions",Math.max(2,Math.min(50,parseInt(r.target.value)||8))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line color"}),a.jsx(ht,{value:A.lineColor??"#94a3b8",onChange:r=>i("lineColor",r),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line width"}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsx(ke,{label:"Show background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Background"}),a.jsx(ht,{value:A.backgroundColor??"#3b82f6",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.08,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",parseFloat(r.target.value)||0),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r.target.value)||0))),style:{width:60}})]})]})}function lB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l)=>e(c=>{const h=c.levels?[...c.levels]:[];return h[s]={...h[s],[o]:l},{...c,levels:h}});return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.medianColor||"#a50000",onChange:s=>i("medianColor",s),onBlur:()=>r("medianColor",A.medianColor,"#a50000"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.medianWidth??1,onChange:s=>i("medianWidth",Number(s.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.medianWidth??1})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"auto 40px 1fr 2fr",gap:8,alignItems:"center"},children:(A.levels??[]).map((s,o)=>a.jsxs(Y.Fragment,{children:[a.jsx("input",{type:"checkbox",checked:!!s.enabled,onChange:l=>n(o,"enabled",l.target.checked),style:{accentColor:t.headerBlue,margin:0}}),a.jsx("span",{style:{fontSize:12,color:t.text},children:s.label}),a.jsx(ht,{value:s.color||"#888888",onChange:l=>n(o,"color",l),onBlur:()=>n(o,"color",Nt(s.color,"#888888")),tokens:t,disabled:!s.enabled}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:l=>n(o,"width",Number(l.target.value)),disabled:!s.enabled,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]})]},s.k))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]})]})}function cB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=parseFloat(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},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},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point3Time),style:r}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function ua({draft:A,setDraft:e,tokens:t,strokeDefault:i="#7aa6ae",bgDefault:r="#b4a7d6"}){const n=(s,o)=>e(l=>({...l,[s]:o}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||i,onChange:s=>n("strokeColor",s),onBlur:()=>n("strokeColor",Nt(A.strokeColor,i)),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:s=>n("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{fontSize:12,color:t.text,minWidth:12,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:A.showBackground!==!1,onChange:s=>n("showBackground",s),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||r,onChange:s=>n("backgroundColor",s),onBlur:()=>n("backgroundColor",Nt(A.backgroundColor,r)),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,min:0,max:1,step:.01,onChange:s=>n("backgroundOpacity",parseFloat(s.target.value)||0),onBlur:s=>n("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(s.target.value)||0))),style:{width:60}})]})]})}function hB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function uB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function pB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function dB({draft:A,setDraft:e,tokens:t}){const i=(h,m)=>e(v=>({...v,[h]:m})),r=h=>{if(!h)return"";const m=new Date(h*1e3),v=String(m.getUTCDate()).padStart(2,"0"),x=String(m.getUTCMonth()+1).padStart(2,"0"),F=m.getUTCFullYear(),T=String(m.getUTCHours()).padStart(2,"0"),S=String(m.getUTCMinutes()).padStart(2,"0"),I=String(m.getUTCSeconds()).padStart(2,"0");return`${v}.${x}.${F} ${T}:${S}:${I}`},n={display:"grid",gridTemplateColumns:"110px 1fr 100px",gap:8,alignItems:"center",marginBottom:6},s={fontSize:12,color:t.mutedText},o={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldDisabledBg,color:t.fieldDisabledText,boxSizing:"border-box"},l={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldBg,color:t.text,boxSizing:"border-box",outline:"none"},c=[{label:"#1 (Bar, Price)",timeKey:"point1Time",priceKey:"point1Price"},{label:"#2 (Bar, Price)",timeKey:"point2Time",priceKey:"point2Price"},{label:"#3 (Bar, Price)",timeKey:"point3Time",priceKey:"point3Price"}];return a.jsx("div",{style:{padding:"12px 16px"},children:c.map(({label:h,timeKey:m,priceKey:v})=>a.jsxs("div",{style:n,children:[a.jsx("span",{style:s,children:h}),a.jsx("input",{style:o,value:r(A[m]),readOnly:!0}),a.jsx("input",{type:"number",style:l,value:A[v]??0,step:"0.00001",onChange:x=>i(v,parseFloat(x.target.value)||0)})]},h))})}function fB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ht,{value:A.strokeColor??"#7aa6ae",onChange:r=>i("strokeColor",r),tokens:t}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ke,{label:"Background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsx(ht,{value:A.backgroundColor??"#94a3b8",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.18,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",r),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r)||0))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[a.jsx("span",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Extension"}),a.jsx(ke,{label:"Left",checked:!!A.extendLeft,onChange:r=>i("extendLeft",r),tokens:t}),a.jsx(ke,{label:"Right",checked:!!A.extendRight,onChange:r=>i("extendRight",r),tokens:t})]})]})}function gB({draft:A,tokens:e}){const t=[{label:"#1 (Bar, Price)",time:A.point1Time,price:A.point1Price},{label:"#2 (Bar, Price)",time:A.point1Time,price:A.point4Price},{label:"#3 (Bar, Price)",time:A.point2Time,price:A.point1Price},{label:"#4 (Bar, Price)",time:A.point2Time,price:A.point4Price}],i={height:28,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},r={height:28,width:80,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"12px 16px"},children:t.map((n,s)=>a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"110px 1fr 80px",alignItems:"center",gap:6},children:[a.jsx("span",{style:{fontSize:12,color:e.mutedText},children:n.label}),a.jsx("input",{readOnly:!0,value:n.time?new Date(n.time*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).replace(",",""):"—",style:i}),a.jsx("input",{readOnly:!0,value:n.price!=null?Number(n.price).toFixed(5):"—",style:r})]},s))})}function hu({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(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(ht,{value:A.lineColor||"#129f5c",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.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:A.lineWidth??2,onChange:n=>i("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:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.fillColor||"#6aa84f",onChange:n=>i("fillColor",n),onBlur:()=>r("fillColor",A.fillColor,"#6aa84f"),tokens:t}),a.jsx(mt,{tokens:t,value:A.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showPrices,onChange:n=>i("showPrices",n),label:"Prices",tokens:t}),a.jsx(ht,{value:A.pricesColor||"#129f5c",onChange:n=>i("pricesColor",n),onBlur:()=>r("pricesColor",A.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(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("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(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]})]})}function uu({draft:A,setDraft:e,tokens:t}){const i=(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:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("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:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("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(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function mB(A){if(!A)return{};const e={visibleTimeframes:A.visibleTimeframes||Gn.map(t=>t.key)};if(A.type==="gannline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#7aa6ae",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="trendline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#22c55e",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="text")return{...e,text:A.primitive?.text??A.text??"Text",color:A.primitive?.color??"#5f8f96",fontSize:A.primitive?.fontSize??12,fontWeight:A.primitive?.fontWeight??"normal",fontStyle:A.primitive?.fontStyle??"normal",textAlign:A.primitive?.textAlign??"center",textWrap:A.primitive?.textWrap??!1,borderEnabled:A.primitive?.borderEnabled??!1,borderColor:A.primitive?.borderColor??"#5f8f96",borderOpacity:A.primitive?.borderOpacity??.1,borderWidth:A.primitive?.borderWidth??1,bgEnabled:A.primitive?.bgEnabled??!1,bgColor:A.primitive?.bgColor??"#5f8f96",bgOpacity:A.primitive?.bgOpacity??.1,price:A.price};if(A.type==="pricelevel")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price};if(A.type==="horizontalray")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price,originTime:A.rawOriginTime??A.originTime};if(A.type==="verticalline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showDate:A.showDate!==!1,rawTime:A.rawTime};if(A.type==="infoline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!0,statsPriceRange:A.statsPriceRange??!0,statsBarsRange:A.statsBarsRange??!0,statsDateRange:A.statsDateRange??!0,statsAngle:A.statsAngle??!0,statsDistance:A.statsDistance??!0,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="arrowedline")return{...e,lineColor:A.lineColor??"#f59e0b",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight!==!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="rayline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="extendedline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft!==!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="crossline")return{...e,lineColor:A.lineColor??"#06a0e3",lineWidth:A.lineWidth??2,showTime:A.showTime??!1,showPrice:A.showPrice??!1,rawTime:A.p?.rawTime??0,price:A.p?.price??0};if(A.type==="trendbyangle")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="disjointchannel")return{...e,lineColor:A.lineColor??"#129f5c",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#6aa84f",fillOpacity:A.fillOpacity??.1,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#129f5c",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="flattopbottom")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#3b82f6",fillOpacity:A.fillOpacity??.12,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#3b82f6",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="gannfan"){const t=A.primitive,i=[{ratio:.125,label:"0.13",color:"#a06b00",width:1},{ratio:.25,label:"0.25",color:"#699e00",width:1},{ratio:.333333,label:"0.30",color:"#009b00",width:1},{ratio:.5,label:"0.50",color:"#009965",width:1},{ratio:1,label:"1.00",color:"#808080",width:1},{ratio:2,label:"2.00",color:"#006599",width:1},{ratio:3,label:"3.00",color:"#000099",width:1},{ratio:4,label:"4.00",color:"#660099",width:1},{ratio:8,label:"8.00",color:"#a50000",width:1}],r=A.rays??(t?._rays?t._rays.map(n=>({...n})):i);return{...e,rays:r,showLabels:t?t.showLabels??!0:A.showLabels??!0,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="ganngrid"){const t=A.primitive;return{...e,divisions:t?.divisions??A.divisions??8,lineColor:t?.lineColor??A.lineColor??"#94a3b8",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.08,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="triangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0,point3Time:A.p3?.rawTime??0,point3Price:A.p3?.price??0}}if(A.type==="circle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="ellipse"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="rectangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#94a3b8",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.18,extendLeft:t?.extendLeft??A.extendLeft??!1,extendRight:t?.extendRight??A.extendRight??!1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point4Price:A.p2?.price??0}}return A.type==="andrewspitchfork"?{...e,medianColor:A.medianColor??"#a50000",medianWidth:A.medianWidth??1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,levels:A.levels??[{k:.25,label:"0.25",color:"#a06b00",width:1,enabled:!0},{k:.38,label:"0.38",color:"#699e00",width:1,enabled:!0},{k:.5,label:"0.50",color:"#009b00",width:1,enabled:!0},{k:.62,label:"0.62",color:"#009965",width:1,enabled:!0},{k:.75,label:"0.75",color:"#006599",width:1,enabled:!0},{k:1,label:"1.00",color:"#000099",width:1,enabled:!0},{k:1.5,label:"1.50",color:"#660099",width:1,enabled:!0},{k:1.75,label:"1.75",color:"#990066",width:1,enabled:!0},{k:2,label:"2.00",color:"#a50000",width:1,enabled:!0}],point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point3Time:A.p3?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="equidistantchannel"?{...e,strokeColor:A.strokeColor??"#8b5cf6",lineWidth:A.lineWidth??1,showMiddleLine:A.showMiddleLine??!1,middleLineColor:A.middleLineColor??"#8b5cf6",middleLineOpacity:A.middleLineOpacity??.5,middleLineWidth:A.middleLineWidth??1,showBackground:A.showBackground!==!1,backgroundColor:A.backgroundColor??"#b4a7d6",backgroundOpacity:A.backgroundOpacity??.1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="regressionchannel"||A.type==="stddevchannel"?{...e,baseLineColor:A.baseLineColor??"#ff0000",baseLineOpacity:A.baseLineOpacity??.35,baseLineWidth:A.baseLineWidth??1,showBaseLine:A.showBaseLine!==!1,upperLineColor:A.upperLineColor??"#0000ff",upperLineOpacity:A.upperLineOpacity??.35,upperLineWidth:A.upperLineWidth??1,showUpperLine:A.showUpperLine!==!1,lowerLineColor:A.lowerLineColor??"#0000ff",lowerLineOpacity:A.lowerLineOpacity??.35,lowerLineWidth:A.lowerLineWidth??1,showLowerLine:A.showLowerLine!==!1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,extendLeft:A.extendLeft??!1,extendRight:A.extendRight??!1,showPearsonsR:A.showPearsonsR!==!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0}:A.type==="rulerline"?{...e,lineColor:A.lineColor??"#3b82f6",showArea:A.showArea!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways!==!1,statsPriceRange:A.statsPriceRange!==!1,statsBarsRange:A.statsBarsRange!==!1,statsDateRange:A.statsDateRange!==!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}:e}const pu=({isOpen:A,onClose:e,chartObject:t,onUpdate:i})=>{const{theme:r}=$t(),s=Pw(r==="light"),[o,l]=Y.useState("style"),[c,h]=Y.useState({}),[m,v]=Y.useState(null),x=Y.useRef(null),F=Y.useRef(null);Y.useEffect(()=>{t&&(h(mB(t)),l("style"))},[t]),Y.useEffect(()=>{A||v(null)},[A]);const T=H=>{if(H.button!==0)return;H.preventDefault();const z=x.current;if(!z)return;const re=z.offsetParent,q=re?re.getBoundingClientRect():{left:0,top:0},ie=z.getBoundingClientRect(),G=ie.left-q.left,ne=ie.top-q.top;F.current={startMX:H.clientX,startMY:H.clientY,startX:G,startY:ne},v({x:G,y:ne});const le=we=>{const{startMX:j,startMY:ge,startX:ae,startY:pe}=F.current;v({x:ae+we.clientX-j,y:pe+we.clientY-ge})},ee=()=>{F.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ee)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",ee)};if(!A||!t)return null;const S=Hw[t.type]||t.type,I=["style","coordinates","visualization"],Q=()=>{if(o==="visualization")return a.jsx(Ww,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Gw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Jw,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannline"){if(o==="style")return a.jsx(Rw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Zw,{draft:c,setDraft:h,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Yw,{draft:c,setDraft:h,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(qw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(jw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Xw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx($w,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(tB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(AB,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(eB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannfan"){if(o==="style")return a.jsx(oB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ganngrid"){if(o==="style")return a.jsx(aB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="triangle"){if(o==="style")return a.jsx(uB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(dB,{draft:c,setDraft:h,tokens:s})}if(t.type==="circle"){if(o==="style")return a.jsx(hB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ellipse"){if(o==="style")return a.jsx(pB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rectangle"){if(o==="style")return a.jsx(fB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(gB,{draft:c,tokens:s})}if(t.type==="andrewspitchfork"){if(o==="style")return a.jsx(lB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(cB,{draft:c,setDraft:h,tokens:s})}if(t.type==="equidistantchannel"){if(o==="style")return a.jsx(nB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(sB,{draft:c,setDraft:h,tokens:s})}if(t.type==="regressionchannel"||t.type==="stddevchannel"){if(o==="style")return a.jsx(iB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(rB,{draft:c,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=()=>{i(c),e()};return a.jsxs("div",{ref:x,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:T,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:S}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(ha,{size:"18px",children:a.jsx(Dw,{})})})]})}),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(ha,{size:"20px",children:a.jsx(_w,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:I.map(H=>{const z=o===H;return a.jsxs("button",{type:"button",onClick:()=>l(H),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:[H.charAt(0).toUpperCase()+H.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},H)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:Q()}),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 pa=function(A,e){return pa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])},pa(A,e)};function IA(A,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pa(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var da=function(){return da=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},da.apply(this,arguments)};function sA(A,e,t,i){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(h){try{c(i.next(h))}catch(m){s(m)}}function l(h){try{c(i.throw(h))}catch(m){s(m)}}function c(h){h.done?n(h.value):r(h.value).then(o,l)}c((i=i.apply(A,[])).next())})}function tA(A,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,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(h){return l([c,h])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=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(A,t)}catch(h){c=[6,h],r=0}finally{i=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $n(A,e,t){if(arguments.length===2)for(var i=0,r=e.length,n;i<r;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return A.concat(n||e)}for(var ti=(function(){function A(e,t,i,r){this.left=e,this.top=t,this.width=i,this.height=r}return A.prototype.add=function(e,t,i,r){return new A(this.left+e,this.top+t,this.width+i,this.height+r)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var i=Array.from(t).find(function(r){return r.width!==0});return i?new A(i.left+e.windowBounds.left,i.top+e.windowBounds.top,i.width,i.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A})(),Xn=function(A,e){return ti.fromClientRect(A,e.getBoundingClientRect())},wB=function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var i=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 ti(0,0,i,r)},Jn=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},It=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},du="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BB=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<du.length;Zn++)BB[du.charCodeAt(Zn)]=Zn;for(var fu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),Yn=0;Yn<fu.length;Yn++)Ur[fu.charCodeAt(Yn)]=Yn;for(var yB=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Ur[A.charCodeAt(i)],s=Ur[A.charCodeAt(i+1)],o=Ur[A.charCodeAt(i+2)],l=Ur[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},CB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},vB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Mi=5,fa=11,ga=2,TB=fa-Mi,gu=65536>>Mi,bB=1<<Mi,ma=bB-1,xB=1024>>Mi,QB=gu+xB,FB=QB,UB=32,SB=FB+UB,EB=65536>>fa,LB=1<<TB,MB=LB-1,mu=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},HB=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},IB=function(A,e){var t=yB(A),i=Array.isArray(t)?vB(t):new Uint32Array(t),r=Array.isArray(t)?CB(t):new Uint16Array(t),n=24,s=mu(r,n/2,i[4]/2),o=i[5]===2?mu(r,(n+i[4])/2):HB(i,Math.ceil((n+i[4])/4));return new PB(i[0],i[1],i[2],i[3],s,o)},PB=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mi],t=(t<<ga)+(e&ma),this.data[t];if(e<=65535)return t=this.index[gu+(e-55296>>Mi)],t=(t<<ga)+(e&ma),this.data[t];if(e<this.highStart)return t=SB-EB+(e>>fa),t=this.index[t],t+=e>>Mi&MB,t=this.index[t],t=(t<<ga)+(e&ma),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",DB=typeof Uint8Array>"u"?[]:new Uint8Array(256),qn=0;qn<wu.length;qn++)DB[wu.charCodeAt(qn)]=qn;var _B="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==",Bu=50,kB=1,yu=2,Cu=3,OB=4,NB=5,vu=7,Tu=8,bu=9,pi=10,wa=11,xu=12,Ba=13,KB=14,Sr=15,ya=16,jn=17,Er=18,zB=19,Qu=20,Ca=21,Lr=22,va=23,$i=24,CA=25,Mr=26,Hr=27,Xi=28,VB=29,Hi=30,WB=31,es=32,ts=33,Ta=34,ba=35,xa=36,Ir=37,Qa=38,As=39,is=40,Fa=41,Fu=42,GB=43,RB=[9001,65288],Uu="!",lt="×",rs="÷",Ua=IB(_B),Ai=[Hi,xa],Sa=[kB,yu,Cu,NB],Su=[pi,Tu],Eu=[Hr,Mr],$B=Sa.concat(Su),Lu=[Qa,As,is,Ta,ba],XB=[Sr,Ba],JB=function(A,e){e===void 0&&(e="strict");var t=[],i=[],r=[];return A.forEach(function(n,s){var o=Ua.get(n);if(o>Bu?(r.push(!0),o-=Bu):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return i.push(s),t.push(ya);if(o===OB||o===wa){if(s===0)return i.push(s),t.push(Hi);var l=t[s-1];return $B.indexOf(l)===-1?(i.push(i[s-1]),t.push(l)):(i.push(s),t.push(Hi))}if(i.push(s),o===WB)return t.push(e==="strict"?Ca:Ir);if(o===Fu||o===VB)return t.push(Hi);if(o===GB)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Ir):t.push(Hi);t.push(o)}),[i,t,r]},Ea=function(A,e,t,i){var r=i[t];if(Array.isArray(A)?A.indexOf(r)!==-1:A===r)for(var n=t;n<=i.length;){n++;var s=i[n];if(s===e)return!0;if(s!==pi)break}if(r===pi)for(var n=t;n>0;){n--;var o=i[n];if(Array.isArray(A)?A.indexOf(o)!==-1:A===o)for(var l=t;l<=i.length;){l++;var s=i[l];if(s===e)return!0;if(s!==pi)break}if(o!==pi)break}return!1},Mu=function(A,e){for(var t=A;t>=0;){var i=e[t];if(i===pi)t--;else return i}return 0},ZB=function(A,e,t,i,r){if(t[i]===0)return lt;var n=i-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,h=e[o];if(l===yu&&h===Cu)return lt;if(Sa.indexOf(l)!==-1)return Uu;if(Sa.indexOf(h)!==-1||Su.indexOf(h)!==-1)return lt;if(Mu(n,e)===Tu)return rs;if(Ua.get(A[n])===wa||(l===es||l===ts)&&Ua.get(A[o])===wa||l===vu||h===vu||l===bu||[pi,Ba,Sr].indexOf(l)===-1&&h===bu||[jn,Er,zB,$i,Xi].indexOf(h)!==-1||Mu(n,e)===Lr||Ea(va,Lr,n,e)||Ea([jn,Er],Ca,n,e)||Ea(xu,xu,n,e))return lt;if(l===pi)return rs;if(l===va||h===va)return lt;if(h===ya||l===ya)return rs;if([Ba,Sr,Ca].indexOf(h)!==-1||l===KB||c===xa&&XB.indexOf(l)!==-1||l===Xi&&h===xa||h===Qu||Ai.indexOf(h)!==-1&&l===CA||Ai.indexOf(l)!==-1&&h===CA||l===Hr&&[Ir,es,ts].indexOf(h)!==-1||[Ir,es,ts].indexOf(l)!==-1&&h===Mr||Ai.indexOf(l)!==-1&&Eu.indexOf(h)!==-1||Eu.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||[Hr,Mr].indexOf(l)!==-1&&(h===CA||[Lr,Sr].indexOf(h)!==-1&&e[o+1]===CA)||[Lr,Sr].indexOf(l)!==-1&&h===CA||l===CA&&[CA,Xi,$i].indexOf(h)!==-1)return lt;if([CA,Xi,$i,jn,Er].indexOf(h)!==-1)for(var m=n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if([Hr,Mr].indexOf(h)!==-1)for(var m=[jn,Er].indexOf(l)!==-1?s:n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if(Qa===l&&[Qa,As,Ta,ba].indexOf(h)!==-1||[As,Ta].indexOf(l)!==-1&&[As,is].indexOf(h)!==-1||[is,ba].indexOf(l)!==-1&&h===is||Lu.indexOf(l)!==-1&&[Qu,Mr].indexOf(h)!==-1||Lu.indexOf(h)!==-1&&l===Hr||Ai.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||l===$i&&Ai.indexOf(h)!==-1||Ai.concat(CA).indexOf(l)!==-1&&h===Lr&&RB.indexOf(A[o])===-1||Ai.concat(CA).indexOf(h)!==-1&&l===Er)return lt;if(l===Fa&&h===Fa){for(var x=t[n],F=1;x>0&&(x--,e[x]===Fa);)F++;if(F%2!==0)return lt}return l===es&&h===ts?lt:rs},YB=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=JB(A,e.lineBreak),i=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[CA,Hi,Fu].indexOf(o)!==-1?Ir:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&A[l]>=19968&&A[l]<=40959}):void 0;return[i,r,s]},qB=(function(){function A(e,t,i,r){this.codePoints=e,this.required=t===Uu,this.start=i,this.end=r}return A.prototype.slice=function(){return It.apply(void 0,this.codePoints.slice(this.start,this.end))},A})(),jB=function(A,e){var t=Jn(A),i=YB(t,e),r=i[0],n=i[1],s=i[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var h=lt;c<o&&(h=ZB(t,n,r,++c,s))===lt;);if(h!==lt||c===o){var m=new qB(t,h,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},e2=1,t2=2,Pr=4,Hu=8,ns=10,Iu=47,Dr=92,A2=9,i2=32,ss=34,_r=61,r2=35,n2=36,s2=37,os=39,as=40,kr=41,o2=95,fA=45,a2=33,l2=60,c2=62,h2=64,u2=91,p2=93,d2=61,f2=123,ls=63,g2=125,Pu=124,m2=126,w2=128,Du=65533,La=42,Ii=43,B2=44,y2=58,C2=59,Or=46,v2=0,T2=8,b2=11,x2=14,Q2=31,F2=127,GA=-1,_u=48,ku=97,Ou=101,U2=102,S2=117,E2=122,Nu=65,Ku=69,zu=70,L2=85,M2=90,AA=function(A){return A>=_u&&A<=57},H2=function(A){return A>=55296&&A<=57343},Ji=function(A){return AA(A)||A>=Nu&&A<=zu||A>=ku&&A<=U2},I2=function(A){return A>=ku&&A<=E2},P2=function(A){return A>=Nu&&A<=M2},D2=function(A){return I2(A)||P2(A)},_2=function(A){return A>=w2},cs=function(A){return A===ns||A===A2||A===i2},hs=function(A){return D2(A)||_2(A)||A===o2},Vu=function(A){return hs(A)||AA(A)||A===fA},k2=function(A){return A>=v2&&A<=T2||A===b2||A>=x2&&A<=Q2||A===F2},di=function(A,e){return A!==Dr?!1:e!==ns},us=function(A,e,t){return A===fA?hs(e)||di(e,t):hs(A)?!0:!!(A===Dr&&di(A,e))},Ma=function(A,e,t){return A===Ii||A===fA?AA(e)?!0:e===Or&&AA(t):AA(A===Or?e:A)},O2=function(A){var e=0,t=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(t=-1),e++);for(var i=[];AA(A[e]);)i.push(A[e++]);var r=i.length?parseInt(It.apply(void 0,i),10):0;A[e]===Or&&e++;for(var n=[];AA(A[e]);)n.push(A[e++]);var s=n.length,o=s?parseInt(It.apply(void 0,n),10):0;(A[e]===Ku||A[e]===Ou)&&e++;var l=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(l=-1),e++);for(var c=[];AA(A[e]);)c.push(A[e++]);var h=c.length?parseInt(It.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*h)},N2={type:2},K2={type:3},z2={type:4},V2={type:13},W2={type:8},G2={type:21},R2={type:9},$2={type:10},X2={type:11},J2={type:12},Z2={type:14},ps={type:23},Y2={type:1},q2={type:25},j2={type:24},ey={type:26},ty={type:27},Ay={type:28},iy={type:29},ry={type:31},Ha={type:32},Wu=(function(){function A(){this._value=[]}return A.prototype.write=function(e){this._value=this._value.concat(Jn(e))},A.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ha;)e.push(t),t=this.consumeToken();return e},A.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ss:return this.consumeStringToken(ss);case r2:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Vu(t)||di(i,r)){var n=us(t,i,r)?t2:e2,s=this.consumeName();return{type:5,value:s,flags:n}}break;case n2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),V2;break;case os:return this.consumeStringToken(os);case as:return N2;case kr:return K2;case La:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),Z2;break;case Ii:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case B2:return z2;case fA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Ma(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(us(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===fA&&c===c2)return this.consumeCodePoint(),this.consumeCodePoint(),j2;break;case Or:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Iu:if(this.peekCodePoint(0)===La)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===La&&(h=this.consumeCodePoint(),h===Iu))return this.consumeToken();if(h===GA)return this.consumeToken()}break;case y2:return ey;case C2:return ty;case l2:if(this.peekCodePoint(0)===a2&&this.peekCodePoint(1)===fA&&this.peekCodePoint(2)===fA)return this.consumeCodePoint(),this.consumeCodePoint(),q2;break;case h2:var m=this.peekCodePoint(0),v=this.peekCodePoint(1),x=this.peekCodePoint(2);if(us(m,v,x)){var s=this.consumeName();return{type:7,value:s}}break;case u2:return Ay;case Dr:if(di(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case p2:return iy;case d2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),W2;break;case f2:return X2;case g2:return J2;case S2:case L2:var F=this.peekCodePoint(0),T=this.peekCodePoint(1);return F===Ii&&(Ji(T)||T===ls)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Pu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),R2;if(this.peekCodePoint(0)===Pu)return this.consumeCodePoint(),G2;break;case m2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),$2;break;case GA:return Ha}return cs(e)?(this.consumeWhiteSpace(),ry):AA(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):hs(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:It(e)}},A.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},A.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},A.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},A.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Ji(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===ls&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i){var r=parseInt(It.apply(void 0,e.map(function(l){return l===ls?_u:l})),16),n=parseInt(It.apply(void 0,e.map(function(l){return l===ls?zu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(It.apply(void 0,e),16);if(this.peekCodePoint(0)===fA&&Ji(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Ji(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(It.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},A.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===as?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===as?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},A.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===os||t===ss){var i=this.consumeStringToken(this.consumeCodePoint());return i.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),ps)}for(;;){var r=this.consumeCodePoint();if(r===GA||r===kr)return{type:22,value:It.apply(void 0,e)};if(cs(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr?(this.consumeCodePoint(),{type:22,value:It.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ps);if(r===ss||r===os||r===as||k2(r))return this.consumeBadUrlRemnants(),ps;if(r===Dr)if(di(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ps;else e.push(r)}},A.prototype.consumeWhiteSpace=function(){for(;cs(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kr||e===GA)return;di(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=It.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},A.prototype.consumeStringToken=function(e){var t="",i=0;do{var r=this._value[i];if(r===GA||r===void 0||r===e)return t+=this.consumeStringSlice(i),{type:0,value:t};if(r===ns)return this._value.splice(0,i),Y2;if(r===Dr){var n=this._value[i+1];n!==GA&&n!==void 0&&(n===ns?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):di(r,n)&&(t+=this.consumeStringSlice(i),t+=It(this.consumeEscapedCodePoint()),i=-1))}i++}while(!0)},A.prototype.consumeNumber=function(){var e=[],t=Pr,i=this.peekCodePoint(0);for((i===Ii||i===fA)&&e.push(this.consumeCodePoint());AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===Or&&AA(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((i===Ku||i===Ou)&&((r===Ii||r===fA)&&AA(n)||AA(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[O2(e),t]},A.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(us(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:i,unit:o}}return r===s2?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},A.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Ji(e)){for(var t=It(e);Ji(this.peekCodePoint(0))&&t.length<6;)t+=It(this.consumeCodePoint());cs(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return i===0||H2(i)||i>1114111?Du:i}return e===GA?Du:e},A.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Vu(t))e+=It(t);else if(di(t,this.peekCodePoint(0)))e+=It(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},A})(),Gu=(function(){function A(e){this._tokens=e}return A.create=function(e){var t=new Wu;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.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")},A.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},A.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},A.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(i.type===32||sy(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},A.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(i.type===32||i.type===3)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Ha:e},A.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},A})(),Nr=function(A){return A.type===15},Zi=function(A){return A.type===17},yt=function(A){return A.type===20},ny=function(A){return A.type===0},Ia=function(A,e){return yt(A)&&A.value===e},Ru=function(A){return A.type!==31},Yi=function(A){return A.type!==31&&A.type!==4},RA=function(A){var e=[],t=[];return A.forEach(function(i){if(i.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}i.type!==31&&t.push(i)}),t.length&&e.push(t),e},sy=function(A,e){return e===11&&A.type===12||e===28&&A.type===29?!0:e===2&&A.type===3},fi=function(A){return A.type===17||A.type===15},Ot=function(A){return A.type===16||fi(A)},$u=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},Xt={type:17,number:0,flags:Pr},Pa={type:16,number:50,flags:Pr},gi={type:16,number:100,flags:Pr},Kr=function(A,e,t){var i=A[0],r=A[1];return[xt(i,e),xt(typeof r<"u"?r:i,t)]},xt=function(A,e){if(A.type===16)return A.number/100*e;if(Nr(A))switch(A.unit){case"rem":case"em":return 16*A.number;default:return A.number}return A.number},Xu="deg",Ju="grad",Zu="rad",Yu="turn",ds={name:"angle",parse:function(A,e){if(e.type===15)switch(e.unit){case Xu:return Math.PI*e.number/180;case Ju:return Math.PI/200*e.number;case Zu:return e.number;case Yu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},qu=function(A){return A.type===15&&(A.unit===Xu||A.unit===Ju||A.unit===Zu||A.unit===Yu)},ju=function(A){var e=A.filter(yt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Xt,Xt];case"to top":case"bottom":return QA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Xt,gi];case"to right":case"left":return QA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[gi,gi];case"to bottom":case"top":return QA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[gi,Xt];case"to left":case"right":return QA(270)}return 0},QA=function(A){return Math.PI*A/180},mi={name:"color",parse:function(A,e){if(e.type===18){var t=oy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(A,e.values)}if(e.type===5){if(e.value.length===3){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ii[e.value.toUpperCase()];if(typeof o<"u")return o}return ii.TRANSPARENT}},wi=function(A){return(255&A)===0},Gt=function(A){var e=255&A,t=255&A>>8,i=255&A>>16,r=255&A>>24;return e<255?"rgba("+r+","+i+","+t+","+e/255+")":"rgb("+r+","+i+","+t+")"},Bi=function(A,e,t,i){return(A<<24|e<<16|t<<8|Math.round(i*255)<<0)>>>0},ep=function(A,e){if(A.type===17)return A.number;if(A.type===16){var t=e===3?1:255;return e===3?A.number/100*t:Math.round(A.number/100*t)}return 0},tp=function(A,e){var t=e.filter(Yi);if(t.length===3){var i=t.map(ep),r=i[0],n=i[1],s=i[2];return Bi(r,n,s,1)}if(t.length===4){var o=t.map(ep),r=o[0],n=o[1],s=o[2],l=o[3];return Bi(r,n,s,l)}return 0};function Da(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<1/2?e:t<2/3?(e-A)*6*(2/3-t)+A:A}var Ap=function(A,e){var t=e.filter(Yi),i=t[0],r=t[1],n=t[2],s=t[3],o=(i.type===17?QA(i.number):ds.parse(A,i))/(Math.PI*2),l=Ot(r)?r.number/100:0,c=Ot(n)?n.number/100:0,h=typeof s<"u"&&Ot(s)?xt(s,1):1;if(l===0)return Bi(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,v=c*2-m,x=Da(v,m,o+1/3),F=Da(v,m,o),T=Da(v,m,o-1/3);return Bi(x*255,F*255,T*255,h)},oy={hsl:Ap,hsla:Ap,rgb:tp,rgba:tp},zr=function(A,e){return mi.parse(A,Gu.create(e).parseComponentValue())},ii={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},ay={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ly={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fs=function(A,e){var t=mi.parse(A,e[0]),i=e[1];return i&&Ot(i)?{color:t,stop:i}:{color:t,stop:null}},ip=function(A,e){var t=A[0],i=A[A.length-1];t.stop===null&&(t.stop=Xt),i.stop===null&&(i.stop=gi);for(var r=[],n=0,s=0;s<A.length;s++){var o=A[s].stop;if(o!==null){var l=xt(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 h=r[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,v=r[c-1],x=(h-v)/(m+1),F=1;F<=m;F++)r[c+F-1]=x*F;c=null}}return A.map(function(T,S){var I=T.color;return{color:I,stop:Math.max(Math.min(1,r[S]/e),0)}})},cy=function(A,e,t){var i=e/2,r=t/2,n=xt(A[0],e)-i,s=r-xt(A[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},hy=function(A,e,t){var i=typeof A=="number"?A:cy(A,e,t),r=Math.abs(e*Math.sin(i))+Math.abs(t*Math.cos(i)),n=e/2,s=t/2,o=r/2,l=Math.sin(i-Math.PI/2)*o,c=Math.cos(i-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},PA=function(A,e){return Math.sqrt(A*A+e*e)},rp=function(A,e,t,i,r){var n=[[0,0],[0,e],[A,0],[A,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],h=PA(t-l,i-c);return(r?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},uy=function(A,e,t,i,r){var n=0,s=0;switch(A.size){case 0:A.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-i)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(A.shape===0)n=s=Math.min(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-i)),l=rp(i,r,e,t,!0),c=l[0],h=l[1];n=PA(c-e,(h-t)/o),s=o*n}break;case 1:A.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-i)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(A.shape===0)n=s=Math.max(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-i)),m=rp(i,r,e,t,!1),c=m[0],h=m[1];n=PA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(A.size)&&(n=xt(A.size[0],i),s=A.size.length===2?xt(A.size[1],r):n),[n,s]},py=function(A,e){var t=QA(180),i=[];return RA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=ju(r);return}else if(qu(s)){t=ds.parse(A,s);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},gs=function(A,e){var t=QA(180),i=[];return RA(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=ju(r);return}else if(qu(s)){t=(ds.parse(A,s)+QA(270))%QA(360);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},dy=function(A,e){var t=QA(180),i=[],r=1,n=0,s=3,o=[];return RA(e).forEach(function(l,c){var h=l[0];if(c===0){if(yt(h)&&h.value==="linear"){r=1;return}else if(yt(h)&&h.value==="radial"){r=2;return}}if(h.type===18){if(h.name==="from"){var m=mi.parse(A,h.values[0]);i.push({stop:Xt,color:m})}else if(h.name==="to"){var m=mi.parse(A,h.values[0]);i.push({stop:gi,color:m})}else if(h.name==="color-stop"){var v=h.values.filter(Yi);if(v.length===2){var m=mi.parse(A,v[1]),x=v[0];Zi(x)&&i.push({stop:{type:16,number:x.number*100,flags:x.flags},color:m})}}}}),r===1?{angle:(t+QA(180))%QA(360),stops:i,type:r}:{size:s,shape:n,stops:i,position:o,type:r}},np="closest-side",sp="farthest-side",op="closest-corner",ap="farthest-corner",lp="circle",cp="ellipse",hp="cover",up="contain",fy=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,v){if(c)if(yt(v))switch(v.value){case"center":return n.push(Pa),m;case"top":case"left":return n.push(Xt),m;case"right":case"bottom":return n.push(gi),m}else(Ot(v)||fi(v))&&n.push(v);else if(yt(v))switch(v.value){case lp:return t=0,!1;case cp:return t=1,!1;case"at":return c=!0,!1;case np:return i=0,!1;case hp:case sp:return i=1,!1;case up:case op:return i=2,!1;case ap:return i=3,!1}else if(fi(v)||Ot(v))return Array.isArray(i)||(i=[]),i.push(v),!1;return m},l)}if(l){var h=fs(A,s);r.push(h)}}),{size:i,shape:t,stops:r,position:n,type:2}},ms=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(h,m){if(yt(m))switch(m.value){case"center":return n.push(Pa),!1;case"top":case"left":return n.push(Xt),!1;case"right":case"bottom":return n.push(gi),!1}else if(Ot(m)||fi(m))return n.push(m),!1;return h},l):o===1&&(l=s.reduce(function(h,m){if(yt(m))switch(m.value){case lp:return t=0,!1;case cp:return t=1,!1;case up:case np:return i=0,!1;case sp:return i=1,!1;case op:return i=2,!1;case hp:case ap:return i=3,!1}else if(fi(m)||Ot(m))return Array.isArray(i)||(i=[]),i.push(m),!1;return h},l)),l){var c=fs(A,s);r.push(c)}}),{size:i,shape:t,stops:r,position:n,type:2}},gy=function(A){return A.type===1},my=function(A){return A.type===2},_a={name:"image",parse:function(A,e){if(e.type===22){var t={url:e.value,type:0};return A.cache.addImage(e.value),t}if(e.type===18){var i=pp[e.name];if(typeof i>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return i(A,e.values)}throw new Error("Unsupported image type "+e.type)}};function wy(A){return!(A.type===20&&A.value==="none")&&(A.type!==18||!!pp[A.name])}var pp={"linear-gradient":py,"-moz-linear-gradient":gs,"-ms-linear-gradient":gs,"-o-linear-gradient":gs,"-webkit-linear-gradient":gs,"radial-gradient":fy,"-moz-radial-gradient":ms,"-ms-radial-gradient":ms,"-o-radial-gradient":ms,"-webkit-radial-gradient":ms,"-webkit-gradient":dy},By={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(i){return Yi(i)&&wy(i)}).map(function(i){return _a.parse(A,i)})}},yy={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Cy={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,e){return RA(e).map(function(t){return t.filter(Ot)}).map($u)}},vy={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(yt).map(function(i){return i.value}).join(" ")}).map(Ty)}},Ty=function(A){switch(A){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}},qi;(function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"})(qi||(qi={}));var by={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(xy)})}},xy=function(A){return yt(A)||Ot(A)},ws=function(A){return{name:"border-"+A+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Qy=ws("top"),Fy=ws("right"),Uy=ws("bottom"),Sy=ws("left"),Bs=function(A){return{name:"border-radius-"+A,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return $u(t.filter(Ot))}}},Ey=Bs("top-left"),Ly=Bs("top-right"),My=Bs("bottom-right"),Hy=Bs("bottom-left"),ys=function(A){return{name:"border-"+A+"-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}}},Iy=ys("top"),Py=ys("right"),Dy=ys("bottom"),_y=ys("left"),Cs=function(A){return{name:"border-"+A+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Nr(t)?t.number:0}}},ky=Cs("top"),Oy=Cs("right"),Ny=Cs("bottom"),Ky=Cs("left"),zy={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vy={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,e){return e==="rtl"?1:0}},Wy={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).reduce(function(t,i){return t|Gy(i.value)},0)}},Gy=function(A){switch(A){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},Ry={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},$y={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},vs;(function(A){A.NORMAL="normal",A.STRICT="strict"})(vs||(vs={}));var Xy={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="strict"?vs.STRICT:vs.NORMAL}},Jy={name:"line-height",initialValue:"normal",prefix:!1,type:4},dp=function(A,e){return yt(A)&&A.value==="normal"?1.2*e:A.type===17?e*A.number:Ot(A)?xt(A,e):e},Zy={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,e){return e.type===20&&e.value==="none"?null:_a.parse(A,e)}},Yy={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,e){return e==="inside"?0:1}},ka={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,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}}},Ts=function(A){return{name:"margin-"+A,initialValue:"0",prefix:!1,type:4}},qy=Ts("top"),jy=Ts("right"),eC=Ts("bottom"),tC=Ts("left"),AC={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).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}})}},iC={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="break-word"?"break-word":"normal"}},bs=function(A){return{name:"padding-"+A,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},rC=bs("top"),nC=bs("right"),sC=bs("bottom"),oC=bs("left"),aC={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},lC={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},cC={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:ii.TRANSPARENT,offsetX:Xt,offsetY:Xt,blur:Xt},r=0,n=0;n<t.length;n++){var s=t[n];fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:i.blur=s,r++):i.color=mi.parse(A,s)}return i})}},hC={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},uC={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=fC[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},pC=function(A){var e=A.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},dC=function(A){var e=A.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],i=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,i,r,n,s,o]:null},fC={matrix:pC,matrix3d:dC},fp={type:16,number:50,flags:Pr},gC=[fp,fp],mC={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,e){var t=e.filter(Ot);return t.length!==2?gC:[t[0],t[1]]}},wC={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Vr;(function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var BC={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},yC={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,e){if(e.type===20)return{auto:!0,order:0};if(Zi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},gp={name:"time",parse:function(A,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")}},CC={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:1}},vC={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},TC={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).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})}},bC={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,e){var t=[],i=[];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:i.push(t.join(" ")),t.length=0;break}}),t.length&&i.push(t.join(" ")),i.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},xC={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},QC={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:yt(e)&&e.value==="bold"?700:400}},FC={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.filter(yt).map(function(t){return t.value})}},UC={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Kt=function(A,e){return(A&e)!==0},SC={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},EC={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var i=[],r=e.filter(Ru),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Zi(o)?o.number:1;i.push({counter:s.value,increment:l})}}return i}},LC={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return[];for(var t=[],i=e.filter(Ru),r=0;r<i.length;r++){var n=i[r],s=i[r+1];if(yt(n)&&n.value!=="none"){var o=s&&Zi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},MC={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,e){return e.filter(Nr).map(function(t){return gp.parse(A,t)})}},HC={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var i=[],r=e.filter(ny);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;i.push({open:s,close:o})}return i}},mp=function(A,e,t){if(!A)return"";var i=A[Math.min(e,A.length-1)];return i?t?i.open:i.close:""},IC={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:255,offsetX:Xt,offsetY:Xt,blur:Xt,spread:Xt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];Ia(s,"inset")?i.inset=!0:fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:r===2?i.blur=s:i.spread=s,r++):i.color=mi.parse(A,s)}return i})}},PC={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,e){var t=[0,1,2],i=[];return e.filter(yt).forEach(function(r){switch(r.value){case"stroke":i.push(1);break;case"fill":i.push(0);break;case"markers":i.push(2);break}}),t.forEach(function(r){i.indexOf(r)===-1&&i.push(r)}),i}},DC={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},_C={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return Nr(e)?e.number:0}},kC=(function(){function A(e,t){var i,r;this.animationDuration=Oe(e,MC,t.animationDuration),this.backgroundClip=Oe(e,ay,t.backgroundClip),this.backgroundColor=Oe(e,ly,t.backgroundColor),this.backgroundImage=Oe(e,By,t.backgroundImage),this.backgroundOrigin=Oe(e,yy,t.backgroundOrigin),this.backgroundPosition=Oe(e,Cy,t.backgroundPosition),this.backgroundRepeat=Oe(e,vy,t.backgroundRepeat),this.backgroundSize=Oe(e,by,t.backgroundSize),this.borderTopColor=Oe(e,Qy,t.borderTopColor),this.borderRightColor=Oe(e,Fy,t.borderRightColor),this.borderBottomColor=Oe(e,Uy,t.borderBottomColor),this.borderLeftColor=Oe(e,Sy,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,Ey,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,Ly,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,My,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,Hy,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,Iy,t.borderTopStyle),this.borderRightStyle=Oe(e,Py,t.borderRightStyle),this.borderBottomStyle=Oe(e,Dy,t.borderBottomStyle),this.borderLeftStyle=Oe(e,_y,t.borderLeftStyle),this.borderTopWidth=Oe(e,ky,t.borderTopWidth),this.borderRightWidth=Oe(e,Oy,t.borderRightWidth),this.borderBottomWidth=Oe(e,Ny,t.borderBottomWidth),this.borderLeftWidth=Oe(e,Ky,t.borderLeftWidth),this.boxShadow=Oe(e,IC,t.boxShadow),this.color=Oe(e,zy,t.color),this.direction=Oe(e,Vy,t.direction),this.display=Oe(e,Wy,t.display),this.float=Oe(e,Ry,t.cssFloat),this.fontFamily=Oe(e,bC,t.fontFamily),this.fontSize=Oe(e,xC,t.fontSize),this.fontStyle=Oe(e,UC,t.fontStyle),this.fontVariant=Oe(e,FC,t.fontVariant),this.fontWeight=Oe(e,QC,t.fontWeight),this.letterSpacing=Oe(e,$y,t.letterSpacing),this.lineBreak=Oe(e,Xy,t.lineBreak),this.lineHeight=Oe(e,Jy,t.lineHeight),this.listStyleImage=Oe(e,Zy,t.listStyleImage),this.listStylePosition=Oe(e,Yy,t.listStylePosition),this.listStyleType=Oe(e,ka,t.listStyleType),this.marginTop=Oe(e,qy,t.marginTop),this.marginRight=Oe(e,jy,t.marginRight),this.marginBottom=Oe(e,eC,t.marginBottom),this.marginLeft=Oe(e,tC,t.marginLeft),this.opacity=Oe(e,CC,t.opacity);var n=Oe(e,AC,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,iC,t.overflowWrap),this.paddingTop=Oe(e,rC,t.paddingTop),this.paddingRight=Oe(e,nC,t.paddingRight),this.paddingBottom=Oe(e,sC,t.paddingBottom),this.paddingLeft=Oe(e,oC,t.paddingLeft),this.paintOrder=Oe(e,PC,t.paintOrder),this.position=Oe(e,lC,t.position),this.textAlign=Oe(e,aC,t.textAlign),this.textDecorationColor=Oe(e,vC,(i=t.textDecorationColor)!==null&&i!==void 0?i:t.color),this.textDecorationLine=Oe(e,TC,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,cC,t.textShadow),this.textTransform=Oe(e,hC,t.textTransform),this.transform=Oe(e,uC,t.transform),this.transformOrigin=Oe(e,mC,t.transformOrigin),this.visibility=Oe(e,wC,t.visibility),this.webkitTextStrokeColor=Oe(e,DC,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,_C,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,BC,t.wordBreak),this.zIndex=Oe(e,yC,t.zIndex)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},A.prototype.isTransparent=function(){return wi(this.backgroundColor)},A.prototype.isTransformed=function(){return this.transform!==null},A.prototype.isPositioned=function(){return this.position!==0},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==0},A.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)},A})(),OC=(function(){function A(e,t){this.content=Oe(e,SC,t.content),this.quotes=Oe(e,HC,t.quotes)}return A})(),wp=(function(){function A(e,t){this.counterIncrement=Oe(e,EC,t.counterIncrement),this.counterReset=Oe(e,LC,t.counterReset)}return A})(),Oe=function(A,e,t){var i=new Wu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;i.write(r);var n=new Gu(i.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(A,yt(s)?s.value:e.initialValue);case 0:return e.parse(A,n.parseComponentValue());case 1:return e.parse(A,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return ds.parse(A,n.parseComponentValue());case"color":return mi.parse(A,n.parseComponentValue());case"image":return _a.parse(A,n.parseComponentValue());case"length":var o=n.parseComponentValue();return fi(o)?o:Xt;case"length-percentage":var l=n.parseComponentValue();return Ot(l)?l:Xt;case"time":return gp.parse(A,n.parseComponentValue())}break}},NC="data-html2canvas-debug",KC=function(A){var e=A.getAttribute(NC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Oa=function(A,e){var t=KC(A);return t===1||e===t},$A=(function(){function A(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Oa(t,3))debugger;this.styles=new kC(e,window.getComputedStyle(t,null)),ja(t)&&(this.styles.animationDuration.some(function(i){return i>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Xn(this.context,t),Oa(t,4)&&(this.flags|=16)}return A})(),zC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Bp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wr=typeof Uint8Array>"u"?[]:new Uint8Array(256),xs=0;xs<Bp.length;xs++)Wr[Bp.charCodeAt(xs)]=xs;for(var VC=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Wr[A.charCodeAt(i)],s=Wr[A.charCodeAt(i+1)],o=Wr[A.charCodeAt(i+2)],l=Wr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},WC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},GC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Pi=5,Na=11,Ka=2,RC=Na-Pi,yp=65536>>Pi,$C=1<<Pi,za=$C-1,XC=1024>>Pi,JC=yp+XC,ZC=JC,YC=32,qC=ZC+YC,jC=65536>>Na,ev=1<<RC,tv=ev-1,Cp=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},Av=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},iv=function(A,e){var t=VC(A),i=Array.isArray(t)?GC(t):new Uint32Array(t),r=Array.isArray(t)?WC(t):new Uint16Array(t),n=24,s=Cp(r,n/2,i[4]/2),o=i[5]===2?Cp(r,(n+i[4])/2):Av(i,Math.ceil((n+i[4])/4));return new rv(i[0],i[1],i[2],i[3],s,o)},rv=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Pi],t=(t<<Ka)+(e&za),this.data[t];if(e<=65535)return t=this.index[yp+(e-55296>>Pi)],t=(t<<Ka)+(e&za),this.data[t];if(e<this.highStart)return t=qC-jC+(e>>Na),t=this.index[t],t+=e>>Pi&tv,t=this.index[t],t=(t<<Ka)+(e&za),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),vp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nv=typeof Uint8Array>"u"?[]:new Uint8Array(256),Qs=0;Qs<vp.length;Qs++)nv[vp.charCodeAt(Qs)]=Qs;var sv=1,Va=2,Wa=3,Tp=4,bp=5,ov=7,xp=8,Ga=9,Ra=10,Qp=11,Fp=12,Up=13,Sp=14,$a=15,av=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},lv=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},cv=iv(zC),FA="×",Xa="÷",hv=function(A){return cv.get(A)},uv=function(A,e,t){var i=t-2,r=e[i],n=e[t-1],s=e[t];if(n===Va&&s===Wa)return FA;if(n===Va||n===Wa||n===Tp||s===Va||s===Wa||s===Tp)return Xa;if(n===xp&&[xp,Ga,Qp,Fp].indexOf(s)!==-1||(n===Qp||n===Ga)&&(s===Ga||s===Ra)||(n===Fp||n===Ra)&&s===Ra||s===Up||s===bp||s===ov||n===sv)return FA;if(n===Up&&s===Sp){for(;r===bp;)r=e[--i];if(r===Sp)return FA}if(n===$a&&s===$a){for(var o=0;r===$a;)o++,r=e[--i];if(o%2===0)return FA}return Xa},pv=function(A){var e=av(A),t=e.length,i=0,r=0,n=e.map(hv);return{next:function(){if(i>=t)return{done:!0,value:null};for(var s=FA;i<t&&(s=uv(e,n,++i))===FA;);if(s!==FA||i===t){var o=lv.apply(null,e.slice(r,i));return r=i,{value:o,done:!1}}return{done:!0,value:null}}}},dv=function(A){for(var e=pv(A),t=[],i;!(i=e.next()).done;)i.value&&t.push(i.value.slice());return t},fv=function(A){var e=123;if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var i=A.createElement("boundtest");i.style.height=e+"px",i.style.display="block",A.body.appendChild(i),t.selectNode(i);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(A.body.removeChild(i),n===e)return!0}}return!1},gv=function(A){var e=A.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",A.body.appendChild(e);var t=A.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var i=e.firstChild,r=Jn(i.data).map(function(l){return It(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(i,n),t.setEnd(i,n+l.length);var h=t.getBoundingClientRect();n+=l.length;var m=h.x>s.x||h.y>s.y;return s=h,c===0?!0:m});return A.body.removeChild(e),o},mv=function(){return typeof new Image().crossOrigin<"u"},wv=function(){return typeof new XMLHttpRequest().responseType=="string"},Bv=function(A){var e=new Image,t=A.createElement("canvas"),i=t.getContext("2d");if(!i)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Ep=function(A){return A[0]===0&&A[1]===255&&A[2]===0&&A[3]===255},yv=function(A){var e=A.createElement("canvas"),t=100;e.width=t,e.height=t;var i=e.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Ja(t,t,0,0,r);return i.fillStyle="red",i.fillRect(0,0,t,t),Lp(s).then(function(o){i.drawImage(o,0,0);var l=i.getImageData(0,0,t,t).data;i.fillStyle="red",i.fillRect(0,0,t,t);var c=A.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",Ep(l)?Lp(Ja(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return i.drawImage(o,0,0),Ep(i.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ja=function(A,e,t,i,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",A.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",i.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},Lp=function(A){return new Promise(function(e,t){var i=new Image;i.onload=function(){return e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Jt={get SUPPORT_RANGE_BOUNDS(){var A=fv(document);return Object.defineProperty(Jt,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=Jt.SUPPORT_RANGE_BOUNDS&&gv(document);return Object.defineProperty(Jt,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=Bv(document);return Object.defineProperty(Jt,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A=typeof Array.from=="function"&&typeof window.fetch=="function"?yv(document):Promise.resolve(!1);return Object.defineProperty(Jt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=mv();return Object.defineProperty(Jt,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A=wv();return Object.defineProperty(Jt,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Jt,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Jt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},Gr=(function(){function A(e,t){this.text=e,this.bounds=t}return A})(),Cv=function(A,e,t,i){var r=bv(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Jt.SUPPORT_RANGE_BOUNDS){var l=Mp(i,s,o.length).getClientRects();if(l.length>1){var c=Za(o),h=0;c.forEach(function(v){n.push(new Gr(v,ti.fromDOMRectList(A,Mp(i,h+s,v.length).getClientRects()))),h+=v.length})}else n.push(new Gr(o,ti.fromDOMRectList(A,l)))}else{var m=i.splitText(o.length);n.push(new Gr(o,vv(A,i))),i=m}else Jt.SUPPORT_RANGE_BOUNDS||(i=i.splitText(o.length));s+=o.length}),n},vv=function(A,e){var t=e.ownerDocument;if(t){var i=t.createElement("html2canvaswrapper");i.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(i,e);var n=Xn(A,i);return i.firstChild&&r.replaceChild(i.firstChild,i),n}}return ti.EMPTY},Mp=function(A,e,t){var i=A.ownerDocument;if(!i)throw new Error("Node has no owner document");var r=i.createRange();return r.setStart(A,e),r.setEnd(A,e+t),r},Za=function(A){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(A)).map(function(t){return t.segment})}return dv(A)},Tv=function(A,e){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(A)).map(function(i){return i.segment})}return Qv(A,e)},bv=function(A,e){return e.letterSpacing!==0?Za(A):Tv(A,e)},xv=[32,160,4961,65792,65793,4153,4241],Qv=function(A,e){for(var t=jB(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),i=[],r,n=function(){if(r.value){var s=r.value.slice(),o=Jn(s),l="";o.forEach(function(c){xv.indexOf(c)===-1?l+=It(c):(l.length&&i.push(l),i.push(It(c)),l="")}),l.length&&i.push(l)}};!(r=t.next()).done;)n();return i},Fv=(function(){function A(e,t,i){this.text=Uv(t.data,i.textTransform),this.textBounds=Cv(e,this.text,i,t)}return A})(),Uv=function(A,e){switch(e){case 1:return A.toLowerCase();case 3:return A.replace(Sv,Ev);case 2:return A.toUpperCase();default:return A}},Sv=/(^|\s|:|-|\(|\))([a-z])/g,Ev=function(A,e,t){return A.length>0?e+t.toUpperCase():A},Hp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return e})($A),Ip=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return e})($A),Pp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=new XMLSerializer,s=Xn(t,i);return i.setAttribute("width",s.width+"px"),i.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})($A),Dp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Ya=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.start=i.start,r.reversed=typeof i.reversed=="boolean"&&i.reversed===!0,r}return e})($A),Lv=[{type:15,flags:0,unit:"px",number:3}],Mv=[{type:16,flags:0,number:50}],Hv=function(A){return A.width>A.height?new ti(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new ti(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A},Iv=function(A){var e=A.type===Pv?new Array(A.value.length+1).join("•"):A.value;return e.length===0?A.placeholder||"":e},Fs="checkbox",Us="radio",Pv="password",_p=707406591,qa=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=Iv(i),(r.type===Fs||r.type===Us)&&(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=Hv(r.bounds)),r.type){case Fs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Lv;break;case Us:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Mv;break}return r}return e})($A),kp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=i.options[i.selectedIndex||0];return r.value=n&&n.text||"",r}return e})($A),Op=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Np=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;r.src=i.src,r.width=parseInt(i.width,10)||0,r.height=parseInt(i.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(i.contentWindow&&i.contentWindow.document&&i.contentWindow.document.documentElement){r.tree=zp(t,i.contentWindow.document.documentElement);var n=i.contentWindow.document.documentElement?zr(t,getComputedStyle(i.contentWindow.document.documentElement).backgroundColor):ii.TRANSPARENT,s=i.contentWindow.document.body?zr(t,getComputedStyle(i.contentWindow.document.body).backgroundColor):ii.TRANSPARENT;r.backgroundColor=wi(n)?wi(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})($A),Dv=["OL","UL","MENU"],Ss=function(A,e,t,i){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,Vp(r)&&r.data.trim().length>0)t.textNodes.push(new Fv(A,r,t.styles));else if(ji(r))if(Jp(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Ss(A,o,t,i)});else{var s=Kp(A,r);s.styles.isVisible()&&(_v(r,s,i)?s.flags|=4:kv(s.styles)&&(s.flags|=2),Dv.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Ss(A,r.shadowRoot,s,i):!Ls(r)&&!Wp(r)&&!Ms(r)&&Ss(A,r,s,i))}},Kp=function(A,e){return tl(e)?new Hp(A,e):Gp(e)?new Ip(A,e):Wp(e)?new Pp(A,e):Ov(e)?new Dp(A,e):Nv(e)?new Ya(A,e):Kv(e)?new qa(A,e):Ms(e)?new kp(A,e):Ls(e)?new Op(A,e):$p(e)?new Np(A,e):new $A(A,e)},zp=function(A,e){var t=Kp(A,e);return t.flags|=4,Ss(A,e,t,t),t},_v=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||el(A)&&t.styles.isTransparent()},kv=function(A){return A.isPositioned()||A.isFloating()},Vp=function(A){return A.nodeType===Node.TEXT_NODE},ji=function(A){return A.nodeType===Node.ELEMENT_NODE},ja=function(A){return ji(A)&&typeof A.style<"u"&&!Es(A)},Es=function(A){return typeof A.className=="object"},Ov=function(A){return A.tagName==="LI"},Nv=function(A){return A.tagName==="OL"},Kv=function(A){return A.tagName==="INPUT"},zv=function(A){return A.tagName==="HTML"},Wp=function(A){return A.tagName==="svg"},el=function(A){return A.tagName==="BODY"},Gp=function(A){return A.tagName==="CANVAS"},Rp=function(A){return A.tagName==="VIDEO"},tl=function(A){return A.tagName==="IMG"},$p=function(A){return A.tagName==="IFRAME"},Xp=function(A){return A.tagName==="STYLE"},Vv=function(A){return A.tagName==="SCRIPT"},Ls=function(A){return A.tagName==="TEXTAREA"},Ms=function(A){return A.tagName==="SELECT"},Jp=function(A){return A.tagName==="SLOT"},Zp=function(A){return A.tagName.indexOf("-")>0},Wv=(function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},A.prototype.pop=function(e){var t=this;e.forEach(function(i){return t.counters[i].pop()})},A.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,n=!0;i!==null&&i.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},A})(),Yp={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"]},qp={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Gv={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Rv={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},er=function(A,e,t,i,r,n){return A<e||A>t?$r(A,r,n.length>0):i.integers.reduce(function(s,o,l){for(;A>=o;)A-=o,s+=i.values[l];return s},"")+n},jp=function(A,e,t,i){var r="";do t||A--,r=i(A)+r,A/=e;while(A*e>=e);return r},Pt=function(A,e,t,i,r){var n=t-e+1;return(A<0?"-":"")+(jp(Math.abs(A),n,i,function(s){return It(Math.floor(s%n)+e)})+r)},Di=function(A,e,t){t===void 0&&(t=". ");var i=e.length;return jp(Math.abs(A),i,!1,function(r){return e[Math.floor(r%i)]})+t},tr=1,yi=2,Ci=4,Rr=8,ri=function(A,e,t,i,r,n){if(A<-9999||A>9999)return $r(A,4,r.length>0);var s=Math.abs(A),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,tr)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Kt(n,yi)||c===1&&l===1&&Kt(n,Ci)&&A>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(A<0?i:"")+o},ed="十百千萬",td="拾佰仟萬",Ad="マイナス",Al="마이너스",$r=function(A,e,t){var i=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=Pt(A,48,57,!0,i);return o.length<4?"0"+o:o;case 4:return Di(A,"〇一二三四五六七八九",r);case 6:return er(A,1,3999,Yp,3,i).toLowerCase();case 7:return er(A,1,3999,Yp,3,i);case 8:return Pt(A,945,969,!1,i);case 9:return Pt(A,97,122,!1,i);case 10:return Pt(A,65,90,!1,i);case 11:return Pt(A,1632,1641,!0,i);case 12:case 49:return er(A,1,9999,qp,3,i);case 35:return er(A,1,9999,qp,3,i).toLowerCase();case 13:return Pt(A,2534,2543,!0,i);case 14:case 30:return Pt(A,6112,6121,!0,i);case 15:return Di(A,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Di(A,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ri(A,"零一二三四五六七八九",ed,"負",r,yi|Ci|Rr);case 47:return ri(A,"零壹貳參肆伍陸柒捌玖",td,"負",r,tr|yi|Ci|Rr);case 42:return ri(A,"零一二三四五六七八九",ed,"负",r,yi|Ci|Rr);case 41:return ri(A,"零壹贰叁肆伍陆柒捌玖",td,"负",r,tr|yi|Ci|Rr);case 26:return ri(A,"〇一二三四五六七八九","十百千万",Ad,r,0);case 25:return ri(A,"零壱弐参四伍六七八九","拾百千万",Ad,r,tr|yi|Ci);case 31:return ri(A,"영일이삼사오육칠팔구","십백천만",Al,n,tr|yi|Ci);case 33:return ri(A,"零一二三四五六七八九","十百千萬",Al,n,0);case 32:return ri(A,"零壹貳參四五六七八九","拾百千",Al,n,tr|yi|Ci);case 18:return Pt(A,2406,2415,!0,i);case 20:return er(A,1,19999,Rv,3,i);case 21:return Pt(A,2790,2799,!0,i);case 22:return Pt(A,2662,2671,!0,i);case 22:return er(A,1,10999,Gv,3,i);case 23:return Di(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Di(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Pt(A,3302,3311,!0,i);case 28:return Di(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Di(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Pt(A,3792,3801,!0,i);case 37:return Pt(A,6160,6169,!0,i);case 38:return Pt(A,4160,4169,!0,i);case 39:return Pt(A,2918,2927,!0,i);case 40:return Pt(A,1776,1785,!0,i);case 43:return Pt(A,3046,3055,!0,i);case 44:return Pt(A,3174,3183,!0,i);case 45:return Pt(A,3664,3673,!0,i);case 46:return Pt(A,3872,3881,!0,i);default:return Pt(A,48,57,!0,i)}},id="data-html2canvas-ignore",rd=(function(){function A(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Wv,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 A.prototype.toIFrame=function(e,t){var i=this,r=$v(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=Zv(r).then(function(){return sA(i,void 0,void 0,function(){var h,m;return tA(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(eT),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))),h=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:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Jv(l)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(qv(document.doctype)+"<html></html>"),jv(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},A.prototype.createElementClone=function(e){if(Oa(e,2))debugger;if(Gp(e))return this.createCanvasClone(e);if(Rp(e))return this.createVideoClone(e);if(Xp(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return tl(t)&&(tl(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Zp(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return il(e.style,t),t},A.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].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=i,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},A.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}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},A.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.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},A.prototype.appendChildNode=function(e,t,i){(!ji(t)||!Vv(t)&&!t.hasAttribute(id)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!ji(t)||!Xp(t))&&e.appendChild(this.cloneNode(t,i))},A.prototype.cloneChildNodes=function(e,t,i){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(ji(n)&&Jp(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,i)})}else this.appendChildNode(t,n,i)},A.prototype.cloneNode=function(e,t){if(Vp(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&ji(e)&&(ja(e)||Es(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=i.getComputedStyle(e),s=i.getComputedStyle(e,":before"),o=i.getComputedStyle(e,":after");this.referenceElement===e&&ja(r)&&(this.clonedReferenceElement=r),el(r)&&iT(r);var l=this.counters.parse(new wp(this.context,n)),c=this.resolvePseudoContent(e,r,s,Xr.BEFORE);Zp(e)&&(t=!0),Rp(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var h=this.resolvePseudoContent(e,r,o,Xr.AFTER);return h&&r.appendChild(h),this.counters.pop(l),(n&&(this.options.copyStyles||Es(e))&&!$p(e)||t)&&il(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ls(e)||Ms(e))&&(Ls(r)||Ms(r))&&(r.value=e.value),r}return e.cloneNode(!1)},A.prototype.resolvePseudoContent=function(e,t,i,r){var n=this;if(i){var s=i.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||i.display==="none")){this.counters.parse(new wp(this.context,i));var l=new OC(this.context,i),c=o.createElement("html2canvaspseudoelement");il(i,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var v=o.createElement("img");v.src=m.value,v.style.opacity="1",c.appendChild(v)}else if(m.type===18){if(m.name==="attr"){var x=m.values.filter(yt);x.length&&c.appendChild(o.createTextNode(e.getAttribute(x[0].value)||""))}else if(m.name==="counter"){var F=m.values.filter(Yi),T=F[0],S=F[1];if(T&&yt(T)){var I=n.counters.getCounterValue(T.value),Q=S&&yt(S)?ka.parse(n.context,S.value):3;c.appendChild(o.createTextNode($r(I,Q,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Yi),T=N[0],J=N[1],S=N[2];if(T&&yt(T)){var H=n.counters.getCounterValues(T.value),z=S&&yt(S)?ka.parse(n.context,S.value):3,re=J&&J.type===0?J.value:"",q=H.map(function(ne){return $r(ne,z,!1)}).join(re);c.appendChild(o.createTextNode(q))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(mp(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(mp(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=rl+" "+nl;var h=r===Xr.BEFORE?" "+rl:" "+nl;return Es(t)?t.className.baseValue+=h:t.className+=h,c}}},A.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},A})(),Xr;(function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"})(Xr||(Xr={}));var $v=function(A,e){var t=A.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(id,"true"),A.body.appendChild(t),t},Xv=function(A){return new Promise(function(e){if(A.complete){e();return}if(!A.src){e();return}A.onload=e,A.onerror=e})},Jv=function(A){return Promise.all([].slice.call(A.images,0).map(Xv))},Zv=function(A){return new Promise(function(e,t){var i=A.contentWindow;if(!i)return t("No window assigned for iframe");var r=i.document;i.onload=A.onload=function(){i.onload=A.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(A))},50)}})},Yv=["all","d","content"],il=function(A,e){for(var t=A.length-1;t>=0;t--){var i=A.item(t);Yv.indexOf(i)===-1&&e.style.setProperty(i,A.getPropertyValue(i))}return e},qv=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'+A.publicId+'"'),A.systemId&&(e+='"'+A.systemId+'"'),e+=">"),e},jv=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},eT=function(A){var e=A[0],t=A[1],i=A[2];e.scrollLeft=t,e.scrollTop=i},tT=":before",AT=":after",rl="___html2canvas___pseudoelement_before",nl="___html2canvas___pseudoelement_after",nd=`{
7
7
  content: "" !important;
8
8
  display: none !important;
9
- }`,cv=function(i){hv(i,"."+Za+av+Wd+`
10
- .`+Ya+lv+Wd)},hv=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})(),uv=(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 AA(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=Rd.isSameOrigin(e),A=!qa(e)&&this._options.useCORS===!0&&Wt.SUPPORT_CORS_IMAGES&&!t,r=!qa(e)&&!t&&!ja(e)&&typeof this._options.proxy=="string"&&Wt.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,(mv(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(B){return s(B)},!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})(),dv=/^data:image\/svg\+xml/i,pv=/^data:image\/.*;base64,/i,fv=/^data:image\/.*/i,gv=function(i){return Wt.SUPPORT_SVG_DRAWING||!wv(i)},qa=function(i){return fv.test(i)},mv=function(i){return pv.test(i)},ja=function(i){return i.substr(0,4)==="blob"},wv=function(i){return i.substr(-3).toLowerCase()==="svg"||dv.test(i)},Ne=(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 Ne(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})(),TA=function(i){return i.type===1},Bv=(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],B=u[1],v=Or(t.borderBottomLeftRadius,A.width,A.height),b=v[0],C=v[1],U=[];U.push((n+l)/A.width),U.push((b+m)/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,m/=F,B/=F,b/=F,C/=F);var L=A.width-l,K=A.height-B,G=A.width-m,E=A.height-C,z=t.borderTopWidth,ne=t.borderRightWidth,X=t.borderBottomWidth,R=t.borderLeftWidth,re=vt(t.paddingTop,e.bounds.width),se=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?bt(A.left+R/3,A.top+z/3,n-R/3,s-z/3,pt.TOP_LEFT):new Ne(A.left+R/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?bt(A.left+L,A.top+z/3,l-ne/3,c-z/3,pt.TOP_RIGHT):new Ne(A.left+A.width-ne/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||B>0?bt(A.left+G,A.top+K,m-ne/3,B-X/3,pt.BOTTOM_RIGHT):new Ne(A.left+A.width-ne/3,A.top+A.height-X/3),this.bottomLeftBorderDoubleOuterBox=b>0||C>0?bt(A.left+R/3,A.top+E,b-R/3,C-X/3,pt.BOTTOM_LEFT):new Ne(A.left+R/3,A.top+A.height-X/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?bt(A.left+R*2/3,A.top+z*2/3,n-R*2/3,s-z*2/3,pt.TOP_LEFT):new Ne(A.left+R*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?bt(A.left+L,A.top+z*2/3,l-ne*2/3,c-z*2/3,pt.TOP_RIGHT):new Ne(A.left+A.width-ne*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||B>0?bt(A.left+G,A.top+K,m-ne*2/3,B-X*2/3,pt.BOTTOM_RIGHT):new Ne(A.left+A.width-ne*2/3,A.top+A.height-X*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||C>0?bt(A.left+R*2/3,A.top+E,b-R*2/3,C-X*2/3,pt.BOTTOM_LEFT):new Ne(A.left+R*2/3,A.top+A.height-X*2/3),this.topLeftBorderStroke=n>0||s>0?bt(A.left+R/2,A.top+z/2,n-R/2,s-z/2,pt.TOP_LEFT):new Ne(A.left+R/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?bt(A.left+L,A.top+z/2,l-ne/2,c-z/2,pt.TOP_RIGHT):new Ne(A.left+A.width-ne/2,A.top+z/2),this.bottomRightBorderStroke=m>0||B>0?bt(A.left+G,A.top+K,m-ne/2,B-X/2,pt.BOTTOM_RIGHT):new Ne(A.left+A.width-ne/2,A.top+A.height-X/2),this.bottomLeftBorderStroke=b>0||C>0?bt(A.left+R/2,A.top+E,b-R/2,C-X/2,pt.BOTTOM_LEFT):new Ne(A.left+R/2,A.top+A.height-X/2),this.topLeftBorderBox=n>0||s>0?bt(A.left,A.top,n,s,pt.TOP_LEFT):new Ne(A.left,A.top),this.topRightBorderBox=l>0||c>0?bt(A.left+L,A.top,l,c,pt.TOP_RIGHT):new Ne(A.left+A.width,A.top),this.bottomRightBorderBox=m>0||B>0?bt(A.left+G,A.top+K,m,B,pt.BOTTOM_RIGHT):new Ne(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=b>0||C>0?bt(A.left,A.top+E,b,C,pt.BOTTOM_LEFT):new Ne(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?bt(A.left+R,A.top+z,Math.max(0,n-R),Math.max(0,s-z),pt.TOP_LEFT):new Ne(A.left+R,A.top+z),this.topRightPaddingBox=l>0||c>0?bt(A.left+Math.min(L,A.width-ne),A.top+z,L>A.width+ne?0:Math.max(0,l-ne),Math.max(0,c-z),pt.TOP_RIGHT):new Ne(A.left+A.width-ne,A.top+z),this.bottomRightPaddingBox=m>0||B>0?bt(A.left+Math.min(G,A.width-R),A.top+Math.min(K,A.height-X),Math.max(0,m-ne),Math.max(0,B-X),pt.BOTTOM_RIGHT):new Ne(A.left+A.width-ne,A.top+A.height-X),this.bottomLeftPaddingBox=b>0||C>0?bt(A.left+R,A.top+Math.min(E,A.height-X),Math.max(0,b-R),Math.max(0,C-X),pt.BOTTOM_LEFT):new Ne(A.left+R,A.top+A.height-X),this.topLeftContentBox=n>0||s>0?bt(A.left+R+Z,A.top+z+re,Math.max(0,n-(R+Z)),Math.max(0,s-(z+re)),pt.TOP_LEFT):new Ne(A.left+R+Z,A.top+z+re),this.topRightContentBox=l>0||c>0?bt(A.left+Math.min(L,A.width+R+Z),A.top+z+re,L>A.width+R+Z?0:l-R+Z,c-(z+re),pt.TOP_RIGHT):new Ne(A.left+A.width-(ne+se),A.top+z+re),this.bottomRightContentBox=m>0||B>0?bt(A.left+Math.min(G,A.width-(R+Z)),A.top+Math.min(K,A.height+z+re),Math.max(0,m-(ne+se)),B-(X+he),pt.BOTTOM_RIGHT):new Ne(A.left+A.width-(ne+se),A.top+A.height-(X+he)),this.bottomLeftContentBox=b>0||C>0?bt(A.left+R+Z,A.top+E,Math.max(0,b-(R+Z)),C-(X+he),pt.BOTTOM_LEFT):new Ne(A.left+R+Z,A.top+A.height-(X+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 bt=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 Ne(i,c),new Ne(i,c-o),new Ne(l-s,e),new Ne(l,e));case pt.TOP_RIGHT:return new Ls(new Ne(i,e),new Ne(i+s,e),new Ne(l,c-o),new Ne(l,c));case pt.BOTTOM_RIGHT:return new Ls(new Ne(l,e),new Ne(l,e+o),new Ne(i+s,c),new Ne(i,c));case pt.BOTTOM_LEFT:default:return new Ls(new Ne(l,c),new Ne(l-s,c),new Ne(i,e+o),new Ne(i,e))}},Ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},yv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Hs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},Cv=(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})(),vv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),Tv=function(i){return i.type===0},Gd=function(i){return i.type===1},bv=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},xv=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 Bv(this.container),this.container.styles.opacity<1&&this.effects.push(new vv(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 Cv(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 m=r.styles.zIndex.order;if(m<0){var B=0;c.negativeZIndex.some(function(b,C){return m>b.element.container.styles.zIndex.order?(B=C,!1):B>0}),c.negativeZIndex.splice(B,0,u)}else if(m>0){var v=0;c.positiveZIndex.some(function(b,C){return m>=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}},Qv=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 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)}},Fv=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)}},Uv=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)}},Sv=function(i,e){switch(e){case 0:return _s(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return _s(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return _s(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return _s(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},_s=function(i,e){var t=[];return TA(i)?t.push(i.subdivide(.5,!1)):t.push(i),TA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},bA=function(i,e,t,A){var r=[];return TA(i)?r.push(i.subdivide(.5,!1)):r.push(i),TA(t)?r.push(t.subdivide(.5,!0)):r.push(t),TA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),TA(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))},Ds=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))},Ev=function(i,e){return i===0?e.bounds:i===2?Ds(e):qd(e)},Lv=function(i,e){return i===0?e.bounds:i===2?Ds(e):qd(e)},tl=function(i,e,t){var A=Ev(Ar(i.styles.backgroundOrigin,e),i),r=Lv(Ar(i.styles.backgroundClip,e),i),n=Mv(Ar(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=Or(Ar(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=Hv(Ar(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]},tr=function(i){return mt(i)&&i.value===Zi.AUTO},Ps=function(i){return typeof i=="number"},Mv=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(Dt(s)&&o&&Dt(o))return[vt(s,t.width),vt(o,t.height)];var l=Ps(n);if(mt(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),m=Ps(r),B=u||m;if(tr(s)&&(!o||tr(o))){if(u&&m)return[A,r];if(!l&&!B)return[t.width,t.height];if(B&&l){var v=u?A:r*n,b=m?r:A/n;return[v,b]}var C=u?A:t.width,U=m?r:t.height;return[C,U]}if(l){var F=0,L=0;return Dt(s)?F=vt(s,t.width):Dt(o)&&(L=vt(o,t.height)),tr(s)?F=L*n:(!o||tr(o))&&(L=F/n),[F,L]}var K=null,G=null;if(Dt(s)?K=vt(s,t.width):o&&Dt(o)&&(G=vt(o,t.height)),K!==null&&(!o||tr(o))&&(G=u&&m?K/A*r:t.height),G!==null&&tr(s)&&(K=u&&m?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},Hv=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 Ne(Math.round(A.left),Math.round(A.top+s)),new Ne(Math.round(A.left+A.width),Math.round(A.top+s)),new Ne(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Ne(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Ne(Math.round(A.left+n),Math.round(A.top)),new Ne(Math.round(A.left+n+o),Math.round(A.top)),new Ne(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Ne(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Ne(Math.round(A.left+n),Math.round(A.top+s)),new Ne(Math.round(A.left+n+o),Math.round(A.top+s)),new Ne(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Ne(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Ne(Math.round(r.left),Math.round(r.top)),new Ne(Math.round(r.left+r.width),Math.round(r.top)),new Ne(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Ne(Math.round(r.left),Math.round(r.height+r.top))]}},Iv="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=Iv,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})(),Dv=1e4,Pv=(function(i){SA(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(),bv(t)&&(this.ctx.globalAlpha=t.opacity),Tv(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 AA(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 AA(this,void 0,void 0,function(){return Jt(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=Vv(t.fontFamily).join(", "),n=kr(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 AA(this,void 0,void 0,function(){var r,n,s,o,l,c,u,m,B=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(b){m.forEach(function(C){switch(C){case 0:B.ctx.fillStyle=Ot(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=Ot(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=Ot(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=Ot(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=Ds(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 AA(this,void 0,void 0,function(){var A,r,n,s,o,l,L,L,c,u,m,B,G,v,b,E,C,U,F,L,K,G,E;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 wd))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 L=z.sent(),this.renderReplacedElement(A,r,L),[3,8];case 7:return z.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];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return L=z.sent(),this.renderReplacedElement(A,r,L),[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 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=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 Wa&&(m=Math.min(A.bounds.width,A.bounds.height),A.type===xs?A.checked&&(this.ctx.save(),this.path([new Ne(A.bounds.left+m*.39363,A.bounds.top+m*.79),new Ne(A.bounds.left+m*.16,A.bounds.top+m*.5549),new Ne(A.bounds.left+m*.27347,A.bounds.top+m*.44071),new Ne(A.bounds.left+m*.39694,A.bounds.top+m*.5649),new Ne(A.bounds.left+m*.72983,A.bounds.top+m*.23),new Ne(A.bounds.left+m*.84,A.bounds.top+m*.34085),new Ne(A.bounds.left+m*.39363,A.bounds.top+m*.79)]),this.ctx.fillStyle=Ot(vd),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(vd),this.ctx.fill(),this.ctx.restore())),Nv(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=Ot(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Ov(A.styles.textAlign),E=Ds(A),C=0,A.styles.textAlign){case 1:C+=E.width/2;break;case 2:C+=E.width;break}U=E.add(C,0,0,-E.height/2+1),this.ctx.save(),this.path([new Ne(E.left,E.top),new Ne(E.left+E.width,E.top),new Ne(E.left+E.width,E.top+E.height),new Ne(E.left,E.top+E.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];L=void 0,K=F.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(K)];case 16:return L=z.sent(),this.ctx.drawImage(L,A.bounds.left-(L.width+10),A.bounds.top),[3,18];case 17:return z.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=Ot(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",E=new qA(A.bounds.left,A.bounds.top+vt(A.styles.paddingTop,A.bounds.width),A.bounds.width,ju(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Wr(t.listValue,E),n.letterSpacing,ju(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 AA(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,m,B,F,v,b,F,C,U,F;return Jt(this,function(L){switch(L.label){case 0:if(Nt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:L.sent(),A=0,r=t.negativeZIndex,L.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:L.sent(),L.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:L.sent(),n=0,s=t.nonInlineLevel,L.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:L.sent(),L.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,L.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:L.sent(),L.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,L.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:L.sent(),L.label=17;case 17:return c++,[3,15];case 18:m=0,B=t.inlineLevel,L.label=19;case 19:return m<B.length?(F=B[m],[4,this.renderNode(F)]):[3,22];case 20:L.sent(),L.label=21;case 21:return m++,[3,19];case 22:v=0,b=t.zeroOrAutoZIndexOrTransformedOrOpacity,L.label=23;case 23:return v<b.length?(F=b[v],[4,this.renderStack(F)]):[3,26];case 24:L.sent(),L.label=25;case 25:return v++,[3,23];case 26:C=0,U=t.positiveZIndex,L.label=27;case 27:return C<U.length?(F=U[C],[4,this.renderStack(F)]):[3,30];case 28:L.sent(),L.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=TA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),TA(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 AA(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,B,v,re,ae,oe,Z,ee,X,b,re,ae,oe,Z,ee,C,U,F,L,K,G,E,z,ne,X,R,re,se,he,Z,ee,ie,ae,oe,le,de,we,be,xe,Be,ge,ve;return Jt(this,function(Te){switch(Te.label){case 0:if(u.type!==0)return[3,5];m=void 0,B=u.url,Te.label=1;case 1:return Te.trys.push([1,3,,4]),[4,n.context.cache.match(B)];case 2:return m=Te.sent(),[3,4];case 3:return Te.sent(),n.context.logger.error("Error loading background-image "+B),[3,4];case 4:return m&&(v=tl(t,A,[m.width,m.height,m.width/m.height]),re=v[0],ae=v[1],oe=v[2],Z=v[3],ee=v[4],X=n.ctx.createPattern(n.resizeImage(m,Z,ee),"repeat"),n.renderRepeat(re,X,ae,oe)),[3,6];case 5:T2(u)?(b=tl(t,A,[null,null,null]),re=b[0],ae=b[1],oe=b[2],Z=b[3],ee=b[4],C=w2(u.angle,Z,ee),U=C[0],F=C[1],L=C[2],K=C[3],G=C[4],E=document.createElement("canvas"),E.width=Z,E.height=ee,z=E.getContext("2d"),ne=z.createLinearGradient(F,K,L,G),Vu(u.stops,U).forEach(function(De){return ne.addColorStop(De.stop,Ot(De.color))}),z.fillStyle=ne,z.fillRect(0,0,Z,ee),Z>0&&ee>0&&(X=n.ctx.createPattern(E,"repeat"),n.renderRepeat(re,X,ae,oe))):b2(u)&&(R=tl(t,A,[null,null,null]),re=R[0],se=R[1],he=R[2],Z=R[3],ee=R[4],ie=u.position.length===0?[Fa]:u.position,ae=vt(ie[0],Z),oe=vt(ie[ie.length-1],ee),le=B2(u,ae,oe,Z,ee),de=le[0],we=le[1],de>0&&we>0&&(be=n.ctx.createRadialGradient(se+ae,he+oe,0,se+ae,he+oe,de),Vu(u.stops,de*2).forEach(function(De){return be.addColorStop(De.stop,Ot(De.color))}),n.path(re),n.ctx.fillStyle=be,de!==we?(xe=t.bounds.left+.5*t.bounds.width,Be=t.bounds.top+.5*t.bounds.height,ge=we/de,ve=1/ge,n.ctx.save(),n.ctx.translate(xe,Be),n.ctx.transform(1,0,0,ge,0,0),n.ctx.translate(-xe,-Be),n.ctx.fillRect(se,ve*(he-Be)+Be,Z,ee*ve),n.ctx.restore()):n.ctx.fill())),Te.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 AA(this,void 0,void 0,function(){return Jt(this,function(n){return this.path(Yd(r,A)),this.ctx.fillStyle=Ot(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return AA(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=Fv(n,r),this.path(s),this.ctx.fillStyle=Ot(t),this.ctx.fill(),o=Uv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return AA(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,m=this;return Jt(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=Ot(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){m.ctx.save();var b=Ms(t.curves),C=v.inset?0:Dv,U=xv(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?(m.path(b),m.ctx.clip(),m.mask(U)):(m.mask(b),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()}),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 AA(this,void 0,void 0,function(){var o,l,c,u,m,B,v,b,C,U,F,L,K,G,E,z,E,z;return Jt(this,function(ne){return this.ctx.save(),o=Sv(n,r),l=Yd(n,r),s===2&&(this.path(l),this.ctx.clip()),TA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),TA(l[1])?(m=l[1].end.x,B=l[1].end.y):(m=l[1].x,B=l[1].y),r===0||r===2?v=Math.abs(c-m):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):(L=Math.floor((v+C)/(b+C)),K=(v-L*b)/(L-1),G=(v-(L+1)*b)/L,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=Ot(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(TA(l[0])&&(E=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Ne(E.end.x,E.end.y),new Ne(z.start.x,z.start.y)]),this.ctx.stroke()),TA(l[1])&&(E=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Ne(E.end.x,E.end.y),new Ne(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return AA(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=Qv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(ep),Nv=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 yv(e);default:return Hs(e)}},Ov=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},Kv=["-apple-system","system-ui"],Vv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return Kv.indexOf(e)===-1}):i},zv=(function(i){SA(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 AA(this,void 0,void 0,function(){var A,r;return Jt(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,Wv(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})(ep),Wv=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))})},Rv=(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})(),Gv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Rv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new uv(this,e)}return i.instanceCount=1,i})(),$v=function(i,e){return e===void 0&&(e={}),Xv(i,e)};typeof window<"u"&&Rd.setContext(window);var Xv=function(i,e){return AA(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,m,B,v,b,C,U,F,L,K,G,E,ne,z,ne,X,R,re,se,he,Z,ee,ie,ae,oe,le,de,we,be,xe,Be,ge;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:(X=e.allowTaint)!==null&&X!==void 0?X:!1,imageTimeout:(R=e.imageTimeout)!==null&&R!==void 0?R:15e3,proxy:e.proxy,useCORS:(re=e.useCORS)!==null&&re!==void 0?re:!1},n=sa({logging:(se=e.logging)!==null&&se!==void 0?se:!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:(ee=e.scrollX)!==null&&ee!==void 0?ee:A.pageXOffset,scrollY:(ie=e.scrollY)!==null&&ie!==void 0?ie:A.pageYOffset},o=new qA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new Gv(n,o),c=(ae=e.foreignObjectRendering)!==null&&ae!==void 0?ae:!1,u={allowTaint:(oe=e.allowTaint)!==null&&oe!==void 0?oe:!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 zd(l,i,u),B=m.clonedReferenceElement,B?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=ve.sent(),b=Ga(B)||JC(B)?xw(B.ownerDocument):Gn(l,B),C=b.width,U=b.height,F=b.left,L=b.top,K=Jv(l,B,e.backgroundColor),G={canvas:e.canvas,backgroundColor:K,scale:(de=(le=e.scale)!==null&&le!==void 0?le:A.devicePixelRatio)!==null&&de!==void 0?de:1,x:((we=e.x)!==null&&we!==void 0?we:0)+F,y:((be=e.y)!==null&&be!==void 0?be:0)+L,width:(xe=e.width)!==null&&xe!==void 0?xe: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 zv(l,G),[4,ne.render(B)]):[3,3];case 2:return E=ve.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+L+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=Fd(l,B),K===z.styles.backgroundColor&&(z.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 Pv(l,G),[4,ne.render(z)];case 4:E=ve.sent(),ve.label=5;case 5:return(!((ge=e.removeContainer)!==null&&ge!==void 0)||ge)&&(zd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,E]}})})},Jv=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 Zv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class Yv{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 B=Math.round(m*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 m=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):m,n.textAlign="right"}else b=m,n.textAlign="left";else A.hAlign==="right"?(b=v-m,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 qv{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,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*m),L=Math.round(C*B),K=Math.round(b*m),G=Math.round(U*B),E=l.context;if(E.save(),E.beginPath(),E.strokeStyle=s.color,E.lineWidth=s.lineWidth*B,E.setLineDash([]),E.moveTo(F,L),E.lineTo(K,G),E.stroke(),E.beginPath(),E.fillStyle=s.color,E.arc(F,L,3*B,0,Math.PI*2),E.fill(),E.beginPath(),E.arc(K,G,3*B,0,Math.PI*2),E.fill(),!s.statsShowAlways&&!s.isActive){E.restore();return}const{priceDiff:z,pricePct:ne,bars:X,days:R,angle:re}=s.info,se=z>=0?"+":"",he=[];if(s.statsPriceRange!==!1&&he.push(`${se}${z.toFixed(5)} (${se}${ne.toFixed(2)}%)`),s.statsBarsRange!==!1&&he.push(`${X} bars`),s.statsDateRange!==!1&&he.push(`${R} days`),s.statsAngle!==!1&&he.push(`∠ ${re.toFixed(1)}°`),s.statsDistance&&he.push(`Δ ${Math.abs(z).toFixed(5)}`),he.length===0){E.restore();return}const Z=Math.round(11*B);E.font=`${Z}px sans-serif`;const ee=Z*1.6,ie=8*B,ae=Math.max(...he.map(Xe=>E.measureText(Xe).width))+ie*2,oe=he.length*ee+ie*2,le=s.statsPosition??"right";let de,we;le==="left"?(de=F,we=L):le==="center"?(de=Math.round((F+K)/2),we=Math.round((L+G)/2)):(de=K,we=G);let be,xe;le==="left"?(be=de-ae-10*m,xe=we-oe-4*B):le==="center"?(be=de-ae/2,xe=we-oe-8*B):(be=de+10*m,xe=we-oe-4*B);const Be=l.bitmapSize.width,ge=l.bitmapSize.height,ve=Math.min(Math.max(0,be),Be-ae-4*m),Te=Math.min(Math.max(4*B,xe),ge-oe-4*B),De=4*B;E.beginPath(),E.moveTo(ve+De,Te),E.lineTo(ve+ae-De,Te),E.quadraticCurveTo(ve+ae,Te,ve+ae,Te+De),E.lineTo(ve+ae,Te+oe-De),E.quadraticCurveTo(ve+ae,Te+oe,ve+ae-De,Te+oe),E.lineTo(ve+De,Te+oe),E.quadraticCurveTo(ve,Te+oe,ve,Te+oe-De),E.lineTo(ve,Te+De),E.quadraticCurveTo(ve,Te,ve+De,Te),E.closePath(),E.fillStyle="rgba(30, 41, 59, 0.92)",E.fill(),E.strokeStyle=s.statsColor||s.color,E.lineWidth=1*B,E.stroke(),E.fillStyle="#e2e8f0",E.textAlign="left",he.forEach((Xe,Ve)=>{E.fillText(Xe,ve+ie,Te+ie+Z+Ve*ee)}),E.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 m=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*m),L=Math.round(C*B),K=Math.round(b*m),G=Math.round(U*B),E=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,K),Math.min(L,G),Math.abs(K-F),Math.abs(G-L)),z.strokeStyle=E,z.lineWidth=1*B,z.setLineDash([]),z.strokeRect(Math.min(F,K),Math.min(L,G),Math.abs(K-F),Math.abs(G-L))),z.beginPath(),z.strokeStyle=E,z.lineWidth=2*B,z.moveTo(F,L),z.lineTo(K,G),z.stroke(),z.fillStyle=E,z.beginPath(),z.arc(F,L,3*B,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(K,G,3*B,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:ne,pricePct:X,bars:R,days:re}=s.info,se=ne>=0?"+":"",he=[];if(s.statsPriceRange&&he.push(se+ne.toFixed(5)+" ("+se+X.toFixed(2)+"%)"),s.statsBarsRange&&he.push(R+" bars"),s.statsDateRange&&he.push(re+" days"),he.length===0){z.restore();return}const Z=Math.round(11*B);z.font=Z+"px sans-serif";const ee=Z*1.6,ie=8*B,ae=Math.max(...he.map(ve=>z.measureText(ve).width))+ie*2,oe=he.length*ee+ie*2,le=l.bitmapSize.width,de=l.bitmapSize.height;let we,be;if(s.statsPosition==="left")we=F-ae-10*m,be=L-oe-4*B;else if(s.statsPosition==="center"){const ve=(F+K)/2,Te=(L+G)/2;we=ve-ae/2,be=Te-oe-4*B}else we=K+10*m,be=G-oe-4*B;const xe=Math.min(Math.max(0,we),le-ae-4*m),Be=Math.min(Math.max(4*B,be),de-oe-4*B),ge=4*B;z.beginPath(),z.moveTo(xe+ge,Be),z.lineTo(xe+ae-ge,Be),z.quadraticCurveTo(xe+ae,Be,xe+ae,Be+ge),z.lineTo(xe+ae,Be+oe-ge),z.quadraticCurveTo(xe+ae,Be+oe,xe+ae-ge,Be+oe),z.lineTo(xe+ge,Be+oe),z.quadraticCurveTo(xe,Be+oe,xe,Be+oe-ge),z.lineTo(xe,Be+ge),z.quadraticCurveTo(xe,Be,xe+ge,Be),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||E,z.lineWidth=1*B,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",he.forEach((ve,Te)=>{z.fillText(ve,xe+ie,Be+ie+Z+Te*ee)}),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 jv{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),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(m==null||B==null||v==null||b==null)return;const C=Math.min(m,B)*c,U=Math.max(m,B)*c,F=Math.min(v,b)*u,L=Math.max(v,b)*u,K=U-C,G=L-F;if(K<.5||G<.5)return;const E=s.context;E.save(),E.fillStyle=r.fillColor,E.fillRect(C,F,K,G),E.strokeStyle=r.strokeColor,E.lineWidth=r.lineWidth*u,E.setLineDash([]),E.strokeRect(C,F,K,G),E.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.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),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(m==null||B==null||v==null||b==null)return;const C=m*c,U=B*u,F=v*c,L=b*u,K=Math.hypot(F-C,L-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 tT{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,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 L=B*u,K=v*m,G=b*u,E=C*m,z=U*u,ne=F*m,X=o.context;X.save(),X.beginPath(),X.moveTo(L,K),X.lineTo(G,E),X.lineTo(z,ne),X.closePath(),X.fillStyle=n.fillColor,X.fill(),X.strokeStyle=n.strokeColor,X.lineWidth=n.lineWidth*m,X.setLineDash([]),X.stroke(),X.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.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),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(m==null||B==null||v==null||b==null)return;const C=m*c,U=B*u,F=v*c,L=b*u,K=F-C,G=L-U,E=Math.hypot(K,G);if(E<.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,L),z.stroke();else{const ne=(C+F)/2,X=(U+L)/2,R=Math.atan2(G,K),re=E/2,se=Math.max(1,re*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(ne,X,re,se,R,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 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,m=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(m==null||B==null||v==null||b==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(B*c),L=Math.round(b*u),K=F-C,G=L-U,E=s.context;E.save(),E.strokeStyle=r.color,E.fillStyle=r.color,E.lineWidth=r.lineWidth*u,E.setLineDash([]);const z=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const he=U+z*(0-C);E.beginPath(),E.moveTo(0,he),E.lineTo(C,U),E.stroke()}if(r.rayRight){const se=s.bitmapSize.width,he=L+z*(se-F);E.beginPath(),E.moveTo(F,L),E.lineTo(se,he),E.stroke()}E.beginPath(),E.moveTo(C,U),E.lineTo(F,L),E.stroke();const ne=Math.atan2(L-U,F-C),X=(r.lineWidth*4+4)*u,R=Math.PI/7;if(r.arrowRight){const se=F-X*Math.cos(ne-R),he=L-X*Math.sin(ne-R),Z=F-X*Math.cos(ne+R),ee=L-X*Math.sin(ne+R);E.beginPath(),E.moveTo(F,L),E.lineTo(se,he),E.lineTo(Z,ee),E.closePath(),E.fill()}if(r.arrowLeft){const se=ne+Math.PI,he=C-X*Math.cos(se-R),Z=U-X*Math.sin(se-R),ee=C-X*Math.cos(se+R),ie=U-X*Math.sin(se+R);E.beginPath(),E.moveTo(C,U),E.lineTo(he,Z),E.lineTo(ee,ie),E.closePath(),E.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const se=r.p1.rawTime,he=r.p2.rawTime,Z=r.p1.price,ee=r.p2.price,ie=[];if(r.statsPriceRange){const oe=Math.abs(ee-Z),le=Z!==0?Math.abs((ee-Z)/Z*100):0,de=oe<1e-4?6:oe<.01?5:oe<1?4:2;ie.push("↕ "+oe.toFixed(de)+" ("+le.toFixed(2)+"%)")}const ae=[];if(r.statsBarsRange)try{const oe=o.timeScale().timeToCoordinate(se),le=o.timeScale().timeToCoordinate(he);if(oe!=null&&le!=null){const de=o.timeScale().coordinateToLogical(oe),we=o.timeScale().coordinateToLogical(le);de!=null&&we!=null&&ae.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const oe=Math.abs(he-se),le=Math.floor(oe/86400),de=Math.floor(oe%86400/3600),we=Math.floor(oe%3600/60);let be=le>0?le+" day"+(le!==1?"s":""):"";de>0&&(be+=(be?" ":"")+de+" hour"+(de!==1?"s":"")),!le&&!de&&(be=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ae.length>0?ae[ae.length-1]+=" ("+be+")":ae.push(be)}if(r.statsDistance){const oe=K/c,le=G/u;ae.push("distance: "+Math.sqrt(oe*oe+le*le).toFixed(2))}if(ae.length>0&&ie.push(ae.join(", ")),r.statsAngle){const oe=K/c,le=G/u,de=Math.atan2(le,oe)*180/Math.PI;ie.push("∠ "+de.toFixed(0)+"°")}if(ie.length>0){const oe=Math.min(c,u),le=11*oe,de=le*1.5,we=5*oe;E.font=le+"px sans-serif";const xe=ie.reduce((Le,Ee)=>Math.max(Le,E.measureText(Ee).width),0)+we*2,Be=ie.length*de+we*2,[ge,ve,Te,De]=C<=F?[C,U,F,L]:[F,L,C,U];let Xe,Ve;r.statsPosition==="left"?(Xe=ge,Ve=ve):r.statsPosition==="center"?(Xe=(ge+Te)/2,Ve=(ve+De)/2):(Xe=Te,Ve=De);const Ce=Xe-xe/2,je=Ve-Be-12*oe;E.fillStyle="rgba(20, 20, 30, 0.72)",E.fillRect(Ce,je,xe,Be),E.strokeStyle=r.statsColor,E.lineWidth=1*oe,E.strokeRect(Ce,je,xe,Be),E.fillStyle=r.statsColor,E.textBaseline="top",E.textAlign="left",ie.forEach((Le,Ee)=>{E.fillText(Le,Ce+we,je+we+Ee*de)})}}E.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.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),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(m==null||B==null||v==null||b==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(B*c),L=Math.round(b*u),K=F-C,G=L-U,E=s.context;E.save(),E.strokeStyle=r.color,E.fillStyle=r.color,E.lineWidth=r.lineWidth*u,E.setLineDash([]);const z=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const he=U+z*(0-C);E.beginPath(),E.moveTo(0,he),E.lineTo(C,U),E.stroke()}if(r.rayRight){const se=s.bitmapSize.width,he=L+z*(se-F);E.beginPath(),E.moveTo(F,L),E.lineTo(se,he),E.stroke()}E.beginPath(),E.moveTo(C,U),E.lineTo(F,L),E.stroke();const ne=Math.atan2(L-U,F-C),X=(r.lineWidth*4+4)*u,R=Math.PI/7;if(r.arrowRight){const se=F-X*Math.cos(ne-R),he=L-X*Math.sin(ne-R),Z=F-X*Math.cos(ne+R),ee=L-X*Math.sin(ne+R);E.beginPath(),E.moveTo(F,L),E.lineTo(se,he),E.lineTo(Z,ee),E.closePath(),E.fill()}if(r.arrowLeft){const se=ne+Math.PI,he=C-X*Math.cos(se-R),Z=U-X*Math.sin(se-R),ee=C-X*Math.cos(se+R),ie=U-X*Math.sin(se+R);E.beginPath(),E.moveTo(C,U),E.lineTo(he,Z),E.lineTo(ee,ie),E.closePath(),E.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const se=r.p1.rawTime,he=r.p2.rawTime,Z=r.p1.price,ee=r.p2.price,ie=[];if(r.statsPriceRange){const oe=Math.abs(ee-Z),le=Z!==0?Math.abs((ee-Z)/Z*100):0,de=oe<1e-4?6:oe<.01?5:oe<1?4:2;ie.push("↕ "+oe.toFixed(de)+" ("+le.toFixed(2)+"%)")}const ae=[];if(r.statsBarsRange)try{const oe=o.timeScale().timeToCoordinate(se),le=o.timeScale().timeToCoordinate(he);if(oe!=null&&le!=null){const de=o.timeScale().coordinateToLogical(oe),we=o.timeScale().coordinateToLogical(le);de!=null&&we!=null&&ae.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const oe=Math.abs(he-se),le=Math.floor(oe/86400),de=Math.floor(oe%86400/3600),we=Math.floor(oe%3600/60);let be=le>0?le+" day"+(le!==1?"s":""):"";de>0&&(be+=(be?" ":"")+de+" hour"+(de!==1?"s":"")),!le&&!de&&(be=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ae.length>0?ae[ae.length-1]+=" ("+be+")":ae.push(be)}if(r.statsDistance){const oe=K/c,le=G/u;ae.push("distance: "+Math.sqrt(oe*oe+le*le).toFixed(2))}if(ae.length>0&&ie.push(ae.join(", ")),r.statsAngle){const oe=K/c,le=G/u,de=Math.atan2(le,oe)*180/Math.PI;ie.push("∠ "+de.toFixed(0)+"°")}if(ie.length>0){const oe=Math.min(c,u),le=11*oe,de=le*1.5,we=5*oe;E.font=le+"px sans-serif";const xe=ie.reduce((Le,Ee)=>Math.max(Le,E.measureText(Ee).width),0)+we*2,Be=ie.length*de+we*2,[ge,ve,Te,De]=C<=F?[C,U,F,L]:[F,L,C,U];let Xe,Ve;r.statsPosition==="left"?(Xe=ge,Ve=ve):r.statsPosition==="center"?(Xe=(ge+Te)/2,Ve=(ve+De)/2):(Xe=Te,Ve=De);const Ce=Xe-xe/2,je=Ve-Be-12*oe;E.fillStyle="rgba(20, 20, 30, 0.72)",E.fillRect(Ce,je,xe,Be),E.strokeStyle=r.statsColor,E.lineWidth=1*oe,E.strokeRect(Ce,je,xe,Be),E.fillStyle=r.statsColor,E.textBaseline="top",E.textAlign="left",ie.forEach((Le,Ee)=>{E.fillText(Le,Ce+we,je+we+Ee*de)})}}E.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,m=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(m==null||B==null||v==null||b==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(B*c),L=Math.round(b*u),K=F-C,G=L-U,E=s.context;E.save(),E.strokeStyle=r.color,E.fillStyle=r.color,E.lineWidth=r.lineWidth*u,E.setLineDash([]);const z=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const he=U+z*(0-C);E.beginPath(),E.moveTo(0,he),E.lineTo(C,U),E.stroke()}if(r.rayRight){const se=s.bitmapSize.width,he=L+z*(se-F);E.beginPath(),E.moveTo(F,L),E.lineTo(se,he),E.stroke()}E.beginPath(),E.moveTo(C,U),E.lineTo(F,L),E.stroke();const ne=Math.atan2(L-U,F-C),X=(r.lineWidth*4+4)*u,R=Math.PI/7;if(r.arrowRight){const se=F-X*Math.cos(ne-R),he=L-X*Math.sin(ne-R),Z=F-X*Math.cos(ne+R),ee=L-X*Math.sin(ne+R);E.beginPath(),E.moveTo(F,L),E.lineTo(se,he),E.lineTo(Z,ee),E.closePath(),E.fill()}if(r.arrowLeft){const se=ne+Math.PI,he=C-X*Math.cos(se-R),Z=U-X*Math.sin(se-R),ee=C-X*Math.cos(se+R),ie=U-X*Math.sin(se+R);E.beginPath(),E.moveTo(C,U),E.lineTo(he,Z),E.lineTo(ee,ie),E.closePath(),E.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const se=r.p1.rawTime,he=r.p2.rawTime,Z=r.p1.price,ee=r.p2.price,ie=[];if(r.statsPriceRange){const oe=Math.abs(ee-Z),le=Z!==0?Math.abs((ee-Z)/Z*100):0,de=oe<1e-4?6:oe<.01?5:oe<1?4:2;ie.push("↕ "+oe.toFixed(de)+" ("+le.toFixed(2)+"%)")}const ae=[];if(r.statsBarsRange)try{const oe=o.timeScale().timeToCoordinate(se),le=o.timeScale().timeToCoordinate(he);if(oe!=null&&le!=null){const de=o.timeScale().coordinateToLogical(oe),we=o.timeScale().coordinateToLogical(le);de!=null&&we!=null&&ae.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const oe=Math.abs(he-se),le=Math.floor(oe/86400),de=Math.floor(oe%86400/3600),we=Math.floor(oe%3600/60);let be=le>0?le+" day"+(le!==1?"s":""):"";de>0&&(be+=(be?" ":"")+de+" hour"+(de!==1?"s":"")),!le&&!de&&(be=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ae.length>0?ae[ae.length-1]+=" ("+be+")":ae.push(be)}if(r.statsDistance){const oe=K/c,le=G/u;ae.push("distance: "+Math.sqrt(oe*oe+le*le).toFixed(2))}if(ae.length>0&&ie.push(ae.join(", ")),r.statsAngle){const oe=K/c,le=G/u,de=Math.atan2(le,oe)*180/Math.PI;ie.push("∠ "+de.toFixed(0)+"°")}if(ie.length>0){const oe=Math.min(c,u),le=11*oe,de=le*1.5,we=5*oe;E.font=le+"px sans-serif";const xe=ie.reduce((Le,Ee)=>Math.max(Le,E.measureText(Ee).width),0)+we*2,Be=ie.length*de+we*2,[ge,ve,Te,De]=C<=F?[C,U,F,L]:[F,L,C,U];let Xe,Ve;r.statsPosition==="left"?(Xe=ge,Ve=ve):r.statsPosition==="center"?(Xe=(ge+Te)/2,Ve=(ve+De)/2):(Xe=Te,Ve=De);const Ce=Xe-xe/2,je=Ve-Be-12*oe;E.fillStyle="rgba(20, 20, 30, 0.72)",E.fillRect(Ce,je,xe,Be),E.strokeStyle=r.statsColor,E.lineWidth=1*oe,E.strokeRect(Ce,je,xe,Be),E.fillStyle=r.statsColor,E.textBaseline="top",E.textAlign="left",ie.forEach((Le,Ee)=>{E.fillText(Le,Ce+we,je+we+Ee*de)})}}E.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="#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 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=m.priceToCoordinate(n.p1.price),F=m.priceToCoordinate(n.p2.price);if(b==null||C==null||U==null||F==null)return;const L=b*B,K=U*v,G=C*B,E=F*v,[z,ne,X,R]=L<=G?[L,K,G,E]:[G,E,L,K];let re=X-z,se=R-ne;Math.abs(re)<1e-4&&(re=1e-4);const he=se/re,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 oe=o.bitmapSize.width,le=R+he*(oe-X);Z.beginPath(),Z.moveTo(X,R),Z.lineTo(oe,le),Z.stroke()}const ee=Math.atan2(se,re),ie=(n.lineWidth*4+4)*v,ae=Math.PI/7;if(n.arrowRight){const oe=X-ie*Math.cos(ee-ae),le=R-ie*Math.sin(ee-ae),de=X-ie*Math.cos(ee+ae),we=R-ie*Math.sin(ee+ae);Z.beginPath(),Z.moveTo(X,R),Z.lineTo(oe,le),Z.lineTo(de,we),Z.closePath(),Z.fill()}if(n.arrowLeft){const oe=ee+Math.PI,le=z-ie*Math.cos(oe-ae),de=ne-ie*Math.sin(oe-ae),we=z-ie*Math.cos(oe+ae),be=ne-ie*Math.sin(oe+ae);Z.beginPath(),Z.moveTo(z,ne),Z.lineTo(le,de),Z.lineTo(we,be),Z.closePath(),Z.fill()}if(c){const oe=n.p1.rawTime??n.p1.time,le=n.p2.rawTime??n.p2.time,de=n.p1.price,we=n.p2.price,be=[];if(n.statsPriceRange){const Be=Math.abs(we-de),ge=de!==0?Math.abs((we-de)/de*100):0,ve=Be<1e-4?6:Be<.01?5:Be<1?4:2;be.push("↕ "+Be.toFixed(ve)+" ("+ge.toFixed(2)+"%)")}const xe=[];if(n.statsBarsRange)try{const Be=u.timeScale().timeToCoordinate(oe),ge=u.timeScale().timeToCoordinate(le);if(Be!=null&&ge!=null){const ve=u.timeScale().coordinateToLogical(Be),Te=u.timeScale().coordinateToLogical(ge);ve!=null&&Te!=null&&xe.push("↔ "+Math.abs(Math.round(Te-ve))+" bars")}}catch{}if(n.statsDateRange){const Be=Math.abs(le-oe),ge=Math.floor(Be/86400),ve=Math.floor(Be%86400/3600),Te=Math.floor(Be%3600/60);let De=ge>0?ge+" day"+(ge!==1?"s":""):"";ve>0&&(De+=(De?" ":"")+ve+" hour"+(ve!==1?"s":"")),!ge&&!ve&&(De=Te+" min"+(Te!==1?"s":"")),n.statsBarsRange&&xe.length>0?xe[xe.length-1]+=" ("+De+")":xe.push(De)}if(n.statsDistance){const Be=(G-L)/B,ge=(E-K)/v;xe.push("distance: "+Math.sqrt(Be*Be+ge*ge).toFixed(2))}if(xe.length>0&&be.push(xe.join(", ")),n.statsAngle){const Be=re/B,ge=se/v,ve=Math.atan2(ge,Be)*180/Math.PI;be.push("∠ "+ve.toFixed(0)+"°")}if(be.length>0){const Be=Math.min(B,v),ge=11*Be,ve=ge*1.5,Te=5*Be;Z.font=ge+"px sans-serif";const Xe=be.reduce((at,rt)=>Math.max(at,Z.measureText(rt).width),0)+Te*2,Ve=be.length*ve+Te*2;let Ce,je;n.statsPosition==="left"?(Ce=z,je=ne):n.statsPosition==="center"?(Ce=(z+X)/2,je=(ne+R)/2):(Ce=X,je=R);const Le=Ce-Xe/2,Ee=je-Ve-12*Be;Z.fillStyle="rgba(20, 20, 30, 0.72)",Z.fillRect(Le,Ee,Xe,Ve),Z.strokeStyle=n.statsColor,Z.lineWidth=1*Be,Z.strokeRect(Le,Ee,Xe,Ve),Z.fillStyle=n.statsColor,Z.textBaseline="top",Z.textAlign="left",be.forEach((at,rt)=>{Z.fillText(at,Le+Te,Ee+Te+rt*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 sT{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 B=Math.round(u*l),v=Math.round(m*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),L=Math.round(11*c);U.font=L+"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),E=Math.round(3*c),z=L+2*E,ne=K+2*G,X=b-ne-Math.round(2*l),R=v-z/2;U.fillStyle=A.color,U.fillRect(X,R,ne,z),U.fillStyle="#ffffff",U.fillText(F,X+G,v)}if(A.showTime){const F=A.center.rawTime,L=new Date(F*1e3),K=Z=>String(Z).padStart(2,"0"),G=K(L.getUTCDate())+"."+K(L.getUTCMonth()+1)+"."+L.getUTCFullYear()+" "+K(L.getUTCHours())+":"+K(L.getUTCMinutes())+":"+K(L.getUTCSeconds()),E=Math.round(11*c);U.font=E+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const z=U.measureText(G).width,ne=Math.round(6*l),X=Math.round(3*c),R=E+2*X,re=z+2*ne,se=B-re/2,he=C-R-Math.round(4*c);U.fillStyle=A.color,U.fillRect(se,he,re,R),U.fillStyle="#ffffff",U.fillText(G,B,he+R/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 oT{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),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(m==null||B==null||v==null||b==null)return;const C=m*c,U=v*u,F=B*c,L=b*u,K=C-F,G=U-L,E=F-C,z=L-U;if(Math.hypot(K,G)<1e-4)return;const X=Math.atan2(G,K),R=Math.round(Math.abs(X*180/Math.PI)),re=s.context;re.save(),re.strokeStyle=r.color,re.fillStyle=r.color,re.lineWidth=r.lineWidth*u,re.setLineDash([]);const se=Math.abs(E)<1e-4?0:z/E;if(r.rayLeft){const we=U+se*(0-C);re.beginPath(),re.moveTo(0,we),re.lineTo(C,U),re.stroke()}if(r.rayRight){const de=s.bitmapSize.width,we=L+se*(de-F);re.beginPath(),re.moveTo(F,L),re.lineTo(de,we),re.stroke()}re.beginPath(),re.moveTo(C,U),re.lineTo(F,L),re.stroke();const he=Math.atan2(z,E),Z=(r.lineWidth*4+4)*u,ee=Math.PI/7;if(r.arrowRight){const de=F-Z*Math.cos(he-ee),we=L-Z*Math.sin(he-ee),be=F-Z*Math.cos(he+ee),xe=L-Z*Math.sin(he+ee);re.beginPath(),re.moveTo(F,L),re.lineTo(de,we),re.lineTo(be,xe),re.closePath(),re.fill()}if(r.arrowLeft){const de=he+Math.PI,we=C-Z*Math.cos(de-ee),be=U-Z*Math.sin(de-ee),xe=C-Z*Math.cos(de+ee),Be=U-Z*Math.sin(de+ee);re.beginPath(),re.moveTo(C,U),re.lineTo(we,be),re.lineTo(xe,Be),re.closePath(),re.fill()}const ie=28*u;re.strokeStyle="rgba(122,166,174,0.55)",re.fillStyle=r.color,re.lineWidth=1*u,re.beginPath(),re.moveTo(F,L),re.lineTo(F+ie,L),re.stroke(),re.beginPath(),re.strokeStyle="rgba(122,166,174,0.45)",re.arc(F,L,ie,0,X,X<0),re.stroke(),re.fillStyle="#4b7c86",re.font=`${Math.round(10*u)}px sans-serif`,re.textAlign="left",re.textBaseline="middle";const ae=F+(ie+10*u)*Math.cos(X/2),oe=L+(ie+10*u)*Math.sin(X/2);if(re.fillText(`${R}°`,ae,oe),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const de=r.p1.price,we=r.p2.price,be=[];if(r.statsPriceRange){const Be=Math.abs(we-de),ge=de!==0?Math.abs((we-de)/de*100):0,ve=Be<1e-4?6:Be<.01?5:Be<1?4:2;be.push("↕ "+Be.toFixed(ve)+" ("+ge.toFixed(2)+"%)")}const xe=[];if(r.statsDistance){const Be=E/c,ge=z/u;xe.push("distance: "+Math.sqrt(Be*Be+ge*ge).toFixed(2))}if(xe.length>0&&be.push(xe.join(", ")),be.length>0){const Be=Math.min(c,u),ge=11*Be,ve=ge*1.5,Te=5*Be;re.font=ge+"px sans-serif";const Xe=be.reduce((ke,Fe)=>Math.max(ke,re.measureText(Fe).width),0)+Te*2,Ve=be.length*ve+Te*2,[Ce,je,Le,Ee]=C<=F?[C,U,F,L]:[F,L,C,U];let at,rt;r.statsPosition==="left"?(at=Ce,rt=je):r.statsPosition==="center"?(at=(Ce+Le)/2,rt=(je+Ee)/2):(at=Le,rt=Ee);const Pt=at-Xe/2,_e=rt-Ve-12*Be;re.fillStyle="rgba(20, 20, 30, 0.72)",re.fillRect(Pt,_e,Xe,Ve),re.strokeStyle=r.statsColor,re.lineWidth=1*Be,re.strokeRect(Pt,_e,Xe,Ve),re.fillStyle=r.statsColor,re.textBaseline="top",re.textAlign="left",be.forEach((ke,Fe)=>{re.fillText(ke,Pt+Te,_e+Te+Fe*ve)})}}re.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.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,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 L=B*c,K=v*u,G=b*c,E=C*u,z=U*c,ne=F*u,X=(G+z)/2,R=(E+ne)/2;let re=X-L,se=R-K;Math.abs(re)<1e-4&&(re=1e-4);const he=se/re,Z=s.bitmapSize.width,ee=(G-z)/2,ie=(E-ne)/2,ae=Be=>({x:X+ee*Be,y:R+ie*Be}),oe=(Be,ge)=>({x:Z,y:ge+he*(Z-Be)}),le=ae(1),de=ae(-1),we=oe(le.x,le.y),be=oe(de.x,de.y);m.save(),m.beginPath(),m.moveTo(le.x,le.y),m.lineTo(we.x,we.y),m.lineTo(be.x,be.y),m.lineTo(de.x,de.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(G,E),m.lineTo(z,ne),m.stroke(),r._levels.forEach(Be=>{const ge=ae(Be.k),ve=oe(ge.x,ge.y);m.beginPath(),m.strokeStyle=Be.color,m.lineWidth=Be.width*u,m.moveTo(ge.x,ge.y),m.lineTo(ve.x,ve.y),m.stroke()});const xe=oe(L,K);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*u,m.moveTo(L,K),m.lineTo(xe.x,xe.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 lT{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),B=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),b=o.priceToCoordinate(A.p2.price);if(m==null||B==null||v==null||b==null)return;const C=m*l,U=B*c,F=v*l,L=b*c,K=n.bitmapSize.width,G=Math.abs(F-C)<1e-4?1:F-C,E=(L-U)/G,z=F>=C?1:-1,ne=z>0?K:0,X=C+z*Math.min(220*l,Math.max(80*l,K*.35)),R=A._rays.map(se=>{const he=E*se.ratio;return{...se,yEnd:U+he*(ne-C),yLabel:U+he*(X-C)}});u.save();const re=(se,he,Z)=>{!se||!he||(u.beginPath(),u.moveTo(C,U),u.lineTo(ne,se.yEnd),u.lineTo(ne,he.yEnd),u.closePath(),u.fillStyle=Z,u.fill())};re(R[0],R[3],"rgba(161, 98, 7, 0.10)"),re(R[3],R[4],"rgba(5, 150, 105, 0.10)"),re(R[4],R[5],"rgba(107, 114, 128, 0.12)"),R.forEach(se=>{u.beginPath(),u.strokeStyle=se.color,u.lineWidth=1*c,u.moveTo(C,U),u.lineTo(ne,se.yEnd),u.stroke()}),u.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,u.textAlign=z>0?"left":"right",u.textBaseline="middle",R.forEach(se=>{u.fillStyle=se.color;const he=X+(z>0?4*l:-4*l),Z=se.yLabel;Z<-20||Z>n.bitmapSize.height+20||u.fillText(se.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 cT{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,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,L=b*c,K=C*u,G=L-U,E=K-F,z=Math.hypot(G,E);if(z<1e-4)return;const ne=G/z,X=E/z,R=-X,re=ne,se=L+R*z,he=K+re*z,Z=U+R*z,ee=F+re*z,ie=(oe,le)=>({x:U+ne*z*oe+R*z*le,y:F+X*z*oe+re*z*le});m.save();const ae=["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 oe=0;oe<r.divisions;oe++){const le=oe/r.divisions,de=(oe+1)/r.divisions,we=ie(0,le),be=ie(1,le),xe=ie(1,de),Be=ie(0,de);m.beginPath(),m.moveTo(we.x,we.y),m.lineTo(be.x,be.y),m.lineTo(xe.x,xe.y),m.lineTo(Be.x,Be.y),m.closePath(),m.fillStyle=ae[oe%ae.length],m.fill()}m.lineWidth=1*u,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let oe=0;oe<=r.divisions;oe++){const le=oe/r.divisions,de=ie(0,le),we=ie(1,le),be=ie(le,0),xe=ie(le,1);m.beginPath(),m.moveTo(de.x,de.y),m.lineTo(we.x,we.y),m.stroke(),m.beginPath(),m.moveTo(be.x,be.y),m.lineTo(xe.x,xe.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*u,m.beginPath(),m.moveTo(U,F),m.lineTo(se,he),m.stroke(),m.beginPath(),m.moveTo(L,K),m.lineTo(Z,ee),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*u,m.beginPath(),m.moveTo(U,F),m.lineTo(L,K),m.lineTo(se,he),m.lineTo(Z,ee),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 Al{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: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=m,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(L){L.useBitmapCoordinateSpace(K=>{if(!F.visible)return;const G=F._chart,E=F._series;if(!G||!E)return;const z=K.horizontalPixelRatio,ne=K.verticalPixelRatio,X=[F.p1,F.p3,F.p4,F.p2].map(Ve=>{const Ce=G.timeScale().timeToCoordinate(Ve.rawTime),je=E.priceToCoordinate(Ve.price);return Ce==null||je==null?null:{x:Ce*z,y:je*ne}}).filter(Boolean);if(X.length!==4)return;const[R,re,se,he]=X,Z=K.context;Z.save();const ee=re.x-R.x,ie=re.y-R.y,ae=Math.sqrt(ee*ee+ie*ie)||1,oe=ee/ae,le=ie/ae,de=se.x-he.x,we=se.y-he.y,be=Math.sqrt(de*de+we*we)||1,xe=de/be,Be=we/be,ge=1e5,ve=F.rayLeft?{x:R.x-oe*ge,y:R.y-le*ge}:R,Te=F.rayRight?{x:re.x+oe*ge,y:re.y+le*ge}:re,De=F.rayLeft?{x:he.x-xe*ge,y:he.y-Be*ge}:he,Xe=F.rayRight?{x:se.x+xe*ge,y:se.y+Be*ge}:se;if(F.showBackground){const Ve=F.fillColor||"#6aa84f",Ce=parseInt(Ve.slice(1,3),16),je=parseInt(Ve.slice(3,5),16),Le=parseInt(Ve.slice(5,7),16);Z.beginPath(),Z.moveTo(R.x,R.y),Z.lineTo(re.x,re.y),Z.lineTo(se.x,se.y),Z.lineTo(he.x,he.y),Z.closePath(),Z.fillStyle=`rgba(${Ce},${je},${Le},${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(Te.x,Te.y),Z.moveTo(De.x,De.y),Z.lineTo(Xe.x,Xe.y),Z.moveTo(R.x,R.y),Z.lineTo(he.x,he.y),Z.moveTo(re.x,re.y),Z.lineTo(se.x,se.y),Z.stroke(),F.arrowLeft||F.arrowRight){const Ve=8*ne,Ce=(je,Le,Ee)=>{Z.save(),Z.translate(je,Le),Z.rotate(Ee),Z.beginPath(),Z.moveTo(0,0),Z.lineTo(-Ve,-Ve/2),Z.lineTo(-Ve,Ve/2),Z.closePath(),Z.fillStyle=F.lineColor,Z.fill(),Z.restore()};F.arrowLeft&&(Ce(ve.x,ve.y,Math.atan2(-le,-oe)),Ce(De.x,De.y,Math.atan2(-Be,-xe))),F.arrowRight&&(Ce(Te.x,Te.y,Math.atan2(le,oe)),Ce(Xe.x,Xe.y,Math.atan2(Be,xe)))}if(Z.fillStyle="#ffffff",Z.strokeStyle="#3b82f6",Z.lineWidth=2*ne,[R,re,se,he].forEach(Ve=>{Z.beginPath(),Z.arc(Ve.x,Ve.y,6*ne,0,Math.PI*2),Z.fill(),Z.stroke()}),F.showPrices){const Ve=[F.p1,F.p3,F.p2,F.p4],Ce=[R,re,he,se];Z.fillStyle=F.pricesColor||F.lineColor,Z.font=`${Math.round(10*ne)}px sans-serif`,Z.textAlign="left",Z.textBaseline="middle",Ce.forEach((je,Le)=>{const Ee=Ve[Le]?.price;typeof Ee=="number"&&Z.fillText(Ee.toFixed(5),je.x+8*z,je.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,m=o._series;if(!u||!m)return;const B=c.horizontalPixelRatio,v=c.verticalPixelRatio,b=c.context,C=G=>{const E=u.timeScale().timeToCoordinate(G.rawTime),z=m.priceToCoordinate(G.price);return E==null||z==null?null:{x:E*B,y:z*v}},U=C(o.p1),F=C(o.p2),L=C(o.b2),K=C(o.b1);!U||!F||!L||!K||(b.save(),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(F.x,F.y),b.lineTo(L.x,L.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(L.x,L.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 m=l._chart,B=l._series;if(!m||!B)return;const v=u.horizontalPixelRatio,b=u.verticalPixelRatio,C=u.context,U=X=>{const R=m.timeScale().timeToCoordinate(X.rawTime),re=B.priceToCoordinate(X.price);return R==null||re==null?null:{x:R*v,y:re*b}},F=U(l.mid1),L=U(l.mid2),K=U(l.top1),G=U(l.top2),E=U(l.bot1),z=U(l.bot2);if(!F||!L||!K||!G||!E||!z)return;C.save(),C.beginPath(),C.moveTo(F.x,F.y),C.lineTo(L.x,L.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(E.x,E.y),C.lineTo(z.x,z.y),C.lineTo(L.x,L.y),C.lineTo(F.x,F.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const ne=(X,R,re)=>{C.beginPath(),C.strokeStyle=re,C.lineWidth=l.lineWidth*b,C.setLineDash([]),C.moveTo(X.x,X.y),C.lineTo(R.x,R.y),C.stroke()};if(ne(K,G,l.upperStrokeColor),ne(F,L,l.centerStrokeColor),ne(E,z,l.lowerStrokeColor),l.showDeviationLabel){const X=Math.abs(l.top1.price-l.mid1.price),R=Number.isFinite(X)?X.toFixed(5):null;if(R){const re=Math.max(10,Math.round(10*b));C.fillStyle=l.labelColor,C.font=`${re}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(R,E.x+2*v,E.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,m=n.bitmapSize.width;n.bitmapSize.height;const B=A.p1.price,v=A.p2.price,b=B-v,C=X=>v+b*X,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),L=o.priceToCoordinate(B),K=o.priceToCoordinate(v),G=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,E=U!=null&&F!=null?Math.round(Math.max(U,F)*l):m,z=E-G;u.save(),A._zoneFills.forEach(({from:X,to:R,color:re})=>{const se=C(X),he=C(R),Z=o.priceToCoordinate(se),ee=o.priceToCoordinate(he);if(Z==null||ee==null)return;const ie=Math.round(Z*c),ae=Math.round(ee*c);u.fillStyle=re,u.fillRect(G,Math.min(ie,ae),z,Math.abs(ae-ie))}),A._levels.forEach(({ratio:X,label:R})=>{const re=C(X),se=o.priceToCoordinate(re);if(se==null)return;const he=Math.round(se*c),Z=A._levelColors[X]||"#888888";u.beginPath(),u.strokeStyle=Z,u.lineWidth=X===0||X===1?1.5*c:1*c,X!==0&&X!==1&&X<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(G,he),u.lineTo(E,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:X,label:R})=>{const re=C(X),se=o.priceToCoordinate(re);if(se==null)return;const he=Math.round(se*c),Z=A._levelColors[X]||"#888888",ee=`${R} (${re.toFixed(5)})`;u.fillStyle=Z,u.textAlign="right",u.fillText(ee,G-4*l,he-4*c)}),U!=null&&F!=null&&L!=null&&K!=null){const X=Math.round(U*l),R=Math.round(L*c),re=Math.round(F*l),se=Math.round(K*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo(X,R),u.lineTo(re,se),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(X,R,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(re,se,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 hT{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,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,m),B.stroke();const v=Math.round(m/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=re=>String(re).padStart(2,"0"),F=`${U(C.getUTCDate())}.${U(C.getUTCMonth()+1)}.${C.getUTCFullYear()} ${U(C.getUTCHours())}:${U(C.getUTCMinutes())}:${U(C.getUTCSeconds())}`,L=Math.round(11*o.verticalPixelRatio);B.font=`${L}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),E=Math.round(3*o.verticalPixelRatio),z=L+2*E,ne=K+2*G,X=u-ne/2,R=m-z-Math.round(4*o.verticalPixelRatio);B.fillStyle=n.color,B.fillRect(X,R,ne,z),B.fillStyle="#ffffff",B.fillText(F,u,R+z/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 uT(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 lp(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=uT(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,m=s.length*u+10,B=e-c/2,v=t-m;return{left:B,right:B+c,top:v,bottom:v+m+12}}class dT{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 m=s.horizontalPixelRatio,B=s.verticalPixelRatio,v=Math.round(c*m),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??""}`,L=220*m,K=[],G=le=>{if(!r.textWrap||le.length===0){K.push(le);return}const de=le.split(/\s+/);let we="";for(const be of de){const xe=we?`${we} ${be}`:be;C.measureText(xe).width<=L||!we?we=xe:(K.push(we),we=be)}K.push(we)};F.split(`
12
- `).forEach(G),K.length===0&&K.push("");const E=K.map(le=>C.measureText(le).width),z=Math.max(...E,20*m),ne=8*m,X=5*B,R=z+ne*2,re=U*1.2,se=re*K.length+X*2,he=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Z=v-R/2,ee=b-se;r.bgEnabled&&(C.fillStyle=ap(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(Z,ee,R,se),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,ee,R,se),C.stroke()),C.fillStyle=r.color,C.textAlign=he,C.textBaseline="middle";const ie=he==="left"?Z+ne:he==="right"?Z+R-ne:Z+R/2;for(let le=0;le<K.length;le++)C.fillText(K[le],ie,ee+X+re*(le+.5));const ae=5*B,oe=b+10*B;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*B,C.arc(v,oe,ae,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 pT={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 pT[e]??7}function fT(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 VA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:te(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,m=A+c*o;return Math.hypot(i-u,e-m)}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,m=A+c*o;return Math.hypot(i-u,e-m)}function mT(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 mi(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??te(i.rawTime),r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(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=te((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 ir(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map(X=>({time:te(X.time),close:typeof X.close=="number"?X.close:parseFloat(X.close)})).filter(X=>X.time!=null&&Number.isFinite(X.close)&&X.time>=s&&X.time<=o).sort((X,R)=>X.time-R.time);if(l.length<2)return null;const c=l.length;let u=0,m=0,B=0,v=0;for(let X=0;X<c;X++){const R=X,re=l[X].close;u+=R,m+=re,B+=R*re,v+=R*R}const b=c*v-u*u,C=Math.abs(b)<1e-12?0:(c*B-u*m)/b,U=(m-C*u)/c;let F=0;for(let X=0;X<c;X++){const R=U+C*X,re=l[X].close-R;F+=re*re}const L=Math.sqrt(F/c),K=Math.max(L*A,1e-8),G=l[0].time,E=l[c-1].time,z=U,ne=U+C*(c-1);return{slope:C,intercept:U,stdDev:L,offset:K,barCount:c,p1:{rawTime:G,normalizedTime:G,price:z},p2:{rawTime:E,normalizedTime:E,price:ne},top1:{rawTime:G,normalizedTime:G,price:z+K},top2:{rawTime:E,normalizedTime:E,price:ne+K},bot1:{rawTime:G,normalizedTime:G,price:z-K},bot2:{rawTime:E,normalizedTime:E,price:ne-K}}}function Xr(i,e,t,A=1){return ir(i,e,t,A)}const wT={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}},BT={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 yT(i,e){if(!i||!i.type)return!1;const t=wT[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function CT(i){return i?BT[i]??"#22c55e":"#22c55e"}const vT=300,up=24,TT=150,dp=150;function rl(i,e,t=vT){if(!Array.isArray(i)||i.length===0)return[];const A=dA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=te(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 bT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=te(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function xT(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=te(e),n=te(t),s=dA(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=xT(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),m=c(n);return Math.max(1,Math.abs(m-u)+1)}function pp(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=bT(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,B=Number.isFinite(m)&&m>20?m: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=dA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-TT*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 ks(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 gp(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 mp(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,m)=>{const B=r[r.length-n.length+m];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,m)=>u+m.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 QT=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),m=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),L=Y.useRef(null),K=Y.useRef([]),[G,E]=Y.useState(null),[z,ne]=Y.useState(null),[X,R]=Y.useState([]),[re,se]=Y.useState(null),[he,Z]=Y.useState([]),ee=Y.useRef(null),ie=Y.useRef(null),ae=Y.useRef(null),oe=Y.useRef(!1),le=Y.useRef(!1);Y.useEffect(()=>{ae.current=G;let p=!1;v.current.forEach(f=>{if(f.type==="trendline"&&f.decoration){const k=f===G;f.decoration.isSelected!==k&&(f.decoration.isSelected=k,p=!0)}}),p&&c.current?.applyOptions({})},[G]);const de=Y.useRef(new Map),we=Y.useRef(null),be=Y.useRef(null),xe=(p,f)=>`${p}_${f}`,Be=()=>{const p=xe(Le,Ee);return de.current.get(p)||null},ge=p=>{if(!p)return;const f=xe(Le,Ee);de.current.set(f,p)},{activeTool:ve,setActiveTool:Te,showGrid:De,snapToGrid:Xe,chartObjects:Ve,setChartObjects:Ce,orders:je,selectedSymbol:Le,selectedTimeframe:Ee,drawingsVisible:at,chartType:rt,chartLocked:Pt,theme:_e,candleColors:ke,showTradeOrders:Fe,showTradePosition:He,showTradeHistory:Ie,showSLTP:$e,showAskPrice:qe,showChartControls:wt,showCrosshair:Qt,showOHLC:RA,currentSymbolData:GA,baseUrl:Rt,endpoints:gA,endpointParams:$A,indicators:Yt,indicatorSettings:Ft}=Vt(),rA=Y.useRef({}),[nt,ft]=Y.useState({}),Ut=Y.useRef(0),Ht=Y.useRef(Yt),XA=Y.useRef(Ft);Ht.current=Yt,XA.current=Ft;const Je=Y.useRef([]),[Ke,At]=Y.useState(!1),[Qe,Re]=Y.useState(null),[Me,ze]=Y.useState([]),[Pe,st]=Y.useState(!0),[ot,Ct]=Y.useState(null),[qt,Ai]=Y.useState(0),Ks=Y.useMemo(()=>{const p=Me.map(f=>te(f?.time)).filter(f=>Number.isFinite(f));return p.sort((f,k)=>f-k),p},[Me]),Vs=Y.useRef(null),ii=Y.useRef(new Map);Y.useRef(null);const bp=Y.useRef(0),LA=Y.useRef(null),rr=Y.useRef(!1),jr=Y.useRef(!1);Y.useEffect(()=>{const p=m.current;p&&p.setData(rl(Me,Ee))},[Me,Ee]),Y.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,fe=(f.from+f.to)/2,H=k*.8;try{p.setVisibleRange({from:fe-H/2,to:fe+H/2}),ge(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,fe=(f.from+f.to)/2,H=k*1.25;try{p.setVisibleRange({from:fe-H/2,to:fe+H/2}),ge(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=_e==="light"?"#ffffff":"#12161d";let fe=null,H=0;if(f.forEach(J=>{if(J.width>0&&J.height>0){const j=J.width*J.height;j>H&&(H=j,fe=J)}}),fe)try{const J=document.createElement("canvas");J.width=fe.width,J.height=fe.height;const j=J.getContext("2d");j.fillStyle=k,j.fillRect(0,0,J.width,J.height),j.drawImage(fe,0,0);const q=document.createElement("a");q.download=`chart-${Le}-${Ee}-${Date.now()}.png`,q.href=J.toDataURL("image/png"),q.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(J){console.warn("Canvas export failed, trying html2canvas",J)}$v(p,{useCORS:!0,allowTaint:!0,backgroundColor:k,scale:2,logging:!1}).then(J=>{const j=document.createElement("a");j.download=`chart-${Le}-${Ee}-${Date.now()}.png`,j.href=J.toDataURL("image/png"),j.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(J=>{console.error("Chart screenshot failed",J),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Le,Ee,_e]);const al=Y.useMemo(()=>Me.length===0?[]:rt==="line"||rt==="area"?Me.map(p=>({time:p.time,value:p.close})):Me,[Me,rt]),JT=p=>{r?r(p):(Re("BUY"),At(!0))},ZT=p=>{n?n(p):(Re("SELL"),At(!0))},YT=()=>{At(!1),Re(null)},qT=p=>{const f=z;if(!f||!p)return;const k=(J,j)=>{if(typeof J!="string")return j;const q=J.trim(),ue=q.startsWith("#")?q:`#${q}`;return/^#[0-9A-Fa-f]{6}$/.test(ue)?ue.toLowerCase():j},fe=(J,j)=>{const q=Number(J);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 J=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=fe(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=fe(p.bgOpacity,j.bgOpacity??.1),j.price=J),H={...H,price:J,text:typeof p.text=="string"?p.text:f.text}}if(f.type==="trendline"){const J=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:J,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 W=f.point1.time??f.point1.rawTime,y=f.point2.time??f.point2.rawTime;try{const h=VA([{time:W,value:q},{time:y,value:ue}]);h.length>0&&f.series.setData(h)}catch{}}const M={...f.point1,price:q},N={...f.point2,price:ue};f.decoration&&(f.decoration.color=J,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=M,f.decoration.p2=N),H={...H,lineColor:J,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:M,point2:N,decoration:f.decoration}}if(f.type==="pricelevel"){const J=k(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,M=typeof p.textContent=="string"?p.textContent:"",N=k(p.textColor,"#ffffff"),W=["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:J,lineWidth:j,axisLabelVisible:q,title:q&&typeof h=="number"?h.toFixed(5):""})}catch{}const T=u.current;if(ue&&M&&T)if(f.textPrimitive)f.textPrimitive.text=M,f.textPrimitive.textColor=N,f.textPrimitive.hAlign=W,f.textPrimitive.vAlign=y,f.textPrimitive.price=h;else{const I=new tp(h,{text:M,textColor:N,hAlign:W,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:J,lineWidth:j,showPrice:q,showText:ue,textContent:M,textColor:N,textHAlign:W,textVAlign:y,textPrimitive:f.textPrimitive}}if(f.type==="horizontalray"){const J=k(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,M=typeof p.textContent=="string"?p.textContent:"",N=k(p.textColor,"#ffffff"),W=["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=J,T.lineWidth=j),f.priceLine)try{f.priceLine.applyOptions({price:h,color:J,axisLabelVisible:q,title:q&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(ue&&M&&I)if(f.textPrimitive)f.textPrimitive.text=M,f.textPrimitive.textColor=N,f.textPrimitive.hAlign=W,f.textPrimitive.vAlign=y,f.textPrimitive.price=h,f.textPrimitive.originTime=f.rawOriginTime;else{const w=new tp(h,{text:M,textColor:N,hAlign:W,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:J,lineWidth:j,showPrice:q,showText:ue,textContent:M,textColor:N,textHAlign:W,textVAlign:y,textPrimitive:f.textPrimitive}}if(f.type==="verticalline"){const J=k(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=J,ue.lineWidth=j,ue.showDate=q),H={...H,lineColor:J,lineWidth:j,showDate:q}}if(f.type==="infoline"){const J=k(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.statsShowAlways!==!1,ue=k(p.statsColor,"#5f8f96"),M=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,W=!!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,D=f.p2.rawTime,Q=w-I,S=I!==0?Q/Math.abs(I)*100:0,x=f.p1.normalizedTime??0,g=f.p2.normalizedTime??0,_=dA(Ee)||3600,P=Math.abs(g-x),O=Math.max(1,Math.round(P/_)),V=Math.max(1,Math.round(P/86400)),$=c.current,Ae=u.current,ce=$?$.timeScale().timeToCoordinate(d):null,me=Ae?Ae.priceToCoordinate(I):null,ye=$?$.timeScale().timeToCoordinate(D):null,Se=Ae?Ae.priceToCoordinate(w):null,Ze=ce!=null&&me!=null&&ye!=null&&Se!=null?Math.atan2(-(Se-me),ye-ce)*(180/Math.PI):f.primitive?.info?.angle??0,it={priceDiff:Q,pricePct:S,bars:O,days:V,angle:Ze},Ge=f.primitive;Ge&&(Ge.color=J,Ge.lineWidth=j,Ge.statsShowAlways=q,Ge.statsColor=ue,Ge.statsPosition=M,Ge.statsPriceRange=N,Ge.statsBarsRange=W,Ge.statsDateRange=y,Ge.statsAngle=h,Ge.statsDistance=T,Ge.p1={...f.p1,price:I},Ge.p2={...f.p2,price:w},Ge.info=it),H={...H,lineColor:J,lineWidth:j,statsShowAlways:q,statsColor:ue,statsPosition:M,statsPriceRange:N,statsBarsRange:W,statsDateRange:y,statsAngle:h,statsDistance:T,p1:{...f.p1,price:I},p2:{...f.p2,price:w}}}if(f.type==="rulerline"){const J=k(p.lineColor,"#3b82f6"),j=p.showArea!==!1,q=!!p.statsShowAlways,ue=k(p.statsColor,"#5f8f96"),M=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,W=!!p.statsBarsRange,y=!!p.statsDateRange,h=f.primitive;h&&(h.lineColor=J,h.showArea=j,h.statsShowAlways=q,h.statsColor=ue,h.statsPosition=M,h.statsPriceRange=N,h.statsBarsRange=W,h.statsDateRange=y),H={...H,lineColor:J,showArea:j,statsShowAlways:q,statsColor:ue,statsPosition:M,statsPriceRange:N,statsBarsRange:W,statsDateRange:y}}if(f.type==="arrowedline"){const J=k(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,M=f.primitive;M&&(M.color=J,M.lineWidth=j,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=k(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsBarsRange=!!p.statsBarsRange,M.statsDateRange=!!p.statsDateRange,M.statsAngle=!!p.statsAngle,M.statsDistance=!!p.statsDistance,M.p1={...f.p1,price:q},M.p2={...f.p2,price:ue}),H={...H,lineColor:J,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:q},p2:{...f.p2,price:ue}}}if(f.type==="rayline"){const J=k(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,M=f.primitive;M&&(M.color=J,M.lineWidth=j,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=k(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsBarsRange=!!p.statsBarsRange,M.statsDateRange=!!p.statsDateRange,M.statsAngle=!!p.statsAngle,M.statsDistance=!!p.statsDistance,M.p1={...f.p1,price:q},M.p2={...f.p2,price:ue}),H={...H,lineColor:J,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:q},p2:{...f.p2,price:ue}}}if(f.type==="extendedline"){const J=k(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,M=f.primitive;M&&(M.color=J,M.lineWidth=j,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=k(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsBarsRange=!!p.statsBarsRange,M.statsDateRange=!!p.statsDateRange,M.statsAngle=!!p.statsAngle,M.statsDistance=!!p.statsDistance,M.p1={...f.p1,price:q},M.p2={...f.p2,price:ue}),H={...H,lineColor:J,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:q},p2:{...f.p2,price:ue}}}if(f.type==="crossline"){const J=k(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=J,ue.lineWidth=j,ue.showTime=!!p.showTime,ue.showPrice=!!p.showPrice,ue.center={...f.p,price:q}),H={...H,lineColor:J,lineWidth:j,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...f.p,price:q}}}if(f.type==="trendbyangle"){const J=k(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,M=f.primitive;M&&(M.color=J,M.lineWidth=j,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=k(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsDistance=!!p.statsDistance,M.p1={...f.p1,price:q},M.p2={...f.p2,price:ue}),H={...H,lineColor:J,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:q},p2:{...f.p2,price:ue}}}if(f.type==="disjointchannel"){const J=k(p.lineColor,"#129f5c"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=k(p.fillColor,"#6aa84f"),ue=fe(p.fillOpacity,.1),M=k(p.pricesColor,"#129f5c"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,W=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=J,h.lineWidth=j,h.fillColor=q,h.fillOpacity=ue,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=M,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:W},h.p2={...f.p2,price:y}),H={...H,lineColor:J,lineWidth:j,fillColor:q,fillOpacity:ue,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:M,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:N},p3:{...f.p3,price:W},p2:{...f.p2,price:y}}}if(f.type==="flattopbottom"){const J=k(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=k(p.fillColor,"#3b82f6"),ue=fe(p.fillOpacity,.12),M=k(p.pricesColor,"#3b82f6"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,W=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=J,h.lineWidth=j,h.fillColor=q,h.fillOpacity=ue,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=M,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:W},h.p2={...f.p2,price:y}),H={...H,lineColor:J,lineWidth:j,fillColor:q,fillOpacity:ue,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:M,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:N},p3:{...f.p3,price:W},p2:{...f.p2,price:y}}}Ce(J=>{const j=J.map(q=>q===f?H:q);return v.current=j,j}),ae.current===f&&(ae.current=H),E(J=>J===f?H:J),se(J=>J===f?H:J),ne(H);try{c.current?.applyOptions({})}catch{}};Y.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"},fe=_e==="light",H=pg(p,{width:f.width||p.clientWidth,height:f.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:k},layout:{background:{color:fe?"#FFFFFF":"#0d1117",type:"solid"},textColor:fe?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:De,color:De?fe?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0},horzLines:{visible:De,color:De?fe?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0}},rightPriceScale:{borderColor:fe?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:fe?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:fe?"#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:fe?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:fe?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:fe?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:fe?"#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}}),J=(typeof Le=="string"?Le:Le?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),j=J.includes("JPY"),q=tn(J),ue=en(J);let M,N;j?(M=.001,N=w=>Math.abs(Number(w)).toFixed(3)):q?J.startsWith("BTC")||J.startsWith("ETH")?(M=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(M=1e-4,N=w=>Math.abs(Number(w)).toFixed(4)):ue&&(J.startsWith("XAU")||J.startsWith("XAG"))?(M=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(M=1e-4,N=w=>Math.abs(Number(w)).toFixed(5));const W=H.addCandlestickSeries({upColor:fe?"#089981":"#26a69a",downColor:fe?"#f23645":"#ef5350",wickUpColor:fe?"#089981":"#26a69a",wickDownColor:fe?"#f23645":"#ef5350",borderUpColor:fe?"#089981":"#26a69a",borderDownColor:fe?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:M,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=W,m.current=y,y.setData(rl(Me,Ee)),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(le.current&&ii.current.size>0){const w=h.getVisibleRange();w&&ge(w)}};h.subscribeVisibleTimeRangeChange(T);const I=new ResizeObserver(w=>{for(const d of w){const{width:D,height:Q}=d.contentRect;if(D>0&&Q>0&&H){const S=h.getVisibleRange();H.resize(D,Q),S&&setTimeout(()=>{try{h.setVisibleRange(S)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(T),I.disconnect(),H.remove(),c.current=null,u.current=null,m.current=null,B.current=null,v.current=[],LA.current&&clearTimeout(LA.current)}},[]),Y.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:De,color:De?"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0},horzLines:{visible:De,color:De?"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0}}})},[De]),Y.useEffect(()=>{const p=c.current;if(!p)return;const f=_e==="light";p.applyOptions({layout:{background:{color:f?"#FFFFFF":"#12161d"},textColor:f?"#020617":"#fff"},grid:{vertLines:{color:De?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:De?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}}})},[_e,De]),Y.useEffect(()=>{const p=u.current;!p||!ke||p.applyOptions({upColor:ke.upColor,downColor:ke.downColor,wickUpColor:ke.upColor,wickDownColor:ke.downColor,borderUpColor:ke.upColor,borderDownColor:ke.downColor})},[ke]),Y.useEffect(()=>{if(!c.current)return;const f=!Pt&&!(ve!==null&&ve!==1&&ve!==0),k=!Pt;c.current.applyOptions({crosshair:{mode:ve===1?1:0,vertLine:{visible:ve===1||Qt,width:1,color:_e==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:_e==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:ve===1||Qt,width:1,color:_e==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:_e==="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,Pt,Qt,_e]);const jT=()=>{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=[],Ce([]),Te(null)},xp=(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 fe=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,axisLabelVisible:fe,title:fe&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}if(f&&k.type==="horizontalray"&&k.priceLine)try{const fe=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:fe,title:fe&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}})};Y.useEffect(()=>{(async()=>{if(!Le||!Ee){ze([]),le.current=!1;return}try{if(LA.current&&(clearTimeout(LA.current),LA.current=null),rr.current=!0,st(!0),Ct(null),ze([]),le.current=!1,jr.current=!1,be.current!==null&&be.current!==Le&&jT(),be.current=Le,u.current)try{u.current.setData([])}catch{}const f=cp(Ee),k=fT(Ee,f),fe=Rt||Zv?.VITE_BASE_URL||"http://localhost:5002",H=gA?.candles||"/api/chart/candles",J=$A?.candles||{},j={symbol:J.symbol||"symbol",timeframe:J.timeframe||"timeframe",limit:J.limit||"limit",daysBack:J.daysBack||"daysBack"},q={};q[j.symbol]=Le,q[j.timeframe]=Ee,q[j.limit]=k,J.daysBack!==!1&&(q[j.daysBack]=f);const ue=localStorage.getItem("token")??localStorage.getItem("authToken"),M=await gt.get(`${fe}${H}`,{params:q,timeout:1e4,headers:ue?{Authorization:`Bearer ${ue}`}:{}});let N=[];if(Array.isArray(M.data)?N=M.data:M.data&&M.data.data&&Array.isArray(M.data.data)?N=M.data.data:M.data&&Array.isArray(M.data)&&(N=M.data),N&&N.length>0){const{candles:W,stats:y}=fl(N,Le,Ee);W.length>0?(ze(W),ii.current=new Map,W.forEach(h=>{ii.current.set(h.time,h)}),jr.current=!0,rr.current=!1,Vs.current?.connected&&Le&&Ee&&Vs.current.emit("subscribeCandles",{symbol:Le,timeframe:Ee})):(console.warn(`⚠️ No valid candles after processing for ${Le}`),rr.current=!1,ze([]))}else console.warn(`⚠️ No candle data returned for ${Le}`),rr.current=!1,ze([])}catch(f){console.error(`❌ Error fetching ${Le}:`,f.message);const k=f.code==="ECONNABORTED"||f.message&&f.message.includes("timeout");Ct(k?"Request timed out. No data available for this symbol.":f.message||"Failed to load candles."),rr.current=!1,ze([]),st(!1)}})()},[Le,Ee,qt]),Y.useEffect(()=>{Vs.current=On.getSocket();const p=Vs.current,f=()=>{if(jr.current&&Le&&Ee&&p.connected){const q={symbol:Le,timeframe:Ee};p.emit("subscribeCandles",q)}},k=()=>{setTimeout(()=>{Le&&Ee&&f()},200)},fe=q=>{},H=q=>{};p.on("connect",k),p.on("disconnect",fe),p.on("connect_error",H),p.on("subscription:confirmed",q=>{q.type});const J=q=>{if(!jr.current||!q||!q.candle||!q.symbol)return;const ue=D=>String(D||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(ue(q.symbol)!==ue(Le)||q.timeframe&&q.timeframe!==Ee)return;const{candle:M}=q,N=gl(M,Le,Ee);if(!N)return;const W=Date.now();if(W-bp.current<200)return;bp.current=W;const y=c.current?.timeScale(),h=y?.getVisibleRange(),T=u.current,I=c.current;if(!(!T||!I||!le.current&&!jr.current||T?.seriesType?.()!==(rt==="line"?"Line":rt==="area"?"Area":rt==="bars"?"Bar":"Candlestick")))try{const D=ii.current.get(N.time),Q=!D,S=D?{time:N.time,open:D.open,high:Math.max(D.high,N.high),low:Math.min(D.low,N.low),close:N.close}:N;ii.current.set(N.time,S),Q&&m.current&&m.current.setData(rl(Array.from(ii.current.values()),Ee));try{rt==="line"||rt==="area"?T.update({time:S.time,value:S.close}):T.update(S),y&&h&&ge(h)}catch(P){throw P}const x=Ht.current||{},g=XA.current||{},_=rA.current;if(Object.keys(_).length>0){const P=Array.from(ii.current.values()).sort((O,V)=>O.time-V.time);if(x.sma20&&_.sma20){const O=ks(P,g.smaPeriod||20);if(O)try{_.sma20.update(O)}catch{}}if(x.sma50&&_.sma50){const O=ks(P,50);if(O)try{_.sma50.update(O)}catch{}}if(x.ema12&&_.ema12){const O=fp(P,g.emaPeriod||12);if(O)try{_.ema12.update(O)}catch{}}if(x.rsi&&_.rsi){const O=gp(P,g.rsiPeriod||14);if(O){try{_.rsi.update(O)}catch{}if(_.rsi70)try{_.rsi70.update({time:O.time,value:70})}catch{}if(_.rsi30)try{_.rsi30.update({time:O.time,value:30})}catch{}}}if(x.macd&&_.macdLine){const O=mp(P,12,26,9);if(O){try{_.macdLine.update({time:O.time,value:O.value})}catch{}try{_.macdSignal.update({time:O.time,value:O.signal})}catch{}try{_.macdHist.update({time:O.time,value:O.histogram,color:O.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(x.bollinger&&_.bbMiddle){const O=Rs(P,g.bbPeriod||20,g.bbStdDev||2);if(O){try{_.bbUpper.update({time:O.time,value:O.upper})}catch{}try{_.bbMiddle.update({time:O.time,value:O.middle})}catch{}try{_.bbLower.update({time:O.time,value:O.lower})}catch{}}}}}catch{}};p.on("candleUpdate",J);const j=()=>{p.connected&&Le&&Ee&&f()};if(p.connected)j();else{const q=()=>{setTimeout(j,200)};p.once("connect",q),setTimeout(()=>{p.connected&&j()},500)}return()=>{p.off("candleUpdate",J),p.off("connect",k),p.off("disconnect",fe),p.off("connect_error",H),p.off("subscription:confirmed"),Le&&Ee&&p.connected&&p.emit("unsubscribeCandles",{symbol:Le,timeframe:Ee})}},[Le,Ee,Rt]),Y.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(),LA.current&&clearTimeout(LA.current),LA.current=setTimeout(()=>requestAnimationFrame(()=>st(!1)),400);return}if(!le.current){const k=(typeof Le=="string"?Le:Le?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),fe=k.includes("JPY"),H=en(k),J=tn(k);let j,q;fe?(j=.001,q=h=>Math.abs(Number(h)).toFixed(3)):J?k.startsWith("BTC")||k.startsWith("ETH")?(j=.01,q=h=>Math.abs(Number(h)).toFixed(2)):(j=1e-4,q=h=>Math.abs(Number(h)).toFixed(4)):H&&(k.startsWith("XAU")||k.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(),M=xe(Le,Ee);we.current,we.current=M;const N=[...Me].sort((h,T)=>h.time-T.time);if(rt==="line"||rt==="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);ke&&p.applyOptions({upColor:ke.upColor,downColor:ke.downColor,wickUpColor:ke.upColor,wickDownColor:ke.downColor,borderUpColor:ke.upColor,borderDownColor:ke.downColor}),xp(p);const W=dA(Ee)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,S=We(Q,W);h.primitive.originTime=S,h.originTime=S;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,S=We(Q,W);h.primitive.time=S,h.time=te(S);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,S=h.rawP2Time??h.p2.rawTime,x=N.length>0?N[0].time:null,g=N.length>0?N[N.length-1].time:null,_=V=>{const $=We(V,W);return x==null||g==null?$:Math.min(Math.max($,x),g)},P=_(Q),O=_(S);h.p1.rawTime=P,h.p1.normalizedTime=te(P),h.p2.rawTime=O,h.p2.normalizedTime=te(O),h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:O,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,S=h.rawP2Time??h.p2.rawTime,x=N.length>0?N[0].time:null,g=N.length>0?N[N.length-1].time:null,_=ce=>{const me=We(ce,W);return x==null||g==null?me:Math.min(Math.max(me,x),g)},P=_(Q),O=_(S);h.p1.rawTime=P,h.p2.rawTime=O,h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:O,price:h.p2.price};const V=te(P),$=te(O),Ae=Math.abs(($??0)-(V??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,O,Ee),days:Math.max(1,Math.round(Ae/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,S=h.p2.rawTime,x=We(Q,W),g=We(S,W);h.p1.rawTime=x,h.p1.normalizedTime=te(x),h.p2.rawTime=g,h.p2.normalizedTime=te(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,S=h.p2.rawTime,x=We(Q,W),g=We(S,W);h.p1.rawTime=x,h.p1.normalizedTime=te(x),h.p2.rawTime=g,h.p2.normalizedTime=te(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,S=h.p2.rawTime,x=We(Q,W),g=We(S,W);h.p1.rawTime=x,h.p1.normalizedTime=te(x),h.p2.rawTime=g,h.p2.normalizedTime=te(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,S=h.p2.rawTime,x=We(Q,W),g=We(S,W);h.p1.rawTime=x,h.p1.normalizedTime=te(x),h.p2.rawTime=g,h.p2.normalizedTime=te(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=S=>{const x=We(S.rawTime,W);S.rawTime=x,S.normalizedTime=te(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=S=>{const x=We(S.rawTime,W);S.rawTime=x,S.normalizedTime=te(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 S=h.primitive;S.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},S.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},S.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},S.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},S.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},S.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 S=h.primitive;S.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},S.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},S.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},S.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},S.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},S.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=We(h.p1.rawTime,W),S=We(h.p2.rawTime,W),x=We(h.p3.rawTime,W);h.p1.rawTime=Q,h.p1.normalizedTime=te(Q),h.p2.rawTime=S,h.p2.normalizedTime=te(S),h.p3.rawTime=x,h.p3.normalizedTime=te(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:S,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=We(h.p1.rawTime,W),S=We(h.p2.rawTime,W);h.p1.rawTime=Q,h.p1.normalizedTime=te(Q),h.p2.rawTime=S,h.p2.normalizedTime=te(S),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:S,price:h.p2.price};return}if((h.type==="circle"||h.type==="ellipse")&&h.primitive&&h.p1&&h.p2){const Q=We(h.p1.rawTime,W),S=We(h.p2.rawTime,W);h.p1.rawTime=Q,h.p1.normalizedTime=te(Q),h.p2.rawTime=S,h.p2.normalizedTime=te(S),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:S,price:h.p2.price};return}if(h.type==="triangle"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=We(h.p1.rawTime,W),S=We(h.p2.rawTime,W),x=We(h.p3.rawTime,W);h.p1.rawTime=Q,h.p1.normalizedTime=te(Q),h.p2.rawTime=S,h.p2.normalizedTime=te(S),h.p3.rawTime=x,h.p3.normalizedTime=te(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:S,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=We(h.p1.rawTime,W),S=We(h.p2.rawTime,W);h.p1.rawTime=Q,h.p1.normalizedTime=te(Q),h.p2.rawTime=S,h.p2.normalizedTime=te(S),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:S,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=We(T,W),d=We(I,W);h.point1.time=w,h.point2.time=d;const D=VA([{time:w,value:h.point1.price},{time:d,value:h.point2.price}]);try{D.length>0&&h.series.setData(D)}catch{}}),N?.length>0){const h=N[N?.length-1].time,T=dA(Ee)||60,w=h-(Ee==="M1"?150:Ee==="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{}le.current=!0;const y=ue.getVisibleRange();ge(y),LA.current&&clearTimeout(LA.current),LA.current=setTimeout(()=>requestAnimationFrame(()=>st(!1)),400)}}},[Me.length,rt,Le,Ee]),Y.useEffect(()=>{const p=c.current;if(!p||!le.current||Me.length===0)return;const f=p.timeScale(),k=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 fe;const H=(typeof Le=="string"?Le:Le?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),J=H.includes("JPY"),j=en(H),q=tn(H);let ue,M;J?(ue=.001,M=y=>Math.abs(Number(y)).toFixed(3)):q?H.startsWith("BTC")||H.startsWith("ETH")?(ue=.01,M=y=>Math.abs(Number(y)).toFixed(2)):(ue=1e-4,M=y=>Math.abs(Number(y)).toFixed(4)):j&&(H.startsWith("XAU")||H.startsWith("XAG"))?(ue=.01,M=y=>Math.abs(Number(y)).toFixed(2)):(ue=1e-4,M=y=>Math.abs(Number(y)).toFixed(5));const N={type:"custom",minMove:ue,formatter:M};if(rt==="bars"){const y=_e==="light";fe=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=[...Me].sort((T,I)=>T.time-I.time);h?.length>0&&fe.setData(h)}else if(rt==="line"){fe=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const y=VA(al);y.length>0&&fe.setData(y)}else if(rt==="area"){fe=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=VA(al);y.length>0&&fe.setData(y)}else if(rt==="volume ticks"||rt==="volume"){const y=_e==="light";fe=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=[...Me].sort((w,d)=>w.time-d.time);h?.length>0&&fe.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=_e==="light";fe=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=[...Me].sort((T,I)=>T.time-I.time);h?.length>0&&fe.setData(h)}if(u.current=fe,ke&&fe)try{fe.applyOptions({upColor:ke.upColor,downColor:ke.downColor,wickUpColor:ke.upColor,wickDownColor:ke.downColor,borderUpColor:ke.upColor,borderDownColor:ke.downColor})}catch{}xp(fe,!0);const W=dA(Ee)||60;if(v.current.forEach(y=>{if(y.type==="horizontalray"&&y.primitive){const S=y.rawOriginTime??y.primitive.originTime,x=We(S,W);y.primitive.originTime=x,y.originTime=x;return}if(y.type==="verticalline"&&y.primitive){const S=y.rawTime??y.primitive.time,x=We(S,W);y.primitive.time=x,y.time=te(x);return}if(y.type==="infoline"&&y.primitive&&y.p1&&y.p2){const S=y.rawP1Time??y.p1.rawTime,x=y.rawP2Time??y.p2.rawTime,g=[...Me].sort((Ae,ce)=>Ae.time-ce.time),_=g.length>0?g[0].time:null,P=g.length>0?g[g.length-1].time:null,O=Ae=>{const ce=We(Ae,W);return _==null||P==null?ce:Math.min(Math.max(ce,_),P)},V=O(S),$=O(x);y.p1.rawTime=V,y.p1.normalizedTime=te(V),y.p2.rawTime=$,y.p2.normalizedTime=te($),y.primitive.p1={rawTime:V,price:y.p1.price},y.primitive.p2={rawTime:$,price:y.p2.price};return}if(y.type==="rulerline"&&y.primitive&&y.p1&&y.p2){const S=y.rawP1Time??y.p1.rawTime,x=y.rawP2Time??y.p2.rawTime,g=[...Me].sort((ye,Se)=>ye.time-Se.time),_=g.length>0?g[0].time:null,P=g.length>0?g[g.length-1].time:null,O=ye=>{const Se=We(ye,W);return _==null||P==null?Se:Math.min(Math.max(Se,_),P)},V=O(S),$=O(x);y.p1.rawTime=V,y.p2.rawTime=$,y.primitive.p1={rawTime:V,price:y.p1.price},y.primitive.p2={rawTime:$,price:y.p2.price};const Ae=te(V),ce=te($),me=Math.abs((ce??0)-(Ae??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,V,$,Ee),days:Math.max(1,Math.round(me/86400))};return}if(y.type==="arrowedline"&&y.primitive&&y.p1&&y.p2){const S=y.p1.rawTime,x=y.p2.rawTime,g=We(S,W),_=We(x,W);y.p1.rawTime=g,y.p1.normalizedTime=te(g),y.p2.rawTime=_,y.p2.normalizedTime=te(_),y.primitive.p1={rawTime:g,price:y.p1.price},y.primitive.p2={rawTime:_,price:y.p2.price};return}if(y.type==="rayline"&&y.primitive&&y.p1&&y.p2){const S=y.p1.rawTime,x=y.p2.rawTime,g=We(S,W),_=We(x,W);y.p1.rawTime=g,y.p1.normalizedTime=te(g),y.p2.rawTime=_,y.p2.normalizedTime=te(_),y.primitive.p1={rawTime:g,price:y.p1.price},y.primitive.p2={rawTime:_,price:y.p2.price};return}if(y.type==="extendedline"&&y.primitive&&y.p1&&y.p2){const S=y.p1.rawTime,x=y.p2.rawTime,g=We(S,W),_=We(x,W);y.p1.rawTime=g,y.p1.normalizedTime=te(g),y.p2.rawTime=_,y.p2.normalizedTime=te(_),y.primitive.p1={rawTime:g,price:y.p1.price},y.primitive.p2={rawTime:_,price:y.p2.price};return}if(y.type==="trendbyangle"&&y.primitive&&y.p1&&y.p2){const S=y.p1.rawTime,x=y.p2.rawTime,g=We(S,W),_=We(x,W);y.p1.rawTime=g,y.p1.normalizedTime=te(g),y.p2.rawTime=_,y.p2.normalizedTime=te(_),y.primitive.p1={rawTime:g,price:y.p1.price},y.primitive.p2={rawTime:_,price:y.p2.price};return}if(y.type==="disjointchannel"&&y.primitive&&y.p1&&y.p2&&y.p3&&y.p4){const S=x=>{const g=We(x.rawTime,W);x.rawTime=g,x.normalizedTime=te(g)};S(y.p1),S(y.p2),S(y.p3),S(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 S=x=>{const g=We(x.rawTime,W);x.rawTime=g,x.normalizedTime=te(g)};S(y.p1),S(y.p2),S(y.p3),S(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 S=[...Me].sort((_,P)=>_.time-P.time),x=ir(S,y.p1,y.p2,y.stdMultiplier??1);if(!x)return;const g=y.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},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 S=[...Me].sort((_,P)=>_.time-P.time),x=Xr(S,y.p1,y.p2,y.stdMultiplier??1);if(!x)return;const g=y.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},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 S=We(y.p1.rawTime,W),x=We(y.p2.rawTime,W),g=We(y.p3.rawTime,W);y.p1.rawTime=S,y.p1.normalizedTime=te(S),y.p2.rawTime=x,y.p2.normalizedTime=te(x),y.p3.rawTime=g,y.p3.normalizedTime=te(g),y.primitive.p1={rawTime:S,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price},y.primitive.p3={rawTime:g,price:y.p3.price};return}if((y.type==="gannfan"||y.type==="ganngrid")&&y.primitive&&y.p1&&y.p2){const S=We(y.p1.rawTime,W),x=We(y.p2.rawTime,W);y.p1.rawTime=S,y.p1.normalizedTime=te(S),y.p2.rawTime=x,y.p2.normalizedTime=te(x),y.primitive.p1={rawTime:S,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 S=We(y.p1.rawTime,W),x=We(y.p2.rawTime,W);y.p1.rawTime=S,y.p1.normalizedTime=te(S),y.p2.rawTime=x,y.p2.normalizedTime=te(x),y.primitive.p1={rawTime:S,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 S=We(y.p1.rawTime,W),x=We(y.p2.rawTime,W),g=We(y.p3.rawTime,W);y.p1.rawTime=S,y.p1.normalizedTime=te(S),y.p2.rawTime=x,y.p2.normalizedTime=te(x),y.p3.rawTime=g,y.p3.normalizedTime=te(g),y.primitive.p1={rawTime:S,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price},y.primitive.p3={rawTime:g,price:y.p3.price};return}if((y.type==="fibonacci"||y.type==="rectangle")&&y.primitive&&y.p1&&y.p2){const S=We(y.p1.rawTime,W),x=We(y.p2.rawTime,W);y.p1.rawTime=S,y.p1.normalizedTime=te(S),y.p2.rawTime=x,y.p2.normalizedTime=te(x),y.primitive.p1={rawTime:S,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=We(I,W),D=We(w,W);y.point1.time=d,y.point2.time=D;const Q=VA([{time:d,value:y.point1.price},{time:D,value:y.point2.price}]);try{Q.length>0&&T.setData(Q)}catch{}if(y.decoration)try{T.attachPrimitive(y.decoration)}catch{}y.series=T}),k&&le.current)setTimeout(()=>{try{f.setVisibleRange(k),ge(k)}catch{if(Me.length>0)try{const h=Me[Me.length-1].time,T=dA(Ee)||60,I=h-100*T;f.setVisibleRange({from:I,to:h+T*up}),ge(f.getVisibleRange())}catch{f.fitContent(),ge(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,ge(f.getVisibleRange())}},[rt,Me.length,al.length,Le,ke]),Y.useEffect(()=>{const p=c.current,f=B.current;if(!p||!f||!le.current||Me.length===0||rt!=="volume"&&rt!=="volume ticks")return;const fe=[...Me].sort((H,J)=>H.time-J.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)"}));fe.length>0&&f.setData(fe)},[Me,rt]),Y.useEffect(()=>{if(!Le||!Ee||!Yt)return;const f=Object.entries(Yt).filter(([q,ue])=>ue).map(([q])=>q).filter(q=>q.startsWith("sma")||q.startsWith("ema")||q==="rsi"||q==="macd");if(f.length===0){ft({});return}const k=f.map(q=>q==="sma20"?`sma:${Ft?.smaPeriod||20}`:q==="sma50"?"sma:50":q==="ema12"?`ema:${Ft?.emaPeriod||12}`:q==="rsi"?`rsi:${Ft?.rsiPeriod||14}`:q==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!k)return;const fe=++Ut.current,H=Rt||"http://localhost:5002",J=gA?.indicators||"/api/market-data/indicators",j=localStorage.getItem("token")??localStorage.getItem("authToken");gt.get(`${H}${J}`,{params:{symbol:Le,timeframe:Ee,indicators:k},headers:j?{Authorization:`Bearer ${j}`}:{}}).then(q=>{fe===Ut.current&&ft(q.data?.data||{})}).catch(q=>{console.error("[ChartArea] Indicator fetch error:",q?.message),fe===Ut.current&&ft({})})},[Le,Ee,Yt,Ft,Rt,gA]),Y.useEffect(()=>{const p=c.current;if(!p||!le.current)return;const f=rA.current,k=(N,W)=>(f[N]||(f[N]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...W})),f[N]),fe=N=>{if(f[N]){try{p.removeSeries(f[N])}catch{}delete f[N]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(fe)},J=Yt||{};if(J.sma20&&nt.sma20?.data?.length?k("sma20",{color:"#2196F3",lineWidth:1.5}).setData(nt.sma20.data.map(W=>({time:W.time,value:W.value}))):fe("sma20"),J.sma50&&nt.sma50?.data?.length?k("sma50",{color:"#FF9800",lineWidth:1.5}).setData(nt.sma50.data.map(W=>({time:W.time,value:W.value}))):fe("sma50"),J.ema12&&nt.ema12?.data?.length?k("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(nt.ema12.data.map(W=>({time:W.time,value:W.value}))):fe("ema12"),J.rsi&&nt.rsi?.data?.length){const N=k("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 W=nt.rsi.data,y=W[0]?.time,h=W[W.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 fe("rsi"),fe("rsi70"),fe("rsi30");if(J.macd&&nt.macd?.data?.length){const N=k("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:T=>T.toFixed(4)}}),W=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:T=>T.toFixed(4)}}));const y=J.rsi?.65:.8;p.priceScale("macd").applyOptions({scaleMargins:{top:y,bottom:0},borderVisible:!1,autoScale:!0}),J.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}))),W.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(fe)};if(J.bollinger){const N=Array.from(ii.current.values()).sort((T,I)=>T.time-I.time),W=XA.current?.bbPeriod||20,y=XA.current?.bbStdDev||2,h=ml(N,W,y);if(h){const T=k("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),I=k("bbMiddle",{color:"rgba(33,150,243,0.8)",lineWidth:1.5}),w=k("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,W)=>N.time-W.time);if(q.length>0){const N=XA.current||{};if(J.sma20&&f.sma20){const W=ks(q,N.smaPeriod||20);if(W)try{f.sma20.update(W)}catch{}}if(J.sma50&&f.sma50){const W=ks(q,50);if(W)try{f.sma50.update(W)}catch{}}if(J.ema12&&f.ema12){const W=fp(q,N.emaPeriod||12);if(W)try{f.ema12.update(W)}catch{}}if(J.rsi&&f.rsi){const W=gp(q,N.rsiPeriod||14);if(W){try{f.rsi.update(W)}catch{}if(f.rsi70)try{f.rsi70.update({time:W.time,value:70})}catch{}if(f.rsi30)try{f.rsi30.update({time:W.time,value:30})}catch{}}}if(J.macd&&f.macdLine){const W=mp(q,12,26,9);if(W){try{f.macdLine.update({time:W.time,value:W.value})}catch{}try{f.macdSignal.update({time:W.time,value:W.signal})}catch{}try{f.macdHist.update({time:W.time,value:W.histogram,color:W.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(J.bollinger&&f.bbMiddle){const W=Rs(q,N.bbPeriod||20,N.bbStdDev||2);if(W){try{f.bbUpper.update({time:W.time,value:W.upper})}catch{}try{f.bbMiddle.update({time:W.time,value:W.middle})}catch{}try{f.bbLower.update({time:W.time,value:W.lower})}catch{}}}}const ue=J.rsi&&nt.rsi?.data?.length||J.macd&&nt.macd?.data?.length,M=J.rsi&&nt.rsi?.data?.length&&J.macd&&nt.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:M?.4:ue?.25:.05}})}catch{}},[nt,Yt,Me.length]),Y.useEffect(()=>()=>{const p=c.current;if(!p)return;const f=rA.current;Object.keys(f).forEach(k=>{try{p.removeSeries(f[k])}catch{}}),rA.current={}},[Le,Ee]),Y.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,J=(M,N)=>{const W=Math.min(M.time,N.time),y=Math.max(M.time,N.time),h=M.time<=N.time?M.rawTime:N.rawTime,T=M.time<=N.time?N.rawTime:M.rawTime,I=Math.max(M.price,N.price),w=Math.min(M.price,N.price),d=te(Math.round((W+y)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:W,price:w},p3:{rawTime:T,normalizedTime:y,price:w}}};if(!H){if(b.current=!1,C.current=null,U.current=null,L.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 M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.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};Ce(D=>[...D,d]),v.current.push(d),Te(null)};return k.addEventListener("click",M),()=>{k.removeEventListener("click",M)}}if(H==="horizontalray"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=new Yv(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):""}),D=te(T),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:D,rawOriginTime:T,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};Ce(S=>[...S,Q]),v.current.push(Q),Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="verticalline"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=p.timeScale().coordinateToTime(y);if(h==null)return;const T=new hT(h);f.attachPrimitive(T);const I=te(h),w={type:"verticalline",primitive:T,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};Ce(d=>[...d,w]),v.current.push(w),Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="text"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=new dT(T,I);f.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:T,price:I,text:"Text"};Ce(D=>[...D,d]),v.current.push(d),Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="infoline"){let M=null,N=null;const W=h=>{if(!M)return;const T=k.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),D=f.coordinateToPrice(w);if(d==null||D==null)return;N||(N=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=M.normalizedTime,S=te(d);if(Q==null||S==null||Q===S)return;const x=Q<=S?[{time:Q,value:M.price},{time:S,value:D}]:[{time:S,value:D},{time:Q,value:M.price}];try{N.setData(x)}catch{}},y=h=>{const T=k.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),D=f.coordinateToPrice(w);if(d==null||D==null)return;if(!M){M={rawTime:d,price:D,normalizedTime:te(d),x:I,y:w};return}if(N){try{p.removeSeries(N)}catch{}N=null}const Q=M.normalizedTime,S=te(d);if(Q==null||S==null)return;const x=D-M.price,g=x/Math.abs(M.price)*100,_=dA(Ee)||3600,P=Math.abs(S-Q),O=Math.max(1,Math.round(P/_)),V=Math.max(1,Math.round(P/86400)),$=M.x,Ae=M.y,ce=I,ye=Math.atan2(-(w-Ae),ce-$)*(180/Math.PI),Se={priceDiff:x,pricePct:g,bars:O,days:V,angle:ye},Ze=new qv({rawTime:M.rawTime,price:M.price},{rawTime:d,price:D},Se);f.attachPrimitive(Ze);const it={type:"infoline",primitive:Ze,rawP1Time:M.rawTime,rawP2Time:d,p1:{rawTime:M.rawTime,normalizedTime:Q,price:M.price},p2:{rawTime:d,normalizedTime:S,price:D},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};Ce(Ge=>[...Ge,it]),v.current.push(it),M=null,Te(null)};return k.addEventListener("mousemove",W),k.addEventListener("click",y),()=>{if(k.removeEventListener("mousemove",W),k.removeEventListener("click",y),N)try{p.removeSeries(N)}catch{}}}if(H==="rulerline"){let M=null,N=null;const W=(T,I,w,d)=>{const D=te(T),Q=te(w),S=d-I,x=S/Math.abs(I)*100,g=Ns(Ks,T,w,Ee),_=Math.abs((Q??0)-(D??0)),P=Math.max(1,Math.round(_/86400));return{priceDiff:S,pricePct:x,bars:g,days:P}},y=T=>{if(!M)return;const I=k.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,D=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(D==null||Q==null)return;const S=te(D);if(S==null||S===M.normalizedTime)return;const x=W(M.rawTime,M.price,D,Q);if(!N)N=new Ap({rawTime:M.rawTime,price:M.price},{rawTime:D,price:Q},x),f.attachPrimitive(N);else{N.p2={rawTime:D,price:Q},N.info=x;const g=Q>=M.price;N.color=g?"#3b82f6":"#ef5350",N.fillColor=g?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=T=>{const I=k.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,D=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(D==null||Q==null)return;if(!M){M={rawTime:D,price:Q,normalizedTime:te(D)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const S=M.normalizedTime,x=te(D);if(S==null||x==null)return;const g=W(M.rawTime,M.price,D,Q),_=new Ap({rawTime:M.rawTime,price:M.price},{rawTime:D,price:Q},g);f.attachPrimitive(_);const P={type:"rulerline",primitive:_,rawP1Time:M.rawTime,rawP2Time:D,p1:{rawTime:M.rawTime,normalizedTime:S,price:M.price},p2:{rawTime:D,normalizedTime:x,price:Q},lineColor:Q>=M.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};Ce(O=>[...O,P]),v.current.push(P),M=null,Te(null)};return k.addEventListener("mousemove",y),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",y),k.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="arrowedline"){let M=null,N=null;const W=h=>{if(!M)return;const T=k.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),D=f.coordinateToPrice(w);if(d==null||D==null)return;const Q=te(d);if(!(Q==null||Q===M.normalizedTime))if(!N)N=new ip({rawTime:M.rawTime,price:M.price},{rawTime:d,price:D}),f.attachPrimitive(N);else{N.p2={rawTime:d,price:D};try{c.current?.applyOptions({})}catch{}}},y=h=>{const T=k.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),D=f.coordinateToPrice(w);if(d==null||D==null)return;if(!M){M={rawTime:d,price:D,normalizedTime:te(d)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const Q=M.normalizedTime,S=te(d);if(Q==null||S==null||Q===S)return;const x=new ip({rawTime:M.rawTime,price:M.price},{rawTime:d,price:D});f.attachPrimitive(x);const g={type:"arrowedline",primitive:x,p1:{rawTime:M.rawTime,normalizedTime:Q,price:M.price},p2:{rawTime:d,normalizedTime:S,price:D},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};Ce(_=>[..._,g]),v.current.push(g),M=null,Te(null)};return k.addEventListener("mousemove",W),k.addEventListener("click",y),()=>{if(k.removeEventListener("mousemove",W),k.removeEventListener("click",y),N)try{f.detachPrimitive(N)}catch{}}}if(H==="rayline"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.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 D=te(T),Q=te(d);if(D==null||Q==null)return;const S=new iT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(S);const x={type:"rayline",primitive:S,p1:{rawTime:T,normalizedTime:D,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};Ce(g=>[...g,x]),v.current.push(x),Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="extendedline"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.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 D=te(T),Q=te(d);if(D==null||Q==null)return;const S=new rT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(S);const x={type:"extendedline",primitive:S,p1:{rawTime:T,normalizedTime:D,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};Ce(g=>[...g,x]),v.current.push(x),Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="crossline"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=te(T);if(w==null)return;const d=new sT({rawTime:T,price:I});f.attachPrimitive(d);const D={type:"crossline",primitive:d,p:{rawTime:T,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};Ce(Q=>[...Q,D]),v.current.push(D),Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="trendbyangle"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.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 D=te(T),Q=te(d);if(D==null||Q==null)return;const S=new oT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(S);const x={type:"trendbyangle",primitive:S,p1:{rawTime:T,normalizedTime:D,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};Ce(g=>[...g,x]),v.current.push(x),Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="disjointchannel"){let M=null,N=null,W=null,y=null,h=0,T=null;const I=(D,Q,S,x)=>{if(!T)T=new Al(D,Q,S,x),f.attachPrimitive(T);else{T.p1=D,T.p2=Q,T.p3=S,T.p4=x;try{c.current?.applyOptions({})}catch{}}},w=D=>{if(h===0||!M)return;const Q=k.getBoundingClientRect(),S=D.clientX-Q.left,x=D.clientY-Q.top;if(h===1){const g=f.coordinateToPrice(x);if(g==null)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:g},I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const g=p.timeScale().coordinateToTime(S),_=f.coordinateToPrice(x);if(g==null||_==null)return;const P=te(g);if(P==null)return;const O=(M.price+N.price)/2;_>=O?(W={rawTime:g,normalizedTime:P,price:_},y={rawTime:g,normalizedTime:P,price:2*O-_}):(y={rawTime:g,normalizedTime:P,price:_},W={rawTime:g,normalizedTime:P,price:2*O-_}),I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:W.rawTime,price:W.price},{rawTime:y.rawTime,price:y.price})}},d=D=>{const Q=k.getBoundingClientRect(),S=D.clientX-Q.left,x=D.clientY-Q.top,g=p.timeScale().coordinateToTime(S),_=f.coordinateToPrice(x);if(g==null||_==null)return;const P=te(g);if(P!=null){if(h===0){M={rawTime:g,normalizedTime:P,price:_},N={rawTime:g,normalizedTime:P,price:_},h=1,I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const O=f.coordinateToPrice(x);if(O==null||Math.abs(O-M.price)<1e-7)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:O},h=2;return}if(h===2&&T){try{f.detachPrimitive(T)}catch{}const O=new Al(T.p1,T.p2,T.p3,T.p4);f.attachPrimitive(O);const V={type:"disjointchannel",primitive:O,p1:M,p2:N,p3:{rawTime:T.p3.rawTime,normalizedTime:te(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:te(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};Ce($=>[...$,V]),v.current.push(V),Te(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),T)try{f.detachPrimitive(T)}catch{}}}if(H==="flattopbottom"){let M=null,N=null,W=null,y=null,h=0,T=null;const I=(D,Q,S,x)=>{if(!T)T=new rp(D,Q,S,x),f.attachPrimitive(T);else{T.p1=D,T.p2=Q,T.p3=S,T.p4=x;try{c.current?.applyOptions({})}catch{}}},w=D=>{if(h===0||!M)return;const Q=k.getBoundingClientRect(),S=D.clientX-Q.left,x=D.clientY-Q.top;if(h===1){const g=f.coordinateToPrice(x);if(g==null)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:g},I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const g=p.timeScale().coordinateToTime(S),_=f.coordinateToPrice(x);if(g==null||_==null)return;const P=te(g);if(P==null)return;W={rawTime:g,normalizedTime:P,price:_},y={rawTime:g,normalizedTime:P,price:N.price},I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:W.rawTime,price:W.price},{rawTime:y.rawTime,price:y.price})}},d=D=>{const Q=k.getBoundingClientRect(),S=D.clientX-Q.left,x=D.clientY-Q.top,g=p.timeScale().coordinateToTime(S),_=f.coordinateToPrice(x);if(g==null||_==null)return;const P=te(g);if(P!=null){if(h===0){M={rawTime:g,normalizedTime:P,price:_},N={rawTime:g,normalizedTime:P,price:_},h=1,I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const O=f.coordinateToPrice(x);if(O==null||Math.abs(O-M.price)<1e-7)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:O},h=2;return}if(h===2&&T){try{f.detachPrimitive(T)}catch{}const O=new rp(T.p1,T.p2,T.p3,T.p4);f.attachPrimitive(O);const V={type:"flattopbottom",primitive:O,p1:M,p2:N,p3:{rawTime:T.p3.rawTime,normalizedTime:te(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:te(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};Ce($=>[...$,V]),v.current.push(V),Te(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),T)try{f.detachPrimitive(T)}catch{}}}if(H==="regressionchannel"){let M=null,N=null;const W=(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(!M)return;const I=k.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,D=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(D==null||Q==null)return;const S=te(D);if(S==null)return;const g=ir(Me,M,{rawTime:D,normalizedTime:S},1);if(g)if(!N)N=new il({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(N);else{W(N,g);try{p.applyOptions({})}catch{}}},h=T=>{const I=k.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,D=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(D==null||Q==null)return;const S=te(D);if(S==null)return;if(!M){M={rawTime:D,normalizedTime:S,price:Q};return}const g=ir(Me,M,{rawTime:D,normalizedTime:S},1);if(!g)return;if(N){try{f.detachPrimitive(N)}catch{}N=null}const _=new il({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(_);const P={type:"regressionchannel",primitive:_,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};Ce(O=>[...O,P]),v.current.push(P),M=null,Te(null)};return k.addEventListener("mousemove",y),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",y),k.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="stddevchannel"){let M=null,N=null;const W=(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(!M)return;const I=k.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,D=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(D==null||Q==null)return;const S=te(D);if(S==null)return;const g=Xr(Me,M,{rawTime:D,normalizedTime:S},1);if(g)if(!N)N=new sp({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(N);else{W(N,g);try{p.applyOptions({})}catch{}}},h=T=>{const I=k.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,D=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(D==null||Q==null)return;const S=te(D);if(S==null)return;if(!M){M={rawTime:D,normalizedTime:S,price:Q};return}const g=Xr(Me,M,{rawTime:D,normalizedTime:S},1);if(!g)return;if(N){try{f.detachPrimitive(N)}catch{}N=null}const _=new sp({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(_);const P={type:"stddevchannel",primitive:_,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};Ce(O=>[...O,P]),v.current.push(P),M=null,Te(null)};return k.addEventListener("mousemove",y),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",y),k.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="andrewspitchfork"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=te(T);if(w==null)return;const d=y+140,D=p.timeScale().coordinateToTime(d);if(D==null)return;const Q=te(D);if(Q==null)return;const S={rawTime:T,normalizedTime:w,price:I},x={rawTime:D,normalizedTime:Q,price:I},g={rawTime:T,normalizedTime:w,price:I},_=new aT({rawTime:S.rawTime,price:S.price},{rawTime:x.rawTime,price:x.price},{rawTime:g.rawTime,price:g.price});f.attachPrimitive(_);const P={type:"andrewspitchfork",primitive:_,p1:S,p2:x,p3:g};Ce(O=>[...O,P]),v.current.push(P),E(P),ae.current=P,Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="gannfan"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=te(T);if(w==null)return;const d={rawTime:T,normalizedTime:w,price:I},D={rawTime:T,normalizedTime:w,price:I},Q=new lT({rawTime:d.rawTime,price:d.price},{rawTime:D.rawTime,price:D.price});f.attachPrimitive(Q);const S={type:"gannfan",primitive:Q,p1:d,p2:D};Ce(x=>[...x,S]),v.current.push(S),E(S),ae.current=S,Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="ganngrid"){const M=N=>{const W=k.getBoundingClientRect(),y=N.clientX-W.left,h=N.clientY-W.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=te(T);if(w==null)return;const d={rawTime:T,normalizedTime:w,price:I},D={rawTime:T,normalizedTime:w,price:I},Q=new cT({rawTime:d.rawTime,price:d.price},{rawTime:D.rawTime,price:D.price});f.attachPrimitive(Q);const S={type:"ganngrid",primitive:Q,p1:d,p2:D};Ce(x=>[...x,S]),v.current.push(S),E(S),ae.current=S,Te(null)};return k.addEventListener("click",M),()=>k.removeEventListener("click",M)}if(H==="trendline"||H==="gannline"){const M=H,N=M==="gannline"?"#7aa6ae":"#22c55e",W=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,D=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const S=f.coordinateToPrice(D);if(!(Q==null||S==null)&&(Q=te(Q),Q!=null))if(L.current===null){L.current={time:Q,price:S};const x=p.addLineSeries({color:N,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:M,series:x},x.setData([{time:Q,value:S}])}else{const x=L.current,g={time:Q,price:S},_=1,P=1e-5,O=Math.abs(g.time-x.time),V=Math.abs(g.price-x.price);if(O<_&&V<P){try{p.removeSeries(F.current.series)}catch{}L.current=null,F.current=null;return}const $={time:x.time,rawTime:x.time,price:x.price},Ae={time:g.time,rawTime:g.time,price:g.price},ce=VA([{time:$.time,value:$.price},{time:Ae.time,value:Ae.price}]);if(ce.length>0){F.current.series.setData(ce);const me=new nT($,Ae,N,2);try{F.current.series.attachPrimitive(me)}catch{}const ye={type:M,series:F.current.series,point1:$,point2:Ae,decoration:me};Ce(Se=>[...Se,ye]),v.current.push(ye)}Te(null),L.current=null,F.current=null}},y=I=>{if(L.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,D=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const S=f.coordinateToPrice(D);if(Q==null||S==null||(Q=te(Q),Q==null))return;const x=L.current,g=VA([{time:x.time,value:x.price},{time:Q,value:S}]);g.length>0&&F.current.series.setData(g)},h=I=>{I.stopPropagation()},T={capture:!0,passive:!1};return k.addEventListener("click",W,T),k.addEventListener("mousemove",y,T),k.addEventListener("mousemove",h,T),()=>{if(L.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",W,T),k.removeEventListener("mousemove",y,T),k.removeEventListener("mousemove",h,T)}}if(H==="parallellines"){let M=null,N=null,W=null,y=0,h=null;const T=(S,x,g,_)=>{S.p1={rawTime:x.rawTime,price:x.price},S.p2={rawTime:g.rawTime,price:g.price},S.b1={rawTime:_.b1.rawTime,price:_.b1.price},S.b2={rawTime:_.b2.rawTime,price:_.b2.price},S.p3={rawTime:_.bottomMid.rawTime,price:_.bottomMid.price}},I=(S,x,g)=>{const _=hp(S,x,g);if(!_)return null;if(!h)h=new np({rawTime:S.rawTime,price:S.price},{rawTime:x.rawTime,price:x.price},{rawTime:_.b1.rawTime,price:_.b1.price},{rawTime:_.b2.rawTime,price:_.b2.price},{rawTime:_.bottomMid.rawTime,price:_.bottomMid.price}),f.attachPrimitive(h);else{T(h,S,x,_);try{p.applyOptions({})}catch{}}return _},w=S=>{S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();const x=k.getBoundingClientRect(),g=S.clientX-x.left,_=S.clientY-x.top,P=p.timeScale().coordinateToTime(g),O=f.coordinateToPrice(_);if(P==null||O==null)return;const V=te(P);if(V!=null){if(y===0){M={rawTime:P,normalizedTime:V,price:O},y=1;return}if(y===1){if(N={rawTime:P,normalizedTime:V,price:O},Math.abs(N.normalizedTime-M.normalizedTime)<1)return;const $=te((M.normalizedTime+N.normalizedTime)/2);if($==null)return;const Ae=(M.price+N.price)/2;W={rawTime:$,normalizedTime:$,price:Ae},I(M,N,W),y=2;return}if(y===2&&M&&N){W={rawTime:P,normalizedTime:V,price:O};const $=I(M,N,W);if(!$||!h)return;try{f.detachPrimitive(h)}catch{}const Ae=new np({rawTime:M.rawTime,price:M.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(Ae);const ce={type:"equidistantchannel",primitive:Ae,p1:M,p2:N,p3:$.bottomMid,b1:$.b1,b2:$.b2,bottomMid:$.bottomMid};Ce(me=>[...me,ce]),v.current.push(ce),Te(null),y=0,M=null,N=null,W=null,h=null}}},d=S=>{if(y===0||!M)return;const x=k.getBoundingClientRect(),g=S.clientX-x.left,_=S.clientY-x.top,P=p.timeScale().coordinateToTime(g),O=f.coordinateToPrice(_);if(P==null||O==null)return;const V=te(P);if(V!=null){if(y===1){const $={rawTime:P,normalizedTime:V,price:O},Ae=te((M.normalizedTime+$.normalizedTime)/2);if(Ae==null)return;const ce=(M.price+$.price)/2;I(M,$,{rawTime:Ae,normalizedTime:Ae,price:ce});return}y===2&&N&&I(M,N,{rawTime:P,normalizedTime:V,price:O})}},D=S=>{S.stopPropagation()},Q={capture:!0,passive:!1};return k.addEventListener("click",w,Q),k.addEventListener("mousemove",d,Q),k.addEventListener("mousemove",D,Q),()=>{if(y=0,M=null,N=null,W=null,K.current=[],h)try{f.detachPrimitive(h)}catch{}h=null,k.removeEventListener("click",w,Q),k.removeEventListener("mousemove",d,Q),k.removeEventListener("mousemove",D,Q)}}if(H==="fibonacci"){let M=null,N=null;const W=h=>{if(!M)return;const T=k.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),D=f.coordinateToPrice(w);if(!(d==null||D==null))if(!N)N=new op({rawTime:M.rawTime,price:M.price},{rawTime:d,price:D}),f.attachPrimitive(N);else{N.p2={rawTime:d,price:D};try{p.applyOptions({})}catch{}}},y=h=>{const T=k.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),D=f.coordinateToPrice(w);if(d==null||D==null)return;if(!M){M={rawTime:d,price:D,normalizedTime:te(d)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const Q=M.normalizedTime,S=te(d);if(Q==null||S==null)return;if(Math.abs(D-M.price)<1e-5){M=null;return}const x=new op({rawTime:M.rawTime,price:M.price},{rawTime:d,price:D});f.attachPrimitive(x);const g={type:"fibonacci",primitive:x,p1:{rawTime:M.rawTime,normalizedTime:Q,price:M.price},p2:{rawTime:d,normalizedTime:S,price:D}};Ce(_=>[..._,g]),v.current.push(g),M=null,Te(null)};return k.addEventListener("mousemove",W),k.addEventListener("click",y),()=>{if(k.removeEventListener("mousemove",W),k.removeEventListener("click",y),N)try{f.detachPrimitive(N)}catch{}}}if(L.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=M=>{if(M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const N=k.getBoundingClientRect(),W=M.clientX-N.left,y=M.clientY-N.top;let h=p.timeScale().coordinateToTime(W);const T=f.coordinateToPrice(y);if(h==null||T==null)return;const I=h;if(h=te(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 jv({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 eT({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 tT({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 AT({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=M=>{if(!b.current||!C.current||!F.current)return;M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation();const N=k.getBoundingClientRect(),W=M.clientX-N.left,y=M.clientY-N.top;let h=p.timeScale().coordinateToTime(W);const T=f.coordinateToPrice(y);if(h==null||T==null)return;const I=h;if(h=te(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,D=J(w,{time:h,rawTime:I,price:T});if(!D)return;d.p1={rawTime:D.p1.rawTime,price:D.p1.price},d.p2={rawTime:D.p2.rawTime,price:D.p2.price},d.p3={rawTime:D.p3.rawTime,price:D.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=d.endPrice-d.startPrice,Q=T,S=Q+D;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:S}]);else{const x=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});x.setData([{time:w.time,value:Q},{time:h,value:S}]),F.current.secondLine=x}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:T}])},ue=M=>{if(M&&(M.preventDefault(),M.stopPropagation()),!b.current||!F.current||!C.current)return;const N=C.current,W=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};Ce(h=>[...h,y]),v.current.push(y),Te(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:W.time,endPrice:W.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=te(Math.min(y.time,h.time)),d=te(Math.max(y.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(T-I)>=1e-5){const D=F.current.primitive,Q=y.time<=h.time?y.rawTime:h.rawTime,S=y.time<=h.time?h.rawTime:y.rawTime,x={rawTime:Q,normalizedTime:w,price:T},g={rawTime:S,normalizedTime:d,price:I};D.p1={rawTime:x.rawTime,price:x.price},D.p2={rawTime:g.rawTime,price:g.price};const _={type:"rectangle",primitive:D,p1:x,p2:g};Ce(P=>[...P,_]),v.current.push(_),Te(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:W.rawTime,normalizedTime:W.time,price:W.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(T.rawTime),D=f.priceToCoordinate(T.price);if((I!=null&&w!=null&&d!=null&&D!=null?Math.hypot(d-I,D-w):0)>=3){y.p1={rawTime:h.rawTime,price:h.price},y.p2={rawTime:T.rawTime,price:T.price};const S={type:"circle",primitive:y,p1:h,p2:T};Ce(x=>[...x,S]),v.current.push(S),Te(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const y=F.current.primitive,h=J(N,W);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};Ce(d=>[...d,w]),v.current.push(w),Te(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:W.rawTime,normalizedTime:W.time,price:W.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(T.rawTime),D=f.priceToCoordinate(T.price);if((I!=null&&w!=null&&d!=null&&D!=null?Math.hypot(d-I,D-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 S={type:"ellipse",primitive:y,p1:h,p2:T,minorRatio:.45};Ce(x=>[...x,S]),v.current.push(S),Te(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 M={capture:!0,passive:!1},N=W=>{b.current||W.stopPropagation()};return k.addEventListener("mousedown",j,M),k.addEventListener("mousemove",q,M),k.addEventListener("mousemove",N,M),k.addEventListener("mouseup",ue,M),()=>{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,k.removeEventListener("mousedown",j,M),k.removeEventListener("mousemove",q,M),k.removeEventListener("mousemove",N,M),k.removeEventListener("mouseup",ue,M)}}},[ve,Me,Ce,Te]),Y.useEffect(()=>{const p=c.current,f=u.current,k=o.current,fe=ve===null||ve===1;if(!fe||!p||!f||!k){fe||(E(null),R([]),se(null),Z([]));return}const H=10,J=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 D=Math.min(T,w),Q=Math.max(T,w),S=Math.min(I,d),x=Math.max(I,d),g=(D+Q)/2,_=(S+x)/2;return[{x:D,y:S},{x:g,y:S},{x:Q,y:S},{x:D,y:_},{x:Q,y:_},{x:D,y:x},{x:g,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),D=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return T==null||I==null||w==null||d==null||D==null||Q==null?[]:[{x:T,y:I},{x:w,y:d},{x:D,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 D=(T+w)/2,Q=(I+d)/2,S=w-T,x=d-I,g=Math.hypot(S,x);if(g<.001)return[];const _=S/g,P=x/g,O=-P,V=_,$=g/2,Ae=$*Math.max(.05,h.minorRatio??.45);return[{x:D-_*$,y:Q-P*$},{x:D+O*Ae,y:Q+V*Ae},{x:D+_*$,y:Q+P*$},{x:D-O*Ae,y:Q-V*Ae}]}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),D=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return T==null||I==null||w==null||d==null||D==null||Q==null?[]:[{x:T,y:I},{x:w,y:d},{x:D,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),D=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=f.priceToCoordinate(h.b1.price),S=p.timeScale().timeToCoordinate(h.b2.rawTime),x=f.priceToCoordinate(h.b2.price);return T==null||I==null||w==null||d==null||D==null||Q==null||S==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:(D+S)/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),D=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),S=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return T==null||I==null||w==null||d==null||D==null||Q==null||S==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:D,y:Q},{x:S,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),D=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),S=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return T==null||I==null||w==null||d==null||D==null||Q==null||S==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:D,y:Q},{x:S,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),D=p.timeScale().timeToCoordinate(I),Q=f.priceToCoordinate(h.p2.price);return w==null||d==null||D==null||Q==null?[]:[{x:w,y:d},{x:D,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=Ve.length-1;I>=0;I--){const w=Ve[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),D=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),S=f.priceToCoordinate(w.point2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-d,T-D),g=Math.hypot(h-Q,T-S);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ut(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),D=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),S=f.priceToCoordinate(w.point2.price);if(d==null||D==null||Q==null||S==null)continue;const x=(d+Q)/2,g=(D+S)/2,_=Math.hypot(h-d,T-D),P=Math.hypot(h-Q,T-S),O=Math.hypot(h-x,T-g);if(_<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(O<H)return{object:w,mode:"line"};if(ut(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.min(d,Q),g=Math.max(d,Q),_=Math.min(D,S),P=Math.max(D,S),O=(x+g)/2,V=(_+P)/2,$=[{x,y:_,mode:"handle1"},{x:O,y:_,mode:"handle2"},{x:g,y:_,mode:"handle3"},{x,y:V,mode:"handle4"},{x:g,y:V,mode:"handle5"},{x,y:P,mode:"handle6"},{x:O,y:P,mode:"handle7"},{x:g,y:P,mode:"handle8"}];for(const Se of $)if(Math.hypot(h-Se.x,T-Se.y)<H)return{object:w,mode:Se.mode};const Ae=ut(h,T,x,_,g,_),ce=ut(h,T,x,P,g,P),me=ut(h,T,x,_,x,P),ye=ut(h,T,g,_,g,P);if(Ae<J||ce<J||me<J||ye<J||mi(h,T,[{x,y:_},{x:g,y:_},{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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(Q-d,S-D);if(x<2)continue;const g=Math.hypot(h-d,T-D),_=Math.hypot(h-Q,T-S);if(g<H)return{object:w,mode:"handle1"};if(_<H)return{object:w,mode:"handle2"};if(Math.abs(g-x)<J||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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price);if(d==null||D==null||Q==null||S==null||x==null||g==null)continue;const _=Math.hypot(h-d,T-D),P=Math.hypot(h-Q,T-S),O=Math.hypot(h-x,T-g);if(_<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(O<H)return{object:w,mode:"handle3"};const V=ut(h,T,d,D,Q,S),$=ut(h,T,Q,S,x,g),Ae=ut(h,T,x,g,d,D);if(V<J||$<J||Ae<J||mi(h,T,[{x:d,y:D},{x:Q,y:S},{x,y:g}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=(d+Q)/2,g=(D+S)/2,_=Q-d,P=S-D,O=Math.hypot(_,P);if(O<2)continue;const V=_/O,$=P/O,Ae=-$,ce=V,me=O/2,ye=me*Math.max(.05,w.minorRatio??.45);if(me<2||ye<2)continue;const Se=x-V*me,Ze=g-$*me,it=x+Ae*ye,Ge=g+ce*ye,Bt=x+V*me,dt=g+$*me,yt=x-Ae*ye,It=g-ce*ye,jt=Math.hypot(h-Se,T-Ze),nA=Math.hypot(h-it,T-Ge),uA=Math.hypot(h-Bt,T-dt),JA=Math.hypot(h-yt,T-It);if(jt<H)return{object:w,mode:"handle1"};if(nA<H)return{object:w,mode:"handle2"};if(uA<H)return{object:w,mode:"handle3"};if(JA<H)return{object:w,mode:"handle4"};const _i=(h-x)*V+(T-g)*$,zs=(h-x)*Ae+(T-g)*ce,Up=_i/me,Sp=zs/ye,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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-Q,T-S),g=Math.hypot(h-d,T-D);if(x<H)return{object:w,mode:"handle2"};if(g<H)return{object:w,mode:"handle1"};if(ut(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-Q,T-S),g=Math.hypot(h-d,T-D);if(x<H)return{object:w,mode:"handle2"};if(g<H)return{object:w,mode:"handle1"};if(ut(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-d,T-D),g=Math.hypot(h-Q,T-S);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ut(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-d,T-D),g=Math.hypot(h-Q,T-S);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(gT(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-d,T-D),g=Math.hypot(h-Q,T-S);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(mT(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),D=f.priceToCoordinate(w.p.price);if(d==null||D==null)continue;if(Math.hypot(h-d,T-D)<H)return{object:w,mode:"handle1"};const S=Math.abs(T-D),x=Math.abs(h-d);if(S<J||x<J)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),D=f.priceToCoordinate(w.price);if(d==null||D==null)continue;const Q=lp(w,d,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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-d,T-D),g=Math.hypot(h-Q,T-S);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ut(h,T,d,D,Q,S)<J)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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),g=f.priceToCoordinate(w.b1.price),_=p.timeScale().timeToCoordinate(w.b2.rawTime),P=f.priceToCoordinate(w.b2.price),O=x!=null&&_!=null?(x+_)/2:null,V=g!=null&&P!=null?(g+P)/2:null;if(d==null||D==null||Q==null||S==null||O==null||V==null||x==null||g==null||_==null||P==null)continue;const $=Math.hypot(h-d,T-D),Ae=Math.hypot(h-Q,T-S),ce=Math.hypot(h-O,T-V),me=Math.hypot(d-O,D-V)<H*1.5;if(me&&Math.min($,ce)<H*1.5)return{object:w,mode:"handle3"};if(ce<H)return{object:w,mode:"handle3"};if(Ae<H)return{object:w,mode:"handle2"};if(me)continue;if($<H)return{object:w,mode:"handle1"};const ye=ut(h,T,d,D,Q,S),Se=ut(h,T,x,g,_,P);if(ye<J||Se<J||mi(h,T,[{x:d,y:D},{x:Q,y:S},{x:_,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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),g=f.priceToCoordinate(w.top1.price),_=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),O=p.timeScale().timeToCoordinate(w.bot1.rawTime),V=f.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=f.priceToCoordinate(w.bot2.price);if(d==null||D==null||Q==null||S==null||x==null||g==null||_==null||P==null||O==null||V==null||$==null||Ae==null)continue;const ce=Math.hypot(h-d,T-D),me=Math.hypot(h-Q,T-S);if(ce<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const ye=ut(h,T,d,D,Q,S),Se=ut(h,T,x,g,_,P),Ze=ut(h,T,O,V,$,Ae);if(ye<J||Se<J||Ze<J||mi(h,T,[{x,y:g},{x:_,y:P},{x:$,y:Ae},{x:O,y:V}]))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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),g=f.priceToCoordinate(w.top1.price),_=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),O=p.timeScale().timeToCoordinate(w.bot1.rawTime),V=f.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=f.priceToCoordinate(w.bot2.price);if(d==null||D==null||Q==null||S==null||x==null||g==null||_==null||P==null||O==null||V==null||$==null||Ae==null)continue;const ce=Math.hypot(h-d,T-D),me=Math.hypot(h-Q,T-S);if(ce<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const ye=ut(h,T,d,D,Q,S),Se=ut(h,T,x,g,_,P),Ze=ut(h,T,O,V,$,Ae);if(ye<J||Se<J||Ze<J||mi(h,T,[{x,y:g},{x:_,y:P},{x:$,y:Ae},{x:O,y:V}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price);if(d==null||D==null||Q==null||S==null||x==null||g==null)continue;const _=Math.hypot(h-d,T-D),P=Math.hypot(h-Q,T-S),O=Math.hypot(h-x,T-g);if(_<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(O<H)return{object:w,mode:"handle3"};const V=(Q+x)/2,$=(S+g)/2;let Ae=V-d,ce=$-D;Math.abs(Ae)<1e-4&&(Ae=1e-4);const me=ce/Ae,ye=k.clientWidth,Se=S+me*(ye-Q),Ze=g+me*(ye-x),it=ut(h,T,Q,S,ye,Se),Ge=ut(h,T,x,g,ye,Ze);if(it<J||Ge<J||mi(h,T,[{x:Q,y:S},{x:ye,y:Se},{x:ye,y:Ze},{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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price),_=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||D==null||Q==null||S==null||x==null||g==null||_==null||P==null)continue;const O=Math.hypot(h-d,T-D),V=Math.hypot(h-Q,T-S),$=Math.hypot(h-x,T-g),Ae=Math.hypot(h-_,T-P);if(O<H)return{object:w,mode:"handle1"};if(V<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(Ae<H)return{object:w,mode:"handle4"};const ce=ut(h,T,d,D,x,g),me=ut(h,T,Q,S,_,P),ye=ut(h,T,d,D,Q,S),Se=ut(h,T,x,g,_,P);if(ce<J||me<J||ye<J||Se<J||mi(h,T,[{x:d,y:D},{x,y:g},{x:_,y:P},{x:Q,y:S}]))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),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price),_=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||D==null||Q==null||S==null||x==null||g==null||_==null||P==null)continue;const O=Math.hypot(h-d,T-D),V=Math.hypot(h-Q,T-S),$=Math.hypot(h-x,T-g),Ae=Math.hypot(h-_,T-P);if(O<H)return{object:w,mode:"handle1"};if(V<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(Ae<H)return{object:w,mode:"handle4"};const ce=ut(h,T,d,D,x,g),me=ut(h,T,Q,S,_,P),ye=ut(h,T,d,D,Q,S),Se=ut(h,T,x,g,_,P);if(ce<J||me<J||ye<J||Se<J||mi(h,T,[{x:d,y:D},{x,y:g},{x:_,y:P},{x:Q,y:S}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=(d+Q)/2,g=(D+S)/2,_=Math.hypot(h-d,T-D),P=Math.hypot(h-Q,T-S),O=Math.hypot(h-x,T-g);if(_<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(O<H)return{object:w,mode:"line"};if(ut(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const d=w.p1.rawTime??w.p1.time,D=w.p2.rawTime??w.p2.time,Q=p.timeScale().timeToCoordinate(d),S=f.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(D),g=f.priceToCoordinate(w.p2.price);if(Q==null||S==null||x==null||g==null)continue;const _=Math.hypot(h-Q,T-S),P=Math.hypot(h-x,T-g);if(_<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ut(h,T,Q,S,x,g)<J)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),S=f.priceToCoordinate(w.p2.price);if(d==null||D==null||Q==null||S==null)continue;const x=Math.hypot(h-d,T-D),g=Math.hypot(h-Q,T-S);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ut(h,T,d,D,Q,S)<J)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,D=p.timeScale().timeToCoordinate(d.originTime),Q=f.priceToCoordinate(d.price);if(Q==null)continue;if(D!=null&&Math.hypot(h-D,T-Q)<H)return{object:w,mode:"handle1"};const S=D==null?0:Math.max(0,D);if(h>=S&&Math.abs(T-Q)<J)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,D=p.timeScale().timeToCoordinate(d.time);if(D==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-D,T-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-D)<J)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)<J)return{object:w,mode:"line"}}}return null}const ue=h=>{const T=k.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){oe.current=!0,ne(d.object),ee.current=null,ie.current=null;return}E(d.object),se(null),Z([]),ee.current=d.mode,d.object.type==="rayline"&&(d.mode==="handle1"||d.mode==="handle2")&&(ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="extendedline"&&(d.mode==="handle1"||d.mode==="handle2")&&(ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="crossline"&&(d.mode==="handle1"||d.mode==="line")&&(ie.current={x:I,y:w,p:{...d.object.p}}),d.object.type==="text"&&d.mode==="line"&&(ie.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}),d.object.type==="trendbyangle"&&(d.mode==="handle1"||d.mode==="handle2")&&(ie.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")&&(ie.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")&&(ie.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")&&(ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="stddevchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(ie.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")&&(ie.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")&&(ie.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")&&(ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="gannfan"&&(d.mode==="handle1"||d.mode==="handle2")&&(ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="ganngrid"&&(d.mode==="handle1"||d.mode==="handle2")&&(ie.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")&&(ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="circle"&&(d.mode==="handle1"||d.mode==="handle2")&&(ie.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")&&(ie.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")&&(ie.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")&&(ie.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")&&(ie.current={x:I,y:w,time:d.object.primitive.time}),d.mode==="line"&&(d.object.type==="rulerline"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="infoline"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="arrowedline"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rayline"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="extendedline"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="crossline"?ie.current={x:I,y:w,p:{...d.object.p}}:d.object.type==="text"?ie.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}:d.object.type==="trendbyangle"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="equidistantchannel"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="andrewspitchfork"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="regressionchannel"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="stddevchannel"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="disjointchannel"?ie.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"?ie.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"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="gannfan"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rectangle"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="circle"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="triangle"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="ellipse"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}:d.object.type==="ganngrid"?ie.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="horizontalray"?ie.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}:d.object.type==="verticalline"?ie.current={x:I,y:w,time:d.object.primitive.time}:d.object.type==="pricelevel"?ie.current={y:w,price:d.object.price}:ie.current={x:I,y:w,point1:{...d.object.point1},point2:{...d.object.point2}})}else E(null),ee.current=null,R([]),se(null),Z([])},M=h=>{const T=k.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top;if(!ee.current){const x=q(I,w);if(x?.object&&!ae.current){const g=j(x.object);se(_=>_===x.object?_:x.object),Z(_=>_.length===g.length&&_.every((P,O)=>P.x===g[O].x&&P.y===g[O].y)?_:g)}else se(g=>g==null?g:null),Z(g=>g.length===0?g:[]);return}const d=ae.current;if(!d)return;const D=p.timeScale().coordinateToTime(I),Q=f.coordinateToPrice(w);if(D==null||Q==null)return;let S=te(D);if(S!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=O=>{const V=O.rawTime??O.time,$=O.normalizedTime??te(V);return{rawTime:V,normalizedTime:$,price:O.price}},g=(O,V)=>{const $=O.normalizedTime??te(O.rawTime),Ae=V.normalizedTime??te(V.rawTime);if($==null||Ae==null)return;const ce=V.price-O.price,me=ce/Math.abs(O.price)*100,ye=dA(Ee)||3600,Se=Math.abs(Ae-$),Ze=Math.max(1,Math.round(Se/ye)),it=Math.max(1,Math.round(Se/86400)),Ge=p.timeScale().timeToCoordinate(O.rawTime),Bt=f.priceToCoordinate(O.price),dt=p.timeScale().timeToCoordinate(V.rawTime),yt=f.priceToCoordinate(V.price),It=Ge!=null&&Bt!=null&&dt!=null&&yt!=null?Math.atan2(-(yt-Bt),dt-Ge)*(180/Math.PI):d.primitive?.info?.angle??0,jt={priceDiff:ce,pricePct:me,bars:Ze,days:it,angle:It},nA=d.primitive;if(nA){nA.p1={rawTime:O.rawTime,price:O.price},nA.p2={rawTime:V.rawTime,price:V.price},nA.info=jt;try{c.current?.applyOptions({})}catch{}}const uA={...d,rawP1Time:O.rawTime,rawP2Time:V.rawTime,p1:{rawTime:O.rawTime,normalizedTime:$,price:O.price},p2:{rawTime:V.rawTime,normalizedTime:Ae,price:V.price}};Ce(JA=>{const _i=JA.map(zs=>zs===d?uA:zs);return v.current=_i,_i}),E(uA),ae.current=uA,Ge!=null&&Bt!=null&&dt!=null&&yt!=null&&R([{x:Ge,y:Bt},{x:dt,y:yt}])},_=x(d.p1),P=x(d.p2);if(_.rawTime==null||_.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(ee.current==="handle1"){const O=p.timeScale().coordinateToTime(I)??D;g({rawTime:O,normalizedTime:S,price:Q},P)}else if(ee.current==="handle2"){const O=p.timeScale().coordinateToTime(I)??D;g(_,{rawTime:O,normalizedTime:S,price:Q})}else if(ee.current==="line"){const O=ie.current;if(!O)return;const V=x(O.p1),$=x(O.p2);if(V.rawTime==null||V.normalizedTime==null||$.rawTime==null||$.normalizedTime==null)return;const Ae=p.timeScale().coordinateToTime(O.x)??V.rawTime,ce=f.coordinateToPrice(O.y);if(Ae==null||ce==null)return;const me=te(Ae)??V.normalizedTime;if(me==null)return;const ye=S-me,Se=Q-ce,Ze=te(V.normalizedTime+ye),it=te($.normalizedTime+ye);if(Ze==null||it==null)return;const Ge=D-Ae;g({rawTime:V.rawTime+Ge,normalizedTime:Ze,price:V.price+Se},{rawTime:$.rawTime+Ge,normalizedTime:it,price:$.price+Se})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(g,_)=>{const P=g.normalizedTime??g.rawTime,O=_.normalizedTime??_.rawTime,V=_.price-g.price,$=V/Math.abs(g.price)*100,Ae=Ns(Ks,g.rawTime,_.rawTime,Ee),ce=Math.abs(O-P),me=Math.max(1,Math.round(ce/86400)),ye={priceDiff:V,pricePct:$,bars:Ae,days:me},Se=d.primitive;if(Se){Se.p1={rawTime:g.rawTime,price:g.price},Se.p2={rawTime:_.rawTime,price:_.price},Se.info=ye;const yt=_.price>=g.price;Se.color=yt?"#3b82f6":"#ef5350",Se.fillColor=yt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const Ze={...d,rawP1Time:g.rawTime,rawP2Time:_.rawTime,p1:g,p2:_};Ce(yt=>{const It=yt.map(jt=>jt===d?Ze:jt);return v.current=It,It}),E(Ze),ae.current=Ze;const it=p.timeScale().timeToCoordinate(g.rawTime),Ge=f.priceToCoordinate(g.price),Bt=p.timeScale().timeToCoordinate(_.rawTime),dt=f.priceToCoordinate(_.price);it!=null&&Ge!=null&&Bt!=null&&dt!=null&&R([{x:it,y:Ge},{x:(it+Bt)/2,y:(Ge+dt)/2},{x:Bt,y:dt}])};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q})}else if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(g,_)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p1:g,p2:_};Ce(me=>{const ye=me.map(Se=>Se===d?O:Se);return v.current=ye,ye}),E(O),ae.current=O;const V=p.timeScale().timeToCoordinate(g.rawTime),$=f.priceToCoordinate(g.price),Ae=p.timeScale().timeToCoordinate(_.rawTime),ce=f.priceToCoordinate(_.price);V!=null&&$!=null&&Ae!=null&&ce!=null&&R([{x:V,y:$},{x:Ae,y:ce}])};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q})}else if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(g,_)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p1:g,p2:_};Ce(me=>{const ye=me.map(Se=>Se===d?O:Se);return v.current=ye,ye}),E(O),ae.current=O;const V=p.timeScale().timeToCoordinate(g.rawTime),$=f.priceToCoordinate(g.price),Ae=p.timeScale().timeToCoordinate(_.rawTime),ce=f.priceToCoordinate(_.price);V!=null&&$!=null&&Ae!=null&&ce!=null&&R([{x:V,y:$},{x:Ae,y:ce}])};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;const _=te(g);if(_==null)return;x(d.p1,{rawTime:g,normalizedTime:_,price:Q})}else if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(g,_)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p1:g,p2:_};Ce(me=>{const ye=me.map(Se=>Se===d?O:Se);return v.current=ye,ye}),E(O),ae.current=O;const V=p.timeScale().timeToCoordinate(g.rawTime),$=f.priceToCoordinate(g.price),Ae=p.timeScale().timeToCoordinate(_.rawTime),ce=f.priceToCoordinate(_.price);V!=null&&$!=null&&Ae!=null&&ce!=null&&R([{x:V,y:$},{x:Ae,y:ce}])};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q})}else if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="crossline"&&d.p){const x=_=>{const P=d.primitive;if(P){P.center={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p:_};Ce(Ae=>{const ce=Ae.map(me=>me===d?O:me);return v.current=ce,ce}),E(O),ae.current=O;const V=p.timeScale().timeToCoordinate(_.rawTime),$=f.priceToCoordinate(_.price);V!=null&&$!=null&&R([{x:V,y:$}])},g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,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,_=f.priceToCoordinate(x);_!=null&&R([{x:g/2,y:_}]);const P={...d,price:x};Ce(O=>{const V=O.map($=>$===d?P:$);return v.current=V,V}),E(P),ae.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,rawTime:x,price:Q};Ce(P=>{const O=P.map(V=>V===d?_:V);return v.current=O,O}),E(_),ae.current=_;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(g,_)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p1:g,p2:_};Ce(me=>{const ye=me.map(Se=>Se===d?O:Se);return v.current=ye,ye}),E(O),ae.current=O;const V=p.timeScale().timeToCoordinate(g.rawTime),$=f.priceToCoordinate(g.price),Ae=p.timeScale().timeToCoordinate(_.rawTime),ce=f.priceToCoordinate(_.price);V!=null&&$!=null&&Ae!=null&&ce!=null&&R([{x:V,y:$},{x:Ae,y:ce}])};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"||ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(g,_,P)=>{const O=hp(g,_,P);if(!O)return;const V=d.primitive;if(V){V.p1={rawTime:g.rawTime,price:g.price},V.p2={rawTime:_.rawTime,price:_.price},V.b1={rawTime:O.b1.rawTime,price:O.b1.price},V.b2={rawTime:O.b2.rawTime,price:O.b2.price},V.p3={rawTime:O.bottomMid.rawTime,price:O.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const $={...d,p1:g,p2:_,p3:O.bottomMid,b1:O.b1,b2:O.b2,bottomMid:O.bottomMid};Ce(Ae=>{const ce=Ae.map(me=>me===d?$:me);return v.current=ce,ce}),E($),ae.current=$};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??te(d.p3.rawTime),price:Q});return}if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O),ce=te(g.p3.normalizedTime+O);if($==null||Ae==null||ce==null)return;const me=D-_;x({rawTime:g.p1.rawTime+me,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+me,normalizedTime:Ae,price:g.p2.price+V},{rawTime:g.p3.rawTime+me,normalizedTime:ce,price:g.p3.price+V});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(g,_)=>{const P=ir(Me,g,_,d.stdMultiplier??1);if(!P)return;const O=d.primitive;if(O){O.mid1={rawTime:P.p1.rawTime,price:P.p1.price},O.mid2={rawTime:P.p2.rawTime,price:P.p2.price},O.top1={rawTime:P.top1.rawTime,price:P.top1.price},O.top2={rawTime:P.top2.rawTime,price:P.top2.price},O.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},O.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const V={...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};Ce($=>{const Ae=$.map(ce=>ce===d?V:ce);return v.current=Ae,Ae}),E(V),ae.current=V};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S},d.p2);return}if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S});return}if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(g,_)=>{const P=Xr(Me,g,_,d.stdMultiplier??1);if(!P)return;const O=d.primitive;if(O){O.mid1={rawTime:P.p1.rawTime,price:P.p1.price},O.mid2={rawTime:P.p2.rawTime,price:P.p2.price},O.top1={rawTime:P.top1.rawTime,price:P.top1.price},O.top2={rawTime:P.top2.rawTime,price:P.top2.price},O.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},O.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const V={...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};Ce($=>{const Ae=$.map(ce=>ce===d?V:ce);return v.current=Ae,Ae}),E(V),ae.current=V};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S},d.p2);return}if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S});return}if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(g,_,P)=>{const O=d.primitive;if(O){O.p1={rawTime:g.rawTime,price:g.price},O.p2={rawTime:_.rawTime,price:_.price},O.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:g,p2:_,p3:P};Ce($=>{const Ae=$.map(ce=>ce===d?V:ce);return v.current=Ae,Ae}),E(V),ae.current=V};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q},d.p3);return}if(ee.current==="handle3"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,d.p2,{rawTime:g,normalizedTime:S,price:Q});return}if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O),ce=te(g.p3.normalizedTime+O);if($==null||Ae==null||ce==null)return;const me=D-_;x({rawTime:g.p1.rawTime+me,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+me,normalizedTime:Ae,price:g.p2.price+V},{rawTime:g.p3.rawTime+me,normalizedTime:ce,price:g.p3.price+V});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(V,$,Ae,ce)=>{const me=d.primitive;if(me){me.p1={rawTime:V.rawTime,price:V.price},me.p2={rawTime:$.rawTime,price:$.price},me.p3={rawTime:Ae.rawTime,price:Ae.price},me.p4={rawTime:ce.rawTime,price:ce.price};try{c.current?.applyOptions({})}catch{}}const ye={...d,p1:V,p2:$,p3:Ae,p4:ce};Ce(Se=>{const Ze=Se.map(it=>it===d?ye:it);return v.current=Ze,Ze}),E(ye),ae.current=ye},g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(I);if(_==null)return;const P=te(_);if(P==null)return;const O=(V,$,Ae,ce)=>{const me=V.normalizedTime??te(V.rawTime);if(me==null)return null;const ye=te(me+Ae);return ye==null?null:{rawTime:V.rawTime+$,normalizedTime:ye,price:V.price+ce}};if(ee.current==="line"){const V=p.timeScale().coordinateToTime(g.x),$=f.coordinateToPrice(g.y);if(V==null||$==null)return;const Ae=te(V);if(Ae==null)return;const ce=_-V,me=P-Ae,ye=Q-$,Se=O(g.p1,ce,me,ye),Ze=O(g.p2,ce,me,ye),it=O(g.p3,ce,me,ye),Ge=O(g.p4,ce,me,ye);if(!Se||!Ze||!it||!Ge)return;x(Se,Ze,it,Ge);return}if(ee.current==="handle1"){const V=(g.p1.price+g.p2.price)/2,$={rawTime:_,normalizedTime:P,price:Q},Ae={rawTime:_,normalizedTime:P,price:2*V-Q};x($,Ae,g.p3,g.p4);return}if(ee.current==="handle3"){const V=(g.p3.price+g.p4.price)/2,$={rawTime:_,normalizedTime:P,price:Q},Ae={rawTime:_,normalizedTime:P,price:2*V-Q};x(g.p1,g.p2,$,Ae);return}if(ee.current==="handle2"){const V=(g.p1.price+g.p2.price)/2,$={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:Q};if($.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:2*V-Q};if(Ae.normalizedTime==null)return;x(Ae,$,g.p3,g.p4);return}if(ee.current==="handle4"){const V=Q-g.p4.price,$={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+V};if($.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+V};if(Ae.normalizedTime==null)return;x(g.p1,Ae,g.p3,$);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(V,$,Ae,ce)=>{const me=d.primitive;if(me){me.p1={rawTime:V.rawTime,price:V.price},me.p2={rawTime:$.rawTime,price:$.price},me.p3={rawTime:Ae.rawTime,price:Ae.price},me.p4={rawTime:ce.rawTime,price:ce.price};try{c.current?.applyOptions({})}catch{}}const ye={...d,p1:V,p2:$,p3:Ae,p4:ce};Ce(Se=>{const Ze=Se.map(it=>it===d?ye:it);return v.current=Ze,Ze}),E(ye),ae.current=ye},g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(I);if(_==null)return;const P=te(_);if(P==null)return;const O=(V,$,Ae,ce)=>{const me=V.normalizedTime??te(V.rawTime);if(me==null)return null;const ye=te(me+Ae);return ye==null?null:{rawTime:V.rawTime+$,normalizedTime:ye,price:V.price+ce}};if(ee.current==="line"){const V=p.timeScale().coordinateToTime(g.x),$=f.coordinateToPrice(g.y);if(V==null||$==null)return;const Ae=te(V);if(Ae==null)return;const ce=_-V,me=P-Ae,ye=Q-$,Se=O(g.p1,ce,me,ye),Ze=O(g.p2,ce,me,ye),it=O(g.p3,ce,me,ye),Ge=O(g.p4,ce,me,ye);if(!Se||!Ze||!it||!Ge)return;x(Se,Ze,it,Ge);return}if(ee.current==="handle1"){const V={rawTime:_,normalizedTime:P,price:Q},$={rawTime:_,normalizedTime:P,price:g.p2.price};x(V,$,g.p3,g.p4);return}if(ee.current==="handle3"){const V={rawTime:_,normalizedTime:P,price:Q},$={rawTime:_,normalizedTime:P,price:g.p4.price};x(g.p1,g.p2,V,$);return}if(ee.current==="handle2"||ee.current==="handle4"){const V=ee.current==="handle2"?g.p2:g.p4,$=Q-V.price,Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+$},ce={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+$};if(Ae.normalizedTime==null||ce.normalizedTime==null)return;x(g.p1,Ae,g.p3,ce);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(g,_)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p1:g,p2:_};Ce(V=>{const $=V.map(Ae=>Ae===d?O:Ae);return v.current=$,$}),E(O),ae.current=O};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q})}else if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(dt,yt)=>{const It=d.primitive;if(It){It.p1={rawTime:dt.rawTime,price:dt.price},It.p2={rawTime:yt.rawTime,price:yt.price};try{c.current?.applyOptions({})}catch{}}const jt={...d,p1:dt,p2:yt};Ce(nA=>{const uA=nA.map(JA=>JA===d?jt:JA);return v.current=uA,uA}),E(jt),ae.current=jt},g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(I);if(_==null)return;const P=te(_);if(P==null)return;if(ee.current==="line"){const dt=p.timeScale().coordinateToTime(g.x),yt=f.coordinateToPrice(g.y);if(dt==null||yt==null)return;const It=te(dt);if(It==null)return;const jt=P-It,nA=Q-yt,uA=te(g.p1.normalizedTime+jt),JA=te(g.p2.normalizedTime+jt);if(uA==null||JA==null)return;const _i=D-dt;x({rawTime:g.p1.rawTime+_i,normalizedTime:uA,price:g.p1.price+nA},{rawTime:g.p2.rawTime+_i,normalizedTime:JA,price:g.p2.price+nA});return}const O=Math.min(g.p1.normalizedTime,g.p2.normalizedTime),V=Math.max(g.p1.normalizedTime,g.p2.normalizedTime),$=Math.max(g.p1.price,g.p2.price),Ae=Math.min(g.p1.price,g.p2.price),ce=g.p1.normalizedTime<=g.p2.normalizedTime?g.p1.rawTime:g.p2.rawTime,me=g.p1.normalizedTime<=g.p2.normalizedTime?g.p2.rawTime:g.p1.rawTime;let ye=O,Se=V,Ze=$,it=Ae,Ge=ce,Bt=me;if((ee.current==="handle1"||ee.current==="handle4"||ee.current==="handle6")&&(ye=P,Ge=_),(ee.current==="handle3"||ee.current==="handle5"||ee.current==="handle8")&&(Se=P,Bt=_),(ee.current==="handle1"||ee.current==="handle2"||ee.current==="handle3")&&(Ze=Q),(ee.current==="handle6"||ee.current==="handle7"||ee.current==="handle8")&&(it=Q),ye>Se){const dt=ye,yt=Ge;ye=Se,Ge=Bt,Se=dt,Bt=yt}if(Ze<it){const dt=Ze;Ze=it,it=dt}x({rawTime:Ge,normalizedTime:ye,price:Ze},{rawTime:Bt,normalizedTime:Se,price:it});return}if(d.type==="circle"&&d.p1&&d.p2){const x=(Ze,it)=>{const Ge=d.primitive;if(Ge){Ge.p1={rawTime:Ze.rawTime,price:Ze.price},Ge.p2={rawTime:it.rawTime,price:it.price};try{c.current?.applyOptions({})}catch{}}const Bt={...d,p1:Ze,p2:it};Ce(dt=>{const yt=dt.map(It=>It===d?Bt:It);return v.current=yt,yt}),E(Bt),ae.current=Bt},g=p.timeScale().coordinateToTime(I);if(g==null)return;const _=te(g);if(_==null)return;if(ee.current==="handle2"){x(d.p1,{rawTime:g,normalizedTime:_,price:Q});return}const P=ie.current;if(!P)return;const O=p.timeScale().coordinateToTime(P.x),V=f.coordinateToPrice(P.y);if(O==null||V==null)return;const $=te(O);if($==null)return;const Ae=_-$,ce=Q-V,me=te(P.p1.normalizedTime+Ae),ye=te(P.p2.normalizedTime+Ae);if(me==null||ye==null)return;const Se=D-O;x({rawTime:P.p1.rawTime+Se,normalizedTime:me,price:P.p1.price+ce},{rawTime:P.p2.rawTime+Se,normalizedTime:ye,price:P.p2.price+ce});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(Ge,Bt,dt)=>{const yt=d.primitive;if(yt){yt.p1={rawTime:Ge.rawTime,price:Ge.price},yt.p2={rawTime:Bt.rawTime,price:Bt.price},yt.p3={rawTime:dt.rawTime,price:dt.price};try{c.current?.applyOptions({})}catch{}}const It={...d,p1:Ge,p2:Bt,p3:dt};Ce(jt=>{const nA=jt.map(uA=>uA===d?It:uA);return v.current=nA,nA}),E(It),ae.current=It},g=p.timeScale().coordinateToTime(I);if(g==null)return;const _=te(g);if(_==null)return;if(ee.current==="handle1"){x({rawTime:g,normalizedTime:_,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){x(d.p1,{rawTime:g,normalizedTime:_,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:g,normalizedTime:_,price:Q});return}const P=ie.current;if(!P)return;const O=p.timeScale().coordinateToTime(P.x),V=f.coordinateToPrice(P.y);if(O==null||V==null)return;const $=te(O);if($==null)return;const Ae=_-$,ce=Q-V,me=D-O,ye=Ge=>{const Bt=Ge.normalizedTime??te(Ge.rawTime);if(Bt==null)return null;const dt=te(Bt+Ae);return dt==null?null:{rawTime:Ge.rawTime+me,normalizedTime:dt,price:Ge.price+ce}},Se=ye(P.p1),Ze=ye(P.p2),it=ye(P.p3);if(!Se||!Ze||!it)return;x(Se,Ze,it);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(O,V,$=d.minorRatio??.45)=>{const Ae=d.primitive;if(Ae){Ae.p1={rawTime:O.rawTime,price:O.price},Ae.p2={rawTime:V.rawTime,price:V.price},Ae.minorRatio=Math.max(.05,$);try{c.current?.applyOptions({})}catch{}}const ce={...d,p1:O,p2:V,minorRatio:Math.max(.05,$)};Ce(me=>{const ye=me.map(Se=>Se===d?ce:Se);return v.current=ye,ye}),E(ce),ae.current=ce},g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(I);if(_==null)return;const P=te(_);if(P==null)return;if(ee.current==="line"){const O=p.timeScale().coordinateToTime(g.x),V=f.coordinateToPrice(g.y);if(O==null||V==null)return;const $=te(O);if($==null)return;const Ae=P-$,ce=Q-V,me=te(g.p1.normalizedTime+Ae),ye=te(g.p2.normalizedTime+Ae);if(me==null||ye==null)return;const Se=D-O;x({rawTime:g.p1.rawTime+Se,normalizedTime:me,price:g.p1.price+ce},{rawTime:g.p2.rawTime+Se,normalizedTime:ye,price:g.p2.price+ce},g.minorRatio??d.minorRatio??.45);return}if(ee.current==="handle1"){x({rawTime:_,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(ee.current==="handle3"){x(d.p1,{rawTime:_,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(ee.current==="handle2"||ee.current==="handle4"){const O=p.timeScale().timeToCoordinate(d.p1.rawTime),V=f.priceToCoordinate(d.p1.price),$=p.timeScale().timeToCoordinate(d.p2.rawTime),Ae=f.priceToCoordinate(d.p2.price);if(O==null||V==null||$==null||Ae==null)return;const ce=(O+$)/2,me=(V+Ae)/2,ye=$-O,Se=Ae-V,Ze=Math.hypot(ye,Se);if(Ze<.001)return;const it=-Se/Ze,Ge=ye/Ze,Bt=Math.abs((I-ce)*it+(w-me)*Ge),dt=Math.max(.05,Bt*2/Ze);x(d.p1,d.p2,dt);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(g,_)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p1:g,p2:_};Ce(V=>{const $=V.map(Ae=>Ae===d?O:Ae);return v.current=$,$}),E(O),ae.current=O};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q})}else if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(g,_)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const O={...d,p1:g,p2:_};Ce(V=>{const $=V.map(Ae=>Ae===d?O:Ae);return v.current=$,$}),E(O),ae.current=O};if(ee.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:S,price:Q},d.p2)}else if(ee.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:S,price:Q})}else if(ee.current==="line"){const g=ie.current;if(!g)return;const _=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(_==null||P==null)return;const O=S-te(_),V=Q-P,$=te(g.p1.normalizedTime+O),Ae=te(g.p2.normalizedTime+O);if($==null||Ae==null)return;const ce=D-_;x({rawTime:g.p1.rawTime+ce,normalizedTime:$,price:g.p1.price+V},{rawTime:g.p2.rawTime+ce,normalizedTime:Ae,price:g.p2.price+V})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=D;const g={...d,time:te(D),rawTime:D};Ce(P=>{const O=P.map(V=>V===d?g:V);return v.current=O,O}),E(g),ae.current=g;const _=p.timeScale().timeToCoordinate(D);_!=null&&R([{x:_,y:x.midYCss??200}]),c.current?.applyOptions({});return}if(d.type==="horizontalray"&&d.primitive){const x=d.primitive,g=ie.current;if(!g)return;if(ee.current==="handle1"){if(x.price=Q,x.originTime=D,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=D);const _={...d,price:x.price,originTime:x.originTime,rawOriginTime:D};Ce(P=>{const O=P.map(V=>V===d?_:V);return v.current=O,O}),E(_),ae.current=_,c.current?.applyOptions({})}else if(ee.current==="line"){const _=f.coordinateToPrice(g.y);if(_==null)return;const P=Q-_;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 O={...d,price:x.price};Ce(V=>{const $=V.map(Ae=>Ae===d?O:Ae);return v.current=$,$}),E(O),ae.current=O,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(ee.current==="handle1"){const x={time:S,price:Q},g=VA([{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,point1:x};Ce(P=>{const O=P.map(V=>V===d?_:V);return v.current=O,O}),E(_),ae.current=_}else if(ee.current==="handle2"){const x={time:S,price:Q},g=VA([{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,point2:x};Ce(P=>{const O=P.map(V=>V===d?_:V);return v.current=O,O}),E(_),ae.current=_}else if(ee.current==="line"){const x=ie.current;if(!x)return;const g=p.timeScale().coordinateToTime(x.x),_=f.coordinateToPrice(x.y);if(g==null||_==null)return;const P=S-g,O=Q-_,V={time:te(x.point1.time+P),price:x.point1.price+O},$={time:te(x.point2.time+P),price:x.point2.price+O},Ae=VA([{time:V.time,value:V.price},{time:$.time,value:$.price}]);Ae.length>0&&d.series.setData(Ae),d.decoration&&(d.decoration.p1=V,d.decoration.p2=$);const ce={...d,point1:V,point2:$};Ce(me=>{const ye=me.map(Se=>Se===d?ce:Se);return v.current=ye,ye}),E(ce),ae.current=ce}}}},N=()=>{ee.current=null,ie.current=null},W=()=>{ee.current||ae.current||(se(null),Z([]))},y={capture:!0,passive:!1};return k.addEventListener("mousedown",ue,y),k.addEventListener("mousemove",M,y),k.addEventListener("mouseup",N,y),k.addEventListener("mouseleave",W,y),()=>{k.removeEventListener("mousedown",ue,y),k.removeEventListener("mousemove",M,y),k.removeEventListener("mouseup",N,y),k.removeEventListener("mouseleave",W,y)}},[ve,Me,Ve,Ce]),Y.useEffect(()=>{const p=c.current,f=u.current;if(!p||!f)return;const k=()=>{const H=G;if(!H){R([]);return}const J=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=J.timeToCoordinate(j),M=f.priceToCoordinate(H.p1.price),N=J.timeToCoordinate(q),W=f.priceToCoordinate(H.p2.price);ue!=null&&M!=null&&N!=null&&W!=null?R([{x:ue,y:M},{x:N,y:W}]):R([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:(j+ue)/2,y:(q+M)/2},{x:ue,y:M}]):R([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="crossline"&&H.p){const j=J.timeToCoordinate(H.p.rawTime),q=f.priceToCoordinate(H.p.price);j!=null&&q!=null?R([{x:j,y:q}]):R([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const j=J.timeToCoordinate(H.rawTime),q=f.priceToCoordinate(H.price);j!=null&&q!=null?R([{x:j,y:q}]):R([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price),N=J.timeToCoordinate(H.b1.rawTime),W=f.priceToCoordinate(H.b1.price),y=J.timeToCoordinate(H.b2.rawTime),h=f.priceToCoordinate(H.b2.price);j!=null&&q!=null&&ue!=null&&M!=null&&N!=null&&W!=null&&y!=null&&h!=null?R([{x:j,y:q},{x:ue,y:M},{x:(N+y)/2,y:(W+h)/2}]):R([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price),N=J.timeToCoordinate(H.p3.rawTime),W=f.priceToCoordinate(H.p3.price);j!=null&&q!=null&&ue!=null&&M!=null&&N!=null&&W!=null?R([{x:j,y:q},{x:ue,y:M},{x:N,y:W}]):R([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price),N=J.timeToCoordinate(H.p3.rawTime),W=f.priceToCoordinate(H.p3.price),y=J.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);j!=null&&q!=null&&ue!=null&&M!=null&&N!=null&&W!=null&&y!=null&&h!=null?R([{x:j,y:q},{x:ue,y:M},{x:N,y:W},{x:y,y:h}]):R([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price),N=J.timeToCoordinate(H.p3.rawTime),W=f.priceToCoordinate(H.p3.price),y=J.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);j!=null&&q!=null&&ue!=null&&M!=null&&N!=null&&W!=null&&y!=null&&h!=null?R([{x:j,y:q},{x:ue,y:M},{x:N,y:W},{x:y,y:h}]):R([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const j=J.timeToCoordinate(H.point1.time),q=f.priceToCoordinate(H.point1.price),ue=J.timeToCoordinate(H.point2.time),M=f.priceToCoordinate(H.point2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const j=J.timeToCoordinate(H.point1.time),q=f.priceToCoordinate(H.point1.price),ue=J.timeToCoordinate(H.point2.time),M=f.priceToCoordinate(H.point2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:(j+ue)/2,y:(q+M)/2},{x:ue,y:M}]):R([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);if(j!=null&&q!=null&&ue!=null&&M!=null){const N=Math.min(j,ue),W=Math.max(j,ue),y=Math.min(q,M),h=Math.max(q,M),T=(N+W)/2,I=(y+h)/2;R([{x:N,y},{x:T,y},{x:W,y},{x:N,y:I},{x:W,y:I},{x:N,y:h},{x:T,y:h},{x:W,y:h}])}else R([]);return}if(H.type==="circle"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price),N=J.timeToCoordinate(H.p3.rawTime),W=f.priceToCoordinate(H.p3.price);j!=null&&q!=null&&ue!=null&&M!=null&&N!=null&&W!=null?R([{x:j,y:q},{x:ue,y:M},{x:N,y:W}]):R([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);if(j!=null&&q!=null&&ue!=null&&M!=null){const N=(j+ue)/2,W=(q+M)/2,y=ue-j,h=M-q,T=Math.hypot(y,h);if(T<.001){R([]);return}const I=y/T,w=h/T,d=-w,D=I,Q=T/2,S=Q*Math.max(.05,H.minorRatio??.45);R([{x:N-I*Q,y:W-w*Q},{x:N+d*S,y:W+D*S},{x:N+I*Q,y:W+w*Q},{x:N-d*S,y:W-D*S}])}else R([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const j=J.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=J.timeToCoordinate(H.p2.rawTime),M=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&M!=null?R([{x:j,y:q},{x:ue,y:M}]):R([]);return}if(H.type==="horizontalray"&&H.primitive){const j=H.primitive,q=J.timeToCoordinate(j.originTime),ue=f.priceToCoordinate(j.price);q!=null&&ue!=null?R([{x:q,y:ue}]):R([]);return}if(H.type==="verticalline"&&H.primitive){const j=H.primitive,q=J.timeToCoordinate(j.time);if(q!=null){const ue=j.midYCss??200;R([{x:q,y:ue}])}else R([]);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;R([{x:q/2,y:j}])}else R([]);return}R([])};k();const fe=p.timeScale();return fe.subscribeVisibleTimeRangeChange(k),()=>{fe.unsubscribeVisibleTimeRangeChange(k)}},[G]),Y.useEffect(()=>{let p=!1;v.current.forEach(f=>{if(f.type==="verticalline"&&f.primitive){const k=f===G||f===re;f.primitive.showDot!==k&&(f.primitive.showDot=k,p=!0)}}),p&&c.current?.applyOptions({})},[G,re]),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 k=f===G||f===re;f.primitive.isActive!==k&&(f.primitive.isActive=k,p=!0)}}),p&&c.current?.applyOptions({})},[G,re]),Y.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:at}),p.priceLine){const f=at&&p.showPrice!==!1;p.priceLine.applyOptions(at?{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=at;try{c.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=at;try{c.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:at}),p.parallelLine&&p.parallelLine.applyOptions({visible:at}),p.firstLine&&p.firstLine.applyOptions({visible:at}),p.secondLine&&p.secondLine.applyOptions({visible:at})),(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=at;try{c.current?.applyOptions({})}catch{}}})},[at,Ve]),Y.useEffect(()=>{!at&&G&&(E(null),R([]))},[at,G]),Y.useEffect(()=>{if(v.current.length>Ve.length){const p=v.current.filter((f,k)=>!Ve.includes(f));G&&p.some(f=>f===G)&&(E(null),R([])),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=Ve}},[Ve,G]),Y.useEffect(()=>{const p=u.current;return p?(Je.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Je.current=[],je.filter(k=>k.symbol===Le).forEach(k=>{const fe=parseFloat(k.openPrice??k.price),J=k.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(Fe&&!isNaN(fe)&&Je.current.push(p.createPriceLine({price:fe,color:J,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${k.type} ${k.volume}`})),$e){const j=parseFloat(k.stopLoss),q=parseFloat(k.takeProfit);!isNaN(j)&&j>0&&Je.current.push(p.createPriceLine({price:j,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(q)&&q>0&&Je.current.push(p.createPriceLine({price:q,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{Je.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Je.current=[]}):void 0},[je,Le,Fe,$e]),Y.useEffect(()=>{const p=u.current;if(!p||!qe)return;const f=parseFloat(GA?.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{}}},[qe,GA]),Y.useEffect(()=>{const p=o.current;if(!p)return;const f=k=>{if(oe.current){oe.current=!1;return}if(b.current||!c.current)return;const fe=c.current,H=u.current;if(fe&&H&&v.current.length>0){const J=p.getBoundingClientRect(),j=k.clientX-J.left,q=k.clientY-J.top,ue=15;for(let M=v.current.length-1;M>=0;M--){const N=v.current[M];let W=!1;if(N.type==="text"&&N.rawTime!=null&&N.price!=null){const y=fe.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&&(W=!0)}}else if(N.point1&&N.point2){const y=fe.timeScale().timeToCoordinate(N.point1.time??N.point1.rawTime),h=H.priceToCoordinate(N.point1.price),T=fe.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),D=(y+T)/2,Q=(h+I)/2,S=Math.hypot(j-D,q-Q);(w<ue||d<ue||S<ue)&&(W=!0)}}else if(N.p1&&N.p2){const y=fe.timeScale().timeToCoordinate(N.p1.rawTime),h=H.priceToCoordinate(N.p1.price),T=fe.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),D=Math.min(h,I),Q=Math.max(h,I);j>=w-5&&j<=d+5&&q>=D-5&&q<=Q+5&&(W=!0)}}else if(N.p){const y=fe.timeScale().timeToCoordinate(N.p.rawTime),h=H.priceToCoordinate(N.p.price);y!=null&&h!=null&&Math.hypot(j-y,q-h)<ue&&(W=!0)}else if(N.type==="pricelevel"&&N.price!=null){const y=H.priceToCoordinate(N.price);y!=null&&Math.abs(q-y)<ue&&(W=!0)}if(W){k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),ne(N);return}}}k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;pp(c.current,Me,Ee)||c.current.timeScale().fitContent();const j=c.current.timeScale().getVisibleRange();ge(j)},80)};return p.addEventListener("dblclick",f,!0),()=>{p.removeEventListener("dblclick",f,!0)}},[Me,Ee]);const Qp=G??re,Fp=G?X:he,eb=at&&yT(Qp,Fp),tb=CT(Qp?.type);Y.useEffect(()=>{const p=o.current,f=l.current;if(!p||!f)return;const k=80,fe=J=>{const j=p.getBoundingClientRect();f.style.opacity=j.bottom-J.clientY<=k?"1":"0"},H=()=>{f.style.opacity="0"};return p.addEventListener("mousemove",fe),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",fe),p.removeEventListener("mouseleave",H)}},[]);const Ab=Y.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,fe=(f.from+f.to)/2,H=k*.8;try{p.setVisibleRange({from:fe-H/2,to:fe+H/2}),ge(p.getVisibleRange())}catch{}},[ge]),ib=Y.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,fe=(f.from+f.to)/2,H=k*1.25;try{p.setVisibleRange({from:fe-H/2,to:fe+H/2}),ge(p.getVisibleRange())}catch{}},[ge]),rb=Y.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{}},[]),nb=Y.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{}},[]),sb=Y.useCallback(()=>{if(!c.current)return;pp(c.current,Me,Ee)||c.current.timeScale().fitContent();const f=c.current.timeScale().getVisibleRange();ge(f)},[Me,Ee,ge]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${_e==="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 Le=="object"?Le?.symbol:Le,"..."]})]})}),!Pe&&ot&&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:_e==="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:_e==="light"?"#64748b":"#94a3b8"},children:ot})]})}),!Pe&&!ot&&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:_e==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof Le=="object"?Le?.symbol:Le]})})}),RA&&Me.length>0&&(()=>{const p=Me[Me.length-1],f=k=>{const fe=Number(k);return Number.isFinite(fe)?fe>=100?fe.toFixed(2):fe.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:_e==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:_e==="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:_e==="light"?"#1e293b":"#e2e8f0"},children:f(p?.close)})]})]})})(),(A||wt)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Gh,{bidPrice:e,askPrice:t,onBuyClick:JT,onSellClick:ZT})}),a.jsx($h,{isOpen:Ke,onClose:YT,orderType:Qe,bidPrice:e,askPrice:t}),a.jsx(qh,{isOpen:z!==null,onClose:()=>ne(null),chartObject:z,onUpdate:qT}),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"}})}),eb&&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:tb}},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:ib,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:Ab,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:rb,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: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:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:sb,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:_e==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:_e==="light"?"#374151":"#94a3b8",border:"1px solid "+(_e==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=_e==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",fe.currentTarget.style.color=_e==="light"?"#111827":"#e2e8f0"},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor=_e==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",fe.currentTarget.style.color=_e==="light"?"#374151":"#94a3b8"},children:k},p))})]})})}),xt={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}=Vt(),[s,o]=Y.useState(!1),[l,c]=Y.useState(""),[u,m]=Y.useState(-1),B=Y.useRef(null),v=Y.useRef(null);Y.useEffect(()=>{const L=K=>{B.current&&!B.current.contains(K.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]),Y.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const b=r.filter(L=>L.symbol.toLowerCase().includes(l.toLowerCase())),C=b.filter(L=>!L.symbol.endsWith("USDT")),U=b.filter(L=>L.symbol.endsWith("USDT")),F=L=>{A(L),o(!1),c("")};return r.find(L=>L.symbol===t),a.jsxs("div",{ref:B,style:{...xt.container,...i},className:e,children:[a.jsxs("button",{style:xt.button,onClick:()=>o(!s),onMouseEnter:L=>Object.assign(L.currentTarget.style,xt.buttonHover),onMouseLeave:L=>{L.currentTarget.style.borderColor="#334155",L.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...xt.arrow,...s?xt.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:xt.dropdown,children:[a.jsx("div",{style:xt.searchContainer,children:a.jsx("input",{ref:v,style:xt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:L=>c(L.target.value)})}),a.jsx("div",{style:xt.list,children:b.length===0?a.jsx("div",{style:xt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:xt.categoryLabel,children:"Forex & Metals"}),C.map(L=>a.jsxs("div",{style:{...xt.item,...L.symbol===t?xt.itemSelected:{}},onClick:()=>F(L.symbol),onMouseEnter:K=>{L.symbol!==t&&(K.currentTarget.style.backgroundColor="#334155")},onMouseLeave:K=>{L.symbol!==t&&(K.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:xt.symbolName,children:L.symbol}),L.bid&&a.jsx("span",{style:{...xt.symbolPrice,...parseFloat(L.change)>=0?xt.priceUp:xt.priceDown},children:parseFloat(L.bid).toFixed(5)})]},L.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:xt.categoryLabel,children:"Crypto"}),U.map(L=>a.jsxs("div",{style:{...xt.item,...L.symbol===t?xt.itemSelected:{}},onClick:()=>F(L.symbol),onMouseEnter:K=>{L.symbol!==t&&(K.currentTarget.style.backgroundColor="#334155")},onMouseLeave:K=>{L.symbol!==t&&(K.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:xt.symbolName,children:L.symbol}),L.bid&&a.jsx("span",{style:{...xt.symbolPrice,...parseFloat(L.change)>=0?xt.priceUp:xt.priceDown},children:parseFloat(L.bid).toFixed(2)})]},L.symbol))]})]})})]})]})}const zA={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"}},FT=[.01,.05,.1,.5,1];function Bp({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=FT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[m,B]=Y.useState(.1),v=i!==void 0?i:m,b=Y.useCallback(L=>{const K=Math.max(t,Math.min(A,parseFloat(L)||t)),G=Math.round(K/r)*r,E=parseFloat(G.toFixed(8));i!==void 0||B(E),e?.(E)},[t,A,r,i,e]),C=()=>b(v+r),U=()=>b(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...zA.container,...c},className:u,children:[o&&a.jsx("span",{style:zA.label,children:l}),a.jsx("button",{style:zA.btn,onClick:U,onMouseEnter:L=>Object.assign(L.currentTarget.style,zA.btnHover),onMouseLeave:L=>{L.currentTarget.style.borderColor="#334155",L.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:zA.input,type:"text",value:F,onChange:L=>{const K=L.target.value;if(K===""||K==="."||K==="0.")return;const G=parseFloat(K);isNaN(G)||b(G)},onBlur:()=>b(v)}),a.jsx("button",{style:zA.btn,onClick:C,onMouseEnter:L=>Object.assign(L.currentTarget.style,zA.btnHover),onMouseLeave:L=>{L.currentTarget.style.borderColor="#334155",L.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:zA.presets,children:n.map(L=>a.jsx("button",{style:{...zA.preset,...Math.abs(v-L)<1e-4?zA.presetActive:{}},onClick:()=>b(L),onMouseEnter:K=>{Math.abs(v-L)>=1e-4&&Object.assign(K.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:K=>{Math.abs(v-L)>=1e-4&&(K.currentTarget.style.borderColor="#334155")},children:L},L))})]})}const cA={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:m}){const{currentSymbolData:B}=Vt(),[v,b]=Y.useState(""),[C,U]=Y.useState(!1),[F,L]=Y.useState("price"),K=i!==void 0?i:v,G=t!==void 0?t:C,E=r!==void 0?r:F,z=Y.useCallback(se=>{t!==void 0||U(se),A?.(se)},[t,A]),ne=Y.useCallback(se=>{r!==void 0||L(se),n?.(se)},[r,n]),X=Y.useCallback(se=>{i!==void 0||b(se),e?.(se)},[i,e]),R=se=>{const he=se.target.value;if(he===""||he==="."||he==="0."){X(he);return}const Z=parseFloat(he);isNaN(Z)||X(he)},re=E==="price"?B?.bid?parseFloat(B.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...cA.container,...u},className:m,children:[l&&a.jsx("span",{style:cA.label,children:c}),s&&a.jsx("button",{style:{...cA.toggle,...G?cA.toggleOn:cA.toggleOff},onClick:()=>z(!G),children:a.jsx("div",{style:{...cA.toggleKnob,...G?cA.knobOn:cA.knobOff}})}),(G||!s)&&a.jsxs("div",{style:cA.inputGroup,children:[a.jsx("input",{style:cA.input,type:"text",value:K,onChange:R,placeholder:re,onFocus:se=>se.currentTarget.style.borderColor="#EF5350",onBlur:se=>se.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...cA.modeBtn,...E==="price"?cA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...cA.modeBtn,...E==="pips"?cA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const hA={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:m}){const{currentSymbolData:B}=Vt(),[v,b]=Y.useState(""),[C,U]=Y.useState(!1),[F,L]=Y.useState("price"),K=i!==void 0?i:v,G=t!==void 0?t:C,E=r!==void 0?r:F,z=Y.useCallback(se=>{t!==void 0||U(se),A?.(se)},[t,A]),ne=Y.useCallback(se=>{r!==void 0||L(se),n?.(se)},[r,n]),X=Y.useCallback(se=>{i!==void 0||b(se),e?.(se)},[i,e]),R=se=>{const he=se.target.value;if(he===""||he==="."||he==="0."){X(he);return}const Z=parseFloat(he);isNaN(Z)||X(he)},re=E==="price"?B?.ask?parseFloat(B.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...hA.container,...u},className:m,children:[l&&a.jsx("span",{style:hA.label,children:c}),s&&a.jsx("button",{style:{...hA.toggle,...G?hA.toggleOn:hA.toggleOff},onClick:()=>z(!G),children:a.jsx("div",{style:{...hA.toggleKnob,...G?hA.knobOn:hA.knobOff}})}),(G||!s)&&a.jsxs("div",{style:hA.inputGroup,children:[a.jsx("input",{style:hA.input,type:"text",value:K,onChange:R,placeholder:re,onFocus:se=>se.currentTarget.style.borderColor="#26A69A",onBlur:se=>se.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...hA.modeBtn,...E==="price"?hA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...hA.modeBtn,...E==="pips"?hA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const UT=[{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:"─"}],WA={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:m,setChartObjects:B}=Vt(),[v,b]=Y.useState(null),C=A||UT,U=K=>{l(o===K?null:K)},F=()=>{B([]),l(null)},L=()=>{u(!c)};return a.jsxs("div",{style:{...WA.container,...n},className:s,children:[i&&a.jsx("span",{style:WA.label,children:r}),C.map(K=>a.jsxs("button",{style:{...WA.btn,...o===K.id?WA.btnActive:{}},onClick:()=>U(K.id),onMouseEnter:G=>{b(K.id),o!==K.id&&Object.assign(G.currentTarget.style,WA.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:WA.tooltip,children:K.name})]},K.id)),(e||t)&&a.jsx("div",{style:WA.divider}),t&&a.jsx("button",{style:{...WA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:L,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:WA.deleteBtn,onClick:F,onMouseEnter:K=>Object.assign(K.currentTarget.style,WA.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 ST({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:B,onTakeProfitChange:v,takeProfitEnabled:b,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:L={},takeProfitProps:K={},drawingToolsProps:G={},style:E,className:z}){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:m,...L},"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 X=[];return ne.forEach((R,re)=>{X.push(R),n&&re<ne.length-1&&X.push(a.jsx("div",{style:Tp.divider},`div-${re}`))}),a.jsx("div",{style:{...Tp.toolbar,...E},className:z,children:X})}const ET=[{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 LT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Vt();return a.jsx("div",{style:{...sl.container,...i},className:e,children:ET.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 MT=[{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 HT({style:i,className:e}){const{chartType:t,setChartType:A}=Vt();return a.jsx("div",{style:{...ol.container,...i},className:e,children:MT.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 iA={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 IT({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]=Y.useState(null),B=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),b=v>0&&B>0?Math.abs(v-B):0,C=L=>!L||L===0?"-.-----":L>=1e3?L.toFixed(2):L>=1?L.toFixed(4):L.toFixed(5),U=L=>L===0?"-":L>=1?L.toFixed(1):L>=.01?L.toFixed(3):(L*1e4).toFixed(1)+"p",F=Y.useCallback(L=>{if(!s)return;const K=L==="BUY"?v:B;if(!K||K<=0){m({type:"error",message:"No price available"});return}const G={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:L,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(z=>[...z,G]);const E=i*K*.01;c(z=>z-E),m({type:"success",message:`${L} executed`}),A?.(G),setTimeout(()=>m(null),3e3)},[s,v,B,i,e,t,l,c,A]);return a.jsxs("div",{style:{...iA.container,...r},className:n,children:[a.jsx("button",{style:iA.sellBtn,onClick:()=>F("SELL"),onMouseEnter:L=>{Object.assign(L.currentTarget.style,iA.sellBtnHover)},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="#7f1d1d",L.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:iA.priceBox,children:[a.jsx("span",{style:iA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...iA.priceValue,color:"#EF5350"},children:C(B)})]}),a.jsxs("div",{style:iA.spread,children:[a.jsx("span",{style:iA.spreadLabel,children:"Spread"}),a.jsx("span",{style:iA.spreadValue,children:U(b)})]}),a.jsxs("div",{style:iA.priceBox,children:[a.jsx("span",{style:iA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...iA.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:iA.buyBtn,onClick:()=>F("BUY"),onMouseEnter:L=>{Object.assign(L.currentTarget.style,iA.buyBtnHover)},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="#14532d",L.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...iA.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 lt={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}=Vt(),[l,c]=Y.useState(null),u=A.filter(C=>C.status==="OPEN"||!C.closeAt),m=Y.useCallback((C,U)=>{const F=n.find(L=>L.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=m(C.symbol,C.type),L=(C.type?.toUpperCase()==="BUY"?U-C.price:C.price-U)*C.volume,K=C.volume*C.price*.01;r(G=>G.filter(E=>E.id!==C.id)),o(G=>G+K+L),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)},b=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...lt.container,...i},className:e,children:[a.jsxs("div",{style:lt.header,children:[a.jsxs("span",{style:lt.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:lt.summary,children:[a.jsxs("div",{style:lt.summaryItem,children:[a.jsx("span",{style:lt.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...lt.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:lt.summaryItem,children:[a.jsx("span",{style:lt.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...lt.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:lt.summaryItem,children:[a.jsx("span",{style:lt.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...lt.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...lt.scrollArea,maxHeight:t},children:a.jsxs("table",{style:lt.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:lt.th,children:"Symbol"}),a.jsx("th",{style:lt.th,children:"Type"}),a.jsx("th",{style:lt.th,children:"Volume"}),a.jsx("th",{style:lt.th,children:"Open Price"}),a.jsx("th",{style:lt.th,children:"Current"}),a.jsx("th",{style:lt.th,children:"SL"}),a.jsx("th",{style:lt.th,children:"TP"}),a.jsx("th",{style:lt.th,children:"Profit"}),a.jsx("th",{style:lt.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:lt.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:{...lt.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...lt.td,...C.type?.toUpperCase()==="BUY"?lt.typeBuy:lt.typeSell},children:C.type}),a.jsx("td",{style:lt.td,children:C.volume}),a.jsx("td",{style:lt.td,children:v(C.price)}),a.jsx("td",{style:lt.td,children:v(U)}),a.jsx("td",{style:lt.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:lt.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...lt.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:b(F)}),a.jsx("td",{style:lt.td,children:a.jsx("button",{style:{...lt.closeBtn,...l===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>B(C),disabled:l===C.id,onMouseEnter:L=>{l!==C.id&&(L.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="#7f1d1d"},children:l===C.id?"...":"Close"})})]},C.id)})})]})})]})}function DT(i){return tA({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 PT(i){return tA({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 NT(i){return tA({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 tA({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 OT=({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:B,buySellPanelOpen:v,onMove:b})=>{const{theme:C}=Vt(),U=C==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],L={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.jsx("div",{className:`overflow-x-auto border-b ${U?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,style:{scrollbarWidth:"thin",scrollbarColor:U?"#cbd5e1 transparent":"#334155 transparent"},children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-1 min-w-max",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:L[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:L[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(DT,{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(PT,{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",{type:"button",onClick:()=>B?.(),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"})})}],Os=({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})}),KT=({AccountId:i,UserName:e,UserId:t,onToggleTerminal:A})=>{const{activeTool:r,setActiveTool:n,showGrid:s,setShowGrid:o,snapToGrid:l,setSnapToGrid:c,chartObjects:u,setChartObjects:m,drawingsVisible:B,setDrawingsVisible:v,chartLocked:b,setChartLocked:C,theme:U,setTheme:F,setCandleColors:L,setShowTradeOrders:K,showTradeOrders:G,setShowTradePosition:E,showTradePosition:z,setShowTradeHistory:ne,showTradeHistory:X,setShowSLTP:R,showSLTP:re,setShowAskPrice:se,showAskPrice:he,setShowChartControls:Z,showChartControls:ee,setShowTradeNotification:ie,showTradeNotification:ae,setShowCrosshair:oe,showCrosshair:le,setShowOHLC:de,showOHLC:we,setIsShow:be}=Vt(),xe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[Be,ge]=Y.useState(!1),[ve,Te]=Y.useState(null),[De,Xe]=Y.useState(null),[Ve,Ce]=Y.useState(0),[je,Le]=Y.useState(!1),[Ee,at]=Y.useState(0),[rt,Pt]=Y.useState(!1),[_e,ke]=Y.useState(0),[Fe,He]=Y.useState(!1),[Ie,$e]=Y.useState(0),[qe,wt]=Y.useState(!1),[Qt,RA]=Y.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),GA=Y.useRef(null),Rt=Y.useRef(null),gA=Y.useRef(null),$A=Y.useRef(null),Yt=Y.useRef(null),Ft=Y.useRef(null);Y.useEffect(()=>{const Ke=At=>{const Qe=GA.current;Be&&Qe&&!Qe.contains(At.target)&&(ge(!1),Te(null));const Re=Rt.current;De==="line"&&Re&&!Re.contains(At.target)&&Xe(null);const Me=gA.current;De==="channel"&&Me&&!Me.contains(At.target)&&Xe(null);const ze=$A.current;De==="gann"&&ze&&!ze.contains(At.target)&&Xe(null);const Pe=Yt.current;De==="shape"&&Pe&&!Pe.contains(At.target)&&Xe(null)};return window.addEventListener("mousedown",Ke),()=>window.removeEventListener("mousedown",Ke)},[Be,De]),Y.useEffect(()=>{const Ke=At=>{At.key==="Escape"&&(ge(!1),Te(null),Xe(null))};return window.addEventListener("keydown",Ke),()=>window.removeEventListener("keydown",Ke)},[]);const rA=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"}],[]),nt=Ke=>{const At=rA[Ke].label;if(At==="Menu"){ge(Qe=>!Qe),Te(null);return}if(At==="Grid"){o(!s);return}if(At==="Magnet"){c(!l),n(l?null:Ke);return}if(At==="Delete"){if(u.length>0){const Qe=[...u];Qe.pop(),m(Qe)}return}if(At==="Eye"){v(!B);return}if(At==="Lock"){C(!b);return}if(At==="Light Theme"||At==="Dark Theme"){F(U==="light"?"dark":"light"),ge(!1),Te(null);return}if(At==="History"){A?.();return}n(r===Ke?null:Ke)};rA.slice(0,12);const ft=rA.slice(12),Ut=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],Ht=[{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:U==="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"})]})}]}],XA=({item:Ke})=>{const At=!!Ke.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Ft.current&&(clearTimeout(Ft.current),Ft.current=null),At&&Te(Ke.key)},onMouseLeave:()=>{At&&(Ft.current=setTimeout(()=>Te(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{At?Te(Qe=>Qe===Ke.key?null:Ke.key):(Ke.key==="theme"&&F(Qe=>Qe==="light"?"dark":"light"),ge(!1),Te(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:Ke.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:Ke.label}),Ke.rightText&&a.jsx("span",{className:`text-xs ${Je?"text-slate-500":"text-slate-400"}`,children:Ke.rightText}),At&&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"})})]}),At&&ve===Ke.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden border ${Je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:Ke.submenu.map((Qe,Re)=>{const Me=Qt[Ke.key],ze=Array.isArray(Me)?Me.includes(Qe.label):Me===Qe.label||Qe.selected&&Me==null;return a.jsxs("button",{type:"button",onClick:()=>{Ke.key==="chart"?(RA(st=>{const ot=Array.isArray(st.chart)?st.chart:[st.chart],Ct=ot.includes(Qe.label)?ot.filter(qt=>qt!==Qe.label):[...ot,Qe.label];return{...st,chart:Ct}}),{Grid:()=>o(!s),"Trade Orders":()=>K(!G),"Ask Price":()=>se(!he),"Chart Controls":()=>Z(!ee),"Trade Notification":()=>ie(!ae),"Crosshair cursor":()=>oe(!le),"Show OHLC":()=>de(!we)}[Qe.label]?.()):(RA(Pe=>({...Pe,[Ke.key]:Qe.label})),Ke.key==="colors"&&xe[Qe.label]&&L(xe[Qe.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:Qe.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Qe.label}),ze&&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"})})})]},Re)})})})]})},Je=U==="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:Ut.map((Ke,At)=>{const Qe=Ke==="gann",Re=Qe?null:rA[Ke],Me=Qe?-1:Ke;return a.jsxs(Y.Fragment,{children:[Me===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ze=Jr[Ve].toolId;n(r===ze?null:ze)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
- ${r===Jr[Ve].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Jr[Ve].label,children:Jr[Ve].icon}),a.jsx("span",{onMouseEnter:()=>Le(!0),onMouseLeave:()=>Le(!1),onMouseDown:ze=>{ze.stopPropagation(),Xe(Pe=>Pe==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:je?10:7,height:je?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:Je?"#64748b":"#94a3b8"})})})]}):Me===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ze=Zr[Ee].toolId;n(r===ze?null:ze)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
- ${r===Zr[Ee].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Zr[Ee].label,children:Zr[Ee].icon}),a.jsx("span",{onMouseEnter:()=>Pt(!0),onMouseLeave:()=>Pt(!1),onMouseDown:ze=>{ze.stopPropagation(),Xe(Pe=>Pe==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:rt?10:7,height:rt?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:Je?"#64748b":"#94a3b8"})})})]}):Qe?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ze=Yr[_e].toolId;n(r===ze?null:ze)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
- ${r===Yr[_e].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Yr[_e].label,children:Yr[_e].icon}),a.jsx("span",{onMouseEnter:()=>He(!0),onMouseLeave:()=>He(!1),onMouseDown:ze=>{ze.stopPropagation(),Xe(Pe=>Pe==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:Fe?10:7,height:Fe?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:Je?"#64748b":"#94a3b8"})})})]}):Me===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ze=qr[Ie].toolId;n(r===ze?null:ze)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
- ${r===qr[Ie].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:qr[Ie].label,children:qr[Ie].icon}),a.jsx("span",{onMouseEnter:()=>wt(!0),onMouseLeave:()=>wt(!1),onMouseDown:ze=>{ze.stopPropagation(),Xe(Pe=>Pe==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:qe?10:7,height:qe?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:Je?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>nt(Me),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
- ${Re.label==="Grid"&&s||Re.label==="Eye"&&!B||Re.label==="Lock"&&b||r===Me?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Re.label}: ${Re.description}`,children:Re.icon}),!Qe&&Re.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${Je?"border-slate-200":"border-slate-700"}`})]},Qe?"gann-slot":`${Re.label}-${Ke}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:ft.map((Ke,At)=>{const Qe=12+At;return a.jsx("button",{onClick:()=>nt(Qe),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
- ${Ke.label==="Grid"&&s||Ke.label==="Eye"&&!B||Ke.label==="Lock"&&b||r===Qe?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Ke.label}: ${Ke.description}`,children:Ke.icon},Ke.label)})})]}),De==="line"&&a.jsx(Os,{top:84,panelRef:Rt,isLight:Je,children:Jr.map((Ke,At)=>{const Qe=Ve===At;return a.jsxs("button",{type:"button",onMouseDown:Re=>{Re.stopPropagation(),Ce(At),n(Ke.toolId),Xe(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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:Ke.icon}),a.jsx("span",{className:"flex-1",children:Ke.label}),Qe&&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"})})})]},Ke.toolId)})}),De==="channel"&&a.jsx(Os,{top:128,panelRef:gA,isLight:Je,children:Zr.map((Ke,At)=>{const Qe=Ee===At;return a.jsxs("button",{type:"button",onMouseDown:Re=>{Re.stopPropagation(),at(At),n(Ke.toolId),Xe(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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:Ke.icon}),a.jsx("span",{className:"flex-1",children:Ke.label}),Qe&&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"})})})]},Ke.toolId)})}),De==="gann"&&a.jsx(Os,{top:210,panelRef:$A,isLight:Je,children:Yr.map((Ke,At)=>{const Qe=_e===At;return a.jsxs("button",{type:"button",onMouseDown:Re=>{Re.stopPropagation(),ke(At),n(Ke.toolId),Xe(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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:Ke.icon}),a.jsx("span",{className:"flex-1",children:Ke.label}),Qe&&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"})})})]},Ke.toolId)})}),De==="shape"&&a.jsx(Os,{top:250,panelRef:Yt,isLight:Je,children:qr.map((Ke,At)=>{const Qe=Ie===At;return a.jsxs("button",{type:"button",onMouseDown:Re=>{Re.stopPropagation(),$e(At),n(Ke.toolId),Xe(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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:Ke.icon}),a.jsx("span",{className:"flex-1",children:Ke.label}),Qe&&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"})})})]},Ke.toolId)})}),Be&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{ge(!1),Te(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:GA,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${Je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Je?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${Je?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),i!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${Je?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:Ht.map(Ke=>a.jsx(XA,{item:Ke},Ke.key))})]})]})]})};function VT(i){return tA({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 zT={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},WT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},RT={binance:"CRYPTO"},GT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Vt(),o=s==="light",[l,c]=Y.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),m=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 L=b.indexOf(U),K=b.indexOf(F);return L!==-1&&K!==-1?L-K:L!==-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(NT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(J1,{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:`
9
+ }`,iT=function(A){rT(A,"."+rl+tT+nd+`
10
+ .`+nl+AT+nd)},rT=function(A,e){var t=A.ownerDocument;if(t){var i=t.createElement("style");i.textContent=e,A.appendChild(i)}},sd=(function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),nT=(function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(ol(e)||lT(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return sA(this,void 0,void 0,function(){var t,i,r,n,s=this;return tA(this,function(o){switch(o.label){case 0:return t=sd.isSameOrigin(e),i=!sl(e)&&this._options.useCORS===!0&&Jt.SUPPORT_CORS_IMAGES&&!t,r=!sl(e)&&!t&&!ol(e)&&typeof this._options.proxy=="string"&&Jt.SUPPORT_CORS_XHR&&!i,!t&&this._options.allowTaint===!1&&!sl(e)&&!ol(e)&&!r&&!i?[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 h=new Image;h.onload=function(){return l(h)},h.onerror=c,(cT(n)||i)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return l(h)},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()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var o=Jt.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(v){return s(v)},!1),m.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=i.indexOf("?")>-1?"&":"?";if(l.open("GET",""+i+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var h=t._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+r)}}l.send()})},A})(),sT=/^data:image\/svg\+xml/i,oT=/^data:image\/.*;base64,/i,aT=/^data:image\/.*/i,lT=function(A){return Jt.SUPPORT_SVG_DRAWING||!hT(A)},sl=function(A){return aT.test(A)},cT=function(A){return oT.test(A)},ol=function(A){return A.substr(0,4)==="blob"},hT=function(A){return A.substr(-3).toLowerCase()==="svg"||sT.test(A)},Pe=(function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A})(),Ar=function(A,e,t){return new Pe(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},Hs=(function(){function A(e,t,i,r){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=r}return A.prototype.subdivide=function(e,t){var i=Ar(this.start,this.startControl,e),r=Ar(this.startControl,this.endControl,e),n=Ar(this.endControl,this.end,e),s=Ar(i,r,e),o=Ar(r,n,e),l=Ar(s,o,e);return t?new A(this.start,i,s,l):new A(l,o,n,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),UA=function(A){return A.type===1},uT=(function(){function A(e){var t=e.styles,i=e.bounds,r=Kr(t.borderTopLeftRadius,i.width,i.height),n=r[0],s=r[1],o=Kr(t.borderTopRightRadius,i.width,i.height),l=o[0],c=o[1],h=Kr(t.borderBottomRightRadius,i.width,i.height),m=h[0],v=h[1],x=Kr(t.borderBottomLeftRadius,i.width,i.height),F=x[0],T=x[1],S=[];S.push((n+l)/i.width),S.push((F+m)/i.width),S.push((s+T)/i.height),S.push((c+v)/i.height);var I=Math.max.apply(Math,S);I>1&&(n/=I,s/=I,l/=I,c/=I,m/=I,v/=I,F/=I,T/=I);var Q=i.width-l,N=i.height-v,J=i.width-m,H=i.height-T,z=t.borderTopWidth,re=t.borderRightWidth,q=t.borderBottomWidth,ie=t.borderLeftWidth,G=xt(t.paddingTop,e.bounds.width),ne=xt(t.paddingRight,e.bounds.width),le=xt(t.paddingBottom,e.bounds.width),ee=xt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?St(i.left+ie/3,i.top+z/3,n-ie/3,s-z/3,gt.TOP_LEFT):new Pe(i.left+ie/3,i.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?St(i.left+Q,i.top+z/3,l-re/3,c-z/3,gt.TOP_RIGHT):new Pe(i.left+i.width-re/3,i.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||v>0?St(i.left+J,i.top+N,m-re/3,v-q/3,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re/3,i.top+i.height-q/3),this.bottomLeftBorderDoubleOuterBox=F>0||T>0?St(i.left+ie/3,i.top+H,F-ie/3,T-q/3,gt.BOTTOM_LEFT):new Pe(i.left+ie/3,i.top+i.height-q/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?St(i.left+ie*2/3,i.top+z*2/3,n-ie*2/3,s-z*2/3,gt.TOP_LEFT):new Pe(i.left+ie*2/3,i.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?St(i.left+Q,i.top+z*2/3,l-re*2/3,c-z*2/3,gt.TOP_RIGHT):new Pe(i.left+i.width-re*2/3,i.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||v>0?St(i.left+J,i.top+N,m-re*2/3,v-q*2/3,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re*2/3,i.top+i.height-q*2/3),this.bottomLeftBorderDoubleInnerBox=F>0||T>0?St(i.left+ie*2/3,i.top+H,F-ie*2/3,T-q*2/3,gt.BOTTOM_LEFT):new Pe(i.left+ie*2/3,i.top+i.height-q*2/3),this.topLeftBorderStroke=n>0||s>0?St(i.left+ie/2,i.top+z/2,n-ie/2,s-z/2,gt.TOP_LEFT):new Pe(i.left+ie/2,i.top+z/2),this.topRightBorderStroke=n>0||s>0?St(i.left+Q,i.top+z/2,l-re/2,c-z/2,gt.TOP_RIGHT):new Pe(i.left+i.width-re/2,i.top+z/2),this.bottomRightBorderStroke=m>0||v>0?St(i.left+J,i.top+N,m-re/2,v-q/2,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re/2,i.top+i.height-q/2),this.bottomLeftBorderStroke=F>0||T>0?St(i.left+ie/2,i.top+H,F-ie/2,T-q/2,gt.BOTTOM_LEFT):new Pe(i.left+ie/2,i.top+i.height-q/2),this.topLeftBorderBox=n>0||s>0?St(i.left,i.top,n,s,gt.TOP_LEFT):new Pe(i.left,i.top),this.topRightBorderBox=l>0||c>0?St(i.left+Q,i.top,l,c,gt.TOP_RIGHT):new Pe(i.left+i.width,i.top),this.bottomRightBorderBox=m>0||v>0?St(i.left+J,i.top+N,m,v,gt.BOTTOM_RIGHT):new Pe(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=F>0||T>0?St(i.left,i.top+H,F,T,gt.BOTTOM_LEFT):new Pe(i.left,i.top+i.height),this.topLeftPaddingBox=n>0||s>0?St(i.left+ie,i.top+z,Math.max(0,n-ie),Math.max(0,s-z),gt.TOP_LEFT):new Pe(i.left+ie,i.top+z),this.topRightPaddingBox=l>0||c>0?St(i.left+Math.min(Q,i.width-re),i.top+z,Q>i.width+re?0:Math.max(0,l-re),Math.max(0,c-z),gt.TOP_RIGHT):new Pe(i.left+i.width-re,i.top+z),this.bottomRightPaddingBox=m>0||v>0?St(i.left+Math.min(J,i.width-ie),i.top+Math.min(N,i.height-q),Math.max(0,m-re),Math.max(0,v-q),gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re,i.top+i.height-q),this.bottomLeftPaddingBox=F>0||T>0?St(i.left+ie,i.top+Math.min(H,i.height-q),Math.max(0,F-ie),Math.max(0,T-q),gt.BOTTOM_LEFT):new Pe(i.left+ie,i.top+i.height-q),this.topLeftContentBox=n>0||s>0?St(i.left+ie+ee,i.top+z+G,Math.max(0,n-(ie+ee)),Math.max(0,s-(z+G)),gt.TOP_LEFT):new Pe(i.left+ie+ee,i.top+z+G),this.topRightContentBox=l>0||c>0?St(i.left+Math.min(Q,i.width+ie+ee),i.top+z+G,Q>i.width+ie+ee?0:l-ie+ee,c-(z+G),gt.TOP_RIGHT):new Pe(i.left+i.width-(re+ne),i.top+z+G),this.bottomRightContentBox=m>0||v>0?St(i.left+Math.min(J,i.width-(ie+ee)),i.top+Math.min(N,i.height+z+G),Math.max(0,m-(re+ne)),v-(q+le),gt.BOTTOM_RIGHT):new Pe(i.left+i.width-(re+ne),i.top+i.height-(q+le)),this.bottomLeftContentBox=F>0||T>0?St(i.left+ie+ee,i.top+H,Math.max(0,F-(ie+ee)),T-(q+le),gt.BOTTOM_LEFT):new Pe(i.left+ie+ee,i.top+i.height-(q+le))}return A})(),gt;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(gt||(gt={}));var St=function(A,e,t,i,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=i*n,l=A+t,c=e+i;switch(r){case gt.TOP_LEFT:return new Hs(new Pe(A,c),new Pe(A,c-o),new Pe(l-s,e),new Pe(l,e));case gt.TOP_RIGHT:return new Hs(new Pe(A,e),new Pe(A+s,e),new Pe(l,c-o),new Pe(l,c));case gt.BOTTOM_RIGHT:return new Hs(new Pe(l,e),new Pe(l,e+o),new Pe(A+s,c),new Pe(A,c));case gt.BOTTOM_LEFT:default:return new Hs(new Pe(l,c),new Pe(l-s,c),new Pe(A,e+o),new Pe(A,e))}},Is=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},pT=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Ps=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},dT=(function(){function A(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6}return A})(),Ds=(function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A})(),fT=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),gT=function(A){return A.type===0},od=function(A){return A.type===1},mT=function(A){return A.type===2},ad=function(A,e){return A.length===e.length?A.some(function(t,i){return t===e[i]}):!1},wT=function(A,e,t,i,r){return A.map(function(n,s){switch(s){case 0:return n.add(e,t);case 1:return n.add(e+i,t);case 2:return n.add(e+i,t+r);case 3:return n.add(e,t+r)}return n})},ld=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),cd=(function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new uT(this.container),this.container.styles.opacity<1&&this.effects.push(new fT(this.container.styles.opacity)),this.container.styles.transform!==null){var i=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 dT(i,r,n))}if(this.container.styles.overflowX!==0){var s=Is(this.curves),o=Ps(this.curves);ad(s,o)?this.effects.push(new Ds(s,6)):(this.effects.push(new Ds(s,2)),this.effects.push(new Ds(o,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,i=this.parent,r=this.effects.slice(0);i;){var n=i.effects.filter(function(l){return!od(l)});if(t||i.container.styles.position!==0||!i.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(i.container.styles.position)===-1,i.container.styles.overflowX!==0){var s=Is(i.curves),o=Ps(i.curves);ad(s,o)||r.unshift(new Ds(o,6))}}else r.unshift.apply(r,n);i=i.parent}return r.filter(function(l){return Kt(l.target,e)})},A})(),al=function(A,e,t,i){A.container.elements.forEach(function(r){var n=Kt(r.flags,4),s=Kt(r.flags,2),o=new cd(r,A);Kt(r.styles.display,2048)&&i.push(o);var l=Kt(r.flags,8)?[]:i;if(n||s){var c=n||r.styles.isPositioned()?t:e,h=new ld(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var v=0;c.negativeZIndex.some(function(F,T){return m>F.element.container.styles.zIndex.order?(v=T,!1):v>0}),c.negativeZIndex.splice(v,0,h)}else if(m>0){var x=0;c.positiveZIndex.some(function(F,T){return m>=F.element.container.styles.zIndex.order?(x=T+1,!1):x>0}),c.positiveZIndex.splice(x,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);al(o,h,n?h:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),al(o,e,t,l);Kt(r.flags,8)&&hd(r,l)})},hd=function(A,e){for(var t=A instanceof Ya?A.start:1,i=A instanceof Ya?A.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Dp&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=$r(t,n.container.styles.listStyleType,!0),t+=i?-1:1}},BT=function(A){var e=new cd(A,null),t=new ld(e),i=[];return al(e,t,t,i),hd(e.container,i),t},ud=function(A,e){switch(e){case 0:return SA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return SA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return SA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return SA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},yT=function(A,e){switch(e){case 0:return SA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return SA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return SA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return SA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},CT=function(A,e){switch(e){case 0:return SA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return SA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return SA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return SA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},vT=function(A,e){switch(e){case 0:return _s(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return _s(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return _s(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return _s(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},_s=function(A,e){var t=[];return UA(A)?t.push(A.subdivide(.5,!1)):t.push(A),UA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},SA=function(A,e,t,i){var r=[];return UA(A)?r.push(A.subdivide(.5,!1)):r.push(A),UA(t)?r.push(t.subdivide(.5,!0)):r.push(t),UA(i)?r.push(i.subdivide(.5,!0).reverse()):r.push(i),UA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},pd=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},ks=function(A){var e=A.styles,t=A.bounds,i=xt(e.paddingLeft,t.width),r=xt(e.paddingRight,t.width),n=xt(e.paddingTop,t.width),s=xt(e.paddingBottom,t.width);return t.add(i+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+i+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},TT=function(A,e){return A===0?e.bounds:A===2?ks(e):pd(e)},bT=function(A,e){return A===0?e.bounds:A===2?ks(e):pd(e)},ll=function(A,e,t){var i=TT(rr(A.styles.backgroundOrigin,e),A),r=bT(rr(A.styles.backgroundClip,e),A),n=xT(rr(A.styles.backgroundSize,e),t,i),s=n[0],o=n[1],l=Kr(rr(A.styles.backgroundPosition,e),i.width-s,i.height-o),c=QT(rr(A.styles.backgroundRepeat,e),l,n,i,r),h=Math.round(i.left+l[0]),m=Math.round(i.top+l[1]);return[c,h,m,s,o]},ir=function(A){return yt(A)&&A.value===qi.AUTO},Os=function(A){return typeof A=="number"},xT=function(A,e,t){var i=e[0],r=e[1],n=e[2],s=A[0],o=A[1];if(!s)return[0,0];if(Ot(s)&&o&&Ot(o))return[xt(s,t.width),xt(o,t.height)];var l=Os(n);if(yt(s)&&(s.value===qi.CONTAIN||s.value===qi.COVER)){if(Os(n)){var c=t.width/t.height;return c<n!=(s.value===qi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var h=Os(i),m=Os(r),v=h||m;if(ir(s)&&(!o||ir(o))){if(h&&m)return[i,r];if(!l&&!v)return[t.width,t.height];if(v&&l){var x=h?i:r*n,F=m?r:i/n;return[x,F]}var T=h?i:t.width,S=m?r:t.height;return[T,S]}if(l){var I=0,Q=0;return Ot(s)?I=xt(s,t.width):Ot(o)&&(Q=xt(o,t.height)),ir(s)?I=Q*n:(!o||ir(o))&&(Q=I/n),[I,Q]}var N=null,J=null;if(Ot(s)?N=xt(s,t.width):o&&Ot(o)&&(J=xt(o,t.height)),N!==null&&(!o||ir(o))&&(J=h&&m?N/i*r:t.height),J!==null&&ir(s)&&(N=h&&m?J/r*i:t.width),N!==null&&J!==null)return[N,J];throw new Error("Unable to calculate background-size for element")},rr=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},QT=function(A,e,t,i,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(A){case 2:return[new Pe(Math.round(i.left),Math.round(i.top+s)),new Pe(Math.round(i.left+i.width),Math.round(i.top+s)),new Pe(Math.round(i.left+i.width),Math.round(l+i.top+s)),new Pe(Math.round(i.left),Math.round(l+i.top+s))];case 3:return[new Pe(Math.round(i.left+n),Math.round(i.top)),new Pe(Math.round(i.left+n+o),Math.round(i.top)),new Pe(Math.round(i.left+n+o),Math.round(i.height+i.top)),new Pe(Math.round(i.left+n),Math.round(i.height+i.top))];case 1:return[new Pe(Math.round(i.left+n),Math.round(i.top+s)),new Pe(Math.round(i.left+n+o),Math.round(i.top+s)),new Pe(Math.round(i.left+n+o),Math.round(i.top+s+l)),new Pe(Math.round(i.left+n),Math.round(i.top+s+l))];default:return[new Pe(Math.round(r.left),Math.round(r.top)),new Pe(Math.round(r.left+r.width),Math.round(r.top)),new Pe(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Pe(Math.round(r.left),Math.round(r.height+r.top))]}},FT="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",dd="Hidden Text",UT=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var i=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;i.style.visibility="hidden",i.style.fontFamily=e,i.style.fontSize=t,i.style.margin="0",i.style.padding="0",i.style.whiteSpace="nowrap",s.appendChild(i),r.src=FT,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(dd)),i.appendChild(n),i.appendChild(r);var o=r.offsetTop-n.offsetTop+2;i.removeChild(n),i.appendChild(this._document.createTextNode(dd)),i.style.lineHeight="normal",r.style.verticalAlign="super";var l=r.offsetTop-i.offsetTop+2;return s.removeChild(i),{baseline:o,middle:l}},A.prototype.getMetrics=function(e,t){var i=e+" "+t;return typeof this._data[i]>"u"&&(this._data[i]=this.parseMetrics(e,t)),this._data[i]},A})(),fd=(function(){function A(e,t){this.context=e,this.options=t}return A})(),ST=1e4,ET=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r._activeEffects=[],r.canvas=i.canvas?i.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),i.canvas||(r.canvas.width=Math.floor(i.width*i.scale),r.canvas.height=Math.floor(i.height*i.scale),r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px"),r.fontMetrics=new UT(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-i.x,-i.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+i.width+"x"+i.height+") with scale "+i.scale),r}return e.prototype.applyEffects=function(t){for(var i=this;this._activeEffects.length;)this.popEffect();t.forEach(function(r){return i.applyEffect(r)})},e.prototype.applyEffect=function(t){this.ctx.save(),mT(t)&&(this.ctx.globalAlpha=t.opacity),gT(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 sA(this,void 0,void 0,function(){var i;return tA(this,function(r){switch(r.label){case 0:return i=t.element.container.styles,i.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return sA(this,void 0,void 0,function(){return tA(this,function(i){switch(i.label){case 0:if(Kt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return i.sent(),[4,this.renderNodeContent(t)];case 2:i.sent(),i.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,i,r){var n=this;if(i===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=Za(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 i=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=PT(t.fontFamily).join(", "),n=Nr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,i,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,i){return sA(this,void 0,void 0,function(){var r,n,s,o,l,c,h,m,v=this;return tA(this,function(x){return r=this.createFontStyle(i),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=i.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,h=l.middle,m=i.paintOrder,t.textBounds.forEach(function(F){m.forEach(function(T){switch(T){case 0:v.ctx.fillStyle=Gt(i.color),v.renderTextWithLetterSpacing(F,i.letterSpacing,c);var S=i.textShadow;S.length&&F.text.trim().length&&(S.slice(0).reverse().forEach(function(I){v.ctx.shadowColor=Gt(I.color),v.ctx.shadowOffsetX=I.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=I.offsetY.number*v.options.scale,v.ctx.shadowBlur=I.blur.number,v.renderTextWithLetterSpacing(F,i.letterSpacing,c)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),i.textDecorationLine.length&&(v.ctx.fillStyle=Gt(i.textDecorationColor||i.color),i.textDecorationLine.forEach(function(I){switch(I){case 1:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top+c),F.bounds.width,1);break;case 2:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top),F.bounds.width,1);break;case 3:v.ctx.fillRect(F.bounds.left,Math.ceil(F.bounds.top+h),F.bounds.width,1);break}}));break;case 1:i.webkitTextStrokeWidth&&F.text.trim().length&&(v.ctx.strokeStyle=Gt(i.webkitTextStrokeColor),v.ctx.lineWidth=i.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(F.text,F.bounds.left,F.bounds.top+c)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,i,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=ks(t),s=Ps(i);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 sA(this,void 0,void 0,function(){var i,r,n,s,o,l,Q,Q,c,h,m,v,J,x,F,H,T,S,I,Q,N,J,H;return tA(this,function(z){switch(z.label){case 0:this.applyEffects(t.getEffects(4)),i=t.container,r=t.curves,n=i.styles,s=0,o=i.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(!(i instanceof Hp))return[3,8];z.label=5;case 5:return z.trys.push([5,7,,8]),[4,this.context.cache.match(i.src)];case 6:return Q=z.sent(),this.renderReplacedElement(i,r,Q),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+i.src),[3,8];case 8:if(i instanceof Ip&&this.renderReplacedElement(i,r,i.canvas),!(i instanceof Pp))return[3,12];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(i.svg)];case 10:return Q=z.sent(),this.renderReplacedElement(i,r,Q),[3,12];case 11:return z.sent(),this.context.logger.error("Error loading svg "+i.svg.substring(0,255)),[3,12];case 12:return i instanceof Np&&i.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:i.backgroundColor,x:0,y:0,width:i.width,height:i.height}),[4,c.render(i.tree)]):[3,14];case 13:h=z.sent(),i.width&&i.height&&this.ctx.drawImage(h,0,0,i.width,i.height,i.bounds.left,i.bounds.top,i.bounds.width,i.bounds.height),z.label=14;case 14:if(i instanceof qa&&(m=Math.min(i.bounds.width,i.bounds.height),i.type===Fs?i.checked&&(this.ctx.save(),this.path([new Pe(i.bounds.left+m*.39363,i.bounds.top+m*.79),new Pe(i.bounds.left+m*.16,i.bounds.top+m*.5549),new Pe(i.bounds.left+m*.27347,i.bounds.top+m*.44071),new Pe(i.bounds.left+m*.39694,i.bounds.top+m*.5649),new Pe(i.bounds.left+m*.72983,i.bounds.top+m*.23),new Pe(i.bounds.left+m*.84,i.bounds.top+m*.34085),new Pe(i.bounds.left+m*.39363,i.bounds.top+m*.79)]),this.ctx.fillStyle=Gt(_p),this.ctx.fill(),this.ctx.restore()):i.type===Us&&i.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(i.bounds.left+m/2,i.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Gt(_p),this.ctx.fill(),this.ctx.restore())),LT(i)&&i.value.length){switch(v=this.createFontStyle(n),J=v[0],x=v[1],F=this.fontMetrics.getMetrics(J,x).baseline,this.ctx.font=J,this.ctx.fillStyle=Gt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=HT(i.styles.textAlign),H=ks(i),T=0,i.styles.textAlign){case 1:T+=H.width/2;break;case 2:T+=H.width;break}S=H.add(T,0,0,-H.height/2+1),this.ctx.save(),this.path([new Pe(H.left,H.top),new Pe(H.left+H.width,H.top),new Pe(H.left+H.width,H.top+H.height),new Pe(H.left,H.top+H.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Gr(i.value,S),n.letterSpacing,F),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Kt(i.styles.display,2048))return[3,20];if(i.styles.listStyleImage===null)return[3,19];if(I=i.styles.listStyleImage,I.type!==0)return[3,18];Q=void 0,N=I.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return Q=z.sent(),this.ctx.drawImage(Q,i.bounds.left-(Q.width+10),i.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&&i.styles.listStyleType!==-1&&(J=this.createFontStyle(n)[0],this.ctx.font=J,this.ctx.fillStyle=Gt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",H=new ti(i.bounds.left,i.bounds.top+xt(i.styles.paddingTop,i.bounds.width),i.bounds.width,dp(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Gr(t.listValue,H),n.letterSpacing,dp(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 sA(this,void 0,void 0,function(){var i,r,I,n,s,I,o,l,I,c,h,I,m,v,I,x,F,I,T,S,I;return tA(this,function(Q){switch(Q.label){case 0:if(Kt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:Q.sent(),i=0,r=t.negativeZIndex,Q.label=2;case 2:return i<r.length?(I=r[i],[4,this.renderStack(I)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return i++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:Q.sent(),n=0,s=t.nonInlineLevel,Q.label=7;case 7:return n<s.length?(I=s[n],[4,this.renderNode(I)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,Q.label=11;case 11:return o<l.length?(I=l[o],[4,this.renderStack(I)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,Q.label=15;case 15:return c<h.length?(I=h[c],[4,this.renderStack(I)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return c++,[3,15];case 18:m=0,v=t.inlineLevel,Q.label=19;case 19:return m<v.length?(I=v[m],[4,this.renderNode(I)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return m++,[3,19];case 22:x=0,F=t.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return x<F.length?(I=F[x],[4,this.renderStack(I)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return x++,[3,23];case 26:T=0,S=t.positiveZIndex,Q.label=27;case 27:return T<S.length?(I=S[T],[4,this.renderStack(I)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return T++,[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 i=this;t.forEach(function(r,n){var s=UA(r)?r.start:r;n===0?i.ctx.moveTo(s.x,s.y):i.ctx.lineTo(s.x,s.y),UA(r)&&i.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,i,r,n){this.path(t),this.ctx.fillStyle=i,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,i,r){var n;if(t.width===i&&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,i),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,i,r),o},e.prototype.renderBackgroundImage=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l;return tA(this,function(c){switch(c.label){case 0:i=t.styles.backgroundImage.length-1,r=function(h){var m,v,x,G,ge,ae,ee,we,q,F,G,ge,ae,ee,we,T,S,I,Q,N,J,H,z,re,q,ie,G,ne,le,ee,we,j,ge,ae,pe,ue,oe,fe,Qe,me,xe,Se;return tA(this,function(Me){switch(Me.label){case 0:if(h.type!==0)return[3,5];m=void 0,v=h.url,Me.label=1;case 1:return Me.trys.push([1,3,,4]),[4,n.context.cache.match(v)];case 2:return m=Me.sent(),[3,4];case 3:return Me.sent(),n.context.logger.error("Error loading background-image "+v),[3,4];case 4:return m&&(x=ll(t,i,[m.width,m.height,m.width/m.height]),G=x[0],ge=x[1],ae=x[2],ee=x[3],we=x[4],q=n.ctx.createPattern(n.resizeImage(m,ee,we),"repeat"),n.renderRepeat(G,q,ge,ae)),[3,6];case 5:gy(h)?(F=ll(t,i,[null,null,null]),G=F[0],ge=F[1],ae=F[2],ee=F[3],we=F[4],T=hy(h.angle,ee,we),S=T[0],I=T[1],Q=T[2],N=T[3],J=T[4],H=document.createElement("canvas"),H.width=ee,H.height=we,z=H.getContext("2d"),re=z.createLinearGradient(I,N,Q,J),ip(h.stops,S).forEach(function($e){return re.addColorStop($e.stop,Gt($e.color))}),z.fillStyle=re,z.fillRect(0,0,ee,we),ee>0&&we>0&&(q=n.ctx.createPattern(H,"repeat"),n.renderRepeat(G,q,ge,ae))):my(h)&&(ie=ll(t,i,[null,null,null]),G=ie[0],ne=ie[1],le=ie[2],ee=ie[3],we=ie[4],j=h.position.length===0?[Pa]:h.position,ge=xt(j[0],ee),ae=xt(j[j.length-1],we),pe=uy(h,ge,ae,ee,we),ue=pe[0],oe=pe[1],ue>0&&oe>0&&(fe=n.ctx.createRadialGradient(ne+ge,le+ae,0,ne+ge,le+ae,ue),ip(h.stops,ue*2).forEach(function($e){return fe.addColorStop($e.stop,Gt($e.color))}),n.path(G),n.ctx.fillStyle=fe,ue!==oe?(Qe=t.bounds.left+.5*t.bounds.width,me=t.bounds.top+.5*t.bounds.height,xe=oe/ue,Se=1/xe,n.ctx.save(),n.ctx.translate(Qe,me),n.ctx.transform(1,0,0,xe,0,0),n.ctx.translate(-Qe,-me),n.ctx.fillRect(ne,Se*(le-me)+me,ee,we*Se),n.ctx.restore()):n.ctx.fill())),Me.label=6;case 6:return i--,[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,i,r){return sA(this,void 0,void 0,function(){return tA(this,function(n){return this.path(ud(r,i)),this.ctx.fillStyle=Gt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,i,r,n){return sA(this,void 0,void 0,function(){var s,o;return tA(this,function(l){switch(l.label){case 0:return i<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=yT(n,r),this.path(s),this.ctx.fillStyle=Gt(t),this.ctx.fill(),o=CT(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l,c,h,m=this;return tA(this,function(v){switch(v.label){case 0:return this.applyEffects(t.getEffects(2)),i=t.container.styles,r=!wi(i.backgroundColor)||i.backgroundImage.length,n=[{style:i.borderTopStyle,color:i.borderTopColor,width:i.borderTopWidth},{style:i.borderRightStyle,color:i.borderRightColor,width:i.borderRightWidth},{style:i.borderBottomStyle,color:i.borderBottomColor,width:i.borderBottomWidth},{style:i.borderLeftStyle,color:i.borderLeftColor,width:i.borderLeftWidth}],s=MT(rr(i.backgroundClip,0),t.curves),r||i.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),wi(i.backgroundColor)||(this.ctx.fillStyle=Gt(i.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),i.boxShadow.slice(0).reverse().forEach(function(x){m.ctx.save();var F=Is(t.curves),T=x.inset?0:ST,S=wT(F,-T+(x.inset?1:-1)*x.spread.number,(x.inset?1:-1)*x.spread.number,x.spread.number*(x.inset?-2:2),x.spread.number*(x.inset?-2:2));x.inset?(m.path(F),m.ctx.clip(),m.mask(S)):(m.mask(F),m.ctx.clip(),m.path(S)),m.ctx.shadowOffsetX=x.offsetX.number+T,m.ctx.shadowOffsetY=x.offsetY.number,m.ctx.shadowColor=Gt(x.color),m.ctx.shadowBlur=x.blur.number,m.ctx.fillStyle=x.inset?Gt(x.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),v.label=2;case 2:o=0,l=0,c=n,v.label=3;case 3:return l<c.length?(h=c[l],h.style!==0&&!wi(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return v.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,t.curves)];case 10:v.sent(),v.label=11;case 11:o++,v.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,i,r,n,s){return sA(this,void 0,void 0,function(){var o,l,c,h,m,v,x,F,T,S,I,Q,N,J,H,z,H,z;return tA(this,function(re){return this.ctx.save(),o=vT(n,r),l=ud(n,r),s===2&&(this.path(l),this.ctx.clip()),UA(l[0])?(c=l[0].start.x,h=l[0].start.y):(c=l[0].x,h=l[0].y),UA(l[1])?(m=l[1].end.x,v=l[1].end.y):(m=l[1].x,v=l[1].y),r===0||r===2?x=Math.abs(c-m):x=Math.abs(h-v),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),F=i<3?i*3:i*2,T=i<3?i*2:i,s===3&&(F=i,T=i),S=!0,x<=F*2?S=!1:x<=F*2+T?(I=x/(2*F+T),F*=I,T*=I):(Q=Math.floor((x+T)/(F+T)),N=(x-Q*F)/(Q-1),J=(x-(Q+1)*F)/Q,T=J<=0||Math.abs(T-N)<Math.abs(T-J)?N:J),S&&(s===3?this.ctx.setLineDash([0,F+T]):this.ctx.setLineDash([F,T])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=i):this.ctx.lineWidth=i*2+1.1,this.ctx.strokeStyle=Gt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(UA(l[0])&&(H=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Pe(H.end.x,H.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke()),UA(l[1])&&(H=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Pe(H.end.x,H.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return sA(this,void 0,void 0,function(){var i;return tA(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Gt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),i=BT(t),[4,this.renderStack(i)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(fd),LT=function(A){return A instanceof Op||A instanceof kp?!0:A instanceof qa&&A.type!==Us&&A.type!==Fs},MT=function(A,e){switch(A){case 0:return Is(e);case 2:return pT(e);default:return Ps(e)}},HT=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},IT=["-apple-system","system-ui"],PT=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return IT.indexOf(e)===-1}):A},DT=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.canvas=i.canvas?i.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=i,r.canvas.width=Math.floor(i.width*i.scale),r.canvas.height=Math.floor(i.height*i.scale),r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-i.x,-i.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+i.width+"x"+i.height+" at "+i.x+","+i.y+") with scale "+i.scale),r}return e.prototype.render=function(t){return sA(this,void 0,void 0,function(){var i,r;return tA(this,function(n){switch(n.label){case 0:return i=Ja(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,_T(i)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Gt(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})(fd),_T=function(A){return new Promise(function(e,t){var i=new Image;i.onload=function(){e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},kT=(function(){function A(e){var t=e.id,i=e.enabled;this.id=t,this.enabled=i,this.start=Date.now()}return A.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,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.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,$n([this.id,this.getTime()+"ms"],e))},A.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,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.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,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),OT=(function(){function A(e,t){var i;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new kT({id:this.instanceName,enabled:e.logging}),this.cache=(i=e.cache)!==null&&i!==void 0?i:new nT(this,e)}return A.instanceCount=1,A})(),NT=function(A,e){return e===void 0&&(e={}),KT(A,e)};typeof window<"u"&&sd.setContext(window);var KT=function(A,e){return sA(void 0,void 0,void 0,function(){var t,i,r,n,s,o,l,c,h,m,v,x,F,T,S,I,Q,N,J,H,re,z,re,q,ie,G,ne,le,ee,we,j,ge,ae,pe,ue,oe,fe,Qe,me,xe;return tA(this,function(Se){switch(Se.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(i=t.defaultView,!i)throw new Error("Document is not attached to a Window");return r={allowTaint:(q=e.allowTaint)!==null&&q!==void 0?q:!1,imageTimeout:(ie=e.imageTimeout)!==null&&ie!==void 0?ie:15e3,proxy:e.proxy,useCORS:(G=e.useCORS)!==null&&G!==void 0?G:!1},n=da({logging:(ne=e.logging)!==null&&ne!==void 0?ne:!0,cache:e.cache},r),s={windowWidth:(le=e.windowWidth)!==null&&le!==void 0?le:i.innerWidth,windowHeight:(ee=e.windowHeight)!==null&&ee!==void 0?ee:i.innerHeight,scrollX:(we=e.scrollX)!==null&&we!==void 0?we:i.pageXOffset,scrollY:(j=e.scrollY)!==null&&j!==void 0?j:i.pageYOffset},o=new ti(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new OT(n,o),c=(ge=e.foreignObjectRendering)!==null&&ge!==void 0?ge:!1,h={allowTaint:(ae=e.allowTaint)!==null&&ae!==void 0?ae:!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 rd(l,A,h),v=m.clonedReferenceElement,v?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return x=Se.sent(),F=el(v)||zv(v)?wB(v.ownerDocument):Xn(l,v),T=F.width,S=F.height,I=F.left,Q=F.top,N=zT(l,v,e.backgroundColor),J={canvas:e.canvas,backgroundColor:N,scale:(ue=(pe=e.scale)!==null&&pe!==void 0?pe:i.devicePixelRatio)!==null&&ue!==void 0?ue:1,x:((oe=e.x)!==null&&oe!==void 0?oe:0)+I,y:((fe=e.y)!==null&&fe!==void 0?fe:0)+Q,width:(Qe=e.width)!==null&&Qe!==void 0?Qe:Math.ceil(T),height:(me=e.height)!==null&&me!==void 0?me:Math.ceil(S)},c?(l.logger.debug("Document cloned, using foreign object rendering"),re=new DT(l,J),[4,re.render(v)]):[3,3];case 2:return H=Se.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+I+","+Q+" with size "+T+"x"+S+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=zp(l,v),N===z.styles.backgroundColor&&(z.styles.backgroundColor=ii.TRANSPARENT),l.logger.debug("Starting renderer for element at "+J.x+","+J.y+" with size "+J.width+"x"+J.height),re=new ET(l,J),[4,re.render(z)];case 4:H=Se.sent(),Se.label=5;case 5:return(!((xe=e.removeContainer)!==null&&xe!==void 0)||xe)&&(rd.destroy(x)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,H]}})})},zT=function(A,e,t){var i=e.ownerDocument,r=i.documentElement?zr(A,getComputedStyle(i.documentElement).backgroundColor):ii.TRANSPARENT,n=i.body?zr(A,getComputedStyle(i.body).backgroundColor):ii.TRANSPARENT,s=typeof t=="string"?zr(A,t):t===null?ii.TRANSPARENT:4294967295;return e===i.documentElement?wi(r)?wi(n)?s:n:r:s};const VT=new Set(["primitive","series","priceLine","decoration","textPrimitive","firstLine","secondLine","baseLine","parallelLine"]);function WT(A){const e={};for(const[t,i]of Object.entries(A))VT.has(t)||(e[t]=i);return e}function GT(A,e,t){if(!e)return;const i=`chart_drawings_${e}_${t||"default"}`;try{const r=A.map(WT);localStorage.setItem(i,JSON.stringify(r))}catch{}}function RT(A,e){if(!A)return[];const t=`chart_drawings_${A}_${e||"default"}`;try{const i=localStorage.getItem(t);if(!i)return[];const r=JSON.parse(i);return Array.isArray(r)?r:[]}catch{return[]}}function $T(A,e){if(!A)return;const t=`chart_drawings_${A}_${e||"default"}`;try{localStorage.removeItem(t)}catch{}}class gd{constructor(e,t,i="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=i,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,h=n._series;if(!c||!h)return;const m=h.priceToCoordinate(n.price);if(m==null)return;const v=Math.round(m*o.verticalPixelRatio),x=c.timeScale().timeToCoordinate(n.originTime),F=x==null?0:Math.max(0,Math.round(x*o.horizontalPixelRatio)),T=o.bitmapSize.width;if(F>=T)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(F,v),l.lineTo(T,v),l.stroke(),l.beginPath(),l.fillStyle=n.color;const S=3*o.verticalPixelRatio;l.arc(F,v,S,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 md{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 i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!i.visible||!i.text||!i._series)return;const c=i._series.priceToCoordinate(i.price);if(c==null)return;const h=Math.round(i.fontSize*l);n.font=`${h}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),v=Math.round(14*l),x=s.width;let F;if(i.hAlign==="left")if(i.originTime!=null&&i._chart){const I=i._chart.timeScale().timeToCoordinate(i.originTime);F=I!=null?Math.round(I*o):m,n.textAlign="right"}else F=m,n.textAlign="left";else i.hAlign==="right"?(F=x-m,n.textAlign="right"):(F=x/2,n.textAlign="center");const T=Math.round(c*l);let S;i.vAlign==="top"?S=T-v:i.vAlign==="bottom"?S=T+v:S=T,n.fillStyle=i.textColor,n.fillText(i.text,F,S)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class wd{constructor(e,t,i,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=i,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,h=s._series;if(!c||!h)return;const m=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*m),Q=Math.round(T*v),N=Math.round(F*m),J=Math.round(S*v),H=l.context;if(H.save(),H.beginPath(),H.strokeStyle=s.color,H.lineWidth=s.lineWidth*v,H.setLineDash([]),H.moveTo(I,Q),H.lineTo(N,J),H.stroke(),H.beginPath(),H.fillStyle=s.color,H.arc(I,Q,3*v,0,Math.PI*2),H.fill(),H.beginPath(),H.arc(N,J,3*v,0,Math.PI*2),H.fill(),!s.statsShowAlways&&!s.isActive){H.restore();return}const{priceDiff:z,pricePct:re,bars:q,days:ie,angle:G}=s.info,ne=z>=0?"+":"",le=[];if(s.statsPriceRange!==!1&&le.push(`${ne}${z.toFixed(5)} (${ne}${re.toFixed(2)}%)`),s.statsBarsRange!==!1&&le.push(`${q} bars`),s.statsDateRange!==!1&&le.push(`${ie} days`),s.statsAngle!==!1&&le.push(`∠ ${G.toFixed(1)}°`),s.statsDistance&&le.push(`Δ ${Math.abs(z).toFixed(5)}`),le.length===0){H.restore();return}const ee=Math.round(11*v);H.font=`${ee}px sans-serif`;const we=ee*1.6,j=8*v,ge=Math.max(...le.map(Ye=>H.measureText(Ye).width))+j*2,ae=le.length*we+j*2,pe=s.statsPosition??"right";let ue,oe;pe==="left"?(ue=I,oe=Q):pe==="center"?(ue=Math.round((I+N)/2),oe=Math.round((Q+J)/2)):(ue=N,oe=J);let fe,Qe;pe==="left"?(fe=ue-ge-10*m,Qe=oe-ae-4*v):pe==="center"?(fe=ue-ge/2,Qe=oe-ae-8*v):(fe=ue+10*m,Qe=oe-ae-4*v);const me=l.bitmapSize.width,xe=l.bitmapSize.height,Se=Math.min(Math.max(0,fe),me-ge-4*m),Me=Math.min(Math.max(4*v,Qe),xe-ae-4*v),$e=4*v;H.beginPath(),H.moveTo(Se+$e,Me),H.lineTo(Se+ge-$e,Me),H.quadraticCurveTo(Se+ge,Me,Se+ge,Me+$e),H.lineTo(Se+ge,Me+ae-$e),H.quadraticCurveTo(Se+ge,Me+ae,Se+ge-$e,Me+ae),H.lineTo(Se+$e,Me+ae),H.quadraticCurveTo(Se,Me+ae,Se,Me+ae-$e),H.lineTo(Se,Me+$e),H.quadraticCurveTo(Se,Me,Se+$e,Me),H.closePath(),H.fillStyle="rgba(30, 41, 59, 0.92)",H.fill(),H.strokeStyle=s.statsColor||s.color,H.lineWidth=1*v,H.stroke(),H.fillStyle="#e2e8f0",H.textAlign="left",le.forEach((Ye,Ie)=>{H.fillText(Ye,Se+j,Me+j+ee+Ie*we)}),H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cl{constructor(e,t,i,r={}){this.p1=e,this.p2=t,this.info=i,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,h=s._series;if(!c||!h)return;const m=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*m),Q=Math.round(T*v),N=Math.round(F*m),J=Math.round(S*v),H=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(I,N),Math.min(Q,J),Math.abs(N-I),Math.abs(J-Q)),z.strokeStyle=H,z.lineWidth=1*v,z.setLineDash([]),z.strokeRect(Math.min(I,N),Math.min(Q,J),Math.abs(N-I),Math.abs(J-Q))),z.beginPath(),z.strokeStyle=H,z.lineWidth=2*v,z.moveTo(I,Q),z.lineTo(N,J),z.stroke(),z.fillStyle=H,z.beginPath(),z.arc(I,Q,3*v,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(N,J,3*v,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:re,pricePct:q,bars:ie,days:G}=s.info,ne=re>=0?"+":"",le=[];if(s.statsPriceRange&&le.push(ne+re.toFixed(5)+" ("+ne+q.toFixed(2)+"%)"),s.statsBarsRange&&le.push(ie+" bars"),s.statsDateRange&&le.push(G+" days"),le.length===0){z.restore();return}const ee=Math.round(11*v);z.font=ee+"px sans-serif";const we=ee*1.6,j=8*v,ge=Math.max(...le.map(Se=>z.measureText(Se).width))+j*2,ae=le.length*we+j*2,pe=l.bitmapSize.width,ue=l.bitmapSize.height;let oe,fe;if(s.statsPosition==="left")oe=I-ge-10*m,fe=Q-ae-4*v;else if(s.statsPosition==="center"){const Se=(I+N)/2,Me=(Q+J)/2;oe=Se-ge/2,fe=Me-ae-4*v}else oe=N+10*m,fe=J-ae-4*v;const Qe=Math.min(Math.max(0,oe),pe-ge-4*m),me=Math.min(Math.max(4*v,fe),ue-ae-4*v),xe=4*v;z.beginPath(),z.moveTo(Qe+xe,me),z.lineTo(Qe+ge-xe,me),z.quadraticCurveTo(Qe+ge,me,Qe+ge,me+xe),z.lineTo(Qe+ge,me+ae-xe),z.quadraticCurveTo(Qe+ge,me+ae,Qe+ge-xe,me+ae),z.lineTo(Qe+xe,me+ae),z.quadraticCurveTo(Qe,me+ae,Qe,me+ae-xe),z.lineTo(Qe,me+xe),z.quadraticCurveTo(Qe,me,Qe+xe,me),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||H,z.lineWidth=1*v,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",le.forEach((Se,Me)=>{z.fillText(Se,Qe+j,me+j+ee+Me*we)}),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 Bd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.fillColor=i.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=i.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,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.min(m,v)*c,S=Math.max(m,v)*c,I=Math.min(x,F)*h,Q=Math.max(x,F)*h,N=S-T,J=Q-I;if(N<.5||J<.5)return;const H=s.context;H.save(),H.fillStyle=r.fillColor,H.fillRect(T,I,N,J),H.strokeStyle=r.strokeColor,H.lineWidth=r.lineWidth*h,H.setLineDash([]),H.strokeRect(T,I,N,J),H.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,i={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.lineWidth=i.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,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=v*h,I=x*c,Q=F*h,N=Math.hypot(I-T,Q-S);if(N<.5)return;const J=s.context;J.save(),J.strokeStyle=r.strokeColor,J.lineWidth=r.lineWidth*h,J.setLineDash([]),J.beginPath(),J.arc(T,S,N,0,Math.PI*2),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 Cd{constructor(e,t,i,r={}){this.p1=e,this.p2=t,this.p3=i,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 h=o.horizontalPixelRatio,m=o.verticalPixelRatio,v=l.timeScale().timeToCoordinate(n.p1.rawTime),x=c.priceToCoordinate(n.p1.price),F=l.timeScale().timeToCoordinate(n.p2.rawTime),T=c.priceToCoordinate(n.p2.price),S=l.timeScale().timeToCoordinate(n.p3.rawTime),I=c.priceToCoordinate(n.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*h,N=x*m,J=F*h,H=T*m,z=S*h,re=I*m,q=o.context;q.save(),q.beginPath(),q.moveTo(Q,N),q.lineTo(J,H),q.lineTo(z,re),q.closePath(),q.fillStyle=n.fillColor,q.fill(),q.strokeStyle=n.strokeColor,q.lineWidth=n.lineWidth*m,q.setLineDash([]),q.stroke(),q.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.minorRatio=i.minorRatio??.45,this.previewAsLine=i.previewAsLine??!1,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.lineWidth=i.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,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=v*h,I=x*c,Q=F*h,N=I-T,J=Q-S,H=Math.hypot(N,J);if(H<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*h,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(T,S),z.lineTo(I,Q),z.stroke();else{const re=(T+I)/2,q=(S+Q)/2,ie=Math.atan2(J,N),G=H/2,ne=Math.max(1,G*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(re,q,G,ne,ie,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 hl{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#f59e0b",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight!==!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight??!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.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,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Td{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight!==!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.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,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class bd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft!==!1,this.rayRight=i.rayRight!==!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.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,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class xd{constructor(e,t,i="#22c55e",r=2){this.p1=e,this.p2=t,this.color=i,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 h=n._chart,m=n._series;if(!h||!m)return;const v=o.horizontalPixelRatio,x=o.verticalPixelRatio,F=h.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),T=h.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),S=m.priceToCoordinate(n.p1.price),I=m.priceToCoordinate(n.p2.price);if(F==null||T==null||S==null||I==null)return;const Q=F*v,N=S*x,J=T*v,H=I*x,[z,re,q,ie]=Q<=J?[Q,N,J,H]:[J,H,Q,N];let G=q-z,ne=ie-re;Math.abs(G)<1e-4&&(G=1e-4);const le=ne/G,ee=o.context;if(ee.save(),ee.strokeStyle=n.color,ee.fillStyle=n.color,ee.lineWidth=n.lineWidth*x,ee.setLineDash([]),n.rayLeft){const pe=re+le*(0-z);ee.beginPath(),ee.moveTo(0,pe),ee.lineTo(z,re),ee.stroke()}if(n.rayRight){const ae=o.bitmapSize.width,pe=ie+le*(ae-q);ee.beginPath(),ee.moveTo(q,ie),ee.lineTo(ae,pe),ee.stroke()}const we=Math.atan2(ne,G),j=(n.lineWidth*4+4)*x,ge=Math.PI/7;if(n.arrowRight){const ae=q-j*Math.cos(we-ge),pe=ie-j*Math.sin(we-ge),ue=q-j*Math.cos(we+ge),oe=ie-j*Math.sin(we+ge);ee.beginPath(),ee.moveTo(q,ie),ee.lineTo(ae,pe),ee.lineTo(ue,oe),ee.closePath(),ee.fill()}if(n.arrowLeft){const ae=we+Math.PI,pe=z-j*Math.cos(ae-ge),ue=re-j*Math.sin(ae-ge),oe=z-j*Math.cos(ae+ge),fe=re-j*Math.sin(ae+ge);ee.beginPath(),ee.moveTo(z,re),ee.lineTo(pe,ue),ee.lineTo(oe,fe),ee.closePath(),ee.fill()}if(c){const ae=n.p1.rawTime??n.p1.time,pe=n.p2.rawTime??n.p2.time,ue=n.p1.price,oe=n.p2.price,fe=[];if(n.statsPriceRange){const me=Math.abs(oe-ue),xe=ue!==0?Math.abs((oe-ue)/ue*100):0,Se=me<1e-4?6:me<.01?5:me<1?4:2;fe.push("↕ "+me.toFixed(Se)+" ("+xe.toFixed(2)+"%)")}const Qe=[];if(n.statsBarsRange)try{const me=h.timeScale().timeToCoordinate(ae),xe=h.timeScale().timeToCoordinate(pe);if(me!=null&&xe!=null){const Se=h.timeScale().coordinateToLogical(me),Me=h.timeScale().coordinateToLogical(xe);Se!=null&&Me!=null&&Qe.push("↔ "+Math.abs(Math.round(Me-Se))+" bars")}}catch{}if(n.statsDateRange){const me=Math.abs(pe-ae),xe=Math.floor(me/86400),Se=Math.floor(me%86400/3600),Me=Math.floor(me%3600/60);let $e=xe>0?xe+" day"+(xe!==1?"s":""):"";Se>0&&($e+=($e?" ":"")+Se+" hour"+(Se!==1?"s":"")),!xe&&!Se&&($e=Me+" min"+(Me!==1?"s":"")),n.statsBarsRange&&Qe.length>0?Qe[Qe.length-1]+=" ("+$e+")":Qe.push($e)}if(n.statsDistance){const me=(J-Q)/v,xe=(H-N)/x;Qe.push("distance: "+Math.sqrt(me*me+xe*xe).toFixed(2))}if(Qe.length>0&&fe.push(Qe.join(", ")),n.statsAngle){const me=G/v,xe=ne/x,Se=Math.atan2(xe,me)*180/Math.PI;fe.push("∠ "+Se.toFixed(0)+"°")}if(fe.length>0){const me=Math.min(v,x),xe=11*me,Se=xe*1.5,Me=5*me;ee.font=xe+"px sans-serif";const Ye=fe.reduce((dt,He)=>Math.max(dt,ee.measureText(He).width),0)+Me*2,Ie=fe.length*Se+Me*2;let We,De;n.statsPosition==="left"?(We=z,De=re):n.statsPosition==="center"?(We=(z+q)/2,De=(re+ie)/2):(We=q,De=ie);const Ze=We-Ye/2,nt=De-Ie-12*me;ee.fillStyle="rgba(20, 20, 30, 0.72)",ee.fillRect(Ze,nt,Ye,Ie),ee.strokeStyle=n.statsColor,ee.lineWidth=1*me,ee.strokeRect(Ze,nt,Ye,Ie),ee.fillStyle=n.statsColor,ee.textBaseline="top",ee.textAlign="left",fe.forEach((dt,He)=>{ee.fillText(dt,Ze+Me,nt+Me+He*Se)})}}ee.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{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 i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=s.timeScale().timeToCoordinate(i.center.rawTime),m=o.priceToCoordinate(i.center.price);if(h==null||m==null)return;const v=Math.round(h*l),x=Math.round(m*c),F=n.bitmapSize.width,T=n.bitmapSize.height,S=n.context;if(S.save(),S.strokeStyle=i.color,S.lineWidth=i.lineWidth*c,S.setLineDash([]),S.beginPath(),S.moveTo(0,x),S.lineTo(F,x),S.stroke(),S.beginPath(),S.moveTo(v,0),S.lineTo(v,T),S.stroke(),i.showPrice){const I=i.center.price.toFixed(5),Q=Math.round(11*c);S.font=Q+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="left";const N=S.measureText(I).width,J=Math.round(6*l),H=Math.round(3*c),z=Q+2*H,re=N+2*J,q=F-re-Math.round(2*l),ie=x-z/2;S.fillStyle=i.color,S.fillRect(q,ie,re,z),S.fillStyle="#ffffff",S.fillText(I,q+J,x)}if(i.showTime){const I=i.center.rawTime,Q=new Date(I*1e3),N=ee=>String(ee).padStart(2,"0"),J=N(Q.getUTCDate())+"."+N(Q.getUTCMonth()+1)+"."+Q.getUTCFullYear()+" "+N(Q.getUTCHours())+":"+N(Q.getUTCMinutes())+":"+N(Q.getUTCSeconds()),H=Math.round(11*c);S.font=H+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="center";const z=S.measureText(J).width,re=Math.round(6*l),q=Math.round(3*c),ie=H+2*q,G=z+2*re,ne=v-G/2,le=T-ie-Math.round(4*c);S.fillStyle=i.color,S.fillRect(ne,le,G,ie),S.fillStyle="#ffffff",S.fillText(J,v,le+ie/2)}S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Fd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight??!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsDistance=i.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,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=x*h,I=v*c,Q=F*h,N=T-I,J=S-Q,H=I-T,z=Q-S;if(Math.hypot(N,J)<1e-4)return;const q=Math.atan2(J,N),ie=Math.round(Math.abs(q*180/Math.PI)),G=s.context;G.save(),G.strokeStyle=r.color,G.fillStyle=r.color,G.lineWidth=r.lineWidth*h,G.setLineDash([]);const ne=Math.abs(H)<1e-4?0:z/H;if(r.rayLeft){const oe=S+ne*(0-T);G.beginPath(),G.moveTo(0,oe),G.lineTo(T,S),G.stroke()}if(r.rayRight){const ue=s.bitmapSize.width,oe=Q+ne*(ue-I);G.beginPath(),G.moveTo(I,Q),G.lineTo(ue,oe),G.stroke()}G.beginPath(),G.moveTo(T,S),G.lineTo(I,Q),G.stroke();const le=Math.atan2(z,H),ee=(r.lineWidth*4+4)*h,we=Math.PI/7;if(r.arrowRight){const ue=I-ee*Math.cos(le-we),oe=Q-ee*Math.sin(le-we),fe=I-ee*Math.cos(le+we),Qe=Q-ee*Math.sin(le+we);G.beginPath(),G.moveTo(I,Q),G.lineTo(ue,oe),G.lineTo(fe,Qe),G.closePath(),G.fill()}if(r.arrowLeft){const ue=le+Math.PI,oe=T-ee*Math.cos(ue-we),fe=S-ee*Math.sin(ue-we),Qe=T-ee*Math.cos(ue+we),me=S-ee*Math.sin(ue+we);G.beginPath(),G.moveTo(T,S),G.lineTo(oe,fe),G.lineTo(Qe,me),G.closePath(),G.fill()}const j=28*h;G.strokeStyle="rgba(122,166,174,0.55)",G.fillStyle=r.color,G.lineWidth=1*h,G.beginPath(),G.moveTo(I,Q),G.lineTo(I+j,Q),G.stroke(),G.beginPath(),G.strokeStyle="rgba(122,166,174,0.45)",G.arc(I,Q,j,0,q,q<0),G.stroke(),G.fillStyle="#4b7c86",G.font=`${Math.round(10*h)}px sans-serif`,G.textAlign="left",G.textBaseline="middle";const ge=I+(j+10*h)*Math.cos(q/2),ae=Q+(j+10*h)*Math.sin(q/2);if(G.fillText(`${ie}°`,ge,ae),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const ue=r.p1.price,oe=r.p2.price,fe=[];if(r.statsPriceRange){const me=Math.abs(oe-ue),xe=ue!==0?Math.abs((oe-ue)/ue*100):0,Se=me<1e-4?6:me<.01?5:me<1?4:2;fe.push("↕ "+me.toFixed(Se)+" ("+xe.toFixed(2)+"%)")}const Qe=[];if(r.statsDistance){const me=H/c,xe=z/h;Qe.push("distance: "+Math.sqrt(me*me+xe*xe).toFixed(2))}if(Qe.length>0&&fe.push(Qe.join(", ")),fe.length>0){const me=Math.min(c,h),xe=11*me,Se=xe*1.5,Me=5*me;G.font=xe+"px sans-serif";const Ye=fe.reduce((Te,ve)=>Math.max(Te,G.measureText(ve).width),0)+Me*2,Ie=fe.length*Se+Me*2,[We,De,Ze,nt]=T<=I?[T,S,I,Q]:[I,Q,T,S];let dt,He;r.statsPosition==="left"?(dt=We,He=De):r.statsPosition==="center"?(dt=(We+Ze)/2,He=(De+nt)/2):(dt=Ze,He=nt);const zt=dt-Ye/2,ye=He-Ie-12*me;G.fillStyle="rgba(20, 20, 30, 0.72)",G.fillRect(zt,ye,Ye,Ie),G.strokeStyle=r.statsColor,G.lineWidth=1*me,G.strokeRect(zt,ye,Ye,Ie),G.fillStyle=r.statsColor,G.textBaseline="top",G.textAlign="left",fe.forEach((Te,ve)=>{G.fillText(Te,zt+Me,ye+Me+ve*Se)})}}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 Ud{constructor(e,t,i){this.p1=e,this.p2=t,this.p3=i,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,h=s.verticalPixelRatio,m=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price),S=o.timeScale().timeToCoordinate(r.p3.rawTime),I=l.priceToCoordinate(r.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*c,N=x*h,J=F*c,H=T*h,z=S*c,re=I*h,q=(J+z)/2,ie=(H+re)/2;let G=q-Q,ne=ie-N;Math.abs(G)<1e-4&&(G=1e-4);const le=ne/G,ee=s.bitmapSize.width,we=(J-z)/2,j=(H-re)/2,ge=me=>({x:q+we*me,y:ie+j*me}),ae=(me,xe)=>({x:ee,y:xe+le*(ee-me)}),pe=ge(1),ue=ge(-1),oe=ae(pe.x,pe.y),fe=ae(ue.x,ue.y);m.save(),m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(oe.x,oe.y),m.lineTo(fe.x,fe.y),m.lineTo(ue.x,ue.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*h,m.moveTo(J,H),m.lineTo(z,re),m.stroke(),r._levels.forEach(me=>{const xe=ge(me.k),Se=ae(xe.x,xe.y);m.beginPath(),m.strokeStyle=me.color,m.lineWidth=me.width*h,m.moveTo(xe.x,xe.y),m.lineTo(Se.x,Se.y),m.stroke()});const Qe=ae(Q,N);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*h,m.moveTo(Q,N),m.lineTo(Qe.x,Qe.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 Sd{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 i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,m=s.timeScale().timeToCoordinate(i.p1.rawTime),v=o.priceToCoordinate(i.p1.price),x=s.timeScale().timeToCoordinate(i.p2.rawTime),F=o.priceToCoordinate(i.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*l,S=v*c,I=x*l,Q=F*c,N=n.bitmapSize.width,J=Math.abs(I-T)<1e-4?1:I-T,H=(Q-S)/J,z=I>=T?1:-1,re=z>0?N:0,q=T+z*Math.min(220*l,Math.max(80*l,N*.35)),ie=i._rays.map(ne=>{const le=H*ne.ratio;return{...ne,yEnd:S+le*(re-T),yLabel:S+le*(q-T)}});h.save();const G=(ne,le,ee)=>{!ne||!le||(h.beginPath(),h.moveTo(T,S),h.lineTo(re,ne.yEnd),h.lineTo(re,le.yEnd),h.closePath(),h.fillStyle=ee,h.fill())};G(ie[0],ie[3],"rgba(161, 98, 7, 0.10)"),G(ie[3],ie[4],"rgba(5, 150, 105, 0.10)"),G(ie[4],ie[5],"rgba(107, 114, 128, 0.12)"),ie.forEach(ne=>{h.beginPath(),h.strokeStyle=ne.color,h.lineWidth=1*c,h.moveTo(T,S),h.lineTo(re,ne.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=z>0?"left":"right",h.textBaseline="middle",ie.forEach(ne=>{h.fillStyle=ne.color;const le=q+(z>0?4*l:-4*l),ee=ne.yLabel;ee<-20||ee>n.bitmapSize.height+20||h.fillText(ne.label,le,ee)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ed{constructor(e,t,i=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,i),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,h=s.verticalPixelRatio,m=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(v==null||x==null||F==null||T==null)return;const S=v*c,I=x*h,Q=F*c,N=T*h,J=Q-S,H=N-I,z=Math.hypot(J,H);if(z<1e-4)return;const re=J/z,q=H/z,ie=-q,G=re,ne=Q+ie*z,le=N+G*z,ee=S+ie*z,we=I+G*z,j=(ae,pe)=>({x:S+re*z*ae+ie*z*pe,y:I+q*z*ae+G*z*pe});m.save();const ge=["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 ae=0;ae<r.divisions;ae++){const pe=ae/r.divisions,ue=(ae+1)/r.divisions,oe=j(0,pe),fe=j(1,pe),Qe=j(1,ue),me=j(0,ue);m.beginPath(),m.moveTo(oe.x,oe.y),m.lineTo(fe.x,fe.y),m.lineTo(Qe.x,Qe.y),m.lineTo(me.x,me.y),m.closePath(),m.fillStyle=ge[ae%ge.length],m.fill()}m.lineWidth=1*h,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let ae=0;ae<=r.divisions;ae++){const pe=ae/r.divisions,ue=j(0,pe),oe=j(1,pe),fe=j(pe,0),Qe=j(pe,1);m.beginPath(),m.moveTo(ue.x,ue.y),m.lineTo(oe.x,oe.y),m.stroke(),m.beginPath(),m.moveTo(fe.x,fe.y),m.lineTo(Qe.x,Qe.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*h,m.beginPath(),m.moveTo(S,I),m.lineTo(ne,le),m.stroke(),m.beginPath(),m.moveTo(Q,N),m.lineTo(ee,we),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*h,m.beginPath(),m.moveTo(S,I),m.lineTo(Q,N),m.lineTo(ne,le),m.lineTo(ee,we),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 Ns{constructor(e,t,i,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:h=!0,showPrices:m=!0,pricesColor:v="#129f5c",rayLeft:x=!1,rayRight:F=!1,arrowLeft:T=!1,arrowRight:S=!1}=n;this.p1=e,this.p2=t,this.p3=i,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=h,this.showPrices=m,this.pricesColor=v,this.rayLeft=x,this.rayRight=F,this.arrowLeft=T,this.arrowRight=S,this.visible=!0,this._chart=null,this._series=null;const I=this;this._paneView={renderer(){return{draw(Q){Q.useBitmapCoordinateSpace(N=>{if(!I.visible)return;const J=I._chart,H=I._series;if(!J||!H)return;const z=N.horizontalPixelRatio,re=N.verticalPixelRatio,q=[I.p1,I.p3,I.p4,I.p2].map(Ie=>{const We=J.timeScale().timeToCoordinate(Ie.rawTime),De=H.priceToCoordinate(Ie.price);return We==null||De==null?null:{x:We*z,y:De*re}}).filter(Boolean);if(q.length!==4)return;const[ie,G,ne,le]=q,ee=N.context;ee.save();const we=G.x-ie.x,j=G.y-ie.y,ge=Math.sqrt(we*we+j*j)||1,ae=we/ge,pe=j/ge,ue=ne.x-le.x,oe=ne.y-le.y,fe=Math.sqrt(ue*ue+oe*oe)||1,Qe=ue/fe,me=oe/fe,xe=1e5,Se=I.rayLeft?{x:ie.x-ae*xe,y:ie.y-pe*xe}:ie,Me=I.rayRight?{x:G.x+ae*xe,y:G.y+pe*xe}:G,$e=I.rayLeft?{x:le.x-Qe*xe,y:le.y-me*xe}:le,Ye=I.rayRight?{x:ne.x+Qe*xe,y:ne.y+me*xe}:ne;if(I.showBackground){const Ie=I.fillColor||"#6aa84f",We=parseInt(Ie.slice(1,3),16),De=parseInt(Ie.slice(3,5),16),Ze=parseInt(Ie.slice(5,7),16);ee.beginPath(),ee.moveTo(ie.x,ie.y),ee.lineTo(G.x,G.y),ee.lineTo(ne.x,ne.y),ee.lineTo(le.x,le.y),ee.closePath(),ee.fillStyle=`rgba(${We},${De},${Ze},${I.fillOpacity??.1})`,ee.fill()}if(ee.strokeStyle=I.lineColor,ee.lineWidth=I.lineWidth*re,ee.setLineDash([]),ee.beginPath(),ee.moveTo(Se.x,Se.y),ee.lineTo(Me.x,Me.y),ee.moveTo($e.x,$e.y),ee.lineTo(Ye.x,Ye.y),ee.moveTo(ie.x,ie.y),ee.lineTo(le.x,le.y),ee.moveTo(G.x,G.y),ee.lineTo(ne.x,ne.y),ee.stroke(),I.arrowLeft||I.arrowRight){const Ie=8*re,We=(De,Ze,nt)=>{ee.save(),ee.translate(De,Ze),ee.rotate(nt),ee.beginPath(),ee.moveTo(0,0),ee.lineTo(-Ie,-Ie/2),ee.lineTo(-Ie,Ie/2),ee.closePath(),ee.fillStyle=I.lineColor,ee.fill(),ee.restore()};I.arrowLeft&&(We(Se.x,Se.y,Math.atan2(-pe,-ae)),We($e.x,$e.y,Math.atan2(-me,-Qe))),I.arrowRight&&(We(Me.x,Me.y,Math.atan2(pe,ae)),We(Ye.x,Ye.y,Math.atan2(me,Qe)))}if(ee.fillStyle="#ffffff",ee.strokeStyle="#3b82f6",ee.lineWidth=2*re,[ie,G,ne,le].forEach(Ie=>{ee.beginPath(),ee.arc(Ie.x,Ie.y,6*re,0,Math.PI*2),ee.fill(),ee.stroke()}),I.showPrices){const Ie=[I.p1,I.p3,I.p2,I.p4],We=[ie,G,le,ne];ee.fillStyle=I.pricesColor||I.lineColor,ee.font=`${Math.round(10*re)}px sans-serif`,ee.textAlign="left",ee.textBaseline="middle",We.forEach((De,Ze)=>{const nt=Ie[Ze]?.price;typeof nt=="number"&&ee.fillText(nt.toFixed(5),De.x+8*z,De.y)})}ee.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ul extends Ns{constructor(e,t,i,r,n={}){super(e,t,i,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class pl{constructor(e,t,i,r,n,s={}){this.p1=e,this.p2=t,this.b1=i,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 h=o._chart,m=o._series;if(!h||!m)return;const v=c.horizontalPixelRatio,x=c.verticalPixelRatio,F=c.context,T=J=>{const H=h.timeScale().timeToCoordinate(J.rawTime),z=m.priceToCoordinate(J.price);return H==null||z==null?null:{x:H*v,y:z*x}},S=T(o.p1),I=T(o.p2),Q=T(o.b2),N=T(o.b1);!S||!I||!Q||!N||(F.save(),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.lineTo(Q.x,Q.y),F.lineTo(N.x,N.y),F.closePath(),F.fillStyle=o.fillColor,F.fill(),F.strokeStyle=o.strokeColor,F.lineWidth=o.lineWidth*x,F.setLineDash([]),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.stroke(),F.beginPath(),F.moveTo(N.x,N.y),F.lineTo(Q.x,Q.y),F.stroke(),F.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ks{constructor(e,t,i,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=i,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(h=>{if(!l.visible)return;const m=l._chart,v=l._series;if(!m||!v)return;const x=h.horizontalPixelRatio,F=h.verticalPixelRatio,T=h.context,S=q=>{const ie=m.timeScale().timeToCoordinate(q.rawTime),G=v.priceToCoordinate(q.price);return ie==null||G==null?null:{x:ie*x,y:G*F}},I=S(l.mid1),Q=S(l.mid2),N=S(l.top1),J=S(l.top2),H=S(l.bot1),z=S(l.bot2);if(!I||!Q||!N||!J||!H||!z)return;T.save(),T.beginPath(),T.moveTo(I.x,I.y),T.lineTo(Q.x,Q.y),T.lineTo(J.x,J.y),T.lineTo(N.x,N.y),T.closePath(),T.fillStyle=l.upperFillColor,T.fill(),T.beginPath(),T.moveTo(H.x,H.y),T.lineTo(z.x,z.y),T.lineTo(Q.x,Q.y),T.lineTo(I.x,I.y),T.closePath(),T.fillStyle=l.lowerFillColor,T.fill();const re=(q,ie,G)=>{T.beginPath(),T.strokeStyle=G,T.lineWidth=l.lineWidth*F,T.setLineDash([]),T.moveTo(q.x,q.y),T.lineTo(ie.x,ie.y),T.stroke()};if(re(N,J,l.upperStrokeColor),re(I,Q,l.centerStrokeColor),re(H,z,l.lowerStrokeColor),l.showDeviationLabel){const q=Math.abs(l.top1.price-l.mid1.price),ie=Number.isFinite(q)?q.toFixed(5):null;if(ie){const G=Math.max(10,Math.round(10*F));T.fillStyle=l.labelColor,T.font=`${G}px sans-serif`,T.textAlign="left",T.textBaseline="top",T.fillText(ie,H.x+2*x,H.y+10*F)}}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 dl extends Ks{}class fl{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 i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,m=n.bitmapSize.width;n.bitmapSize.height;const v=i.p1.price,x=i.p2.price,F=v-x,T=q=>x+F*q,S=s.timeScale().timeToCoordinate(i.p1.rawTime),I=s.timeScale().timeToCoordinate(i.p2.rawTime),Q=o.priceToCoordinate(v),N=o.priceToCoordinate(x),J=S!=null&&I!=null?Math.round(Math.min(S,I)*l):0,H=S!=null&&I!=null?Math.round(Math.max(S,I)*l):m,z=H-J;h.save(),i._zoneFills.forEach(({from:q,to:ie,color:G})=>{const ne=T(q),le=T(ie),ee=o.priceToCoordinate(ne),we=o.priceToCoordinate(le);if(ee==null||we==null)return;const j=Math.round(ee*c),ge=Math.round(we*c);h.fillStyle=G,h.fillRect(J,Math.min(j,ge),z,Math.abs(ge-j))}),i._levels.forEach(({ratio:q,label:ie})=>{const G=T(q),ne=o.priceToCoordinate(G);if(ne==null)return;const le=Math.round(ne*c),ee=i._levelColors[q]||"#888888";h.beginPath(),h.strokeStyle=ee,h.lineWidth=q===0||q===1?1.5*c:1*c,q!==0&&q!==1&&q<1?h.setLineDash([4*l,4*l]):h.setLineDash([]),h.moveTo(J,le),h.lineTo(H,le),h.stroke(),h.setLineDash([])});const re=Math.round(11*c);if(h.font=`${re}px sans-serif`,h.textAlign="left",i._levels.forEach(({ratio:q,label:ie})=>{const G=T(q),ne=o.priceToCoordinate(G);if(ne==null)return;const le=Math.round(ne*c),ee=i._levelColors[q]||"#888888",we=`${ie} (${G.toFixed(5)})`;h.fillStyle=ee,h.textAlign="right",h.fillText(we,J-4*l,le-4*c)}),S!=null&&I!=null&&Q!=null&&N!=null){const q=Math.round(S*l),ie=Math.round(Q*c),G=Math.round(I*l),ne=Math.round(N*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo(q,ie),h.lineTo(G,ne),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(q,ie,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(G,ne,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ld{constructor(e,t="#3b82f6",i=2,r=!0){this.time=e,this.color=t,this.lineWidth=i,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 h=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,v=o.context;v.save(),v.beginPath(),v.strokeStyle=n.color,v.lineWidth=n.lineWidth*o.horizontalPixelRatio,v.setLineDash([]),v.moveTo(h,0),v.lineTo(h,m),v.stroke();const x=Math.round(m/2);if(n.midYCss=x/o.verticalPixelRatio,n.showDot){v.beginPath(),v.strokeStyle=n.color,v.lineWidth=1.5*o.horizontalPixelRatio;const F=5*o.horizontalPixelRatio;v.arc(h,x,F,0,Math.PI*2),v.stroke()}if(n.showDate!==!1){const F=n.time,T=new Date(typeof F=="number"?F*1e3:F),S=G=>String(G).padStart(2,"0"),I=`${S(T.getUTCDate())}.${S(T.getUTCMonth()+1)}.${T.getUTCFullYear()} ${S(T.getUTCHours())}:${S(T.getUTCMinutes())}:${S(T.getUTCSeconds())}`,Q=Math.round(11*o.verticalPixelRatio);v.font=`${Q}px ui-sans-serif, system-ui, sans-serif`,v.textBaseline="middle",v.textAlign="center";const N=v.measureText(I).width,J=Math.round(6*o.horizontalPixelRatio),H=Math.round(3*o.verticalPixelRatio),z=Q+2*H,re=N+2*J,q=h-re/2,ie=m-z-Math.round(4*o.verticalPixelRatio);v.fillStyle=n.color,v.fillRect(q,ie,re,z),v.fillStyle="#ffffff",v.fillText(I,h,ie+z/2)}v.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Md(A,e){const t=typeof A=="string"?A.trim():"",i=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(i))return`rgba(95, 143, 150, ${e})`;const r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),s=parseInt(i.slice(4,6),16);return`rgba(${r}, ${n}, ${s}, ${e})`}function XT(A,e,t){const i=`${A??""}`,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 h=c;for(;h.length>s;){let m=h.lastIndexOf(" ",s);m<=0&&(m=s),o.push(h.slice(0,m)),h=h.slice(m).trimStart()}o.push(h)};return i.split(`
11
+ `).forEach(l),o.length===0&&o.push(""),o}function Hd(A,e,t){const i=A?.primitive??{},r=Number(i.fontSize)||12,n=!!i.textWrap,s=XT(i.text??A?.text??"Text",r,n),o=s.reduce((F,T)=>Math.max(F,T.length),1),c=Math.max(20,o*r*.58)+16,h=r*1.2,m=s.length*h+10,v=e-c/2,x=t-m;return{left:v,right:v+c,top:x,bottom:x+m+12}}class Id{constructor(e,t,i={}){this.rawTime=e,this.price=t,this.text=i.text??"Text",this.color=i.color??"#5f8f96",this.fontSize=i.fontSize??12,this.fontWeight=i.fontWeight??"normal",this.fontStyle=i.fontStyle??"normal",this.textAlign=i.textAlign??"center",this.textWrap=i.textWrap??!1,this.borderEnabled=i.borderEnabled??!1,this.borderColor=i.borderColor??"#5f8f96",this.borderOpacity=i.borderOpacity??.1,this.borderWidth=i.borderWidth??1,this.bgEnabled=i.bgEnabled??!1,this.bgColor=i.bgColor??"#5f8f96",this.bgOpacity=i.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),h=l.priceToCoordinate(r.price);if(c==null||h==null)return;const m=s.horizontalPixelRatio,v=s.verticalPixelRatio,x=Math.round(c*m),F=Math.round(h*v),T=s.context;T.save();const S=Math.round(r.fontSize*v);T.font=`${r.fontStyle} ${r.fontWeight} ${S}px sans-serif`;const I=`${r.text??""}`,Q=220*m,N=[],J=pe=>{if(!r.textWrap||pe.length===0){N.push(pe);return}const ue=pe.split(/\s+/);let oe="";for(const fe of ue){const Qe=oe?`${oe} ${fe}`:fe;T.measureText(Qe).width<=Q||!oe?oe=Qe:(N.push(oe),oe=fe)}N.push(oe)};I.split(`
12
+ `).forEach(J),N.length===0&&N.push("");const H=N.map(pe=>T.measureText(pe).width),z=Math.max(...H,20*m),re=8*m,q=5*v,ie=z+re*2,G=S*1.2,ne=G*N.length+q*2,le=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",ee=x-ie/2,we=F-ne;r.bgEnabled&&(T.fillStyle=Md(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),T.beginPath(),T.rect(ee,we,ie,ne),T.fill()),r.borderEnabled&&(T.strokeStyle=Md(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),T.lineWidth=Math.max(.5,(r.borderWidth??1)*v),T.beginPath(),T.rect(ee,we,ie,ne),T.stroke()),T.fillStyle=r.color,T.textAlign=le,T.textBaseline="middle";const j=le==="left"?ee+re:le==="right"?ee+ie-re:ee+ie/2;for(let pe=0;pe<N.length;pe++)T.fillText(N[pe],j,we+q+G*(pe+.5));const ge=5*v,ae=F+10*v;T.beginPath(),T.strokeStyle="#3b82f6",T.lineWidth=1.5*v,T.arc(x,ae,ge,0,Math.PI*2),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]}}const JT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Pd(A){return A?JT[A]??7:7}function ZT(A,e){const t=String(A||"").toUpperCase(),i=e||Pd(A),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(i*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const DA=A=>{if(!Array.isArray(A)||A.length===0)return[];const e=A.map(i=>({...i,time:te(i.time)})).filter(i=>i.time!=null);e.sort((i,r)=>i.time-r.time);const t=new Map;for(const i of e)t.set(i.time,i);return Array.from(t.values()).sort((i,r)=>i.time-r.time)},YT=300,Dd=24,qT=150,_d=150;function gl(A,e,t=YT){if(!Array.isArray(A)||A.length===0)return[];const i=BA(e),r=Number.isFinite(i)&&i>0?i:60;let n=null;for(const o of A){const l=te(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 jT(A){if(!Array.isArray(A)||A.length===0)return null;let e=null;for(const t of A){const i=te(t?.time);i!=null&&(e==null||i>e)&&(e=i)}return e}function eb(A,e){let t=0,i=A.length;for(;t<i;){const r=t+i>>1;A[r]<e?t=r+1:i=r}return t}function zs(A,e,t,i){const r=te(e),n=te(t),s=BA(i)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(A)||A.length===0)return l;if(r==null||n==null)return 1;const c=v=>{const x=eb(A,v);if(x<=0)return 0;if(x>=A.length)return A.length-1;const F=A[x-1],T=A[x];return Math.abs(v-F)<=Math.abs(T-v)?x-1:x},h=c(r),m=c(n);return Math.max(1,Math.abs(m-h)+1)}function kd(A,e,t){if(!A)return!1;const i=A.timeScale();if(!i)return!1;const r=jT(e);if(r==null)return!1;const n=i.timeToCoordinate(r);if(Number.isFinite(n)){const c=i.coordinateToLogical(n);if(Number.isFinite(c)){const h=i.getVisibleLogicalRange(),m=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,v=Number.isFinite(m)&&m>20?m:120,x=Math.min(_d,v/2),F=Math.max(20,v-x),T={from:c-F,to:c+x};try{return i.setVisibleLogicalRange(T),!0}catch{}}}const s=BA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-qT*o,to:r+_d*o};try{return i.setVisibleRange(l),!0}catch{return!1}}function ut(A,e,t,i,r,n){const s=r-t,o=n-i,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/(l*l);c=Math.max(0,Math.min(1,c));const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function tb(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/l;c<0&&(c=0);const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function Ab(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);const c=((A-t)*s+(e-i)*o)/l,h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function vi(A,e,t){let i=!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&&A<(l-s)*(e-o)/(c-o)+s&&(i=!i)}return i}function Od(A,e,t){if(!A||!e||!t)return null;const i=(A.normalizedTime+e.normalizedTime)/2,r=(A.price+e.price)/2,n=t.price-r,s={rawTime:A.rawTime,normalizedTime:A.normalizedTime,price:A.price+n},o={rawTime:e.rawTime,normalizedTime:e.normalizedTime,price:e.price+n},l={rawTime:t.rawTime??te(i),normalizedTime:te(i),price:r+n};return{b1:s,b2:o,bottomMid:l}}function Jr(A,e,t,i=1){if(!A||!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=A.filter(re=>{const q=te(re.time);return q!=null&&q>=s&&q<=o});if(l.length<2)return null;const c=l.length;let h=0,m=0,v=0,x=0;l.forEach((re,q)=>{h+=q,m+=re.close,v+=q*re.close,x+=q*q});const F=(c*v-h*m)/(c*x-h*h),T=(m-F*h)/c;let S=0;l.forEach((re,q)=>{const ie=T+F*q;S+=(re.close-ie)**2});const I=Math.sqrt(S/c),Q=I*i,N=T,J=T+F*(c-1),H=l[0].time,z=l[c-1].time;return{p1:{rawTime:H,normalizedTime:te(H),price:N},p2:{rawTime:z,normalizedTime:te(z),price:J},top1:{rawTime:H,normalizedTime:te(H),price:N+Q},top2:{rawTime:z,normalizedTime:te(z),price:J+Q},bot1:{rawTime:H,normalizedTime:te(H),price:N-Q},bot2:{rawTime:z,normalizedTime:te(z),price:J-Q},slope:F,intercept:T,stdDev:I,offset:Q,barCount:c}}function Zr(A,e,t,i=1){if(!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=(A||[]).filter(S=>{const I=te(S.time);return I!=null&&I>=s&&I<=o});if(l.length<2)return null;const c=e.rawTime,h=t.rawTime,m=l.length,v=(t.price-e.price)/(m-1||1);let x=0;l.forEach((S,I)=>{const Q=e.price+v*I;x+=(S.close-Q)**2});const F=Math.sqrt(x/m),T=F*i;return{p1:{rawTime:c,normalizedTime:r,price:e.price},p2:{rawTime:h,normalizedTime:n,price:t.price},top1:{rawTime:c,normalizedTime:r,price:e.price+T},top2:{rawTime:h,normalizedTime:n,price:t.price+T},bot1:{rawTime:c,normalizedTime:r,price:e.price-T},bot2:{rawTime:h,normalizedTime:n,price:t.price-T},slope:v,stdDev:F,offset:T,barCount:m}}const ib={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}},rb={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 nb(A,e){if(!A||!A.type)return!1;const t=ib[A.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(i=>!!A[i])}function sb(A){return A?rb[A]??"#22c55e":"#22c55e"}function ml(A,e){if(A.length<e)return[];const t=2/(e+1);let i=A.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:A[e-1].time,value:i}];for(let n=e;n<A.length;n++)i=A[n].close*t+i*(1-t),r.push({time:A[n].time,value:i});return r}function Vs(A,e){if(A.length<e)return null;const t=A[A.length-1],i=A.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:i}}function Nd(A,e){const t=ml(A,e);return t.length?t[t.length-1]:null}function Kd(A,e){if(A.length<e+1)return null;let t=0,i=0;for(let s=1;s<=e;s++){const o=A[s].close-A[s-1].close;o>0?t+=o:i-=o}t/=e,i/=e;for(let s=e+1;s<A.length;s++){const o=A[s].close-A[s-1].close;t=(t*(e-1)+Math.max(o,0))/e,i=(i*(e-1)+Math.max(-o,0))/e}const r=A[A.length-1],n=i===0?100:100-100/(1+t/i);return{time:r.time,value:n}}function zd(A,e=12,t=26,i=9){if(A.length<t+i)return null;const r=ml(A,e),n=ml(A,t);if(!r.length||!n.length)return null;const s=n.map((h,m)=>{const v=r[r.length-n.length+m];return{time:h.time,value:v.value-h.value}});if(s.length<i)return null;const o=2/(i+1);let l=s.slice(0,i).reduce((h,m)=>h+m.value,0)/i;for(let h=i;h<s.length;h++)l=s[h].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 ob={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ab=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:i=!0,onBuyClick:r,onSellClick:n},s){const o=Y.useRef(null),l=Y.useRef(null),c=Y.useRef(null),h=Y.useRef(null),m=Y.useRef(null),v=Y.useRef(null),x=Y.useRef([]),F=Y.useRef(null),T=Y.useRef(!1),S=Y.useRef(null),I=Y.useRef(null),Q=Y.useRef(null),N=Y.useRef(null),J=Y.useRef([]),[H,z]=Y.useState(null),[re,q]=Y.useState(null),[ie,G]=Y.useState([]),[ne,le]=Y.useState(null);Y.useRef(null);const[ee,we]=Y.useState([]),j=Y.useRef(null),ge=Y.useRef({tp:null,sl:null,entry:null}),ae=Y.useRef(null),pe=Y.useRef(0),ue=Y.useRef(0),oe=Y.useRef(null),fe=Y.useRef(null),Qe=Y.useRef(!1),me=Y.useRef(!1);Y.useEffect(()=>{fe.current=H;let d=!1;x.current.forEach(u=>{if(u.type==="trendline"&&u.decoration){const O=u===H;u.decoration.isSelected!==O&&(u.decoration.isSelected=O,d=!0)}}),d&&c.current?.applyOptions({})},[H]);const xe=Y.useRef(new Map),Se=Y.useRef(null),Me=Y.useRef(null),$e=(d,u)=>`${d}_${u}`,Ye=()=>{const d=$e(ye,Te);return xe.current.get(d)||null},Ie=d=>{if(!d)return;const u=$e(ye,Te);xe.current.set(u,d)},{activeTool:We,setActiveTool:De,showGrid:Ze,snapToGrid:nt,chartObjects:dt,setChartObjects:He,orders:zt,selectedSymbol:ye,selectedTimeframe:Te,drawingsVisible:ve,chartType:be,chartLocked:Le,theme:Ee,candleColors:Ke,showTradeOrders:wt,showTradePosition:Dt,showTradeHistory:ni,showSLTP:ZA,showAskPrice:aA,showChartControls:si,showCrosshair:_A,showOHLC:YA,currentSymbolData:Zt,baseUrl:Yt,endpoints:Qt,endpointParams:Lt,indicators:Ct,indicatorSettings:Ut,selectedTradeForModify:Vt,setSelectedTradeForModify:je}=$t(),_e=Y.useRef({}),[Je,et]=Y.useState({}),bt=Y.useRef(0),ze=Y.useRef(Ct),Ve=Y.useRef(Ut);ze.current=Ct,Ve.current=Ut;const At=Y.useRef([]),[st,Ge]=Y.useState(!1),[ft,at]=Y.useState(null),[Ne,Wt]=Y.useState([]),[lA,Gs]=Y.useState(!0),[yl,Jd]=Y.useState(null),[Lb,dx]=Y.useState(0),Rs=Y.useMemo(()=>{const d=Ne.map(u=>te(u?.time)).filter(u=>Number.isFinite(u));return d.sort((u,O)=>u-O),d},[Ne]),$s=Y.useRef(null),oi=Y.useRef(new Map);Y.useRef(null);const Zd=Y.useRef(0),kA=Y.useRef(null),nr=Y.useRef(!1),tn=Y.useRef(!1);Y.useEffect(()=>{const d=m.current;d&&d.setData(gl(Ne,Te))},[Ne,Te]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},zoomOut:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const d=o.current;if(!d){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const u=Ee==="light"?"#ffffff":"#12161d",O=`chart-${ye}-${Te}-${Date.now()}.png`;NT(d,{useCORS:!0,allowTaint:!0,backgroundColor:u,scale:2,logging:!1}).then(ce=>{const y=document.createElement("a");y.download=O,y.href=ce.toDataURL("image/png"),y.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(ce=>{console.error("Chart screenshot failed",ce),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,Te,Ee]);const Cl=Y.useMemo(()=>Ne.length===0?[]:be==="line"||be==="area"?Ne.map(d=>({time:d.time,value:d.close})):Ne,[Ne,be]),Mb=d=>{r?r(d):(at("BUY"),Ge(!0))},Hb=d=>{n?n(d):(at("SELL"),Ge(!0))},Ib=()=>{Ge(!1),at(null)},Pb=d=>{const u=re;if(!u||!d)return;const O=(R,V)=>{if(typeof R!="string")return V;const X=R.trim(),se=X.startsWith("#")?X:`#${X}`;return/^#[0-9A-Fa-f]{6}$/.test(se)?se.toLowerCase():V},ce=(R,V)=>{const X=Number(R);return Number.isFinite(X)?Math.max(0,Math.min(1,X)):V};let y={...u,visibleTimeframes:Array.isArray(d.visibleTimeframes)?[...d.visibleTimeframes]:u.visibleTimeframes};if(u.type==="text"){const R=Number.isFinite(Number(d.price))?Number(d.price):u.price,V=u.primitive;V&&(V.text=typeof d.text=="string"?d.text:V.text,V.color=O(d.color,V.color??"#5f8f96"),V.fontSize=Number.isFinite(Number(d.fontSize))?Number(d.fontSize):V.fontSize,V.fontWeight=d.fontWeight==="bold"?"bold":"normal",V.fontStyle=d.fontStyle==="italic"?"italic":"normal",V.textAlign=["left","center","right"].includes(d.textAlign)?d.textAlign:V.textAlign,V.textWrap=!!d.textWrap,V.borderEnabled=!!d.borderEnabled,V.borderColor=O(d.borderColor,V.borderColor??"#5f8f96"),V.borderOpacity=ce(d.borderOpacity,V.borderOpacity??.1),V.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(d.borderWidth))?Number(d.borderWidth):1)),V.bgEnabled=!!d.bgEnabled,V.bgColor=O(d.bgColor,V.bgColor??"#5f8f96"),V.bgOpacity=ce(d.bgOpacity,V.bgOpacity??.1),V.price=R),y={...y,price:R,text:typeof d.text=="string"?d.text:u.text}}if(u.type==="trendline"){const R=O(d.lineColor,"#22c55e"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2));if(u.series)try{u.series.applyOptions({color:R,lineWidth:V})}catch{}const X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.point1?.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.point2?.price;if(u.series&&u.point1&&u.point2){const $=u.point1.time??u.point1.rawTime,C=u.point2.time??u.point2.rawTime;try{const B=DA([{time:$,value:X},{time:C,value:se}]);B.length>0&&u.series.setData(B)}catch{}}const E={...u.point1,price:X},D={...u.point2,price:se};u.decoration&&(u.decoration.color=R,u.decoration.lineWidth=V,u.decoration.arrowLeft=!!d.arrowLeft,u.decoration.arrowRight=!!d.arrowRight,u.decoration.rayLeft=!!d.rayLeft,u.decoration.rayRight=!!d.rayRight,u.decoration.statsColor=O(d.statsColor,"#5f8f96"),u.decoration.statsPosition=d.statsPosition??"right",u.decoration.statsShowAlways=!!d.statsShowAlways,u.decoration.statsPriceRange=!!d.statsPriceRange,u.decoration.statsBarsRange=!!d.statsBarsRange,u.decoration.statsDateRange=!!d.statsDateRange,u.decoration.statsAngle=!!d.statsAngle,u.decoration.statsDistance=!!d.statsDistance,u.decoration.p1=E,u.decoration.p2=D),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsShowAlways:!!d.statsShowAlways,statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,point1:E,point2:D,decoration:u.decoration}}if(u.type==="pricelevel"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price;if(u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,lineWidth:V,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const f=h.current;if(se&&E&&f)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B;else{const L=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C});try{f.attachPrimitive(L)}catch{}u.textPrimitive=L}else if(u.textPrimitive&&f){try{f.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="horizontalray"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price,f=u.primitive;if(f&&(f.price=B,f.color=R,f.lineWidth=V),u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const L=h.current;if(se&&E&&L)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B,u.textPrimitive.originTime=u.rawOriginTime;else{const w=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C,originTime:u.rawOriginTime});try{L.attachPrimitive(w)}catch{}u.textPrimitive=w}else if(u.textPrimitive&&L){try{L.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="verticalline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showDate!==!1,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showDate=X),y={...y,lineColor:R,lineWidth:V,showDate:X}}if(u.type==="infoline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.statsShowAlways!==!1,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=!!d.statsAngle,f=!!d.statsDistance,L=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,w=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,p=u.p1.rawTime,_=u.p2.rawTime,P=w-L,U=L!==0?P/Math.abs(L)*100:0,b=u.p1.normalizedTime??0,g=u.p2.normalizedTime??0,M=BA(Te)||3600,k=Math.abs(g-b),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=c.current,Ae=h.current,he=Z?Z.timeScale().timeToCoordinate(p):null,Be=Ae?Ae.priceToCoordinate(L):null,Ce=Z?Z.timeScale().timeToCoordinate(_):null,Ue=Ae?Ae.priceToCoordinate(w):null,qe=he!=null&&Be!=null&&Ce!=null&&Ue!=null?Math.atan2(-(Ue-Be),Ce-he)*(180/Math.PI):u.primitive?.info?.angle??0,rt={priceDiff:P,pricePct:U,bars:K,days:W,angle:qe},Xe=u.primitive;Xe&&(Xe.color=R,Xe.lineWidth=V,Xe.statsShowAlways=X,Xe.statsColor=se,Xe.statsPosition=E,Xe.statsPriceRange=D,Xe.statsBarsRange=$,Xe.statsDateRange=C,Xe.statsAngle=B,Xe.statsDistance=f,Xe.p1={...u.p1,price:L},Xe.p2={...u.p2,price:w},Xe.info=rt),y={...y,lineColor:R,lineWidth:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C,statsAngle:B,statsDistance:f,p1:{...u.p1,price:L},p2:{...u.p2,price:w}}}if(u.type==="rulerline"){const R=O(d.lineColor,"#3b82f6"),V=d.showArea!==!1,X=!!d.statsShowAlways,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=u.primitive;B&&(B.lineColor=R,B.showArea=V,B.statsShowAlways=X,B.statsColor=se,B.statsPosition=E,B.statsPriceRange=D,B.statsBarsRange=$,B.statsDateRange=C),y={...y,lineColor:R,showArea:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C}}if(u.type==="arrowedline"){const R=O(d.lineColor,"#f59e0b"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="rayline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="extendedline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="crossline"){const R=O(d.lineColor,"#06a0e3"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.price))?Number(d.price):u.p.price,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showTime=!!d.showTime,se.showPrice=!!d.showPrice,se.center={...u.p,price:X}),y={...y,lineColor:R,lineWidth:V,showTime:!!d.showTime,showPrice:!!d.showPrice,p:{...u.p,price:X}}}if(u.type==="trendbyangle"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="disjointchannel"){const R=O(d.lineColor,"#129f5c"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#6aa84f"),se=ce(d.fillOpacity,.1),E=O(d.pricesColor,"#129f5c"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}if(u.type==="flattopbottom"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#3b82f6"),se=ce(d.fillOpacity,.12),E=O(d.pricesColor,"#3b82f6"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}He(R=>{const V=R.map(X=>X===u?y:X);return x.current=V,V}),fe.current===u&&(fe.current=y),z(R=>R===u?y:R),le(R=>R===u?y:R),q(y);try{c.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const d=o.current;if(!d)return;const u=d.getBoundingClientRect(),O=w=>{const p=Math.abs(Number(w));return Number.isFinite(p)?p>=1e3?p.toFixed(2):p.toFixed(5):"0"},ce=Ee==="light",y=R0(d,{width:u.width||d.clientWidth,height:u.height||d.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:ce?"#FFFFFF":"#0d1117",type:"solid"},textColor:ce?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}},rightPriceScale:{borderColor:ce?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:ce?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:ce?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:0,vertLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:We===1,horzLineVisible:We===1},handleScroll:{mouseWheel:!0,pressedMouseMove:We===null||We===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}}),R=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),V=R.includes("JPY"),X=rn(R),se=An(R);let E,D;V?(E=.001,D=w=>Math.abs(Number(w)).toFixed(3)):X?R.startsWith("BTC")||R.startsWith("ETH")?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(4)):se&&(R.startsWith("XAU")||R.startsWith("XAG"))?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(5));const $=y.addCandlestickSeries({upColor:ce?"#089981":"#26a69a",downColor:ce?"#f23645":"#ef5350",wickUpColor:ce?"#089981":"#26a69a",wickDownColor:ce?"#f23645":"#ef5350",borderUpColor:ce?"#089981":"#26a69a",borderDownColor:ce?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:E,formatter:D}}),C=y.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=y,h.current=$,m.current=C,C.setData(gl(Ne,Te)),requestAnimationFrame(()=>{if(d&&y){const w=d.getBoundingClientRect();w.width>0&&w.height>0&&y.resize(w.width,w.height)}});const B=y.timeScale(),f=()=>{if(me.current&&oi.current.size>0){const w=B.getVisibleRange();w&&Ie(w)}};B.subscribeVisibleTimeRangeChange(f);const L=new ResizeObserver(w=>{for(const p of w){const{width:_,height:P}=p.contentRect;if(_>0&&P>0&&y){const U=B.getVisibleRange();y.resize(_,P),U&&setTimeout(()=>{try{B.setVisibleRange(U)}catch{}},0)}}});return L.observe(d),()=>{B.unsubscribeVisibleTimeRangeChange(f),L.disconnect(),y.remove(),c.current=null,h.current=null,m.current=null,v.current=null,x.current=[],kA.current&&clearTimeout(kA.current)}},[]),Y.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}}})},[Ze]),Y.useEffect(()=>{const d=c.current;if(!d)return;const u=Ee==="light";d.applyOptions({layout:{background:{color:u?"#FFFFFF":"#12161d"},textColor:u?"#020617":"#fff"},grid:{vertLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:u?"#e5e7eb":"#1e293b"},timeScale:{borderColor:u?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1},horzLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1}}})},[Ee,Ze]),Y.useEffect(()=>{const d=h.current;!d||!Ke||d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})},[Ke]),Y.useEffect(()=>{if(!c.current)return;const u=!Le&&!(We!==null&&We!==1&&We!==0),O=!Le;c.current.applyOptions({crosshair:{mode:0,vertLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:u,horzTouchDrag:u,vertTouchDrag:u},handleScale:{axisPressedMouseMove:{time:u,price:u},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:u,price:u},mouseWheel:O,pinch:O}})},[We,Le,_A,Ee]);const Db=(d=!1)=>{const u=h.current,O=c.current;x.current.forEach(ce=>{if(ce.primitive)try{u&&u.detachPrimitive(ce.primitive)}catch{}if(ce.series&&ce.series!==u&&O)try{O.removeSeries(ce.series)}catch{}if(ce.priceLine&&u)try{u.removePriceLine(ce.priceLine)}catch{}if(ce.textPrimitive&&u)try{u.detachPrimitive(ce.textPrimitive)}catch{}}),x.current=[],He([]),De(null),d&&$T(ye,Te)},Yd=(d,u=!1)=>{d&&x.current.forEach(O=>{if(O.primitive){try{d.detachPrimitive(O.primitive)}catch{}try{d.attachPrimitive(O.primitive)}catch{}}if(u&&O.type==="pricelevel"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}if(u&&O.type==="horizontalray"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}})},Xs=Y.useCallback(()=>{GT(x.current,ye,Te)},[ye,Te]),_b=Y.useCallback(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=RT(ye,Te);if(!O.length)return;const ce=[];for(const y of O)try{let R=null;switch(y.type){case"pricelevel":{const V=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,priceLine:V};break}case"horizontalray":{const V=new gd(y.price,y.rawOriginTime);u.attachPrimitive(V);const X=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,primitive:V,priceLine:X};break}case"verticalline":{const V=new Ld(y.rawTime);u.attachPrimitive(V),R={...y,primitive:V};break}case"text":{const V=new Id(y.rawTime,y.price);y.text&&(V.text=y.text),u.attachPrimitive(V),R={...y,primitive:V};break}case"crossline":{const V=new Qd({rawTime:y.p.rawTime,price:y.p.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"infoline":{const V=y.info||{},X=new wd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"rulerline":{const V=y.info||{},X=new cl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"arrowedline":{const V=new hl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"rayline":{const V=new Td({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"extendedline":{const V=new bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendbyangle":{const V=new Fd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendline":case"gannline":{const V=y.type==="gannline"?"#7aa6ae":"#22c55e",X=d.addLineSeries({color:V,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),se=DA([{time:y.point1.time,value:y.point1.price},{time:y.point2.time,value:y.point2.price}]);se.length>0&&X.setData(se);const E=new xd(y.point1,y.point2,V,2);try{X.attachPrimitive(E)}catch{}R={...y,series:X,decoration:E};break}case"rectangle":{const V=new Bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"circle":{const V=new yd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"triangle":{const V=new Cd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"ellipse":{const V=new vd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1,minorRatio:y.minorRatio??.45,previewAsLine:!1});u.attachPrimitive(V),R={...y,primitive:V};break}case"fibonacci":{const V=new fl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"equidistantchannel":{const V=new pl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.b1.rawTime,price:y.b1.price},{rawTime:y.b2.rawTime,price:y.b2.price},{rawTime:y.bottomMid.rawTime,price:y.bottomMid.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"disjointchannel":{const V=new Ns({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"flattopbottom":{const V=new ul({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"regressionchannel":{const V=new Ks({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"stddevchannel":{const V=new dl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"andrewspitchfork":{const V=new Ud({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"gannfan":{const V=new Sd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"ganngrid":{const V=new Ed({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}default:continue}R&&ce.push(R)}catch{}ce.length&&(x.current.push(...ce),He(y=>[...y,...ce]))},[ye,Te,He]);Y.useEffect(()=>{const d=`${ye}_${Te}`;F.current===d&&Xs()},[dt,Xs,ye,Te]),Y.useEffect(()=>{(async()=>{if(!ye||!Te){Wt([]),me.current=!1;return}try{if(kA.current&&(clearTimeout(kA.current),kA.current=null),nr.current=!0,Gs(!0),Jd(null),Wt([]),me.current=!1,tn.current=!1,Me.current!==null&&Me.current!==ye&&(F.current=null,Db()),Me.current=ye,h.current)try{h.current.setData([])}catch{}const u=Pd(Te),O=ZT(Te,u),ce=Yt||ob?.VITE_BASE_URL||"http://localhost:5002",y=Qt?.candles||"/api/chart/candles",R=Lt?.candles||{},V={symbol:R.symbol||"symbol",timeframe:R.timeframe||"timeframe",limit:R.limit||"limit",daysBack:R.daysBack||"daysBack"},X={};X[V.symbol]=ye,X[V.timeframe]=Te,X[V.limit]=O,R.daysBack!==!1&&(X[V.daysBack]=u);const se=localStorage.getItem("token")??localStorage.getItem("authToken"),E=await Bt.get(`${ce}${y}`,{params:X,timeout:1e4,headers:se?{Authorization:`Bearer ${se}`}:{}});let D=[];if(Array.isArray(E.data)?D=E.data:E.data&&E.data.data&&Array.isArray(E.data.data)?D=E.data.data:E.data&&Array.isArray(E.data)&&(D=E.data),D&&D.length>0){const{candles:$,stats:C}=El(D,ye,Te);$.length>0?(Wt($),oi.current=new Map,$.forEach(B=>{oi.current.set(B.time,B)}),tn.current=!0,nr.current=!1,$s.current?.connected&&ye&&Te&&$s.current.emit("subscribeCandles",{symbol:ye,timeframe:Te})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),nr.current=!1,Wt([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),nr.current=!1,Wt([])}catch(u){console.error(`❌ Error fetching ${ye}:`,u.message);const O=u.code==="ECONNABORTED"||u.message&&u.message.includes("timeout");Jd(O?"Request timed out. No data available for this symbol.":u.message||"Failed to load candles."),nr.current=!1,Wt([]),Gs(!1)}})()},[ye,Te,Lb]),Y.useEffect(()=>{$s.current=zn.getSocket();const d=$s.current,u=()=>{if(tn.current&&ye&&Te&&d.connected){const X={symbol:ye,timeframe:Te};d.emit("subscribeCandles",X)}},O=()=>{setTimeout(()=>{ye&&Te&&u()},200)},ce=X=>{},y=X=>{};d.on("connect",O),d.on("disconnect",ce),d.on("connect_error",y),d.on("subscription:confirmed",X=>{X.type});const R=X=>{if(!tn.current||!X||!X.candle||!X.symbol)return;const se=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(se(X.symbol)!==se(ye)||X.timeframe&&X.timeframe!==Te)return;const{candle:E}=X,D=Ll(E,ye,Te);if(!D)return;const $=Date.now();if($-Zd.current<200)return;Zd.current=$;const C=c.current?.timeScale(),B=C?.getVisibleRange(),f=h.current,L=c.current;if(!(!f||!L||!me.current&&!tn.current||f?.seriesType?.()!==(be==="line"?"Line":be==="area"?"Area":be==="bars"?"Bar":"Candlestick")))try{const _=oi.current.get(D.time),P=!_,U=_?{time:D.time,open:_.open,high:Math.max(_.high,D.high),low:Math.min(_.low,D.low),close:D.close}:D;oi.current.set(D.time,U),P&&m.current&&m.current.setData(gl(Array.from(oi.current.values()),Te));try{be==="line"||be==="area"?f.update({time:U.time,value:U.close}):f.update(U),C&&B&&Ie(B)}catch(k){throw k}const b=ze.current||{},g=Ve.current||{},M=_e.current;if(Object.keys(M).length>0){const k=Array.from(oi.current.values()).sort((K,W)=>K.time-W.time);if(b.sma20&&M.sma20){const K=Vs(k,g.smaPeriod||20);if(K)try{M.sma20.update(K)}catch{}}if(b.sma50&&M.sma50){const K=Vs(k,50);if(K)try{M.sma50.update(K)}catch{}}if(b.ema12&&M.ema12){const K=Nd(k,g.emaPeriod||12);if(K)try{M.ema12.update(K)}catch{}}if(b.rsi&&M.rsi){const K=Kd(k,g.rsiPeriod||14);if(K){try{M.rsi.update(K)}catch{}if(M.rsi70)try{M.rsi70.update({time:K.time,value:70})}catch{}if(M.rsi30)try{M.rsi30.update({time:K.time,value:30})}catch{}}}if(b.macd&&M.macdLine){const K=zd(k,12,26,9);if(K){try{M.macdLine.update({time:K.time,value:K.value})}catch{}try{M.macdSignal.update({time:K.time,value:K.signal})}catch{}try{M.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(b.bollinger&&M.bbMiddle){const K=qs(k,g.bbPeriod||20,g.bbStdDev||2);if(K){try{M.bbUpper.update({time:K.time,value:K.upper})}catch{}try{M.bbMiddle.update({time:K.time,value:K.middle})}catch{}try{M.bbLower.update({time:K.time,value:K.lower})}catch{}}}}}catch{}};d.on("candleUpdate",R);const V=()=>{d.connected&&ye&&Te&&u()};if(d.connected)V();else{const X=()=>{setTimeout(V,200)};d.once("connect",X),setTimeout(()=>{d.connected&&V()},500)}return()=>{d.off("candleUpdate",R),d.off("connect",O),d.off("disconnect",ce),d.off("connect_error",y),d.off("subscription:confirmed"),ye&&Te&&d.connected&&d.emit("unsubscribeCandles",{symbol:ye,timeframe:Te})}},[ye,Te,Yt]),Y.useEffect(()=>{const d=h.current,u=c.current;if(!(!d||!u)&&!(nr.current&&Ne.length>0)&&!(Ne.length===0&&me.current)){if(Ne.length===0&&!me.current){if(lA)return;const O=u.timeScale();d.setData([]),O.fitContent(),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400);return}if(!me.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),ce=O.includes("JPY"),y=An(O),R=rn(O);let V,X;ce?(V=.001,X=f=>Math.abs(Number(f)).toFixed(3)):R?O.startsWith("BTC")||O.startsWith("ETH")?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(4)):y&&(O.startsWith("XAU")||O.startsWith("XAG"))?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(5));try{d.applyOptions({priceFormat:{type:"custom",minMove:V,formatter:X}})}catch{}const se=u.timeScale(),E=$e(ye,Te);Se.current,Se.current=E;const D=[...Ne].sort((f,L)=>f.time-L.time);if(be==="line"||be==="area"){const f=D?.map(L=>({time:L.time,value:L.close})).filter(L=>L.time!=null);f.length>0&&d.setData(f)}else D?.length>0&&d.setData(D);Ke&&d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor}),Yd(d);const $=`${ye}_${Te}`;F.current!==$&&(F.current=$,_b());const C=BA(Te)||60;if(x.current.forEach(f=>{if(f.type==="horizontalray"&&f.primitive){const U=f.rawOriginTime??f.primitive.originTime,b=Re(U,C);f.primitive.originTime=b,f.originTime=b;return}if(f.type==="verticalline"&&f.primitive){const U=f.rawTime??f.primitive.time,b=Re(U,C);f.primitive.time=b,f.time=te(b);return}if(f.type==="infoline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Z=>{const Ae=Re(Z,C);return g==null||M==null?Ae:Math.min(Math.max(Ae,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p1.normalizedTime=te(K),f.p2.rawTime=W,f.p2.normalizedTime=te(W),f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};return}if(f.type==="rulerline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Be=>{const Ce=Re(Be,C);return g==null||M==null?Ce:Math.min(Math.max(Ce,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p2.rawTime=W,f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};const Z=te(K),Ae=te(W),he=Math.abs((Ae??0)-(Z??0));f.primitive.info={priceDiff:f.p2.price-f.p1.price,pricePct:(f.p2.price-f.p1.price)/Math.abs(f.p1.price||1)*100,bars:zs(Rs,K,W,Te),days:Math.max(1,Math.round(he/86400))};return}if(f.type==="arrowedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="rayline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="extendedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="trendbyangle"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="disjointchannel"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="flattopbottom"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="regressionchannel"&&f.primitive&&f.p1&&f.p2){const U=Jr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.intercept=U.intercept,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="stddevchannel"&&f.primitive&&f.p1&&f.p2){const U=Zr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="andrewspitchfork"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="gannfan"||f.type==="ganngrid")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if((f.type==="circle"||f.type==="ellipse")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type==="triangle"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="fibonacci"||f.type==="rectangle")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type!=="trendline"&&f.type!=="gannline"||!f.series||!f.point1||!f.point2)return;const L=f.point1.rawTime??f.point1.time,w=f.point2.rawTime??f.point2.time,p=Re(L,C),_=Re(w,C);f.point1.time=p,f.point2.time=_;const P=DA([{time:p,value:f.point1.price},{time:_,value:f.point2.price}]);try{P.length>0&&f.series.setData(P)}catch{}}),D?.length>0){const f=D[D?.length-1].time,L=BA(Te)||60,p=f-(Te==="M1"?150:Te==="M5"?120:100)*L;try{se.setVisibleRange({from:p,to:f+L*Dd})}catch{se.fitContent()}}else se.fitContent();try{u.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0;const B=se.getVisibleRange();Ie(B),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400)}}},[Ne.length,be,ye,Te]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current||Ne.length===0)return;const u=d.timeScale(),O=u.getVisibleRange()||Ye();if(h.current)try{d.removeSeries(h.current)}catch{}if(v.current)try{d.removeSeries(v.current),v.current=null}catch{}let ce;const y=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),R=y.includes("JPY"),V=An(y),X=rn(y);let se,E;R?(se=.001,E=C=>Math.abs(Number(C)).toFixed(3)):X?y.startsWith("BTC")||y.startsWith("ETH")?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(4)):V&&(y.startsWith("XAU")||y.startsWith("XAG"))?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(5));const D={type:"custom",minMove:se,formatter:E};if(be==="bars"){const C=Ee==="light";ce=d.addBarSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}else if(be==="line"){ce=d.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="area"){ce=d.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="volume ticks"||be==="volume"){const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,priceScaleId:"right"});const B=[...Ne].sort((w,p)=>w.time-p.time);B?.length>0&&ce.setData(B);const f=d.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),d.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const L=B?.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)"}));L.length>0&&f.setData(L),v.current=f}else{const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}if(h.current=ce,Ke&&ce)try{ce.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})}catch{}Yd(ce,!0);const $=BA(Te)||60;if(x.current.forEach(C=>{if(C.type==="horizontalray"&&C.primitive){const U=C.rawOriginTime??C.primitive.originTime,b=Re(U,$);C.primitive.originTime=b,C.originTime=b;return}if(C.type==="verticalline"&&C.primitive){const U=C.rawTime??C.primitive.time,b=Re(U,$);C.primitive.time=b,C.time=te(b);return}if(C.type==="infoline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ae,he)=>Ae.time-he.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ae=>{const he=Re(Ae,$);return M==null||k==null?he:Math.min(Math.max(he,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p1.normalizedTime=te(W),C.p2.rawTime=Z,C.p2.normalizedTime=te(Z),C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};return}if(C.type==="rulerline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ce,Ue)=>Ce.time-Ue.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ce=>{const Ue=Re(Ce,$);return M==null||k==null?Ue:Math.min(Math.max(Ue,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p2.rawTime=Z,C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};const Ae=te(W),he=te(Z),Be=Math.abs((he??0)-(Ae??0));C.primitive.info={priceDiff:C.p2.price-C.p1.price,pricePct:(C.p2.price-C.p1.price)/Math.abs(C.p1.price||1)*100,bars:zs(Rs,W,Z,Te),days:Math.max(1,Math.round(Be/86400))};return}if(C.type==="arrowedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="rayline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="extendedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="trendbyangle"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="disjointchannel"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="flattopbottom"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="regressionchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Jr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.intercept=b.intercept,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="stddevchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Zr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="andrewspitchfork"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="gannfan"||C.type==="ganngrid")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if((C.type==="circle"||C.type==="ellipse")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type==="triangle"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="fibonacci"||C.type==="rectangle")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type!=="trendline"&&C.type!=="gannline"||!C.series||!C.point1||!C.point2)return;const B=C.type==="gannline"?"#7aa6ae":"#22c55e";try{d.removeSeries(C.series)}catch{}const f=d.addLineSeries({color:C.lineColor??B,lineWidth:C.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),L=C.point1.rawTime??C.point1.time,w=C.point2.rawTime??C.point2.time,p=Re(L,$),_=Re(w,$);C.point1.time=p,C.point2.time=_;const P=DA([{time:p,value:C.point1.price},{time:_,value:C.point2.price}]);try{P.length>0&&f.setData(P)}catch{}if(C.decoration)try{f.attachPrimitive(C.decoration)}catch{}C.series=f}),O&&me.current)setTimeout(()=>{try{u.setVisibleRange(O),Ie(O)}catch{if(Ne.length>0)try{const B=Ne[Ne.length-1].time,f=BA(Te)||60,L=B-100*f;u.setVisibleRange({from:L,to:B+f*Dd}),Ie(u.getVisibleRange())}catch{u.fitContent(),Ie(u.getVisibleRange())}}try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!me.current){u.fitContent();try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0,Ie(u.getVisibleRange())}},[be,Ne.length,Cl.length,ye,Ke]),Y.useEffect(()=>{const d=c.current,u=v.current;if(!d||!u||!me.current||Ne.length===0||be!=="volume"&&be!=="volume ticks")return;const ce=[...Ne].sort((y,R)=>y.time-R.time)?.map(y=>({time:y.time,value:y.volume||0,color:y.close>=y.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ce.length>0&&u.setData(ce)},[Ne,be]),Y.useEffect(()=>{if(!ye||!Te||!Ct)return;const u=Object.entries(Ct).filter(([X,se])=>se).map(([X])=>X).filter(X=>X.startsWith("sma")||X.startsWith("ema")||X==="rsi"||X==="macd");if(u.length===0){et({});return}const O=u.map(X=>X==="sma20"?`sma:${Ut?.smaPeriod||20}`:X==="sma50"?"sma:50":X==="ema12"?`ema:${Ut?.emaPeriod||12}`:X==="rsi"?`rsi:${Ut?.rsiPeriod||14}`:X==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const ce=++bt.current,y=Yt||"http://localhost:5002",R=Qt?.indicators||"/api/market-data/indicators",V=localStorage.getItem("token")??localStorage.getItem("authToken");Bt.get(`${y}${R}`,{params:{symbol:ye,timeframe:Te,indicators:O},headers:V?{Authorization:`Bearer ${V}`}:{}}).then(X=>{ce===bt.current&&et(X.data?.data||{})}).catch(X=>{console.error("[ChartArea] Indicator fetch error:",X?.message),ce===bt.current&&et({})})},[ye,Te,Ct,Ut,Yt,Qt]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current)return;const u=_e.current,O=(D,$)=>(u[D]||(u[D]=d.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...$})),u[D]),ce=D=>{if(u[D]){try{d.removeSeries(u[D])}catch{}delete u[D]}},y=()=>{["macdLine","macdSignal","macdHist"].forEach(ce)},R=Ct||{};if(R.sma20&&Je.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(Je.sma20.data.map($=>({time:$.time,value:$.value}))):ce("sma20"),R.sma50&&Je.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(Je.sma50.data.map($=>({time:$.time,value:$.value}))):ce("sma50"),R.ema12&&Je.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(Je.ema12.data.map($=>({time:$.time,value:$.value}))):ce("ema12"),R.rsi&&Je.rsi?.data?.length){const D=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:f=>f.toFixed(1)}});d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),D.setData(Je.rsi.data.map(f=>({time:f.time,value:f.value}))),u.rsi70||(u.rsi70=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),u.rsi30||(u.rsi30=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const $=Je.rsi.data,C=$[0]?.time,B=$[$.length-1]?.time;C&&B&&(u.rsi70.setData([{time:C,value:70},{time:B,value:70}]),u.rsi30.setData([{time:C,value:30},{time:B,value:30}]))}else ce("rsi"),ce("rsi70"),ce("rsi30");if(R.macd&&Je.macd?.data?.length){const D=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}),$=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});u.macdHist||(u.macdHist=d.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}));const C=R.rsi?.65:.8;d.priceScale("macd").applyOptions({scaleMargins:{top:C,bottom:0},borderVisible:!1,autoScale:!0}),R.rsi&&d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const B=Je.macd.data;D.setData(B.map(f=>({time:f.time,value:f.value}))),$.setData(B.map(f=>({time:f.time,value:f.signal}))),u.macdHist.setData(B.map(f=>({time:f.time,value:f.histogram,color:f.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else y();const V=()=>{["bbUpper","bbMiddle","bbLower"].forEach(ce)};if(R.bollinger){const D=Array.from(oi.current.values()).sort((f,L)=>f.time-L.time),$=Ve.current?.bbPeriod||20,C=Ve.current?.bbStdDev||2,B=Ml(D,$,C);if(B){const f=O("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),L=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});f.setData(B.upper),L.setData(B.middle),w.setData(B.lower)}}else V();const X=Array.from(oi.current.values()).sort((D,$)=>D.time-$.time);if(X.length>0){const D=Ve.current||{};if(R.sma20&&u.sma20){const $=Vs(X,D.smaPeriod||20);if($)try{u.sma20.update($)}catch{}}if(R.sma50&&u.sma50){const $=Vs(X,50);if($)try{u.sma50.update($)}catch{}}if(R.ema12&&u.ema12){const $=Nd(X,D.emaPeriod||12);if($)try{u.ema12.update($)}catch{}}if(R.rsi&&u.rsi){const $=Kd(X,D.rsiPeriod||14);if($){try{u.rsi.update($)}catch{}if(u.rsi70)try{u.rsi70.update({time:$.time,value:70})}catch{}if(u.rsi30)try{u.rsi30.update({time:$.time,value:30})}catch{}}}if(R.macd&&u.macdLine){const $=zd(X,12,26,9);if($){try{u.macdLine.update({time:$.time,value:$.value})}catch{}try{u.macdSignal.update({time:$.time,value:$.signal})}catch{}try{u.macdHist.update({time:$.time,value:$.histogram,color:$.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(R.bollinger&&u.bbMiddle){const $=qs(X,D.bbPeriod||20,D.bbStdDev||2);if($){try{u.bbUpper.update({time:$.time,value:$.upper})}catch{}try{u.bbMiddle.update({time:$.time,value:$.middle})}catch{}try{u.bbLower.update({time:$.time,value:$.lower})}catch{}}}}const se=R.rsi&&Je.rsi?.data?.length||R.macd&&Je.macd?.data?.length,E=R.rsi&&Je.rsi?.data?.length&&R.macd&&Je.macd?.data?.length;try{d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:E?.4:se?.25:.05}})}catch{}},[Je,Ct,Ne.length]),Y.useEffect(()=>()=>{const d=c.current;if(!d)return;const u=_e.current;Object.keys(u).forEach(O=>{try{d.removeSeries(u[O])}catch{}}),_e.current={}},[ye,Te]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current;if(!d||!u||!O)return;const y=We!==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"][We]:null,R=(E,D)=>{const $=Math.min(E.time,D.time),C=Math.max(E.time,D.time),B=E.time<=D.time?E.rawTime:D.rawTime,f=E.time<=D.time?D.rawTime:E.rawTime,L=Math.max(E.price,D.price),w=Math.min(E.price,D.price),p=te(Math.round(($+C)/2));return p==null?null:{p1:{rawTime:p,normalizedTime:p,price:L},p2:{rawTime:B,normalizedTime:$,price:w},p3:{rawTime:f,normalizedTime:C,price:w}}};if(!y){if(T.current=!1,S.current=null,I.current=null,N.current=null,Q.current?.series)try{d.removeSeries(Q.current.series)}catch{}if(Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null;return}if(y==="pricelevel"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const p={type:"pricelevel",priceLine:u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:L.toFixed(5)}),price:L,showPrice:!0,showText:!1};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>{O.removeEventListener("click",E)}}if(y==="horizontalray"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new gd(L,f);u.attachPrimitive(w);const p=u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof L=="number"?L.toFixed(5):""}),_=te(f),P={type:"horizontalray",primitive:w,priceLine:p,price:L,originTime:_,rawOriginTime:f,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};He(U=>[...U,P]),x.current.push(P),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="verticalline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=d.timeScale().coordinateToTime(C);if(B==null)return;const f=new Ld(B);u.attachPrimitive(f);const L=te(B),w={type:"verticalline",primitive:f,time:L,rawTime:B,lineColor:"#3b82f6",lineWidth:2,showDate:!0};He(p=>[...p,w]),x.current.push(w),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="text"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new Id(f,L);u.attachPrimitive(w);const p={type:"text",primitive:w,rawTime:f,price:L,text:"Text"};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="infoline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;D||(D=d.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=P<=U?[{time:P,value:E.price},{time:U,value:_}]:[{time:U,value:_},{time:P,value:E.price}];try{D.setData(b)}catch{}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p),x:L,y:w};return}if(D){try{d.removeSeries(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;const b=_-E.price,g=b/Math.abs(E.price)*100,M=BA(Te)||3600,k=Math.abs(U-P),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=E.x,Ae=E.y,he=L,Ce=Math.atan2(-(w-Ae),he-Z)*(180/Math.PI),Ue={priceDiff:b,pricePct:g,bars:K,days:W,angle:Ce},qe=new wd({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_},Ue);u.attachPrimitive(qe);const rt={type:"infoline",primitive:qe,rawP1Time:E.rawTime,rawP2Time:p,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};He(Xe=>[...Xe,rt]),x.current.push(rt),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{d.removeSeries(D)}catch{}}}if(y==="rulerline"){let E=null,D=null;const $=(f,L,w,p)=>{const _=te(f),P=te(w),U=p-L,b=U/Math.abs(L)*100,g=zs(Rs,f,w,Te),M=Math.abs((P??0)-(_??0)),k=Math.max(1,Math.round(M/86400));return{priceDiff:U,pricePct:b,bars:g,days:k}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null||U===E.normalizedTime)return;const b=$(E.rawTime,E.price,_,P);if(!D)D=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},b),u.attachPrimitive(D);else{D.p2={rawTime:_,price:P},D.info=b;const g=P>=E.price;D.color=g?"#3b82f6":"#ef5350",D.fillColor=g?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;if(!E){E={rawTime:_,price:P,normalizedTime:te(_)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const U=E.normalizedTime,b=te(_);if(U==null||b==null)return;const g=$(E.rawTime,E.price,_,P),M=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},g);u.attachPrimitive(M);const k={type:"rulerline",primitive:M,rawP1Time:E.rawTime,rawP2Time:_,p1:{rawTime:E.rawTime,normalizedTime:U,price:E.price},p2:{rawTime:_,normalizedTime:b,price:P},lineColor:P>=E.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="arrowedline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;const P=te(p);if(!(P==null||P===E.normalizedTime))if(!D)D=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{c.current?.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"arrowedline",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,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};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(y==="rayline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Td({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"rayline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},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};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="extendedline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new bd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"extendedline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},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};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="crossline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=new Qd({rawTime:f,price:L});u.attachPrimitive(p);const _={type:"crossline",primitive:p,p:{rawTime:f,normalizedTime:w,price:L},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};He(P=>[...P,_]),x.current.push(_),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendbyangle"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Fd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"trendbyangle",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="disjointchannel"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new Ns(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;const K=(E.price+D.price)/2;M>=K?($={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:2*K-M}):(C={rawTime:g,normalizedTime:k,price:M},$={rawTime:g,normalizedTime:k,price:2*K-M}),L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new Ns(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="flattopbottom"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new ul(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;$={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:D.price},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new ul(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="regressionchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(g)if(!D)D=new Ks({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}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new Ks({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});u.attachPrimitive(M);const k={type:"regressionchannel",primitive:M,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};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="stddevchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(g)if(!D)D=new dl({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}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new dl({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});u.attachPrimitive(M);const k={type:"stddevchannel",primitive:M,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};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="andrewspitchfork"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=C+140,_=d.timeScale().coordinateToTime(p);if(_==null)return;const P=te(_);if(P==null)return;const U={rawTime:f,normalizedTime:w,price:L},b={rawTime:_,normalizedTime:P,price:L},g={rawTime:f,normalizedTime:w,price:L},M=new Ud({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:g.rawTime,price:g.price});u.attachPrimitive(M);const k={type:"andrewspitchfork",primitive:M,p1:U,p2:b,p3:g};He(K=>[...K,k]),x.current.push(k),z(k),fe.current=k,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="gannfan"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Sd({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"gannfan",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="ganngrid"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Ed({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"ganngrid",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendline"||y==="gannline"){const E=y,D=E==="gannline"?"#7aa6ae":"#22c55e",$=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(!(P==null||U==null)&&(P=te(P),P!=null))if(N.current===null){N.current={time:P,price:U};const b=d.addLineSeries({color:D,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:E,series:b},b.setData([{time:P,value:U}])}else{const b=N.current,g={time:P,price:U},M=1,k=1e-5,K=Math.abs(g.time-b.time),W=Math.abs(g.price-b.price);if(K<M&&W<k){try{d.removeSeries(Q.current.series)}catch{}N.current=null,Q.current=null;return}const Z={time:b.time,rawTime:b.time,price:b.price},Ae={time:g.time,rawTime:g.time,price:g.price},he=DA([{time:Z.time,value:Z.price},{time:Ae.time,value:Ae.price}]);if(he.length>0){Q.current.series.setData(he);const Be=new xd(Z,Ae,D,2);try{Q.current.series.attachPrimitive(Be)}catch{}const Ce={type:E,series:Q.current.series,point1:Z,point2:Ae,decoration:Be};He(Ue=>[...Ue,Ce]),x.current.push(Ce)}De(null),N.current=null,Q.current=null}},C=L=>{if(N.current===null||Q.current?.type!=="trendline"&&Q.current?.type!=="gannline")return;L.preventDefault(),L.stopPropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(P==null||U==null||(P=te(P),P==null))return;const b=N.current,g=DA([{time:b.time,value:b.price},{time:P,value:U}]);g.length>0&&Q.current.series.setData(g)},B=L=>{L.stopPropagation()},f={capture:!0,passive:!1};return O.addEventListener("click",$,f),O.addEventListener("mousemove",C,f),O.addEventListener("mousemove",B,f),()=>{if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}O.removeEventListener("click",$,f),O.removeEventListener("mousemove",C,f),O.removeEventListener("mousemove",B,f)}}if(y==="parallellines"){let E=null,D=null,$=null,C=0,B=null;const f=(U,b,g,M)=>{U.p1={rawTime:b.rawTime,price:b.price},U.p2={rawTime:g.rawTime,price:g.price},U.b1={rawTime:M.b1.rawTime,price:M.b1.price},U.b2={rawTime:M.b2.rawTime,price:M.b2.price},U.p3={rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}},L=(U,b,g)=>{const M=Od(U,b,g);if(!M)return null;if(!B)B=new pl({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:M.b1.rawTime,price:M.b1.price},{rawTime:M.b2.rawTime,price:M.b2.price},{rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}),u.attachPrimitive(B);else{f(B,U,b,M);try{d.applyOptions({})}catch{}}return M},w=U=>{U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===0){E={rawTime:k,normalizedTime:W,price:K},C=1;return}if(C===1){if(D={rawTime:k,normalizedTime:W,price:K},Math.abs(D.normalizedTime-E.normalizedTime)<1)return;const Z=te((E.normalizedTime+D.normalizedTime)/2);if(Z==null)return;const Ae=(E.price+D.price)/2;$={rawTime:Z,normalizedTime:Z,price:Ae},L(E,D,$),C=2;return}if(C===2&&E&&D){$={rawTime:k,normalizedTime:W,price:K};const Z=L(E,D,$);if(!Z||!B)return;try{u.detachPrimitive(B)}catch{}const Ae=new pl({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:Z.b1.rawTime,price:Z.b1.price},{rawTime:Z.b2.rawTime,price:Z.b2.price},{rawTime:Z.bottomMid.rawTime,price:Z.bottomMid.price});u.attachPrimitive(Ae);const he={type:"equidistantchannel",primitive:Ae,p1:E,p2:D,p3:Z.bottomMid,b1:Z.b1,b2:Z.b2,bottomMid:Z.bottomMid};He(Be=>[...Be,he]),x.current.push(he),De(null),C=0,E=null,D=null,$=null,B=null}}},p=U=>{if(C===0||!E)return;const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===1){const Z={rawTime:k,normalizedTime:W,price:K},Ae=te((E.normalizedTime+Z.normalizedTime)/2);if(Ae==null)return;const he=(E.price+Z.price)/2;L(E,Z,{rawTime:Ae,price:he});return}C===2&&D&&L(E,D,{rawTime:k,price:K})}},_=U=>{U.stopPropagation()},P={capture:!0,passive:!1};return O.addEventListener("click",w,P),O.addEventListener("mousemove",p,P),O.addEventListener("mousemove",_,P),()=>{if(C=0,E=null,D=null,$=null,J.current=[],B)try{u.detachPrimitive(B)}catch{}B=null,O.removeEventListener("click",w,P),O.removeEventListener("mousemove",p,P),O.removeEventListener("mousemove",_,P)}}if(y==="fibonacci"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(!(p==null||_==null))if(!D)D=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{d.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;if(Math.abs(_-E.price)<1e-5){E=null;return}const b=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"fibonacci",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_}};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}const V=E=>{if(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),y==="trendline"||y==="gannline"||y==="parallellines"||y==="fibonacci"||y!=="rectangle"&&y!=="circle"&&y!=="triangle"&&y!=="ellipse")return;const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B!=null){if(T.current=!0,S.current={time:B,normalizedTime:B,rawTime:L,price:f},I.current=null,y==="rectangle"){const w=new Bd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"rectangle",primitive:w}}if(y==="circle"){const w=new yd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1});u.attachPrimitive(w),Q.current={type:"circle",primitive:w}}if(y==="triangle"){const w=new Cd({rawTime:L,price:f},{rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"triangle",primitive:w}}if(y==="ellipse"){const w=new vd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});u.attachPrimitive(w),Q.current={type:"ellipse",primitive:w}}if(y==="parallellines"){const w=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},X=E=>{if(!T.current||!S.current||!Q.current)return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B==null)return;I.current={time:B,normalizedTime:B,rawTime:L,price:f};const w=S.current;if(Q.current.type==="rectangle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="circle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="triangle"){const p=Q.current.primitive,_=R(w,{time:B,rawTime:L,price:f});if(!_)return;p.p1={rawTime:_.p1.rawTime,price:_.p1.price},p.p2={rawTime:_.p2.rawTime,price:_.p2.price},p.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="ellipse"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="parallellines")if(Q.current.firstLine){const p=Q.current.firstLine;p.endTime-p.startTime;const _=p.endPrice-p.startPrice,P=f,U=P+_;if(Q.current.secondLine)Q.current.secondLine.setData([{time:w.time,value:P},{time:B,value:U}]);else{const b=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});b.setData([{time:w.time,value:P},{time:B,value:U}]),Q.current.secondLine=b}}else Q.current.series.setData([{time:w.time,value:w.price},{time:B,value:f}])},se=E=>{if(E&&(E.preventDefault(),E.stopPropagation()),!T.current||!Q.current||!S.current)return;const D=S.current,$=I.current||D;if(Q.current.type==="parallellines")if(Q.current.firstLine){const C={type:"parallellines",firstLine:Q.current.series,secondLine:Q.current.secondLine,firstLineData:Q.current.firstLine};He(B=>[...B,C]),x.current.push(C),De(null),Q.current=null,T.current=!1,S.current=null,I.current=null;return}else{Q.current.firstLine={startTime:D.time,startPrice:D.price,endTime:$.time,endPrice:$.price},T.current=!1,S.current=null,I.current=null;return}if(Q.current.type==="rectangle"){const C=S.current,B=I.current||C,f=Math.max(C.price,B.price),L=Math.min(C.price,B.price),w=te(Math.min(C.time,B.time)),p=te(Math.max(C.time,B.time));if(w!=null&&p!=null&&Math.abs(p-w)>=1&&Math.abs(f-L)>=1e-5){const _=Q.current.primitive,P=C.time<=B.time?C.rawTime:B.rawTime,U=C.time<=B.time?B.rawTime:C.rawTime,b={rawTime:P,normalizedTime:w,price:f},g={rawTime:U,normalizedTime:p,price:L};_.p1={rawTime:b.rawTime,price:b.price},_.p2={rawTime:g.rawTime,price:g.price};const M={type:"rectangle",primitive:_,p1:b,p2:g};He(k=>[...k,M]),x.current.push(M),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="circle"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=3){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price};const U={type:"circle",primitive:C,p1:B,p2:f};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="triangle"){const C=Q.current.primitive,B=R(D,$);if(B){const f=Math.abs(B.p3.normalizedTime-B.p2.normalizedTime),L=Math.abs(B.p1.price-B.p2.price);if(f>=1&&L>=1e-5){C.p1={rawTime:B.p1.rawTime,price:B.p1.price},C.p2={rawTime:B.p2.rawTime,price:B.p2.price},C.p3={rawTime:B.p3.rawTime,price:B.p3.price};const w={type:"triangle",primitive:C,p1:B.p1,p2:B.p2,p3:B.p3};He(p=>[...p,w]),x.current.push(w),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="ellipse"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=4){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price},C.previewAsLine=!1,C.minorRatio=.45;const U={type:"ellipse",primitive:C,p1:B,p2:f,minorRatio:.45};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}T.current=!1,S.current=null,I.current=null,Q.current=null};if(y==="rectangle"||y==="circle"||y==="triangle"||y==="ellipse"){const E={capture:!0,passive:!1},D=$=>{T.current||$.stopPropagation()};return O.addEventListener("mousedown",V,E),O.addEventListener("mousemove",X,E),O.addEventListener("mousemove",D,E),O.addEventListener("mouseup",se,E),()=>{if((Q.current?.type==="rectangle"||Q.current?.type==="circle"||Q.current?.type==="triangle"||Q.current?.type==="ellipse")&&Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null,T.current=!1,S.current=null,I.current=null,O.removeEventListener("mousedown",V,E),O.removeEventListener("mousemove",X,E),O.removeEventListener("mousemove",D,E),O.removeEventListener("mouseup",se,E)}}},[We,Ne,He,De]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current,ce=We===null||We===1;if(!ce||!d||!u||!O){ce||(z(null),G([]),le(null),we([]));return}const y=10,R=8;function V(B){if(!B)return[];if(B.type==="trendline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="gannline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="rectangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=Math.min(f,w),P=Math.max(f,w),U=Math.min(L,p),b=Math.max(L,p),g=(_+P)/2,M=(U+b)/2;return[{x:_,y:U},{x:g,y:U},{x:P,y:U},{x:_,y:M},{x:P,y:M},{x:_,y:b},{x:g,y:b},{x:P,y:b}]}if(B.type==="circle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="triangle"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="ellipse"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=(f+w)/2,P=(L+p)/2,U=w-f,b=p-L,g=Math.hypot(U,b);if(g<.001)return[];const M=U/g,k=b/g,K=-k,W=M,Z=g/2,Ae=Z*Math.max(.05,B.minorRatio??.45);return[{x:_-M*Z,y:P-k*Z},{x:_+K*Ae,y:P+W*Ae},{x:_+M*Z,y:P+k*Z},{x:_-K*Ae,y:P-W*Ae}]}if(B.type==="gannfan"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="ganngrid"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="arrowedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="rayline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="extendedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="crossline"&&B.p){const f=d.timeScale().timeToCoordinate(B.p.rawTime),L=u.priceToCoordinate(B.p.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="pricelevel"&&B.price!=null){const f=u.priceToCoordinate(B.price);return f==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:f}]}if(B.type==="text"&&B.rawTime!=null&&B.price!=null){const f=d.timeScale().timeToCoordinate(B.rawTime),L=u.priceToCoordinate(B.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="trendbyangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="andrewspitchfork"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="equidistantchannel"&&B.p1&&B.p2&&B.b1&&B.b2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.b1.rawTime),P=u.priceToCoordinate(B.b1.price),U=d.timeScale().timeToCoordinate(B.b2.rawTime),b=u.priceToCoordinate(B.b2.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:(_+U)/2,y:(P+b)/2}]}if(B.type==="regressionchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="stddevchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="disjointchannel"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="flattopbottom"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="infoline"&&B.p1&&B.p2){const f=B.p1.rawTime??B.p1.time,L=B.p2.rawTime??B.p2.time,w=d.timeScale().timeToCoordinate(f),p=u.priceToCoordinate(B.p1.price),_=d.timeScale().timeToCoordinate(L),P=u.priceToCoordinate(B.p2.price);return w==null||p==null||_==null||P==null?[]:[{x:w,y:p},{x:_,y:P}]}if(B.type==="rulerline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="fibonacci"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="horizontalray"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.originTime),w=u.priceToCoordinate(f.price);return L==null||w==null?[]:[{x:L,y:w}]}if(B.type==="verticalline"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.time);if(L==null)return[];const w=f.midYCss??200;return[{x:L,y:w}]}return[]}function X(B,f){for(let L=dt.length-1;L>=0;L--){const w=dt[L];if(w.type==="trendline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.min(p,P),g=Math.max(p,P),M=Math.min(_,U),k=Math.max(_,U),K=(b+g)/2,W=(M+k)/2,Z=[{x:b,y:M,mode:"handle1"},{x:K,y:M,mode:"handle2"},{x:g,y:M,mode:"handle3"},{x:b,y:W,mode:"handle4"},{x:g,y:W,mode:"handle5"},{x:b,y:k,mode:"handle6"},{x:K,y:k,mode:"handle7"},{x:g,y:k,mode:"handle8"}];for(const Ue of Z)if(Math.hypot(B-Ue.x,f-Ue.y)<y)return{object:w,mode:Ue.mode};const Ae=ut(B,f,b,M,g,M),he=ut(B,f,b,k,g,k),Be=ut(B,f,b,M,b,k),Ce=ut(B,f,g,M,g,k);if(Ae<R||he<R||Be<R||Ce<R||vi(B,f,[{x:b,y:M},{x:g,y:M},{x:g,y:k},{x:b,y:k}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(P-p,U-_);if(b<2)continue;const g=Math.hypot(B-p,f-_),M=Math.hypot(B-P,f-U);if(g<y)return{object:w,mode:"handle1"};if(M<y)return{object:w,mode:"handle2"};if(Math.abs(g-b)<R||g<b)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=ut(B,f,p,_,P,U),Z=ut(B,f,P,U,b,g),Ae=ut(B,f,b,g,p,_);if(W<R||Z<R||Ae<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=P-p,k=U-_,K=Math.hypot(M,k);if(K<2)continue;const W=M/K,Z=k/K,Ae=-Z,he=W,Be=K/2,Ce=Be*Math.max(.05,w.minorRatio??.45);if(Be<2||Ce<2)continue;const Ue=b-W*Be,qe=g-Z*Be,rt=b+Ae*Ce,Xe=g+he*Ce,vt=b+W*Be,pt=g+Z*Be,Tt=b-Ae*Ce,_t=g-he*Ce,iA=Math.hypot(B-Ue,f-qe),cA=Math.hypot(B-rt,f-Xe),wA=Math.hypot(B-vt,f-pt),qA=Math.hypot(B-Tt,f-_t);if(iA<y)return{object:w,mode:"handle1"};if(cA<y)return{object:w,mode:"handle2"};if(wA<y)return{object:w,mode:"handle3"};if(qA<y)return{object:w,mode:"handle4"};const _i=(B-b)*W+(f-g)*Z,Zs=(B-b)*Ae+(f-g)*he,of=_i/Be,af=Zs/Ce,lf=of*of+af*af;if(Math.abs(lf-1)<.2||lf<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(tb(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(Ab(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const p=d.timeScale().timeToCoordinate(w.p.rawTime),_=u.priceToCoordinate(w.p.price);if(p==null||_==null)continue;if(Math.hypot(B-p,f-_)<y)return{object:w,mode:"handle1"};const U=Math.abs(f-_),b=Math.abs(B-p);if(U<R||b<R)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const p=d.timeScale().timeToCoordinate(w.rawTime),_=u.priceToCoordinate(w.price);if(p==null||_==null)continue;const P=Hd(w,p,_);if(B>=P.left&&B<=P.right&&f>=P.top&&f<=P.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.b1.rawTime),g=u.priceToCoordinate(w.b1.price),M=d.timeScale().timeToCoordinate(w.b2.rawTime),k=u.priceToCoordinate(w.b2.price),K=b!=null&&M!=null?(b+M)/2:null,W=g!=null&&k!=null?(g+k)/2:null;if(p==null||_==null||P==null||U==null||K==null||W==null||b==null||g==null||M==null||k==null)continue;const Z=Math.hypot(B-p,f-_),Ae=Math.hypot(B-P,f-U),he=Math.hypot(B-K,f-W),Be=Math.hypot(p-K,_-W)<y*1.5;if(Be&&Math.min(Z,he)<y*1.5)return{object:w,mode:"handle3"};if(he<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle2"};if(Be)continue;if(Z<y)return{object:w,mode:"handle1"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:M,y:k},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{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 p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=(P+b)/2,Z=(U+g)/2;let Ae=W-p,he=Z-_;Math.abs(Ae)<1e-4&&(Ae=1e-4);const Be=he/Ae,Ce=O.clientWidth,Ue=U+Be*(Ce-P),qe=g+Be*(Ce-b),rt=ut(B,f,P,U,Ce,Ue),Xe=ut(B,f,b,g,Ce,qe);if(rt<R||Xe<R||vi(B,f,[{x:P,y:U},{x:Ce,y:Ue},{x:Ce,y:qe},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const p=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,P=d.timeScale().timeToCoordinate(p),U=u.priceToCoordinate(w.p1.price),b=d.timeScale().timeToCoordinate(_),g=u.priceToCoordinate(w.p2.price);if(P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-P,f-U),k=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(ut(B,f,P,U,b,g)<R)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.originTime),P=u.priceToCoordinate(p.price);if(P==null)continue;if(_!=null&&Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};const U=_==null?0:Math.max(0,_);if(B>=U&&Math.abs(f-P)<R)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.time);if(_==null)continue;const P=p.midYCss??200;if(Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};if(Math.abs(B-_)<R)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const p=u.priceToCoordinate(w.price);if(p==null)continue;const P=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(B-P,f-p)<y)return{object:w,mode:"line"};if(Math.abs(f-p)<R)return{object:w,mode:"line"}}}return null}const se=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=X(L,w);if(p){if(B.preventDefault(),B.stopPropagation(),B.detail>=2){Qe.current=!0,q(p.object),j.current=null,oe.current=null;return}z(p.object),le(null),we([]),j.current=p.mode,p.object.type==="rayline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="extendedline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="crossline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,p:{...p.object.p}}),p.object.type==="text"&&p.mode==="line"&&(oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}),p.object.type==="trendbyangle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="equidistantchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="andrewspitchfork"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="regressionchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="stddevchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="disjointchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="flattopbottom"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="fibonacci"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="gannfan"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="ganngrid"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="rectangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4"||p.mode==="handle5"||p.mode==="handle6"||p.mode==="handle7"||p.mode==="handle8")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="circle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="triangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="ellipse"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}),p.object.type==="horizontalray"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}),p.object.type==="verticalline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,time:p.object.primitive.time}),p.mode==="line"&&(p.object.type==="rulerline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="infoline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="arrowedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rayline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="extendedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="crossline"?oe.current={x:L,y:w,p:{...p.object.p}}:p.object.type==="text"?oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}:p.object.type==="trendbyangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="equidistantchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="andrewspitchfork"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="regressionchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="stddevchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="disjointchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="flattopbottom"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="fibonacci"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="gannfan"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rectangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="circle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="triangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="ellipse"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}:p.object.type==="ganngrid"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="horizontalray"?oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}:p.object.type==="verticalline"?oe.current={x:L,y:w,time:p.object.primitive.time}:p.object.type==="pricelevel"?oe.current={y:w,price:p.object.price}:oe.current={x:L,y:w,point1:{...p.object.point1},point2:{...p.object.point2}})}else z(null),j.current=null,G([]),le(null),we([])},E=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top;if(!j.current){const b=X(L,w);if(b?.object&&!fe.current){const g=V(b.object);le(M=>M===b.object?M:b.object),we(M=>M.length===g.length&&M.every((k,K)=>k.x===g[K].x&&k.y===g[K].y)?M:g)}else le(g=>g==null?g:null),we(g=>g.length===0?g:[]);return}const p=fe.current;if(!p)return;const _=d.timeScale().coordinateToTime(L),P=u.coordinateToPrice(w);if(_==null||P==null)return;let U=te(_);if(U!=null){if(p.type==="infoline"&&p.p1&&p.p2){const b=K=>{const W=K.rawTime??K.time,Z=K.normalizedTime??te(W);return{rawTime:W,normalizedTime:Z,price:K.price}},g=(K,W)=>{const Z=K.normalizedTime??te(K.rawTime),Ae=W.normalizedTime??te(W.rawTime);if(Z==null||Ae==null)return;const he=W.price-K.price,Be=he/Math.abs(K.price)*100,Ce=BA(Te)||3600,Ue=Math.abs(Ae-Z),qe=Math.max(1,Math.round(Ue/Ce)),rt=Math.max(1,Math.round(Ue/86400)),Xe=d.timeScale().timeToCoordinate(K.rawTime),vt=u.priceToCoordinate(K.price),pt=d.timeScale().timeToCoordinate(W.rawTime),Tt=u.priceToCoordinate(W.price),_t=Xe!=null&&vt!=null&&pt!=null&&Tt!=null?Math.atan2(-(Tt-vt),pt-Xe)*(180/Math.PI):p.primitive?.info?.angle??0,iA={priceDiff:he,pricePct:Be,bars:qe,days:rt,angle:_t},cA=p.primitive;if(cA){cA.p1={rawTime:K.rawTime,price:K.price},cA.p2={rawTime:W.rawTime,price:W.price},cA.info=iA;try{c.current?.applyOptions({})}catch{}}const wA={...p,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:Z,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:Ae,price:W.price}};He(qA=>{const _i=qA.map(Zs=>Zs===p?wA:Zs);return x.current=_i,_i}),z(wA),fe.current=wA,Xe!=null&&vt!=null&&pt!=null&&Tt!=null&&G([{x:Xe,y:vt},{x:pt,y:Tt}])},M=b(p.p1),k=b(p.p2);if(M.rawTime==null||M.normalizedTime==null||k.rawTime==null||k.normalizedTime==null)return;if(j.current==="handle1"){const K=d.timeScale().coordinateToTime(L)??_;g({rawTime:K,normalizedTime:U,price:P},k)}else if(j.current==="handle2"){const K=d.timeScale().coordinateToTime(L)??_;g(M,{rawTime:K,normalizedTime:U,price:P})}else if(j.current==="line"){const K=oe.current;if(!K)return;const W=b(K.p1),Z=b(K.p2);if(W.rawTime==null||W.normalizedTime==null||Z.rawTime==null||Z.normalizedTime==null)return;const Ae=d.timeScale().coordinateToTime(K.x)??W.rawTime,he=u.coordinateToPrice(K.y);if(Ae==null||he==null)return;const Be=te(Ae)??W.normalizedTime;if(Be==null)return;const Ce=U-Be,Ue=P-he,qe=te(W.normalizedTime+Ce),rt=te(Z.normalizedTime+Ce);if(qe==null||rt==null)return;const Xe=_-Ae;g({rawTime:W.rawTime+Xe,normalizedTime:qe,price:W.price+Ue},{rawTime:Z.rawTime+Xe,normalizedTime:rt,price:Z.price+Ue})}return}if(p.type==="rulerline"&&p.p1&&p.p2){const b=(g,M)=>{const k=g.normalizedTime??g.rawTime,K=M.normalizedTime??M.rawTime,W=M.price-g.price,Z=W/Math.abs(g.price)*100,Ae=zs(Rs,g.rawTime,M.rawTime,Te),he=Math.abs(K-k),Be=Math.max(1,Math.round(he/86400)),Ce={priceDiff:W,pricePct:Z,bars:Ae,days:Be},Ue=p.primitive;if(Ue){Ue.p1={rawTime:g.rawTime,price:g.price},Ue.p2={rawTime:M.rawTime,price:M.price},Ue.info=Ce;const Tt=M.price>=g.price;Ue.color=Tt?"#3b82f6":"#ef5350",Ue.fillColor=Tt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const qe={...p,rawP1Time:g.rawTime,rawP2Time:M.rawTime,p1:g,p2:M};He(Tt=>{const _t=Tt.map(iA=>iA===p?qe:iA);return x.current=_t,_t}),z(qe),fe.current=qe;const rt=d.timeScale().timeToCoordinate(g.rawTime),Xe=u.priceToCoordinate(g.price),vt=d.timeScale().timeToCoordinate(M.rawTime),pt=u.priceToCoordinate(M.price);rt!=null&&Xe!=null&&vt!=null&&pt!=null&&G([{x:rt,y:Xe},{x:(rt+vt)/2,y:(Xe+pt)/2},{x:vt,y:pt}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="arrowedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rayline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;b(p.p1,{rawTime:g,normalizedTime:M,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="extendedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="crossline"&&p.p){const b=M=>{const k=p.primitive;if(k){k.center={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p:M};He(Ae=>{const he=Ae.map(Be=>Be===p?K:Be);return x.current=he,he}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(M.rawTime),Z=u.priceToCoordinate(M.price);W!=null&&Z!=null&&G([{x:W,y:Z}])},g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P});return}if(p.type==="pricelevel"&&p.price!=null){const b=u.coordinateToPrice(w);if(b==null)return;try{p.priceLine.applyOptions({price:b,title:b.toFixed(5)})}catch{}p.textPrimitive&&(p.textPrimitive.price=b);const g=c.current?c.current.paneSize().width:400,M=u.priceToCoordinate(b);M!=null&&G([{x:g/2,y:M}]);const k={...p,price:b};He(K=>{const W=K.map(Z=>Z===p?k:Z);return x.current=W,W}),z(k),fe.current=k;return}if(p.type==="text"){const b=d.timeScale().coordinateToTime(L);if(b==null)return;const g=p.primitive;if(g){g.rawTime=b,g.price=P;try{c.current?.applyOptions({})}catch{}}const M={...p,rawTime:b,price:P};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M;return}if(p.type==="trendbyangle"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"||j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="equidistantchannel"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=Od(g,M,k);if(!K)return;const W=p.primitive;if(W){W.p1={rawTime:g.rawTime,price:g.price},W.p2={rawTime:M.rawTime,price:M.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 Z={...p,p1:g,p2:M,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};He(Ae=>{const he=Ae.map(Be=>Be===p?Z:Be);return x.current=he,he}),z(Z),fe.current=Z};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??te(p.p3.rawTime),price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,price:g.p3.price+W});return}}if(p.type==="regressionchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Jr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,intercept:k.intercept,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="stddevchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Zr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="andrewspitchfork"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=p.primitive;if(K){K.p1={rawTime:g.rawTime,price:g.price},K.p2={rawTime:M.rawTime,price:M.price},K.p3={rawTime:k.rawTime,price:k.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:g,p2:M,p3:k};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,p.p2,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,normalizedTime:he,price:g.p3.price+W});return}}if(p.type==="disjointchannel"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(Z,Ae,g.p3,g.p4);return}if(j.current==="handle3"){const W=(g.p3.price+g.p4.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(g.p1,g.p2,Z,Ae);return}if(j.current==="handle2"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:P};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:2*W-P};if(Ae.normalizedTime==null)return;b(Ae,Z,g.p3,g.p4);return}if(j.current==="handle4"){const W=P-g.p4.price,Z={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+W};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+W};if(Ae.normalizedTime==null)return;b(g.p1,Ae,g.p3,Z);return}}if(p.type==="flattopbottom"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p2.price};b(W,Z,g.p3,g.p4);return}if(j.current==="handle3"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p4.price};b(g.p1,g.p2,W,Z);return}if(j.current==="handle2"||j.current==="handle4"){const W=j.current==="handle2"?g.p2:g.p4,Z=P-W.price,Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+Z},he={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+Z};if(Ae.normalizedTime==null||he.normalizedTime==null)return;b(g.p1,Ae,g.p3,he);return}}if(p.type==="fibonacci"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rectangle"&&p.p1&&p.p2){const b=(pt,Tt)=>{const _t=p.primitive;if(_t){_t.p1={rawTime:pt.rawTime,price:pt.price},_t.p2={rawTime:Tt.rawTime,price:Tt.price};try{c.current?.applyOptions({})}catch{}}const iA={...p,p1:pt,p2:Tt};He(cA=>{const wA=cA.map(qA=>qA===p?iA:qA);return x.current=wA,wA}),z(iA),fe.current=iA},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const pt=d.timeScale().coordinateToTime(g.x),Tt=u.coordinateToPrice(g.y);if(pt==null||Tt==null)return;const _t=te(pt);if(_t==null)return;const iA=k-_t,cA=P-Tt,wA=te(g.p1.normalizedTime+iA),qA=te(g.p2.normalizedTime+iA);if(wA==null||qA==null)return;const _i=_-pt;b({rawTime:g.p1.rawTime+_i,normalizedTime:wA,price:g.p1.price+cA},{rawTime:g.p2.rawTime+_i,normalizedTime:qA,price:g.p2.price+cA});return}const K=Math.min(g.p1.normalizedTime,g.p2.normalizedTime),W=Math.max(g.p1.normalizedTime,g.p2.normalizedTime),Z=Math.max(g.p1.price,g.p2.price),Ae=Math.min(g.p1.price,g.p2.price),he=g.p1.normalizedTime<=g.p2.normalizedTime?g.p1.rawTime:g.p2.rawTime,Be=g.p1.normalizedTime<=g.p2.normalizedTime?g.p2.rawTime:g.p1.rawTime;let Ce=K,Ue=W,qe=Z,rt=Ae,Xe=he,vt=Be;if((j.current==="handle1"||j.current==="handle4"||j.current==="handle6")&&(Ce=k,Xe=M),(j.current==="handle3"||j.current==="handle5"||j.current==="handle8")&&(Ue=k,vt=M),(j.current==="handle1"||j.current==="handle2"||j.current==="handle3")&&(qe=P),(j.current==="handle6"||j.current==="handle7"||j.current==="handle8")&&(rt=P),Ce>Ue){const pt=Ce,Tt=Xe;Ce=Ue,Xe=vt,Ue=pt,vt=Tt}if(qe<rt){const pt=qe;qe=rt,rt=pt}b({rawTime:Xe,normalizedTime:Ce,price:qe},{rawTime:vt,normalizedTime:Ue,price:rt});return}if(p.type==="circle"&&p.p1&&p.p2){const b=(qe,rt)=>{const Xe=p.primitive;if(Xe){Xe.p1={rawTime:qe.rawTime,price:qe.price},Xe.p2={rawTime:rt.rawTime,price:rt.price};try{c.current?.applyOptions({})}catch{}}const vt={...p,p1:qe,p2:rt};He(pt=>{const Tt=pt.map(_t=>_t===p?vt:_t);return x.current=Tt,Tt}),z(vt),fe.current=vt},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=te(k.p1.normalizedTime+Ae),Ce=te(k.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:k.p1.rawTime+Ue,normalizedTime:Be,price:k.p1.price+he},{rawTime:k.p2.rawTime+Ue,normalizedTime:Ce,price:k.p2.price+he});return}if(p.type==="triangle"&&p.p1&&p.p2&&p.p3){const b=(Xe,vt,pt)=>{const Tt=p.primitive;if(Tt){Tt.p1={rawTime:Xe.rawTime,price:Xe.price},Tt.p2={rawTime:vt.rawTime,price:vt.price},Tt.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const _t={...p,p1:Xe,p2:vt,p3:pt};He(iA=>{const cA=iA.map(wA=>wA===p?_t:wA);return x.current=cA,cA}),z(_t),fe.current=_t},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle1"){b({rawTime:g,normalizedTime:M,price:P},p.p2,p.p3);return}if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=_-K,Ce=Xe=>{const vt=Xe.normalizedTime??te(Xe.rawTime);if(vt==null)return null;const pt=te(vt+Ae);return pt==null?null:{rawTime:Xe.rawTime+Be,normalizedTime:pt,price:Xe.price+he}},Ue=Ce(k.p1),qe=Ce(k.p2),rt=Ce(k.p3);if(!Ue||!qe||!rt)return;b(Ue,qe,rt);return}if(p.type==="ellipse"&&p.p1&&p.p2){const b=(K,W,Z=p.minorRatio??.45)=>{const Ae=p.primitive;if(Ae){Ae.p1={rawTime:K.rawTime,price:K.price},Ae.p2={rawTime:W.rawTime,price:W.price},Ae.minorRatio=Math.max(.05,Z);try{c.current?.applyOptions({})}catch{}}const he={...p,p1:K,p2:W,minorRatio:Math.max(.05,Z)};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const K=d.timeScale().coordinateToTime(g.x),W=u.coordinateToPrice(g.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=k-Z,he=P-W,Be=te(g.p1.normalizedTime+Ae),Ce=te(g.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:g.p1.rawTime+Ue,normalizedTime:Be,price:g.p1.price+he},{rawTime:g.p2.rawTime+Ue,normalizedTime:Ce,price:g.p2.price+he},g.minorRatio??p.minorRatio??.45);return}if(j.current==="handle1"){b({rawTime:M,normalizedTime:k,price:P},p.p2,p.minorRatio??.45);return}if(j.current==="handle3"){b(p.p1,{rawTime:M,normalizedTime:k,price:P},p.minorRatio??.45);return}if(j.current==="handle2"||j.current==="handle4"){const K=d.timeScale().timeToCoordinate(p.p1.rawTime),W=u.priceToCoordinate(p.p1.price),Z=d.timeScale().timeToCoordinate(p.p2.rawTime),Ae=u.priceToCoordinate(p.p2.price);if(K==null||W==null||Z==null||Ae==null)return;const he=(K+Z)/2,Be=(W+Ae)/2,Ce=Z-K,Ue=Ae-W,qe=Math.hypot(Ce,Ue);if(qe<.001)return;const rt=-Ue/qe,Xe=Ce/qe,vt=Math.abs((L-he)*rt+(w-Be)*Xe),pt=Math.max(.05,vt*2/qe);b(p.p1,p.p2,pt);return}return}if(p.type==="gannfan"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="ganngrid"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="verticalline"&&p.primitive){const b=p.primitive;b.time=_;const g={...p,time:te(_),rawTime:_};He(k=>{const K=k.map(W=>W===p?g:W);return x.current=K,K}),z(g),fe.current=g;const M=d.timeScale().timeToCoordinate(_);M!=null&&G([{x:M,y:b.midYCss??200}]),c.current?.applyOptions({});return}if(p.type==="horizontalray"&&p.primitive){const b=p.primitive,g=oe.current;if(!g)return;if(j.current==="handle1"){if(b.price=P,b.originTime=_,p.priceLine)try{p.priceLine.applyOptions({price:P,title:p.showPrice!==!1?P.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=P,p.textPrimitive.originTime=_);const M={...p,price:b.price,originTime:b.originTime,rawOriginTime:_};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M,c.current?.applyOptions({})}else if(j.current==="line"){const M=u.coordinateToPrice(g.y);if(M==null)return;const k=P-M;if(b.price=g.price+k,p.priceLine)try{p.priceLine.applyOptions({price:b.price,title:p.showPrice!==!1?b.price.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=b.price);const K={...p,price:b.price};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K,c.current?.applyOptions({})}return}if(!(p.type!=="trendline"&&p.type!=="gannline")&&!(!p.point1||!p.point2)){if(j.current==="handle1"){const b={time:U,price:P},g=DA([{time:b.time,value:b.price},{time:p.point2.time,value:p.point2.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p1=b);const M={...p,point1:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="handle2"){const b={time:U,price:P},g=DA([{time:p.point1.time,value:p.point1.price},{time:b.time,value:b.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p2=b);const M={...p,point2:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="line"){const b=oe.current;if(!b)return;const g=d.timeScale().coordinateToTime(b.x),M=u.coordinateToPrice(b.y);if(g==null||M==null)return;const k=U-g,K=P-M,W={time:te(b.point1.time+k),price:b.point1.price+K},Z={time:te(b.point2.time+k),price:b.point2.price+K},Ae=DA([{time:W.time,value:W.price},{time:Z.time,value:Z.price}]);Ae.length>0&&p.series.setData(Ae),p.decoration&&(p.decoration.p1=W,p.decoration.p2=Z);const he={...p,point1:W,point2:Z};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he}}}},D=()=>{j.current=null,oe.current=null},$=()=>{j.current||fe.current||(le(null),we([]))},C={capture:!0,passive:!1};return O.addEventListener("mousedown",se,C),O.addEventListener("mousemove",E,C),O.addEventListener("mouseup",D,C),O.addEventListener("mouseleave",$,C),()=>{O.removeEventListener("mousedown",se,C),O.removeEventListener("mousemove",E,C),O.removeEventListener("mouseup",D,C),O.removeEventListener("mouseleave",$,C)}},[We,Ne,dt,He]),Y.useEffect(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=()=>{const y=H;if(!y){G([]);return}const R=d.timeScale();if(y.type==="infoline"&&y.p1&&y.p2){const V=y.p1.rawTime??y.p1.time,X=y.p2.rawTime??y.p2.time,se=R.timeToCoordinate(V),E=u.priceToCoordinate(y.p1.price),D=R.timeToCoordinate(X),$=u.priceToCoordinate(y.p2.price);se!=null&&E!=null&&D!=null&&$!=null?G([{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="rulerline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="arrowedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="rayline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="extendedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="crossline"&&y.p){const V=R.timeToCoordinate(y.p.rawTime),X=u.priceToCoordinate(y.p.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="text"&&y.rawTime!=null&&y.price!=null){const V=R.timeToCoordinate(y.rawTime),X=u.priceToCoordinate(y.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="trendbyangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="equidistantchannel"&&y.p1&&y.p2&&y.b1&&y.b2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.b1.rawTime),$=u.priceToCoordinate(y.b1.price),C=R.timeToCoordinate(y.b2.rawTime),B=u.priceToCoordinate(y.b2.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:(D+C)/2,y:($+B)/2}]):G([]);return}if(y.type==="regressionchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="stddevchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="andrewspitchfork"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="disjointchannel"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="flattopbottom"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="fibonacci"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="trendline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="gannline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="rectangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=Math.min(V,se),$=Math.max(V,se),C=Math.min(X,E),B=Math.max(X,E),f=(D+$)/2,L=(C+B)/2;G([{x:D,y:C},{x:f,y:C},{x:$,y:C},{x:D,y:L},{x:$,y:L},{x:D,y:B},{x:f,y:B},{x:$,y:B}])}else G([]);return}if(y.type==="circle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="triangle"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="ellipse"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=(V+se)/2,$=(X+E)/2,C=se-V,B=E-X,f=Math.hypot(C,B);if(f<.001){G([]);return}const L=C/f,w=B/f,p=-w,_=L,P=f/2,U=P*Math.max(.05,y.minorRatio??.45);G([{x:D-L*P,y:$-w*P},{x:D+p*U,y:$+_*U},{x:D+L*P,y:$+w*P},{x:D-p*U,y:$-_*U}])}else G([]);return}if(y.type==="gannfan"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="ganngrid"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="horizontalray"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.originTime),se=u.priceToCoordinate(V.price);X!=null&&se!=null?G([{x:X,y:se}]):G([]);return}if(y.type==="verticalline"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.time);if(X!=null){const se=V.midYCss??200;G([{x:X,y:se}])}else G([]);return}if(y.type==="pricelevel"&&y.priceLine){const V=h.current?.priceToCoordinate(y.price);if(V!=null){const X=c.current?c.current.paneSize().width:400;G([{x:X/2,y:V}])}else G([]);return}G([])};O();const ce=d.timeScale();return ce.subscribeVisibleTimeRangeChange(O),()=>{ce.unsubscribeVisibleTimeRangeChange(O)}},[H]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if(u.type==="verticalline"&&u.primitive){const O=u===H||u===ne;u.primitive.showDot!==O&&(u.primitive.showDot=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if((u.type==="infoline"||u.type==="rulerline"||u.type==="arrowedline"||u.type==="rayline"||u.type==="extendedline"||u.type==="trendbyangle")&&u.primitive){const O=u===H||u===ne;u.primitive.isActive!==O&&(u.primitive.isActive=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{!c.current||!h.current||x.current.forEach(d=>{if(d.series&&d.series.applyOptions({visible:ve}),d.priceLine){const u=ve&&d.showPrice!==!1;d.priceLine.applyOptions(ve?{color:d.lineColor??"#3b82f6",axisLabelVisible:u,title:u&&typeof d.price=="number"?d.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(d.type==="fibonacci"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="rectangle"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="parallellines"&&(d.baseLine&&d.baseLine.applyOptions({visible:ve}),d.parallelLine&&d.parallelLine.applyOptions({visible:ve}),d.firstLine&&d.firstLine.applyOptions({visible:ve}),d.secondLine&&d.secondLine.applyOptions({visible:ve})),(d.type==="horizontalray"||d.type==="verticalline"||d.type==="infoline"||d.type==="rulerline"||d.type==="arrowedline"||d.type==="rayline"||d.type==="extendedline"||d.type==="crossline"||d.type==="trendbyangle"||d.type==="equidistantchannel"||d.type==="regressionchannel"||d.type==="stddevchannel"||d.type==="gannfan"||d.type==="ganngrid"||d.type==="andrewspitchfork"||d.type==="disjointchannel"||d.type==="flattopbottom"||d.type==="circle"||d.type==="triangle"||d.type==="ellipse"||d.type==="text")&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}})},[ve,dt]),Y.useEffect(()=>{!ve&&H&&(z(null),G([]))},[ve,H]),Y.useEffect(()=>{if(x.current.length>dt.length){const d=x.current.filter((u,O)=>!dt.includes(u));H&&d.some(u=>u===H)&&(z(null),G([])),d.forEach(u=>{if(u.series&&c.current?.removeSeries(u.series),u.priceLine&&h.current?.removePriceLine(u.priceLine),u.textPrimitive)try{h.current?.detachPrimitive(u.textPrimitive)}catch{}if(u.type==="horizontalray"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="verticalline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="infoline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rulerline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="arrowedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rayline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="extendedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="crossline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="trendbyangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="equidistantchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="regressionchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="stddevchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="gannfan"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ganngrid"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="andrewspitchfork"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="disjointchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="flattopbottom"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="fibonacci"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rectangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="circle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="triangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ellipse"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="text"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="parallellines")try{u.baseLine&&c.current?.removeSeries(u.baseLine),u.parallelLine&&c.current?.removeSeries(u.parallelLine),u.firstLine&&c.current?.removeSeries(u.firstLine),u.secondLine&&c.current?.removeSeries(u.secondLine)}catch{}}),x.current=dt,Xs()}},[dt,H,Xs]),Y.useEffect(()=>{const d=h.current;return d?(At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[],zt.filter(O=>O.symbol===ye).forEach(O=>{const ce=parseFloat(O.openPrice??O.price),R=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(wt&&!isNaN(ce)&&At.current.push(d.createPriceLine({price:ce,color:R,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),ZA){const V=parseFloat(O.stopLoss),X=parseFloat(O.takeProfit);!isNaN(V)&&V>0&&At.current.push(d.createPriceLine({price:V,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(X)&&X>0&&At.current.push(d.createPriceLine({price:X,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[]}):void 0},[zt,ye,wt,ZA]),Y.useEffect(()=>{const d=h.current;if(!d||!aA)return;const u=parseFloat(Zt?.ask);if(isNaN(u)||u<=0)return;let O;try{O=d.createPriceLine({price:u,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{d.removePriceLine(O)}catch{}}},[aA,Zt]),Y.useEffect(()=>{const d=o.current;if(!d)return;const u=O=>{if(Qe.current){Qe.current=!1;return}if(T.current||!c.current)return;const ce=c.current,y=h.current;if(ce&&y&&x.current.length>0){const R=d.getBoundingClientRect(),V=O.clientX-R.left,X=O.clientY-R.top,se=15;for(let E=x.current.length-1;E>=0;E--){const D=x.current[E];let $=!1;if(D.type==="text"&&D.rawTime!=null&&D.price!=null){const C=ce.timeScale().timeToCoordinate(D.rawTime),B=y.priceToCoordinate(D.price);if(C!=null&&B!=null){const f=Hd(D,C,B);V>=f.left&&V<=f.right&&X>=f.top&&X<=f.bottom&&($=!0)}}else if(D.point1&&D.point2){const C=ce.timeScale().timeToCoordinate(D.point1.time??D.point1.rawTime),B=y.priceToCoordinate(D.point1.price),f=ce.timeScale().timeToCoordinate(D.point2.time??D.point2.rawTime),L=y.priceToCoordinate(D.point2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.hypot(V-C,X-B),p=Math.hypot(V-f,X-L),_=(C+f)/2,P=(B+L)/2,U=Math.hypot(V-_,X-P);(w<se||p<se||U<se)&&($=!0)}}else if(D.p1&&D.p2){const C=ce.timeScale().timeToCoordinate(D.p1.rawTime),B=y.priceToCoordinate(D.p1.price),f=ce.timeScale().timeToCoordinate(D.p2.rawTime),L=y.priceToCoordinate(D.p2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.min(C,f),p=Math.max(C,f),_=Math.min(B,L),P=Math.max(B,L);V>=w-5&&V<=p+5&&X>=_-5&&X<=P+5&&($=!0)}}else if(D.p){const C=ce.timeScale().timeToCoordinate(D.p.rawTime),B=y.priceToCoordinate(D.p.price);C!=null&&B!=null&&Math.hypot(V-C,X-B)<se&&($=!0)}else if(D.type==="pricelevel"&&D.price!=null){const C=y.priceToCoordinate(D.price);C!=null&&Math.abs(X-C)<se&&($=!0)}if($){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),q(D);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const V=c.current.timeScale().getVisibleRange();Ie(V)},80)};return d.addEventListener("dblclick",u,!0),()=>{d.removeEventListener("dblclick",u,!0)}},[Ne,Te]);const qd=H??ne,jd=H?ie:ee,kb=ve&&nb(qd,jd),Ob=sb(qd?.type);Y.useEffect(()=>{const d=o.current,u=l.current;if(!d||!u)return;const O=80,ce=R=>{const V=d.getBoundingClientRect();u.style.opacity=V.bottom-R.clientY<=O?"1":"0"},y=()=>{u.style.opacity="0"};return d.addEventListener("mousemove",ce),d.addEventListener("mouseleave",y),()=>{d.removeEventListener("mousemove",ce),d.removeEventListener("mouseleave",y)}},[]);const Nb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),Kb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),zb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from-O,to:u.to-O})}catch{}},[]),Vb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from+O,to:u.to+O})}catch{}},[]),Wb=Y.useCallback(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const u=c.current.timeScale().getVisibleRange();Ie(u)},[Ne,Te,Ie]),ef=Vt?.id??null,tf=Vt?.takeProfit??null,Af=Vt?.stopLoss??null,vl=Vt?.type??null,rf=Vt?.volume??null,Tl=Vt?.symbol??null,nf=Vt?.price||Vt?.openPrice||null;Y.useEffect(()=>{const d=h.current;if(!d)return;const u=ge.current;if(["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}}),!ef)return;const O=typeof ye=="object"?ye?.symbol:ye;if(Tl!==O)return;const ce=parseFloat(nf),y=parseFloat(tf),R=parseFloat(Af),V=vl==="BUY";Number.isFinite(ce)&&ce>0&&(u.entry=d.createPriceLine({price:ce,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`${vl} ${rf} @ ${ce}`}));const X=Tl?.includes("JPY")?.01:1e-4;if(Number.isFinite(y)&&y>0&&Number.isFinite(ce)&&ce>0){const se=V?((y-ce)*(1/X)*10).toFixed(0):((ce-y)*(1/X)*10).toFixed(0);u.tp=d.createPriceLine({price:y,color:"#26A69A",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`TP, ${se} pts`})}if(Number.isFinite(R)&&R>0&&Number.isFinite(ce)&&ce>0){const se=V?((ce-R)*(1/X)*10).toFixed(0):((R-ce)*(1/X)*10).toFixed(0);u.sl=d.createPriceLine({price:R,color:"#EF5350",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`SL, ${se} pts`})}return()=>{["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}})}},[ef,tf,Af,vl,rf,Tl,nf,ye]);const Js=Y.useRef(Vt);Js.current=Vt;const sf=Y.useRef(je);return sf.current=je,Y.useEffect(()=>{const u=V=>{const X=h.current;if(!X)return null;const se=ge.current[V];if(!se)return null;const E=se.options();return!E||!Number.isFinite(E.price)?null:X.priceToCoordinate(E.price)},O=V=>{const X=o.current,se=c.current;if(!X||!se||!Js.current)return;const E=X.getBoundingClientRect(),D=V.clientY-E.top,$=u("tp"),C=u("sl");$!==null&&Math.abs(D-$)<20?(ae.current="tp",pe.current=D,ue.current=ge.current.tp.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1})):C!==null&&Math.abs(D-C)<20&&(ae.current="sl",pe.current=D,ue.current=ge.current.sl.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1}))},ce=V=>{const X=o.current,se=h.current;if(!X)return;const E=ae.current;if(!E){if(!Js.current)return;const _=X.getBoundingClientRect(),P=V.clientY-_.top,U=u("tp"),b=u("sl"),g=U!==null&&Math.abs(P-U)<20,M=b!==null&&Math.abs(P-b)<20;X.style.cursor=g||M?"ns-resize":"";return}if(!se)return;const D=X.getBoundingClientRect(),$=V.clientY-D.top,C=se.coordinateToPrice($);if(!Number.isFinite(C)||C<=0)return;const B=ge.current[E];if(!B)return;const f=Js.current;if(!f)return;const L=parseFloat(f.price||f.openPrice),w=f.type==="BUY",p=E==="tp"?w?((C-L)*1e5).toFixed(0):((L-C)*1e5).toFixed(0):w?((L-C)*1e5).toFixed(0):((C-L)*1e5).toFixed(0);B.applyOptions({price:C,title:`${E.toUpperCase()} ${p} pts`})},y=()=>{const V=o.current,X=c.current,se=ae.current;if(!se)return;const E=ge.current[se],D=E?E.options().price:null;if(ae.current=null,V&&(V.style.cursor=""),X&&X.applyOptions({handleScroll:!0,handleScale:!0}),!Number.isFinite(D)||D<=0)return;const $=sf.current;$&&$(C=>C&&(se==="tp"?{...C,takeProfit:D}:se==="sl"?{...C,stopLoss:D}:C))},R=o.current;if(R)return R.addEventListener("mousedown",O,!0),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",y),()=>{R.removeEventListener("mousedown",O,!0),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",y)}},[lA]),a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${Ee==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:We===1||We!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[lA&&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,"..."]})]})}),!lA&&yl&&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:Ee==="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:Ee==="light"?"#64748b":"#94a3b8"},children:yl})]})}),!lA&&!yl&&Ne.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:Ee==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),YA&&Ne.length>0&&(()=>{const d=Ne[Ne.length-1],u=O=>{const ce=Number(O);return Number.isFinite(ce)?ce>=100?ce.toFixed(2):ce.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:Ee==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:u(d?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:u(d?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.close)})]})]})})(),(i||si)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(ou,{bidPrice:e,askPrice:t,onBuyClick:Mb,onSellClick:Hb})}),a.jsx(au,{isOpen:st,onClose:Ib,orderType:ft,bidPrice:e,askPrice:t}),a.jsx(pu,{isOpen:re!==null,onClose:()=>q(null),chartObject:re,onUpdate:Pb}),lA&&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"}})}),kb&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:jd.map((d,u)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:d.x-5,top:d.y-5,backgroundColor:Ob}},u))}),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:Kb,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:Nb,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:zb,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:Vb,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:Wb,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:d,onClick:u,icon:O})=>a.jsx("button",{title:d,onClick:u,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:Ee==="light"?"#374151":"#94a3b8",border:"1px solid "+(Ee==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",ce.currentTarget.style.color=Ee==="light"?"#111827":"#e2e8f0"},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",ce.currentTarget.style.color=Ee==="light"?"#374151":"#94a3b8"},children:O},d))})]})})}),Et={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 Vd({style:A,className:e}){const{selectedSymbol:t,setSelectedSymbol:i,symbols:r,symbolsLoading:n}=$t(),[s,o]=Y.useState(!1),[l,c]=Y.useState(""),[h,m]=Y.useState(-1),v=Y.useRef(null),x=Y.useRef(null);Y.useEffect(()=>{const Q=N=>{v.current&&!v.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[]),Y.useEffect(()=>{s&&x.current&&x.current.focus()},[s]);const F=r.filter(Q=>Q.symbol.toLowerCase().includes(l.toLowerCase())),T=F.filter(Q=>!Q.symbol.endsWith("USDT")),S=F.filter(Q=>Q.symbol.endsWith("USDT")),I=Q=>{i(Q),o(!1),c("")};return r.find(Q=>Q.symbol===t),a.jsxs("div",{ref:v,style:{...Et.container,...A},className:e,children:[a.jsxs("button",{style:Et.button,onClick:()=>o(!s),onMouseEnter:Q=>Object.assign(Q.currentTarget.style,Et.buttonHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Et.arrow,...s?Et.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Et.dropdown,children:[a.jsx("div",{style:Et.searchContainer,children:a.jsx("input",{ref:x,style:Et.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:Q=>c(Q.target.value)})}),a.jsx("div",{style:Et.list,children:F.length===0?a.jsx("div",{style:Et.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[T.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Forex & Metals"}),T.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(5)})]},Q.symbol))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Crypto"}),S.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(2)})]},Q.symbol))]})]})})]})]})}const XA={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"}},lb=[.01,.05,.1,.5,1];function Wd({value:A,onChange:e,min:t=.01,max:i=100,step:r=.01,presets:n=lb,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:h}){const[m,v]=Y.useState(.1),x=A!==void 0?A:m,F=Y.useCallback(Q=>{const N=Math.max(t,Math.min(i,parseFloat(Q)||t)),J=Math.round(N/r)*r,H=parseFloat(J.toFixed(8));A!==void 0||v(H),e?.(H)},[t,i,r,A,e]),T=()=>F(x+r),S=()=>F(x-r),I=(x>=1,x.toFixed(2));return a.jsxs("div",{style:{...XA.container,...c},className:h,children:[o&&a.jsx("span",{style:XA.label,children:l}),a.jsx("button",{style:XA.btn,onClick:S,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:XA.input,type:"text",value:I,onChange:Q=>{const N=Q.target.value;if(N===""||N==="."||N==="0.")return;const J=parseFloat(N);isNaN(J)||F(J)},onBlur:()=>F(x)}),a.jsx("button",{style:XA.btn,onClick:T,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:XA.presets,children:n.map(Q=>a.jsx("button",{style:{...XA.preset,...Math.abs(x-Q)<1e-4?XA.presetActive:{}},onClick:()=>F(Q),onMouseEnter:N=>{Math.abs(x-Q)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(x-Q)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:Q},Q))})]})}const gA={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 Gd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.bid?parseFloat(v.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...gA.container,...h},className:m,children:[l&&a.jsx("span",{style:gA.label,children:c}),s&&a.jsx("button",{style:{...gA.toggle,...J?gA.toggleOn:gA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...gA.toggleKnob,...J?gA.knobOn:gA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:gA.inputGroup,children:[a.jsx("input",{style:gA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#EF5350",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...gA.modeBtn,...H==="price"?gA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...gA.modeBtn,...H==="pips"?gA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const mA={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 Rd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.ask?parseFloat(v.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...mA.container,...h},className:m,children:[l&&a.jsx("span",{style:mA.label,children:c}),s&&a.jsx("button",{style:{...mA.toggle,...J?mA.toggleOn:mA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...mA.toggleKnob,...J?mA.knobOn:mA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:mA.inputGroup,children:[a.jsx("input",{style:mA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#26A69A",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...mA.modeBtn,...H==="price"?mA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...mA.modeBtn,...H==="pips"?mA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const cb=[{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:"─"}],JA={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 $d({showLabel:A=!0,showDelete:e=!0,showVisibility:t=!0,tools:i,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:h,chartObjects:m,setChartObjects:v}=$t(),[x,F]=Y.useState(null),T=i||cb,S=N=>{l(o===N?null:N)},I=()=>{v([]),l(null)},Q=()=>{h(!c)};return a.jsxs("div",{style:{...JA.container,...n},className:s,children:[A&&a.jsx("span",{style:JA.label,children:r}),T.map(N=>a.jsxs("button",{style:{...JA.btn,...o===N.id?JA.btnActive:{}},onClick:()=>S(N.id),onMouseEnter:J=>{F(N.id),o!==N.id&&Object.assign(J.currentTarget.style,JA.btnHover)},onMouseLeave:J=>{F(null),o!==N.id&&(J.currentTarget.style.borderColor="#334155",J.currentTarget.style.backgroundColor="#1e293b",J.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,x===N.id&&a.jsx("div",{style:JA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:JA.divider}),t&&a.jsx("button",{style:{...JA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:Q,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:JA.deleteBtn,onClick:I,onMouseEnter:N=>Object.assign(N.currentTarget.style,JA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Xd={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 hb({showCoinSelector:A=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:i=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:h,onStopLossEnabledChange:m,takeProfit:v,onTakeProfitChange:x,takeProfitEnabled:F,onTakeProfitEnabledChange:T,coinSelectorProps:S={},volumeControlProps:I={},stopLossProps:Q={},takeProfitProps:N={},drawingToolsProps:J={},style:H,className:z}){const re=[];A&&re.push(a.jsx(Vd,{...S},"coin")),e&&re.push(a.jsx(Wd,{value:s,onChange:o,...I},"volume")),t&&re.push(a.jsx(Gd,{value:l,onChange:c,enabled:h,onEnabledChange:m,...Q},"sl")),i&&re.push(a.jsx(Rd,{value:v,onChange:x,enabled:F,onEnabledChange:T,...N},"tp")),r&&re.push(a.jsx($d,{...J},"draw"));const q=[];return re.forEach((ie,G)=>{q.push(ie),n&&G<re.length-1&&q.push(a.jsx("div",{style:Xd.divider},`div-${G}`))}),a.jsx("div",{style:{...Xd.toolbar,...H},className:z,children:q})}const ub=[{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"}],wl={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 pb({style:A,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:i}=$t();return a.jsx("div",{style:{...wl.container,...A},className:e,children:ub.map(r=>a.jsx("button",{style:{...wl.btn,...t===r.value?wl.btnActive:{}},onClick:()=>i(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 db=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Bl={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 fb({style:A,className:e}){const{chartType:t,setChartType:i}=$t();return a.jsx("div",{style:{...Bl.container,...A},className:e,children:db.map(r=>a.jsxs("button",{style:{...Bl.btn,...t===r.value?Bl.btnActive:{}},onClick:()=>i(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 oA={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 gb({volume:A=.1,stopLoss:e,takeProfit:t,onTradeExecuted:i,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=$t(),[h,m]=Y.useState(null),v=parseFloat(o?.bid||0),x=parseFloat(o?.ask||0),F=x>0&&v>0?Math.abs(x-v):0,T=Q=>!Q||Q===0?"-.-----":Q>=1e3?Q.toFixed(2):Q>=1?Q.toFixed(4):Q.toFixed(5),S=Q=>Q===0?"-":Q>=1?Q.toFixed(1):Q>=.01?Q.toFixed(3):(Q*1e4).toFixed(1)+"p",I=Y.useCallback(Q=>{if(!s)return;const N=Q==="BUY"?x:v;if(!N||N<=0){m({type:"error",message:"No price available"});return}const J={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:Q,volume:A,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,J]);const H=A*N*.01;c(z=>z-H),m({type:"success",message:`${Q} executed`}),i?.(J),setTimeout(()=>m(null),3e3)},[s,x,v,A,e,t,l,c,i]);return a.jsxs("div",{style:{...oA.container,...r},className:n,children:[a.jsx("button",{style:oA.sellBtn,onClick:()=>I("SELL"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.sellBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d",Q.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...oA.priceValue,color:"#EF5350"},children:T(v)})]}),a.jsxs("div",{style:oA.spread,children:[a.jsx("span",{style:oA.spreadLabel,children:"Spread"}),a.jsx("span",{style:oA.spreadValue,children:S(F)})]}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...oA.priceValue,color:"#26A69A"},children:T(x)})]}),a.jsx("button",{style:oA.buyBtn,onClick:()=>I("BUY"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.buyBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#14532d",Q.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&a.jsx("span",{style:{...oA.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.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 mb({style:A,className:e,maxHeight:t=200}){const{orders:i,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=$t(),[l,c]=Y.useState(null),h=i.filter(T=>T.status==="OPEN"||!T.closeAt),m=Y.useCallback((T,S)=>{const I=n.find(Q=>Q.symbol===T);return I?S?.toUpperCase()==="BUY"?parseFloat(I.bid||0):parseFloat(I.ask||0):0},[n]),v=Y.useCallback(T=>{if(l)return;c(T.id);const S=m(T.symbol,T.type),Q=(T.type?.toUpperCase()==="BUY"?S-T.price:T.price-S)*T.volume,N=T.volume*T.price*.01;r(J=>J.filter(H=>H.id!==T.id)),o(J=>J+N+Q),c(null)},[l,m,r,o]),x=T=>{const S=parseFloat(T);return!S||isNaN(S)?"-":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5)},F=T=>{const S=parseFloat(T);return isNaN(S)?"-":(S>=0?"+":"")+S.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...A},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",h.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:h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):h.map(T=>{const S=m(T.symbol,T.type),I=T.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:T.symbol}),a.jsx("td",{style:{...ot.td,...T.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:T.type}),a.jsx("td",{style:ot.td,children:T.volume}),a.jsx("td",{style:ot.td,children:x(T.price)}),a.jsx("td",{style:ot.td,children:x(S)}),a.jsx("td",{style:ot.td,children:T.stopLoss?x(T.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:T.takeProfit?x(T.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:I>=0?"#26A69A":"#EF5350",fontWeight:700},children:F(I)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===T.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>v(T),disabled:l===T.id,onMouseEnter:Q=>{l!==T.id&&(Q.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d"},children:l===T.id?"...":"Close"})})]},T.id)})})]})})]})}function wb(A){return nA({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:[]}]})(A)}function Bb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(A)}function yb(A){return nA({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:[]}]})(A)}function Cb(A){return nA({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:[]}]})(A)}const vb=({selectedSymbol:A,selectedTimeframe:e,onTimeframeChange:t,chartType:i="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:m=!0,onToggleMarketWatch:v,buySellPanelOpen:x,onMove:F})=>{const{theme:T}=$t(),S=T==="light",I=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],Q={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.jsx("div",{className:`overflow-x-auto border-b ${S?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,style:{scrollbarWidth:"thin",scrollbarColor:S?"#cbd5e1 transparent":"#334155 transparent"},children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-1 min-w-max",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${S?"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
+ ${i===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
+ `,title:N,children:Q[N]},N))}),a.jsx("div",{className:`flex items-center gap-1 border-r ${S?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].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
15
+ ${i===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
16
+ `,title:N,children:Q[N]},N))}),a.jsxs("div",{className:"flex items-center gap-2",children:[I.map(N=>a.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?S?"text-sky-600":"text-sky-400":S?"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 ${S?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:x?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${x?S?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":S?"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 ${S?"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 ${S?"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 ${S?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(wb,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${S?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(Bb,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${S?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>v?.(),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?S?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":S?"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 ${S?"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:()=>h?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${S?"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"})})})]})]})})},Yr=[{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"})]})}],qr=[{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"})})}],jr=[{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"})})}],en=[{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"})})}],Ws=({children:A,top:e,panelRef:t,isLight:i})=>a.jsx("div",{ref:t,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${i?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:a.jsx("div",{className:"py-1",children:A})}),Tb=({AccountId:A,UserName:e,UserId:t,onToggleTerminal:i})=>{const{activeTool:r,setActiveTool:n,showGrid:s,setShowGrid:o,snapToGrid:l,setSnapToGrid:c,chartObjects:h,setChartObjects:m,drawingsVisible:v,setDrawingsVisible:x,chartLocked:F,setChartLocked:T,theme:S,setTheme:I,setCandleColors:Q,setShowTradeOrders:N,showTradeOrders:J,setShowTradePosition:H,showTradePosition:z,setShowTradeHistory:re,showTradeHistory:q,setShowSLTP:ie,showSLTP:G,setShowAskPrice:ne,showAskPrice:le,setShowChartControls:ee,showChartControls:we,setShowTradeNotification:j,showTradeNotification:ge,setShowCrosshair:ae,showCrosshair:pe,setShowOHLC:ue,showOHLC:oe,setIsShow:fe}=$t(),Qe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[me,xe]=Y.useState(!1),[Se,Me]=Y.useState(null),[$e,Ye]=Y.useState(null),[Ie,We]=Y.useState(0),[De,Ze]=Y.useState(!1),[nt,dt]=Y.useState(0),[He,zt]=Y.useState(!1),[ye,Te]=Y.useState(0),[ve,be]=Y.useState(!1),[Le,Ee]=Y.useState(0),[Ke,wt]=Y.useState(!1),[Dt,ni]=Y.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),ZA=Y.useRef(null),aA=Y.useRef(null),si=Y.useRef(null),_A=Y.useRef(null),YA=Y.useRef(null),Zt=Y.useRef(null);Y.useEffect(()=>{const _e=Je=>{const et=ZA.current;me&&et&&!et.contains(Je.target)&&(xe(!1),Me(null));const bt=aA.current;$e==="line"&&bt&&!bt.contains(Je.target)&&Ye(null);const ze=si.current;$e==="channel"&&ze&&!ze.contains(Je.target)&&Ye(null);const Ve=_A.current;$e==="gann"&&Ve&&!Ve.contains(Je.target)&&Ye(null);const At=YA.current;$e==="shape"&&At&&!At.contains(Je.target)&&Ye(null)};return window.addEventListener("mousedown",_e),()=>window.removeEventListener("mousedown",_e)},[me,$e]),Y.useEffect(()=>{const _e=Je=>{Je.key==="Escape"&&(xe(!1),Me(null),Ye(null))};return window.addEventListener("keydown",_e),()=>window.removeEventListener("keydown",_e)},[]);const Yt=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"}],[]),Qt=_e=>{const Je=Yt[_e].label;if(Je==="Menu"){xe(et=>!et),Me(null);return}if(Je==="Grid"){o(!s);return}if(Je==="Magnet"){c(!l),n(l?null:_e);return}if(Je==="Delete"){if(h.length>0){const et=[...h];et.pop(),m(et)}return}if(Je==="Eye"){x(!v);return}if(Je==="Lock"){T(!F);return}if(Je==="Light Theme"||Je==="Dark Theme"){I(S==="light"?"dark":"light"),xe(!1),Me(null);return}if(Je==="History"){i?.();return}n(r===_e?null:_e)};Yt.slice(0,12);const Lt=Yt.slice(12),Ct=[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:"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:S==="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"})]})}]}],Vt=({item:_e})=>{const Je=!!_e.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Zt.current&&(clearTimeout(Zt.current),Zt.current=null),Je&&Me(_e.key)},onMouseLeave:()=>{Je&&(Zt.current=setTimeout(()=>Me(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{Je?Me(et=>et===_e.key?null:_e.key):(_e.key==="theme"&&I(et=>et==="light"?"dark":"light"),xe(!1),Me(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:_e.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:_e.label}),_e.rightText&&a.jsx("span",{className:`text-xs ${je?"text-slate-500":"text-slate-400"}`,children:_e.rightText}),Je&&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"})})]}),Je&&Se===_e.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden border ${je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:_e.submenu.map((et,bt)=>{const ze=Dt[_e.key],Ve=Array.isArray(ze)?ze.includes(et.label):ze===et.label||et.selected&&ze==null;return a.jsxs("button",{type:"button",onClick:()=>{_e.key==="chart"?(ni(st=>{const Ge=Array.isArray(st.chart)?st.chart:[st.chart],ft=Ge.includes(et.label)?Ge.filter(at=>at!==et.label):[...Ge,et.label];return{...st,chart:ft}}),{Grid:()=>o(!s),"Trade Orders":()=>N(!J),"Ask Price":()=>ne(!le),"Chart Controls":()=>ee(!we),"Trade Notification":()=>j(!ge),"Crosshair cursor":()=>ae(!pe),"Show OHLC":()=>ue(!oe)}[et.label]?.()):(ni(At=>({...At,[_e.key]:et.label})),_e.key==="colors"&&Qe[et.label]&&Q(Qe[et.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:et.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:et.label}),Ve&&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"})})})]},bt)})})})]})},je=S==="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:Ct.map((_e,Je)=>{const et=_e==="gann",bt=et?null:Yt[_e],ze=et?-1:_e;return a.jsxs(Y.Fragment,{children:[ze===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=Yr[Ie].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
+ ${r===Yr[Ie].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Yr[Ie].label,children:Yr[Ie].icon}),a.jsx("span",{onMouseEnter:()=>Ze(!0),onMouseLeave:()=>Ze(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:De?10:7,height:De?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:je?"#64748b":"#94a3b8"})})})]}):ze===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=qr[nt].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
+ ${r===qr[nt].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:qr[nt].label,children:qr[nt].icon}),a.jsx("span",{onMouseEnter:()=>zt(!0),onMouseLeave:()=>zt(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:He?10:7,height:He?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:je?"#64748b":"#94a3b8"})})})]}):et?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=jr[ye].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
+ ${r===jr[ye].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:jr[ye].label,children:jr[ye].icon}),a.jsx("span",{onMouseEnter:()=>be(!0),onMouseLeave:()=>be(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:ve?10:7,height:ve?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:je?"#64748b":"#94a3b8"})})})]}):ze===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=en[Le].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
+ ${r===en[Le].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:en[Le].label,children:en[Le].icon}),a.jsx("span",{onMouseEnter:()=>wt(!0),onMouseLeave:()=>wt(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Ke?10:7,height:Ke?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:je?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>Qt(ze),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
+ ${bt.label==="Grid"&&s||bt.label==="Eye"&&!v||bt.label==="Lock"&&F||r===ze?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${bt.label}: ${bt.description}`,children:bt.icon}),!et&&bt.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${je?"border-slate-200":"border-slate-700"}`})]},et?"gann-slot":`${bt.label}-${_e}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:Lt.map((_e,Je)=>{const et=12+Je;return a.jsx("button",{onClick:()=>Qt(et),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
+ ${_e.label==="Grid"&&s||_e.label==="Eye"&&!v||_e.label==="Lock"&&F||r===et?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${_e.label}: ${_e.description}`,children:_e.icon},_e.label)})})]}),$e==="line"&&a.jsx(Ws,{top:84,panelRef:aA,isLight:je,children:Yr.map((_e,Je)=>{const et=Ie===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),We(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&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"})})})]},_e.toolId)})}),$e==="channel"&&a.jsx(Ws,{top:128,panelRef:si,isLight:je,children:qr.map((_e,Je)=>{const et=nt===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),dt(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&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"})})})]},_e.toolId)})}),$e==="gann"&&a.jsx(Ws,{top:210,panelRef:_A,isLight:je,children:jr.map((_e,Je)=>{const et=ye===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),Te(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&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"})})})]},_e.toolId)})}),$e==="shape"&&a.jsx(Ws,{top:250,panelRef:YA,isLight:je,children:en.map((_e,Je)=>{const et=Le===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),Ee(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 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}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&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"})})})]},_e.toolId)})}),me&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{xe(!1),Me(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:ZA,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${je?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${je?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),A!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${je?"text-slate-500":"text-slate-400"}`,children:A})]}),a.jsx("div",{className:"py-2",children:Ut.map(_e=>a.jsx(Vt,{item:_e},_e.key))})]})]})]})};function bb(A){return nA({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:[]}]})(A)}const xb={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},Qb={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},Fb={binance:"CRYPTO"},Ub=({width:A=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:i,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=$t(),o=s==="light",[l,c]=Y.useState(""),h=e.filter(x=>(x.symbol||"").toLowerCase().includes(l.toLowerCase())),m=Y.useMemo(()=>{const x={};for(const S of h){const I=(S.category||"other").toLowerCase();x[I]||(x[I]=[]),x[I].push(S)}const F=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(x).sort((S,I)=>{const Q=F.indexOf(S),N=F.indexOf(I);return Q!==-1&&N!==-1?Q-N:Q!==-1?-1:N!==-1?1:S.localeCompare(I)}).map(S=>({category:S,symbols:x[S]}))},[h]),v=x=>a.jsxs("tr",{onClick:()=>i(x.symbol),className:`cursor-pointer transition-colors ${t===x.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:[x.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Cb,{className:"text-2xl text-emerald-500"})}):x.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(yb,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Fw,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:x.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${x.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[x.change>=0?"+":"",x.change,"%"]})]},x.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`},className:`border-l flex flex-col h-full shrink-0 overflow-hidden ${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(VT,{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: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?WT[v]||"text-slate-600":zT[v]||"text-slate-400"}`,children:RT[v]||v.toUpperCase()})}),b.map(B)]},v))})]})})]})]})},$T=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r,bots:n,onRunBot:s,onPauseBot:o,onDeleteBot:l})=>{const{accountSummary:c,orders:u,theme:m,isShow:B,setIsShow:v,historyOrders:b,fetchHistoryOrders:C}=Vt(),U=i||c,F=e||u,L=b||[],K=n||[],G=m==="light",[E,z]=Y.useState("trade");Y.useEffect(()=>{v&&v(E==="history")},[E,v]),Y.useEffect(()=>{E==="history"&&C&&C()},[E,C]);const ne="#26A69A",X="#EF5350",R=G?"#f8fafc":"#12161D",re=G?"#e2e8f0":"#1e293b",se=G?"#f1f5f9":"#12161D",he=G?"#F0F5F9":"#2B3543",Z=G?"#f8fafc":"#131c2e",ee=G?"#12161D":"#fff",ie=G?"#64748b":"#fff",ae=(F||[]).filter(Fe=>Fe.status==="OPEN"||!Fe.closeAt),oe=U?.balance||0,le=U?.equity??oe,de=U?.margin||0,we=U?.freeMargin??le-de,be=de>0?le/de*100:0,xe=ae.reduce((Fe,He)=>Fe+(He.livePnL??He.profit??0),0),Be=Fe=>{const He=parseFloat(Fe);return Number.isFinite(He)?He.toLocaleString("en-US",{minimumFractionDigits:4,maximumFractionDigits:4}):"0.00"},ge=Fe=>{const He=parseFloat(Fe);return!He||isNaN(He)?"—":He>=1e4?He.toFixed(2):He>=10?He.toFixed(4):He.toFixed(5)},ve=Fe=>{const He=parseFloat(Fe);return isNaN(He)?"—":(He>=0?"+":"")+He.toFixed(4)},Te=Fe=>{const He=parseFloat(Fe);return isNaN(He)?"—":He.toFixed(2)},De=Fe=>{if(!Fe)return"—";const He=new Date(Fe);return isNaN(He.getTime())?String(Fe):`${He.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${He.toTimeString().slice(0,8)}`},Xe=Y.useCallback((Fe,He)=>{Fe.stopPropagation(),t&&t(He.id,He)},[t]),Ve=Y.useCallback((Fe,He)=>{Fe.stopPropagation(),A&&A(He)},[A]),Ce={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:R,borderTop:`1px solid ${re}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:ee,width:"100%",minWidth:0},je={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:he,borderBottom:`1px solid ${re}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Le={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${re}`,whiteSpace:"nowrap"},Ee={color:ie,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},at={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},rt={display:"flex",borderBottom:`1px solid ${re}`,flexShrink:0,backgroundColor:se},Pt=Fe=>({padding:"5px 14px",fontSize:"11px",fontWeight:Fe?700:500,color:Fe?G?"#0ea5e9":"#38bdf8":ie,borderBottom:Fe?`2px solid ${G?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),_e={padding:"4px 8px",textAlign:"left",color:ie,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${re}`,whiteSpace:"nowrap",backgroundColor:se,position:"sticky",top:0,zIndex:1},ke={padding:"3px 8px",borderBottom:`1px solid ${re}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:ee};return a.jsxs("div",{className:"ap-scroll",style:Ce,children:[a.jsxs("div",{style:je,children:[a.jsxs("div",{style:Le,children:[a.jsx("span",{style:Ee,children:"Balance:"}),a.jsxs("span",{style:{...at,color:ee},children:["$",Be(oe)]})]}),a.jsxs("div",{style:Le,children:[a.jsx("span",{style:Ee,children:"Equity:"}),a.jsxs("span",{style:{...at,color:le>=oe?ne:X},children:["$",Be(le)]})]}),a.jsxs("div",{style:Le,children:[a.jsx("span",{style:Ee,children:"Margin:"}),a.jsxs("span",{style:{...at,color:ee},children:["$",Be(de)]})]}),a.jsxs("div",{style:Le,children:[a.jsx("span",{style:Ee,children:"Free Margin:"}),a.jsxs("span",{style:{...at,color:we>=0?ee:X},children:["$",Be(we)]})]}),a.jsxs("div",{style:{...Le,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Ee,children:"Margin Level:"}),a.jsx("span",{style:{...at,color:be>=100?ne:X},children:de>0?be.toFixed(2)+"%":"—"})]}),ae.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Ee,children:"Float P/L:"}),a.jsxs("span",{style:{...at,color:xe>=0?ne:X,fontWeight:700},children:[xe>=0?"+":"",Be(xe)]})]})]}),a.jsxs("div",{style:rt,children:[a.jsx("button",{style:Pt(E==="trade"),onClick:()=>z("trade"),children:"Trade"}),a.jsx("button",{style:Pt(E==="history"),onClick:()=>z("history"),children:"History"}),a.jsx("button",{style:Pt(E==="bots"),onClick:()=>z("bots"),children:"Bots"})]}),E==="trade"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},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:ae.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...ke,textAlign:"center",padding:"16px",color:ie},children:"No open positions"})}):ae.map(Fe=>{const He=Fe.livePnL??Fe.profit??0,Ie=He>=0?ne:X;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor=Z,onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ke,fontWeight:700,color:ee,letterSpacing:"0.02em"},children:Fe.symbol}),a.jsx("td",{style:{...ke,color:ie,fontSize:"10px"},children:String(Fe.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ke,color:ie},children:De(Fe.openAt||Fe.time)}),a.jsx("td",{style:{...ke,fontWeight:700,color:Fe.type?.toUpperCase()==="BUY"?ne:X},children:Fe.type?.toUpperCase()}),a.jsx("td",{style:{...ke,textAlign:"right"},children:Te(Fe.volume)}),a.jsx("td",{style:{...ke,textAlign:"right"},children:ge(Fe.price??Fe.openPrice)}),a.jsx("td",{style:{...ke,textAlign:"right",color:Fe.stopLoss?X:ie},children:Fe.stopLoss?ge(Fe.stopLoss):"—"}),a.jsx("td",{style:{...ke,textAlign:"right",color:Fe.takeProfit?ne:ie},children:Fe.takeProfit?ge(Fe.takeProfit):"—"}),a.jsx("td",{style:{...ke,textAlign:"right",color:ie},children:Fe.currentPrice?ge(Fe.currentPrice):"—"}),a.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Ie},children:ve(He)}),a.jsx("td",{style:{...ke,textAlign:"center"},children:a.jsx("button",{onClick:$e=>Ve($e,Fe),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:ie,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:$e=>$e.currentTarget.style.color="#f59e0b",onMouseLeave:$e=>$e.currentTarget.style.color=ie,children:"✎"})}),a.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Ie},children:a.jsx("button",{onClick:$e=>Xe($e,Fe),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},Fe.id)})})]})}),E==="bots"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},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:"Name"}),a.jsx("th",{style:_e,children:"Symbol"}),a.jsx("th",{style:_e,children:"Strategy"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Trades"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Max"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Profit Level"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Risk Level"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Status"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"PnL"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Actions"})]})}),a.jsx("tbody",{children:K.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...ke,textAlign:"center",padding:"16px",color:ie},children:"No bots created"})}):K.map(Fe=>{const He=Fe.status==="active",Ie=Number(Fe.totalPnL??0),$e=Ie>=0?ne:X;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:qe=>qe.currentTarget.style.backgroundColor=Z,onMouseLeave:qe=>qe.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ke,fontWeight:700,color:ee},children:Fe.name}),a.jsx("td",{style:{...ke,color:ee},children:Fe.symbol}),a.jsx("td",{style:{...ke,color:ie,textTransform:"capitalize"},children:Fe.strategy}),a.jsx("td",{style:{...ke,textAlign:"right",color:ee},children:Fe.openTrades??Fe.trades?.filter(qe=>qe.status==="open").length??0}),a.jsx("td",{style:{...ke,textAlign:"right",color:ie},children:Fe.max_trades}),a.jsx("td",{style:{...ke,textAlign:"right",color:ie},children:Fe.profit_level}),a.jsx("td",{style:{...ke,textAlign:"right",color:ie},children:Fe.risk}),a.jsx("td",{style:{...ke,textAlign:"center"},children:a.jsx("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 8px",borderRadius:"4px",background:He?"rgba(38,166,154,0.15)":"rgba(148,163,184,0.15)",color:He?ne:ie,textTransform:"uppercase"},children:Fe.status})}),a.jsxs("td",{style:{...ke,textAlign:"right",fontWeight:700,color:$e},children:[Ie>=0?"+":"",Ie.toFixed(2)]}),a.jsx("td",{style:{...ke,textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"4px",justifyContent:"center"},children:[He?a.jsx("button",{onClick:()=>o&&o(Fe.id),title:"Pause Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:"#f59e0b",color:"#fff"},children:"Pause"}):a.jsx("button",{onClick:()=>s&&s(Fe.id),title:"Run Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:ne,color:"#fff"},children:"Run"}),a.jsx("button",{onClick:()=>l&&l(Fe.id),title:"Delete Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:X,color:"#fff"},children:"Delete"})]})})]},Fe.id)})})]})}),E==="history"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},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:L.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...ke,textAlign:"center",padding:"16px",color:ie},children:"No trade history"})}):L.map(Fe=>{const He=Fe.profit??0,Ie=He>=0?ne:X;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor=Z,onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ke,fontWeight:700,color:ee,letterSpacing:"0.02em"},children:Fe.symbol}),a.jsx("td",{style:{...ke,color:ie,fontSize:"10px"},children:String(Fe.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ke,color:ie},children:De(Fe.openAt)}),a.jsx("td",{style:{...ke,fontWeight:700,color:Fe.type?.toUpperCase()==="BUY"?ne:X},children:Fe.type?.toUpperCase()}),a.jsx("td",{style:{...ke,textAlign:"right"},children:Te(Fe.volume)}),a.jsx("td",{style:{...ke,textAlign:"right"},children:ge(Fe.openPrice)}),a.jsx("td",{style:{...ke,color:ie},children:De(Fe.closeAt)}),a.jsx("td",{style:{...ke,textAlign:"right"},children:ge(Fe.closePrice)}),a.jsx("td",{style:{...ke,textAlign:"right",color:Fe.stopLoss?X:ie},children:Fe.stopLoss?ge(Fe.stopLoss):"—"}),a.jsx("td",{style:{...ke,textAlign:"right",color:Fe.takeProfit?ne:ie},children:Fe.takeProfit?ge(Fe.takeProfit):"—"}),a.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Ie},children:ve(He)})]},Fe.id)})})]})})]})},XT="2.3.2";et.AccountPanel=$T,et.BuySellPanel=Gh,et.Chart=QT,et.ChartTypeSelector=HT,et.CoinSelector=wp,et.DrawingTools=vp,et.LeftSidebar=KT,et.MarketExecutionModal=$h,et.MarketWatch=GT,et.PositionsPanel=_T,et.SYMBOL_CONFIG=ll,et.StopLoss=yp,et.TakeProfit=Cp,et.TimeframeSelector=LT,et.ToolCustomizationModal=qh,et.TopBar=OT,et.TradePanel=IT,et.TradingProvider=D1,et.TradingToolbar=ST,et.VolumeControl=Bp,et.alignToTimeframe=We,et.calcBollingerBands=ml,et.calcLiveBollingerBands=Rs,et.detectGaps=Ip,et.getSymbolConfig=nr,et.is24x7Symbol=Hp,et.isCryptoSymbol=tn,et.isForexSymbol=en,et.isWithinTradingSession=_p,et.normalizeCandleTimes=hl,et.normalizeTime=te,et.processCandles=fl,et.processSingleCandle=gl,et.setSocketBaseUrl=kh,et.timeframeToSeconds=dA,et.useTrading=Vt,et.validateTimeOrdering=Dp,et.version=XT,Object.defineProperty(et,Symbol.toStringTag,{value:"Module"})}));
49
+ `}),a.jsxs("div",{style:{width:`${A}px`},className:`border-l flex flex-col h-full shrink-0 overflow-hidden ${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(bb,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:x=>c(x.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..."})}):h.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:x,symbols:F})=>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?Qb[x]||"text-slate-600":xb[x]||"text-slate-400"}`,children:Fb[x]||x.toUpperCase()})}),F.map(v)]},x))})]})})]})]})},Sb=({accountSummary:A,orders:e,onClose:t,onModify:i,height:r,bots:n,onRunBot:s,onPauseBot:o,onDeleteBot:l})=>{const{accountSummary:c,orders:h,theme:m,isShow:v,setIsShow:x,historyOrders:F,fetchHistoryOrders:T}=$t(),S=A||c,I=e||h,Q=F||[],N=n||[],J=m==="light",[H,z]=Y.useState("trade");Y.useEffect(()=>{x&&x(H==="history")},[H,x]),Y.useEffect(()=>{H==="history"&&T&&T()},[H,T]);const re="#26A69A",q="#EF5350",ie=J?"#f8fafc":"#12161D",G=J?"#e2e8f0":"#1e293b",ne=J?"#f1f5f9":"#12161D",le=J?"#F0F5F9":"#2B3543",ee=J?"#f8fafc":"#131c2e",we=J?"#12161D":"#fff",j=J?"#64748b":"#fff",ge=(I||[]).filter(ve=>ve.status==="OPEN"||!ve.closeAt),ae=S?.balance||0,pe=S?.equity??ae,ue=S?.margin||0,oe=S?.freeMargin??pe-ue,fe=ue>0?pe/ue*100:0,Qe=ge.reduce((ve,be)=>ve+(be.livePnL??be.profit??0),0),me=ve=>{const be=parseFloat(ve);return Number.isFinite(be)?be.toLocaleString("en-US",{minimumFractionDigits:4,maximumFractionDigits:4}):"0.00"},xe=ve=>{const be=parseFloat(ve);return!be||isNaN(be)?"—":be>=1e4?be.toFixed(2):be>=10?be.toFixed(4):be.toFixed(5)},Se=ve=>{const be=parseFloat(ve);return isNaN(be)?"—":(be>=0?"+":"")+be.toFixed(4)},Me=ve=>{const be=parseFloat(ve);return isNaN(be)?"—":be.toFixed(2)},$e=ve=>{if(!ve)return"—";const be=new Date(ve);return isNaN(be.getTime())?String(ve):`${be.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${be.toTimeString().slice(0,8)}`},Ye=Y.useCallback((ve,be)=>{ve.stopPropagation(),t&&t(be.id,be)},[t]),Ie=Y.useCallback((ve,be)=>{ve.stopPropagation(),i&&i(be)},[i]),We={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:ie,borderTop:`1px solid ${G}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:we,width:"100%",minWidth:0},De={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:le,borderBottom:`1px solid ${G}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ze={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${G}`,whiteSpace:"nowrap"},nt={color:j,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},dt={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},He={display:"flex",borderBottom:`1px solid ${G}`,flexShrink:0,backgroundColor:ne},zt=ve=>({padding:"5px 14px",fontSize:"11px",fontWeight:ve?700:500,color:ve?J?"#0ea5e9":"#38bdf8":j,borderBottom:ve?`2px solid ${J?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),ye={padding:"4px 8px",textAlign:"left",color:j,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",backgroundColor:ne,position:"sticky",top:0,zIndex:1},Te={padding:"3px 8px",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:we};return a.jsxs("div",{className:"ap-scroll",style:We,children:[a.jsxs("div",{style:De,children:[a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Balance:"}),a.jsxs("span",{style:{...dt,color:we},children:["$",me(ae)]})]}),a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Equity:"}),a.jsxs("span",{style:{...dt,color:pe>=ae?re:q},children:["$",me(pe)]})]}),a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Margin:"}),a.jsxs("span",{style:{...dt,color:we},children:["$",me(ue)]})]}),a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Free Margin:"}),a.jsxs("span",{style:{...dt,color:oe>=0?we:q},children:["$",me(oe)]})]}),a.jsxs("div",{style:{...Ze,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:nt,children:"Margin Level:"}),a.jsx("span",{style:{...dt,color:fe>=100?re:q},children:ue>0?fe.toFixed(2)+"%":"—"})]}),ge.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:nt,children:"Float P/L:"}),a.jsxs("span",{style:{...dt,color:Qe>=0?re:q,fontWeight:700},children:[Qe>=0?"+":"",me(Qe)]})]})]}),a.jsxs("div",{style:He,children:[a.jsx("button",{style:zt(H==="trade"),onClick:()=>z("trade"),children:"Trade"}),a.jsx("button",{style:zt(H==="history"),onClick:()=>z("history"),children:"History"}),a.jsx("button",{style:zt(H==="bots"),onClick:()=>z("bots"),children:"Bots"})]}),H==="trade"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ye,children:"Symbol"}),a.jsx("th",{style:ye,children:"Ticket"}),a.jsx("th",{style:ye,children:"Time"}),a.jsx("th",{style:ye,children:"Type"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:ge.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Te,textAlign:"center",padding:"16px",color:j},children:"No open positions"})}):ge.map(ve=>{const be=ve.livePnL??ve.profit??0,Le=be>=0?re:q;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor=ee,onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Te,fontWeight:700,color:we,letterSpacing:"0.02em"},children:ve.symbol}),a.jsx("td",{style:{...Te,color:j,fontSize:"10px"},children:String(ve.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Te,color:j},children:$e(ve.openAt||ve.time)}),a.jsx("td",{style:{...Te,fontWeight:700,color:ve.type?.toUpperCase()==="BUY"?re:q},children:ve.type?.toUpperCase()}),a.jsx("td",{style:{...Te,textAlign:"right"},children:Me(ve.volume)}),a.jsx("td",{style:{...Te,textAlign:"right"},children:xe(ve.price??ve.openPrice)}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.stopLoss?q:j},children:ve.stopLoss?xe(ve.stopLoss):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.takeProfit?re:j},children:ve.takeProfit?xe(ve.takeProfit):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.currentPrice?xe(ve.currentPrice):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Le},children:Se(be)}),a.jsx("td",{style:{...Te,textAlign:"center"},children:a.jsx("button",{onClick:Ee=>Ie(Ee,ve),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:j,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:Ee=>Ee.currentTarget.style.color="#f59e0b",onMouseLeave:Ee=>Ee.currentTarget.style.color=j,children:"✎"})}),a.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Le},children:a.jsx("button",{onClick:Ee=>Ye(Ee,ve),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},ve.id)})})]})}),H==="bots"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ye,children:"Name"}),a.jsx("th",{style:ye,children:"Symbol"}),a.jsx("th",{style:ye,children:"Strategy"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Trades"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Max"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Profit Level"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Risk Level"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Status"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"PnL"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Actions"})]})}),a.jsx("tbody",{children:N.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Te,textAlign:"center",padding:"16px",color:j},children:"No bots created"})}):N.map(ve=>{const be=ve.status==="active",Le=Number(ve.totalPnL??0),Ee=Le>=0?re:q;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ke=>Ke.currentTarget.style.backgroundColor=ee,onMouseLeave:Ke=>Ke.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Te,fontWeight:700,color:we},children:ve.name}),a.jsx("td",{style:{...Te,color:we},children:ve.symbol}),a.jsx("td",{style:{...Te,color:j,textTransform:"capitalize"},children:ve.strategy}),a.jsx("td",{style:{...Te,textAlign:"right",color:we},children:ve.openTrades??ve.trades?.filter(Ke=>Ke.status==="open").length??0}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.max_trades}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.profit_level}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.risk}),a.jsx("td",{style:{...Te,textAlign:"center"},children:a.jsx("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 8px",borderRadius:"4px",background:be?"rgba(38,166,154,0.15)":"rgba(148,163,184,0.15)",color:be?re:j,textTransform:"uppercase"},children:ve.status})}),a.jsxs("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Ee},children:[Le>=0?"+":"",Le.toFixed(2)]}),a.jsx("td",{style:{...Te,textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"4px",justifyContent:"center"},children:[be?a.jsx("button",{onClick:()=>o&&o(ve.id),title:"Pause Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:"#f59e0b",color:"#fff"},children:"Pause"}):a.jsx("button",{onClick:()=>s&&s(ve.id),title:"Run Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:re,color:"#fff"},children:"Run"}),a.jsx("button",{onClick:()=>l&&l(ve.id),title:"Delete Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:q,color:"#fff"},children:"Delete"})]})})]},ve.id)})})]})}),H==="history"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ye,children:"Symbol"}),a.jsx("th",{style:ye,children:"Ticket"}),a.jsx("th",{style:ye,children:"Open Time"}),a.jsx("th",{style:ye,children:"Type"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:ye,children:"Close Time"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:Q.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Te,textAlign:"center",padding:"16px",color:j},children:"No trade history"})}):Q.map(ve=>{const be=ve.profit??0,Le=be>=0?re:q;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor=ee,onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Te,fontWeight:700,color:we,letterSpacing:"0.02em"},children:ve.symbol}),a.jsx("td",{style:{...Te,color:j,fontSize:"10px"},children:String(ve.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Te,color:j},children:$e(ve.openAt)}),a.jsx("td",{style:{...Te,fontWeight:700,color:ve.type?.toUpperCase()==="BUY"?re:q},children:ve.type?.toUpperCase()}),a.jsx("td",{style:{...Te,textAlign:"right"},children:Me(ve.volume)}),a.jsx("td",{style:{...Te,textAlign:"right"},children:xe(ve.openPrice)}),a.jsx("td",{style:{...Te,color:j},children:$e(ve.closeAt)}),a.jsx("td",{style:{...Te,textAlign:"right"},children:xe(ve.closePrice)}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.stopLoss?q:j},children:ve.stopLoss?xe(ve.stopLoss):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.takeProfit?re:j},children:ve.takeProfit?xe(ve.takeProfit):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Le},children:Se(be)})]},ve.id)})})]})})]})},Eb="2.3.2";it.AccountPanel=Sb,it.BuySellPanel=ou,it.Chart=ab,it.ChartTypeSelector=fb,it.CoinSelector=Vd,it.DrawingTools=$d,it.LeftSidebar=Tb,it.MarketExecutionModal=au,it.MarketWatch=Ub,it.PositionsPanel=mb,it.SYMBOL_CONFIG=bl,it.StopLoss=Gd,it.TakeProfit=Rd,it.TimeframeSelector=pb,it.ToolCustomizationModal=pu,it.TopBar=vb,it.TradePanel=gb,it.TradingProvider=dw,it.TradingToolbar=hb,it.VolumeControl=Wd,it.alignToTimeframe=Re,it.calcBollingerBands=Ml,it.calcLiveBollingerBands=qs,it.detectGaps=pf,it.getSymbolConfig=sr,it.is24x7Symbol=uf,it.isCryptoSymbol=rn,it.isForexSymbol=An,it.isWithinTradingSession=df,it.normalizeCandleTimes=Ql,it.normalizeTime=te,it.processCandles=El,it.processSingleCandle=Ll,it.setSocketBaseUrl=eu,it.timeframeToSeconds=BA,it.useTrading=$t,it.validateTimeOrdering=ff,it.version=Eb,Object.defineProperty(it,Symbol.toStringTag,{value:"Module"})}));