@nabeeltahirdeveloper/chart-sdk 2.3.18-beta → 2.3.19-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,q){"use strict";var Ws=typeof document<"u"?document.currentScript:null;const $t="17:00-17:00",Xt="America/New_York",HA="24x7",IA="UTC",al={EURUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},ETHUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},BNBUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},SOLUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},ADAUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},XRPUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},DOTUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},MATICUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},LINKUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"}},ll={type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"};function nr(i){return i&&al[i.toUpperCase()]||ll}function en(i){return nr(i).type==="forex"}function tn(i){return nr(i).type==="crypto"}function Ld(i){return nr(i).session==="24x7"}function j(i){if(i==null)return null;if(typeof i=="number"){if(Number.isNaN(i)||!Number.isFinite(i))return null;let e;i>1e10?e=i/1e3:(i<1e9,e=i);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof i=="string"){const e=Date.parse(i);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof i=="object"&&"year"in i&&"month"in i&&"day"in i){const t=new Date(Date.UTC(i.year,i.month-1,i.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function Md(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 Hd(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 cl(i){return Array.isArray(i)?i.map(e=>({...e,time:j(e.time)})).filter(e=>e.time!=null):[]}function Id(i){if(!i||i.length<2)return!0;for(let e=1;e<i.length;e++)if(i[e].time<=i[e-1].time)return!1;return!0}function ke(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function hl(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(j(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof A!="number"||!Number.isFinite(A)||typeof r!="number"||!Number.isFinite(r)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||A<t||A<n||A<r||r>t||r>n||r>A||t<=0||A<=0||r<=0||n<=0)}function ul(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=j(t.time);if(A!=null)if(e.has(A)){const r=e.get(A);e.set(A,{...t,time:A,open:t.open,high:Math.max(r.high,t.high),low:Math.min(r.low,t.low),close:t.close,volume:(r.volume||0)+(t.volume||0)})}else e.set(A,{...t,time:A})}),Array.from(e.values())}function Dd(i,e="percentile"){if(!Array.isArray(i)||i.length<3)return i;const t=i.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return i;const A=[...t].sort((s,o)=>s-o);let r,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),l=A[s],c=A[o],u=c-l;r=l-1.5*u,n=c+1.5*u}else{const s=t.reduce((c,u)=>c+u,0)/t.length,o=t.reduce((c,u)=>c+Math.pow(u-s,2),0)/t.length,l=Math.sqrt(o);if(l===0)return i;r=s-3*l,n=s+3*l}return i.map((s,o)=>{const l=s.close;if(l<r||l>n){if(o===0)return s;const c=i[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function _d(i,e){if(!Array.isArray(i)||i.length===0)return i;const t=[],A=Math.max(e*10080,604800),r=1e4;for(let o=0;o<i.length;o++)if(t.push(i[o]),o<i.length-1){const l=i[o].time,c=i[o+1].time,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const g=i[o];let B=l+e,v=0;for(B=ke(B,e);B<c&&v<r;){const T=ke(B,e);t.some(S=>S.time===T)||(t.push({time:T,open:g.close,high:g.close,low:g.close,close:g.close,volume:0}),v++),B+=e}if(B<c&&v>=r){const T=ke(c-e,e);t.some(S=>S.time===T)||t.push({time:T,open:g.close,high:g.close,low:g.close,close:g.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function hA(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 dl(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=hA(t),o=cl(i).map(E=>({...E,time:ke(E.time,r)})).filter(E=>hl(E)).map(E=>ul(E)),l=pl(o);l.sort((E,k)=>E.time-k.time);const c=Math.floor(Date.now()/1e3),u=l.filter(E=>E.time<=c),g=u.filter((E,k)=>k===0?!0:E.time>u[k-1].time),B=g.length>10?Dd(g,"percentile"):g,v=pl(B);v.sort((E,k)=>E.time-k.time);const T=_d(v,r),y=[];for(let E=1;E<T.length;E++){const k=T[E].time-T[E-1].time;k>r*2&&y.push({from:T[E-1].time,to:T[E].time,gapSeconds:k,gapMinutes:Math.round(k/60),fromDate:new Date(T[E-1].time*1e3).toISOString(),toDate:new Date(T[E].time*1e3).toISOString()})}const S=B.filter((E,k)=>k===0?!1:E.close===B[k-1].close&&E.open===B[k-1].close).length,F={original:i.length,processed:T.length,duplicates:i.length-l.length,outliers:S,gaps:y,filledGaps:T.length-v.length,symbolConfig:A};return{candles:T,stats:F}}function fl(i,e,t="1m"){if(!i||!e||!hl(i))return null;const A=j(i.time);if(A==null)return null;const r=hA(t),n=ke(A,r);return ul({...i,time:n})}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 Pd=(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 Nd(i){return new Pd(i)}var Od=(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}Kd().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=ml(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Nd(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=ml(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?Vd(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 kd(i,e){return new Od(i,e.transform,e.options)}function ml(i){return i.ownerDocument.defaultView}function Kd(){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 Vd(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 zd=(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 zd(r,t,A)}const Wd={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Rd={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Gd={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},$d={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},Xd={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},Jd={color:"#26a69a",base:0},gl={color:"#2196f3"},wl={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 Bl,yl;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 Cl(i,e,t,A){i.beginPath();const r=i.lineWidth%2?.5:0;i.moveTo(t,e+r),i.lineTo(A,e+r),i.stroke()}function ii(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function jt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Se(i){if(i===null)throw new Error("Value is null");return i}function _i(i){return Se(jt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(Bl||(Bl={})),(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"})(yl||(yl={}));const vl={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 gA(i){return i<0?0:i>255?255:Math.round(i)||0}function Tl(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const Zd=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Yd=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,qd=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,jd=/^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 vl&&(i=vl[i]);{const e=jd.exec(i)||qd.exec(i);if(e)return[gA(parseInt(e[1],10)),gA(parseInt(e[2],10)),gA(parseInt(e[3],10)),Tl(e.length<5?1:parseFloat(e[4]))]}{const e=Yd.exec(i);if(e)return[gA(parseInt(e[1],16)),gA(parseInt(e[2],16)),gA(parseInt(e[3],16)),1]}{const e=Zd.exec(i);if(e)return[gA(17*parseInt(e[1],16)),gA(17*parseInt(e[2],16)),gA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function bl(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:bl(e)>160?"black":"white"}}class Lt{constructor(){this.h=[]}l(e,t,A){const r={o:e,_:t,u:A===!0};this.h.push(r)}v(e){const t=this.h.findIndex((A=>e===A.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,A){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function 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 DA(i){return typeof i=="number"&&isFinite(i)}function or(i){return typeof i=="number"&&i%1==0}function ar(i){return typeof i=="string"}function rn(i){return typeof i=="boolean"}function ZA(i){const e=i;if(!e||typeof e!="object")return e;let t,A,r;for(A in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(A)&&(r=e[A],t[A]=r&&typeof r=="object"?ZA(r):r);return t}function ef(i){return i!==null}function lr(i){return i===null?void 0:i}const Rs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Pi(i,e,t){return e===void 0&&(e=Rs),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class tf{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 Gs{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 Af 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],g=Math.round(u.nt*t)+s,B=u.st*A,v=l*A+s;e.moveTo(g,B),e.arc(g,B,v,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function rf(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const nf={from:0,to:1};class sf{constructor(e,t){this.ut=new Gs,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(rf),this.ct=this.dt.map((A=>{const r=new Af;return r.J(A),r})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,t=this.F.wt(),A=this.vt.xt(),r=this.F.St();t.forEach(((n,s)=>{var o;const l=this.dt[s],c=n.kt(A);if(e||c===null||!n.yt())return void(l.tt=null);const u=Se(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,u.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=A,l.it[0].nt=r.It(A),l.tt=nf}))}}let of=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,g,B){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,g),c.lineTo(u+v,B),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,yi(e,this.zt.Et.Nt),Cl(e,l,0,t.width))}};class af{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 of(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),t=Se(this.jt.Ht()),A=t.$t().W().crosshair,r=this.Ft;if(A.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=A.horzLine.width,r.Et.Nt=A.horzLine.style,r.Et.V=A.horzLine.color,r.Lt.et=A.vertLine.width,r.Lt.Nt=A.vertLine.style,r.Lt.V=A.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function lf(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 xl(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 Ql(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return xl(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;xl(i,e+c,t+c,A-s,r-s,(u=-c,o.map((g=>g===0?g:g+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function Fl(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 Ul{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,A,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const u=this.Gt(l,t,A,r),g=u.Jt;return u.Qt?Ql(c,g.ti,g.ii,g.ni,g.si,s,g.ei,[g.ht,0,0,g.ht],s):Ql(c,g.ri,g.ii,g.ni,g.si,s,g.ei,[0,g.ht,g.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(g.ri,g.li,g.ai-g.ri,g.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(u.Qt?g.ui-g.ei:0,g.ii,g.ei,g.ci-g.ii)),u}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,g=this.zt.hi||!this.zt.mi?t.T:0,B=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,T=t.B+this.Xt.gi,y=t.A,S=t.I,F=this.zt.Kt,E=t.P,k=A.Mi(s,F),R=Math.ceil(A.xi(s,F)),M=E+v+T,z=t.C+y+S+R+g,ne=Math.max(1,Math.floor(u));let J=Math.round(M*u);J%2!=ne%2&&(J+=1);const V=B>0?Math.max(1,Math.floor(B*c)):0,Ae=Math.round(z*c),re=Math.round(g*c),he=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,Y=Math.round(he*u)-Math.floor(.5*u),te=Math.floor(Y+ne/2-J/2),oe=te+J,ce=r==="right",se=ce?l.width-B:B,ae=ce?o.width-V:V;let de,we,Fe;return ce?(de=ae-Ae,we=ae-re,Fe=se-g-y-B):(de=ae+Ae,we=ae+re,Fe=se+g+y),{Qt:ce,Jt:{ii:te,li:Y,ci:oe,ni:Ae,si:J,ht:2*c,ei:V,ti:de,ri:ae,ai:we,oi:ne,ui:o.width},di:{ii:te/u,ci:oe/u,fi:Fe,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||Ul)(this.Ci,this.yi),this.Ri=new(e||Ul)(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 cf 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 hf=/[1-9]/g;class Sl{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const A=e.useMediaCoordinateSpace((({context:B})=>(B.font=t.R,Math.round(t.Wi.xi(B,Se(this.zt).Kt,hf)))));if(A<=0)return;const r=t.ji,n=A+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const u=c+n,g=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:B,horizontalPixelRatio:v,verticalPixelRatio:T})=>{const y=Se(this.zt);B.fillStyle=y.t;const S=Math.round(c*v),F=Math.round(0*T),E=Math.round(u*v),k=Math.round(g*T),R=Math.round(2*v);if(B.beginPath(),B.moveTo(S,F),B.lineTo(S,k-R),B.arcTo(S,k,S+R,k,R),B.lineTo(E-R,k),B.arcTo(E,k,E,k-R,R),B.lineTo(E,F),B.fill(),y.hi){const M=Math.round(y.ki*v),z=F,ne=Math.round((z+t.T)*T);B.fillStyle=y.V;const J=Math.max(1,Math.floor(v)),V=Math.floor(.5*v);B.fillRect(M-V,z,J,ne-z)}})),e.useMediaCoordinateSpace((({context:B})=>{const v=Se(this.zt),T=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 y=t.Wi.Mi(B,"Apr0");B.translate(c+r,T+y),B.fillText(v.Kt,0,0)}))}}class uf{constructor(e,t,A){this.ft=!0,this.Wt=new Sl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Se(n)),e.yt=!0;const s=An(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class $s{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 El;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(El||(El={}));class pf extends $s{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 sf(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Se(this.tn).vn())return{_t:l,ki:o};{const c=Se(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new uf(this,e,A),this.wn=new af(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(ef),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 cf(this,t,A),e.set(t,r)),r}}function on(i){return i==="left"||i==="right"}class Vt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(r,n){return r===void 0?n:{Fn:Math.max(r.Fn,n.Fn),Wn:r.Wn||n.Wn}})(this.zn.get(e),t);this.zn.set(e,A)}jn(){return this.En}Hn(e){const t=this.zn.get(e);return t===void 0?{Fn:this.En}:{Fn:Math.max(this.En,t.Fn),Wn:t.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(e){this.Un(),this.Ln=[{qn:1,Vt:e}]}Zn(e){this.Xn(),this.Ln.push({qn:5,Vt:e})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(e){this.Un(),this.Ln.push({qn:2,Vt:e})}Jn(e){this.Un(),this.Ln.push({qn:3,Vt:e})}Qn(){return this.Ln}ts(e){for(const t of e.Ln)this.ns(t);this.En=Math.max(this.En,e.En),e.zn.forEach(((t,A)=>{this.Nn(A,t)}))}static ss(){return new Vt(2)}static es(){return new Vt(3)}ns(e){switch(e.qn){case 0:this.$n();break;case 1:this.Yn(e.Vt);break;case 2:this.Gn(e.Vt);break;case 3:this.Jn(e.Vt);break;case 4:this.Kn();break;case 5:this.Zn(e.Vt);break;case 6:this.Xn()}}Xn(){const e=this.Ln.findIndex((t=>t.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Ll=".";function YA(i,e){if(!DA(i))return"n/a";if(!or(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?i.toString():("0000000000000000"+i.toString()).slice(-e)}class an{constructor(e,t){if(t||(t=1),DA(e)&&or(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=t,this.hs()}format(e){const t=e<0?"−":"";return e=Math.abs(e),t+this.ls(e)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let e=this.Li;for(;e>1;)e/=10,this._s++}}ls(e){const t=this.Li/this.rs;let A=Math.floor(e),r="";const n=this._s!==void 0?this._s:NaN;if(t>1){let s=+(Math.round(e*t)-A*t).toFixed(this._s);s>=t&&(s-=t,A+=1),r=Ll+YA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=Ll+YA(0,n));return A.toFixed(0)+r}}class Ml extends an{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class df{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 Hl(i,e,t,A,r,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=i,u=e[A.from];let g=n(i,u),B=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const T={nt:u.nt-v,st:u.st},y={nt:u.nt+v,st:u.st};o.moveTo(T.nt*l,T.st*c),o.lineTo(y.nt*l,y.st*c),s(i,g,T,y)}else{const v=(y,S)=>{s(i,g,B,S),o.beginPath(),g=y,B=S};let T=B;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let y=A.from+1;y<A.to;++y){T=e[y];const S=n(i,T);switch(t){case 0:o.lineTo(T.nt*l,T.st*c);break;case 1:o.lineTo(T.nt*l,e[y-1].st*c),S!==g&&(v(S,T),o.lineTo(T.nt*l,e[y-1].st*c)),o.lineTo(T.nt*l,T.st*c);break;case 2:{const[F,E]=ff(e,y-1,y);o.bezierCurveTo(F.nt*l,F.st*c,E.nt*l,E.st*c,T.nt*l,T.st*c);break}}t!==1&&S!==g&&(v(S,T),o.moveTo(T.nt*l,T.st*c))}(B!==T||B===T&&t===1)&&s(i,g,B,T)}}const Il=6;function Xs(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Dl(i,e){return{nt:i.nt/e,st:i.st/e}}function ff(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=Dl(Xs(i[t],i[A]),Il),{nt:n.nt+s.nt,st:n.st+s.st}),Xs(i[t],Dl(Xs(i[r],i[e]),Il))]}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 _l 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,Hl(e,A,l,r,n,this.bs.bind(this),mf.bind(null,c))}}function Js(i,e,t){return Math.min(Math.max(i,e),t)}function ln(i,e,t){return e-i<=t}function Pl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Zs{ws(e,t){const A=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==r||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==l){const u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const g=Js(c*e.verticalPixelRatio/l,0,1);u.addColorStop(g,n),u.addColorStop(g,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class gf extends _l{constructor(){super(...arguments),this.Ts=new Zs}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function wf(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class Nl 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&&Hl(e,t,n,A,r,u,wf),l&&(function(g,B,v,T,y){const{horizontalPixelRatio:S,verticalPixelRatio:F,context:E}=g;let k=null;const R=Math.max(1,Math.floor(S))%2/2,M=v*F+R;for(let z=T.to-1;z>=T.from;--z){const ne=B[z];if(ne){const J=y(g,ne);J!==k&&(E.beginPath(),k!==null&&E.fill(),E.fillStyle=J,k=J);const V=Math.round(ne.nt*S)+R,Ae=ne.st*F;E.moveTo(V,Ae),E.arc(V,Ae,M,0,2*Math.PI)}}E.fill()})(e,t,l,A,u)}}class Ol extends Nl{Vs(e,t){return t.lt}}function kl(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=kl.bind(null,!0),Kl=kl.bind(null,!1);function Bf(i,e){return i.ot<e}function yf(i,e){return e<i.ot}function Vl(i,e,t){const A=e.Os(),r=e.ui(),n=cr(i,A,Bf),s=Kl(i,r,yf);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 Ys{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=Vl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class cn extends Ys{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 Cf extends cn{constructor(e,t){super(e,t),this.js=new Gs,this.re=new gf,this.he=new Ol,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 vf 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,g=this.oe,B=u+g-1,v=Math.min(o.de,o.fe),T=Math.max(o.de,o.fe),y=Math.round(v*A)-l,S=Math.round(T*A)+l,F=Math.max(S-y,this.oe);e.fillRect(u,y,g,F);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-E;let ne=Math.max(y,Math.round(o.pe*A)-l),J=ne+g-1;J>y+F-1&&(J=y+F-1,ne=J-g+1),e.fillRect(z,ne,u-z,J-ne+1)}const k=c+E;let R=Math.max(y,Math.round(o.me*A)-l),M=R+g-1;M>y+F-1&&(M=y+F-1,R=M-g+1),e.fillRect(B+1,R,k-B,M-R+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Se(this.zt).le,e)))}}class zl extends Ys{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 Tf extends zl{constructor(){super(...arguments),this.js=new vf}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 bf extends _l{constructor(){super(...arguments),this.Ts=new Zs}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 xf extends Nl{constructor(){super(...arguments),this.Pe=new Zs}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 Qf extends cn{constructor(e,t){super(e,t),this.js=new Gs,this.Ve=new bf,this.Oe=new xf,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 Ff 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 g=A.from;g<A.to;g++){const B=t[g];B.Ee!==o&&(r.fillStyle=B.Ee,o=B.Ee);const v=Math.round(Math.min(B.pe,B.me)*s),T=Math.round(Math.max(B.pe,B.me)*s),y=Math.round(B.de*s),S=Math.round(B.fe*s);let F=Math.round(n*B.nt)-c;const E=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,E));const k=E-F+1;r.fillRect(F,y,k,v-y),r.fillRect(F,T+1,k,S-T),u=E}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const A=Math.max(Math.floor(e),t);return this.ae<=2*A?Math.max(Math.floor(e),Math.floor(1*e)):A}Ie(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let u=A.from;u<A.to;u++){const g=t[u];g.Ne!==o&&(r.fillStyle=g.Ne,o=g.Ne);let B=Math.round(g.nt*n)-Math.floor(.5*this.ae);const v=B+this.ae-1,T=Math.round(Math.min(g.pe,g.me)*s),y=Math.round(Math.max(g.pe,g.me)*s);if(c!==null&&(B=Math.max(c+1,B),B=Math.min(B,v)),this.zt.le*n>2*l)lf(r,B,T,v-B+1,y-T+1,l);else{const S=v-B+1;r.fillRect(B,T,S,y-T+1)}c=v}}Le(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=A.from;c<A.to;c++){const u=t[c];let g=Math.round(Math.min(u.pe,u.me)*s),B=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),T=v+this.ae-1;if(u.ce!==o){const y=u.ce;r.fillStyle=y,o=y}this.zt._i&&(v+=l,g+=l,T-=l,B-=l),g>B||r.fillRect(v,g,T-v+1,B-g+1)}}}class Uf extends zl{constructor(){super(...arguments),this.js=new Ff}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class Sf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class qs extends Ys{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new Sf(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(Ef),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Ef(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class Lf 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 g,B;e.fillStyle=l.ce,u<=n?(g=u,B=s):(g=n,B=u-Math.floor(r/2)+r),e.fillRect(c.Os,g,c.ui-c.Os+1,B-g)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,c;if(A%2){const u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class Mf extends cn{constructor(){super(...arguments),this.js=new Lf}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,Se(this.Es.Ct()).Vt)};this.js.J(e)}}class Hf extends cn{constructor(){super(...arguments),this.js=new Ol}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 If=/[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||If,n=String(t).replace(r,"0");if(this.tr.has(n))return jt(this.tr.get(n)).er;if(this.Ke===this.ir){const o=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(o),this.Je++,this.Ke--}e.save(),e.textBaseline="middle";const s=e.measureText(n);return e.restore(),s.width===0&&t.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class 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 Wl{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 _f 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),Cl(e,n,0,t.width))}}class js{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new _f,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 Pf extends js{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 Nf 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 Rl(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 Gl(i,e){const t=i%2600/2600;let A;for(const l of Of)if(t>=l.Vr&&t<=l.Or){A=l;break}ii(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:Rl(e,r,A.Ir,A.zr),Dr:Rl(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 Nf,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=Gl(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=Gl(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 Pl(Math.min(Math.max(i,12),30)*e)}function pr(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 $l(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(ur(i,1))}function Xl(i){return Math.max(ur(i,.1),3)}function Jl(i,e,t){return e?i:t?Math.ceil(i/2):0}function Zl(i,e,t,A,r){const n=pr("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function Yl(i,e,t,A){const r=(pr("arrowUp",A)-1)/2*t.Jr,n=(Pl(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 Kf(i,e,t,A,r,n){return Zl(e,t,A,r,n)}class Vf 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(Wf(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),zf(o,e,t,A)}}}}function zf(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 Yl(!1,n,s,r.Ks);case"arrowUp":return void Yl(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(pr("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=pr("square",c),g=(u-1)*l.Jr/2,B=l.nt-g,v=l.st-g;o.fillRect(B,v,u*l.Jr,u*l.Jr)})(n,s,r.Ks)}r.nh}})(i,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(i,t,A))}function Wf(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 Kf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const g=2+pr("circle",l)/2,B=s-c,v=o-u;return Math.sqrt(B*B+v*v)<=g})(A.nt,A.st,A.Ks,r,n);case"square":return Zl(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function Rf(i,e,t,A,r,n,s,o,l){const c=DA(t)?t:t.Se,u=DA(t)?t:t.Me,g=DA(t)?t:t.xe,B=DA(e.size)?Math.max(e.size,0):1,v=$l(o.le())*B,T=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-T-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-T-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(g,l)+T+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class Gf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Vf,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=Xl(e),A=1.5*$l(e)+2*t,r=this.fh();this.ah={above:Jl(A,r.aboveBar,r.inBar),below:Jl(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=Xl(t.le()),c={sh:l,eh:l};this.zt.tt=Vl(this.zt.it,n,!0);for(let u=this.zt.tt.from;u<this.zt.tt.to;u++){const g=A[u];g.time!==o&&(c.sh=l,c.eh=l,o=g.time);const B=this.zt.it[u];B.nt=t.It(g.time),g.text!==void 0&&g.text.length>0&&(B.Kt={ih:g.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(g.time);v!==null&&Rf(B,g,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class $f extends js{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 Xf extends sn{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const u=r.mh(c.V),g=An(u);A.t=g.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=g.i,t.V=g.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function ql(i,e,t,A){const r=Number.isFinite(e),n=Number.isFinite(t);return r&&n?i(e,t):r||n?r?e:t:A}class rA{constructor(e,t){this.kh=e,this.yh=t}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new rA(this.kh,this.yh)}Ph(){return this.kh}Rh(){return this.yh}Dh(){return this.yh-this.kh}Ni(){return this.yh===this.kh||Number.isNaN(this.yh)||Number.isNaN(this.kh)}ts(e){return e===null?this:new rA(ql(Math.min,this.Ph(),e.Ph(),-1/0),ql(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!DA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let A=this.yh-t,r=this.kh-t;A*=e,r*=e,this.yh=t+A,this.kh=t+r}Oh(e){DA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new rA(e.minValue,e.maxValue)}}class hn{constructor(e,t){this.Ih=e,this.zh=t||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return this.Ih===null?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(e){return e===null?null:new hn(rA.Ah(e.priceRange),e.margins)}}class Jf extends js{constructor(e,t){super(e),this.Nh=t}yr(){const e=this.Sr;e.yt=!1;const t=this.Nh.W();if(!this.Es.yt()||!t.lineVisible)return;const A=this.Nh.Fh();A!==null&&(e.yt=!0,e.st=A,e.V=t.color,e.et=t.lineWidth,e.Nt=t.lineStyle,e.gr=this.Nh.W().id)}}class Zf extends sn{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.Nh.W(),n=r.axisLabelVisible,s=r.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(t.Kt=r.title,t.yt=!0),t.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(r.price),e.yt=!0;const c=An(r.axisLabelColor||r.color);A.t=c.t;const u=r.axisLabelTextColor||c.i;e.V=u,t.V=u,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Yf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Jf(e,this),this.ur=new Zf(e,this),this.Hh=new Wl(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 qf extends $s{constructor(e){super(),this.$i=e}$t(){return this.$i}}const jf={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Se(i(t,A)),l=_i(o.Vt[0])<=_i(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,u=e.borderDownColor,g=e.wickUpColor,B=e.wickDownColor,v=Se(i(t,A)),T=_i(v.Vt[0])<=_i(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:T?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:T?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:T?g:B}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Se(i(t,A));return{ce:(r=l.lt)!==null&&r!==void 0?r:e.lineColor,lt:(n=l.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=l.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=l.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(i,e,t,A)=>{var r,n,s,o,l,c;const u=Se(i(t,A));return{ce:u.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=u.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=u.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=u.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=u.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=u.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=u.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Se(i(t,A));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class e0{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=jf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var jl;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(jl||(jl={}));const ri=30;class t0{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 Kl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,A){if(this.Ni())return null;let r=null;const n=Se(this.el()),s=Se(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/ri)*ri,u=Math.max(c,Math.floor(l/ri)*ri);{const B=this.fl(o),v=this.vl(Math.min(l,c,t));r=un(r,this.pl(B,v,A))}let g=this.il.get(A);g===void 0&&(g=new Map,this.il.set(A,g));for(let B=Math.max(c+1,o);B<u;B+=ri){const v=Math.floor(B/ri);let T=g.get(v);if(T===void 0){const y=this.fl(v*ri),S=this.vl((v+1)*ri-1);T=this.pl(y,S,A),g.set(v,T)}r=un(r,T)}{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 A0{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 eo{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 A0(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 ec(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 i0{constructor(e,t){this.Wt=new Sl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},ec(this.kl))),this.Wt}}class r0 extends sn{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=ec(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 n0{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 eo(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 i0(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 r0(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 eo(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 eo(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 to(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function Ao(i){return i.Pn()}function s0(i){return i.Bl()}function o0(i){return i.Al()}class io extends qf{constructor(e,t,A,r,n){super(e),this.zt=new t0,this.jh=new $f(this),this.zl=[],this.Ll=new Pf(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 Xf(this);this.rn=[s],this.Hh=new Wl(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 g=this.zt.sl();if(g===null)return t;s=g,o=g.ee}else{const g=this.zt.ll(r.ui(),-1);if(g===null||(s=this.zt.Gh(g.ee),s===null))return t;o=g.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),u=A.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:A.Fi(l,n.Vt),xh:A.Yl(l),Sh:A.Zl(l,n.Vt),V:c.ce,ki:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new e0(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 Yf(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=[];to(this.Hl,Ao,"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),to(this.Hl,Ao,"normal",e),e}ua(){return this.ca(Ao,"bottom")}da(e){return this.ca(s0,e)}fa(e){return this.ca(o0,e)}va(e,t){return this.Hl.map((A=>A.wr(e,t))).filter((A=>A!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const A=[...this.rn];for(const r of this.zl)A.push(r.Zh());return this.Hl.forEach((r=>{A.push(...r.Rn())})),A}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const A=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return hn.Ah(A)}return this.pa(e,t)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return Se(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new n0(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof qs)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof qs)return e=>this.wn.je(e)}_a(){return!on(this.Dt().Pa())}pa(e,t){if(!or(e)||!or(t)||this.zt.Ni())return null;const A=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],r=this.zt.ol(e,t,A);let n=r!==null?new rA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new rA(o,o);n=n!==null?n.ts(l):l}let s=this.dn.uh();return this.Hl.forEach((o=>{const l=o.Il(e,t);if(l?.priceRange){const v=new rA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,g,B;l?.margins&&(c=s,u=l.margins,s={above:Math.max((g=c?.above)!==null&&g!==void 0?g:0,u.above),below:Math.max((B=c?.below)!==null&&B!==void 0?B:0,u.below)})})),new hn(n,s)}ga(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}Ma(){switch(this.$l){case"Line":case"Area":case"Baseline":{const e=this.cn.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(e){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(t.length!==0)return t}}return this.Us().$s(e).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new df(this.cn.priceFormat.precision);break;case"percent":this.wa=new Ml(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new an(e,this.cn.priceFormat.minMove*e)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const e=this.$t().St();if(!e.Da()||this.zt.Ni())return void(this.Wl=[]);const t=Se(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Se(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Se(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:r,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new Gf(this,this.$t()),this.$l){case"Bar":this.wn=new Tf(this,this.$t());break;case"Candlestick":this.wn=new Uf(this,this.$t());break;case"Line":this.wn=new Hf(this,this.$t());break;case"Custom":this.wn=new qs(this,this.$t(),jt(e));break;case"Area":this.wn=new Cf(this,this.$t());break;case"Baseline":this.wn=new Qf(this,this.$t());break;case"Histogram":this.wn=new Mf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return to(this.Hl,e,t,A),A}}class a0{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 io)).reduce(((u,g)=>{if(A.vr(g)||!g.yt())return u;const B=g.Dt(),v=g.In();if(B.Ni()||!v.Kr(t))return u;const T=v.Gh(t);if(T===null)return u;const y=_i(g.Ct());return u.concat([B.Rt(T.Vt[3],y.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,g)=>Math.abs(u-o)-Math.abs(g-o)));const c=l[0];return r=n.pn(c,s),r}}class l0 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=Se(this.zt);if(s.Aa){e.strokeStyle=s.Ia,yi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*A);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,yi(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*r);e.moveTo(-n,l),e.lineTo(t.width+n,l)}e.stroke()}}))}}class c0{constructor(e){this.Wt=new l0,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 h0{constructor(e){this.wn=new c0(e)}qh(){return this.wn}}const ro={$a:4,Ua:1e-4};function Ni(i,e){const t=100*(i-e)/e;return e<0?-t:t}function u0(i,e){const t=Ni(i.Ph(),e),A=Ni(i.Rh(),e);return new rA(t,A)}function dr(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function p0(i,e){const t=dr(i.Ph(),e),A=dr(i.Rh(),e);return new rA(t,A)}function pn(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.log10(t+e.Ua)+e.$a;return i<0?-A:A}function fr(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.pow(10,t-e.$a)-e.Ua;return i<0?-A:A}function mr(i,e){if(i===null)return null;const t=pn(i.Ph(),e),A=pn(i.Rh(),e);return new rA(t,A)}function dn(i,e){if(i===null)return null;const t=fr(i.Ph(),e),A=fr(i.Rh(),e);return new rA(t,A)}function no(i){if(i===null)return ro;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return ro;const t=Math.ceil(Math.abs(Math.log10(e))),A=ro.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class so{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let r=A;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let A=this.qa;A!==1;){if(A%2==0)this.Za.push(2),A/=2;else{if(A%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),A/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,A){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const g=ln(n,r,1e-14)&&n>r+1e-14,B=ln(n,A*o,1e-14),v=ln(n,1,1e-14);if(!(g&&B&&v))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];ln(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,u;return n}}class tc{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 so(this.qa,[2,2.5,2]),s=new so(this.qa,[2,2,2.5]),o=new so(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let u=c[0];for(let g=1;g<c.length;++g)c[g]<u&&(u=c[g]);return u})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),r=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=A-1-s,c=Math.max(r,n),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let g=this.Xa(c,u),B=c%g;B+=B<0?g:0;const v=c>=u?1:-1;let T=null,y=0;for(let S=c-B;S>u;S-=g){const F=this.Ja(S,t,!0);T!==null&&Math.abs(F-T)<this.Qa()||F<o||F>l||(y<this.Ka.length?(this.Ka[y].Ea=F,this.Ka[y].so=e.eo(S)):this.Ka.push({Ea:F,so:e.eo(S)}),y++,T=F,e.ro()&&(g=this.Xa(S*v,u)))}this.Ka.length=y}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Ac(i){return i.slice().sort(((e,t)=>Se(e.Xi())-Se(t.Xi())))}var ic;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(ic||(ic={}));const rc=new Ml,nc=new an(100,1);class d0{constructor(e,t,A,r){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new Lt,this.vo=new Lt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=nc,this.xo=no(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new tc(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=jt(e.scaleMargins.top),A=jt(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(A<0||A>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${A}`);if(t+A>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+A}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return this.cn.mode===1}Mh(){return this.cn.mode===2}Oo(){return this.cn.mode===3}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(e){const t=this.Cr();let A=null;e.Wn!==void 0&&(this.cn.autoScale=e.Wn),e.Cr!==void 0&&(this.cn.mode=e.Cr,e.Cr!==2&&e.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),t.Cr===1&&e.Cr!==t.Cr&&((function(n,s){if(n===null)return!1;const o=fr(n.Ph(),s),l=fr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=dn(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=mr(this.Ih,this.xo),A!==null&&this.Ao(A));const r=t.Cr!==this.cn.mode;r&&(t.Cr===2||this.Mh())&&this.Ra(),r&&(t.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&t.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(t,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(e){this.ho!==e&&(this.ho=e,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const e=this.At()-this.No()-this.Fo();return this.lo=e,e}Lh(){return this.Wo(),this.Ih}Ao(e,t){const A=this.Ih;(t||A===null&&e!==null||A!==null&&!A.Ch(e))&&(this.bo=null,this.Ih=e)}Ni(){return this.Wo(),this.ho===0||!this.Ih||this.Ih.Ni()}jo(e){return this.Bo()?e:this.At()-1-e}Rt(e,t){return this.Mh()?e=Ni(e,t):this.Oo()&&(e=dr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),g=A===void 0?0:A.from,B=A===void 0?e.length:A.to,v=this.Ho();for(let T=g;T<B;T++){const y=e[T],S=y._t;if(isNaN(S))continue;let F=S;v!==null&&(F=v(y._t,t));const E=r+u*(F-s),k=c?E:this.ho-1-E;y.st=k}}be(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),g=A===void 0?0:A.from,B=A===void 0?e.length:A.to,v=this.Ho();for(let T=g;T<B;T++){const y=e[T];let S=y.ge,F=y.Me,E=y.xe,k=y.Se;v!==null&&(S=v(y.ge,t),F=v(y.Me,t),E=v(y.xe,t),k=v(y.Se,t));let R=r+u*(S-s),M=c?R:this.ho-1-R;y.pe=M,R=r+u*(F-s),M=c?R:this.ho-1-R,y.de=M,R=r+u*(E-s),M=c?R:this.ho-1-R,y.fe=M,R=r+u*(k-s),M=c?R:this.ho-1-R,y.me=M}}pn(e,t){const A=this.To(e,t);return this.$o(A,t)}$o(e,t){let A=e;return this.Mh()?A=(function(r,n){return n<0&&(r=-r),r/100*n+n})(A,t):this.Oo()&&(A=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(A,t)),A}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const A=this.po[t];A.Xi()===null&&A.Ki(t+1),e.push(A)}return e=Ac(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const A=t.Ct();A!==null&&(e===null||A.la<e.la)&&(e=A)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=Se(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const A=Se(this.ao).Th();t=Math.max(t,.1),A.Vh(t),this.Ao(A)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=Se(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Se(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Se(this.ao).Th();n.Oh(r),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(Ni(e,t));case 3:return this.ba().format(dr(e,t));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,Se(this.e_()).ba())}Zl(e,t){return e=Ni(e,t),this.s_(e,rc)}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=nc,this.Mh()?(this.wa=rc,t=100):this.Oo()?(this.wa=new an(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new tc(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?pn(e,this.xo):e;const A=Se(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),r=Se(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?fr(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const A=this.r_();let r=0,n=0;for(const l of A){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const u=l.Il(e.Os(),e.ui());let g=u&&u.Lh();if(g!==null){switch(this.cn.mode){case 1:g=mr(g,this.xo);break;case 2:g=u0(g,c.Vt);break;case 3:g=p0(g,c.Vt)}if(t=t===null?g:t.ts(Se(g)),u!==null){const B=u.Eh();B!==null&&(r=Math.max(r,B.above),n=Math.max(n,B.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=dn(t,this.xo)),t=new rA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=mr(t,this.xo))}if(this.ro()){const l=dn(t,this.xo),c=no(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?dn(this.ao,this.xo):null;this.xo=c,t=mr(l,c),u!==null&&(this.ao=mr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new rA(-.5,.5)),this.xo=no(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ni:this.Oo()?dr:this.ro()?e=>pn(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 f0{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Lt,this.yl=e,this.$i=t,this.d_=new h0(this);const A=t.W();this.f_=this.v_("left",A.leftPriceScale),this.p_=this.v_("right",A.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(A)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const t=Array.from(this.o_.values());for(const A of t){const r=Se(A[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?jt(this.o_.get(e))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((e=>{e.S&&e.S()})),this.c_.m()}M_(){return this.u_}x_(e){this.u_=e}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(e){this.__=e,this.k_()}Lo(e){this.ho=e,this.f_.Lo(e),this.p_.Lo(e),this.po.forEach((t=>{if(this.vr(t)){const A=t.Dt();A!==null&&A.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const t=e.Dt();return t===null||this.f_!==t&&this.p_!==t}qo(e,t,A){const r=A!==void 0?A:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ii(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Se(e.Dt()).Pa();if(this.o_.has(A)){const n=jt(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const r=e.Dt();r&&r.Ba().indexOf(e)>=0&&r.Zo(e),r!==null&&(r.Yo(),this.P_(r)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,t){e.Go(t)}O_(e,t){e.Jo(t),this.k_()}B_(e){e.Qo()}A_(e,t){e.t_(t)}I_(e,t){e.i_(t),this.k_()}z_(e){e.n_()}k_(){this.po.forEach((e=>{e.Vn()}))}vn(){let e=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?e=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?e=this.f_:this.po.length!==0&&(e=this.po[0].Dt()),e===null&&(e=this.p_),e}pr(){let e=null;return this.$i.W().rightPriceScale.visible?e=this.p_:this.$i.W().leftPriceScale.visible&&(e=this.f_),e}P_(e){e!==null&&e.Vo()&&this.L_(e)}E_(e){const t=this.yl.Xs();e.Ro({Wn:!0}),t!==null&&e.h_(t),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((e=>{this.vr(e)&&this.P_(e.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=Ac(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 d0(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(jt(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(A,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,A),this.Ke++,this.Ge++,n}}class gr{constructor(e,t){ii(e<=t,"right should be >= left"),this.X_=e,this.K_=t}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(e){return this.X_<=e&&e<=this.K_}Ch(e){return this.X_===e.Os()&&this.K_===e.ui()}}function sc(i,e){return i===null||e===null?i===e:i.Ch(e)}class g0{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,t){this.nu(t),this.tr=null;for(let A=t;A<e.length;++A){const r=e[A];let n=this.J_.get(r.timeWeight);n===void 0&&(n=[],this.J_.set(r.timeWeight,n)),n.push({index:A,time:r.time,weight:r.timeWeight,originalTime:r.originalTime})}}su(e,t){const A=Math.ceil(t/e);return this.tr!==null&&this.tr.eu===A||(this.tr={Ha:this.ru(A),eu:A}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const t=[];this.J_.forEach(((A,r)=>{e<=A[0].index?t.push(r):A.splice(cr(A,e,(n=>n.index<e)),1/0)}));for(const A of t)this.J_.delete(A)}ru(e){let t=[];for(const A of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(A))continue;const r=t;t=[];const n=r.length;let s=0;const o=jt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let g=0;g<l;g++){const B=o[g],v=B.index;for(;s<n;){const T=r[s],y=T.index;if(!(y<v)){c=y;break}s++,t.push(T),u=y,c=1/0}if(c-v>=e&&v-u>=e)t.push(B),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class Oi{constructor(e){this.hu=e}lu(){return this.hu===null?null:new gr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Oi(null)}}function w0(i,e){return i.weight>e.weight?i:e}class B0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new g0,this.du=new Map,this.fu=Oi.ou(),this.vu=!0,this.pu=new Lt,this.mu=new Lt,this.bu=new Lt,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=A,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){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=Se(this.Bu()),n=Se(this.Au());return{from:Se(this.Ui(Math.max(r,t))),to:Se(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Se(this.Va(e.from,!0)),to:Se(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),A=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&A!==0){const r=this.Su*e/A;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=A-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!or(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=A+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(this.gu!==null)return this.gu;const e=this.Su,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),A=Math.round(t/e),r=Se(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,u=this.$u(),g=this.cn.fixLeftEdge||u,B=this.cn.fixRightEdge||u;let v=0;for(const T of o){if(!(n<=T.index&&T.index<=s))continue;let y;v<this.Mu.length?(y=this.Mu[v],y.coord=this.It(T.index),y.label=this.Uu(T),y.weight=T.weight):(y={needAlignCoordinate:!1,coord:this.It(T.index),label:this.Uu(T),weight:T.weight},this.Mu.push(y)),this.Su>t/2&&!u?y.needAlignCoordinate=!1:y.needAlignCoordinate=g&&T.index<=l||B&&T.index>=c,v++}return this.Mu.length=v,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const A=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(A-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const t=Js(this.__-e,0,this.__),A=Js(this.__-Se(this.wo),0,this.__);t!==0&&A!==0&&this.Gn(this.wu.le*t/A)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const t=(this.Mo-e)/this.le();this.xu=Se(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const A=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:A+(e-A)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new gr(e,t+this.cn.rightOffset))}lc(e){const t=new gr(e.from,e.to);this.rc(t)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:t}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(e){return(this.__-1-e)/this.Su}Fu(e){const t=this.ac(e),A=this.Eu()+this.xu-t;return Math.round(1e6*A)/1e6}ju(e){const t=this.Su;this.Su=e,this.zu(),t!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Oi.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new gr(A-t+1,A);this._c(new Oi(r))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const e=this.cc();e!==null&&this.xu<e&&(this.xu=e,this.vu=!0);const t=this.dc();this.xu>t&&(this.xu=t,this.vu=!0)}cc(){const e=this.Bu(),t=this._u;return e===null||t===null?null:e-t-1+(this.cn.fixLeftEdge?this.__/this.Su:Math.min(2,this.uu.length))}dc(){return this.cn.fixRightEdge?0:this.__/this.Su-Math.min(2,this.uu.length)}Xu(){this.wu={le:this.le(),Hu:this.Hu()}}Ku(){this.wu=null}Uu(e){let t=this.du.get(e.weight);return t===void 0&&(t=new 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,sc(t.lu(),this.fu.lu())||this.pu.m(),sc(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 y0{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 C0 extends y0{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 v0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new C0(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 T0 extends $s{constructor(e,t){super(),this.cn=t,this.wn=new v0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var oc,ac,lc,cc,hc;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(oc||(oc={}));class b0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Lt,this.Rc=new Lt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new tf(this),this.yl=new B0(this,t.timeScale,this.cn.localization,A),this.vt=new pf(this,t.crosshair),this.Bc=new a0(t.crosshair),this.Ac=new T0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Vt.es())}Uh(){this.Nc(Vt.ss())}oa(){this.Nc(new Vt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){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 f0(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const A=e===void 0?this.yc.length-1:e,r=Vt.es();return r.Nn(A,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,A){e.V_(t,A)}O_(e,t,A){e.O_(t,A),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,A){t.Vo()||e.A_(t,A)}I_(e,t,A){t.Vo()||(e.I_(t,A),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,t){t.Vo()||(e.z_(t),this.Nc(this.Gc(e,2)))}E_(e,t){e.E_(t),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,t){const A=this.St();if(A.Ni()||t===0)return;const r=A.Hi();e=Math.max(1,Math.min(e,r)),A.Zu(e,t),this.Wu()}td(e){this.nd(0),this.sd(e),this.ed()}rd(e){this.yl.Jo(e),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(e){this.yl.t_(e)}sd(e){this.yl.i_(e),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(e,t,A,r,n){this.vt.gn(e,t);let s=NaN,o=this.yl.Nu(e);const l=this.yl.Xs();l!==null&&(o=Math.min(Math.max(l.Os(),o),l.ui()));const c=r.vn(),u=c.Ct();u!==null&&(s=c.pn(t,u)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const r=A.vn(),n=r.Ct(),s=r.Rt(e,Se(n)),o=this.yl.Va(t,!0),l=this.yl.It(Se(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),u=e!==null&&e>s&&!c,g=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,B=l&&(A!==void 0||g)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!B){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.S())),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(e,t,A){const r=this.yc[0],n=this.fd(t,e,r,A);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),A=this.Cc.indexOf(e);ii(A!==-1,"Series not found"),this.Cc.splice(A,1),Se(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Se(this.dr(e));A.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();A.qo(e,t,n)}else{const n=r.Ht===A?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Vt.ss();e.$n(),this.Nc(e)}pd(e){const t=Vt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Vt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Vt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Vt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Vt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Vt.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,u,g]=sr(n),[B,v,T,y]=sr(s),S=[gA(l+o*(B-l)),gA(c+o*(v-c)),gA(u+o*(T-u)),Tl(g+o*(y-g))];return`rgba(${S[0]}, ${S[1]}, ${S[2]}, ${S[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new Vt(t);if(e!==null){const r=this.yc.indexOf(e);A.Nn(r,{Fn:t})}return A}Fc(e,t){return t===void 0&&(t=2),this.Gc(this.dr(e),t)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((t=>t.j_().qh().bt()))}fd(e,t,A,r){const n=new io(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 oo(i){return!DA(i)&&!ar(i)}function uc(i){return DA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(ac||(ac={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(lc||(lc={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(cc||(cc={})),(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"})(hc||(hc={}));const pc=i=>i.getUTCFullYear();function x0(i,e,t){return e.replace(/yyyy/g,(A=>YA(pc(A),4))(i)).replace(/yy/g,(A=>YA(pc(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 dc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return x0(e,this.gd,this.Md)}}class Q0{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 F0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class U0{constructor(e={}){const t=Object.assign(Object.assign({},F0),e);this.Td=new dc(t.Sd,t.Cd),this.Pd=new Q0(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 ao(i){return 60*i*1e3}const mn=[{Dd:(fc=1,1e3*fc),Vd:10},{Dd:ao(1),Vd:20},{Dd:ao(5),Vd:21},{Dd:ao(30),Vd:22},{Dd:fn(1),Vd:30},{Dd:fn(3),Vd:31},{Dd:fn(6),Vd:32},{Dd:fn(12),Vd:33}];var fc;function mc(i,e){if(i.getUTCFullYear()!==e.getUTCFullYear())return 70;if(i.getUTCMonth()!==e.getUTCMonth())return 60;if(i.getUTCDate()!==e.getUTCDate())return 50;for(let t=mn.length-1;t>=0;--t)if(Math.floor(e.getTime()/mn[t].Dd)!==Math.floor(i.getTime()/mn[t].Dd))return mn[t].Vd;return 0}function lo(i){let e=i;if(ar(i)&&(e=co(i)),!oo(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 gc(i){if(!uc(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function co(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 wc(i){ar(i.time)&&(i.time=co(i.time))}class Bc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(wc)})(e):wc(e)}createConverterToInternalObj(e){return Se((function(t){return t.length===0?null:oo(t[0].time)||ar(t[0].time)?lo:gc})(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 uc(t=e)?gc(t):oo(t)?lo(t):lo(co(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new U0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new dc(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(w0,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=mc(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=mc(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return xA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const ki=typeof window<"u";function yc(){return!!ki&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ho(){return!!ki&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function uo(i){return i+i%2}function po(i,e){return i.zd-e.zd}function fo(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class S0{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=fo(this.Ld,this.Ed,this.Ud),n=po(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=fo(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=po(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const g=fo(this.Nd,this.Fd,this.Ud);if(Math.sign(g)===Math.sign(r)){const B=po(this.Nd,this.Fd);s.push(g),o.push(B),A+=B}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/A*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,u){const g=Math.log(u);return Math.log(1*g/-c)/g})(Math.abs(l),this.qd))}tc(e){const t=Se(this.Wd),A=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,A)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Se(this.Wd).ot;return Math.min(t,this.jd)}}class E0{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 bl(sr(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.pathname:""}tf(){this.nf()&&(this.if(),this.en=this.sf(),this.en&&(this.Gd=this.ef(),this.Kd=document.createElement("style"),this.Kd.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.Xd=document.createElement("a"),this.Xd.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.rf()}`,this.Xd.title="Charting by TradingView",this.Xd.id="tv-attr-logo",this.Xd.target="_blank",this.Xd.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 19" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.Xd.toggleAttribute("data-dark",this.Gd==="dark"),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function Ci(i,e){const t=Se(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=kd(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 gn(i,e,t,A){i.X(e,t,A)}function go(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function L0(i){ki&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class wo{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=!ho(),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=Bo(e.changedTouches,Se(this.Of));if(t===null||(this.Vf=wn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(_A(t),Se(this.pf)),{nv:r,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),Ki(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(_A(e),Se(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:A,sv:r,Nf:A+r}}ov(e){let t=Bo(e.changedTouches,Se(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=wn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const A=this.Ef(e,t);if(this.Wf(A,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(_A(t),this.cf);r<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&Ki(e));this._f===0&&Ki(e),e.touches.length===0&&this.ff&&(this.ff=!1,Ki(e))}If(e){if(e.button!==0)return;const t=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),yc()&&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;yc()&&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})}ho()&&(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}),L0(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=Cc(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=Cc(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=!ho()}vv(e){const t=Bo(e.touches,Se(this.Of));if(t===null)return;const A=this.Ef(e,t);this.Wf(A,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:wn(e)<this.Vf+500}Wf(e,t){t&&t.call(this.Hf,e)}Uf(e,t){t&&t.call(this.Hf,e)}Ef(e,t){const A=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:A.clientX,clientY:A.clientY,pageX:A.pageX,pageY:A.pageY,screenX:A.screenX,screenY:A.screenY,localX:A.clientX-r.left,localY:A.clientY-r.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Ki(e)}}}}function Cc(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 Bo(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 M0(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 yo(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 vc(i,e,t,A){if(!i.length)return;let r=0;const n=t/2,s=i[0].At(A,!0);let o=e===1?n-(i[0].Vi()-s/2):i[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<i.length;l++){const c=i[l],u=i[l-1],g=u.At(A,!1),B=c.Vi(),v=u.Vi();if(e===1?B>v-g:B<v+g){const T=v-g*e;c.Oi(T);const y=T-e*g/2;if((e===1?y<0:y>t)&&o>0){const S=e===1?-1-y:y-t,F=Math.min(S,o);for(let E=r;E<i.length;E++)i[E].Oi(i[E].Vi()+e*F);o-=F}}else r=l,o=e===1?v-g-B:B-(v+g)}}class Tc{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=yo("normal",r),this.Zv=yo("top",r),this.Xv=yo("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 wo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose(),this.Li!==null&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const t=this.ap(),A=Se(this.Gv.canvasElement.getContext("2d"));A.save();const r=this.Li.Ha();A.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(A,r[0].so),this.Fv.xi(A,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const u=this.Fv.xi(A,n[c].Kt());u>e&&(e=u)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),u=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,u))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,u))-.11111111111111,s)))}var o;A.restore();const l=e||34;return uo(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&wi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return Se(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,Se(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=Bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}bt(){var e;(e=this.Li)===null||e===void 0||e.Ha()}Qv(e){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!0,t.V_(A,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp(),r=this.Li;t.O_(A,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),A=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,A))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!1,t.B_(A,this.Li)}sp(e){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(e){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(e){this.kp(0)}up(){const e=[],t=this.Li===null?void 0:this.Li;return(A=>{for(let r=0;r<A.length;++r){const n=A[r].Rn(this.tn.fp(),t);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,s):Fl(e,0,0,A,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(l)),u=Math.floor(.5*l),g=Math.round(r.T*o);s.beginPath();for(const B of t)s.rect(Math.floor(n*o),Math.round(B.Ea*l)-u,g,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-r.A):Math.round(n+r.T+r.A),c=t.map((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const g=t[u];s.fillText(g.so,l,g.Ea+c[u])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),r=this.ap();this.Li===A.pr()&&this.tn.fp().Uo().forEach((s=>{A.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(A,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,r)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,r=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));r.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),l=s.ki();l>-o&&l<o&&s.Oi(o),l>this.Ev.height-o&&l<this.Ev.height+o&&s.Oi(this.Ev.height-o)}vc(r,1,this.Ev.height,t),vc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Se(this.Li)).X(e,A,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((l=>{l.forEach((c=>{c.gt(Se(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return Pi(this.ko.fontSize,this.ko.fontFamily)}}function H0(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 I0(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 Co{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 Lt,this.Op=new Lt,this.Bp=0,this.Ap=!1,this.Ip=null,this.zp=!1,this.Lp=null,this.Ep=null,this.jv=!1,this.Hv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Uv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Qd=e,this.Np=t,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const A=document.createElement("div");A.style.width="100%",A.style.height="100%",A.style.position="relative",A.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(A),this.Gv=Ci(A,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 wo(this.Jv.canvasElement,this,{ev:()=>this.Ip===null&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>this.Ip===null&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.Cp!==null&&this.Cp.S(),this.Tp!==null&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Se(this.Np)}qp(e){var t,A;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(Co.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 E0(this.Wp,this.Qd),this.Pp.bt()):((A=this.Pp)===null||A===void 0||A.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const e=this.Np.R_();this.Cp.Gi(Se(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Se(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const t=e.localX,A=e.localY;this.Gp(t,A,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const A=e.localX,r=e.localY;this.Gp(A,r,e);const n=this.wr(A,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const t={x:e.localX,y:e.localY};this.rm(t,t,e)}}Pv(e){this.Np!==null&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(e,t){if(!this.Qd.W().handleScale.pinch)return;const A=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,A)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,A=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Se(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,u,g){var B,v;let T,y;for(const E of c){const k=(v=(B=E.va)===null||B===void 0?void 0:B.call(E,u,g))!==null&&v!==void 0?v:[];for(const R of k)S=R.zOrder,(!(F=T?.zOrder)||S==="top"&&F!=="top"||S==="normal"&&F==="bottom")&&(T=R,y=E)}var S,F;return T&&y?{zv:T,Hc:y}: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=M0(c.Pn(r),n,s);if(u!==null)return{Hc:c,Bv:u.Bv,Iv:u.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Bn(l)}return l?.zv?Bn(l):null})(A,e,t)}_m(e,t){Se(t==="left"?this.Cp:this.Tp).cp(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=Se(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const A=t.Dt();A!==null&&e.P_(A),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,H0),this.vm(A),this.pm(A),this.fm(A,yn),this.fm(A,I0)))}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):Fl(e,0,0,A,r,s,o)}vm(e){const t=Se(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,yn,mo,t),this.Mm(e,yn,gn,t)}bm(e){this.Mm(e,yn,gn,this.$i().Zc())}fm(e,t){const A=Se(this.Np).Uo();for(const r of A)this.Mm(e,t,mo,r);for(const r of A)this.Mm(e,t,gn,r)}Mm(e,t,A,r){const n=Se(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;go(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 Tc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new Tc(this,e.W(),r,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,Se(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,A){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,A);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),A=this.fp();if(t.z_(A,A.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Se(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const t=this.$i(),A=t.St();if(A.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),l=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:l,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new S0(.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 bc{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 vo(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 _0=vo("normal"),P0=vo("top"),N0=vo("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 Lt,this.Fv=new hr(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=e,this.q_=t,this.cn=e.W().layout,this.Xd=document.createElement("tr"),this.Bm=document.createElement("td"),this.Bm.style.padding="0",this.Am=document.createElement("td"),this.Am.style.padding="0",this.Kv=document.createElement("td"),this.Kv.style.height="25px",this.Kv.style.padding="0",this.Im=document.createElement("div"),this.Im.style.width="100%",this.Im.style.height="100%",this.Im.style.position="relative",this.Im.style.overflow="hidden",this.Kv.appendChild(this.Im),this.Gv=Ci(this.Im,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 wo(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,N0)})),this.wp(A),this.$m(A,_0)),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,P0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)go(t,(n=>mo(n,e,!1,void 0)),r,void 0);for(const r of A)go(t,(n=>gn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const u=Math.max(1,Math.floor(l)),g=Math.floor(.5*l);o.beginPath();const B=Math.round(n.T*c);for(let v=A.length;v--;){const T=Math.round(A[v].coord*l);o.rect(T-g,0,u,B)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const l=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}}))}Ym(e,t,A){const r=this.Fv.xi(e,A),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const A=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return Pi(this.j(),this.cn.fontFamily)}Zm(){return Pi(this.j(),this.cn.fontFamily,"bold")}jm(){this.k===null&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new hr,Hm:0});const e=this.k,t=this._p();if(e.R!==t){const A=this.j();e.P=A,e.R=t,e.L=3*A/12,e.B=3*A/12,e.ji=9*A/12,e.N=0,e.Hm=4*A/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),t=e.W();t.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),t.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const A={ud:this.Qd.$t().ud()},r=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new bc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new bc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const k0=!!ki&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!ki&&(!((To=navigator?.userAgentData)===null||To===void 0)&&To.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var To;class K0{constructor(e,t,A){var r;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new Lt,this.Op=new Lt,this.Rc=new Lt,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=A,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(r=this.Xd).style.userSelect="none",r.style.webkitUserSelect="none",r.style.msUserSelect="none",r.style.MozUserSelect="none",r.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),bo(this.cn)&&this.hb(!0),this.$i=new b0(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=[],Se(this.ab).S(),this.Xd.parentElement!==null&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(e,t,A=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return 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";Se(this.Xd).style.height=n,Se(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Vt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Vt.es());for(let t=0;t<this.Xm.length;t++)this.Xm[t].vp(e.Hn(t).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const t=bo(this.cn);this.$i.$h(e);const A=bo(this.cn);A!==t&&this.hb(A),this.cb(),this.bb(e)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){this.Qm!==null&&(this.mb(this.Qm,performance.now()),this.Qm=null);const e=this.gb(null),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const A=Se(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Se(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return jt(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let u=0;u<this.Xm.length;u++){const g=this.Xm[u],B=Se(o==="left"?g.wm():g.gm()),v=B.xp();e!==null&&B.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Se(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,A),A+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Se(r.gm()).xp().width);const s=(o,l,c)=>{Se(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Se(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,A),l=Se(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return Tt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const T of this.Xm)this.xb()&&(t=Math.max(t,Se(T.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Se(T.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=T.M_();t=uo(t),A=uo(A);const r=this.__,n=this.ho,s=Math.max(r-t-A,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const u=0+l,g=n<u?0:n-u,B=g/e;let v=0;for(let T=0;T<this.Xm.length;++T){const y=this.Xm[T];y.qp(this.$i.qc()[T]);let S=0,F=0;F=T===this.Xm.length-1?g-v:Math.round(y.M_()*B),S=Math.max(F,2),v+=S,y.cp(Tt({width:s,height:S})),this.xb()&&y._m(t,"left"),this.Sb()&&y._m(A,"right"),y.fp()&&this.$i.Kc(y.fp(),S)}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=jt(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=A;r<t;r++){const n=new Co(this,e[r]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var r;const n=new Map;e!==null&&this.$i.wt().forEach((u=>{const g=u.In().ll(e);g!==null&&n.set(u,g)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof io?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 bo(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function V0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function xc(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 Qc(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 z0(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 W0(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 R0(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 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),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function $0(i,e,t,A,r){const n=jt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:g,color:B}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:xc(u,["time","color"]),V:B}}function Cn(i){return i.Vt!==void 0}function Fc(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)?Fc({ot:e,ee:t,zb:r},A):Fc(i(e,t,A,r,n),A)}function Uc(i){return{Candlestick:Ti(G0),Bar:Ti(R0),Area:Ti(z0),Baseline:Ti(W0),Histogram:Ti(Qc),Line:Ti(Qc),Custom:Ti($0)}[i]}function Sc(i){return{ee:0,Hb:new Map,la:i}}function Ec(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 Lc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),jt(e)}class X0{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=Uc(e.Qh()),g=e.Ca(),B=e.Ta();s=t.map(((v,T)=>{const y=c(v.time),S=this.q_.key(y);let F=this.qb.get(S);F===void 0&&(F=Sc(y),this.qb.set(S,F),r=!0);const E=u(y,F.ee,v,l[T],g,B);return F.Hb.set(e,E),E}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:Lc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const g=Ec(l,u),B=Ec(c,u);if(g!==void 0&&B!==void 0)return{ta:g.Ub>=B.Ub&&g.$b>=B.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(y){y.zb===void 0&&(y.zb=y.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=Sc(r),this.qb.set(this.q_.key(r),s));const l=Uc(e.Qh()),c=e.Ca(),u=e.Ta(),g=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,g),this.nw(e,g);const B={ta:Cn(g)};if(!o)return this.tw(e,-1,B);const v={timeWeight:0,time:s.la,pointData:s,originalTime:Lc(s.Hb)},T=cr(this.Xb,this.q_.key(v.time),((y,S)=>this.q_.key(y.time)<S));this.Xb.splice(T,0,v);for(let y=T;y<this.Xb.length;++y)xo(this.Xb[y].pointData,y);return this.q_.fillWeightsForPoints(this.Xb,T),this.tw(e,T,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,xo(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)xo(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 xo(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function Qo(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function Mc(i){const e=Qo(i);return i.V!==void 0&&(e.color=i.V),e}function J0(i){const e=Qo(i);return i.lt!==void 0&&(e.lineColor=i.lt),i.Ps!==void 0&&(e.topColor=i.Ps),i.Rs!==void 0&&(e.bottomColor=i.Rs),e}function Z0(i){const e=Qo(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 Hc(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 Y0(i){const e=Hc(i);return i.V!==void 0&&(e.color=i.V),e}function q0(i){const e=Hc(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 Fo(i){return{Area:J0,Line:Mc,Baseline:Z0,Histogram:Mc,Bar:Y0,Candlestick:q0,Custom:j0}[i]}function j0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const em={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},tm={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},Am={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Rs,attributionLogo:!0},Uo={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},im={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},rm={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Rs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Ic(){return{width:0,height:0,autoSize:!1,layout:Am,crosshair:em,grid:tm,overlayPriceScales:Object.assign({},Uo),leftPriceScale:Object.assign(Object.assign({},Uo),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Uo),{visible:!0}),timeScale:im,watermark:rm,localization:{locale:ki?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class nm{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return on(this.ow)?this.aw.Mb(this.ow):0}Li(){return Se(this.aw.$t().Uc(this.ow)).Dt}}function Dc(i,e,t){const A=xc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const sm={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class om{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class am{constructor(e,t,A,r,n){this.uw=new Lt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=r}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().Rt(e,t.Vt)}coordinateToPrice(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().pn(e,t.Vt)}barsInLogicalRange(e){if(e===null)return null;const t=new Oi(new gr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const r=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=Se(A.el()),o=Se(A.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.zb,l.to=n.zb),l}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:Fo(this.seriesType())(A)}data(){const e=Fo(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=>Dc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Dc(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(sm),e),A=this.Es.ea(t);return new om(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 lm{constructor(e,t,A){this.ww=new Lt,this.mu=new Lt,this.Om=new Lt,this.$i=e,this.yl=e.St(),this.ab=t,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=A}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(e,t){t?this.yl.Ju(e,1e3):this.$i.Jn(e)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const e=this.yl.Vu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const t={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},A=this.yl.Iu(t);this.$i.pd(A)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ii(e.from<=e.to,"The from index cannot be after the to index."),this.$i.pd(e)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(e){const t=this.$i.St();return t.Ni()?null:t.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const t=this.q_.convertHorzItemToInternal(e),A=this.yl.Va(t,!1);return A===null?null:this.yl.It(A)}coordinateToTime(e){const t=this.$i.St(),A=t.Nu(e),r=t.Ui(A);return r===null?null:r.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},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 cm(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 _c(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 hm{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Lt,this.Cw=new Lt,this.Tw=new Lt,this.Pw=new X0(t);const r=A===void 0?ZA(Ic()):xA(ZA(Ic()),_c(A));this.q_=t,this.aw=new K0(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 lm(n,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(e,t,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=_i(e),r=Object.assign(Object.assign({},gl),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",$d,e)}addBaselineSeries(e){return this.Vw("Baseline",Xd,e)}addBarSeries(e){return this.Vw("Bar",Rd,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",Wd,e)}addHistogramSeries(e){return this.Vw("Histogram",Jd,e)}addLineSeries(e){return this.Vw("Line",Gd,e)}removeSeries(e){const t=jt(this.Sw.get(e)),A=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(A),this.Sw.delete(e),this.kw.delete(t)}pw(e,t){this.Ow(this.Pw.Kb(e,t))}bw(e,t){this.Ow(this.Pw.iw(e,t))}subscribeClick(e){this.yw.l(e)}unsubscribeClick(e){this.yw.v(e)}subscribeCrosshairMove(e){this.Tw.l(e)}unsubscribeCrosshairMove(e){this.Tw.v(e)}subscribeDblClick(e){this.Cw.l(e)}unsubscribeDblClick(e){this.Cw.v(e)}priceScale(e){return new nm(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(_c(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){cm(A.priceFormat);const n=xA(ZA(wl),ZA(t),A),s=this.aw.$t().dd(e,n,r),o=new am(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((A,r)=>r.J(A.$e,A.rw))),t.Wu()}Bw(e){return jt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=Fo(s)(r);if(s!=="Custom")ii(V0(o));else{const l=n.Ta();ii(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const A=e.Eb!==void 0&&this.kw.has(e.Eb)?this.Bw(e.Eb):void 0;return{time:e.zb,logical:e.ee,point:e.Lb,hoveredSeries:A,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function um(i,e,t){let A;if(ar(i)){const n=document.getElementById(i);ii(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new hm(A,e,t);return e.setOptions(r.options()),r}function pm(i,e){return um(i,new Bc,Bc.Id(e))}Object.assign(Object.assign({},wl),gl);function Pc(i,e){return function(){return i.apply(e,arguments)}}const{toString:dm}=Object.prototype,{getPrototypeOf:So}=Object,{iterator:vn,toStringTag:Nc}=Symbol,Tn=(i=>e=>{const t=dm.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)&&nA(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Oc=FA("ArrayBuffer");function fm(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Oc(i.buffer),e}const mm=bn("string"),nA=bn("function"),kc=bn("number"),Br=i=>i!==null&&typeof i=="object",gm=i=>i===!0||i===!1,xn=i=>{if(Tn(i)!=="object")return!1;const e=So(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Nc in i)&&!(vn in i)},wm=i=>{if(!Br(i)||wr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},Bm=FA("Date"),ym=FA("File"),Cm=FA("Blob"),vm=FA("FileList"),Tm=i=>Br(i)&&nA(i.pipe),bm=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||nA(i.append)&&((e=Tn(i))==="formdata"||e==="object"&&nA(i.toString)&&i.toString()==="[object FormData]"))},xm=FA("URLSearchParams"),[Qm,Fm,Um,Sm]=["ReadableStream","Request","Response","Headers"].map(FA),Em=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 Kc(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,Vc=i=>!zi(i)&&i!==bi;function Eo(){const{caseless:i,skipUndefined:e}=Vc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&Kc(t,n)||n;xn(t[s])&&xn(r)?t[s]=Eo(t[s],r):xn(r)?t[s]=Eo({},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 Lm=(i,e,t,{allOwnKeys:A}={})=>(yr(e,(r,n)=>{t&&nA(r)?Object.defineProperty(i,n,{value:Pc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),Mm=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Hm=(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)},Im=(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&&So(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},Dm=(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},_m=i=>{if(!i)return null;if(Vi(i))return i;let e=i.length;if(!kc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},Pm=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&So(Uint8Array)),Nm=(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])}},Om=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},km=FA("HTMLFormElement"),Km=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),zc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Vm=FA("RegExp"),Wc=(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)},zm=i=>{Wc(i,(e,t)=>{if(nA(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(nA(A)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Wm=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Vi(i)?A(i):A(String(i).split(e)),t},Rm=()=>{},Gm=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function $m(i){return!!(i&&nA(i.append)&&i[Nc]==="FormData"&&i[vn])}const Xm=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)},Jm=FA("AsyncFunction"),Zm=i=>i&&(Br(i)||nA(i))&&nA(i.then)&&nA(i.catch),Rc=((i,e)=>i?setImmediate:e?((t,A)=>(bi.addEventListener("message",({source:r,data:n})=>{r===bi&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),bi.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",nA(bi.postMessage)),Ym=typeof queueMicrotask<"u"?queueMicrotask.bind(bi):typeof process<"u"&&process.nextTick||Rc,fe={isArray:Vi,isArrayBuffer:Oc,isBuffer:wr,isFormData:bm,isArrayBufferView:fm,isString:mm,isNumber:kc,isBoolean:gm,isObject:Br,isPlainObject:xn,isEmptyObject:wm,isReadableStream:Qm,isRequest:Fm,isResponse:Um,isHeaders:Sm,isUndefined:zi,isDate:Bm,isFile:ym,isBlob:Cm,isRegExp:Vm,isFunction:nA,isStream:Tm,isURLSearchParams:xm,isTypedArray:Pm,isFileList:vm,forEach:yr,merge:Eo,extend:Lm,trim:Em,stripBOM:Mm,inherits:Hm,toFlatObject:Im,kindOf:Tn,kindOfTest:FA,endsWith:Dm,toArray:_m,forEachEntry:Nm,matchAll:Om,isHTMLForm:km,hasOwnProperty:zc,hasOwnProp:zc,reduceDescriptors:Wc,freezeMethods:zm,toObjectSet:Wm,toCamelCase:Km,noop:Rm,toFiniteNumber:Gm,findKey:Kc,global:bi,isContextDefined:Vc,isSpecCompliantForm:$m,toJSONObject:Xm,isAsyncFn:Jm,isThenable:Zm,setImmediate:Rc,asap:Ym,isIterable:i=>i!=null&&nA(i[vn])};let Ge=class Sd extends Error{static from(e,t,A,r,n,s){const o=new Sd(e.message,t||e.code,A,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),r&&(this.request=r),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.status}}};Ge.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ge.ERR_BAD_OPTION="ERR_BAD_OPTION",Ge.ECONNABORTED="ECONNABORTED",Ge.ETIMEDOUT="ETIMEDOUT",Ge.ERR_NETWORK="ERR_NETWORK",Ge.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ge.ERR_DEPRECATED="ERR_DEPRECATED",Ge.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ge.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ge.ERR_CANCELED="ERR_CANCELED",Ge.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ge.ERR_INVALID_URL="ERR_INVALID_URL";const qm=null;function Lo(i){return fe.isPlainObject(i)||fe.isArray(i)}function Gc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function $c(i,e,t){return i?i.concat(e).map(function(r,n){return r=Gc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function jm(i){return fe.isArray(i)&&!i.some(Lo)}const eg=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function Qn(i,e,t){if(!fe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=fe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,S){return!fe.isUndefined(S[y])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(r))throw new TypeError("visitor must be a function");function c(T){if(T===null)return"";if(fe.isDate(T))return T.toISOString();if(fe.isBoolean(T))return T.toString();if(!l&&fe.isBlob(T))throw new Ge("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(T)||fe.isTypedArray(T)?l&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function u(T,y,S){let F=T;if(T&&!S&&typeof T=="object"){if(fe.endsWith(y,"{}"))y=A?y:y.slice(0,-2),T=JSON.stringify(T);else if(fe.isArray(T)&&jm(T)||(fe.isFileList(T)||fe.endsWith(y,"[]"))&&(F=fe.toArray(T)))return y=Gc(y),F.forEach(function(k,R){!(fe.isUndefined(k)||k===null)&&e.append(s===!0?$c([y],R,n):s===null?y:y+"[]",c(k))}),!1}return Lo(T)?!0:(e.append($c(S,y,n),c(T)),!1)}const g=[],B=Object.assign(eg,{defaultVisitor:u,convertValue:c,isVisitable:Lo});function v(T,y){if(!fe.isUndefined(T)){if(g.indexOf(T)!==-1)throw Error("Circular reference detected in "+y.join("."));g.push(T),fe.forEach(T,function(F,E){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(E)?E.trim():E,y,B))===!0&&v(F,y?y.concat(E):[E])}),g.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Xc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function Mo(i,e){this._pairs=[],i&&Qn(i,this,e)}const Jc=Mo.prototype;Jc.append=function(e,t){this._pairs.push([e,t])},Jc.toString=function(e){const t=e?function(A){return e.call(this,A,Xc)}:Xc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function tg(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Zc(i,e,t){if(!e)return i;const A=t&&t.encode||tg,r=fe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=fe.isURLSearchParams(e)?e.toString():new Mo(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Yc{constructor(){this.handlers=[]}use(e,t,A){return this.handlers.push({fulfilled:e,rejected:t,synchronous:A?A.synchronous:!1,runWhen:A?A.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){fe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const Ho={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ag={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Mo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Io=typeof window<"u"&&typeof document<"u",Do=typeof navigator=="object"&&navigator||void 0,ig=Io&&(!Do||["ReactNative","NativeScript","NS"].indexOf(Do.product)<0),rg=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ng=Io&&window.location.href||"http://localhost",Jt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Io,hasStandardBrowserEnv:ig,hasStandardBrowserWebWorkerEnv:rg,navigator:Do,origin:ng},Symbol.toStringTag,{value:"Module"})),...Ag};function sg(i,e){return Qn(i,new Jt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Jt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function og(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function ag(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 qc(i){function e(t,A,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&fe.isArray(r)?r.length:s,l?(fe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!fe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&fe.isArray(r[s])&&(r[s]=ag(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(og(A),r,t,0)}),t}return null}function lg(i,e,t){if(fe.isString(i))try{return(e||JSON.parse)(i),fe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const Cr={transitional:Ho,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=fe.isObject(e);if(n&&fe.isHTMLForm(e)&&(e=new FormData(e)),fe.isFormData(e))return r?JSON.stringify(qc(e)):e;if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)||fe.isReadableStream(e))return e;if(fe.isArrayBufferView(e))return e.buffer;if(fe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(A.indexOf("application/x-www-form-urlencoded")>-1)return sg(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Qn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),lg(e)):e}],transformResponse:[function(e){const t=this.transitional||Cr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(fe.isResponse(e)||fe.isReadableStream(e))return e;if(e&&fe.isString(e)&&(A&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Ge.from(o,Ge.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Jt.classes.FormData,Blob:Jt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],i=>{Cr.headers[i]={}});const cg=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),hg=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]&&cg[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},jc=Symbol("internals");function vr(i){return i&&String(i).trim().toLowerCase()}function Fn(i){return i===!1||i==null?i:fe.isArray(i)?i.map(Fn):String(i)}function ug(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 pg=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function _o(i,e,t,A,r){if(fe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!fe.isString(e)){if(fe.isString(A))return e.indexOf(A)!==-1;if(fe.isRegExp(A))return A.test(e)}}function dg(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function fg(i,e){const t=fe.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(i,A+t,{value:function(r,n,s){return this[A].call(this,e,r,n,s)},configurable:!0})})}let sA=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=vr(l);if(!u)throw new Error("header name must be a non-empty string");const g=fe.findKey(r,u);(!g||r[g]===void 0||c===!0||c===void 0&&r[g]!==!1)&&(r[g||l]=Fn(o))}const s=(o,l)=>fe.forEach(o,(c,u)=>n(c,u,l));if(fe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(fe.isString(e)&&(e=e.trim())&&!pg(e))s(hg(e),t);else if(fe.isObject(e)&&fe.isIterable(e)){let o={},l,c;for(const u of e){if(!fe.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[c=u[0]]=(l=o[c])?fe.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=vr(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return ug(r);if(fe.isFunction(t))return t.call(this,r,A);if(fe.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vr(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||_o(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=vr(s),s){const o=fe.findKey(A,s);o&&(!t||_o(A,A[o],o,t))&&(delete A[o],r=!0)}}return fe.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let A=t.length,r=!1;for(;A--;){const n=t[A];(!e||_o(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,A={};return fe.forEach(this,(r,n)=>{const s=fe.findKey(A,n);if(s){t[s]=Fn(r),delete t[n];return}const o=e?dg(n):String(n).trim();o!==n&&delete t[n],t[o]=Fn(r),A[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return fe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&fe.isArray(A)?A.join(", "):A)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[jc]=this[jc]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=vr(s);A[o]||(fg(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};sA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(sA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(sA);function Po(i,e){const t=this||Cr,A=e||t,r=sA.from(A.headers);let n=A.data;return fe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function eh(i){return!!(i&&i.__CANCEL__)}let Tr=class extends Ge{constructor(e,t,A){super(e??"canceled",Ge.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function th(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Ge("Request failed with status code "+t.status,[Ge.ERR_BAD_REQUEST,Ge.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function mg(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function gg(i,e){i=i||10;const t=new Array(i),A=new Array(i);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let g=n,B=0;for(;g!==r;)B+=t[g++],g=g%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(B*1e3/v):void 0}}function wg(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),g=u-t;g>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-g)))},()=>r&&s(r)]}const Un=(i,e,t=3)=>{let A=0;const r=gg(50,250);return wg(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const g={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(g)},t)},Ah=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},ih=i=>(...e)=>fe.asap(()=>i(...e)),Bg=Jt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Jt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Jt.origin),Jt.navigator&&/(msie|trident)/i.test(Jt.navigator.userAgent)):()=>!0,yg=Jt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];fe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),fe.isString(A)&&o.push(`path=${A}`),fe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),fe.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Cg(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function vg(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function rh(i,e,t){let A=!Cg(e);return i&&(A||t==!1)?vg(i,e):e}const nh=i=>i instanceof sA?{...i}:i;function xi(i,e){e=e||{};const t={};function A(c,u,g,B){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:B},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,g,B){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,g,B)}else return A(c,u,g,B)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,g){if(g in e)return A(c,u);if(g in i)return A(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,u,g)=>r(nh(c),nh(u),g,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const g=fe.hasOwnProp(l,u)?l[u]:r,B=g(i[u],e[u],u);fe.isUndefined(B)&&g!==o||(t[u]=B)}),t}const sh=i=>{const e=xi({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=sA.from(s),e.url=Zc(rh(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),fe.isFormData(t)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,g])=>{c.includes(u.toLowerCase())&&s.set(u,g)})}}if(Jt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&Bg(e.url))){const l=r&&n&&yg.read(n);l&&s.set(r,l)}return e},Tg=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=sh(i);let n=r.data;const s=sA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,g,B,v,T;function y(){v&&v(),T&&T(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let S=new XMLHttpRequest;S.open(r.method.toUpperCase(),r.url,!0),S.timeout=r.timeout;function F(){if(!S)return;const k=sA.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),M={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:k,config:i,request:S};th(function(ne){t(ne),y()},function(ne){A(ne),y()},M),S=null}"onloadend"in S?S.onloadend=F:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(F)},S.onabort=function(){S&&(A(new Ge("Request aborted",Ge.ECONNABORTED,i,S)),S=null)},S.onerror=function(R){const M=R&&R.message?R.message:"Network Error",z=new Ge(M,Ge.ERR_NETWORK,i,S);z.event=R||null,A(z),S=null},S.ontimeout=function(){let R=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||Ho;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Ge(R,M.clarifyTimeoutError?Ge.ETIMEDOUT:Ge.ECONNABORTED,i,S)),S=null},n===void 0&&s.setContentType(null),"setRequestHeader"in S&&fe.forEach(s.toJSON(),function(R,M){S.setRequestHeader(M,R)}),fe.isUndefined(r.withCredentials)||(S.withCredentials=!!r.withCredentials),o&&o!=="json"&&(S.responseType=r.responseType),c&&([B,T]=Un(c,!0),S.addEventListener("progress",B)),l&&S.upload&&([g,v]=Un(l),S.upload.addEventListener("progress",g),S.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=k=>{S&&(A(!k||k.type?new Tr(null,i,S):k),S.abort(),S=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const E=mg(r.url);if(E&&Jt.protocols.indexOf(E)===-1){A(new Ge("Unsupported protocol "+E+":",Ge.ERR_BAD_REQUEST,i));return}S.send(n||null)})},bg=(i,e)=>{const{length:t}=i=i?i.filter(Boolean):[];if(e||t){let A=new AbortController,r;const n=function(c){if(!r){r=!0,o();const u=c instanceof Error?c:this.reason;A.abort(u instanceof Ge?u:new Tr(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Ge(`timeout of ${e}ms exceeded`,Ge.ETIMEDOUT))},e);const o=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),i=null)};i.forEach(c=>c.addEventListener("abort",n));const{signal:l}=A;return l.unsubscribe=()=>fe.asap(o),l}},xg=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},Qg=async function*(i,e){for await(const t of Fg(i))yield*xg(t,e)},Fg=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()}},oh=(i,e,t,A)=>{const r=Qg(i,e);let n=0,s,o=l=>{s||(s=!0,A&&A(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){o(),l.close();return}let g=u.byteLength;if(t){let B=n+=g;t(B)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},ah=64*1024,{isFunction:Sn}=fe,Ug=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:lh,TextEncoder:ch}=fe.global,hh=(i,...e)=>{try{return!!i(...e)}catch{return!1}},Sg=i=>{i=fe.merge.call({skipUndefined:!0},Ug,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(lh),l=r&&(typeof ch=="function"?(T=>y=>T.encode(y))(new ch):async T=>new Uint8Array(await new t(T).arrayBuffer())),c=n&&o&&hh(()=>{let T=!1;const y=new t(Jt.origin,{body:new lh,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!y}),u=s&&o&&hh(()=>fe.isReadableStream(new A("").body)),g={stream:u&&(T=>T.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!g[T]&&(g[T]=(y,S)=>{let F=y&&y[T];if(F)return F.call(y);throw new Ge(`Response type '${T}' is not supported`,Ge.ERR_NOT_SUPPORT,S)})});const B=async T=>{if(T==null)return 0;if(fe.isBlob(T))return T.size;if(fe.isSpecCompliantForm(T))return(await new t(Jt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(T)||fe.isArrayBuffer(T))return T.byteLength;if(fe.isURLSearchParams(T)&&(T=T+""),fe.isString(T))return(await l(T)).byteLength},v=async(T,y)=>{const S=fe.toFiniteNumber(T.getContentLength());return S??B(y)};return async T=>{let{url:y,method:S,data:F,signal:E,cancelToken:k,timeout:R,onDownloadProgress:M,onUploadProgress:z,responseType:ne,headers:J,withCredentials:V="same-origin",fetchOptions:Ae}=sh(T),re=e||fetch;ne=ne?(ne+"").toLowerCase():"text";let he=bg([E,k&&k.toAbortSignal()],R),Y=null;const te=he&&he.unsubscribe&&(()=>{he.unsubscribe()});let oe;try{if(z&&c&&S!=="get"&&S!=="head"&&(oe=await v(J,F))!==0){let Fe=new t(y,{method:"POST",body:F,duplex:"half"}),Ue;if(fe.isFormData(F)&&(Ue=Fe.headers.get("content-type"))&&J.setContentType(Ue),Fe.body){const[Be,Te]=Ah(oe,Un(ih(z)));F=oh(Fe.body,ah,Be,Te)}}fe.isString(V)||(V=V?"include":"omit");const ce=n&&"credentials"in t.prototype,se={...Ae,signal:he,method:S.toUpperCase(),headers:J.normalize().toJSON(),body:F,duplex:"half",credentials:ce?V:void 0};Y=n&&new t(y,se);let ae=await(n?re(Y,Ae):re(y,se));const de=u&&(ne==="stream"||ne==="response");if(u&&(M||de&&te)){const Fe={};["status","statusText","headers"].forEach(Ce=>{Fe[Ce]=ae[Ce]});const Ue=fe.toFiniteNumber(ae.headers.get("content-length")),[Be,Te]=M&&Ah(Ue,Un(ih(M),!0))||[];ae=new A(oh(ae.body,ah,Be,()=>{Te&&Te(),te&&te()}),Fe)}ne=ne||"text";let we=await g[fe.findKey(g,ne)||"text"](ae,T);return!de&&te&&te(),await new Promise((Fe,Ue)=>{th(Fe,Ue,{data:we,headers:sA.from(ae.headers),status:ae.status,statusText:ae.statusText,config:T,request:Y})})}catch(ce){throw te&&te(),ce&&ce.name==="TypeError"&&/Load failed|fetch/i.test(ce.message)?Object.assign(new Ge("Network Error",Ge.ERR_NETWORK,T,Y,ce&&ce.response),{cause:ce.cause||ce}):Ge.from(ce,ce&&ce.code,T,Y,ce&&ce.response)}}},Eg=new Map,uh=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=Eg;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:Sg(e)),u=c;return c};uh();const No={http:qm,xhr:Tg,fetch:{get:uh}};fe.forEach(No,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const ph=i=>`- ${i}`,Lg=i=>fe.isFunction(i)||i===null||i===!1;function Mg(i,e){i=fe.isArray(i)?i:[i];const{length:t}=i;let A,r;const n={};for(let s=0;s<t;s++){A=i[s];let o;if(r=A,!Lg(A)&&(r=No[(o=String(A)).toLowerCase()],r===void 0))throw new Ge(`Unknown adapter '${o}'`);if(r&&(fe.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
4
- `+s.map(ph).join(`
5
- `):" "+ph(s[0]):"as no adapter specified";throw new Ge("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const dh={getAdapter:Mg,adapters:No};function Oo(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Tr(null,i)}function fh(i){return Oo(i),i.headers=sA.from(i.headers),i.data=Po.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),dh.getAdapter(i.adapter||Cr.adapter,i)(i).then(function(A){return Oo(i),A.data=Po.call(i,i.transformResponse,A),A.headers=sA.from(A.headers),A},function(A){return eh(A)||(Oo(i),A&&A.response&&(A.response.data=Po.call(i,i.transformResponse,A.response),A.response.headers=sA.from(A.response.headers))),Promise.reject(A)})}const mh="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 gh={};En.transitional=function(e,t,A){function r(n,s){return"[Axios v"+mh+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new Ge(r(s," has been removed"+(t?" in "+t:"")),Ge.ERR_DEPRECATED);return t&&!gh[s]&&(gh[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 Hg(i,e,t){if(typeof i!="object")throw new Ge("options must be an object",Ge.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 Ge("option "+n+" must be "+l,Ge.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Ge("Unknown option "+n,Ge.ERR_BAD_OPTION)}}const Ln={assertOptions:Hg,validators:En},wA=Ln.validators;let Qi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Yc,response:new Yc}}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&&(fe.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&&fe.merge(n.common,n[t.method]);n&&fe.forEach(["delete","get","head","post","put","patch","common"],T=>{delete n[T]}),t.headers=sA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(t)===!1)return;l=l&&y.synchronous;const S=t.transitional||Ho;S&&S.legacyInterceptorReqResOrdering?o.unshift(y.fulfilled,y.rejected):o.push(y.fulfilled,y.rejected)});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let u,g=0,B;if(!l){const T=[fh.bind(this),void 0];for(T.unshift(...o),T.push(...c),B=T.length,u=Promise.resolve(t);g<B;)u=u.then(T[g++],T[g++]);return u}B=o.length;let v=t;for(;g<B;){const T=o[g++],y=o[g++];try{v=T(v)}catch(S){y.call(this,S);break}}try{u=fh.call(this,v)}catch(T){return Promise.reject(T)}for(g=0,B=c.length;g<B;)u=u.then(c[g++],c[g++]);return u}getUri(e){e=xi(this.defaults,e);const t=rh(e.baseURL,e.url,e.allowAbsoluteUrls);return Zc(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){Qi.prototype[e]=function(t,A){return this.request(xi(A||{},{method:e,url:t,data:(A||{}).data}))}}),fe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(xi(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Qi.prototype[e]=t(),Qi.prototype[e+"Form"]=t(!0)});let Ig=class Ed{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 Ed(function(r){e=r}),cancel:e}}};function Dg(i){return function(t){return i.apply(null,t)}}function _g(i){return fe.isObject(i)&&i.isAxiosError===!0}const ko={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ko).forEach(([i,e])=>{ko[e]=i});function wh(i){const e=new Qi(i),t=Pc(Qi.prototype.request,e);return fe.extend(t,Qi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return wh(xi(i,r))},t}const gt=wh(Cr);gt.Axios=Qi,gt.CanceledError=Tr,gt.CancelToken=Ig,gt.isCancel=eh,gt.VERSION=mh,gt.toFormData=Qn,gt.AxiosError=Ge,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=Dg,gt.isAxiosError=_g,gt.mergeConfig=xi,gt.AxiosHeaders=sA,gt.formToJSON=i=>qc(fe.isHTMLForm(i)?new FormData(i):i),gt.getAdapter=dh.getAdapter,gt.HttpStatusCode=ko,gt.default=gt;const{Axios:ub,AxiosError:pb,CanceledError:db,isCancel:fb,CancelToken:mb,VERSION:gb,all:wb,Cancel:Bb,isAxiosError:yb,spread:Cb,toFormData:vb,AxiosHeaders:Tb,HttpStatusCode:bb,formToJSON:xb,getAdapter:Qb,mergeConfig:Fb}=gt,PA=Object.create(null);PA.open="0",PA.close="1",PA.ping="2",PA.pong="3",PA.message="4",PA.upgrade="5",PA.noop="6";const Mn=Object.create(null);Object.keys(PA).forEach(i=>{Mn[PA[i]]=i});const Ko={type:"error",data:"parser error"},Bh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",yh=typeof ArrayBuffer=="function",Ch=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Vo=({type:i,data:e},t,A)=>Bh&&e instanceof Blob?t?A(e):vh(e,A):yh&&(e instanceof ArrayBuffer||Ch(e))?t?A(e):vh(new Blob([e]),A):A(PA[i]+(e||"")),vh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function Th(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let zo;function Pg(i,e){if(Bh&&i.data instanceof Blob)return i.data.arrayBuffer().then(Th).then(e);if(yh&&(i.data instanceof ArrayBuffer||Ch(i.data)))return e(Th(i.data));Vo(i,!1,t=>{zo||(zo=new TextEncoder),e(zo.encode(t))})}const bh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",br=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<bh.length;i++)br[bh.charCodeAt(i)]=i;const Ng=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},Og=typeof ArrayBuffer=="function",Wo=(i,e)=>{if(typeof i!="string")return{type:"message",data:xh(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:kg(i.substring(1),e)}:Mn[t]?i.length>1?{type:Mn[t],data:i.substring(1)}:{type:Mn[t]}:Ko},kg=(i,e)=>{if(Og){const t=Ng(i);return xh(t,e)}else return{base64:!0,data:i}},xh=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,Qh="",Kg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{Vo(n,!1,o=>{A[s]=o,++r===t&&e(A.join(Qh))})})},Vg=(i,e)=>{const t=i.split(Qh),A=[];for(let r=0;r<t.length;r++){const n=Wo(t[r],e);if(A.push(n),n.type==="error")break}return A};function zg(){return new TransformStream({transform(i,e){Pg(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 Ro;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 Wg(i,e){Ro||(Ro=new TextDecoder);const t=[];let A=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(Hn(t)<1)break;const l=In(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?A=3:r===126?A=1:A=2}else if(A===1){if(Hn(t)<2)break;const l=In(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(Hn(t)<8)break;const l=In(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(Ko);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(Hn(t)<r)break;const l=In(t,r);o.enqueue(Wo(n?l:Ro.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(Ko);break}}}})}const Fh=4;function _t(i){if(i)return Rg(i)}function Rg(i){for(var e in _t.prototype)i[e]=_t.prototype[e];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},_t.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var A,r=0;r<t.length;r++)if(A=t[r],A===e||A.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+i],this},_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){t=t.slice(0);for(var A=0,r=t.length;A<r;++A)t[A].apply(this,e)}return this},_t.prototype.emitReserved=_t.prototype.emit,_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),BA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Gg="arraybuffer";function Ub(){}function Uh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const $g=BA.setTimeout,Xg=BA.clearTimeout;function _n(i,e){e.useNativeTimers?(i.setTimeoutFn=$g.bind(BA),i.clearTimeoutFn=Xg.bind(BA)):(i.setTimeoutFn=BA.setTimeout.bind(BA),i.clearTimeoutFn=BA.clearTimeout.bind(BA))}const Jg=1.33;function Zg(i){return typeof i=="string"?Yg(i):Math.ceil((i.byteLength||i.size)*Jg)}function Yg(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 Sh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function qg(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function jg(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 e1 extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class Go extends _t{constructor(e){super(),this.writable=!1,_n(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,A){return super.emitReserved("error",new e1(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=Wo(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=qg(e);return t.length?"?"+t:""}}class t1 extends Go{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)};Vg(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,Kg(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]=Sh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Eh=!1;try{Eh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const A1=Eh;function i1(){}class r1 extends t1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let A=location.port;A||(A=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||A!==e.port}}doWrite(e,t){const A=this.request({method:"POST",data:e});A.on("success",t),A.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,A)=>{this.onError("xhr poll error",t,A)}),this.pollXhr=e}}class NA extends _t{constructor(e,t,A){super(),this.createRequest=e,_n(this,A),this._opts=A,this._method=A.method||"GET",this._uri=t,this._data=A.data!==void 0?A.data:null,this._create()}_create(){var e;const t=Uh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const A=this._xhr=this.createRequest(t);try{A.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){A.setDisableHeaderCheck&&A.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&A.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{A.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{A.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(A),"withCredentials"in A&&(A.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(A.timeout=this._opts.requestTimeout),A.onreadystatechange=()=>{var r;A.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(A.getResponseHeader("set-cookie"))),A.readyState===4&&(A.status===200||A.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof A.status=="number"?A.status:0)},0))},A.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=NA.requestsCount++,NA.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=i1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete NA.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(NA.requestsCount=0,NA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Lh);else if(typeof addEventListener=="function"){const i="onpagehide"in BA?"pagehide":"unload";addEventListener(i,Lh,!1)}}function Lh(){for(let i in NA.requests)NA.requests.hasOwnProperty(i)&&NA.requests[i].abort()}const n1=(function(){const i=Mh({xdomain:!1});return i&&i.responseType!==null})();class s1 extends r1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=n1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new NA(Mh,this.uri(),e)}}function Mh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||A1))return new XMLHttpRequest}catch{}if(!e)try{return new BA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Hh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class o1 extends Go{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=Hh?{}:Uh(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;Vo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Sh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const $o=BA.WebSocket||BA.MozWebSocket;class a1 extends o1{createSocket(e,t,A){return Hh?new $o(e,t,A):t?new $o(e,t):new $o(e)}doWrite(e,t){this.ws.send(t)}}class l1 extends Go{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=Wg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=zg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{A.read().then(({done:o,value:l})=>{o||(this.onPacket(l),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;this._writer.write(A).then(()=>{r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const c1={websocket:a1,webtransport:l1,polling:s1},h1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,u1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xo(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=h1.exec(i||""),n={},s=14;for(;s--;)n[u1[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=d1(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 d1(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Jo=typeof addEventListener=="function"&&typeof removeEventListener=="function",Pn=[];Jo&&addEventListener("offline",()=>{Pn.forEach(i=>i())},!1);class ni extends _t{constructor(e,t){if(super(),this.binaryType=Gg,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=Xo(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=Xo(t.host).host);_n(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(A=>{const r=A.prototype.name;this.transports.push(r),this._transportsByName[r]=A}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=jg(this.opts.query)),Jo&&(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=Fh,t.transport=e,this.id&&(t.sid=this.id);const A=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](A)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ni.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ni.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let A=0;A<this.writeBuffer.length;A++){const r=this.writeBuffer[A].data;if(r&&(t+=Zg(r)),A>0&&t>this._maxPayload)return this.writeBuffer.slice(0,A);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Dn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,A){return this._sendPacket("message",e,t,A),this}send(e,t,A){return this._sendPacket("message",e,t,A),this}_sendPacket(e,t,A,r){if(typeof t=="function"&&(r=t,t=void 0),typeof A=="function"&&(r=A,A=null),this.readyState==="closing"||this.readyState==="closed")return;A=A||{},A.compress=A.compress!==!1;const n={type:e,data:t,options:A};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},A=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?A():e()}):this.upgrading?A():e()),this}_onError(e){if(ni.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Jo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Pn.indexOf(this._offlineEventListener);A!==-1&&Pn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ni.protocol=Fh;class f1 extends ni{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),A=!1;ni.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",g=>{if(!A)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ni.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const B=new Error("probe error");B.transport=t.name,this.emitReserved("upgradeError",B)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=g=>{const B=new Error("probe error: "+g);B.transport=t.name,n(),this.emitReserved("upgradeError",B)};function o(){s("transport closed")}function l(){s("socket closed")}function c(g){t&&g.name!==t.name&&n()}const u=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{A||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let A=0;A<e.length;A++)~this.transports.indexOf(e[A])&&t.push(e[A]);return t}}let m1=class extends f1{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=>c1[r]).filter(r=>!!r)),super(e,A)}};function g1(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=Xo(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 w1=typeof ArrayBuffer=="function",B1=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Ih=Object.prototype.toString,y1=typeof Blob=="function"||typeof Blob<"u"&&Ih.call(Blob)==="[object BlobConstructor]",C1=typeof File=="function"||typeof File<"u"&&Ih.call(File)==="[object FileConstructor]";function Zo(i){return w1&&(i instanceof ArrayBuffer||B1(i))||y1&&i instanceof Blob||C1&&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(Zo(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 v1(i){const e=[],t=i.data,A=i;return A.data=Yo(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Yo(i,e){if(!i)return i;if(Zo(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]=Yo(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]=Yo(i[A],e));return t}return i}function T1(i,e){return i.data=qo(i.data,e),delete i.attachments,i}function qo(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]=qo(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=qo(i[t],e));return i}const b1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ct;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(ct||(ct={}));class x1{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=v1(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class jo extends _t{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const A=t.type===ct.BINARY_EVENT;A||t.type===ct.BINARY_ACK?(t.type=A?ct.EVENT:ct.ACK,this.reconstructor=new Q1(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Zo(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const A={type:Number(e.charAt(0))};if(ct[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===ct.BINARY_EVENT||A.type===ct.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");A.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););A.nsp=e.substring(n,t)}else A.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}A.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(jo.isPayloadValid(A.type,n))A.data=n;else throw new Error("invalid payload")}return A}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ct.CONNECT:return Dh(t);case ct.DISCONNECT:return t===void 0;case ct.CONNECT_ERROR:return typeof t=="string"||Dh(t);case ct.EVENT:case ct.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&b1.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 Q1{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=T1(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Dh(i){return Object.prototype.toString.call(i)==="[object Object]"}const F1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:jo,Encoder:x1,get PacketType(){return ct}},Symbol.toStringTag,{value:"Module"}));function UA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const U1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class _h 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(U1.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ct.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,g=t.pop();this._registerAckCallback(u,g),s.id=u}const o=(r=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const r=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,r)=>{const n=(s,o)=>s?r(s):A(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const A={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),A.pending=!1,this._drainQueue())),this._queue.push(A),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ct.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(A=>String(A.id)===e)){const A=this.acks[e];delete this.acks[e],A.withError&&A.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ct.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ct.EVENT:case ct.BINARY_EVENT:this.onevent(e);break;case ct.ACK:case ct.BINARY_ACK:this.onack(e);break;case ct.DISCONNECT:this.ondisconnect();break;case ct.CONNECT_ERROR:this.destroy();const A=new Error(e.data.message);A.data=e.data.data,this.emitReserved("connect_error",A);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const A of t)A.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let A=!1;return function(...r){A||(A=!0,t.packet({type:ct.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ct.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const A of t)A.apply(this,e.data)}}}function 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 ea extends _t{constructor(e,t){var A;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,_n(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((A=t.randomizationFactor)!==null&&A!==void 0?A:.5),this.backoff=new Wi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||F1;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){Dn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let A=this.nsps[e];return A?this._autoConnect&&!A.active&&A.connect():(A=new _h(this,e,t),this.nsps[e]=A),A}_destroy(e){const t=Object.keys(this.nsps);for(const A of t)if(this.nsps[A].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let A=0;A<t.length;A++)this.engine.write(t[A],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var A;this.cleanup(),(A=this.engine)===null||A===void 0||A.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const A=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&A.unref(),this.subs.push(()=>{this.clearTimeoutFn(A)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const xr={};function On(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=g1(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 ea(A,e):(xr[r]||(xr[r]=new ea(A,e)),l=xr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(On,{Manager:ea,Socket:_h,io:On,connect:On});function ta(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 uA=ta("http://localhost:8000");function Ph(i){const e=ta(i);e&&e!==uA&&(uA=e,Et&&(Et.disconnect(),Et.removeAllListeners(),Et=null))}let Et=null;function S1(){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:uA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=On(uA,{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:uA,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:uA,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:uA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:uA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function Aa(){const i=ta(Et?.io?.uri||null);return!Et||Et.io&&i&&uA&&i!==uA?(Et&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:uA,wasConnected:Et.connected,reason:"baseUrl changed"}),Et.disconnect(),Et.removeAllListeners(),Et=null),Et=S1()):Et.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Et.id,connected:Et.connected,baseUrl:uA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Et.id,baseUrl:uA}),Et}function E1(i,e){const t=Aa();return t.on(i,e),()=>t.off(i,e)}function L1(i,e){Et&&Et.off(i,e)}function M1(i,e){Aa().emit(i,e)}function H1(){return Et?Et.connected?"connected":"connecting":"disconnected"}const kn={getSocket:Aa,on:E1,off:L1,emit:M1,getStatus:H1,setBaseUrl:Ph},I1={},Nh=q.createContext(),zt=()=>{const i=q.useContext(Nh);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"&&I1?.VITE_BASE_URL)??"http://localhost:5002";kn.setBaseUrl(l);const u={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},g=t?.params||{},[B,v]=q.useState(r||"BTC/USD"),[T,y]=q.useState(n||"M1"),[S,F]=q.useState([]),[E,k]=q.useState(!0),[R,M]=q.useState([]),[z,ne]=q.useState(!1),[J,V]=q.useState(1e5),[Ae,re]=q.useState(null),[he,Y]=q.useState([]),[te,oe]=q.useState(!0),[ce,se]=q.useState(!1),[ae,de]=q.useState(!0),[we,Fe]=q.useState("candles"),[Ue,Be]=q.useState(!1),[Te,Ce]=q.useState("dark"),[xe,Le]=q.useState(null),[Re,Ke]=q.useState(!1),[be,_e]=q.useState(!1),[ye,pe]=q.useState(!1),[Pe,tt]=q.useState(!1),[rt,nt]=q.useState(!1),[ut,dA]=q.useState(!1),[Je,Oe]=q.useState(!1),[at,it]=q.useState(!1),[Ct,bt]=q.useState(!1),[GA,$A]=q.useState(!1),[Gt,fA]=q.useState([]),XA=q.useRef(null),Kt=q.useRef(new Map),Ft=q.useRef(null),mA=1e3,st=q.useCallback(async()=>{if(A)try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;ne(!0);const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Me}`}});let ve=[];Array.isArray(ze.data)?ve=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(ve=ze.data.data);const qe=ve.filter(Ne=>Ne.closePrice===null||Ne.closePrice===void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,comment:Ne.comment||"",status:"OPEN",swap:0,profit:Ne.profit||0,profitCurrency:"USD",time:new Date(Ne.openedAt||Ne.openAt||Date.now()).toLocaleTimeString(),openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt}));M(qe)}catch(Me){console.error("❌ Error fetching orders:",Me.response?.data||Me.message),M([])}finally{ne(!1)}},[l,A]),mt=q.useCallback((Me,ze)=>!ze||!Me.price||isNaN(ze)||isNaN(Me.price)?Me.profit||0:(Me?.type?.toUpperCase()==="BUY"?ze-Me.price:Me.price-ze)*Me.volume,[]),Ut=q.useCallback(async()=>{try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;const ze=await gt.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${Me}`}});if(ze.data&&ze.data.data){const ve=parseFloat(ze.data.data.balance);isNaN(ve)||V(ve)}}catch(Me){console.error("❌ Error fetching user balance:",Me.response?.data||Me.message)}},[l]),It=q.useCallback(async()=>{if(A)try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Me}`}});let ve=[];Array.isArray(ze.data)?ve=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(ve=ze.data.data);const qe=ve.filter(Ne=>Ne.closePrice!==null&&Ne.closePrice!==void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,closePrice:Ne.closePrice,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,profit:Ne.profit??Ne.profitLoss??0,profitCurrency:"USD",openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt,closeReason:Ne.closeReason||"",status:"CLOSED"}));fA(qe)}catch(Me){console.error("❌ Error fetching history orders:",Me.response?.data||Me.message),fA([])}},[l,A]),$e=q.useMemo(()=>{const Me=J,ze=R.reduce((ft,St)=>ft+St.volume*St.price*.01,0),ve=R.reduce((ft,St)=>{const LA=S.find(Ai=>Ai.symbol===St.symbol);if(LA){const Ai=St.type?.toUpperCase()==="BUY"?parseFloat(LA.bid||0):parseFloat(LA.ask||0);if(Ai&&Ai>0&&!isNaN(Ai))return ft+mt(St,Ai)}return ft+(St.profit||0)},0),qe=Me+ve,Ne=qe-ze,Ze=ze>0?qe/ze*100:0;return{balance:Me,equity:qe,margin:ze,freeMargin:Ne,level:Ze.toFixed(2)}},[R,S,J,mt]);q.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(st(),Ut(),It())},[st,Ut,It,A]),q.useEffect(()=>{(async()=>{try{k(!0);const ze=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,ve=await gt.get(ze);let qe=[];Array.isArray(ve.data)?qe=ve.data:ve.data&&ve.data.data&&Array.isArray(ve.data.data)?qe=ve.data.data:ve.data&&ve.data.prices&&Array.isArray(ve.data.prices)?qe=ve.data.prices:ve.data&&Array.isArray(ve.data)&&(qe=ve.data);const Ne=qe.map(Ze=>{const ft=Ze.symbol||Ze.name||"",St=Ze.category||null;return ft&&(Ze.bid!==void 0||Ze.price!==void 0)?{symbol:ft,bid:Ze.bid??Ze.price??0,ask:Ze.ask??Ze.price??0,change:Ze.change??0,category:St}:{...Ze,symbol:ft,category:St}});Ne.length>0?(F(Ne),Ne.find(ft=>ft.symbol===B)||v(Ne[0].symbol)):F([])}catch(ze){console.error("❌ Error fetching symbols:",ze.response?.data||ze.message),F([])}finally{k(!1)}})()},[l,u.symbols]);const He=q.useCallback(()=>{const Me=Kt.current;if(Me.size===0)return;const ze=new Map(Me);Me.clear(),F(ve=>ve.map(qe=>{const Ne=ze.get(qe.symbol);return Ne?{...qe,...Ne}:qe})),M(ve=>{let qe=!1;const Ne=ve.map(Ze=>{const ft=ze.get(Ze.symbol);if(!ft)return Ze;const St=Ze.type?.toUpperCase()==="BUY"?parseFloat(ft.bid||0):parseFloat(ft.ask||0);if(!St||isNaN(St)||St<=0)return Ze;const LA=mt(Ze,St);return LA===Ze.profit?Ze:(qe=!0,{...Ze,profit:LA})});return qe?Ne:ve})},[mt]);q.useEffect(()=>{XA.current||(XA.current=kn.getSocket());const Me=XA.current,ze=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Me.emit("joinUserRoom",{userId:Number(A)})},ve=()=>console.log("⚠️ TradingContext: Disconnected"),qe=Ze=>{Ze?.symbol&&(Kt.current.set(Ze.symbol,Ze),Ft.current||(Ft.current=setTimeout(()=>{Ft.current=null,He()},mA)))},Ne=async Ze=>{if(Ze){if(Ze.newBalance!==void 0){const ft=parseFloat(Ze.newBalance);isNaN(ft)||V(ft)}if(window.notify){const ft=Ze.profitLoss||Ze.profit||0,St=ft>=0?`+${ft.toFixed(2)}`:ft.toFixed(2),LA=Ze.symbol||"Trade",Ai=Ze.reason||"Closed";window.notify(`Trade Closed: ${Ai} | ${LA} | P/L: ${St} USD`,ft>=0?"success":"error")}Ze.tradeId&&M(ft=>ft.filter(St=>St.id!==Ze.tradeId)),await st(),await Ut()}};return Me.on("connect",ze),Me.on("disconnect",ve),Me.on("priceUpdate",qe),Me.on("tradeClosed",Ne),Me.connected&&A&&Number.isFinite(Number(A))&&Me.emit("joinUserRoom",{userId:Number(A)}),()=>{Me.off("connect",ze),Me.off("disconnect",ve),Me.off("priceUpdate",qe),Me.off("tradeClosed",Ne),Ft.current&&(clearTimeout(Ft.current),Ft.current=null),Kt.current.clear()}},[He,st,Ut]),q.useEffect(()=>{try{const Me=document.documentElement;if(!Me)return;Me.dataset.theme=Te}catch{}},[Te]);const At=q.useMemo(()=>S.find(Me=>Me.symbol===B)||{bid:"0.00000",ask:"0.00000",change:0},[S,B]),Xe=q.useMemo(()=>({selectedSymbol:B,setSelectedSymbol:v,selectedTimeframe:T,setSelectedTimeframe:y,symbols:S,setSymbols:F,symbolsLoading:E,orders:R,setOrders:M,ordersLoading:z,fetchOrders:st,fetchUserBalance:Ut,userBalance:J,setUserBalance:V,accountSummary:$e,currentSymbolData:At,activeTool:Ae,setActiveTool:re,chartObjects:he,setChartObjects:Y,showGrid:te,setShowGrid:oe,snapToGrid:ce,setSnapToGrid:se,drawingsVisible:ae,setDrawingsVisible:de,chartType:we,setChartType:Fe,chartLocked:Ue,setChartLocked:Be,theme:Te,setTheme:Ce,candleColors:xe,setCandleColors:Le,showTradeOrders:Re,setShowTradeOrders:Ke,showTradePosition:be,setShowTradePosition:_e,showTradeHistory:ye,setShowTradeHistory:pe,showSLTP:Pe,setShowSLTP:tt,showAskPrice:rt,setShowAskPrice:nt,showChartControls:ut,setShowChartControls:dA,showTradeNotification:Je,setShowTradeNotification:Oe,showCrosshair:at,setShowCrosshair:it,showOHLC:Ct,setShowOHLC:bt,baseUrl:l,endpoints:u,endpointParams:g,accountId:A,isShow:GA,setIsShow:$A,historyOrders:Gt,setHistoryOrders:fA,fetchHistoryOrders:It,indicators:s,indicatorSettings:o}),[B,T,S,E,R,z,st,Ut,J,$e,At,Ae,he,te,ce,ae,we,Ue,Te,xe,Re,be,ye,Pe,rt,ut,Je,at,Ct,l,u,g,GA,Gt,It,s,o]);return a.jsx(Nh.Provider,{value:Xe,children:i})};var Oh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},kh=q.createContext&&q.createContext(Oh),_1=["attr","size","title"];function P1(i,e){if(i==null)return{};var t=N1(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 N1(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 Kh(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?Kh(Object(t),!0).forEach(function(A){O1(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Kh(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=K1(i,"string");return typeof e=="symbol"?e:e+""}function K1(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 Vh(i){return i&&i.map((e,t)=>q.createElement(e.tag,Vn({key:t},e.attr),Vh(e.child)))}function eA(i){return e=>q.createElement(V1,Kn({attr:Vn({},i.attr)},e),Vh(i.child))}function V1(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=P1(i,_1),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),q.createElement("svg",Kn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Vn(Vn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&q.createElement("title",null,n),i.children)};return kh!==void 0?q.createElement(kh.Consumer,null,t=>e(t)):e(Oh)}function z1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(i)}function W1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(i)}function R1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(i)}function G1(i){return eA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(i)}function zh(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(i)}function $1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(i)}function X1(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(i)}function J1(i){return eA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(i)}function Z1(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(i)}function Y1(i){return eA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(i)}const q1={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Wh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=zt(),c=r==="light",[u,g]=q.useState("0.01"),[B,v]=q.useState(""),[T,y]=q.useState(!1),S=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",E=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",k=M=>{const z=parseFloat(u)||.01,ne=Math.max(.01,z+M);g(ne.toFixed(2))},R=async M=>{v("");const z=M,ne=parseFloat(z==="BUY"?e:i),J=parseFloat(u);if(!J||J<=0||isNaN(J)){v("Please enter a valid volume (minimum 0.01)");return}if(J<.01){v("Volume must be at least 0.01");return}if(!ne||ne<=0||isNaN(ne)){v("Invalid price. Please refresh and try again.");return}const V=localStorage.getItem("token")??localStorage.getItem("authToken");if(!V){v("Please login to place trades");return}y(!0);const Ae=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:Ae,type:z,volume:J,openPrice:ne,takeProfit:null,stopLoss:null};try{const he=o||q1?.VITE_BASE_URL||"http://localhost:8000",Y=l?.trades||"/api/trades",te=await gt.post(`${he}${Y}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(te.status<200||te.status>=300){v(te.data?.message||`Failed to place trade (${te.status})`);return}s&&s(),A&&A()}catch(he){const Y=he?.response?.data?.message||he?.message||"Network error. Please try again.";v(Y)}finally{y(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>R("SELL"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:i?Number(i).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${S}`,children:[a.jsx("button",{type:"button",onClick:()=>k(-.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(zh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:M=>{const z=M.target.value;(z===""||/^\d*\.?\d{0,2}$/.test(z))&&g(z)},onBlur:()=>{const M=parseFloat(u);g(isNaN(M)||M<.01?"0.01":M.toFixed(2))},className:`w-14 text-center focus:outline-none ${S} ${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} ${E} transition-colors`,children:a.jsx($1,{size:8})})]}),a.jsxs("button",{onClick:()=>R("BUY"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),B&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:B})]})},j1={},Rh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:g,selectedTimeframe:B,setOrders:v,symbols:T,fetchOrders:y,theme:S,baseUrl:F,endpoints:E}=zt(),k=S==="light",R={getContractSpec:Je=>{const Oe=String(Je||"").toUpperCase();return Oe.includes("BTC")||Oe.includes("ETH")||Oe.includes("SOL")||Oe.includes("XRP")||Oe.includes("ADA")||Oe.includes("DOGE")||Oe.includes("BNB")||Oe.includes("AVAX")||Oe.includes("DOT")||Oe.includes("LINK")||Oe.endsWith("USDT")?{contractSize:1}:Oe.includes("XAU")||Oe.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Je,volume:Oe})=>{const at=R.getContractSpec(Je);return(parseFloat(Oe)||0)*(at.contractSize||1)}},M=u||R,[z,ne]=q.useState("0.01"),[J,V]=q.useState(""),[Ae,re]=q.useState(""),[he,Y]=q.useState(""),[te,oe]=q.useState(!1),[ce,se]=q.useState(null),[ae,de]=q.useState(""),[we,Fe]=q.useState(t||"BUY"),[Ue,Be]=q.useState(parseFloat(A)||0),[Te,Ce]=q.useState(parseFloat(r)||0),[xe,Le]=q.useState("text-white"),[Re,Ke]=q.useState("text-white"),be=q.useRef(parseFloat(A)||0),_e=q.useRef(parseFloat(r)||0);q.useEffect(()=>{if(!i)return;const Je=kn.getSocket(),Oe=it=>{if(!(!it||!it.symbol)&&it.symbol.toUpperCase()===g?.toUpperCase()){const Ct=parseFloat(it.bid)||0,bt=parseFloat(it.ask)||0;Ct>0&&(Ct>be.current?(Le("text-green-400"),setTimeout(()=>Le("text-white"),500)):Ct<be.current&&be.current>0&&(Le("text-red-400"),setTimeout(()=>Le("text-white"),500)),Be(Ct),be.current=Ct),bt>0&&(bt>_e.current?(Ke("text-green-400"),setTimeout(()=>Ke("text-white"),500)):bt<_e.current&&_e.current>0&&(Ke("text-red-400"),setTimeout(()=>Ke("text-white"),500)),Ce(bt),_e.current=bt)}};Je.on("priceUpdate",Oe);const at=T.find(it=>it.symbol===g);if(at){const it=parseFloat(at.bid)||0,Ct=parseFloat(at.ask)||0;it>0&&(Be(it),be.current=it),Ct>0&&(Ce(Ct),_e.current=Ct)}return()=>{Je.off("priceUpdate",Oe)}},[i,g,T]),q.useEffect(()=>{if(i){ne(o?String(o):"0.01"),V(""),re(""),Y(""),de(""),Fe(t||"BUY");const Je=parseFloat(A)||0,Oe=parseFloat(r)||0;Je>0&&(Be(Je),be.current=Je),Oe>0&&(Ce(Oe),_e.current=Oe)}},[i,t,A,r,o]);const ye=Ue||0,pe=Te||0,Pe=Je=>{const Oe=parseFloat(z)||.01,at=Math.max(.01,Oe+Je);ne(at.toFixed(2))},tt=Je=>{const Oe=parseFloat(J)||0,at=parseFloat(we==="BUY"?Te:Ue)||0;if(!at){de("Current price not available. Please wait...");return}let it=Oe+Je;we==="BUY"?it=Math.max(1e-5,Math.min(it,at-1e-5)):it=Math.max(at+1e-5,it),V(it>0?it.toFixed(5):""),de("")},rt=Je=>{const Oe=parseFloat(Ae)||0,at=parseFloat(we==="BUY"?Te:Ue)||0;if(!at){de("Current price not available. Please wait...");return}let it=Oe+Je;we==="BUY"?it=Math.max(at+1e-5,it):it=Math.max(1e-5,Math.min(it,at-1e-5)),re(it>0?it.toFixed(5):""),de("")},nt=async Je=>{de("");const Oe=Je||we,at=parseFloat(Oe==="BUY"?Te:Ue),it=parseFloat(z),Ct=J?parseFloat(J):null,bt=Ae?parseFloat(Ae):null;if(!it||it<=0||isNaN(it)){de("Please enter a valid volume (minimum 0.01)");return}if(it<.01){de("Volume must be at least 0.01");return}if(!at||at<=0||isNaN(at)){de("Invalid price. Please refresh and try again.");return}if(Ct!==null&&Ct!==""){if(isNaN(Ct)||Ct<=0){de("Stop Loss must be a valid positive number");return}if(Oe==="BUY"&&Ct>=at){de("Stop Loss must be below the current price for BUY orders");return}if(Oe==="SELL"&&Ct<=at){de("Stop Loss must be above the current price for SELL orders");return}}if(bt!==null&&bt!==""){if(isNaN(bt)||bt<=0){de("Take Profit must be a valid positive number");return}if(Oe==="BUY"){if(bt<=at){de(`Take Profit must be above the entry price (${at.toFixed(5)}) for BUY orders`);return}}else if(Oe==="SELL"&&bt>=at){de(`Take Profit must be below the entry price (${at.toFixed(5)}) for SELL orders`);return}}Fe(Oe),se(Oe),oe(!0);const GA=new Date,$A=GA.toLocaleTimeString(),Gt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,fA=localStorage.getItem("token")??localStorage.getItem("authToken");if(!fA){de("Please login to place trades"),oe(!1),se(null);return}const XA={accountId:s,symbol:g,type:Oe,volume:it,price:at,takeProfit:bt,stopLoss:Ct,comment:he.trim()||null},Kt={ticket:Gt.substring(0,8),symbol:g,type:Oe,volume:parseFloat(it),price:parseFloat(at),time:$A,stopLoss:Ct?parseFloat(Ct):null,takeProfit:bt?parseFloat(bt):null,swap:0,profit:0,profitCurrency:"USD",comment:he.trim()||"",id:Gt,status:"OPEN",openAt:GA.toISOString()};if(!l&&v&&v(Ft=>[...Ft,Kt]),c&&!n){de("Execution handler is required in forceParentExecution mode"),oe(!1),se(null);return}if(n){oe(!1),se(null),e();const Ft={symbol:g,type:Oe,lotSize:it,entryPrice:at,stopLoss:Ct,takeProfit:bt,comment:he.trim()||null};Promise.resolve(n(Ft)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),y&&y()}).catch(mA=>{console.error("❌ Trade execution failed:",mA),!l&&v&&v(st=>st.filter(mt=>mt.id!==Gt))})}else{if(c){de("Fallback API path disabled in forceParentExecution mode"),oe(!1),se(null);return}oe(!1),se(null),e();const Ft=F||j1?.VITE_BASE_URL||"http://localhost:8000",mA=E?.trades||"/api/trades";gt.post(`${Ft}${mA}`,XA,{headers:{Authorization:`Bearer ${fA}`,"Content-Type":"application/json"}}).then(st=>{if(st.data&&st.data.data){const mt=st.data.data.trade;!l&&v&&v(Ut=>Ut.map(It=>It.id===Gt?{...It,id:mt.id,ticket:mt.id.substring(0,8),time:$A,openAt:mt.openAt}:It)),console.log("✅ Trade saved successfully:",mt),window.notify&&window.notify(`Trade placed successfully: ${mt.symbol} ${mt.type}`,"success")}else{!l&&v&&v(Ut=>Ut.filter(It=>It.id!==Gt));const mt=st.data?.message||"Failed to place trade";window.notify&&window.notify(mt,"error")}}).catch(st=>{console.error("Error placing trade:",st),!l&&v&&v(Ut=>Ut.filter(It=>It.id!==Gt));let mt="Failed to place trade";if(st.response){const Ut=st.response.status,It=st.response.data;Ut===400?mt=It?.message||"Invalid trade data. Please check your inputs.":Ut===401?mt="Authentication failed. Please login again.":Ut===404?mt=It?.message||"Symbol not found. Please select a valid symbol.":Ut===500?mt="Server error. Please try again later.":mt=It?.message||`Error: ${Ut}`}else st.request&&(mt="Network error. Please check your internet connection.");window.notify&&window.notify(mt,"error")})}},dA=(M?.calculateVolumeUnits?.({symbol:g,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:[ae&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:ae}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${k?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${k?"text-slate-700":"text-white"}`,children:[dA," ",g]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>Pe(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:z,onChange:Je=>{const Oe=Je.target.value;(Oe===""||/^\d*\.?\d{0,2}$/.test(Oe))&&(ne(Oe),de(""))},onBlur:()=>{const Je=parseFloat(z);ne(isNaN(Je)||Je<.01?"0.01":Je.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>Pe(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${k?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>tt(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:J,onChange:Je=>{const Oe=Je.target.value;(Oe===""||/^\d*\.?\d*$/.test(Oe))&&(V(Oe),de(""))},onBlur:Je=>{const Oe=parseFloat(Je.target.value);!isNaN(Oe)&&Oe>0?V(Oe.toFixed(5)):Je.target.value===""&&V("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>tt(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:()=>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 TP",children:"−"}),a.jsx("input",{type:"text",value:Ae,onChange:Je=>{const Oe=Je.target.value;(Oe===""||/^\d*\.?\d*$/.test(Oe))&&(re(Oe),de(""))},onBlur:Je=>{const Oe=parseFloat(Je.target.value);!isNaN(Oe)&&Oe>0?re(Oe.toFixed(5)):Je.target.value===""&&re("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>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 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:Je=>Y(Je.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:`${xe} font-medium transition-colors duration-400`,children:ye>0?ye.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:k?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Re} font-medium transition-colors duration-400`,children:pe>0?pe.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>nt("SELL"),disabled:te,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:te&&ce==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>nt("BUY"),disabled:te,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:te&&ce==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},ew={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"},tw=[10,11,12,14,16,20,24,28,30,40],zn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],si={width:"78%",height:"78%",display:"block"},Gh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Aw(i){return i?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function OA(i,e="#5f8f96"){if(typeof i!="string")return e;const t=i.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const iw=()=>a.jsx(Z1,{style:si}),rw=()=>a.jsx(Y1,{style:si}),nw=()=>a.jsx(G1,{style:si}),sw=()=>a.jsx(J1,{style:si}),ow=()=>a.jsx(W1,{style:si}),aw=()=>a.jsx(z1,{style:si}),lw=()=>a.jsx(R1,{style:si}),cw=()=>a.jsx(zh,{style:si}),ia=({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(ia,{size:"18px",children:r})})}function Ye({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:Gh}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,background:A.fieldBg},children:i&&a.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Ot({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=OA(i,"#5f8f96"),s=(i||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:A?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:u=>e(u.target.value),disabled:A,style:{...Gh,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:u=>{const g=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(g?`#${g}`:"")},onBlur:t,disabled:A,style:c})]})}function 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(cw,{})})]})}function hw({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(Ye,{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(Ye,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function uw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,OA(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(Fi,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:tw.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(nw,{})}),a.jsx(Qr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(sw,{})})]}),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(ow,{})}),a.jsx(Qr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(aw,{})}),a.jsx(Qr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(lw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(Ye,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(Ye,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(Ot,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(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(Ye,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Ot,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(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,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#22c55e",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(Ye,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ye,{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(Ye,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ye,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ye,{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(Ye,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ye,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ye,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(Ye,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(Ye,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function pw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ye,{checked:i.showArea!==!1,onChange:n=>A("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ye,{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(Ye,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ye,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ye,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function dw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ye,{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(Ye,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ye,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ye,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(Ye,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(Ye,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function fw({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 $h({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,OA(o,l)),n=!i.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:s=>A("lineColor",s),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:s=>A("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ye,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(Ye,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(Ot,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(Fi,{value:i.textHAlign??"center",onChange:s=>A("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(Fi,{value:i.textVAlign??"top",onChange:s=>A("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:i.textContent||"",onChange:s=>A("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function 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 gw({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 ww({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ye,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function Bw({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 yw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#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(Ye,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ye,{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(Ye,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ye,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(Ye,{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(Ye,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ye,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Cw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#06a0e3",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ye,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(Ye,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function vw({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 Xh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#129f5c",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(Ye,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Ot,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(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(Ye,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Ot,{value:i.pricesColor||"#129f5c",onChange:n=>A("pricesColor",n),onBlur:()=>r("pricesColor",i.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(Ye,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ye,{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(Ye,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ye,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Jh({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 Tw(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 Zh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=zt(),s=Aw(r==="light"),[o,l]=q.useState("style"),[c,u]=q.useState({}),[g,B]=q.useState(null),v=q.useRef(null),T=q.useRef(null);q.useEffect(()=>{t&&(u(Tw(t)),l("style"))},[t]),q.useEffect(()=>{i||B(null)},[i]);const y=M=>{if(M.button!==0)return;M.preventDefault();const z=v.current;if(!z)return;const ne=z.offsetParent,J=ne?ne.getBoundingClientRect():{left:0,top:0},V=z.getBoundingClientRect(),Ae=V.left-J.left,re=V.top-J.top;T.current={startMX:M.clientX,startMY:M.clientY,startX:Ae,startY:re},B({x:Ae,y:re});const he=te=>{const{startMX:oe,startMY:ce,startX:se,startY:ae}=T.current;B({x:se+te.clientX-oe,y:ae+te.clientY-ce})},Y=()=>{T.current=null,document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Y)};document.addEventListener("mousemove",he),document.addEventListener("mouseup",Y)};if(!i||!t)return null;const S=ew[t.type]||t.type,F=["style","coordinates","visualization"],E=()=>{if(o==="visualization")return a.jsx(hw,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(uw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(fw,{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($h,{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($h,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(gw,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(ww,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Bw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(dw,{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(Cw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(vw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(yw,{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(Xh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Jh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Xh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Jh,{draft:c,setDraft:u,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},k=()=>{A(c),e()};return a.jsxs("div",{ref:v,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...g===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:g.y,left:g.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:y,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(ia,{size:"18px",children:a.jsx(iw,{})})})]})}),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(ia,{size:"20px",children:a.jsx(rw,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(M=>{const z=o===M;return a.jsxs("button",{type:"button",onClick:()=>l(M),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:z?s.text:s.mutedText,cursor:"pointer"},children:[M.charAt(0).toUpperCase()+M.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},M)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:E()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick: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 ra=function(i,e){return ra=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])},ra(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");ra(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var na=function(){return na=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},na.apply(this,arguments)};function tA(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(u){try{c(A.next(u))}catch(g){s(g)}}function l(u){try{c(A.throw(u))}catch(g){s(g)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Zt(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},A,r,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(u){return l([c,u])}}function l(c){if(A)throw new TypeError("Generator is already executing.");for(;t;)try{if(A=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(u){c=[6,u],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Rn(i,e,t){if(arguments.length===2)for(var A=0,r=e.length,n;A<r;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return i.concat(n||e)}for(var qA=(function(){function i(e,t,A,r){this.left=e,this.top=t,this.width=A,this.height=r}return i.prototype.add=function(e,t,A,r){return new i(this.left+e,this.top+t,this.width+A,this.height+r)},i.fromClientRect=function(e,t){return new i(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},i.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(r){return r.width!==0});return A?new i(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):i.EMPTY},i.EMPTY=new i(0,0,0,0),i})(),Gn=function(i,e){return qA.fromClientRect(i,e.getBoundingClientRect())},bw=function(i){var e=i.body,t=i.documentElement;if(!e||!t)throw new Error("Unable to get document size");var A=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new qA(0,0,A,r)},$n=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},Mt=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},Yh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<Yh.length;Xn++)xw[Yh.charCodeAt(Xn)]=Xn;for(var qh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Jn=0;Jn<qh.length;Jn++)Fr[qh.charCodeAt(Jn)]=Jn;for(var Qw=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},Fw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Uw=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,sa=11,oa=2,Sw=sa-Ei,jh=65536>>Ei,Ew=1<<Ei,aa=Ew-1,Lw=1024>>Ei,Mw=jh+Lw,Hw=Mw,Iw=32,Dw=Hw+Iw,_w=65536>>sa,Pw=1<<Sw,Nw=Pw-1,eu=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=Qw(i),A=Array.isArray(t)?Uw(t):new Uint32Array(t),r=Array.isArray(t)?Fw(t):new Uint16Array(t),n=24,s=eu(r,n/2,A[4]/2),o=A[5]===2?eu(r,(n+A[4])/2):Ow(A,Math.ceil((n+A[4])/4));return new Kw(A[0],A[1],A[2],A[3],s,o)},Kw=(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<<oa)+(e&aa),this.data[t];if(e<=65535)return t=this.index[jh+(e-55296>>Ei)],t=(t<<oa)+(e&aa),this.data[t];if(e<this.highStart)return t=Dw-_w+(e>>sa),t=this.index[t],t+=e>>Ei&Nw,t=this.index[t],t=(t<<oa)+(e&aa),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),tu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<tu.length;Zn++)Vw[tu.charCodeAt(Zn)]=Zn;var zw="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==",Au=50,Ww=1,iu=2,ru=3,Rw=4,Gw=5,nu=7,su=8,ou=9,oi=10,la=11,au=12,ca=13,$w=14,Ur=15,ha=16,Yn=17,Sr=18,Xw=19,lu=20,ua=21,Er=22,pa=23,Ri=24,pA=25,Lr=26,Mr=27,Gi=28,Jw=29,Li=30,Zw=31,qn=32,jn=33,da=34,fa=35,ma=36,Hr=37,ga=38,es=39,ts=40,wa=41,cu=42,Yw=43,qw=[9001,65288],hu="!",lt="×",As="÷",Ba=kw(zw),jA=[Li,ma],ya=[Ww,iu,ru,Gw],uu=[oi,su],pu=[Mr,Lr],jw=ya.concat(uu),du=[ga,es,ts,da,fa],eB=[Ur,ca],tB=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=Ba.get(n);if(o>Au?(r.push(!0),o-=Au):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(ha);if(o===Rw||o===la){if(s===0)return A.push(s),t.push(Li);var l=t[s-1];return jw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(Li))}if(A.push(s),o===Zw)return t.push(e==="strict"?ua:Hr);if(o===cu||o===Jw)return t.push(Li);if(o===Yw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Hr):t.push(Li);t.push(o)}),[A,t,r]},Ca=function(i,e,t,A){var r=A[t];if(Array.isArray(i)?i.indexOf(r)!==-1:i===r)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==oi)break}if(r===oi)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(i)?i.indexOf(o)!==-1:i===o)for(var l=t;l<=A.length;){l++;var s=A[l];if(s===e)return!0;if(s!==oi)break}if(o!==oi)break}return!1},fu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===oi)t--;else return A}return 0},AB=function(i,e,t,A,r){if(t[A]===0)return lt;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return lt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===iu&&u===ru)return lt;if(ya.indexOf(l)!==-1)return hu;if(ya.indexOf(u)!==-1||uu.indexOf(u)!==-1)return lt;if(fu(n,e)===su)return As;if(Ba.get(i[n])===la||(l===qn||l===jn)&&Ba.get(i[o])===la||l===nu||u===nu||l===ou||[oi,ca,Ur].indexOf(l)===-1&&u===ou||[Yn,Sr,Xw,Ri,Gi].indexOf(u)!==-1||fu(n,e)===Er||Ca(pa,Er,n,e)||Ca([Yn,Sr],ua,n,e)||Ca(au,au,n,e))return lt;if(l===oi)return As;if(l===pa||u===pa)return lt;if(u===ha||l===ha)return As;if([ca,Ur,ua].indexOf(u)!==-1||l===$w||c===ma&&eB.indexOf(l)!==-1||l===Gi&&u===ma||u===lu||jA.indexOf(u)!==-1&&l===pA||jA.indexOf(l)!==-1&&u===pA||l===Mr&&[Hr,qn,jn].indexOf(u)!==-1||[Hr,qn,jn].indexOf(l)!==-1&&u===Lr||jA.indexOf(l)!==-1&&pu.indexOf(u)!==-1||pu.indexOf(l)!==-1&&jA.indexOf(u)!==-1||[Mr,Lr].indexOf(l)!==-1&&(u===pA||[Er,Ur].indexOf(u)!==-1&&e[o+1]===pA)||[Er,Ur].indexOf(l)!==-1&&u===pA||l===pA&&[pA,Gi,Ri].indexOf(u)!==-1)return lt;if([pA,Gi,Ri,Yn,Sr].indexOf(u)!==-1)for(var g=n;g>=0;){var B=e[g];if(B===pA)return lt;if([Gi,Ri].indexOf(B)!==-1)g--;else break}if([Mr,Lr].indexOf(u)!==-1)for(var g=[Yn,Sr].indexOf(l)!==-1?s:n;g>=0;){var B=e[g];if(B===pA)return lt;if([Gi,Ri].indexOf(B)!==-1)g--;else break}if(ga===l&&[ga,es,da,fa].indexOf(u)!==-1||[es,da].indexOf(l)!==-1&&[es,ts].indexOf(u)!==-1||[ts,fa].indexOf(l)!==-1&&u===ts||du.indexOf(l)!==-1&&[lu,Lr].indexOf(u)!==-1||du.indexOf(u)!==-1&&l===Mr||jA.indexOf(l)!==-1&&jA.indexOf(u)!==-1||l===Ri&&jA.indexOf(u)!==-1||jA.concat(pA).indexOf(l)!==-1&&u===Er&&qw.indexOf(i[o])===-1||jA.concat(pA).indexOf(u)!==-1&&l===Sr)return lt;if(l===wa&&u===wa){for(var v=t[n],T=1;v>0&&(v--,e[v]===wa);)T++;if(T%2!==0)return lt}return l===qn&&u===jn?lt:As},iB=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=tB(i,e.lineBreak),A=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[pA,Li,cu].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]},rB=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===hu,this.start=A,this.end=r}return i.prototype.slice=function(){return Mt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),nB=function(i,e){var t=$n(i),A=iB(t,e),r=A[0],n=A[1],s=A[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var u=lt;c<o&&(u=AB(t,n,r,++c,s))===lt;);if(u!==lt||c===o){var g=new rB(t,u,l,c);return l=c,{value:g,done:!1}}return{done:!0,value:null}}}},sB=1,oB=2,Ir=4,mu=8,is=10,gu=47,Dr=92,aB=9,lB=32,rs=34,_r=61,cB=35,hB=36,uB=37,ns=39,ss=40,Pr=41,pB=95,oA=45,dB=33,fB=60,mB=62,gB=64,wB=91,BB=93,yB=61,CB=123,os=63,vB=125,wu=124,TB=126,bB=128,Bu=65533,va=42,Mi=43,xB=44,QB=58,FB=59,Nr=46,UB=0,SB=8,EB=11,LB=14,MB=31,HB=127,kA=-1,yu=48,Cu=97,vu=101,IB=102,DB=117,_B=122,Tu=65,bu=69,xu=70,PB=85,NB=90,Yt=function(i){return i>=yu&&i<=57},OB=function(i){return i>=55296&&i<=57343},$i=function(i){return Yt(i)||i>=Tu&&i<=xu||i>=Cu&&i<=IB},kB=function(i){return i>=Cu&&i<=_B},KB=function(i){return i>=Tu&&i<=NB},VB=function(i){return kB(i)||KB(i)},zB=function(i){return i>=bB},as=function(i){return i===is||i===aB||i===lB},ls=function(i){return VB(i)||zB(i)||i===pB},Qu=function(i){return ls(i)||Yt(i)||i===oA},WB=function(i){return i>=UB&&i<=SB||i===EB||i>=LB&&i<=MB||i===HB},ai=function(i,e){return i!==Dr?!1:e!==is},cs=function(i,e,t){return i===oA?ls(e)||ai(e,t):ls(i)?!0:!!(i===Dr&&ai(i,e))},Ta=function(i,e,t){return i===Mi||i===oA?Yt(e)?!0:e===Nr&&Yt(t):Yt(i===Nr?e:i)},RB=function(i){var e=0,t=1;(i[e]===Mi||i[e]===oA)&&(i[e]===oA&&(t=-1),e++);for(var A=[];Yt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Mt.apply(void 0,A),10):0;i[e]===Nr&&e++;for(var n=[];Yt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Mt.apply(void 0,n),10):0;(i[e]===bu||i[e]===vu)&&e++;var l=1;(i[e]===Mi||i[e]===oA)&&(i[e]===oA&&(l=-1),e++);for(var c=[];Yt(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Mt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},GB={type:2},$B={type:3},XB={type:4},JB={type:13},ZB={type:8},YB={type:21},qB={type:9},jB={type:10},e2={type:11},t2={type:12},A2={type:14},hs={type:23},i2={type:1},r2={type:25},n2={type:24},s2={type:26},o2={type:27},a2={type:28},l2={type:29},c2={type:31},ba={type:32},Fu=(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!==ba;)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 cB:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Qu(t)||ai(A,r)){var n=cs(t,A,r)?oB:sB,s=this.consumeName();return{type:5,value:s,flags:n}}break;case hB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),JB;break;case ns:return this.consumeStringToken(ns);case ss:return GB;case Pr:return $B;case va:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),A2;break;case Mi:if(Ta(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case xB:return XB;case oA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Ta(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(cs(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===oA&&c===mB)return this.consumeCodePoint(),this.consumeCodePoint(),n2;break;case Nr:if(Ta(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case gu:if(this.peekCodePoint(0)===va)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===va&&(u=this.consumeCodePoint(),u===gu))return this.consumeToken();if(u===kA)return this.consumeToken()}break;case QB:return s2;case FB:return o2;case fB:if(this.peekCodePoint(0)===dB&&this.peekCodePoint(1)===oA&&this.peekCodePoint(2)===oA)return this.consumeCodePoint(),this.consumeCodePoint(),r2;break;case gB:var g=this.peekCodePoint(0),B=this.peekCodePoint(1),v=this.peekCodePoint(2);if(cs(g,B,v)){var s=this.consumeName();return{type:7,value:s}}break;case wB:return a2;case Dr:if(ai(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case BB:return l2;case yB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),ZB;break;case CB:return e2;case vB:return t2;case DB:case PB:var T=this.peekCodePoint(0),y=this.peekCodePoint(1);return T===Mi&&($i(y)||y===os)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case wu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),qB;if(this.peekCodePoint(0)===wu)return this.consumeCodePoint(),YB;break;case TB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),jB;break;case kA:return ba}return as(e)?(this.consumeWhiteSpace(),c2):Yt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ls(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Mt(e)}},i.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},i.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},i.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},i.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();$i(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===os&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Mt.apply(void 0,e.map(function(l){return l===os?yu:l})),16),n=parseInt(Mt.apply(void 0,e.map(function(l){return l===os?xu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Mt.apply(void 0,e),16);if(this.peekCodePoint(0)===oA&&$i(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];$i(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Mt.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},i.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ss?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ss?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===kA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ns||t===rs){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===kA||this.peekCodePoint(0)===Pr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),hs)}for(;;){var r=this.consumeCodePoint();if(r===kA||r===Pr)return{type:22,value:Mt.apply(void 0,e)};if(as(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===kA||this.peekCodePoint(0)===Pr?(this.consumeCodePoint(),{type:22,value:Mt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),hs);if(r===rs||r===ns||r===ss||WB(r))return this.consumeBadUrlRemnants(),hs;if(r===Dr)if(ai(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),hs;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;as(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Pr||e===kA)return;ai(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},i.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var r=Math.min(t,e);A+=Mt.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),A},i.prototype.consumeStringToken=function(e){var t="",A=0;do{var r=this._value[A];if(r===kA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===is)return this._value.splice(0,A),i2;if(r===Dr){var n=this._value[A+1];n!==kA&&n!==void 0&&(n===is?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):ai(r,n)&&(t+=this.consumeStringSlice(A),t+=Mt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Ir,A=this.peekCodePoint(0);for((A===Mi||A===oA)&&e.push(this.consumeCodePoint());Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Nr&&Yt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=mu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===bu||A===vu)&&((r===Mi||r===oA)&&Yt(n)||Yt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=mu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[RB(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===uB?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if($i(e)){for(var t=Mt(e);$i(this.peekCodePoint(0))&&t.length<6;)t+=Mt(this.consumeCodePoint());as(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||OB(A)||A>1114111?Bu:A}return e===kA?Bu:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Qu(t))e+=Mt(t);else if(ai(t,this.peekCodePoint(0)))e+=Mt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),Uu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new Fu;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||u2(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"?ba:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),Or=function(i){return i.type===15},Xi=function(i){return i.type===17},wt=function(i){return i.type===20},h2=function(i){return i.type===0},xa=function(i,e){return wt(i)&&i.value===e},Su=function(i){return i.type!==31},Ji=function(i){return i.type!==31&&i.type!==4},KA=function(i){var e=[],t=[];return i.forEach(function(A){if(A.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}A.type!==31&&t.push(A)}),t.length&&e.push(t),e},u2=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},li=function(i){return i.type===17||i.type===15},Pt=function(i){return i.type===16||li(i)},Eu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},Wt={type:17,number:0,flags:Ir},Qa={type:16,number:50,flags:Ir},ci={type:16,number:100,flags:Ir},kr=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(Or(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},Lu="deg",Mu="grad",Hu="rad",Iu="turn",us={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case Lu:return Math.PI*e.number/180;case Mu:return Math.PI/200*e.number;case Hu:return e.number;case Iu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Du=function(i){return i.type===15&&(i.unit===Lu||i.unit===Mu||i.unit===Hu||i.unit===Iu)},_u=function(i){var e=i.filter(wt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Wt,Wt];case"to top":case"bottom":return CA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Wt,ci];case"to right":case"left":return CA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ci,ci];case"to bottom":case"top":return CA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ci,Wt];case"to left":case"right":return CA(270)}return 0},CA=function(i){return Math.PI*i/180},hi={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}},ui=function(i){return(255&i)===0},kt=function(i){var e=255&i,t=255&i>>8,A=255&i>>16,r=255&i>>24;return e<255?"rgba("+r+","+A+","+t+","+e/255+")":"rgb("+r+","+A+","+t+")"},pi=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},Pu=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},Nu=function(i,e){var t=e.filter(Ji);if(t.length===3){var A=t.map(Pu),r=A[0],n=A[1],s=A[2];return pi(r,n,s,1)}if(t.length===4){var o=t.map(Pu),r=o[0],n=o[1],s=o[2],l=o[3];return pi(r,n,s,l)}return 0};function Fa(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 Ou=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=Pt(r)?r.number/100:0,c=Pt(n)?n.number/100:0,u=typeof s<"u"&&Pt(s)?vt(s,1):1;if(l===0)return pi(c*255,c*255,c*255,1);var g=c<=.5?c*(l+1):c+l-c*l,B=c*2-g,v=Fa(B,g,o+1/3),T=Fa(B,g,o),y=Fa(B,g,o-1/3);return pi(v*255,T*255,y*255,u)},p2={hsl:Ou,hsla:Ou,rgb:Nu,rgba:Nu},Kr=function(i,e){return hi.parse(i,Uu.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},d2={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},f2={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ps=function(i,e){var t=hi.parse(i,e[0]),A=e[1];return A&&Pt(A)?{color:t,stop:A}:{color:t,stop:null}},ku=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=Wt),A.stop===null&&(A.stop=ci);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=vt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var g=s-c,B=r[c-1],v=(u-B)/(g+1),T=1;T<=g;T++)r[c+T-1]=v*T;c=null}}return i.map(function(y,S){var F=y.color;return{color:F,stop:Math.max(Math.min(1,r[S]/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)},g2=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)},Ku=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},w2=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=Ku(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)),g=Ku(A,r,e,t,!1),c=g[0],u=g[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]},B2=function(i,e){var t=CA(180),A=[];return KA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=_u(r);return}else if(Du(s)){t=us.parse(i,s);return}}var o=ps(i,r);A.push(o)}),{angle:t,stops:A,type:1}},ds=function(i,e){var t=CA(180),A=[];return KA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=_u(r);return}else if(Du(s)){t=(us.parse(i,s)+CA(270))%CA(360);return}}var o=ps(i,r);A.push(o)}),{angle:t,stops:A,type:1}},y2=function(i,e){var t=CA(180),A=[],r=1,n=0,s=3,o=[];return KA(e).forEach(function(l,c){var u=l[0];if(c===0){if(wt(u)&&u.value==="linear"){r=1;return}else if(wt(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var g=hi.parse(i,u.values[0]);A.push({stop:Wt,color:g})}else if(u.name==="to"){var g=hi.parse(i,u.values[0]);A.push({stop:ci,color:g})}else if(u.name==="color-stop"){var B=u.values.filter(Ji);if(B.length===2){var g=hi.parse(i,B[1]),v=B[0];Xi(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:g})}}}}),r===1?{angle:(t+CA(180))%CA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},Vu="closest-side",zu="farthest-side",Wu="closest-corner",Ru="farthest-corner",Gu="circle",$u="ellipse",Xu="cover",Ju="contain",C2=function(i,e){var t=0,A=3,r=[],n=[];return KA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(g,B){if(c)if(wt(B))switch(B.value){case"center":return n.push(Qa),g;case"top":case"left":return n.push(Wt),g;case"right":case"bottom":return n.push(ci),g}else(Pt(B)||li(B))&&n.push(B);else if(wt(B))switch(B.value){case Gu:return t=0,!1;case $u:return t=1,!1;case"at":return c=!0,!1;case Vu:return A=0,!1;case Xu:case zu:return A=1,!1;case Ju:case Wu:return A=2,!1;case Ru:return A=3,!1}else if(li(B)||Pt(B))return Array.isArray(A)||(A=[]),A.push(B),!1;return g},l)}if(l){var u=ps(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},fs=function(i,e){var t=0,A=3,r=[],n=[];return KA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,g){if(wt(g))switch(g.value){case"center":return n.push(Qa),!1;case"top":case"left":return n.push(Wt),!1;case"right":case"bottom":return n.push(ci),!1}else if(Pt(g)||li(g))return n.push(g),!1;return u},l):o===1&&(l=s.reduce(function(u,g){if(wt(g))switch(g.value){case Gu:return t=0,!1;case $u:return t=1,!1;case Ju:case Vu:return A=0,!1;case zu:return A=1,!1;case Wu:return A=2,!1;case Xu:case Ru:return A=3,!1}else if(li(g)||Pt(g))return Array.isArray(A)||(A=[]),A.push(g),!1;return u},l)),l){var c=ps(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},v2=function(i){return i.type===1},T2=function(i){return i.type===2},Ua={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=Zu[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 b2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Zu[i.name])}var Zu={"linear-gradient":B2,"-moz-linear-gradient":ds,"-ms-linear-gradient":ds,"-o-linear-gradient":ds,"-webkit-linear-gradient":ds,"radial-gradient":C2,"-moz-radial-gradient":fs,"-ms-radial-gradient":fs,"-o-radial-gradient":fs,"-webkit-radial-gradient":fs,"-webkit-gradient":y2},x2={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)&&b2(A)}).map(function(A){return Ua.parse(i,A)})}},Q2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},F2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return KA(e).map(function(t){return t.filter(Pt)}).map(Eu)}},U2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return KA(e).map(function(t){return t.filter(wt).map(function(A){return A.value}).join(" ")}).map(S2)}},S2=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 E2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return KA(e).map(function(t){return t.filter(L2)})}},L2=function(i){return wt(i)||Pt(i)},ms=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},M2=ms("top"),H2=ms("right"),I2=ms("bottom"),D2=ms("left"),gs=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Eu(t.filter(Pt))}}},_2=gs("top-left"),P2=gs("top-right"),N2=gs("bottom-right"),O2=gs("bottom-left"),ws=function(i){return{name:"border-"+i+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},k2=ws("top"),K2=ws("right"),V2=ws("bottom"),z2=ws("left"),Bs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Or(t)?t.number:0}}},W2=Bs("top"),R2=Bs("right"),G2=Bs("bottom"),$2=Bs("left"),X2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},J2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},Z2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).reduce(function(t,A){return t|Y2(A.value)},0)}},Y2=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},q2={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}},j2={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 ey={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ys.STRICT:ys.NORMAL}},ty={name:"line-height",initialValue:"normal",prefix:!1,type:4},Yu=function(i,e){return wt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Pt(i)?vt(i,e):e},Ay={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:Ua.parse(i,e)}},iy={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},Sa={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}},ry=Cs("top"),ny=Cs("right"),sy=Cs("bottom"),oy=Cs("left"),ay={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},ly={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"}},cy=vs("top"),hy=vs("right"),uy=vs("bottom"),py=vs("left"),dy={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}}},fy={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&&xa(e[0],"none")?[]:KA(e).map(function(t){for(var A={color:ei.TRANSPARENT,offsetX:Wt,offsetY:Wt,blur:Wt},r=0,n=0;n<t.length;n++){var s=t[n];li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=hi.parse(i,s)}return A})}},gy={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}},wy={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=Cy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},By=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},yy=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},Cy={matrix:By,matrix3d:yy},qu={type:16,number:50,flags:Ir},vy=[qu,qu],Ty={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Pt);return t.length!==2?vy:[t[0],t[1]]}},by={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 xy={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}}},Qy={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")}},ju={name:"time",parse:function(i,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Fy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:1}},Uy={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Sy={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},Ey={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+"'"})}},Ly={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},My={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:wt(e)&&e.value==="bold"?700:400}},Hy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(wt).map(function(t){return t.value})}},Iy={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}},_y={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(Su),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}},Py={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(Su),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(wt(n)&&n.value!=="none"){var o=s&&Xi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},Ny={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(Or).map(function(t){return ju.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(h2);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}},ep=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&&xa(e[0],"none")?[]:KA(e).map(function(t){for(var A={color:255,offsetX:Wt,offsetY:Wt,blur:Wt,spread:Wt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];xa(s,"inset")?A.inset=!0:li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=hi.parse(i,s)}return A})}},Ky={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(wt).forEach(function(r){switch(r.value){case"stroke":A.push(1);break;case"fill":A.push(0);break;case"markers":A.push(2);break}}),t.forEach(function(r){A.indexOf(r)===-1&&A.push(r)}),A}},Vy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},zy={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return Or(e)?e.number:0}},Wy=(function(){function i(e,t){var A,r;this.animationDuration=De(e,Ny,t.animationDuration),this.backgroundClip=De(e,d2,t.backgroundClip),this.backgroundColor=De(e,f2,t.backgroundColor),this.backgroundImage=De(e,x2,t.backgroundImage),this.backgroundOrigin=De(e,Q2,t.backgroundOrigin),this.backgroundPosition=De(e,F2,t.backgroundPosition),this.backgroundRepeat=De(e,U2,t.backgroundRepeat),this.backgroundSize=De(e,E2,t.backgroundSize),this.borderTopColor=De(e,M2,t.borderTopColor),this.borderRightColor=De(e,H2,t.borderRightColor),this.borderBottomColor=De(e,I2,t.borderBottomColor),this.borderLeftColor=De(e,D2,t.borderLeftColor),this.borderTopLeftRadius=De(e,_2,t.borderTopLeftRadius),this.borderTopRightRadius=De(e,P2,t.borderTopRightRadius),this.borderBottomRightRadius=De(e,N2,t.borderBottomRightRadius),this.borderBottomLeftRadius=De(e,O2,t.borderBottomLeftRadius),this.borderTopStyle=De(e,k2,t.borderTopStyle),this.borderRightStyle=De(e,K2,t.borderRightStyle),this.borderBottomStyle=De(e,V2,t.borderBottomStyle),this.borderLeftStyle=De(e,z2,t.borderLeftStyle),this.borderTopWidth=De(e,W2,t.borderTopWidth),this.borderRightWidth=De(e,R2,t.borderRightWidth),this.borderBottomWidth=De(e,G2,t.borderBottomWidth),this.borderLeftWidth=De(e,$2,t.borderLeftWidth),this.boxShadow=De(e,ky,t.boxShadow),this.color=De(e,X2,t.color),this.direction=De(e,J2,t.direction),this.display=De(e,Z2,t.display),this.float=De(e,q2,t.cssFloat),this.fontFamily=De(e,Ey,t.fontFamily),this.fontSize=De(e,Ly,t.fontSize),this.fontStyle=De(e,Iy,t.fontStyle),this.fontVariant=De(e,Hy,t.fontVariant),this.fontWeight=De(e,My,t.fontWeight),this.letterSpacing=De(e,j2,t.letterSpacing),this.lineBreak=De(e,ey,t.lineBreak),this.lineHeight=De(e,ty,t.lineHeight),this.listStyleImage=De(e,Ay,t.listStyleImage),this.listStylePosition=De(e,iy,t.listStylePosition),this.listStyleType=De(e,Sa,t.listStyleType),this.marginTop=De(e,ry,t.marginTop),this.marginRight=De(e,ny,t.marginRight),this.marginBottom=De(e,sy,t.marginBottom),this.marginLeft=De(e,oy,t.marginLeft),this.opacity=De(e,Fy,t.opacity);var n=De(e,ay,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=De(e,ly,t.overflowWrap),this.paddingTop=De(e,cy,t.paddingTop),this.paddingRight=De(e,hy,t.paddingRight),this.paddingBottom=De(e,uy,t.paddingBottom),this.paddingLeft=De(e,py,t.paddingLeft),this.paintOrder=De(e,Ky,t.paintOrder),this.position=De(e,fy,t.position),this.textAlign=De(e,dy,t.textAlign),this.textDecorationColor=De(e,Uy,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=De(e,Sy,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=De(e,my,t.textShadow),this.textTransform=De(e,gy,t.textTransform),this.transform=De(e,wy,t.transform),this.transformOrigin=De(e,Ty,t.transformOrigin),this.visibility=De(e,by,t.visibility),this.webkitTextStrokeColor=De(e,Vy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=De(e,zy,t.webkitTextStrokeWidth),this.wordBreak=De(e,xy,t.wordBreak),this.zIndex=De(e,Qy,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return ui(this.backgroundColor)},i.prototype.isTransformed=function(){return this.transform!==null},i.prototype.isPositioned=function(){return this.position!==0},i.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},i.prototype.isFloating=function(){return this.float!==0},i.prototype.isInlineLevel=function(){return 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})(),Ry=(function(){function i(e,t){this.content=De(e,Dy,t.content),this.quotes=De(e,Oy,t.quotes)}return i})(),tp=(function(){function i(e,t){this.counterIncrement=De(e,_y,t.counterIncrement),this.counterReset=De(e,Py,t.counterReset)}return i})(),De=function(i,e,t){var A=new Fu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new Uu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,wt(s)?s.value:e.initialValue);case 0:return e.parse(i,n.parseComponentValue());case 1:return e.parse(i,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return us.parse(i,n.parseComponentValue());case"color":return hi.parse(i,n.parseComponentValue());case"image":return Ua.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return li(o)?o:Wt;case"length-percentage":var l=n.parseComponentValue();return Pt(l)?l:Wt;case"time":return ju.parse(i,n.parseComponentValue())}break}},Gy="data-html2canvas-debug",$y=function(i){var e=i.getAttribute(Gy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Ea=function(i,e){var t=$y(i);return t===1||e===t},VA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Ea(t,3))debugger;this.styles=new Wy(e,window.getComputedStyle(t,null)),Wa(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),Ea(t,4)&&(this.flags|=16)}return i})(),Xy="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Ap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<Ap.length;Ts++)zr[Ap.charCodeAt(Ts)]=Ts;for(var Jy=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=zr[i.charCodeAt(A)],s=zr[i.charCodeAt(A+1)],o=zr[i.charCodeAt(A+2)],l=zr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Zy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Yy=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,La=11,Ma=2,qy=La-Hi,ip=65536>>Hi,jy=1<<Hi,Ha=jy-1,eC=1024>>Hi,tC=ip+eC,AC=tC,iC=32,rC=AC+iC,nC=65536>>La,sC=1<<qy,oC=sC-1,rp=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},aC=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},lC=function(i,e){var t=Jy(i),A=Array.isArray(t)?Yy(t):new Uint32Array(t),r=Array.isArray(t)?Zy(t):new Uint16Array(t),n=24,s=rp(r,n/2,A[4]/2),o=A[5]===2?rp(r,(n+A[4])/2):aC(A,Math.ceil((n+A[4])/4));return new cC(A[0],A[1],A[2],A[3],s,o)},cC=(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<<Ma)+(e&Ha),this.data[t];if(e<=65535)return t=this.index[ip+(e-55296>>Hi)],t=(t<<Ma)+(e&Ha),this.data[t];if(e<this.highStart)return t=rC-nC+(e>>La),t=this.index[t],t+=e>>Hi&oC,t=this.index[t],t=(t<<Ma)+(e&Ha),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),np="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hC=typeof Uint8Array>"u"?[]:new Uint8Array(256),bs=0;bs<np.length;bs++)hC[np.charCodeAt(bs)]=bs;var uC=1,Ia=2,Da=3,sp=4,op=5,pC=7,ap=8,_a=9,Pa=10,lp=11,cp=12,hp=13,up=14,Na=15,dC=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},fC=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=lC(Xy),vA="×",Oa="÷",gC=function(i){return mC.get(i)},wC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===Ia&&s===Da)return vA;if(n===Ia||n===Da||n===sp||s===Ia||s===Da||s===sp)return Oa;if(n===ap&&[ap,_a,lp,cp].indexOf(s)!==-1||(n===lp||n===_a)&&(s===_a||s===Pa)||(n===cp||n===Pa)&&s===Pa||s===hp||s===op||s===pC||n===uC)return vA;if(n===hp&&s===up){for(;r===op;)r=e[--A];if(r===up)return vA}if(n===Na&&s===Na){for(var o=0;r===Na;)o++,r=e[--A];if(o%2===0)return vA}return Oa},BC=function(i){var e=dC(i),t=e.length,A=0,r=0,n=e.map(gC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=vA;A<t&&(s=wC(e,n,++A))===vA;);if(s!==vA||A===t){var o=fC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},yC=function(i){for(var e=BC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},CC=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},vC=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 Mt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var g=u.x>s.x||u.y>s.y;return s=u,c===0?!0:g});return i.body.removeChild(e),o},TC=function(){return typeof new Image().crossOrigin<"u"},bC=function(){return typeof new XMLHttpRequest().responseType=="string"},xC=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},pp=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},QC=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),dp(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",pp(l)?dp(ka(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),pp(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},dp=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){return e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Rt={get SUPPORT_RANGE_BOUNDS(){var i=CC(document);return Object.defineProperty(Rt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Rt.SUPPORT_RANGE_BOUNDS&&vC(document);return Object.defineProperty(Rt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=xC(document);return Object.defineProperty(Rt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?QC(document):Promise.resolve(!1);return Object.defineProperty(Rt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=TC();return Object.defineProperty(Rt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=bC();return Object.defineProperty(Rt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Rt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Rt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Wr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),FC=function(i,e,t,A){var r=EC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Rt.SUPPORT_RANGE_BOUNDS){var l=fp(A,s,o.length).getClientRects();if(l.length>1){var c=Ka(o),u=0;c.forEach(function(B){n.push(new Wr(B,qA.fromDOMRectList(i,fp(A,u+s,B.length).getClientRects()))),u+=B.length})}else n.push(new Wr(o,qA.fromDOMRectList(i,l)))}else{var g=A.splitText(o.length);n.push(new Wr(o,UC(i,A))),A=g}else Rt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},UC=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},fp=function(i,e,t){var A=i.ownerDocument;if(!A)throw new Error("Node has no owner document");var r=A.createRange();return r.setStart(i,e),r.setEnd(i,e+t),r},Ka=function(i){if(Rt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(i)).map(function(t){return t.segment})}return yC(i)},SC=function(i,e){if(Rt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(i)).map(function(A){return A.segment})}return MC(i,e)},EC=function(i,e){return e.letterSpacing!==0?Ka(i):SC(i,e)},LC=[32,160,4961,65792,65793,4153,4241],MC=function(i,e){for(var t=nB(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){LC.indexOf(c)===-1?l+=Mt(c):(l.length&&A.push(l),A.push(Mt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},HC=(function(){function i(e,t,A){this.text=IC(t.data,A.textTransform),this.textBounds=FC(e,this.text,A,t)}return i})(),IC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(DC,_C);case 2:return i.toUpperCase();default:return i}},DC=/(^|\s|:|-|\(|\))([a-z])/g,_C=function(i,e,t){return i.length>0?e+t.toUpperCase():i},mp=(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})(VA),gp=(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})(VA),wp=(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})(VA),Bp=(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})(VA),Va=(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})(VA),PC=[{type:15,flags:0,unit:"px",number:3}],NC=[{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===KC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},xs="checkbox",Qs="radio",KC="password",yp=707406591,za=(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=PC;break;case Qs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=NC;break}return r}return e})(VA),Cp=(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})(VA),vp=(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})(VA),Tp=(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=xp(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=ui(n)?ui(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(VA),VC=["OL","UL","MENU"],Fs=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,Qp(r)&&r.data.trim().length>0)t.textNodes.push(new HC(i,r,t.styles));else if(Yi(r))if(Mp(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Fs(i,o,t,A)});else{var s=bp(i,r);s.styles.isVisible()&&(zC(r,s,A)?s.flags|=4:WC(s.styles)&&(s.flags|=2),VC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Fs(i,r.shadowRoot,s,A):!Ss(r)&&!Fp(r)&&!Es(r)&&Fs(i,r,s,A))}},bp=function(i,e){return Ga(e)?new mp(i,e):Up(e)?new gp(i,e):Fp(e)?new wp(i,e):RC(e)?new Bp(i,e):GC(e)?new Va(i,e):$C(e)?new za(i,e):Es(e)?new Cp(i,e):Ss(e)?new vp(i,e):Ep(e)?new Tp(i,e):new VA(i,e)},xp=function(i,e){var t=bp(i,e);return t.flags|=4,Fs(i,e,t,t),t},zC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ra(i)&&t.styles.isTransparent()},WC=function(i){return i.isPositioned()||i.isFloating()},Qp=function(i){return i.nodeType===Node.TEXT_NODE},Yi=function(i){return i.nodeType===Node.ELEMENT_NODE},Wa=function(i){return Yi(i)&&typeof i.style<"u"&&!Us(i)},Us=function(i){return typeof i.className=="object"},RC=function(i){return i.tagName==="LI"},GC=function(i){return i.tagName==="OL"},$C=function(i){return i.tagName==="INPUT"},XC=function(i){return i.tagName==="HTML"},Fp=function(i){return i.tagName==="svg"},Ra=function(i){return i.tagName==="BODY"},Up=function(i){return i.tagName==="CANVAS"},Sp=function(i){return i.tagName==="VIDEO"},Ga=function(i){return i.tagName==="IMG"},Ep=function(i){return i.tagName==="IFRAME"},Lp=function(i){return i.tagName==="STYLE"},JC=function(i){return i.tagName==="SCRIPT"},Ss=function(i){return i.tagName==="TEXTAREA"},Es=function(i){return i.tagName==="SELECT"},Mp=function(i){return i.tagName==="SLOT"},Hp=function(i){return i.tagName.indexOf("-")>0},ZC=(function(){function i(){this.counters={}}return i.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},i.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},i.prototype.pop=function(e){var t=this;e.forEach(function(A){return t.counters[A].pop()})},i.prototype.parse=function(e){var t=this,A=e.counterIncrement,r=e.counterReset,n=!0;A!==null&&A.forEach(function(o){var l=t.counters[o.counter];l&&o.increment!==0&&(n=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var s=[];return n&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},i})(),Ip={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"]},Dp={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},YC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},qC={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},_p=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},Ht=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(_p(Math.abs(i),n,A,function(s){return Mt(Math.floor(s%n)+e)})+r)},Ii=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return _p(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},ji=1,di=2,fi=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,di)||c===1&&l===1&&Nt(n,fi)&&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},Pp="十百千萬",Np="拾佰仟萬",Op="マイナス",$a="마이너스",Gr=function(i,e,t){var A=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=Ht(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Ii(i,"〇一二三四五六七八九",r);case 6:return qi(i,1,3999,Ip,3,A).toLowerCase();case 7:return qi(i,1,3999,Ip,3,A);case 8:return Ht(i,945,969,!1,A);case 9:return Ht(i,97,122,!1,A);case 10:return Ht(i,65,90,!1,A);case 11:return Ht(i,1632,1641,!0,A);case 12:case 49:return qi(i,1,9999,Dp,3,A);case 35:return qi(i,1,9999,Dp,3,A).toLowerCase();case 13:return Ht(i,2534,2543,!0,A);case 14:case 30:return Ht(i,6112,6121,!0,A);case 15:return Ii(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Ii(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ti(i,"零一二三四五六七八九",Pp,"負",r,di|fi|Rr);case 47:return ti(i,"零壹貳參肆伍陸柒捌玖",Np,"負",r,ji|di|fi|Rr);case 42:return ti(i,"零一二三四五六七八九",Pp,"负",r,di|fi|Rr);case 41:return ti(i,"零壹贰叁肆伍陆柒捌玖",Np,"负",r,ji|di|fi|Rr);case 26:return ti(i,"〇一二三四五六七八九","十百千万",Op,r,0);case 25:return ti(i,"零壱弐参四伍六七八九","拾百千万",Op,r,ji|di|fi);case 31:return ti(i,"영일이삼사오육칠팔구","십백천만",$a,n,ji|di|fi);case 33:return ti(i,"零一二三四五六七八九","十百千萬",$a,n,0);case 32:return ti(i,"零壹貳參四五六七八九","拾百千",$a,n,ji|di|fi);case 18:return Ht(i,2406,2415,!0,A);case 20:return qi(i,1,19999,qC,3,A);case 21:return Ht(i,2790,2799,!0,A);case 22:return Ht(i,2662,2671,!0,A);case 22:return qi(i,1,10999,YC,3,A);case 23:return Ii(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Ii(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ht(i,3302,3311,!0,A);case 28:return Ii(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Ii(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Ht(i,3792,3801,!0,A);case 37:return Ht(i,6160,6169,!0,A);case 38:return Ht(i,4160,4169,!0,A);case 39:return Ht(i,2918,2927,!0,A);case 40:return Ht(i,1776,1785,!0,A);case 43:return Ht(i,3046,3055,!0,A);case 44:return Ht(i,3174,3183,!0,A);case 45:return Ht(i,3664,3673,!0,A);case 46:return Ht(i,3872,3881,!0,A);default:return Ht(i,48,57,!0,A)}},kp="data-html2canvas-ignore",Kp=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new ZC,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return i.prototype.toIFrame=function(e,t){var A=this,r=jC(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=Av(r).then(function(){return tA(A,void 0,void 0,function(){var u,g;return Zt(this,function(B){switch(B.label){case 0:return this.scrolledElements.forEach(sv),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,g=this.clonedReferenceElement,typeof g>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:B.sent(),B.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,tv(l)]:[3,4];case 3:B.sent(),B.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,g)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(rv(document.doctype)+"<html></html>"),nv(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(Ea(e,2))debugger;if(Up(e))return this.createCanvasClone(e);if(Sp(e))return this.createVideoClone(e);if(Lp(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ga(t)&&(Ga(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Hp(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Xa(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)||!JC(t)&&!t.hasAttribute(kp)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Yi(t)||!Lp(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)&&Mp(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(Qp(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Yi(e)&&(Wa(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&&Wa(r)&&(this.clonedReferenceElement=r),Ra(r)&&lv(r);var l=this.counters.parse(new tp(this.context,n)),c=this.resolvePseudoContent(e,r,s,$r.BEFORE);Hp(e)&&(t=!0),Sp(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))&&!Ep(e)||t)&&Xa(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 tp(this.context,A));var l=new Ry(this.context,A),c=o.createElement("html2canvaspseudoelement");Xa(A,c),l.content.forEach(function(g){if(g.type===0)c.appendChild(o.createTextNode(g.value));else if(g.type===22){var B=o.createElement("img");B.src=g.value,B.style.opacity="1",c.appendChild(B)}else if(g.type===18){if(g.name==="attr"){var v=g.values.filter(wt);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(g.name==="counter"){var T=g.values.filter(Ji),y=T[0],S=T[1];if(y&&wt(y)){var F=n.counters.getCounterValue(y.value),E=S&&wt(S)?Sa.parse(n.context,S.value):3;c.appendChild(o.createTextNode(Gr(F,E,!1)))}}else if(g.name==="counters"){var k=g.values.filter(Ji),y=k[0],R=k[1],S=k[2];if(y&&wt(y)){var M=n.counters.getCounterValues(y.value),z=S&&wt(S)?Sa.parse(n.context,S.value):3,ne=R&&R.type===0?R.value:"",J=M.map(function(re){return Gr(re,z,!1)}).join(ne);c.appendChild(o.createTextNode(J))}}}else if(g.type===20)switch(g.value){case"open-quote":c.appendChild(o.createTextNode(ep(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(ep(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(g.value))}}),c.className=Ja+" "+Za;var u=r===$r.BEFORE?" "+Ja:" "+Za;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 jC=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(kp,"true"),i.body.appendChild(t),t},ev=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},tv=function(i){return Promise.all([].slice.call(i.images,0).map(ev))},Av=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)}})},iv=["all","d","content"],Xa=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);iv.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},rv=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},nv=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},sv=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},ov=":before",av=":after",Ja="___html2canvas___pseudoelement_before",Za="___html2canvas___pseudoelement_after",Vp=`{
1
+ (function(Ye,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(Ye=typeof globalThis<"u"?globalThis:Ye||self,a(Ye.ChartSDK={},Ye.jsxRuntime,Ye.React))})(this,(function(Ye,a,Y){"use strict";var Ws=typeof document<"u"?document.currentScript:null;const $t="17:00-17:00",Xt="America/New_York",HA="24x7",IA="UTC",ll={EURUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},ETHUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},BNBUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},SOLUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},ADAUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},XRPUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},DOTUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},MATICUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"},LINKUSDT:{type:"crypto",session:HA,sessionTZ:IA,priceMode:"last"}},cl={type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"};function nr(i){return i&&ll[i.toUpperCase()]||cl}function en(i){return nr(i).type==="forex"}function tn(i){return nr(i).type==="crypto"}function Hp(i){return nr(i).session==="24x7"}function ee(i){if(i==null)return null;if(typeof i=="number"){if(Number.isNaN(i)||!Number.isFinite(i))return null;let e;i>1e10?e=i/1e3:(i<1e9,e=i);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof i=="string"){const e=Date.parse(i);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof i=="object"&&"year"in i&&"month"in i&&"day"in i){const t=new Date(Date.UTC(i.year,i.month-1,i.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function Ip(i,e){if(!i||i.length<2)return[];const t=[],A=2;for(let r=1;r<i.length;r++){const n=i[r-1].time,s=i[r].time,o=s-n;o>e*A&&t.push({from:n,to:s,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(n*1e3).toISOString(),toDate:new Date(s*1e3).toISOString()})}return t}function Dp(i,e="America/New_York"){const t=new Date(i*1e3),A=new Date(t.toLocaleString("en-US",{timeZone:e})),r=A.getDay();return!(r===0||r===6||r===5&&A.getHours()>=17)}function hl(i){return Array.isArray(i)?i.map(e=>({...e,time:ee(e.time)})).filter(e=>e.time!=null):[]}function _p(i){if(!i||i.length<2)return!0;for(let e=1;e<i.length;e++)if(i[e].time<=i[e-1].time)return!1;return!0}function ke(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function ul(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(ee(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof A!="number"||!Number.isFinite(A)||typeof r!="number"||!Number.isFinite(r)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||A<t||A<n||A<r||r>t||r>n||r>A||t<=0||A<=0||r<=0||n<=0)}function dl(i){const e=s=>Math.round(s*1e5)/1e5;let t=e(i.open),A=e(i.high),r=e(i.low),n=e(i.close);return A=Math.max(A,t,n,r),r=Math.min(r,t,n,A),{...i,open:t,high:A,low:r,close:n,volume:i.volume!=null?Math.round(i.volume):i.volume}}function pl(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=ee(t.time);if(A!=null)if(e.has(A)){const r=e.get(A);e.set(A,{...t,time:A,open:t.open,high:Math.max(r.high,t.high),low:Math.min(r.low,t.low),close:t.close,volume:(r.volume||0)+(t.volume||0)})}else e.set(A,{...t,time:A})}),Array.from(e.values())}function Pp(i,e="percentile"){if(!Array.isArray(i)||i.length<3)return i;const t=i.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return i;const A=[...t].sort((s,o)=>s-o);let r,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),l=A[s],c=A[o],u=c-l;r=l-1.5*u,n=c+1.5*u}else{const s=t.reduce((c,u)=>c+u,0)/t.length,o=t.reduce((c,u)=>c+Math.pow(u-s,2),0)/t.length,l=Math.sqrt(o);if(l===0)return i;r=s-3*l,n=s+3*l}return i.map((s,o)=>{const l=s.close;if(l<r||l>n){if(o===0)return s;const c=i[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function Np(i,e){if(!Array.isArray(i)||i.length===0)return i;const t=[],A=Math.max(e*10080,604800),r=1e4;for(let o=0;o<i.length;o++)if(t.push(i[o]),o<i.length-1){const l=i[o].time,c=i[o+1].time,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const g=i[o];let B=l+e,v=0;for(B=ke(B,e);B<c&&v<r;){const b=ke(B,e);t.some(U=>U.time===b)||(t.push({time:b,open:g.close,high:g.close,low:g.close,close:g.close,volume:0}),v++),B+=e}if(B<c&&v>=r){const b=ke(c-e,e);t.some(U=>U.time===b)||t.push({time:b,open:g.close,high:g.close,low:g.close,close:g.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function uA(i){if(!i||typeof i!="string")return 60;const e=i.toUpperCase();if(e==="MN")return 2592e3;let t=e.match(/^([MHDW])(\d+)$/);if(t){const A=t[1];return parseInt(t[2],10)*({M:60,H:3600,D:86400,W:604800}[A]||60)}if(t=i.match(/^(\d+)([mhdwy])$/i),t){const A=parseInt(t[1],10),r=t[2].toLowerCase();return A*({m:60,h:3600,d:86400,w:604800,y:31536e3}[r]||60)}return 60}function fl(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=nr(e),r=uA(t),o=hl(i).map(S=>({...S,time:ke(S.time,r)})).filter(S=>ul(S)).map(S=>dl(S)),l=pl(o);l.sort((S,K)=>S.time-K.time);const c=Math.floor(Date.now()/1e3),u=l.filter(S=>S.time<=c),g=u.filter((S,K)=>K===0?!0:S.time>u[K-1].time),B=g.length>10?Pp(g,"percentile"):g,v=pl(B);v.sort((S,K)=>S.time-K.time);const b=Np(v,r),C=[];for(let S=1;S<b.length;S++){const K=b[S].time-b[S-1].time;K>r*2&&C.push({from:b[S-1].time,to:b[S].time,gapSeconds:K,gapMinutes:Math.round(K/60),fromDate:new Date(b[S-1].time*1e3).toISOString(),toDate:new Date(b[S].time*1e3).toISOString()})}const U=B.filter((S,K)=>K===0?!1:S.close===B[K-1].close&&S.open===B[K-1].close).length,F={original:i.length,processed:b.length,duplicates:i.length-l.length,outliers:U,gaps:C,filledGaps:b.length-v.length,symbolConfig:A};return{candles:b,stats:F}}function ml(i,e,t="1m"){if(!i||!e||!ul(i))return null;const A=ee(i.time);if(A==null)return null;const r=uA(t),n=ke(A,r);return dl({...i,time:n})}function gl(i,e=20,t=2){if(!i||i.length<e)return null;const A=[],r=[],n=[];for(let s=e-1;s<i.length;s++){let o=0;for(let B=s-e+1;B<=s;B++)o+=i[B].close;const l=o/e;let c=0;for(let B=s-e+1;B<=s;B++){const v=i[B].close-l;c+=v*v}const u=Math.sqrt(c/e),g=i[s].time;r.push({time:g,value:l}),A.push({time:g,value:l+t*u}),n.push({time:g,value:l-t*u})}return{upper:A,middle:r,lower:n}}function Rs(i,e=20,t=2){if(!i||i.length<e)return null;const A=i.slice(-e);let r=0;for(let c=0;c<A.length;c++)r+=A[c].close;const n=r/e;let s=0;for(let c=0;c<A.length;c++){const u=A[c].close-n;s+=u*u}const o=Math.sqrt(s/e);return{time:i[i.length-1].time,upper:n+t*o,middle:n,lower:n-t*o}}function bt(i){var e=i.width,t=i.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(t<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:t}}function wi(i,e){return i.width===e.width&&i.height===e.height}var Op=(function(){function i(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return i.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(i.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),i.prototype.subscribe=function(e){var t=this,A={next:e};return this._observers.push(A),{unsubscribe:function(){t._observers=t._observers.filter(function(r){return r!==A})}}},i.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},i.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},i.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},i.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},i})();function kp(i){return new Op(i)}var Kp=(function(){function i(e,t,A){var r;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=bt({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(r=A?.allowResizeObserver)!==null&&r!==void 0?r:!0,this._chooseAndInitObserver()}return i.prototype.dispose=function(){var e,t;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(t=this._devicePixelRatioObservable)===null||t===void 0||t.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(i.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"bitmapSize",{get:function(){return bt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=bt(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},i.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(i.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),i.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},i.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},i.prototype._resizeBitmap=function(e){var t=this.bitmapSize;wi(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},i.prototype._emitBitmapSizeChanged=function(e,t){var A=this;this._bitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,A=bt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=wi(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&wi(t,r)||(this._suggestedBitmapSize=r,this._emitSuggestedBitmapSizeChanged(t,r))},i.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var A=this;this._suggestedBitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}zp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=wl(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=kp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=wl(this._canvasElement);if(A!==null){var r=(t=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:A.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?Wp(n[0],r):bt({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(s)}}},i.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var A=t.find(function(s){return s.target===e._canvasElement});if(!(!A||!A.devicePixelContentBoxSize||!A.devicePixelContentBoxSize[0])){var r=A.devicePixelContentBoxSize[0],n=bt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function Vp(i,e){return new Kp(i,e.transform,e.options)}function wl(i){return i.ownerDocument.defaultView}function zp(){return new Promise(function(i){var e=new ResizeObserver(function(t){i(t.every(function(A){return"devicePixelContentBoxSize"in A})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function Wp(i,e){return bt({width:Math.round(i.left*e+i.width*e)-Math.round(i.left*e),height:Math.round(i.top*e+i.height*e)-Math.round(i.top*e)})}var Rp=(function(){function i(e,t,A){if(t.width===0||t.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,A.width===0||A.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=A,this._context=e}return i.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},i.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(i.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),i})();function Bi(i,e){var t=i.canvasElementClientSize;if(t.width===0||t.height===0)return null;var A=i.bitmapSize;if(A.width===0||A.height===0)return null;var r=i.canvasElement.getContext("2d",e);return r===null?null:new Rp(r,t,A)}const Gp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},$p={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Xp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Jp={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Zp={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Yp={color:"#26a69a",base:0},Bl={color:"#2196f3"},yl={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var Cl,vl;function yi(i,e){const t={0:[],1:[i.lineWidth,i.lineWidth],2:[2*i.lineWidth,2*i.lineWidth],3:[6*i.lineWidth,6*i.lineWidth],4:[i.lineWidth,4*i.lineWidth]}[e];i.setLineDash(t)}function Tl(i,e,t,A){i.beginPath();const r=i.lineWidth%2?.5:0;i.moveTo(t,e+r),i.lineTo(A,e+r),i.stroke()}function ri(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function jt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Se(i){if(i===null)throw new Error("Value is null");return i}function _i(i){return Se(jt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(Cl||(Cl={})),(function(i){i[i.Solid=0]="Solid",i[i.Dotted=1]="Dotted",i[i.Dashed=2]="Dashed",i[i.LargeDashed=3]="LargeDashed",i[i.SparseDotted=4]="SparseDotted"})(vl||(vl={}));const bl={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function wA(i){return i<0?0:i>255?255:Math.round(i)||0}function xl(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const qp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,jp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,ef=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,tf=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function sr(i){(i=i.toLowerCase())in bl&&(i=bl[i]);{const e=tf.exec(i)||ef.exec(i);if(e)return[wA(parseInt(e[1],10)),wA(parseInt(e[2],10)),wA(parseInt(e[3],10)),xl(e.length<5?1:parseFloat(e[4]))]}{const e=jp.exec(i);if(e)return[wA(parseInt(e[1],16)),wA(parseInt(e[2],16)),wA(parseInt(e[3],16)),1]}{const e=qp.exec(i);if(e)return[wA(17*parseInt(e[1],16)),wA(17*parseInt(e[2],16)),wA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function Ql(i){return .199*i[0]+.687*i[1]+.114*i[2]}function An(i){const e=sr(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Ql(e)>160?"black":"white"}}class Lt{constructor(){this.h=[]}l(e,t,A){const r={o:e,_:t,u:A===!0};this.h.push(r)}v(e){const t=this.h.findIndex((A=>e===A.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,A){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function QA(i,...e){for(const t of e)for(const A in t)t[A]!==void 0&&Object.prototype.hasOwnProperty.call(t,A)&&!["__proto__","constructor","prototype"].includes(A)&&(typeof t[A]!="object"||i[A]===void 0||Array.isArray(t[A])?i[A]=t[A]:QA(i[A],t[A]));return i}function DA(i){return typeof i=="number"&&isFinite(i)}function or(i){return typeof i=="number"&&i%1==0}function ar(i){return typeof i=="string"}function rn(i){return typeof i=="boolean"}function ZA(i){const e=i;if(!e||typeof e!="object")return e;let t,A,r;for(A in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(A)&&(r=e[A],t[A]=r&&typeof r=="object"?ZA(r):r);return t}function Af(i){return i!==null}function lr(i){return i===null?void 0:i}const Gs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Pi(i,e,t){return e===void 0&&(e=Gs),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class rf{constructor(e){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=e}W(){const e=this.k,t=this.j(),A=this.H();return e.P===t&&e.D===A||(e.P=t,e.D=A,e.R=Pi(t,A),e.L=2.5/12*t,e.B=e.L,e.A=t/12*e.T,e.I=t/12*e.T,e.N=0),e.V=this.$(),e.O=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class $s{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class FA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class nf extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const u=n.it[c],g=Math.round(u.nt*t)+s,B=u.st*A,v=l*A+s;e.moveTo(g,B),e.arc(g,B,v,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function sf(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const of={from:0,to:1};class af{constructor(e,t){this.ut=new $s,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=t,this.ut.Z(this.ct)}bt(e){const t=this.F.wt();t.length!==this.ct.length&&(this.dt=t.map(sf),this.ct=this.dt.map((A=>{const r=new nf;return r.J(A),r})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,t=this.F.wt(),A=this.vt.xt(),r=this.F.St();t.forEach(((n,s)=>{var o;const l=this.dt[s],c=n.kt(A);if(e||c===null||!n.yt())return void(l.tt=null);const u=Se(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,u.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=A,l.it[0].nt=r.It(A),l.tt=of}))}}let lf=class extends FA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*A),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*A),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,yi(e,this.zt.Lt.Nt),(function(c,u,g,B){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,g),c.lineTo(u+v,B),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,yi(e,this.zt.Et.Nt),Tl(e,l,0,t.width))}};class cf{constructor(e){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,V:"",yt:!1},Et:{et:1,Nt:0,V:"",yt:!1},nt:0,st:0},this.Wt=new lf(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),t=Se(this.jt.Ht()),A=t.$t().W().crosshair,r=this.Ft;if(A.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=A.horzLine.width,r.Et.Nt=A.horzLine.style,r.Et.V=A.horzLine.color,r.Lt.et=A.vertLine.width,r.Lt.Nt=A.vertLine.style,r.Lt.V=A.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function hf(i,e,t,A,r,n){i.fillRect(e+n,t,A-2*n,n),i.fillRect(e+n,t+r-n,A-2*n,n),i.fillRect(e,t,n,r),i.fillRect(e+A-n,t,n,r)}function nn(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function Fl(i,e,t,A,r,n){i.beginPath(),i.roundRect?i.roundRect(e,t,A,r,n):(i.lineTo(e+A-n[1],t),n[1]!==0&&i.arcTo(e+A,t,e+A,t+n[1],n[1]),i.lineTo(e+A,t+r-n[2]),n[2]!==0&&i.arcTo(e+A,t+r,e+A-n[2],t+r,n[2]),i.lineTo(e+n[3],t+r),n[3]!==0&&i.arcTo(e,t+r,e,t+r-n[3],n[3]),i.lineTo(e,t+n[0]),n[0]!==0&&i.arcTo(e,t,e+n[0],t,n[0]))}function Ul(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return Fl(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;Fl(i,e+c,t+c,A-s,r-s,(u=-c,o.map((g=>g===0?g:g+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function Sl(i,e,t,A,r,n,s){i.save(),i.globalCompositeOperation="copy";const o=i.createLinearGradient(0,0,0,r);o.addColorStop(0,n),o.addColorStop(1,s),i.fillStyle=o,i.fillRect(e,t,A,r),i.restore()}class El{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,A,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const u=this.Gt(l,t,A,r),g=u.Jt;return u.Qt?Ul(c,g.ti,g.ii,g.ni,g.si,s,g.ei,[g.ht,0,0,g.ht],s):Ul(c,g.ri,g.ii,g.ni,g.si,s,g.ei,[0,g.ht,g.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(g.ri,g.li,g.ai-g.ri,g.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(u.Qt?g.ui-g.ei:0,g.ii,g.ei,g.ci-g.ii)),u}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,g=this.zt.hi||!this.zt.mi?t.T:0,B=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,b=t.B+this.Xt.gi,C=t.A,U=t.I,F=this.zt.Kt,S=t.P,K=A.Mi(s,F),G=Math.ceil(A.xi(s,F)),M=S+v+b,W=t.C+C+U+G+g,ne=Math.max(1,Math.floor(u));let J=Math.round(M*u);J%2!=ne%2&&(J+=1);const V=B>0?Math.max(1,Math.floor(B*c)):0,ie=Math.round(W*c),re=Math.round(g*c),ce=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,Z=Math.round(ce*u)-Math.floor(.5*u),Ae=Math.floor(Z+ne/2-J/2),oe=Ae+J,le=r==="right",se=le?l.width-B:B,ae=le?o.width-V:V;let pe,we,Qe;return le?(pe=ae-ie,we=ae-re,Qe=se-g-C-B):(pe=ae+ie,we=ae+re,Qe=se+g+C),{Qt:le,Jt:{ii:Ae,li:Z,ci:oe,ni:ie,si:J,ht:2*c,ei:V,ti:pe,ri:ae,ai:we,oi:ne,ui:o.width},di:{ii:Ae/u,ci:oe/u,fi:Qe,pi:K}}}}class sn{constructor(e){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Kt:"",yt:!1,hi:!0,mi:!1,Ot:"",V:"#FFF",_i:!1,bi:!1},this.Ti={Kt:"",yt:!1,hi:!1,mi:!0,Ot:"",V:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(e||El)(this.Ci,this.yi),this.Ri=new(e||El)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(e,t=!1){return Math.max(this.Pi.At(e,t),this.Ri.At(e,t))}Vi(){return this.yi.Si||0}Oi(e){this.yi.Si=e}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(e){return this.Di(),this.Ci.hi=this.Ci.hi&&e.W().ticksVisible,this.Ti.hi=this.Ti.hi&&e.W().ticksVisible,this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Pi}Ii(){return this.Di(),this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Ri}Di(){this.ft&&(this.Ci.hi=!0,this.Ti.hi=!1,this.zi(this.Ci,this.Ti,this.yi))}}class uf extends sn{constructor(e,t,A){super(),this.jt=e,this.Li=t,this.Ei=A}zi(e,t,A){if(e.yt=!1,this.jt.W().mode===2)return;const r=this.jt.W().horzLine;if(!r.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=An(r.labelBackgroundColor);A.t=s.t,e.V=s.i;const o=2/12*this.Li.P();A.wi=o,A.gi=o;const l=this.Ei(this.Li);A.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const df=/[1-9]/g;class Ll{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const A=e.useMediaCoordinateSpace((({context:B})=>(B.font=t.R,Math.round(t.Wi.xi(B,Se(this.zt).Kt,df)))));if(A<=0)return;const r=t.ji,n=A+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const u=c+n,g=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:B,horizontalPixelRatio:v,verticalPixelRatio:b})=>{const C=Se(this.zt);B.fillStyle=C.t;const U=Math.round(c*v),F=Math.round(0*b),S=Math.round(u*v),K=Math.round(g*b),G=Math.round(2*v);if(B.beginPath(),B.moveTo(U,F),B.lineTo(U,K-G),B.arcTo(U,K,U+G,K,G),B.lineTo(S-G,K),B.arcTo(S,K,S,K-G,G),B.lineTo(S,F),B.fill(),C.hi){const M=Math.round(C.ki*v),W=F,ne=Math.round((W+t.T)*b);B.fillStyle=C.V;const J=Math.max(1,Math.floor(v)),V=Math.floor(.5*v);B.fillRect(M-V,W,J,ne-W)}})),e.useMediaCoordinateSpace((({context:B})=>{const v=Se(this.zt),b=0+t.C+t.T+t.L+t.P/2;B.font=t.R,B.textAlign="left",B.textBaseline="middle",B.fillStyle=v.V;const C=t.Wi.Mi(B,"Apr0");B.translate(c+r,b+C),B.fillText(v.Kt,0,0)}))}}class pf{constructor(e,t,A){this.ft=!0,this.Wt=new Ll,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Se(n)),e.yt=!0;const s=An(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Xs{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(e){this.Zi=e}Dt(){return this.Yi}Gi(e){this.Yi=e}Ji(e){return[]}Qi(){return[]}yt(){return!0}}var Ml;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(Ml||(Ml={}));class ff extends Xs{constructor(e,t){super(),this.tn=null,this.nn=NaN,this.sn=0,this.en=!0,this.rn=new Map,this.hn=!1,this.ln=NaN,this.an=NaN,this._n=NaN,this.un=NaN,this.$i=e,this.cn=t,this.dn=new af(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Se(this.tn).vn())return{_t:l,ki:o};{const c=Se(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new pf(this,e,A),this.wn=new cf(this)}W(){return this.cn}gn(e,t){this._n=e,this.un=t}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(e,t,A){this.hn||(this.hn=!0),this.en=!0,this.yn(e,t,A)}xt(){return this.sn}Yt(){return this.ln}Zt(){return this.an}yt(){return this.en}Cn(){this.en=!1,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn()}Pn(e){return this.tn!==null?[this.wn,this.dn]:[]}Ut(e){return e===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(e,t){this.en&&this.tn===e||this.rn.clear();const A=[];return this.tn===e&&A.push(this.Dn(this.rn,t,this.fn)),A}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach((e=>e.bt())),this.bn.bt(),this.dn.bt()}On(e){return e&&!e.vn().Ni()?e.vn():null}yn(e,t,A){this.Bn(e,t,A)&&this.Vn()}Bn(e,t,A){const r=this.ln,n=this.an,s=this.nn,o=this.sn,l=this.tn,c=this.On(A);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=A;const u=c!==null?c.Ct():null;return c!==null&&u!==null?(this.nn=t,this.an=c.Rt(t,u)):(this.nn=NaN,this.an=NaN),r!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter(Af),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,A){let r=e.get(t);return r===void 0&&(r=new uf(this,t,A),e.set(t,r)),r}}function on(i){return i==="left"||i==="right"}class Vt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(r,n){return r===void 0?n:{Fn:Math.max(r.Fn,n.Fn),Wn:r.Wn||n.Wn}})(this.zn.get(e),t);this.zn.set(e,A)}jn(){return this.En}Hn(e){const t=this.zn.get(e);return t===void 0?{Fn:this.En}:{Fn:Math.max(this.En,t.Fn),Wn:t.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(e){this.Un(),this.Ln=[{qn:1,Vt:e}]}Zn(e){this.Xn(),this.Ln.push({qn:5,Vt:e})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(e){this.Un(),this.Ln.push({qn:2,Vt:e})}Jn(e){this.Un(),this.Ln.push({qn:3,Vt:e})}Qn(){return this.Ln}ts(e){for(const t of e.Ln)this.ns(t);this.En=Math.max(this.En,e.En),e.zn.forEach(((t,A)=>{this.Nn(A,t)}))}static ss(){return new Vt(2)}static es(){return new Vt(3)}ns(e){switch(e.qn){case 0:this.$n();break;case 1:this.Yn(e.Vt);break;case 2:this.Gn(e.Vt);break;case 3:this.Jn(e.Vt);break;case 4:this.Kn();break;case 5:this.Zn(e.Vt);break;case 6:this.Xn()}}Xn(){const e=this.Ln.findIndex((t=>t.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Hl=".";function YA(i,e){if(!DA(i))return"n/a";if(!or(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?i.toString():("0000000000000000"+i.toString()).slice(-e)}class an{constructor(e,t){if(t||(t=1),DA(e)&&or(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=t,this.hs()}format(e){const t=e<0?"−":"";return e=Math.abs(e),t+this.ls(e)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let e=this.Li;for(;e>1;)e/=10,this._s++}}ls(e){const t=this.Li/this.rs;let A=Math.floor(e),r="";const n=this._s!==void 0?this._s:NaN;if(t>1){let s=+(Math.round(e*t)-A*t).toFixed(this._s);s>=t&&(s-=t,A+=1),r=Hl+YA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=Hl+YA(0,n));return A.toFixed(0)+r}}class Il extends an{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class mf{constructor(e){this.us=e}format(e){let t="";return e<0&&(t="-",e=-e),e<995?t+this.cs(e):e<999995?t+this.cs(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),t+this.cs(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),t+this.cs(e/1e9)+"B")}cs(e){let t;const A=Math.pow(10,this.us);return t=(e=Math.round(e*A)/A)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),t.replace(/(\.[1-9]*)0+$/,((r,n)=>n))}}function Dl(i,e,t,A,r,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=i,u=e[A.from];let g=n(i,u),B=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const b={nt:u.nt-v,st:u.st},C={nt:u.nt+v,st:u.st};o.moveTo(b.nt*l,b.st*c),o.lineTo(C.nt*l,C.st*c),s(i,g,b,C)}else{const v=(C,U)=>{s(i,g,B,U),o.beginPath(),g=C,B=U};let b=B;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let C=A.from+1;C<A.to;++C){b=e[C];const U=n(i,b);switch(t){case 0:o.lineTo(b.nt*l,b.st*c);break;case 1:o.lineTo(b.nt*l,e[C-1].st*c),U!==g&&(v(U,b),o.lineTo(b.nt*l,e[C-1].st*c)),o.lineTo(b.nt*l,b.st*c);break;case 2:{const[F,S]=gf(e,C-1,C);o.bezierCurveTo(F.nt*l,F.st*c,S.nt*l,S.st*c,b.nt*l,b.st*c);break}}t!==1&&U!==g&&(v(U,b),o.moveTo(b.nt*l,b.st*c))}(B!==b||B===b&&t===1)&&s(i,g,B,b)}}const _l=6;function Js(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Pl(i,e){return{nt:i.nt/e,st:i.st/e}}function gf(i,e,t){const A=Math.max(0,e-1),r=Math.min(i.length-1,t+1);var n,s;return[(n=i[e],s=Pl(Js(i[t],i[A]),_l),{nt:n.nt+s.nt,st:n.st+s.st}),Js(i[t],Pl(Js(i[r],i[e]),_l))]}function wf(i,e,t,A,r){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(r.nt*s,i*o),n.lineTo(A.nt*s,i*o),n.closePath(),n.fillStyle=t,n.fill()}class Nl extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:A,tt:r,ds:n,et:s,Nt:o,fs:l}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(r===null)return;const u=e.context;u.lineCap="butt",u.lineJoin="round",u.lineWidth=s,yi(u,o),u.lineWidth=1,Dl(e,A,l,r,n,this.bs.bind(this),wf.bind(null,c))}}function Zs(i,e,t){return Math.min(Math.max(i,e),t)}function ln(i,e,t){return e-i<=t}function Ol(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Ys{ws(e,t){const A=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==r||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==l){const u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const g=Zs(c*e.verticalPixelRatio/l,0,1);u.addColorStop(g,n),u.addColorStop(g,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class Bf extends Nl{constructor(){super(...arguments),this.Ts=new Ys}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function yf(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class kl extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,yi(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&Dl(e,t,n,A,r,u,yf),l&&(function(g,B,v,b,C){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:S}=g;let K=null;const G=Math.max(1,Math.floor(U))%2/2,M=v*F+G;for(let W=b.to-1;W>=b.from;--W){const ne=B[W];if(ne){const J=C(g,ne);J!==K&&(S.beginPath(),K!==null&&S.fill(),S.fillStyle=J,K=J);const V=Math.round(ne.nt*U)+G,ie=ne.st*F;S.moveTo(V,ie),S.arc(V,ie,M,0,2*Math.PI)}}S.fill()})(e,t,l,A,u)}}class Kl extends kl{Vs(e,t){return t.lt}}function Vl(i,e,t,A,r=0,n=e.length){let s=n-r;for(;0<s;){const o=s>>1,l=r+o;A(e[l],t)===i?(r=l+1,s-=o+1):s=o}return r}const cr=Vl.bind(null,!0),zl=Vl.bind(null,!1);function Cf(i,e){return i.ot<e}function vf(i,e){return e<i.ot}function Wl(i,e,t){const A=e.Os(),r=e.ui(),n=cr(i,A,Cf),s=zl(i,r,vf);if(!t)return{from:n,to:s};let o=n,l=s;return n>0&&n<i.length&&i[n].ot>=A&&(o=n-1),s>0&&s<i.length&&i[s-1].ot<=r&&(l=s+1),{from:o,to:l}}class qs{constructor(e,t,A){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=t,this.Fs=A}bt(e){this.Bs=!0,e==="data"&&(this.As=!0),e==="options"&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),this.Ls===null?null:this.js):null}Hs(){this.zs=this.zs.map((e=>Object.assign(Object.assign({},e),this.Es.Us().$s(e.ot))))}qs(){this.Ls=null}Ws(){this.As&&(this.Ys(),this.As=!1),this.Is&&(this.Hs(),this.Is=!1),this.Bs&&(this.Zs(),this.Bs=!1)}Zs(){const e=this.Es.Dt(),t=this.Ns.St();if(this.qs(),t.Ni()||e.Ni())return;const A=t.Xs();if(A===null||this.Es.In().Ks()===0)return;const r=this.Es.Ct();r!==null&&(this.Ls=Wl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class cn extends qs{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.te(this.zs,A,lr(this.Ls))}ie(e,t){return{ot:e,_t:t,nt:NaN,st:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>{const A=t.Vt[3];return this.se(t.ee,A,e)}))}}class Tf extends cn{constructor(e,t){super(e,t),this.js=new $s,this.re=new Bf,this.he=new Kl,this.js.Z([this.re,this.he])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W();this.re.J({fs:e.lineType,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,vs:null,ps:e.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:e.lineVisible?e.lineType:void 0,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}}class bf extends FA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),u=c-l,g=this.oe,B=u+g-1,v=Math.min(o.de,o.fe),b=Math.max(o.de,o.fe),C=Math.round(v*A)-l,U=Math.round(b*A)+l,F=Math.max(U-C,this.oe);e.fillRect(u,C,g,F);const S=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const W=c-S;let ne=Math.max(C,Math.round(o.pe*A)-l),J=ne+g-1;J>C+F-1&&(J=C+F-1,ne=J-g+1),e.fillRect(W,ne,u-W,J-ne+1)}const K=c+S;let G=Math.max(C,Math.round(o.me*A)-l),M=G+g-1;M>C+F-1&&(M=C+F-1,G=M-g+1),e.fillRect(B+1,G,K-B,M-G+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Se(this.zt).le,e)))}}class Rl extends qs{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.be(this.zs,A,lr(this.Ls))}we(e,t,A){return{ot:e,ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>this.se(t.ee,t,e)))}}class xf extends Rl{constructor(){super(...arguments),this.js=new bf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class Qf extends Nl{constructor(){super(...arguments),this.Ts=new Ys}bs(e,t){const A=this.G;return this.Ts.ws(e,{Ms:t.ke,xs:t.ye,Ss:t.Ce,ks:t.Te,ys:e.bitmapSize.height,vs:A.vs})}}class Ff extends kl{constructor(){super(...arguments),this.Pe=new Ys}Vs(e,t){const A=this.G;return this.Pe.ws(e,{Ms:t.Re,xs:t.Re,Ss:t.De,ks:t.De,ys:e.bitmapSize.height,vs:A.vs})}}class Uf extends cn{constructor(e,t){super(e,t),this.js=new $s,this.Ve=new Qf,this.Oe=new Ff,this.js.Z([this.Ve,this.Oe])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const t=this.Es.W(),A=this.Es.Dt().Rt(t.baseValue.price,e.Vt),r=this.Ns.St().le();this.Ve.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineType,vs:A,ps:!1,tt:this.Ls,ds:r}),this.Oe.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,vs:A,tt:this.Ls,ds:r})}}class Sf extends FA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),l=Math.floor(n*o*s),c=Math.floor(n*s),u=Math.min(l,c);return Math.max(Math.floor(s),u)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",l=Math.min(Math.floor(n),Math.floor(this.zt.le*n));l=Math.max(Math.floor(n),Math.min(l,this.ae));const c=Math.floor(.5*l);let u=null;for(let g=A.from;g<A.to;g++){const B=t[g];B.Ee!==o&&(r.fillStyle=B.Ee,o=B.Ee);const v=Math.round(Math.min(B.pe,B.me)*s),b=Math.round(Math.max(B.pe,B.me)*s),C=Math.round(B.de*s),U=Math.round(B.fe*s);let F=Math.round(n*B.nt)-c;const S=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,S));const K=S-F+1;r.fillRect(F,C,K,v-C),r.fillRect(F,b+1,K,U-b),u=S}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const A=Math.max(Math.floor(e),t);return this.ae<=2*A?Math.max(Math.floor(e),Math.floor(1*e)):A}Ie(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let u=A.from;u<A.to;u++){const g=t[u];g.Ne!==o&&(r.fillStyle=g.Ne,o=g.Ne);let B=Math.round(g.nt*n)-Math.floor(.5*this.ae);const v=B+this.ae-1,b=Math.round(Math.min(g.pe,g.me)*s),C=Math.round(Math.max(g.pe,g.me)*s);if(c!==null&&(B=Math.max(c+1,B),B=Math.min(B,v)),this.zt.le*n>2*l)hf(r,B,b,v-B+1,C-b+1,l);else{const U=v-B+1;r.fillRect(B,b,U,C-b+1)}c=v}}Le(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=A.from;c<A.to;c++){const u=t[c];let g=Math.round(Math.min(u.pe,u.me)*s),B=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),b=v+this.ae-1;if(u.ce!==o){const C=u.ce;r.fillStyle=C,o=C}this.zt._i&&(v+=l,g+=l,b-=l,B-=l),g>B||r.fillRect(v,g,b-v+1,B-g+1)}}}class Ef extends Rl{constructor(){super(...arguments),this.js=new Sf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class Lf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class js extends qs{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new Lf(this.wn.renderer(),(r=>{const n=e.Ct();return n===null?null:e.Dt().Rt(r,n.Vt)}))}We(e){return this.wn.priceValueBuilder(e)}je(e){return this.wn.isWhitespace(e)}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>Object.assign(Object.assign({ot:t.ee,nt:NaN},e.$s(t.ee)),{He:t.$e})))}Gs(e,t){t.Qs(this.zs,lr(this.Ls))}Js(){this.wn.update({bars:this.zs.map(Mf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Mf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class Hf extends FA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],u=Math.round(l.st*A);let g,B;e.fillStyle=l.ce,u<=n?(g=u,B=s):(g=n,B=u-Math.floor(r/2)+r),e.fillRect(c.Os,g,c.ui-c.Os+1,B-g)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,c;if(A%2){const u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class If extends cn{constructor(){super(...arguments),this.js=new Hf}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,Se(this.Es.Ct()).Vt)};this.js.J(e)}}class Df extends cn{constructor(){super(...arguments),this.js=new Kl}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W(),t={it:this.zs,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,et:e.lineWidth,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(t)}}const _f=/[2-9]/g;class hr{constructor(e=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=e}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(e,t,A){return this.sr(e,t,A).width}Mi(e,t,A){const r=this.sr(e,t,A);return((r.actualBoundingBoxAscent||0)-(r.actualBoundingBoxDescent||0))/2}sr(e,t,A){const r=A||_f,n=String(t).replace(r,"0");if(this.tr.has(n))return jt(this.tr.get(n)).er;if(this.Ke===this.ir){const o=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(o),this.Je++,this.Ke--}e.save(),e.textBaseline="middle";const s=e.measureText(n);return e.restore(),s.width===0&&t.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class Pf{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,t,A){this.hr=e,this.k=t,this.lr=A}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class Gl{constructor(e,t,A){this.ur=e,this.ar=new hr(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new Pf(this.ar)}gt(){const e=this.F.dr(this.cr);if(e===null)return null;const t=e.vr(this.cr)?e.pr():this.cr.Dt();if(t===null)return null;const A=e.mr(t);if(A==="overlay")return null;const r=this.F.br();return r.P!==this.j&&(this.j=r.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),r,A),this.Wt}}class Nf extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var A;if(!(!((A=this.zt)===null||A===void 0)&&A.yt))return null;const{st:r,et:n,gr:s}=this.zt;return t>=r-n-7&&t<=r+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*r);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),yi(e,this.zt.Nt),Tl(e,n,0,t.width))}}class eo{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new Nf,this.ft=!0,this.Es=e,this.Ns=e.$t(),this.kr.J(this.Sr)}bt(){this.ft=!0}gt(){return this.Es.yt()?(this.ft&&(this.yr(),this.ft=!1),this.kr):null}}class Of extends eo{constructor(e){super(e)}yr(){this.Sr.yt=!1;const e=this.Es.Dt(),t=e.Cr().Cr;if(t!==2&&t!==3)return;const A=this.Es.W();if(!A.baseLineVisible||!this.Es.yt())return;const r=this.Es.Ct();r!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(r.Vt,r.Vt),this.Sr.V=A.baseLineColor,this.Sr.et=A.baseLineWidth,this.Sr.Nt=A.baseLineStyle)}}class kf extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){const r=this.zt;if(r===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(r.Xe.x*t)+s,l=r.Xe.y*A;e.fillStyle=r.Tr,e.beginPath();const c=Math.max(2,1.5*r.Pr)*t;e.arc(o,l,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=r.Rr,e.beginPath(),e.arc(o,l,r.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=r.Dr,e.beginPath(),e.arc(o,l,r.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const Kf=[{Vr:0,Or:.25,Br:4,Ar:10,Ir:.25,zr:0,Lr:.4,Er:.8},{Vr:.25,Or:.525,Br:10,Ar:14,Ir:0,zr:0,Lr:.8,Er:0},{Vr:.525,Or:1,Br:14,Ar:14,Ir:0,zr:0,Lr:0,Er:0}];function $l(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=sr(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Xl(i,e){const t=i%2600/2600;let A;for(const l of Kf)if(t>=l.Vr&&t<=l.Or){A=l;break}ri(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:$l(e,r,A.Ir,A.zr),Dr:$l(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class Vf{constructor(e){this.Wt=new kf,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=e}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),this.jr.W().lastPriceAnimation===2){const e=performance.now(),t=this.Wr-e;if(t>0)return void(t<650&&(this.Wr+=2600));this.Fr=e,this.Wr=e+2600}}bt(){this.ft=!0}Ur(){this.Nr=!0}yt(){return this.jr.W().lastPriceAnimation!==0}qr(){switch(this.jr.W().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.Wr}}gt(){return this.ft?(this.Mt(),this.ft=!1,this.Nr=!1):this.Nr&&(this.Yr(),this.Nr=!1),this.Wt}Mt(){this.Wt.J(null);const e=this.jr.$t().St(),t=e.Xs(),A=this.jr.Ct();if(t===null||A===null)return;const r=this.jr.Zr(!0);if(r.Xr||!t.Kr(r.ee))return;const n={x:e.It(r.ee),y:this.jr.Dt().Rt(r._t,A.Vt)},s=r.V,o=this.jr.W().lineWidth,l=Xl(this.Gr(),s);this.Wt.J({Tr:s,Pr:o,Rr:l.Rr,Dr:l.Dr,ht:l.ht,Xe:n})}Yr(){const e=this.Wt.$e();if(e!==null){const t=Xl(this.Gr(),e.Tr);e.Rr=t.Rr,e.Dr=t.Dr,e.ht=t.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function ur(i,e){return Ol(Math.min(Math.max(i,12),30)*e)}function dr(i,e){switch(i){case"arrowDown":case"arrowUp":return ur(e,1);case"circle":return ur(e,.8);case"square":return ur(e,.7)}}function Jl(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(ur(i,1))}function Zl(i){return Math.max(ur(i,.1),3)}function Yl(i,e,t){return e?i:t?Math.ceil(i/2):0}function ql(i,e,t,A,r){const n=dr("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function jl(i,e,t,A){const r=(dr("arrowUp",A)-1)/2*t.Jr,n=(Ol(A/2)-1)/2*t.Jr;e.beginPath(),i?(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st-r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+r),e.lineTo(t.nt-n,t.st+r),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st+r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-r),e.lineTo(t.nt-n,t.st-r),e.lineTo(t.nt-n,t.st)),e.fill()}function zf(i,e,t,A,r,n){return ql(e,t,A,r,n)}class Wf extends FA{constructor(){super(...arguments),this.zt=null,this.ar=new hr,this.j=-1,this.H="",this.Qr=""}J(e){this.zt=e}_r(e,t){this.j===e&&this.H===t||(this.j=e,this.H=t,this.Qr=Pi(e,t),this.ar.nr())}wr(e,t){if(this.zt===null||this.zt.tt===null)return null;for(let A=this.zt.tt.from;A<this.zt.tt.to;A++){const r=this.zt.it[A];if(Gf(r,e,t))return{Mr:r.th,gr:r.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A},r,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),Rf(o,e,t,A)}}}}function Rf(i,e,t,A){e.fillStyle=i.V,i.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,i.Kt.ih,i.Kt.nt,i.Kt.st,t,A),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void jl(!1,n,s,r.Ks);case"arrowUp":return void jl(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(dr("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,u*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const u=dr("square",c),g=(u-1)*l.Jr/2,B=l.nt-g,v=l.st-g;o.fillRect(B,v,u*l.Jr,u*l.Jr)})(n,s,r.Ks)}r.nh}})(i,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(i,t,A))}function Gf(i,e,t){return!(i.Kt===void 0||!(function(A,r,n,s,o,l){const c=s/2;return o>=A&&o<=A+n&&l>=r-c&&l<=r+c})(i.Kt.nt,i.Kt.st,i.Kt.Hi,i.Kt.At,e,t))||(function(A,r,n){if(A.Ks===0)return!1;switch(A.nh){case"arrowDown":case"arrowUp":return zf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const g=2+dr("circle",l)/2,B=s-c,v=o-u;return Math.sqrt(B*B+v*v)<=g})(A.nt,A.st,A.Ks,r,n);case"square":return ql(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function $f(i,e,t,A,r,n,s,o,l){const c=DA(t)?t:t.Se,u=DA(t)?t:t.Me,g=DA(t)?t:t.xe,B=DA(e.size)?Math.max(e.size,0):1,v=Jl(o.le())*B,b=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-b-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-b-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(g,l)+b+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class Xf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Wf,this.jr=e,this.$i=t,this.zt={it:[],tt:null}}bt(e){this.ft=!0,this.hh=!0,e==="data"&&(this.rh=!0,this.oh=null)}gt(e){if(!this.jr.yt())return null;this.ft&&this._h();const t=this.$i.W().layout;return this.Wt._r(t.fontSize,t.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const e=this.$i.St().le(),t=Zl(e),A=1.5*Jl(e)+2*t,r=this.fh();this.ah={above:Yl(A,r.aboveBar,r.inBar),below:Yl(A,r.belowBar,r.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),t=this.$i.St(),A=this.jr.dh();this.rh&&(this.zt.it=A.map((u=>({ot:u.time,nt:0,st:0,Ks:0,nh:u.shape,V:u.color,th:u.th,gr:u.id,Kt:void 0}))),this.rh=!1);const r=this.$i.W().layout;this.zt.tt=null;const n=t.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=Zl(t.le()),c={sh:l,eh:l};this.zt.tt=Wl(this.zt.it,n,!0);for(let u=this.zt.tt.from;u<this.zt.tt.to;u++){const g=A[u];g.time!==o&&(c.sh=l,c.eh=l,o=g.time);const B=this.zt.it[u];B.nt=t.It(g.time),g.text!==void 0&&g.text.length>0&&(B.Kt={ih:g.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(g.time);v!==null&&$f(B,g,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Jf extends eo{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const t=this.Es.W();if(!t.priceLineVisible||!this.Es.yt())return;const A=this.Es.Zr(t.priceLineSource===0);A.Xr||(e.yt=!0,e.st=A.ki,e.V=this.Es.mh(A.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class Zf extends sn{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const u=r.mh(c.V),g=An(u);A.t=g.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=g.i,t.V=g.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function ec(i,e,t,A){const r=Number.isFinite(e),n=Number.isFinite(t);return r&&n?i(e,t):r||n?r?e:t:A}class rA{constructor(e,t){this.kh=e,this.yh=t}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new rA(this.kh,this.yh)}Ph(){return this.kh}Rh(){return this.yh}Dh(){return this.yh-this.kh}Ni(){return this.yh===this.kh||Number.isNaN(this.yh)||Number.isNaN(this.kh)}ts(e){return e===null?this:new rA(ec(Math.min,this.Ph(),e.Ph(),-1/0),ec(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!DA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let A=this.yh-t,r=this.kh-t;A*=e,r*=e,this.yh=t+A,this.kh=t+r}Oh(e){DA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new rA(e.minValue,e.maxValue)}}class hn{constructor(e,t){this.Ih=e,this.zh=t||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return this.Ih===null?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(e){return e===null?null:new hn(rA.Ah(e.priceRange),e.margins)}}class Yf extends eo{constructor(e,t){super(e),this.Nh=t}yr(){const e=this.Sr;e.yt=!1;const t=this.Nh.W();if(!this.Es.yt()||!t.lineVisible)return;const A=this.Nh.Fh();A!==null&&(e.yt=!0,e.st=A,e.V=t.color,e.et=t.lineWidth,e.Nt=t.lineStyle,e.gr=this.Nh.W().id)}}class qf extends sn{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.Nh.W(),n=r.axisLabelVisible,s=r.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(t.Kt=r.title,t.yt=!0),t.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(r.price),e.yt=!0;const c=An(r.axisLabelColor||r.color);A.t=c.t;const u=r.axisLabelTextColor||c.i;e.V=u,t.V=u,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class jf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Yf(e,this),this.ur=new qf(e,this),this.Hh=new Gl(this.ur,e,e.$t())}$h(e){QA(this.cn,e),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const e=this.jr,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const A=e.Ct();return A===null?null:t.Rt(this.cn.price,A.Vt)}}class e0 extends Xs{constructor(e){super(),this.$i=e}$t(){return this.$i}}const t0={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Se(i(t,A)),l=_i(o.Vt[0])<=_i(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,u=e.borderDownColor,g=e.wickUpColor,B=e.wickDownColor,v=Se(i(t,A)),b=_i(v.Vt[0])<=_i(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:b?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:b?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:b?g:B}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Se(i(t,A));return{ce:(r=l.lt)!==null&&r!==void 0?r:e.lineColor,lt:(n=l.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=l.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=l.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(i,e,t,A)=>{var r,n,s,o,l,c;const u=Se(i(t,A));return{ce:u.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=u.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=u.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=u.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=u.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=u.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=u.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Se(i(t,A));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class A0{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=t0[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var tc;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(tc||(tc={}));const ni=30;class i0{constructor(){this.tl=[],this.il=new Map,this.nl=new Map}sl(){return this.Ks()>0?this.tl[this.tl.length-1]:null}el(){return this.Ks()>0?this.rl(0):null}An(){return this.Ks()>0?this.rl(this.tl.length-1):null}Ks(){return this.tl.length}Ni(){return this.Ks()===0}Kr(e){return this.hl(e,0)!==null}Gh(e){return this.ll(e)}ll(e,t=0){const A=this.hl(e,t);return A===null?null:Object.assign(Object.assign({},this.al(A)),{ee:this.rl(A)})}ne(){return this.tl}ol(e,t,A){if(this.Ni())return null;let r=null;for(const n of A)r=un(r,this._l(e,t,n));return r}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,t){const A=this.ul(e);if(A===null&&t!==0)switch(t){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return A}cl(e){let t=this.fl(e);return t>0&&(t-=1),t!==this.tl.length&&this.rl(t)<e?t:null}dl(e){const t=this.vl(e);return t!==this.tl.length&&e<this.rl(t)?t:null}ul(e){const t=this.fl(e);return t===this.tl.length||e<this.tl[t].ee?null:t}fl(e){return cr(this.tl,e,((t,A)=>t.ee<A))}vl(e){return zl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,A){if(this.Ni())return null;let r=null;const n=Se(this.el()),s=Se(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/ni)*ni,u=Math.max(c,Math.floor(l/ni)*ni);{const B=this.fl(o),v=this.vl(Math.min(l,c,t));r=un(r,this.pl(B,v,A))}let g=this.il.get(A);g===void 0&&(g=new Map,this.il.set(A,g));for(let B=Math.max(c+1,o);B<u;B+=ni){const v=Math.floor(B/ni);let b=g.get(v);if(b===void 0){const C=this.fl(v*ni),U=this.vl((v+1)*ni-1);b=this.pl(C,U,A),g.set(v,b)}r=un(r,b)}{const B=this.fl(u),v=this.vl(l);r=un(r,this.pl(B,v,A))}return r}}function un(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class r0{constructor(e){this.wl=e}X(e,t,A){this.wl.draw(e)}gl(e,t,A){var r,n;(n=(r=this.wl).drawBackground)===null||n===void 0||n.call(r,e)}}class to{constructor(e){this.tr=null,this.wn=e}gt(){var e;const t=this.wn.renderer();if(t===null)return null;if(((e=this.tr)===null||e===void 0?void 0:e.Ml)===t)return this.tr.xl;const A=new r0(t);return this.tr={Ml:t,xl:A},A}Sl(){var e,t,A;return(A=(t=(e=this.wn).zOrder)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:"normal"}}function Ac(i){var e,t,A,r,n;return{Kt:i.text(),ki:i.coordinate(),Si:(e=i.fixedCoordinate)===null||e===void 0?void 0:e.call(i),V:i.textColor(),t:i.backColor(),yt:(A=(t=i.visible)===null||t===void 0?void 0:t.call(i))===null||A===void 0||A,hi:(n=(r=i.tickVisible)===null||r===void 0?void 0:r.call(i))===null||n===void 0||n}}class n0{constructor(e,t){this.Wt=new Ll,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Ac(this.kl))),this.Wt}}class s0 extends sn{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Ac(this.kl);A.t=r.t,e.V=r.V;const n=2/12*this.Li.P();A.wi=n,A.gi=n,A.ki=r.ki,A.Si=r.Si,e.Kt=r.Kt,e.yt=r.yt,e.hi=r.hi}}class o0{constructor(e,t){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=e,this.jr=t}Ol(){return this.Vl}Vn(){var e,t;(t=(e=this.Vl).updateAllViews)===null||t===void 0||t.call(e)}Pn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Cl)===null||r===void 0?void 0:r.Ml)===n)return this.Cl.xl;const s=n.map((o=>new to(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Tl)===null||r===void 0?void 0:r.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((l=>new n0(l,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Pl)===null||r===void 0?void 0:r.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((l=>new s0(l,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Rl)===null||r===void 0?void 0:r.Ml)===n)return this.Rl.xl;const s=n.map((o=>new to(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Dl)===null||r===void 0?void 0:r.Ml)===n)return this.Dl.xl;const s=n.map((o=>new to(o)));return this.Dl={Ml:n,xl:s},s}Il(e,t){var A,r,n;return(n=(r=(A=this.Vl).autoscaleInfo)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}wr(e,t){var A,r,n;return(n=(r=(A=this.Vl).hitTest)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}}function Ao(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function io(i){return i.Pn()}function a0(i){return i.Bl()}function l0(i){return i.Al()}class ro extends e0{constructor(e,t,A,r,n){super(e),this.zt=new i0,this.jh=new Jf(this),this.zl=[],this.Ll=new Of(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=t,this.$l=A;const s=new Zf(this);this.rn=[s],this.Hh=new Gl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new Vf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},A=this.Dt();if(this.$t().St().Ni()||A.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const g=this.zt.sl();if(g===null)return t;s=g,o=g.ee}else{const g=this.zt.ll(r.ui(),-1);if(g===null||(s=this.zt.Gh(g.ee),s===null))return t;o=g.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),u=A.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:A.Fi(l,n.Vt),xh:A.Yl(l),Sh:A.Zl(l,n.Vt),V:c.ce,ki:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new A0(this)),this.Nl}W(){return this.cn}$h(e){const t=e.priceScaleId;t!==void 0&&t!==this.cn.priceScaleId&&this.$t().Xl(this,t),QA(this.cn,e),e.priceFormat!==void 0&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(e,t){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(t&&t.ta?this.El.$r():e.length===0&&this.El.Hr());const A=this.$t().dr(this);this.$t().ia(A),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const t=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const t=new jf(this,e);return this.zl.push(t),this.$t().Gl(this),t}ra(e){const t=this.zl.indexOf(e);t!==-1&&this.zl.splice(t,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const e=this.ha();return e===null?null:{Vt:e.Vt[3],la:e.ot}}ha(){const e=this.$t().St().Xs();if(e===null)return null;const t=e.Os();return this.zt.ll(t,1)}In(){return this.zt}ph(e){const t=this.zt.Gh(e);return t===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3]}:t.Vt[3]}aa(e){const t=[];Ao(this.Hl,io,"top",t);const A=this.El;return A!==null&&A.yt()&&(this.jl===null&&A.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),A.Ur(),t.unshift(A)),t}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const t=this.zl.map((A=>A.qh()));return e.push(...t),Ao(this.Hl,io,"normal",e),e}ua(){return this.ca(io,"bottom")}da(e){return this.ca(a0,e)}fa(e){return this.ca(l0,e)}va(e,t){return this.Hl.map((A=>A.wr(e,t))).filter((A=>A!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const A=[...this.rn];for(const r of this.zl)A.push(r.Zh());return this.Hl.forEach((r=>{A.push(...r.Rn())})),A}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const A=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return hn.Ah(A)}return this.pa(e,t)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return Se(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new o0(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof js)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof js)return e=>this.wn.je(e)}_a(){return!on(this.Dt().Pa())}pa(e,t){if(!or(e)||!or(t)||this.zt.Ni())return null;const A=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],r=this.zt.ol(e,t,A);let n=r!==null?new rA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new rA(o,o);n=n!==null?n.ts(l):l}let s=this.dn.uh();return this.Hl.forEach((o=>{const l=o.Il(e,t);if(l?.priceRange){const v=new rA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,g,B;l?.margins&&(c=s,u=l.margins,s={above:Math.max((g=c?.above)!==null&&g!==void 0?g:0,u.above),below:Math.max((B=c?.below)!==null&&B!==void 0?B:0,u.below)})})),new hn(n,s)}ga(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}Ma(){switch(this.$l){case"Line":case"Area":case"Baseline":{const e=this.cn.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(e){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(t.length!==0)return t}}return this.Us().$s(e).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new mf(this.cn.priceFormat.precision);break;case"percent":this.wa=new Il(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new an(e,this.cn.priceFormat.minMove*e)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const e=this.$t().St();if(!e.Da()||this.zt.Ni())return void(this.Wl=[]);const t=Se(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Se(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Se(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:r,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new Xf(this,this.$t()),this.$l){case"Bar":this.wn=new xf(this,this.$t());break;case"Candlestick":this.wn=new Ef(this,this.$t());break;case"Line":this.wn=new Df(this,this.$t());break;case"Custom":this.wn=new js(this,this.$t(),jt(e));break;case"Area":this.wn=new Tf(this,this.$t());break;case"Baseline":this.wn=new Uf(this,this.$t());break;case"Histogram":this.wn=new If(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return Ao(this.Hl,e,t,A),A}}class c0{constructor(e){this.cn=e}Oa(e,t,A){let r=e;if(this.cn.mode===0)return r;const n=A.vn(),s=n.Ct();if(s===null)return r;const o=n.Rt(e,s),l=A.Ba().filter((u=>u instanceof ro)).reduce(((u,g)=>{if(A.vr(g)||!g.yt())return u;const B=g.Dt(),v=g.In();if(B.Ni()||!v.Kr(t))return u;const b=v.Gh(t);if(b===null)return u;const C=_i(g.Ct());return u.concat([B.Rt(b.Vt[3],C.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,g)=>Math.abs(u-o)-Math.abs(g-o)));const c=l[0];return r=n.pn(c,s),r}}class h0 extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(A));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Se(this.zt);if(s.Aa){e.strokeStyle=s.Ia,yi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*A);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,yi(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*r);e.moveTo(-n,l),e.lineTo(t.width+n,l)}e.stroke()}}))}}class u0{constructor(e){this.Wt=new h0,this.ft=!0,this.tn=e}bt(){this.ft=!0}gt(){if(this.ft){const e=this.tn.$t().W().grid,t={Na:e.horzLines.visible,Aa:e.vertLines.visible,Fa:e.horzLines.color,Ia:e.vertLines.color,Wa:e.horzLines.style,za:e.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map((A=>({Ea:A.coord})))};this.Wt.J(t),this.ft=!1}return this.Wt}}class d0{constructor(e){this.wn=new u0(e)}qh(){return this.wn}}const no={$a:4,Ua:1e-4};function Ni(i,e){const t=100*(i-e)/e;return e<0?-t:t}function p0(i,e){const t=Ni(i.Ph(),e),A=Ni(i.Rh(),e);return new rA(t,A)}function pr(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function f0(i,e){const t=pr(i.Ph(),e),A=pr(i.Rh(),e);return new rA(t,A)}function dn(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.log10(t+e.Ua)+e.$a;return i<0?-A:A}function fr(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.pow(10,t-e.$a)-e.Ua;return i<0?-A:A}function mr(i,e){if(i===null)return null;const t=dn(i.Ph(),e),A=dn(i.Rh(),e);return new rA(t,A)}function pn(i,e){if(i===null)return null;const t=fr(i.Ph(),e),A=fr(i.Rh(),e);return new rA(t,A)}function so(i){if(i===null)return no;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return no;const t=Math.ceil(Math.abs(Math.log10(e))),A=no.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class oo{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let r=A;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let A=this.qa;A!==1;){if(A%2==0)this.Za.push(2),A/=2;else{if(A%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),A/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,A){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const g=ln(n,r,1e-14)&&n>r+1e-14,B=ln(n,A*o,1e-14),v=ln(n,1,1e-14);if(!(g&&B&&v))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];ln(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,u;return n}}class ic{constructor(e,t,A,r){this.Ka=[],this.Li=e,this.qa=t,this.Ga=A,this.Ja=r}Xa(e,t){if(e<t)throw new Error("high < low");const A=this.Li.At(),r=(e-t)*this.Qa()/A,n=new oo(this.qa,[2,2.5,2]),s=new oo(this.qa,[2,2,2.5]),o=new oo(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let u=c[0];for(let g=1;g<c.length;++g)c[g]<u&&(u=c[g]);return u})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),r=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=A-1-s,c=Math.max(r,n),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let g=this.Xa(c,u),B=c%g;B+=B<0?g:0;const v=c>=u?1:-1;let b=null,C=0;for(let U=c-B;U>u;U-=g){const F=this.Ja(U,t,!0);b!==null&&Math.abs(F-b)<this.Qa()||F<o||F>l||(C<this.Ka.length?(this.Ka[C].Ea=F,this.Ka[C].so=e.eo(U)):this.Ka.push({Ea:F,so:e.eo(U)}),C++,b=F,e.ro()&&(g=this.Xa(U*v,u)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function rc(i){return i.slice().sort(((e,t)=>Se(e.Xi())-Se(t.Xi())))}var nc;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(nc||(nc={}));const sc=new Il,oc=new an(100,1);class m0{constructor(e,t,A,r){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new Lt,this.vo=new Lt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=oc,this.xo=so(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new ic(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(QA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=jt(e.scaleMargins.top),A=jt(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(A<0||A>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${A}`);if(t+A>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+A}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return this.cn.mode===1}Mh(){return this.cn.mode===2}Oo(){return this.cn.mode===3}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(e){const t=this.Cr();let A=null;e.Wn!==void 0&&(this.cn.autoScale=e.Wn),e.Cr!==void 0&&(this.cn.mode=e.Cr,e.Cr!==2&&e.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),t.Cr===1&&e.Cr!==t.Cr&&((function(n,s){if(n===null)return!1;const o=fr(n.Ph(),s),l=fr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=pn(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=mr(this.Ih,this.xo),A!==null&&this.Ao(A));const r=t.Cr!==this.cn.mode;r&&(t.Cr===2||this.Mh())&&this.Ra(),r&&(t.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&t.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(t,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(e){this.ho!==e&&(this.ho=e,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const e=this.At()-this.No()-this.Fo();return this.lo=e,e}Lh(){return this.Wo(),this.Ih}Ao(e,t){const A=this.Ih;(t||A===null&&e!==null||A!==null&&!A.Ch(e))&&(this.bo=null,this.Ih=e)}Ni(){return this.Wo(),this.ho===0||!this.Ih||this.Ih.Ni()}jo(e){return this.Bo()?e:this.At()-1-e}Rt(e,t){return this.Mh()?e=Ni(e,t):this.Oo()&&(e=pr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),g=A===void 0?0:A.from,B=A===void 0?e.length:A.to,v=this.Ho();for(let b=g;b<B;b++){const C=e[b],U=C._t;if(isNaN(U))continue;let F=U;v!==null&&(F=v(C._t,t));const S=r+u*(F-s),K=c?S:this.ho-1-S;C.st=K}}be(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),g=A===void 0?0:A.from,B=A===void 0?e.length:A.to,v=this.Ho();for(let b=g;b<B;b++){const C=e[b];let U=C.ge,F=C.Me,S=C.xe,K=C.Se;v!==null&&(U=v(C.ge,t),F=v(C.Me,t),S=v(C.xe,t),K=v(C.Se,t));let G=r+u*(U-s),M=c?G:this.ho-1-G;C.pe=M,G=r+u*(F-s),M=c?G:this.ho-1-G,C.de=M,G=r+u*(S-s),M=c?G:this.ho-1-G,C.fe=M,G=r+u*(K-s),M=c?G:this.ho-1-G,C.me=M}}pn(e,t){const A=this.To(e,t);return this.$o(A,t)}$o(e,t){let A=e;return this.Mh()?A=(function(r,n){return n<0&&(r=-r),r/100*n+n})(A,t):this.Oo()&&(A=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(A,t)),A}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const A=this.po[t];A.Xi()===null&&A.Ki(t+1),e.push(A)}return e=rc(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const A=t.Ct();A!==null&&(e===null||A.la<e.la)&&(e=A)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=Se(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const A=Se(this.ao).Th();t=Math.max(t,.1),A.Vh(t),this.Ao(A)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=Se(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Se(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Se(this.ao).Th();n.Oh(r),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(Ni(e,t));case 3:return this.ba().format(pr(e,t));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,Se(this.e_()).ba())}Zl(e,t){return e=Ni(e,t),this.s_(e,sc)}r_(){return this.po}h_(e){this.oo={uo:e,_o:!1}}Vn(){this.po.forEach((e=>e.Vn()))}Ra(){this.bo=null;const e=this.e_();let t=100;e!==null&&(t=Math.round(1/e.ma())),this.wa=oc,this.Mh()?(this.wa=sc,t=100):this.Oo()?(this.wa=new an(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new ic(this,t,this.To.bind(this),this.Po.bind(this)),this.Co.io()}Yo(){this.mo=null}e_(){return this.po[0]||null}No(){return this.Bo()?this.cn.scaleMargins.bottom*this.At()+this.do:this.cn.scaleMargins.top*this.At()+this.co}Fo(){return this.Bo()?this.cn.scaleMargins.top*this.At()+this.co:this.cn.scaleMargins.bottom*this.At()+this.do}Wo(){this.oo._o||(this.oo._o=!0,this.l_())}Do(){this.lo=null}Po(e,t){if(this.Wo(),this.Ni())return 0;e=this.ro()&&e?dn(e,this.xo):e;const A=Se(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),r=Se(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?fr(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const A=this.r_();let r=0,n=0;for(const l of A){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const u=l.Il(e.Os(),e.ui());let g=u&&u.Lh();if(g!==null){switch(this.cn.mode){case 1:g=mr(g,this.xo);break;case 2:g=p0(g,c.Vt);break;case 3:g=f0(g,c.Vt)}if(t=t===null?g:t.ts(Se(g)),u!==null){const B=u.Eh();B!==null&&(r=Math.max(r,B.above),n=Math.max(n,B.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=pn(t,this.xo)),t=new rA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=mr(t,this.xo))}if(this.ro()){const l=pn(t,this.xo),c=so(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?pn(this.ao,this.xo):null;this.xo=c,t=mr(l,c),u!==null&&(this.ao=mr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new rA(-.5,.5)),this.xo=so(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ni:this.Oo()?pr:this.ro()?e=>dn(e,this.xo):null}a_(e,t,A){return t===void 0?(A===void 0&&(A=this.ba()),A.format(e)):t(e)}Wh(e,t){return this.a_(e,this.yo.priceFormatter,t)}s_(e,t){return this.a_(e,this.yo.percentageFormatter,t)}}class g0{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Lt,this.yl=e,this.$i=t,this.d_=new d0(this);const A=t.W();this.f_=this.v_("left",A.leftPriceScale),this.p_=this.v_("right",A.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(A)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const t=Array.from(this.o_.values());for(const A of t){const r=Se(A[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?jt(this.o_.get(e))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((e=>{e.S&&e.S()})),this.c_.m()}M_(){return this.u_}x_(e){this.u_=e}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(e){this.__=e,this.k_()}Lo(e){this.ho=e,this.f_.Lo(e),this.p_.Lo(e),this.po.forEach((t=>{if(this.vr(t)){const A=t.Dt();A!==null&&A.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const t=e.Dt();return t===null||this.f_!==t&&this.p_!==t}qo(e,t,A){const r=A!==void 0?A:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ri(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Se(e.Dt()).Pa();if(this.o_.has(A)){const n=jt(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const r=e.Dt();r&&r.Ba().indexOf(e)>=0&&r.Zo(e),r!==null&&(r.Yo(),this.P_(r)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,t){e.Go(t)}O_(e,t){e.Jo(t),this.k_()}B_(e){e.Qo()}A_(e,t){e.t_(t)}I_(e,t){e.i_(t),this.k_()}z_(e){e.n_()}k_(){this.po.forEach((e=>{e.Vn()}))}vn(){let e=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?e=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?e=this.f_:this.po.length!==0&&(e=this.po[0].Dt()),e===null&&(e=this.p_),e}pr(){let e=null;return this.$i.W().rightPriceScale.visible?e=this.p_:this.$i.W().leftPriceScale.visible&&(e=this.f_),e}P_(e){e!==null&&e.Vo()&&this.L_(e)}E_(e){const t=this.yl.Xs();e.Ro({Wn:!0}),t!==null&&e.h_(t),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((e=>{this.vr(e)&&this.P_(e.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=rc(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const t=e.r_();if(t&&t.length>0&&!this.yl.Ni()){const A=this.yl.Xs();A!==null&&e.h_(A)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let t=0,A=0;for(let r=0;r<e.length;r++){const n=e[r].Xi();n!==null&&(n<t&&(t=n),n>A&&(A=n))}return{H_:t,y_:A}}T_(e,t,A){let r=this.w_(t);if(r===null&&(r=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!on(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}r.qo(e),e.Gi(r),e.Ki(A),this.P_(r),this.mo=null}m_(e,t,A){t.Cr!==A.Cr&&this.L_(e)}v_(e,t){const A=Object.assign({visible:!0,autoScale:!0},ZA(t)),r=new m0(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class w0{constructor(e,t,A=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=t,this.ir=A}Y_(e){const t=e.time,A=this.q_.cacheKey(t),r=this.tr.get(A);if(r!==void 0)return r.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(jt(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(A,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,A),this.Ke++,this.Ge++,n}}class gr{constructor(e,t){ri(e<=t,"right should be >= left"),this.X_=e,this.K_=t}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(e){return this.X_<=e&&e<=this.K_}Ch(e){return this.X_===e.Os()&&this.K_===e.ui()}}function ac(i,e){return i===null||e===null?i===e:i.Ch(e)}class B0{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,t){this.nu(t),this.tr=null;for(let A=t;A<e.length;++A){const r=e[A];let n=this.J_.get(r.timeWeight);n===void 0&&(n=[],this.J_.set(r.timeWeight,n)),n.push({index:A,time:r.time,weight:r.timeWeight,originalTime:r.originalTime})}}su(e,t){const A=Math.ceil(t/e);return this.tr!==null&&this.tr.eu===A||(this.tr={Ha:this.ru(A),eu:A}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const t=[];this.J_.forEach(((A,r)=>{e<=A[0].index?t.push(r):A.splice(cr(A,e,(n=>n.index<e)),1/0)}));for(const A of t)this.J_.delete(A)}ru(e){let t=[];for(const A of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(A))continue;const r=t;t=[];const n=r.length;let s=0;const o=jt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let g=0;g<l;g++){const B=o[g],v=B.index;for(;s<n;){const b=r[s],C=b.index;if(!(C<v)){c=C;break}s++,t.push(b),u=C,c=1/0}if(c-v>=e&&v-u>=e)t.push(B),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class Oi{constructor(e){this.hu=e}lu(){return this.hu===null?null:new gr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Oi(null)}}function y0(i,e){return i.weight>e.weight?i:e}class C0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new B0,this.du=new Map,this.fu=Oi.ou(),this.vu=!0,this.pu=new Lt,this.mu=new Lt,this.bu=new Lt,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=A,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){QA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;QA(this.cn,e),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),e.barSpacing!==void 0&&this.$i.Gn(e.barSpacing),e.rightOffset!==void 0&&this.$i.Jn(e.rightOffset),e.minBarSpacing!==void 0&&this.$i.Gn((A=e.barSpacing)!==null&&A!==void 0?A:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var t,A;return(A=(t=this.uu[e])===null||t===void 0?void 0:t.time)!==null&&A!==void 0?A:null}Ui(e){var t;return(t=this.uu[e])!==null&&t!==void 0?t:null}Va(e,t){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return t?this.uu.length-1:null;const A=cr(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[A].time)?t?A:null:A}Ni(){return this.__===0||this.uu.length===0||this._u===null}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const e=this.Xs();if(e===null)return null;const t={from:e.Os(),to:e.ui()};return this.Ou(t)}Ou(e){const t=Math.round(e.from),A=Math.round(e.to),r=Se(this.Bu()),n=Se(this.Au());return{from:Se(this.Ui(Math.max(r,t))),to:Se(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Se(this.Va(e.from,!0)),to:Se(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),A=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&A!==0){const r=this.Su*e/A;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=A-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!or(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=A+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(this.gu!==null)return this.gu;const e=this.Su,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),A=Math.round(t/e),r=Se(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,u=this.$u(),g=this.cn.fixLeftEdge||u,B=this.cn.fixRightEdge||u;let v=0;for(const b of o){if(!(n<=b.index&&b.index<=s))continue;let C;v<this.Mu.length?(C=this.Mu[v],C.coord=this.It(b.index),C.label=this.Uu(b),C.weight=b.weight):(C={needAlignCoordinate:!1,coord:this.It(b.index),label:this.Uu(b),weight:b.weight},this.Mu.push(C)),this.Su>t/2&&!u?C.needAlignCoordinate=!1:C.needAlignCoordinate=g&&b.index<=l||B&&b.index>=c,v++}return this.Mu.length=v,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const A=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(A-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const t=Zs(this.__-e,0,this.__),A=Zs(this.__-Se(this.wo),0,this.__);t!==0&&A!==0&&this.Gn(this.wu.le*t/A)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const t=(this.Mo-e)/this.le();this.xu=Se(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const A=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:A+(e-A)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new gr(e,t+this.cn.rightOffset))}lc(e){const t=new gr(e.from,e.to);this.rc(t)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:t}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(e){return(this.__-1-e)/this.Su}Fu(e){const t=this.ac(e),A=this.Eu()+this.xu-t;return Math.round(1e6*A)/1e6}ju(e){const t=this.Su;this.Su=e,this.zu(),t!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Oi.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new gr(A-t+1,A);this._c(new Oi(r))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const e=this.cc();e!==null&&this.xu<e&&(this.xu=e,this.vu=!0);const t=this.dc();this.xu>t&&(this.xu=t,this.vu=!0)}cc(){const e=this.Bu(),t=this._u;return e===null||t===null?null:e-t-1+(this.cn.fixLeftEdge?this.__/this.Su:Math.min(2,this.uu.length))}dc(){return this.cn.fixRightEdge?0:this.__/this.Su-Math.min(2,this.uu.length)}Xu(){this.wu={le:this.le(),Hu:this.Hu()}}Ku(){this.wu=null}Uu(e){let t=this.du.get(e.weight);return t===void 0&&(t=new w0((A=>this.fc(A)),this.q_),this.du.set(e.weight,t)),t.Y_(e)}fc(e){return this.q_.formatTickmark(e,this.yo)}_c(e){const t=this.fu;this.fu=e,ac(t.lu(),this.fu.lu())||this.pu.m(),ac(t.au(),this.fu.au())||this.mu.m(),this.oc()}oc(){this.gu=null}Cu(){this.oc(),this.du.clear()}ku(){this.q_.updateFormatter(this.yo)}Tu(){if(!this.cn.fixLeftEdge)return;const e=this.Bu();if(e===null)return;const t=this.Xs();if(t===null)return;const A=t.Os()-e;if(A<0){const r=this.xu-A-1;this.Jn(r)}this.zu()}Pu(){this.Lu(),this.zu()}}class v0{X(e,t,A){e.useMediaCoordinateSpace((r=>this.K(r,t,A)))}gl(e,t,A){e.useMediaCoordinateSpace((r=>this.vc(r,t,A)))}vc(e,t,A){}}class T0 extends v0{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:t,mediaSize:A}=e;let r=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;t.font=s.R;const o=this.wc(t,s.Kt);o>A.width?s.Zu=A.width/o:s.Zu=1,r+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((A.height-r)/2,0);break;case"bottom":n=Math.max(A.height-r,0)}t.fillStyle=this.zt.V;for(const s of this.zt.bc){t.save();let o=0;switch(this.zt.xc){case"left":t.textAlign="left",o=s.gc/2;break;case"center":t.textAlign="center",o=A.width/2;break;case"right":t.textAlign="right",o=A.width-1-s.gc/2}t.translate(o,n),t.textBaseline="top",t.font=s.R,t.scale(s.Zu,s.Zu),t.fillText(s.Kt,0,s.Sc),t.restore(),n+=s.gc*s.Zu}}wc(e,t){const A=this.kc(e.font);let r=A.get(t);return r===void 0&&(r=e.measureText(t).width,A.set(t,r)),r}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class b0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new T0(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.W(),t=this.Ft;t.yt=e.visible,t.yt&&(t.V=e.color,t.xc=e.horzAlign,t.Mc=e.vertAlign,t.bc=[{Kt:e.text,R:Pi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class x0 extends Xs{constructor(e,t){super(),this.cn=t,this.wn=new b0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var lc,cc,hc,uc,dc;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(lc||(lc={}));class Q0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Lt,this.Rc=new Lt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new rf(this),this.yl=new C0(this,t.timeScale,this.cn.localization,A),this.vt=new ff(this,t.crosshair),this.Bc=new c0(t.crosshair),this.Ac=new x0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Vt.es())}Uh(){this.Nc(Vt.ss())}oa(){this.Nc(new Vt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){QA(this.cn,e),this.yc.forEach((t=>t.b_(e))),e.timeScale!==void 0&&this.yl.$h(e.timeScale),e.localization!==void 0&&this.yl.yu(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(e,t){if(e==="left")return void this.$h({leftPriceScale:t});if(e==="right")return void this.$h({rightPriceScale:t});const A=this.Uc(e);A!==null&&(A.Dt.$h(t),this.Pc.m())}Uc(e){for(const t of this.yc){const A=t.w_(e);if(A!==null)return{Ht:t,Dt:A}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,t){e.Lo(t),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((t=>t.S_(e))),this.Wu()}Ic(e){const t=new g0(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const A=e===void 0?this.yc.length-1:e,r=Vt.es();return r.Nn(A,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,A){e.V_(t,A)}O_(e,t,A){e.O_(t,A),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,A){t.Vo()||e.A_(t,A)}I_(e,t,A){t.Vo()||(e.I_(t,A),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,t){t.Vo()||(e.z_(t),this.Nc(this.Gc(e,2)))}E_(e,t){e.E_(t),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,t){const A=this.St();if(A.Ni()||t===0)return;const r=A.Hi();e=Math.max(1,Math.min(e,r)),A.Zu(e,t),this.Wu()}td(e){this.nd(0),this.sd(e),this.ed()}rd(e){this.yl.Jo(e),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(e){this.yl.t_(e)}sd(e){this.yl.i_(e),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(e,t,A,r,n){this.vt.gn(e,t);let s=NaN,o=this.yl.Nu(e);const l=this.yl.Xs();l!==null&&(o=Math.min(Math.max(l.Os(),o),l.ui()));const c=r.vn(),u=c.Ct();u!==null&&(s=c.pn(t,u)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const r=A.vn(),n=r.Ct(),s=r.Rt(e,Se(n)),o=this.yl.Va(t,!0),l=this.yl.It(Se(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),u=e!==null&&e>s&&!c,g=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,B=l&&(A!==void 0||g)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!B){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.S())),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(e,t,A){const r=this.yc[0],n=this.fd(t,e,r,A);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),A=this.Cc.indexOf(e);ri(A!==-1,"Series not found"),this.Cc.splice(A,1),Se(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Se(this.dr(e));A.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();A.qo(e,t,n)}else{const n=r.Ht===A?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Vt.ss();e.$n(),this.Nc(e)}pd(e){const t=Vt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Vt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Vt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Vt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Vt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Vt.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,u,g]=sr(n),[B,v,b,C]=sr(s),U=[wA(l+o*(B-l)),wA(c+o*(v-c)),wA(u+o*(b-u)),xl(g+o*(C-g))];return`rgba(${U[0]}, ${U[1]}, ${U[2]}, ${U[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new Vt(t);if(e!==null){const r=this.yc.indexOf(e);A.Nn(r,{Fn:t})}return A}Fc(e,t){return t===void 0&&(t=2),this.Gc(this.dr(e),t)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((t=>t.j_().qh().bt()))}fd(e,t,A,r){const n=new ro(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),on(s)||n.$h(e),n}Lc(e){const t=this.cn.layout;return t.background.type==="gradient"?e===0?t.background.topColor:t.background.bottomColor:t.background.color}}function ao(i){return!DA(i)&&!ar(i)}function pc(i){return DA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(cc||(cc={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(hc||(hc={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(uc||(uc={})),(function(i){i[i.Year=0]="Year",i[i.Month=1]="Month",i[i.DayOfMonth=2]="DayOfMonth",i[i.Time=3]="Time",i[i.TimeWithSeconds=4]="TimeWithSeconds"})(dc||(dc={}));const fc=i=>i.getUTCFullYear();function F0(i,e,t){return e.replace(/yyyy/g,(A=>YA(fc(A),4))(i)).replace(/yy/g,(A=>YA(fc(A)%100,2))(i)).replace(/MMMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"long"}))(i,t)).replace(/MMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"short"}))(i,t)).replace(/MM/g,(A=>YA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>YA((r=>r.getUTCDate())(A),2))(i))}class mc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return F0(e,this.gd,this.Md)}}class U0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",YA(e.getUTCHours(),2)).replace("%m",YA(e.getUTCMinutes(),2)).replace("%s",YA(e.getUTCSeconds(),2))}}const S0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class E0{constructor(e={}){const t=Object.assign(Object.assign({},S0),e);this.Td=new mc(t.Sd,t.Cd),this.Pd=new U0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function fn(i){return 60*i*60*1e3}function lo(i){return 60*i*1e3}const mn=[{Dd:(gc=1,1e3*gc),Vd:10},{Dd:lo(1),Vd:20},{Dd:lo(5),Vd:21},{Dd:lo(30),Vd:22},{Dd:fn(1),Vd:30},{Dd:fn(3),Vd:31},{Dd:fn(6),Vd:32},{Dd:fn(12),Vd:33}];var gc;function wc(i,e){if(i.getUTCFullYear()!==e.getUTCFullYear())return 70;if(i.getUTCMonth()!==e.getUTCMonth())return 60;if(i.getUTCDate()!==e.getUTCDate())return 50;for(let t=mn.length-1;t>=0;--t)if(Math.floor(e.getTime()/mn[t].Dd)!==Math.floor(i.getTime()/mn[t].Dd))return mn[t].Vd;return 0}function co(i){let e=i;if(ar(i)&&(e=ho(i)),!ao(e))throw new Error("time must be of type BusinessDay");const t=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(t.getTime()/1e3),Bd:e}}function Bc(i){if(!pc(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function ho(i){const e=new Date(i);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${i}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function yc(i){ar(i.time)&&(i.time=ho(i.time))}class Cc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(yc)})(e):yc(e)}createConverterToInternalObj(e){return Se((function(t){return t.length===0?null:ao(t[0].time)||ar(t[0].time)?co:Bc})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const t=e;return t.Bd===void 0?new Date(1e3*t.Od).getTime():new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day)).getTime()}convertHorzItemToInternal(e){return pc(t=e)?Bc(t):ao(t)?co(t):co(ho(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new E0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new mc(t,e.locale)}formatHorzItem(e){const t=e;return this.Ad.Y_(new Date(1e3*t.Od))}formatTickmark(e,t){const A=(function(n,s,o){switch(n){case 0:case 10:return s?o?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return s?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(e.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),r=this.cn.timeScale;if(r.tickMarkFormatter!==void 0){const n=r.tickMarkFormatter(e.originalTime,A,t.locale);if(n!==null)return n}return(function(n,s,o){const l={};switch(s){case 0:l.year="numeric";break;case 1:l.month="short";break;case 2:l.day="numeric";break;case 3:l.hour12=!1,l.hour="2-digit",l.minute="2-digit";break;case 4:l.hour12=!1,l.hour="2-digit",l.minute="2-digit",l.second="2-digit"}const c=n.Bd===void 0?new Date(1e3*n.Od):new Date(Date.UTC(n.Bd.year,n.Bd.month-1,n.Bd.day));return new Date(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()).toLocaleString(o,l)})(e.time,A,t.locale)}maxTickMarkWeight(e){let t=e.reduce(y0,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(A,r=0){if(A.length===0)return;let n=r===0?null:A[r-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let l=r;l<A.length;++l){const c=A[l],u=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=wc(u,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=u}if(r===0&&A.length>1){const l=Math.ceil(o/(A.length-1)),c=new Date(1e3*(A[0].time.Od-l));A[0].timeWeight=wc(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return QA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const ki=typeof window<"u";function vc(){return!!ki&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function uo(){return!!ki&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function po(i){return i+i%2}function fo(i,e){return i.zd-e.zd}function mo(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class L0{constructor(e,t,A,r){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=e,this.Ud=t,this.qd=A,this.rs=r}Yd(e,t){if(this.Ld!==null){if(this.Ld.ot===t)return void(this.Ld.zd=e);if(Math.abs(this.Ld.zd-e)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:t,zd:e}}Vr(e,t){if(this.Ld===null||this.Ed===null||t-this.Ld.ot>50)return;let A=0;const r=mo(this.Ld,this.Ed,this.Ud),n=fo(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=mo(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=fo(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const g=mo(this.Nd,this.Fd,this.Ud);if(Math.sign(g)===Math.sign(r)){const B=fo(this.Nd,this.Fd);s.push(g),o.push(B),A+=B}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/A*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,u){const g=Math.log(u);return Math.log(1*g/-c)/g})(Math.abs(l),this.qd))}tc(e){const t=Se(this.Wd),A=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,A)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Se(this.Wd).ot;return Math.min(t,this.jd)}}class M0{constructor(e,t){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=e,this.Qd=t,this.tf()}bt(){this.tf()}if(){this.Xd&&this.Jd.removeChild(this.Xd),this.Kd&&this.Jd.removeChild(this.Kd),this.Xd=void 0,this.Kd=void 0}nf(){return this.en!==this.sf()||this.Gd!==this.ef()}ef(){return Ql(sr(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.pathname:""}tf(){this.nf()&&(this.if(),this.en=this.sf(),this.en&&(this.Gd=this.ef(),this.Kd=document.createElement("style"),this.Kd.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.Xd=document.createElement("a"),this.Xd.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.rf()}`,this.Xd.title="Charting by TradingView",this.Xd.id="tv-attr-logo",this.Xd.target="_blank",this.Xd.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 19" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.Xd.toggleAttribute("data-dark",this.Gd==="dark"),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function Ci(i,e){const t=Se(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=Vp(t,{options:{allowResizeObserver:!1},transform:(r,n)=>({width:Math.max(r.width,n.width),height:Math.max(r.height,n.height)})});return A.resizeCanvasElement(e),A}function vi(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function go(i,e,t,A){i.gl&&i.gl(e,t,A)}function gn(i,e,t,A){i.X(e,t,A)}function wo(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function H0(i){ki&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Bo{constructor(e,t,A){this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.df=null,this.ff=!1,this.vf=null,this.pf=null,this.mf=!1,this.bf=!1,this.wf=!1,this.gf=null,this.Mf=null,this.xf=null,this.Sf=null,this.kf=null,this.yf=null,this.Cf=null,this.Tf=0,this.Pf=!1,this.Rf=!1,this.Df=!1,this.Vf=0,this.Of=null,this.Bf=!uo(),this.Af=r=>{this.If(r)},this.zf=r=>{if(this.Lf(r)){const n=this.Ef(r);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(_A(r),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(r);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(_A(r),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=t,this.cn=A,this.Xf()}S(){this.gf!==null&&(this.gf(),this.gf=null),this.Mf!==null&&(this.Mf(),this.Mf=null),this.Sf!==null&&(this.Sf(),this.Sf=null),this.kf!==null&&(this.kf(),this.kf=null),this.yf!==null&&(this.yf(),this.yf=null),this.xf!==null&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(e){this.Sf&&this.Sf();const t=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",t)},this.Zf.addEventListener("mousemove",t),this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.Qf),this.Bf=!0}Yf(){this.lf!==null&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){this.uf!==null&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(e){if(this.Df||this.pf!==null||this.Lf(e))return;const t=this.Ef(e);this.Uf(t,this.Hf.tv),this.Bf=!0}iv(e){const t=yo(e.changedTouches,Se(this.Of));if(t===null||(this.Vf=wn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(_A(t),Se(this.pf)),{nv:r,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),Ki(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(_A(e),Se(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:A,sv:r,Nf:A+r}}ov(e){let t=yo(e.changedTouches,Se(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=wn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const A=this.Ef(e,t);if(this.Wf(A,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(_A(t),this.cf);r<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&Ki(e));this._f===0&&Ki(e),e.touches.length===0&&this.ff&&(this.ff=!1,Ki(e))}If(e){if(e.button!==0)return;const t=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),vc()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(t,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:A}=this.Ff(_A(e),this.af);A<5&&!this.bf&&this.Uf(t,this.Hf.qf),this.Yf()}else this.bf||this.Uf(t,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const t=e.changedTouches[0];this.Of=t.identifier,this.Vf=wn(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=_A(t),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{A.removeEventListener("touchmove",n),A.removeEventListener("touchend",s)},A.addEventListener("touchmove",n,{passive:!1}),A.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const r=this.Ef(e,t);this.Wf(r,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=_A(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;vc()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=_A(e),this.kf&&(this.kf(),this.kf=null);{const r=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",r),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",r),t.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=_A(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,t=A=>{this.Hf.wv&&(A.composed&&this.Zf.contains(A.composedPath()[0])||A.target&&this.Zf.contains(A.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",t)},this.gf=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}uo()&&(this.xf=()=>{this.Zf.removeEventListener("dblclick",this.zf)},this.Zf.addEventListener("dblclick",this.zf)),this.Zf.addEventListener("mouseleave",this.gv.bind(this)),this.Zf.addEventListener("touchstart",this.fv.bind(this),{passive:!0}),H0(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",(()=>{}),{passive:!1})}Mv(){this.Hf.xv===void 0&&this.Hf.Sv===void 0&&this.Hf.kv===void 0||(this.Zf.addEventListener("touchstart",(e=>this.yv(e.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(e=>{if(e.touches.length===2&&this.Cf!==null&&this.Hf.Sv!==void 0){const t=Tc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Ki(e)}}),{passive:!1}),this.Zf.addEventListener("touchend",(e=>{this.yv(e.touches)})))}yv(e){e.length===1&&(this.Pf=!1),e.length!==2||this.Pf||this.ff?this.Cv():this.Tv(e)}Tv(e){const t=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,st:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this.Tf=Tc(e[0],e[1]),this.Hf.xv!==void 0&&this.Hf.xv(),this.Kf()}Cv(){this.Cf!==null&&(this.Cf=null,this.Hf.kv!==void 0&&this.Hf.kv())}gv(e){if(this.Sf&&this.Sf(),this.Lf(e)||!this.Bf)return;const t=this.Ef(e);this.Uf(t,this.Hf.Pv),this.Bf=!uo()}vv(e){const t=yo(e.touches,Se(this.Of));if(t===null)return;const A=this.Ef(e,t);this.Wf(A,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:wn(e)<this.Vf+500}Wf(e,t){t&&t.call(this.Hf,e)}Uf(e,t){t&&t.call(this.Hf,e)}Ef(e,t){const A=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:A.clientX,clientY:A.clientY,pageX:A.pageX,pageY:A.pageY,screenX:A.screenX,screenY:A.screenY,localX:A.clientX-r.left,localY:A.clientY-r.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Ki(e)}}}}function Tc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Ki(i){i.cancelable&&i.preventDefault()}function _A(i){return{nt:i.pageX,st:i.pageY}}function wn(i){return i.timeStamp||performance.now()}function yo(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function Bn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function I0(i,e,t){for(const A of i){const r=A.gt();if(r!==null&&r.wr){const n=r.wr(e,t);if(n!==null)return{Bv:A,Iv:n}}}return null}function Co(i,e){return t=>{var A,r,n,s;return((r=(A=t.Dt())===null||A===void 0?void 0:A.Pa())!==null&&r!==void 0?r:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,i))!==null&&s!==void 0?s:[]}}function bc(i,e,t,A){if(!i.length)return;let r=0;const n=t/2,s=i[0].At(A,!0);let o=e===1?n-(i[0].Vi()-s/2):i[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<i.length;l++){const c=i[l],u=i[l-1],g=u.At(A,!1),B=c.Vi(),v=u.Vi();if(e===1?B>v-g:B<v+g){const b=v-g*e;c.Oi(b);const C=b-e*g/2;if((e===1?C<0:C>t)&&o>0){const U=e===1?-1-C:C-t,F=Math.min(U,o);for(let S=r;S<i.length;S++)i[S].Oi(i[S].Vi()+e*F);o-=F}}else r=l,o=e===1?v-g-B:B-(v+g)}}class xc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new hr(200),this.Qr=null,this.Wv=0,this.jv=!1,this.Hv=()=>{this.jv||this.tn.$v().$t().Uh()},this.Uv=()=>{this.jv||this.tn.$v().$t().Uh()},this.tn=e,this.cn=t,this.ko=t.layout,this.Oc=A,this.qv=r==="left",this.Yv=Co("normal",r),this.Zv=Co("top",r),this.Xv=Co("bottom",r),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=Ci(this.Kv,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const n=this.Gv.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Jv=Ci(this.Kv,bt({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const s=this.Jv.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0";const o={bv:this.Qv.bind(this),pv:this.Qv.bind(this),av:this.tp.bind(this),hv:this.tp.bind(this),wv:this.ip.bind(this),cv:this.np.bind(this),_v:this.np.bind(this),qf:this.sp.bind(this),jf:this.sp.bind(this),Qf:this.ep.bind(this),Pv:this.rp.bind(this)};this.hp=new Bo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose(),this.Li!==null&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const t=this.ap(),A=Se(this.Gv.canvasElement.getContext("2d"));A.save();const r=this.Li.Ha();A.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(A,r[0].so),this.Fv.xi(A,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const u=this.Fv.xi(A,n[c].Kt());u>e&&(e=u)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),u=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,u))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,u))-.11111111111111,s)))}var o;A.restore();const l=e||34;return po(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&wi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return Se(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,Se(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=Bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}bt(){var e;(e=this.Li)===null||e===void 0||e.Ha()}Qv(e){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!0,t.V_(A,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp(),r=this.Li;t.O_(A,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),A=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,A))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!1,t.B_(A,this.Li)}sp(e){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(e){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(e){this.kp(0)}up(){const e=[],t=this.Li===null?void 0:this.Li;return(A=>{for(let r=0;r<A.length;++r){const n=A[r].Rn(this.tn.fp(),t);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,s):Sl(e,0,0,A,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(l)),u=Math.floor(.5*l),g=Math.round(r.T*o);s.beginPath();for(const B of t)s.rect(Math.floor(n*o),Math.round(B.Ea*l)-u,g,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-r.A):Math.round(n+r.T+r.A),c=t.map((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const g=t[u];s.fillText(g.so,l,g.Ea+c[u])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),r=this.ap();this.Li===A.pr()&&this.tn.fp().Uo().forEach((s=>{A.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(A,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,r)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,r=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));r.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),l=s.ki();l>-o&&l<o&&s.Oi(o),l>this.Ev.height-o&&l<this.Ev.height+o&&s.Oi(this.Ev.height-o)}bc(r,1,this.Ev.height,t),bc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Se(this.Li)).X(e,A,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((l=>{l.forEach((c=>{c.gt(Se(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return Pi(this.ko.fontSize,this.ko.fontFamily)}}function D0(i,e){var t,A;return(A=(t=i.ua)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function yn(i,e){var t,A;return(A=(t=i.Pn)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function _0(i,e){var t,A;return(A=(t=i.Ji)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function P0(i,e){var t,A;return(A=(t=i.aa)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}class vo{constructor(e,t){this.Ev=bt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Lt,this.Op=new Lt,this.Bp=0,this.Ap=!1,this.Ip=null,this.zp=!1,this.Lp=null,this.Ep=null,this.jv=!1,this.Hv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Uv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Qd=e,this.Np=t,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const A=document.createElement("div");A.style.width="100%",A.style.height="100%",A.style.position="relative",A.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(A),this.Gv=Ci(A,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=Ci(A,bt({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const n=this.Jv.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.style.top="0",this.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new Bo(this.Jv.canvasElement,this,{ev:()=>this.Ip===null&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>this.Ip===null&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.Cp!==null&&this.Cp.S(),this.Tp!==null&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Se(this.Np)}qp(e){var t,A;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(vo.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(t=this.Pp)!==null&&t!==void 0?t:new M0(this.Wp,this.Qd),this.Pp.bt()):((A=this.Pp)===null||A===void 0||A.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const e=this.Np.R_();this.Cp.Gi(Se(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Se(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const t=e.localX,A=e.localY;this.Gp(t,A,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const A=e.localX,r=e.localY;this.Gp(A,r,e);const n=this.wr(A,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const t={x:e.localX,y:e.localY};this.rm(t,t,e)}}Pv(e){this.Np!==null&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(e,t){if(!this.Qd.W().handleScale.pinch)return;const A=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,A)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,A=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Se(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,u,g){var B,v;let b,C;for(const S of c){const K=(v=(B=S.va)===null||B===void 0?void 0:B.call(S,u,g))!==null&&v!==void 0?v:[];for(const G of K)U=G.zOrder,(!(F=b?.zOrder)||U==="top"&&F!=="top"||U==="normal"&&F==="bottom")&&(b=G,C=S)}var U,F;return b&&C?{zv:b,Hc:C}:null})(o,n,s);if(l?.zv.zOrder==="top")return Bn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Bn(l);const u=I0(c.Pn(r),n,s);if(u!==null)return{Hc:c,Bv:u.Bv,Iv:u.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Bn(l)}return l?.zv?Bn(l):null})(A,e,t)}_m(e,t){Se(t==="left"?this.Cp:this.Tp).cp(bt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){wi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Wp.style.width=e.width+"px",this.Wp.style.height=e.height+"px")}dm(){const e=Se(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const A=t.Dt();A!==null&&e.P_(A),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,D0),this.vm(A),this.pm(A),this.fm(A,yn),this.fm(A,_0)))}this.Jv.applySuggestedBitmapSize();const t=Bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,P0))}wm(){return this.Cp}gm(){return this.Tp}bp(e,t){this.fm(e,t)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,t){const A=t.localX,r=t.localY;e.M()&&e.m(this.$i().St().Nu(A),{x:A,y:r},t)}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,o):Sl(e,0,0,A,r,s,o)}vm(e){const t=Se(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,yn,go,t),this.Mm(e,yn,gn,t)}bm(e){this.Mm(e,yn,gn,this.$i().Zc())}fm(e,t){const A=Se(this.Np).Uo();for(const r of A)this.Mm(e,t,go,r);for(const r of A)this.Mm(e,t,gn,r)}Mm(e,t,A,r){const n=Se(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;wo(t,(c=>A(c,e,o,l)),r,n)}Zp(){if(this.Np===null)return;const e=this.Qd,t=this.Np.R_().W().visible,A=this.Np.D_().W().visible;t||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),A||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const r=e.$t().ud();t&&this.Cp===null&&(this.Cp=new xc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new xc(this,e.W(),r,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,Se(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,A){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,A);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),A=this.fp();if(t.z_(A,A.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Se(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const t=this.$i(),A=t.St();if(A.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),l=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:l,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new L0(.2/c,7/c,.997,15/c),this.Ep.Yd(A.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||t.A_(this.Np,o,e.localY),t.nd(e.localX),this.Dp=!0}this.Dp&&(o.Ni()||t.I_(this.Np,o,e.localY),t.sd(e.localX),this.Ep!==null&&this.Ep.Yd(A.Hu(),l))}}class Qc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=bt({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=A.ud,this.cn=t,this.Tm=r,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=Ci(this.Kv,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){wi(this.Ev,e)||(this.Ev=e,this.Gv.resizeCanvasElement(e),this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.ft=!0)}vp(e){if(e<3&&!this.ft||this.Ev.width===0||this.Ev.height===0)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const t=Bi(this.Gv);t!==null&&t.useBitmapCoordinateSpace((A=>{this.mp(A),this.Ie(A)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*A),s=Math.floor(this.Oc.W().C*r),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Pm())}}function To(i){return e=>{var t,A;return(A=(t=e.fa)===null||t===void 0?void 0:t.call(e,i))!==null&&A!==void 0?A:[]}}const N0=To("normal"),O0=To("top"),k0=To("bottom");class K0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=bt({width:0,height:0}),this.Om=new Lt,this.Fv=new hr(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=e,this.q_=t,this.cn=e.W().layout,this.Xd=document.createElement("tr"),this.Bm=document.createElement("td"),this.Bm.style.padding="0",this.Am=document.createElement("td"),this.Am.style.padding="0",this.Kv=document.createElement("td"),this.Kv.style.height="25px",this.Kv.style.padding="0",this.Im=document.createElement("div"),this.Im.style.width="100%",this.Im.style.height="100%",this.Im.style.position="relative",this.Im.style.overflow="hidden",this.Kv.appendChild(this.Im),this.Gv=Ci(this.Im,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const A=this.Gv.canvasElement;A.style.position="absolute",A.style.zIndex="1",A.style.left="0",A.style.top="0",this.Jv=Ci(this.Im,bt({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const r=this.Jv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Xd.appendChild(this.Bm),this.Xd.appendChild(this.Kv),this.Xd.appendChild(this.Am),this.zm(),this.Qd.$t().g_().l(this.zm.bind(this),this),this.hp=new Bo(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),this.Rm!==null&&this.Rm.S(),this.Dm!==null&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),vi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),vi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(e){if(this.Vm)return;this.Vm=!0;const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.Jc(e.localX)}pv(e){this.bv(e)}wv(){const e=this.Qd.$t();!e.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&e.hd())}av(e){const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.rd(e.localX)}hv(e){this.av(e)}cv(){this.Vm=!1;const e=this.Qd.$t();e.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||e.hd()}_v(){this.cv()}qf(){this.Qd.W().handleScale.axisDoubleClickReset.time&&this.Qd.$t().Kn()}jf(){this.qf()}Qf(){this.Qd.$t().W().handleScale.axisPressedMouseMove.time&&this.kp(1)}Pv(){this.kp(0)}um(){return this.Ev}Nm(){return this.Om}Fm(e,t,A){wi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.Om.m(e)),this.Rm!==null&&this.Rm.cp(bt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(bt({width:A,height:e.height}))}Wm(){const e=this.jm();return Math.ceil(e.C+e.T+e.P+e.L+e.B+e.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const A=Bi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,k0)})),this.wp(A),this.$m(A,N0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=Bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,O0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)wo(t,(n=>go(n,e,!1,void 0)),r,void 0);for(const r of A)wo(t,(n=>gn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const u=Math.max(1,Math.floor(l)),g=Math.floor(.5*l);o.beginPath();const B=Math.round(n.T*c);for(let v=A.length;v--;){const b=Math.round(A[v].coord*l);o.rect(b-g,0,u,B)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const l=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}}))}Ym(e,t,A){const r=this.Fv.xi(e,A),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const A=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return Pi(this.j(),this.cn.fontFamily)}Zm(){return Pi(this.j(),this.cn.fontFamily,"bold")}jm(){this.k===null&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new hr,Hm:0});const e=this.k,t=this._p();if(e.R!==t){const A=this.j();e.P=A,e.R=t,e.L=3*A/12,e.B=3*A/12,e.ji=9*A/12,e.N=0,e.Hm=4*A/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),t=e.W();t.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),t.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const A={ud:this.Qd.$t().ud()},r=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Qc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Qc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const V0=!!ki&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!ki&&(!((bo=navigator?.userAgentData)===null||bo===void 0)&&bo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var bo;class z0{constructor(e,t,A){var r;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new Lt,this.Op=new Lt,this.Rc=new Lt,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=A,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(r=this.Xd).style.userSelect="none",r.style.webkitUserSelect="none",r.style.msUserSelect="none",r.style.MozUserSelect="none",r.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),xo(this.cn)&&this.hb(!0),this.$i=new Q0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new K0(this,this.q_),this.sb.appendChild(this.ab.lp());const n=t.autoSize&&this.ob();let s=this.cn.width,o=this.cn.height;if(n||s===0||o===0){const l=e.getBoundingClientRect();s=s||l.width,o=o||l.height}this._b(s,o),this.ub(),e.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),this.Km!==0&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],Se(this.ab).S(),this.Xd.parentElement!==null&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(e,t,A=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return bt({width:l-l%2,height:c-c%2})})(bt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Se(this.Xd).style.height=n,Se(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Vt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Vt.es());for(let t=0;t<this.Xm.length;t++)this.Xm[t].vp(e.Hn(t).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const t=xo(this.cn);this.$i.$h(e);const A=xo(this.cn);A!==t&&this.hb(A),this.cb(),this.bb(e)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){this.Qm!==null&&(this.mb(this.Qm,performance.now()),this.Qm=null);const e=this.gb(null),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const A=Se(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Se(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return jt(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let u=0;u<this.Xm.length;u++){const g=this.Xm[u],B=Se(o==="left"?g.wm():g.gm()),v=B.xp();e!==null&&B.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Se(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,A),A+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Se(r.gm()).xp().width);const s=(o,l,c)=>{Se(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Se(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,A),l=Se(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return bt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const b of this.Xm)this.xb()&&(t=Math.max(t,Se(b.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Se(b.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=b.M_();t=po(t),A=po(A);const r=this.__,n=this.ho,s=Math.max(r-t-A,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const u=0+l,g=n<u?0:n-u,B=g/e;let v=0;for(let b=0;b<this.Xm.length;++b){const C=this.Xm[b];C.qp(this.$i.qc()[b]);let U=0,F=0;F=b===this.Xm.length-1?g-v:Math.round(C.M_()*B),U=Math.max(F,2),v+=U,C.cp(bt({width:s,height:U})),this.xb()&&C._m(t,"left"),this.Sb()&&C._m(A,"right"),C.fp()&&this.$i.Kc(C.fp(),U)}this.ab.Fm(bt({width:o?s:0,height:l}),o?t:0,o?A:0),this.$i.S_(s),this.Gm!==t&&(this.Gm=t),this.Jm!==A&&(this.Jm=A)}hb(e){e?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return V0?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const t=this.Rb(e),A=t*e.deltaX/100,r=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),r!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(r)*Math.min(1,Math.abs(r)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}A!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*A)}mb(e,t){var A;const r=e.jn();r===3&&this.Db(),r!==3&&r!==2||(this.Vb(e),this.Ob(e,t),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((A=this.Qm)===null||A===void 0?void 0:A.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,t),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,t){for(const A of e.Qn())this.ns(A,t)}Vb(e){const t=this.$i.qc();for(let A=0;A<t.length;A++)e.Hn(A).Wn&&t[A].N_()}ns(e,t){const A=this.$i.St();switch(e.qn){case 0:A.hc();break;case 1:A.lc(e.Vt);break;case 2:A.Gn(e.Vt);break;case 3:A.Jn(e.Vt);break;case 4:A.qu();break;case 5:e.Vt.Qu(t)||A.Jn(e.Vt.tc(t))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((t=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const A=this.Qm;this.Qm=null,this.mb(A,t);for(const r of A.Qn())if(r.qn===5&&!r.Vt.Qu(t)){this.$t().Zn(r.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,A=this.Xm.length;for(let r=t;r<A;r++){const n=jt(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=A;r<t;r++){const n=new vo(this,e[r]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var r;const n=new Map;e!==null&&this.$i.wt().forEach((u=>{const g=u.In().ll(e);g!==null&&n.set(u,g)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof ro?o.Hc:void 0,c=o!==null&&o.Iv!==void 0?o.Iv.gr:void 0;return{zb:s,ee:e??void 0,Lb:t??void 0,Eb:l,Nb:n,Fb:c,Wb:A??void 0}}Bb(e,t,A){this.Vp.m((()=>this.Ib(e,t,A)))}Ab(e,t,A){this.Op.m((()=>this.Ib(e,t,A)))}lb(e,t,A){this.Rc.m((()=>this.Ib(e,t,A)))}cb(){const e=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=e}xb(){return this.Xm[0].fp().R_().W().visible}Sb(){return this.Xm[0].fp().D_().W().visible}ob(){return"ResizeObserver"in window&&(this.ib=new ResizeObserver((e=>{const t=e.find((A=>A.target===this.Jd));t&&this._b(t.contentRect.width,t.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function xo(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function W0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function Fc(i,e){var t={};for(var A in i)Object.prototype.hasOwnProperty.call(i,A)&&e.indexOf(A)<0&&(t[A]=i[A]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(A=Object.getOwnPropertySymbols(i);r<A.length;r++)e.indexOf(A[r])<0&&Object.prototype.propertyIsEnumerable.call(i,A[r])&&(t[A[r]]=i[A[r]])}return t}function Uc(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.color!==void 0&&(n.V=t.color),n}function R0(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.lineColor!==void 0&&(n.lt=t.lineColor),t.topColor!==void 0&&(n.Ps=t.topColor),t.bottomColor!==void 0&&(n.Rs=t.bottomColor),n}function G0(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.topLineColor!==void 0&&(n.Re=t.topLineColor),t.bottomLineColor!==void 0&&(n.De=t.bottomLineColor),t.topFillColor1!==void 0&&(n.ke=t.topFillColor1),t.topFillColor2!==void 0&&(n.ye=t.topFillColor2),t.bottomFillColor1!==void 0&&(n.Ce=t.bottomFillColor1),t.bottomFillColor2!==void 0&&(n.Te=t.bottomFillColor2),n}function $0(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),r}function X0(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function J0(i,e,t,A,r){const n=jt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:g,color:B}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:Fc(u,["time","color"]),V:B}}function Cn(i){return i.Vt!==void 0}function Sc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function Ti(i){return(e,t,A,r,n,s)=>(function(o,l){return l?l(o):(c=o).open===void 0&&c.value===void 0;var c})(A,s)?Sc({ot:e,ee:t,zb:r},A):Sc(i(e,t,A,r,n),A)}function Ec(i){return{Candlestick:Ti(X0),Bar:Ti($0),Area:Ti(R0),Baseline:Ti(G0),Histogram:Ti(Uc),Line:Ti(Uc),Custom:Ti(J0)}[i]}function Lc(i){return{ee:0,Hb:new Map,la:i}}function Mc(i,e){if(i!==void 0&&i.length!==0)return{$b:e.key(i[0].ot),Ub:e.key(i[i.length-1].ot)}}function Hc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),jt(e)}class Z0{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,t){let A=this.qb.size!==0,r=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)A=!1,r=!0,this.qb.clear();else for(const l of this.Xb)l.pointData.Hb.delete(e)&&(r=!0);let s=[];if(t.length!==0){const l=t.map((v=>v.time)),c=this.q_.createConverterToInternalObj(t),u=Ec(e.Qh()),g=e.Ca(),B=e.Ta();s=t.map(((v,b)=>{const C=c(v.time),U=this.q_.key(C);let F=this.qb.get(U);F===void 0&&(F=Lc(C),this.qb.set(U,F),r=!0);const S=u(C,F.ee,v,l[b],g,B);return F.Hb.set(e,S),S}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:Hc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const g=Mc(l,u),B=Mc(c,u);if(g!==void 0&&B!==void 0)return{ta:g.Ub>=B.Ub&&g.$b>=B.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(C){C.zb===void 0&&(C.zb=C.time)})(A),this.q_.preprocessData(t);const r=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(r)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${r}`);let s=this.qb.get(this.q_.key(r));const o=s===void 0;s===void 0&&(s=Lc(r),this.qb.set(this.q_.key(r),s));const l=Ec(e.Qh()),c=e.Ca(),u=e.Ta(),g=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,g),this.nw(e,g);const B={ta:Cn(g)};if(!o)return this.tw(e,-1,B);const v={timeWeight:0,time:s.la,pointData:s,originalTime:Hc(s.Hb)},b=cr(this.Xb,this.q_.key(v.time),((C,U)=>this.q_.key(C.time)<U));this.Xb.splice(b,0,v);for(let C=b;C<this.Xb.length;++C)Qo(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,b),this.tw(e,b,B)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const r=A.length!==0?A[A.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?Cn(t)&&A.push(t):Cn(t)?A[A.length-1]=t:A.splice(-1,1),this.Zb.set(e,t.ot)}Jb(e,t){t.length!==0?(this.Yb.set(e,t.filter(Cn)),this.Zb.set(e,t[t.length-1].ot)):(this.Yb.delete(e),this.Zb.delete(e))}Gb(){for(const e of this.Xb)e.pointData.Hb.size===0&&this.qb.delete(this.q_.key(e.time))}Qb(e){let t=-1;for(let A=0;A<this.Xb.length&&A<e.length;++A){const r=this.Xb[A],n=e[A];if(this.q_.key(r.time)!==this.q_.key(n.time)){t=A;break}n.timeWeight=r.timeWeight,Qo(n.pointData,A)}if(t===-1&&this.Xb.length!==e.length&&(t=Math.min(this.Xb.length,e.length)),t===-1)return-1;for(let A=t;A<e.length;++A)Qo(e[A].pointData,A);return this.q_.fillWeightsForPoints(e,t),this.Xb=e,t}sw(){if(this.Yb.size===0)return null;let e=0;return this.Yb.forEach((t=>{t.length!==0&&(e=Math.max(e,t[t.length-1].ee))})),e}tw(e,t,A){const r={ew:new Map,St:{Eu:this.sw()}};if(t!==-1)this.Yb.forEach(((n,s)=>{r.ew.set(s,{$e:n,rw:s===e?A:void 0})})),this.Yb.has(e)||r.ew.set(e,{$e:[],rw:A}),r.St.hw=this.Xb,r.St.lw=t;else{const n=this.Yb.get(e);r.ew.set(e,{$e:n||[],rw:A})}return r}}function Qo(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function Fo(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function Ic(i){const e=Fo(i);return i.V!==void 0&&(e.color=i.V),e}function Y0(i){const e=Fo(i);return i.lt!==void 0&&(e.lineColor=i.lt),i.Ps!==void 0&&(e.topColor=i.Ps),i.Rs!==void 0&&(e.bottomColor=i.Rs),e}function q0(i){const e=Fo(i);return i.Re!==void 0&&(e.topLineColor=i.Re),i.De!==void 0&&(e.bottomLineColor=i.De),i.ke!==void 0&&(e.topFillColor1=i.ke),i.ye!==void 0&&(e.topFillColor2=i.ye),i.Ce!==void 0&&(e.bottomFillColor1=i.Ce),i.Te!==void 0&&(e.bottomFillColor2=i.Te),e}function Dc(i){const e={open:i.Vt[0],high:i.Vt[1],low:i.Vt[2],close:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function j0(i){const e=Dc(i);return i.V!==void 0&&(e.color=i.V),e}function em(i){const e=Dc(i),{V:t,Ot:A,Xh:r}=i;return t!==void 0&&(e.color=t),A!==void 0&&(e.borderColor=A),r!==void 0&&(e.wickColor=r),e}function Uo(i){return{Area:Y0,Line:Ic,Baseline:q0,Histogram:Ic,Bar:j0,Candlestick:em,Custom:tm}[i]}function tm(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const Am={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},im={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},rm={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Gs,attributionLogo:!0},So={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0},nm={rightOffset:0,barSpacing:6,minBarSpacing:.5,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0},sm={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Gs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function _c(){return{width:0,height:0,autoSize:!1,layout:rm,crosshair:Am,grid:im,overlayPriceScales:Object.assign({},So),leftPriceScale:Object.assign(Object.assign({},So),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},So),{visible:!0}),timeScale:nm,watermark:sm,localization:{locale:ki?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class om{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return on(this.ow)?this.aw.Mb(this.ow):0}Li(){return Se(this.aw.$t().Uc(this.ow)).Dt}}function Pc(i,e,t){const A=Fc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const am={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class lm{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class cm{constructor(e,t,A,r,n){this.uw=new Lt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=r}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().Rt(e,t.Vt)}coordinateToPrice(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().pn(e,t.Vt)}barsInLogicalRange(e){if(e===null)return null;const t=new Oi(new gr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const r=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=Se(A.el()),o=Se(A.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.zb,l.to=n.zb),l}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:Uo(this.seriesType())(A)}data(){const e=Uo(this.seriesType());return this.Es.In().ne().map((t=>e(t)))}subscribeDataChanged(e){this.uw.l(e)}unsubscribeDataChanged(e){this.uw.v(e)}setMarkers(e){this.q_;const t=e.map((A=>Pc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Pc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return ZA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=QA(ZA(am),e),A=this.Es.ea(t);return new lm(A)}removePriceLine(e){this.Es.ra(e._w())}seriesType(){return this.Es.Qh()}attachPrimitive(e){this.Es.ka(e),e.attached&&e.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(e){this.Es.ya(e),e.detached&&e.detached()}mw(e){this.uw.M()&&this.uw.m(e)}}class hm{constructor(e,t,A){this.ww=new Lt,this.mu=new Lt,this.Om=new Lt,this.$i=e,this.yl=e.St(),this.ab=t,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=A}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(e,t){t?this.yl.Ju(e,1e3):this.$i.Jn(e)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const e=this.yl.Vu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const t={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},A=this.yl.Iu(t);this.$i.pd(A)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ri(e.from<=e.to,"The from index cannot be after the to index."),this.$i.pd(e)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(e){const t=this.$i.St();return t.Ni()?null:t.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const t=this.q_.convertHorzItemToInternal(e),A=this.yl.Va(t,!1);return A===null?null:this.yl.It(A)}coordinateToTime(e){const t=this.$i.St(),A=t.Nu(e),r=t.Ui(A);return r===null?null:r.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},ZA(this.yl.W())),{barSpacing:this.yl.le()})}gw(){this.ww.M()&&this.ww.m(this.getVisibleRange())}Mw(){this.mu.M()&&this.mu.m(this.getVisibleLogicalRange())}xw(e){this.Om.m(e.width,e.height)}}function um(i){if(i===void 0||i.type==="custom")return;const e=i;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(t){if(t>=1)return 0;let A=0;for(;A<8;A++){const r=Math.round(t);if(Math.abs(r-t)<1e-8)return A;t*=10}return A})(e.minMove))}function Nc(i){return(function(e){if(rn(e.handleScale)){const A=e.handleScale;e.handleScale={axisDoubleClickReset:{time:A,price:A},axisPressedMouseMove:{time:A,price:A},mouseWheel:A,pinch:A}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:A,axisDoubleClickReset:r}=e.handleScale;rn(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),rn(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;rn(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class dm{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Lt,this.Cw=new Lt,this.Tw=new Lt,this.Pw=new Z0(t);const r=A===void 0?ZA(_c()):QA(ZA(_c()),Nc(A));this.q_=t,this.aw=new z0(e,r,t),this.aw.lm().l((s=>{this.yw.M()&&this.yw.m(this.Rw(s()))}),this),this.aw.am().l((s=>{this.Cw.M()&&this.Cw.m(this.Rw(s()))}),this),this.aw.Xc().l((s=>{this.Tw.M()&&this.Tw.m(this.Rw(s()))}),this);const n=this.aw.$t();this.Dw=new hm(n,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(e,t,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=_i(e),r=Object.assign(Object.assign({},Bl),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Jp,e)}addBaselineSeries(e){return this.Vw("Baseline",Zp,e)}addBarSeries(e){return this.Vw("Bar",$p,e)}addCandlestickSeries(e={}){return(function(t){t.borderColor!==void 0&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),t.wickColor!==void 0&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)})(e),this.Vw("Candlestick",Gp,e)}addHistogramSeries(e){return this.Vw("Histogram",Yp,e)}addLineSeries(e){return this.Vw("Line",Xp,e)}removeSeries(e){const t=jt(this.Sw.get(e)),A=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(A),this.Sw.delete(e),this.kw.delete(t)}pw(e,t){this.Ow(this.Pw.Kb(e,t))}bw(e,t){this.Ow(this.Pw.iw(e,t))}subscribeClick(e){this.yw.l(e)}unsubscribeClick(e){this.yw.v(e)}subscribeCrosshairMove(e){this.Tw.l(e)}unsubscribeCrosshairMove(e){this.Tw.v(e)}subscribeDblClick(e){this.Cw.l(e)}unsubscribeDblClick(e){this.Cw.v(e)}priceScale(e){return new om(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Nc(e))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const e=this.aw.Tb();return{height:e.height,width:e.width}}setCrosshairPosition(e,t,A){const r=this.Sw.get(A);if(r===void 0)return;const n=this.aw.$t().dr(r);n!==null&&this.aw.$t().ad(e,t,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,t,A={},r){um(A.priceFormat);const n=QA(ZA(yl),ZA(t),A),s=this.aw.$t().dd(e,n,r),o=new cm(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((A,r)=>r.J(A.$e,A.rw))),t.Wu()}Bw(e){return jt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=Uo(s)(r);if(s!=="Custom")ri(W0(o));else{const l=n.Ta();ri(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const A=e.Eb!==void 0&&this.kw.has(e.Eb)?this.Bw(e.Eb):void 0;return{time:e.zb,logical:e.ee,point:e.Lb,hoveredSeries:A,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function pm(i,e,t){let A;if(ar(i)){const n=document.getElementById(i);ri(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new dm(A,e,t);return e.setOptions(r.options()),r}function fm(i,e){return pm(i,new Cc,Cc.Id(e))}Object.assign(Object.assign({},yl),Bl);function Oc(i,e){return function(){return i.apply(e,arguments)}}const{toString:mm}=Object.prototype,{getPrototypeOf:Eo}=Object,{iterator:vn,toStringTag:kc}=Symbol,Tn=(i=>e=>{const t=mm.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),UA=i=>(i=i.toLowerCase(),e=>Tn(e)===i),bn=i=>e=>typeof e===i,{isArray:Vi}=Array,zi=bn("undefined");function wr(i){return i!==null&&!zi(i)&&i.constructor!==null&&!zi(i.constructor)&&nA(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Kc=UA("ArrayBuffer");function gm(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Kc(i.buffer),e}const wm=bn("string"),nA=bn("function"),Vc=bn("number"),Br=i=>i!==null&&typeof i=="object",Bm=i=>i===!0||i===!1,xn=i=>{if(Tn(i)!=="object")return!1;const e=Eo(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(kc in i)&&!(vn in i)},ym=i=>{if(!Br(i)||wr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},Cm=UA("Date"),vm=UA("File"),Tm=UA("Blob"),bm=UA("FileList"),xm=i=>Br(i)&&nA(i.pipe),Qm=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||nA(i.append)&&((e=Tn(i))==="formdata"||e==="object"&&nA(i.toString)&&i.toString()==="[object FormData]"))},Fm=UA("URLSearchParams"),[Um,Sm,Em,Lm]=["ReadableStream","Request","Response","Headers"].map(UA),Mm=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Vi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(wr(i))return;const n=t?Object.getOwnPropertyNames(i):Object.keys(i),s=n.length;let o;for(A=0;A<s;A++)o=n[A],e.call(null,i[o],o,i)}}function zc(i,e){if(wr(i))return null;e=e.toLowerCase();const t=Object.keys(i);let A=t.length,r;for(;A-- >0;)if(r=t[A],e===r.toLowerCase())return r;return null}const bi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wc=i=>!zi(i)&&i!==bi;function Lo(){const{caseless:i,skipUndefined:e}=Wc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&zc(t,n)||n;xn(t[s])&&xn(r)?t[s]=Lo(t[s],r):xn(r)?t[s]=Lo({},r):Vi(r)?t[s]=r.slice():(!e||!zi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&yr(arguments[r],A);return t}const Hm=(i,e,t,{allOwnKeys:A}={})=>(yr(e,(r,n)=>{t&&nA(r)?Object.defineProperty(i,n,{value:Oc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),Im=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Dm=(i,e,t,A)=>{i.prototype=Object.create(e.prototype,A),Object.defineProperty(i.prototype,"constructor",{value:i,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},_m=(i,e,t,A)=>{let r,n,s;const o={};if(e=e||{},i==null)return e;do{for(r=Object.getOwnPropertyNames(i),n=r.length;n-- >0;)s=r[n],(!A||A(s,i,e))&&!o[s]&&(e[s]=i[s],o[s]=!0);i=t!==!1&&Eo(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},Pm=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const A=i.indexOf(e,t);return A!==-1&&A===t},Nm=i=>{if(!i)return null;if(Vi(i))return i;let e=i.length;if(!Vc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},Om=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Eo(Uint8Array)),km=(i,e)=>{const A=(i&&i[vn]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},Km=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},Vm=UA("HTMLFormElement"),zm=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Rc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Wm=UA("RegExp"),Gc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};yr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},Rm=i=>{Gc(i,(e,t)=>{if(nA(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(nA(A)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Gm=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Vi(i)?A(i):A(String(i).split(e)),t},$m=()=>{},Xm=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function Jm(i){return!!(i&&nA(i.append)&&i[kc]==="FormData"&&i[vn])}const Zm=i=>{const e=new Array(10),t=(A,r)=>{if(Br(A)){if(e.indexOf(A)>=0)return;if(wr(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Vi(A)?[]:{};return yr(A,(s,o)=>{const l=t(s,r+1);!zi(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},Ym=UA("AsyncFunction"),qm=i=>i&&(Br(i)||nA(i))&&nA(i.then)&&nA(i.catch),$c=((i,e)=>i?setImmediate:e?((t,A)=>(bi.addEventListener("message",({source:r,data:n})=>{r===bi&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),bi.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",nA(bi.postMessage)),jm=typeof queueMicrotask<"u"?queueMicrotask.bind(bi):typeof process<"u"&&process.nextTick||$c,fe={isArray:Vi,isArrayBuffer:Kc,isBuffer:wr,isFormData:Qm,isArrayBufferView:gm,isString:wm,isNumber:Vc,isBoolean:Bm,isObject:Br,isPlainObject:xn,isEmptyObject:ym,isReadableStream:Um,isRequest:Sm,isResponse:Em,isHeaders:Lm,isUndefined:zi,isDate:Cm,isFile:vm,isBlob:Tm,isRegExp:Wm,isFunction:nA,isStream:xm,isURLSearchParams:Fm,isTypedArray:Om,isFileList:bm,forEach:yr,merge:Lo,extend:Hm,trim:Mm,stripBOM:Im,inherits:Dm,toFlatObject:_m,kindOf:Tn,kindOfTest:UA,endsWith:Pm,toArray:Nm,forEachEntry:km,matchAll:Km,isHTMLForm:Vm,hasOwnProperty:Rc,hasOwnProp:Rc,reduceDescriptors:Gc,freezeMethods:Rm,toObjectSet:Gm,toCamelCase:zm,noop:$m,toFiniteNumber:Xm,findKey:zc,global:bi,isContextDefined:Wc,isSpecCompliantForm:Jm,toJSONObject:Zm,isAsyncFn:Ym,isThenable:qm,setImmediate:$c,asap:jm,isIterable:i=>i!=null&&nA(i[vn])};let Xe=class Lp extends Error{static from(e,t,A,r,n,s){const o=new Lp(e.message,t||e.code,A,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),r&&(this.request=r),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.status}}};Xe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Xe.ERR_BAD_OPTION="ERR_BAD_OPTION",Xe.ECONNABORTED="ECONNABORTED",Xe.ETIMEDOUT="ETIMEDOUT",Xe.ERR_NETWORK="ERR_NETWORK",Xe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Xe.ERR_DEPRECATED="ERR_DEPRECATED",Xe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Xe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Xe.ERR_CANCELED="ERR_CANCELED",Xe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Xe.ERR_INVALID_URL="ERR_INVALID_URL";const eg=null;function Mo(i){return fe.isPlainObject(i)||fe.isArray(i)}function Xc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function Jc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Xc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function tg(i){return fe.isArray(i)&&!i.some(Mo)}const Ag=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function Qn(i,e,t){if(!fe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=fe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!fe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(r))throw new TypeError("visitor must be a function");function c(b){if(b===null)return"";if(fe.isDate(b))return b.toISOString();if(fe.isBoolean(b))return b.toString();if(!l&&fe.isBlob(b))throw new Xe("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(b)||fe.isTypedArray(b)?l&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function u(b,C,U){let F=b;if(b&&!U&&typeof b=="object"){if(fe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&tg(b)||(fe.isFileList(b)||fe.endsWith(C,"[]"))&&(F=fe.toArray(b)))return C=Xc(C),F.forEach(function(K,G){!(fe.isUndefined(K)||K===null)&&e.append(s===!0?Jc([C],G,n):s===null?C:C+"[]",c(K))}),!1}return Mo(b)?!0:(e.append(Jc(U,C,n),c(b)),!1)}const g=[],B=Object.assign(Ag,{defaultVisitor:u,convertValue:c,isVisitable:Mo});function v(b,C){if(!fe.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+C.join("."));g.push(b),fe.forEach(b,function(F,S){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(S)?S.trim():S,C,B))===!0&&v(F,C?C.concat(S):[S])}),g.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Zc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function Ho(i,e){this._pairs=[],i&&Qn(i,this,e)}const Yc=Ho.prototype;Yc.append=function(e,t){this._pairs.push([e,t])},Yc.toString=function(e){const t=e?function(A){return e.call(this,A,Zc)}:Zc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function ig(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function qc(i,e,t){if(!e)return i;const A=t&&t.encode||ig,r=fe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=fe.isURLSearchParams(e)?e.toString():new Ho(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class jc{constructor(){this.handlers=[]}use(e,t,A){return this.handlers.push({fulfilled:e,rejected:t,synchronous:A?A.synchronous:!1,runWhen:A?A.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){fe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const Io={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},rg={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ho,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Do=typeof window<"u"&&typeof document<"u",_o=typeof navigator=="object"&&navigator||void 0,ng=Do&&(!_o||["ReactNative","NativeScript","NS"].indexOf(_o.product)<0),sg=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",og=Do&&window.location.href||"http://localhost",Jt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Do,hasStandardBrowserEnv:ng,hasStandardBrowserWebWorkerEnv:sg,navigator:_o,origin:og},Symbol.toStringTag,{value:"Module"})),...rg};function ag(i,e){return Qn(i,new Jt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Jt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function lg(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function cg(i){const e={},t=Object.keys(i);let A;const r=t.length;let n;for(A=0;A<r;A++)n=t[A],e[n]=i[n];return e}function eh(i){function e(t,A,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&fe.isArray(r)?r.length:s,l?(fe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!fe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&fe.isArray(r[s])&&(r[s]=cg(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(lg(A),r,t,0)}),t}return null}function hg(i,e,t){if(fe.isString(i))try{return(e||JSON.parse)(i),fe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const Cr={transitional:Io,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=fe.isObject(e);if(n&&fe.isHTMLForm(e)&&(e=new FormData(e)),fe.isFormData(e))return r?JSON.stringify(eh(e)):e;if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)||fe.isReadableStream(e))return e;if(fe.isArrayBufferView(e))return e.buffer;if(fe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(A.indexOf("application/x-www-form-urlencoded")>-1)return ag(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Qn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),hg(e)):e}],transformResponse:[function(e){const t=this.transitional||Cr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(fe.isResponse(e)||fe.isReadableStream(e))return e;if(e&&fe.isString(e)&&(A&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Xe.from(o,Xe.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Jt.classes.FormData,Blob:Jt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],i=>{Cr.headers[i]={}});const ug=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),dg=i=>{const e={};let t,A,r;return i&&i.split(`
2
+ `).forEach(function(s){r=s.indexOf(":"),t=s.substring(0,r).trim().toLowerCase(),A=s.substring(r+1).trim(),!(!t||e[t]&&ug[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},th=Symbol("internals");function vr(i){return i&&String(i).trim().toLowerCase()}function Fn(i){return i===!1||i==null?i:fe.isArray(i)?i.map(Fn):String(i)}function pg(i){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let A;for(;A=t.exec(i);)e[A[1]]=A[2];return e}const fg=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Po(i,e,t,A,r){if(fe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!fe.isString(e)){if(fe.isString(A))return e.indexOf(A)!==-1;if(fe.isRegExp(A))return A.test(e)}}function mg(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function gg(i,e){const t=fe.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(i,A+t,{value:function(r,n,s){return this[A].call(this,e,r,n,s)},configurable:!0})})}let sA=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=vr(l);if(!u)throw new Error("header name must be a non-empty string");const g=fe.findKey(r,u);(!g||r[g]===void 0||c===!0||c===void 0&&r[g]!==!1)&&(r[g||l]=Fn(o))}const s=(o,l)=>fe.forEach(o,(c,u)=>n(c,u,l));if(fe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(fe.isString(e)&&(e=e.trim())&&!fg(e))s(dg(e),t);else if(fe.isObject(e)&&fe.isIterable(e)){let o={},l,c;for(const u of e){if(!fe.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[c=u[0]]=(l=o[c])?fe.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=vr(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return pg(r);if(fe.isFunction(t))return t.call(this,r,A);if(fe.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vr(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||Po(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=vr(s),s){const o=fe.findKey(A,s);o&&(!t||Po(A,A[o],o,t))&&(delete A[o],r=!0)}}return fe.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let A=t.length,r=!1;for(;A--;){const n=t[A];(!e||Po(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,A={};return fe.forEach(this,(r,n)=>{const s=fe.findKey(A,n);if(s){t[s]=Fn(r),delete t[n];return}const o=e?mg(n):String(n).trim();o!==n&&delete t[n],t[o]=Fn(r),A[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return fe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&fe.isArray(A)?A.join(", "):A)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[th]=this[th]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=vr(s);A[o]||(gg(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};sA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(sA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(sA);function No(i,e){const t=this||Cr,A=e||t,r=sA.from(A.headers);let n=A.data;return fe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function Ah(i){return!!(i&&i.__CANCEL__)}let Tr=class extends Xe{constructor(e,t,A){super(e??"canceled",Xe.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function ih(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Xe("Request failed with status code "+t.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function wg(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function Bg(i,e){i=i||10;const t=new Array(i),A=new Array(i);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let g=n,B=0;for(;g!==r;)B+=t[g++],g=g%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(B*1e3/v):void 0}}function yg(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),g=u-t;g>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-g)))},()=>r&&s(r)]}const Un=(i,e,t=3)=>{let A=0;const r=Bg(50,250);return yg(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const g={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(g)},t)},rh=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},nh=i=>(...e)=>fe.asap(()=>i(...e)),Cg=Jt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Jt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Jt.origin),Jt.navigator&&/(msie|trident)/i.test(Jt.navigator.userAgent)):()=>!0,vg=Jt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];fe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),fe.isString(A)&&o.push(`path=${A}`),fe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),fe.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Tg(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function bg(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function sh(i,e,t){let A=!Tg(e);return i&&(A||t==!1)?bg(i,e):e}const oh=i=>i instanceof sA?{...i}:i;function xi(i,e){e=e||{};const t={};function A(c,u,g,B){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:B},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,g,B){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,g,B)}else return A(c,u,g,B)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,g){if(g in e)return A(c,u);if(g in i)return A(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,u,g)=>r(oh(c),oh(u),g,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const g=fe.hasOwnProp(l,u)?l[u]:r,B=g(i[u],e[u],u);fe.isUndefined(B)&&g!==o||(t[u]=B)}),t}const ah=i=>{const e=xi({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=sA.from(s),e.url=qc(sh(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),fe.isFormData(t)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,g])=>{c.includes(u.toLowerCase())&&s.set(u,g)})}}if(Jt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&Cg(e.url))){const l=r&&n&&vg.read(n);l&&s.set(r,l)}return e},xg=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=ah(i);let n=r.data;const s=sA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,g,B,v,b;function C(){v&&v(),b&&b(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function F(){if(!U)return;const K=sA.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),M={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:K,config:i,request:U};ih(function(ne){t(ne),C()},function(ne){A(ne),C()},M),U=null}"onloadend"in U?U.onloadend=F:U.onreadystatechange=function(){!U||U.readyState!==4||U.status===0&&!(U.responseURL&&U.responseURL.indexOf("file:")===0)||setTimeout(F)},U.onabort=function(){U&&(A(new Xe("Request aborted",Xe.ECONNABORTED,i,U)),U=null)},U.onerror=function(G){const M=G&&G.message?G.message:"Network Error",W=new Xe(M,Xe.ERR_NETWORK,i,U);W.event=G||null,A(W),U=null},U.ontimeout=function(){let G=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||Io;r.timeoutErrorMessage&&(G=r.timeoutErrorMessage),A(new Xe(G,M.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&fe.forEach(s.toJSON(),function(G,M){U.setRequestHeader(M,G)}),fe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([B,b]=Un(c,!0),U.addEventListener("progress",B)),l&&U.upload&&([g,v]=Un(l),U.upload.addEventListener("progress",g),U.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=K=>{U&&(A(!K||K.type?new Tr(null,i,U):K),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const S=wg(r.url);if(S&&Jt.protocols.indexOf(S)===-1){A(new Xe("Unsupported protocol "+S+":",Xe.ERR_BAD_REQUEST,i));return}U.send(n||null)})},Qg=(i,e)=>{const{length:t}=i=i?i.filter(Boolean):[];if(e||t){let A=new AbortController,r;const n=function(c){if(!r){r=!0,o();const u=c instanceof Error?c:this.reason;A.abort(u instanceof Xe?u:new Tr(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Xe(`timeout of ${e}ms exceeded`,Xe.ETIMEDOUT))},e);const o=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),i=null)};i.forEach(c=>c.addEventListener("abort",n));const{signal:l}=A;return l.unsubscribe=()=>fe.asap(o),l}},Fg=function*(i,e){let t=i.byteLength;if(t<e){yield i;return}let A=0,r;for(;A<t;)r=A+e,yield i.slice(A,r),A=r},Ug=async function*(i,e){for await(const t of Sg(i))yield*Fg(t,e)},Sg=async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}const e=i.getReader();try{for(;;){const{done:t,value:A}=await e.read();if(t)break;yield A}}finally{await e.cancel()}},lh=(i,e,t,A)=>{const r=Ug(i,e);let n=0,s,o=l=>{s||(s=!0,A&&A(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){o(),l.close();return}let g=u.byteLength;if(t){let B=n+=g;t(B)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},ch=64*1024,{isFunction:Sn}=fe,Eg=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:hh,TextEncoder:uh}=fe.global,dh=(i,...e)=>{try{return!!i(...e)}catch{return!1}},Lg=i=>{i=fe.merge.call({skipUndefined:!0},Eg,i);const{fetch:e,Request:t,Response:A}=i,r=e?Sn(e):typeof fetch=="function",n=Sn(t),s=Sn(A);if(!r)return!1;const o=r&&Sn(hh),l=r&&(typeof uh=="function"?(b=>C=>b.encode(C))(new uh):async b=>new Uint8Array(await new t(b).arrayBuffer())),c=n&&o&&dh(()=>{let b=!1;const C=new t(Jt.origin,{body:new hh,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!C}),u=s&&o&&dh(()=>fe.isReadableStream(new A("").body)),g={stream:u&&(b=>b.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(C,U)=>{let F=C&&C[b];if(F)return F.call(C);throw new Xe(`Response type '${b}' is not supported`,Xe.ERR_NOT_SUPPORT,U)})});const B=async b=>{if(b==null)return 0;if(fe.isBlob(b))return b.size;if(fe.isSpecCompliantForm(b))return(await new t(Jt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(b)||fe.isArrayBuffer(b))return b.byteLength;if(fe.isURLSearchParams(b)&&(b=b+""),fe.isString(b))return(await l(b)).byteLength},v=async(b,C)=>{const U=fe.toFiniteNumber(b.getContentLength());return U??B(C)};return async b=>{let{url:C,method:U,data:F,signal:S,cancelToken:K,timeout:G,onDownloadProgress:M,onUploadProgress:W,responseType:ne,headers:J,withCredentials:V="same-origin",fetchOptions:ie}=ah(b),re=e||fetch;ne=ne?(ne+"").toLowerCase():"text";let ce=Qg([S,K&&K.toAbortSignal()],G),Z=null;const Ae=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let oe;try{if(W&&c&&U!=="get"&&U!=="head"&&(oe=await v(J,F))!==0){let Qe=new t(C,{method:"POST",body:F,duplex:"half"}),Fe;if(fe.isFormData(F)&&(Fe=Qe.headers.get("content-type"))&&J.setContentType(Fe),Qe.body){const[Be,ve]=rh(oe,Un(nh(W)));F=lh(Qe.body,ch,Be,ve)}}fe.isString(V)||(V=V?"include":"omit");const le=n&&"credentials"in t.prototype,se={...ie,signal:ce,method:U.toUpperCase(),headers:J.normalize().toJSON(),body:F,duplex:"half",credentials:le?V:void 0};Z=n&&new t(C,se);let ae=await(n?re(Z,ie):re(C,se));const pe=u&&(ne==="stream"||ne==="response");if(u&&(M||pe&&Ae)){const Qe={};["status","statusText","headers"].forEach(Ce=>{Qe[Ce]=ae[Ce]});const Fe=fe.toFiniteNumber(ae.headers.get("content-length")),[Be,ve]=M&&rh(Fe,Un(nh(M),!0))||[];ae=new A(lh(ae.body,ch,Be,()=>{ve&&ve(),Ae&&Ae()}),Qe)}ne=ne||"text";let we=await g[fe.findKey(g,ne)||"text"](ae,b);return!pe&&Ae&&Ae(),await new Promise((Qe,Fe)=>{ih(Qe,Fe,{data:we,headers:sA.from(ae.headers),status:ae.status,statusText:ae.statusText,config:b,request:Z})})}catch(le){throw Ae&&Ae(),le&&le.name==="TypeError"&&/Load failed|fetch/i.test(le.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,b,Z,le&&le.response),{cause:le.cause||le}):Xe.from(le,le&&le.code,b,Z,le&&le.response)}}},Mg=new Map,ph=i=>{let e=i&&i.env||{};const{fetch:t,Request:A,Response:r}=e,n=[A,r,t];let s=n.length,o=s,l,c,u=Mg;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:Lg(e)),u=c;return c};ph();const Oo={http:eg,xhr:xg,fetch:{get:ph}};fe.forEach(Oo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const fh=i=>`- ${i}`,Hg=i=>fe.isFunction(i)||i===null||i===!1;function Ig(i,e){i=fe.isArray(i)?i:[i];const{length:t}=i;let A,r;const n={};for(let s=0;s<t;s++){A=i[s];let o;if(r=A,!Hg(A)&&(r=Oo[(o=String(A)).toLowerCase()],r===void 0))throw new Xe(`Unknown adapter '${o}'`);if(r&&(fe.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
4
+ `+s.map(fh).join(`
5
+ `):" "+fh(s[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const mh={getAdapter:Ig,adapters:Oo};function ko(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Tr(null,i)}function gh(i){return ko(i),i.headers=sA.from(i.headers),i.data=No.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),mh.getAdapter(i.adapter||Cr.adapter,i)(i).then(function(A){return ko(i),A.data=No.call(i,i.transformResponse,A),A.headers=sA.from(A.headers),A},function(A){return Ah(A)||(ko(i),A&&A.response&&(A.response.data=No.call(i,i.transformResponse,A.response),A.response.headers=sA.from(A.response.headers))),Promise.reject(A)})}const wh="1.13.5",En={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{En[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const Bh={};En.transitional=function(e,t,A){function r(n,s){return"[Axios v"+wh+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new Xe(r(s," has been removed"+(t?" in "+t:"")),Xe.ERR_DEPRECATED);return t&&!Bh[s]&&(Bh[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(n,s,o):!0}},En.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function Dg(i,e,t){if(typeof i!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const A=Object.keys(i);let r=A.length;for(;r-- >0;){const n=A[r],s=e[n];if(s){const o=i[n],l=o===void 0||s(o,n,i);if(l!==!0)throw new Xe("option "+n+" must be "+l,Xe.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Xe("Unknown option "+n,Xe.ERR_BAD_OPTION)}}const Ln={assertOptions:Dg,validators:En},BA=Ln.validators;let Qi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new jc,response:new jc}}async request(e,t){try{return await this._request(e,t)}catch(A){if(A instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{A.stack?n&&!String(A.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(A.stack+=`
6
+ `+n):A.stack=n}catch{}}throw A}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=xi(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&Ln.assertOptions(A,{silentJSONParsing:BA.transitional(BA.boolean),forcedJSONParsing:BA.transitional(BA.boolean),clarifyTimeoutError:BA.transitional(BA.boolean),legacyInterceptorReqResOrdering:BA.transitional(BA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:Ln.assertOptions(r,{encode:BA.function,serialize:BA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ln.assertOptions(t,{baseUrl:BA.spelling("baseURL"),withXsrfToken:BA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&fe.merge(n.common,n[t.method]);n&&fe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete n[b]}),t.headers=sA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(t)===!1)return;l=l&&C.synchronous;const U=t.transitional||Io;U&&U.legacyInterceptorReqResOrdering?o.unshift(C.fulfilled,C.rejected):o.push(C.fulfilled,C.rejected)});const c=[];this.interceptors.response.forEach(function(C){c.push(C.fulfilled,C.rejected)});let u,g=0,B;if(!l){const b=[gh.bind(this),void 0];for(b.unshift(...o),b.push(...c),B=b.length,u=Promise.resolve(t);g<B;)u=u.then(b[g++],b[g++]);return u}B=o.length;let v=t;for(;g<B;){const b=o[g++],C=o[g++];try{v=b(v)}catch(U){C.call(this,U);break}}try{u=gh.call(this,v)}catch(b){return Promise.reject(b)}for(g=0,B=c.length;g<B;)u=u.then(c[g++],c[g++]);return u}getUri(e){e=xi(this.defaults,e);const t=sh(e.baseURL,e.url,e.allowAbsoluteUrls);return qc(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){Qi.prototype[e]=function(t,A){return this.request(xi(A||{},{method:e,url:t,data:(A||{}).data}))}}),fe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(xi(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Qi.prototype[e]=t(),Qi.prototype[e+"Form"]=t(!0)});let _g=class Mp{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(n){t=n});const A=this;this.promise.then(r=>{if(!A._listeners)return;let n=A._listeners.length;for(;n-- >0;)A._listeners[n](r);A._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{A.subscribe(o),n=o}).then(r);return s.cancel=function(){A.unsubscribe(n)},s},e(function(n,s,o){A.reason||(A.reason=new Tr(n,s,o),t(A.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=A=>{e.abort(A)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Mp(function(r){e=r}),cancel:e}}};function Pg(i){return function(t){return i.apply(null,t)}}function Ng(i){return fe.isObject(i)&&i.isAxiosError===!0}const Ko={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ko).forEach(([i,e])=>{Ko[e]=i});function yh(i){const e=new Qi(i),t=Oc(Qi.prototype.request,e);return fe.extend(t,Qi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return yh(xi(i,r))},t}const gt=yh(Cr);gt.Axios=Qi,gt.CanceledError=Tr,gt.CancelToken=_g,gt.isCancel=Ah,gt.VERSION=wh,gt.toFormData=Qn,gt.AxiosError=Xe,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=Pg,gt.isAxiosError=Ng,gt.mergeConfig=xi,gt.AxiosHeaders=sA,gt.formToJSON=i=>eh(fe.isHTMLForm(i)?new FormData(i):i),gt.getAdapter=mh.getAdapter,gt.HttpStatusCode=Ko,gt.default=gt;const{Axios:pb,AxiosError:fb,CanceledError:mb,isCancel:gb,CancelToken:wb,VERSION:Bb,all:yb,Cancel:Cb,isAxiosError:vb,spread:Tb,toFormData:bb,AxiosHeaders:xb,HttpStatusCode:Qb,formToJSON:Fb,getAdapter:Ub,mergeConfig:Sb}=gt,PA=Object.create(null);PA.open="0",PA.close="1",PA.ping="2",PA.pong="3",PA.message="4",PA.upgrade="5",PA.noop="6";const Mn=Object.create(null);Object.keys(PA).forEach(i=>{Mn[PA[i]]=i});const Vo={type:"error",data:"parser error"},Ch=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",vh=typeof ArrayBuffer=="function",Th=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,zo=({type:i,data:e},t,A)=>Ch&&e instanceof Blob?t?A(e):bh(e,A):vh&&(e instanceof ArrayBuffer||Th(e))?t?A(e):bh(new Blob([e]),A):A(PA[i]+(e||"")),bh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function xh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Wo;function Og(i,e){if(Ch&&i.data instanceof Blob)return i.data.arrayBuffer().then(xh).then(e);if(vh&&(i.data instanceof ArrayBuffer||Th(i.data)))return e(xh(i.data));zo(i,!1,t=>{Wo||(Wo=new TextEncoder),e(Wo.encode(t))})}const Qh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",br=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Qh.length;i++)br[Qh.charCodeAt(i)]=i;const kg=i=>{let e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);const c=new ArrayBuffer(e),u=new Uint8Array(c);for(A=0;A<t;A+=4)n=br[i.charCodeAt(A)],s=br[i.charCodeAt(A+1)],o=br[i.charCodeAt(A+2)],l=br[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Kg=typeof ArrayBuffer=="function",Ro=(i,e)=>{if(typeof i!="string")return{type:"message",data:Fh(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:Vg(i.substring(1),e)}:Mn[t]?i.length>1?{type:Mn[t],data:i.substring(1)}:{type:Mn[t]}:Vo},Vg=(i,e)=>{if(Kg){const t=kg(i);return Fh(t,e)}else return{base64:!0,data:i}},Fh=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,Uh="",zg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{zo(n,!1,o=>{A[s]=o,++r===t&&e(A.join(Uh))})})},Wg=(i,e)=>{const t=i.split(Uh),A=[];for(let r=0;r<t.length;r++){const n=Ro(t[r],e);if(A.push(n),n.type==="error")break}return A};function Rg(){return new TransformStream({transform(i,e){Og(i,t=>{const A=t.length;let r;if(A<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,A);else if(A<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,A)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(A))}i.data&&typeof i.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Go;function Hn(i){return i.reduce((e,t)=>e+t.length,0)}function In(i,e){if(i[0].length===e)return i.shift();const t=new Uint8Array(e);let A=0;for(let r=0;r<e;r++)t[r]=i[0][A++],A===i[0].length&&(i.shift(),A=0);return i.length&&A<i[0].length&&(i[0]=i[0].slice(A)),t}function Gg(i,e){Go||(Go=new TextDecoder);const t=[];let A=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(Hn(t)<1)break;const l=In(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?A=3:r===126?A=1:A=2}else if(A===1){if(Hn(t)<2)break;const l=In(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(Hn(t)<8)break;const l=In(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(Vo);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(Hn(t)<r)break;const l=In(t,r);o.enqueue(Ro(n?l:Go.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(Vo);break}}}})}const Sh=4;function _t(i){if(i)return $g(i)}function $g(i){for(var e in _t.prototype)i[e]=_t.prototype[e];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},_t.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var A,r=0;r<t.length;r++)if(A=t[r],A===e||A.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+i],this},_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){t=t.slice(0);for(var A=0,r=t.length;A<r;++A)t[A].apply(this,e)}return this},_t.prototype.emitReserved=_t.prototype.emit,_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),yA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Xg="arraybuffer";function Eb(){}function Eh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Jg=yA.setTimeout,Zg=yA.clearTimeout;function _n(i,e){e.useNativeTimers?(i.setTimeoutFn=Jg.bind(yA),i.clearTimeoutFn=Zg.bind(yA)):(i.setTimeoutFn=yA.setTimeout.bind(yA),i.clearTimeoutFn=yA.clearTimeout.bind(yA))}const Yg=1.33;function qg(i){return typeof i=="string"?jg(i):Math.ceil((i.byteLength||i.size)*Yg)}function jg(i){let e=0,t=0;for(let A=0,r=i.length;A<r;A++)e=i.charCodeAt(A),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(A++,t+=4);return t}function Lh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function e1(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function t1(i){let e={},t=i.split("&");for(let A=0,r=t.length;A<r;A++){let n=t[A].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class A1 extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class $o extends _t{constructor(e){super(),this.writable=!1,_n(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,A){return super.emitReserved("error",new A1(e,t,A)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Ro(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=e1(e);return t.length?"?"+t:""}}class i1 extends $o{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let A=0;this._polling&&(A++,this.once("pollComplete",function(){--A||t()})),this.writable||(A++,this.once("drain",function(){--A||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=A=>{if(this.readyState==="opening"&&A.type==="open"&&this.onOpen(),A.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(A)};Wg(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,zg(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Lh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Mh=!1;try{Mh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const r1=Mh;function n1(){}class s1 extends i1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let A=location.port;A||(A=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||A!==e.port}}doWrite(e,t){const A=this.request({method:"POST",data:e});A.on("success",t),A.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,A)=>{this.onError("xhr poll error",t,A)}),this.pollXhr=e}}class NA extends _t{constructor(e,t,A){super(),this.createRequest=e,_n(this,A),this._opts=A,this._method=A.method||"GET",this._uri=t,this._data=A.data!==void 0?A.data:null,this._create()}_create(){var e;const t=Eh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const A=this._xhr=this.createRequest(t);try{A.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){A.setDisableHeaderCheck&&A.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&A.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{A.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{A.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(A),"withCredentials"in A&&(A.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(A.timeout=this._opts.requestTimeout),A.onreadystatechange=()=>{var r;A.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(A.getResponseHeader("set-cookie"))),A.readyState===4&&(A.status===200||A.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof A.status=="number"?A.status:0)},0))},A.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=NA.requestsCount++,NA.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=n1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete NA.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(NA.requestsCount=0,NA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Hh);else if(typeof addEventListener=="function"){const i="onpagehide"in yA?"pagehide":"unload";addEventListener(i,Hh,!1)}}function Hh(){for(let i in NA.requests)NA.requests.hasOwnProperty(i)&&NA.requests[i].abort()}const o1=(function(){const i=Ih({xdomain:!1});return i&&i.responseType!==null})();class a1 extends s1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=o1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new NA(Ih,this.uri(),e)}}function Ih(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||r1))return new XMLHttpRequest}catch{}if(!e)try{return new yA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Dh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class l1 extends $o{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=Dh?{}:Eh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(A.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,A)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;zo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Lh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Xo=yA.WebSocket||yA.MozWebSocket;class c1 extends l1{createSocket(e,t,A){return Dh?new Xo(e,t,A):t?new Xo(e,t):new Xo(e)}doWrite(e,t){this.ws.send(t)}}class h1 extends $o{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Gg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=Rg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{A.read().then(({done:o,value:l})=>{o||(this.onPacket(l),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;this._writer.write(A).then(()=>{r&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const u1={websocket:c1,webtransport:h1,polling:a1},d1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,p1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Jo(i){if(i.length>8e3)throw"URI too long";const e=i,t=i.indexOf("["),A=i.indexOf("]");t!=-1&&A!=-1&&(i=i.substring(0,t)+i.substring(t,A).replace(/:/g,";")+i.substring(A,i.length));let r=d1.exec(i||""),n={},s=14;for(;s--;)n[p1[s]]=r[s]||"";return t!=-1&&A!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=f1(n,n.path),n.queryKey=m1(n,n.query),n}function f1(i,e){const t=/\/{2,9}/g,A=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&A.splice(0,1),e.slice(-1)=="/"&&A.splice(A.length-1,1),A}function m1(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Zo=typeof addEventListener=="function"&&typeof removeEventListener=="function",Pn=[];Zo&&addEventListener("offline",()=>{Pn.forEach(i=>i())},!1);class si extends _t{constructor(e,t){if(super(),this.binaryType=Xg,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const A=Jo(e);t.hostname=A.host,t.secure=A.protocol==="https"||A.protocol==="wss",t.port=A.port,A.query&&(t.query=A.query)}else t.host&&(t.hostname=Jo(t.host).host);_n(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(A=>{const r=A.prototype.name;this.transports.push(r),this._transportsByName[r]=A}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=t1(this.opts.query)),Zo&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Pn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Sh,t.transport=e,this.id&&(t.sid=this.id);const A=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](A)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&si.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",si.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let A=0;A<this.writeBuffer.length;A++){const r=this.writeBuffer[A].data;if(r&&(t+=qg(r)),A>0&&t>this._maxPayload)return this.writeBuffer.slice(0,A);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Dn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,A){return this._sendPacket("message",e,t,A),this}send(e,t,A){return this._sendPacket("message",e,t,A),this}_sendPacket(e,t,A,r){if(typeof t=="function"&&(r=t,t=void 0),typeof A=="function"&&(r=A,A=null),this.readyState==="closing"||this.readyState==="closed")return;A=A||{},A.compress=A.compress!==!1;const n={type:e,data:t,options:A};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},A=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?A():e()}):this.upgrading?A():e()),this}_onError(e){if(si.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Zo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Pn.indexOf(this._offlineEventListener);A!==-1&&Pn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}si.protocol=Sh;class g1 extends si{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),A=!1;si.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",g=>{if(!A)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;si.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const B=new Error("probe error");B.transport=t.name,this.emitReserved("upgradeError",B)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=g=>{const B=new Error("probe error: "+g);B.transport=t.name,n(),this.emitReserved("upgradeError",B)};function o(){s("transport closed")}function l(){s("socket closed")}function c(g){t&&g.name!==t.name&&n()}const u=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{A||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let A=0;A<e.length;A++)~this.transports.indexOf(e[A])&&t.push(e[A]);return t}}let w1=class extends g1{constructor(e,t={}){const A=typeof e=="object"?e:t;(!A.transports||A.transports&&typeof A.transports[0]=="string")&&(A.transports=(A.transports||["polling","websocket","webtransport"]).map(r=>u1[r]).filter(r=>!!r)),super(e,A)}};function B1(i,e="",t){let A=i;t=t||typeof location<"u"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(typeof t<"u"?i=t.protocol+"//"+i:i="https://"+i),A=Jo(i)),A.port||(/^(http|ws)$/.test(A.protocol)?A.port="80":/^(http|ws)s$/.test(A.protocol)&&(A.port="443")),A.path=A.path||"/";const n=A.host.indexOf(":")!==-1?"["+A.host+"]":A.host;return A.id=A.protocol+"://"+n+":"+A.port+e,A.href=A.protocol+"://"+n+(t&&t.port===A.port?"":":"+A.port),A}const y1=typeof ArrayBuffer=="function",C1=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,_h=Object.prototype.toString,v1=typeof Blob=="function"||typeof Blob<"u"&&_h.call(Blob)==="[object BlobConstructor]",T1=typeof File=="function"||typeof File<"u"&&_h.call(File)==="[object FileConstructor]";function Yo(i){return y1&&(i instanceof ArrayBuffer||C1(i))||v1&&i instanceof Blob||T1&&i instanceof File}function Nn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(Nn(i[t]))return!0;return!1}if(Yo(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Nn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&Nn(i[t]))return!0;return!1}function b1(i){const e=[],t=i.data,A=i;return A.data=qo(t,e),A.attachments=e.length,{packet:A,buffers:e}}function qo(i,e){if(!i)return i;if(Yo(i)){const t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){const t=new Array(i.length);for(let A=0;A<i.length;A++)t[A]=qo(i[A],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){const t={};for(const A in i)Object.prototype.hasOwnProperty.call(i,A)&&(t[A]=qo(i[A],e));return t}return i}function x1(i,e){return i.data=jo(i.data,e),delete i.attachments,i}function jo(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=jo(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=jo(i[t],e));return i}const Q1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ht;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(ht||(ht={}));class F1{constructor(e){this.replacer=e}encode(e){return(e.type===ht.EVENT||e.type===ht.ACK)&&Nn(e)?this.encodeAsBinary({type:e.type===ht.EVENT?ht.BINARY_EVENT:ht.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ht.BINARY_EVENT||e.type===ht.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=b1(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class ea extends _t{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const A=t.type===ht.BINARY_EVENT;A||t.type===ht.BINARY_ACK?(t.type=A?ht.EVENT:ht.ACK,this.reconstructor=new U1(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Yo(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const A={type:Number(e.charAt(0))};if(ht[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===ht.BINARY_EVENT||A.type===ht.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");A.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););A.nsp=e.substring(n,t)}else A.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}A.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(ea.isPayloadValid(A.type,n))A.data=n;else throw new Error("invalid payload")}return A}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ht.CONNECT:return Ph(t);case ht.DISCONNECT:return t===void 0;case ht.CONNECT_ERROR:return typeof t=="string"||Ph(t);case ht.EVENT:case ht.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Q1.indexOf(t[0])===-1);case ht.ACK:case ht.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class U1{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=x1(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Ph(i){return Object.prototype.toString.call(i)==="[object Object]"}const S1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ea,Encoder:F1,get PacketType(){return ht}},Symbol.toStringTag,{value:"Module"}));function SA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const E1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Nh extends _t{constructor(e,t,A){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,A&&A.auth&&(this.auth=A.auth),this._opts=Object.assign({},A),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[SA(e,"open",this.onopen.bind(this)),SA(e,"packet",this.onpacket.bind(this)),SA(e,"error",this.onerror.bind(this)),SA(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var A,r,n;if(E1.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ht.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,g=t.pop();this._registerAckCallback(u,g),s.id=u}const o=(r=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const r=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,r)=>{const n=(s,o)=>s?r(s):A(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const A={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),A.pending=!1,this._drainQueue())),this._queue.push(A),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ht.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(A=>String(A.id)===e)){const A=this.acks[e];delete this.acks[e],A.withError&&A.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ht.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ht.EVENT:case ht.BINARY_EVENT:this.onevent(e);break;case ht.ACK:case ht.BINARY_ACK:this.onack(e);break;case ht.DISCONNECT:this.ondisconnect();break;case ht.CONNECT_ERROR:this.destroy();const A=new Error(e.data.message);A.data=e.data.data,this.emitReserved("connect_error",A);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const A of t)A.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let A=!1;return function(...r){A||(A=!0,t.packet({type:ht.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ht.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const A of t)A.apply(this,e.data)}}}function Wi(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Wi.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=(Math.floor(e*10)&1)==0?i-t:i+t}return Math.min(i,this.max)|0},Wi.prototype.reset=function(){this.attempts=0},Wi.prototype.setMin=function(i){this.ms=i},Wi.prototype.setMax=function(i){this.max=i},Wi.prototype.setJitter=function(i){this.jitter=i};class ta extends _t{constructor(e,t){var A;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,_n(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((A=t.randomizationFactor)!==null&&A!==void 0?A:.5),this.backoff=new Wi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||S1;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new w1(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=SA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=SA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(SA(e,"ping",this.onping.bind(this)),SA(e,"data",this.ondata.bind(this)),SA(e,"error",this.onerror.bind(this)),SA(e,"close",this.onclose.bind(this)),SA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Dn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let A=this.nsps[e];return A?this._autoConnect&&!A.active&&A.connect():(A=new Nh(this,e,t),this.nsps[e]=A),A}_destroy(e){const t=Object.keys(this.nsps);for(const A of t)if(this.nsps[A].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let A=0;A<t.length;A++)this.engine.write(t[A],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var A;this.cleanup(),(A=this.engine)===null||A===void 0||A.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const A=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&A.unref(),this.subs.push(()=>{this.clearTimeoutFn(A)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const xr={};function On(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=B1(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=xr[r]&&n in xr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new ta(A,e):(xr[r]||(xr[r]=new ta(A,e)),l=xr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(On,{Manager:ta,Socket:Nh,io:On,connect:On});function Aa(i){if(!i)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(i,e),A=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${A}`}catch{return String(i).trim().replace(/\/+$/,"")}}let dA=Aa("http://localhost:8000");function Oh(i){const e=Aa(i);e&&e!==dA&&(dA=e,Et&&(Et.disconnect(),Et.removeAllListeners(),Et=null))}let Et=null;function L1(){const i=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=i();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:dA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=On(dA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),A=()=>{const r=i();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:dA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:dA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=A();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:dA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:dA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function ia(){const i=Aa(Et?.io?.uri||null);return!Et||Et.io&&i&&dA&&i!==dA?(Et&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:dA,wasConnected:Et.connected,reason:"baseUrl changed"}),Et.disconnect(),Et.removeAllListeners(),Et=null),Et=L1()):Et.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Et.id,connected:Et.connected,baseUrl:dA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Et.id,baseUrl:dA}),Et}function M1(i,e){const t=ia();return t.on(i,e),()=>t.off(i,e)}function H1(i,e){Et&&Et.off(i,e)}function I1(i,e){ia().emit(i,e)}function D1(){return Et?Et.connected?"connected":"connecting":"disconnected"}const kn={getSocket:ia,on:M1,off:H1,emit:I1,getStatus:D1,setBaseUrl:Oh},_1={},kh=Y.createContext(),zt=()=>{const i=Y.useContext(kh);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},P1=({children:i,baseUrl:e,endpoints:t,accountId:A,initialSymbol:r,initialTimeframe:n,indicators:s,indicatorSettings:o})=>{const l=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ws&&Ws.tagName.toUpperCase()==="SCRIPT"&&Ws.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&_1?.VITE_BASE_URL)??"http://localhost:5002";kn.setBaseUrl(l);const u={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},g=t?.params||{},[B,v]=Y.useState(r||"BTC/USD"),[b,C]=Y.useState(n||"M1"),[U,F]=Y.useState([]),[S,K]=Y.useState(!0),[G,M]=Y.useState([]),[W,ne]=Y.useState(!1),[J,V]=Y.useState(1e5),[ie,re]=Y.useState(null),[ce,Z]=Y.useState([]),[Ae,oe]=Y.useState(!0),[le,se]=Y.useState(!1),[ae,pe]=Y.useState(!0),[we,Qe]=Y.useState("candles"),[Fe,Be]=Y.useState(!1),[ve,Ce]=Y.useState("dark"),[be,Le]=Y.useState(null),[Ge,Ke]=Y.useState(!1),[Te,_e]=Y.useState(!1),[ye,de]=Y.useState(!1),[Pe,et]=Y.useState(!1),[it,rt]=Y.useState(!1),[dt,fA]=Y.useState(!1),[Ze,Oe]=Y.useState(!1),[at,At]=Y.useState(!1),[Ct,xt]=Y.useState(!1),[GA,$A]=Y.useState(!1),[Gt,mA]=Y.useState([]),XA=Y.useRef(null),Kt=Y.useRef(new Map),Ut=Y.useRef(null),gA=1e3,nt=Y.useCallback(async()=>{if(A)try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;ne(!0);const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Me}`}});let Ue=[];Array.isArray(ze.data)?Ue=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Ue=ze.data.data);const We=Ue.filter(Ne=>Ne.closePrice===null||Ne.closePrice===void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,comment:Ne.comment||"",status:"OPEN",swap:0,profit:Ne.profit||0,profitCurrency:"USD",time:new Date(Ne.openedAt||Ne.openAt||Date.now()).toLocaleTimeString(),openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt}));M(We)}catch(Me){console.error("❌ Error fetching orders:",Me.response?.data||Me.message),M([])}finally{ne(!1)}},[l,A]),mt=Y.useCallback((Me,ze)=>!ze||!Me.price||isNaN(ze)||isNaN(Me.price)?Me.profit||0:(Me?.type?.toUpperCase()==="BUY"?ze-Me.price:Me.price-ze)*Me.volume,[]),St=Y.useCallback(async()=>{try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;const ze=await gt.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${Me}`}});if(ze.data&&ze.data.data){const Ue=parseFloat(ze.data.data.balance);isNaN(Ue)||V(Ue)}}catch(Me){console.error("❌ Error fetching user balance:",Me.response?.data||Me.message)}},[l]),It=Y.useCallback(async()=>{if(A)try{const Me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Me)return;const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Me}`}});let Ue=[];Array.isArray(ze.data)?Ue=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Ue=ze.data.data);const We=Ue.filter(Ne=>Ne.closePrice!==null&&Ne.closePrice!==void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,closePrice:Ne.closePrice,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,profit:Ne.profit??Ne.profitLoss??0,profitCurrency:"USD",openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt,closeReason:Ne.closeReason||"",status:"CLOSED"}));mA(We)}catch(Me){console.error("❌ Error fetching history orders:",Me.response?.data||Me.message),mA([])}},[l,A]),$e=Y.useMemo(()=>{const Me=J,ze=G.reduce((lt,vt)=>lt+vt.volume*vt.price*.01,0),Ue=G.reduce((lt,vt)=>{const cA=U.find(Ai=>Ai.symbol===vt.symbol);if(cA){const Ai=vt.type?.toUpperCase()==="BUY"?parseFloat(cA.bid||0):parseFloat(cA.ask||0);if(Ai&&Ai>0&&!isNaN(Ai))return lt+mt(vt,Ai)}return lt+(vt.profit||0)},0),We=Me+Ue,Ne=We-ze,st=ze>0?We/ze*100:0;return{balance:Me,equity:We,margin:ze,freeMargin:Ne,level:st.toFixed(2)}},[G,U,J,mt]);Y.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(nt(),St(),It())},[nt,St,It,A]),Y.useEffect(()=>{(async()=>{try{K(!0);const ze=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Ue=localStorage.getItem("token")??localStorage.getItem("authToken"),We=await gt.get(ze,{headers:Ue?{Authorization:`Bearer ${Ue}`}:{}});let Ne=[];Array.isArray(We.data)?Ne=We.data:We.data&&We.data.data&&Array.isArray(We.data.data)?Ne=We.data.data:We.data&&We.data.prices&&Array.isArray(We.data.prices)?Ne=We.data.prices:We.data&&Array.isArray(We.data)&&(Ne=We.data);const st=Ne.map(lt=>{const vt=lt.symbol||lt.name||"",cA=lt.category||null;return vt&&(lt.bid!==void 0||lt.price!==void 0)?{symbol:vt,bid:lt.bid??lt.price??0,ask:lt.ask??lt.price??0,change:lt.change??0,category:cA}:{...lt,symbol:vt,category:cA}});st.length>0?(F(st),st.find(vt=>vt.symbol===B)||v(st[0].symbol)):F([])}catch(ze){console.error("❌ Error fetching symbols:",ze.response?.data||ze.message),F([])}finally{K(!1)}})()},[l,u.symbols]);const He=Y.useCallback(()=>{const Me=Kt.current;if(Me.size===0)return;const ze=new Map(Me);Me.clear(),F(Ue=>Ue.map(We=>{const Ne=ze.get(We.symbol);return Ne?{...We,...Ne}:We})),M(Ue=>{let We=!1;const Ne=Ue.map(st=>{const lt=ze.get(st.symbol);if(!lt)return st;const vt=st.type?.toUpperCase()==="BUY"?parseFloat(lt.bid||0):parseFloat(lt.ask||0);if(!vt||isNaN(vt)||vt<=0)return st;const cA=mt(st,vt);return cA===st.profit?st:(We=!0,{...st,profit:cA})});return We?Ne:Ue})},[mt]);Y.useEffect(()=>{XA.current||(XA.current=kn.getSocket());const Me=XA.current,ze=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Me.emit("joinUserRoom",{userId:Number(A)})},Ue=()=>console.log("⚠️ TradingContext: Disconnected"),We=st=>{st?.symbol&&(Kt.current.set(st.symbol,st),Ut.current||(Ut.current=setTimeout(()=>{Ut.current=null,He()},gA)))},Ne=async st=>{if(st){if(st.newBalance!==void 0){const lt=parseFloat(st.newBalance);isNaN(lt)||V(lt)}if(window.notify){const lt=st.profitLoss||st.profit||0,vt=lt>=0?`+${lt.toFixed(2)}`:lt.toFixed(2),cA=st.symbol||"Trade",Ai=st.reason||"Closed";window.notify(`Trade Closed: ${Ai} | ${cA} | P/L: ${vt} USD`,lt>=0?"success":"error")}st.tradeId&&M(lt=>lt.filter(vt=>vt.id!==st.tradeId)),await nt(),await St()}};return Me.on("connect",ze),Me.on("disconnect",Ue),Me.on("priceUpdate",We),Me.on("tradeClosed",Ne),Me.connected&&A&&Number.isFinite(Number(A))&&Me.emit("joinUserRoom",{userId:Number(A)}),()=>{Me.off("connect",ze),Me.off("disconnect",Ue),Me.off("priceUpdate",We),Me.off("tradeClosed",Ne),Ut.current&&(clearTimeout(Ut.current),Ut.current=null),Kt.current.clear()}},[He,nt,St]),Y.useEffect(()=>{try{const Me=document.documentElement;if(!Me)return;Me.dataset.theme=ve}catch{}},[ve]);const tt=Y.useMemo(()=>U.find(Me=>Me.symbol===B)||{bid:"0.00000",ask:"0.00000",change:0},[U,B]),Je=Y.useMemo(()=>({selectedSymbol:B,setSelectedSymbol:v,selectedTimeframe:b,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:S,orders:G,setOrders:M,ordersLoading:W,fetchOrders:nt,fetchUserBalance:St,userBalance:J,setUserBalance:V,accountSummary:$e,currentSymbolData:tt,activeTool:ie,setActiveTool:re,chartObjects:ce,setChartObjects:Z,showGrid:Ae,setShowGrid:oe,snapToGrid:le,setSnapToGrid:se,drawingsVisible:ae,setDrawingsVisible:pe,chartType:we,setChartType:Qe,chartLocked:Fe,setChartLocked:Be,theme:ve,setTheme:Ce,candleColors:be,setCandleColors:Le,showTradeOrders:Ge,setShowTradeOrders:Ke,showTradePosition:Te,setShowTradePosition:_e,showTradeHistory:ye,setShowTradeHistory:de,showSLTP:Pe,setShowSLTP:et,showAskPrice:it,setShowAskPrice:rt,showChartControls:dt,setShowChartControls:fA,showTradeNotification:Ze,setShowTradeNotification:Oe,showCrosshair:at,setShowCrosshair:At,showOHLC:Ct,setShowOHLC:xt,baseUrl:l,endpoints:u,endpointParams:g,accountId:A,isShow:GA,setIsShow:$A,historyOrders:Gt,setHistoryOrders:mA,fetchHistoryOrders:It,indicators:s,indicatorSettings:o}),[B,b,U,S,G,W,nt,St,J,$e,tt,ie,ce,Ae,le,ae,we,Fe,ve,be,Ge,Te,ye,Pe,it,dt,Ze,at,Ct,l,u,g,GA,Gt,It,s,o]);return a.jsx(kh.Provider,{value:Je,children:i})};var Kh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Vh=Y.createContext&&Y.createContext(Kh),N1=["attr","size","title"];function O1(i,e){if(i==null)return{};var t=k1(i,e),A,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)A=n[r],!(e.indexOf(A)>=0)&&Object.prototype.propertyIsEnumerable.call(i,A)&&(t[A]=i[A])}return t}function k1(i,e){if(i==null)return{};var t={};for(var A in i)if(Object.prototype.hasOwnProperty.call(i,A)){if(e.indexOf(A)>=0)continue;t[A]=i[A]}return t}function Kn(){return Kn=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(i[A]=t[A])}return i},Kn.apply(this,arguments)}function zh(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(i);e&&(A=A.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,A)}return t}function Vn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zh(Object(t),!0).forEach(function(A){K1(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):zh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function K1(i,e,t){return e=V1(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function V1(i){var e=z1(i,"string");return typeof e=="symbol"?e:e+""}function z1(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var A=t.call(i,e);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Wh(i){return i&&i.map((e,t)=>Y.createElement(e.tag,Vn({key:t},e.attr),Wh(e.child)))}function eA(i){return e=>Y.createElement(W1,Kn({attr:Vn({},i.attr)},e),Wh(i.child))}function W1(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=O1(i,N1),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),Y.createElement("svg",Kn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Vn(Vn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),i.children)};return Vh!==void 0?Y.createElement(Vh.Consumer,null,t=>e(t)):e(Kh)}function R1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(i)}function G1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(i)}function $1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(i)}function X1(i){return eA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(i)}function Rh(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(i)}function J1(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(i)}function Z1(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(i)}function Y1(i){return eA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(i)}function q1(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(i)}function j1(i){return eA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(i)}const ew={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Gh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=zt(),c=r==="light",[u,g]=Y.useState("0.01"),[B,v]=Y.useState(""),[b,C]=Y.useState(!1),U=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",S=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",K=M=>{const W=parseFloat(u)||.01,ne=Math.max(.01,W+M);g(ne.toFixed(2))},G=async M=>{v("");const W=M,ne=parseFloat(W==="BUY"?e:i),J=parseFloat(u);if(!J||J<=0||isNaN(J)){v("Please enter a valid volume (minimum 0.01)");return}if(J<.01){v("Volume must be at least 0.01");return}if(!ne||ne<=0||isNaN(ne)){v("Invalid price. Please refresh and try again.");return}const V=localStorage.getItem("token")??localStorage.getItem("authToken");if(!V){v("Please login to place trades");return}C(!0);const ie=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:ie,type:W,volume:J,openPrice:ne,takeProfit:null,stopLoss:null};try{const ce=o||ew?.VITE_BASE_URL||"http://localhost:8000",Z=l?.trades||"/api/trades",Ae=await gt.post(`${ce}${Z}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(Ae.status<200||Ae.status>=300){v(Ae.data?.message||`Failed to place trade (${Ae.status})`);return}s&&s(),A&&A()}catch(ce){const Z=ce?.response?.data?.message||ce?.message||"Network error. Please try again.";v(Z)}finally{C(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>G("SELL"),disabled:b,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:i?Number(i).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${U}`,children:[a.jsx("button",{type:"button",onClick:()=>K(-.01),className:`w-5 flex items-center justify-center ${F} ${S} transition-colors`,children:a.jsx(Rh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:M=>{const W=M.target.value;(W===""||/^\d*\.?\d{0,2}$/.test(W))&&g(W)},onBlur:()=>{const M=parseFloat(u);g(isNaN(M)||M<.01?"0.01":M.toFixed(2))},className:`w-14 text-center focus:outline-none ${U} ${F}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>K(.01),className:`w-5 flex items-center justify-center ${F} ${S} transition-colors`,children:a.jsx(J1,{size:8})})]}),a.jsxs("button",{onClick:()=>G("BUY"),disabled:b,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),B&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:B})]})},tw={},$h=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:g,selectedTimeframe:B,setOrders:v,symbols:b,fetchOrders:C,theme:U,baseUrl:F,endpoints:S}=zt(),K=U==="light",G={getContractSpec:Ze=>{const Oe=String(Ze||"").toUpperCase();return Oe.includes("BTC")||Oe.includes("ETH")||Oe.includes("SOL")||Oe.includes("XRP")||Oe.includes("ADA")||Oe.includes("DOGE")||Oe.includes("BNB")||Oe.includes("AVAX")||Oe.includes("DOT")||Oe.includes("LINK")||Oe.endsWith("USDT")?{contractSize:1}:Oe.includes("XAU")||Oe.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Ze,volume:Oe})=>{const at=G.getContractSpec(Ze);return(parseFloat(Oe)||0)*(at.contractSize||1)}},M=u||G,[W,ne]=Y.useState("0.01"),[J,V]=Y.useState(""),[ie,re]=Y.useState(""),[ce,Z]=Y.useState(""),[Ae,oe]=Y.useState(!1),[le,se]=Y.useState(null),[ae,pe]=Y.useState(""),[we,Qe]=Y.useState(t||"BUY"),[Fe,Be]=Y.useState(parseFloat(A)||0),[ve,Ce]=Y.useState(parseFloat(r)||0),[be,Le]=Y.useState("text-white"),[Ge,Ke]=Y.useState("text-white"),Te=Y.useRef(parseFloat(A)||0),_e=Y.useRef(parseFloat(r)||0);Y.useEffect(()=>{if(!i)return;const Ze=kn.getSocket(),Oe=At=>{if(!(!At||!At.symbol)&&At.symbol.toUpperCase()===g?.toUpperCase()){const Ct=parseFloat(At.bid)||0,xt=parseFloat(At.ask)||0;Ct>0&&(Ct>Te.current?(Le("text-green-400"),setTimeout(()=>Le("text-white"),500)):Ct<Te.current&&Te.current>0&&(Le("text-red-400"),setTimeout(()=>Le("text-white"),500)),Be(Ct),Te.current=Ct),xt>0&&(xt>_e.current?(Ke("text-green-400"),setTimeout(()=>Ke("text-white"),500)):xt<_e.current&&_e.current>0&&(Ke("text-red-400"),setTimeout(()=>Ke("text-white"),500)),Ce(xt),_e.current=xt)}};Ze.on("priceUpdate",Oe);const at=b.find(At=>At.symbol===g);if(at){const At=parseFloat(at.bid)||0,Ct=parseFloat(at.ask)||0;At>0&&(Be(At),Te.current=At),Ct>0&&(Ce(Ct),_e.current=Ct)}return()=>{Ze.off("priceUpdate",Oe)}},[i,g,b]),Y.useEffect(()=>{if(i){ne(o?String(o):"0.01"),V(""),re(""),Z(""),pe(""),Qe(t||"BUY");const Ze=parseFloat(A)||0,Oe=parseFloat(r)||0;Ze>0&&(Be(Ze),Te.current=Ze),Oe>0&&(Ce(Oe),_e.current=Oe)}},[i,t,A,r,o]);const ye=Fe||0,de=ve||0,Pe=Ze=>{const Oe=parseFloat(W)||.01,at=Math.max(.01,Oe+Ze);ne(at.toFixed(2))},et=Ze=>{const Oe=parseFloat(J)||0,at=parseFloat(we==="BUY"?ve:Fe)||0;if(!at){pe("Current price not available. Please wait...");return}let At=Oe+Ze;we==="BUY"?At=Math.max(1e-5,Math.min(At,at-1e-5)):At=Math.max(at+1e-5,At),V(At>0?At.toFixed(5):""),pe("")},it=Ze=>{const Oe=parseFloat(ie)||0,at=parseFloat(we==="BUY"?ve:Fe)||0;if(!at){pe("Current price not available. Please wait...");return}let At=Oe+Ze;we==="BUY"?At=Math.max(at+1e-5,At):At=Math.max(1e-5,Math.min(At,at-1e-5)),re(At>0?At.toFixed(5):""),pe("")},rt=async Ze=>{pe("");const Oe=Ze||we,at=parseFloat(Oe==="BUY"?ve:Fe),At=parseFloat(W),Ct=J?parseFloat(J):null,xt=ie?parseFloat(ie):null;if(!At||At<=0||isNaN(At)){pe("Please enter a valid volume (minimum 0.01)");return}if(At<.01){pe("Volume must be at least 0.01");return}if(!at||at<=0||isNaN(at)){pe("Invalid price. Please refresh and try again.");return}if(Ct!==null&&Ct!==""){if(isNaN(Ct)||Ct<=0){pe("Stop Loss must be a valid positive number");return}if(Oe==="BUY"&&Ct>=at){pe("Stop Loss must be below the current price for BUY orders");return}if(Oe==="SELL"&&Ct<=at){pe("Stop Loss must be above the current price for SELL orders");return}}if(xt!==null&&xt!==""){if(isNaN(xt)||xt<=0){pe("Take Profit must be a valid positive number");return}if(Oe==="BUY"){if(xt<=at){pe(`Take Profit must be above the entry price (${at.toFixed(5)}) for BUY orders`);return}}else if(Oe==="SELL"&&xt>=at){pe(`Take Profit must be below the entry price (${at.toFixed(5)}) for SELL orders`);return}}Qe(Oe),se(Oe),oe(!0);const GA=new Date,$A=GA.toLocaleTimeString(),Gt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,mA=localStorage.getItem("token")??localStorage.getItem("authToken");if(!mA){pe("Please login to place trades"),oe(!1),se(null);return}const XA={accountId:s,symbol:g,type:Oe,volume:At,price:at,takeProfit:xt,stopLoss:Ct,comment:ce.trim()||null},Kt={ticket:Gt.substring(0,8),symbol:g,type:Oe,volume:parseFloat(At),price:parseFloat(at),time:$A,stopLoss:Ct?parseFloat(Ct):null,takeProfit:xt?parseFloat(xt):null,swap:0,profit:0,profitCurrency:"USD",comment:ce.trim()||"",id:Gt,status:"OPEN",openAt:GA.toISOString()};if(!l&&v&&v(Ut=>[...Ut,Kt]),c&&!n){pe("Execution handler is required in forceParentExecution mode"),oe(!1),se(null);return}if(n){oe(!1),se(null),e();const Ut={symbol:g,type:Oe,lotSize:At,entryPrice:at,stopLoss:Ct,takeProfit:xt,comment:ce.trim()||null};Promise.resolve(n(Ut)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(gA=>{console.error("❌ Trade execution failed:",gA),!l&&v&&v(nt=>nt.filter(mt=>mt.id!==Gt))})}else{if(c){pe("Fallback API path disabled in forceParentExecution mode"),oe(!1),se(null);return}oe(!1),se(null),e();const Ut=F||tw?.VITE_BASE_URL||"http://localhost:8000",gA=S?.trades||"/api/trades";gt.post(`${Ut}${gA}`,XA,{headers:{Authorization:`Bearer ${mA}`,"Content-Type":"application/json"}}).then(nt=>{if(nt.data&&nt.data.data){const mt=nt.data.data.trade;!l&&v&&v(St=>St.map(It=>It.id===Gt?{...It,id:mt.id,ticket:mt.id.substring(0,8),time:$A,openAt:mt.openAt}:It)),console.log("✅ Trade saved successfully:",mt),window.notify&&window.notify(`Trade placed successfully: ${mt.symbol} ${mt.type}`,"success")}else{!l&&v&&v(St=>St.filter(It=>It.id!==Gt));const mt=nt.data?.message||"Failed to place trade";window.notify&&window.notify(mt,"error")}}).catch(nt=>{console.error("Error placing trade:",nt),!l&&v&&v(St=>St.filter(It=>It.id!==Gt));let mt="Failed to place trade";if(nt.response){const St=nt.response.status,It=nt.response.data;St===400?mt=It?.message||"Invalid trade data. Please check your inputs.":St===401?mt="Authentication failed. Please login again.":St===404?mt=It?.message||"Symbol not found. Please select a valid symbol.":St===500?mt="Server error. Please try again later.":mt=It?.message||`Error: ${St}`}else nt.request&&(mt="Network error. Please check your internet connection.");window.notify&&window.notify(mt,"error")})}},fA=(M?.calculateVolumeUnits?.({symbol:g,volume:parseFloat(W)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return i?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${K?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${K?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${K?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${K?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${K?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[ae&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:ae}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${K?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${K?"text-slate-700":"text-white"}`,children:[fA," ",g]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>Pe(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:W,onChange:Ze=>{const Oe=Ze.target.value;(Oe===""||/^\d*\.?\d{0,2}$/.test(Oe))&&(ne(Oe),pe(""))},onBlur:()=>{const Ze=parseFloat(W);ne(isNaN(Ze)||Ze<.01?"0.01":Ze.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>Pe(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${K?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>et(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:J,onChange:Ze=>{const Oe=Ze.target.value;(Oe===""||/^\d*\.?\d*$/.test(Oe))&&(V(Oe),pe(""))},onBlur:Ze=>{const Oe=parseFloat(Ze.target.value);!isNaN(Oe)&&Oe>0?V(Oe.toFixed(5)):Ze.target.value===""&&V("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>et(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${K?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>it(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:ie,onChange:Ze=>{const Oe=Ze.target.value;(Oe===""||/^\d*\.?\d*$/.test(Oe))&&(re(Oe),pe(""))},onBlur:Ze=>{const Oe=parseFloat(Ze.target.value);!isNaN(Oe)&&Oe>0?re(Oe.toFixed(5)):Ze.target.value===""&&re("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>it(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${K?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${K?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:ce,onChange:Ze=>Z(Ze.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${K?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${K?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:K?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${be} font-medium transition-colors duration-400`,children:ye>0?ye.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:K?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Ge} font-medium transition-colors duration-400`,children:de>0?de.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>rt("SELL"),disabled:Ae,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:Ae&&le==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>rt("BUY"),disabled:Ae,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:Ae&&le==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},Aw={text:"Text",trendline:"Trend Line",parallellines:"Parallel Channel",fibonacci:"Fibonacci Retracement",rectangle:"Rectangle",pricelevel:"Horizontal Line",horizontalray:"Horizontal Ray",verticalline:"Vertical Line",infoline:"Info Line",rulerline:"Ruler Line",arrowedline:"Arrowed Line",rayline:"Ray",extendedline:"Extended Line",crossline:"Cross Line",trendbyangle:"Trend By Angle",disjointchannel:"Disjoint Channel",flattopbottom:"Flat Top/Bottom",regressionchannel:"Regression Channel",stddevchannel:"StdDev Channel",andrewspitchfork:"Andrew's Pitchfork",gannline:"Gann Line",gannfan:"Gann Fan",ganngrid:"Gann Grid",circle:"Circle",triangle:"Triangle",ellipse:"Ellipse",equidistantchannel:"Equidistant Channel"},iw=[10,11,12,14,16,20,24,28,30,40],zn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],oi={width:"78%",height:"78%",display:"block"},Xh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function rw(i){return i?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function OA(i,e="#5f8f96"){if(typeof i!="string")return e;const t=i.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const nw=()=>a.jsx(q1,{style:oi}),sw=()=>a.jsx(j1,{style:oi}),ow=()=>a.jsx(X1,{style:oi}),aw=()=>a.jsx(Y1,{style:oi}),lw=()=>a.jsx(G1,{style:oi}),cw=()=>a.jsx(R1,{style:oi}),hw=()=>a.jsx($1,{style:oi}),uw=()=>a.jsx(Rh,{style:oi}),ra=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function Qr({checked:i,onClick:e,hideLeftBorder:t,tokens:A,children:r,title:n}){return a.jsx("button",{type:"button",onClick:e,title:n,style:{display:"flex",width:30,height:30,alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,borderLeftWidth:t?0:1,background:i?A.activeFill:"transparent",color:i?A.activeText:A.text,cursor:"pointer",padding:0},children:a.jsx(ra,{size:"18px",children:r})})}function qe({checked:i,onChange:e,label:t,tokens:A,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:i,onChange:n=>e(n.target.checked),disabled:r,style:Xh}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,background:A.fieldBg},children:i&&a.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Ot({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=OA(i,"#5f8f96"),s=(i||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:A?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:u=>e(u.target.value),disabled:A,style:{...Xh,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:u=>{const g=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(g?`#${g}`:"")},onBlur:t,disabled:A,style:c})]})}function CA({tokens:i,disabled:e=!1,style:t={},...A}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?i.fieldDisabledBg:i.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?i.fieldDisabledBg:i.fieldBg,color:e?i.fieldDisabledText:i.text,...t},...A})}function Fi({value:i,onChange:e,tokens:t,disabled:A=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:i,onChange:e,disabled:A,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${A?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:A?t.fieldDisabledBg:t.fieldBg,color:A?t.fieldDisabledText:t.text,cursor:A?"default":"pointer",opacity:A?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(uw,{})})]})}function dw({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===zn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:zn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(qe,{checked:A,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:zn.map(s=>a.jsx(qe,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function pw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,OA(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(Fi,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:iw.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(ow,{})}),a.jsx(Qr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(aw,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(lw,{})}),a.jsx(Qr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(cw,{})}),a.jsx(Qr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(hw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(qe,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(qe,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(Ot,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(CA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.borderEnabled,value:i.borderOpacity??.1,onChange:n=>A("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!i.borderEnabled,value:i.borderWidth??1,onChange:n=>A("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:i.borderWidth??1})]}),a.jsx(qe,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Ot,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(CA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.bgEnabled,value:i.bgOpacity??.1,onChange:n=>A("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:i.text||"",onChange:n=>A("text",n.target.value),placeholder:"Your text",rows:4,style:{width:"100%",resize:"none",border:`1px solid ${t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text}})]})}function Wn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#22c55e",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(qe,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(qe,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(qe,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(qe,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(qe,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function fw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:i.showArea!==!1,onChange:n=>A("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(qe,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function mw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(qe,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(qe,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(qe,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function gw({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Ui(i){if(!i)return"";const e=new Date(i*1e3),t=A=>String(A).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function Si({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point1Time),style:n}),a.jsx(CA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point2Time),style:n}),a.jsx(CA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Jh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,OA(o,l)),n=!i.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:s=>A("lineColor",s),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:s=>A("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(qe,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(Ot,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(Fi,{value:i.textHAlign??"center",onChange:s=>A("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(Fi,{value:i.textVAlign??"top",onChange:s=>A("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:i.textContent||"",onChange:s=>A("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function ww({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"Price"}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Bw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.originTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function yw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function Cw({draft:i,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.rawTime),style:t})]})})}function vw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#7aa6ae",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(qe,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(qe,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Ot,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Fi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(qe,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(qe,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(qe,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Tw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#06a0e3",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(qe,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(qe,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function bw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.rawTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Zh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Ot,{value:i.lineColor||"#129f5c",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(qe,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Ot,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(CA,{tokens:t,value:i.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&A("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(qe,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Ot,{value:i.pricesColor||"#129f5c",onChange:n=>A("pricesColor",n),onBlur:()=>r("pricesColor",i.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(qe,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(qe,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(qe,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Yh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point1Time),style:n}),a.jsx(CA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Ui(i.point2Time),style:n}),a.jsx(CA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(CA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function xw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||zn.map(t=>t.key)};if(i.type==="trendline"){const t=typeof i.series?.options=="function"?i.series.options():{};return{...e,lineColor:t.color??i.lineColor??"#22c55e",lineWidth:t.lineWidth??i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.point1?.price??0,point1Time:i.point1?.rawTime??i.point1?.time??0,point2Price:i.point2?.price??0,point2Time:i.point2?.rawTime??i.point2?.time??0}}return i.type==="text"?{...e,text:i.primitive?.text??i.text??"Text",color:i.primitive?.color??"#5f8f96",fontSize:i.primitive?.fontSize??12,fontWeight:i.primitive?.fontWeight??"normal",fontStyle:i.primitive?.fontStyle??"normal",textAlign:i.primitive?.textAlign??"center",textWrap:i.primitive?.textWrap??!1,borderEnabled:i.primitive?.borderEnabled??!1,borderColor:i.primitive?.borderColor??"#5f8f96",borderOpacity:i.primitive?.borderOpacity??.1,borderWidth:i.primitive?.borderWidth??1,bgEnabled:i.primitive?.bgEnabled??!1,bgColor:i.primitive?.bgColor??"#5f8f96",bgOpacity:i.primitive?.bgOpacity??.1,price:i.price}:i.type==="pricelevel"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price}:i.type==="horizontalray"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price,originTime:i.rawOriginTime??i.originTime}:i.type==="verticalline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showDate:i.showDate!==!1,rawTime:i.rawTime}:i.type==="infoline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!0,statsPriceRange:i.statsPriceRange??!0,statsBarsRange:i.statsBarsRange??!0,statsDateRange:i.statsDateRange??!0,statsAngle:i.statsAngle??!0,statsDistance:i.statsDistance??!0,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="arrowedline"?{...e,lineColor:i.lineColor??"#f59e0b",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight!==!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="rayline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="extendedline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft!==!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="crossline"?{...e,lineColor:i.lineColor??"#06a0e3",lineWidth:i.lineWidth??2,showTime:i.showTime??!1,showPrice:i.showPrice??!1,rawTime:i.p?.rawTime??0,price:i.p?.price??0}:i.type==="trendbyangle"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="disjointchannel"?{...e,lineColor:i.lineColor??"#129f5c",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#6aa84f",fillOpacity:i.fillOpacity??.1,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#129f5c",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="flattopbottom"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#3b82f6",fillOpacity:i.fillOpacity??.12,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#3b82f6",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="rulerline"?{...e,lineColor:i.lineColor??"#3b82f6",showArea:i.showArea!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways!==!1,statsPriceRange:i.statsPriceRange!==!1,statsBarsRange:i.statsBarsRange!==!1,statsDateRange:i.statsDateRange!==!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:e}const qh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=zt(),s=rw(r==="light"),[o,l]=Y.useState("style"),[c,u]=Y.useState({}),[g,B]=Y.useState(null),v=Y.useRef(null),b=Y.useRef(null);Y.useEffect(()=>{t&&(u(xw(t)),l("style"))},[t]),Y.useEffect(()=>{i||B(null)},[i]);const C=M=>{if(M.button!==0)return;M.preventDefault();const W=v.current;if(!W)return;const ne=W.offsetParent,J=ne?ne.getBoundingClientRect():{left:0,top:0},V=W.getBoundingClientRect(),ie=V.left-J.left,re=V.top-J.top;b.current={startMX:M.clientX,startMY:M.clientY,startX:ie,startY:re},B({x:ie,y:re});const ce=Ae=>{const{startMX:oe,startMY:le,startX:se,startY:ae}=b.current;B({x:se+Ae.clientX-oe,y:ae+Ae.clientY-le})},Z=()=>{b.current=null,document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Z)};document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Z)};if(!i||!t)return null;const U=Aw[t.type]||t.type,F=["style","coordinates","visualization"],S=()=>{if(o==="visualization")return a.jsx(dw,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(pw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(gw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Jh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ww,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Jh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Bw,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(yw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Cw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(mw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(fw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(Tw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(bw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(vw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Si,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Yh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Yh,{draft:c,setDraft:u,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},K=()=>{A(c),e()};return a.jsxs("div",{ref:v,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...g===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:g.y,left:g.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:C,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(ra,{size:"18px",children:a.jsx(nw,{})})})]})}),a.jsx("button",{type:"button",onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",background:s.headerBlue,color:s.headerText,border:"none",cursor:"pointer"},children:a.jsx(ra,{size:"20px",children:a.jsx(sw,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(M=>{const W=o===M;return a.jsxs("button",{type:"button",onClick:()=>l(M),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:W?s.text:s.mutedText,cursor:"pointer"},children:[M.charAt(0).toUpperCase()+M.slice(1),W&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},M)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:S()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:K,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var na=function(i,e){return na=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(t[r]=A[r])},na(i,e)};function EA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");na(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var sa=function(){return sa=Object.assign||function(e){for(var t,A=1,r=arguments.length;A<r;A++){t=arguments[A];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},sa.apply(this,arguments)};function tA(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(u){try{c(A.next(u))}catch(g){s(g)}}function l(u){try{c(A.throw(u))}catch(g){s(g)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Zt(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},A,r,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(u){return l([c,u])}}function l(c){if(A)throw new TypeError("Generator is already executing.");for(;t;)try{if(A=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(u){c=[6,u],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Rn(i,e,t){if(arguments.length===2)for(var A=0,r=e.length,n;A<r;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return i.concat(n||e)}for(var qA=(function(){function i(e,t,A,r){this.left=e,this.top=t,this.width=A,this.height=r}return i.prototype.add=function(e,t,A,r){return new i(this.left+e,this.top+t,this.width+A,this.height+r)},i.fromClientRect=function(e,t){return new i(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},i.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(r){return r.width!==0});return A?new i(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):i.EMPTY},i.EMPTY=new i(0,0,0,0),i})(),Gn=function(i,e){return qA.fromClientRect(i,e.getBoundingClientRect())},Qw=function(i){var e=i.body,t=i.documentElement;if(!e||!t)throw new Error("Unable to get document size");var A=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new qA(0,0,A,r)},$n=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},Mt=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},jh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<jh.length;Xn++)Fw[jh.charCodeAt(Xn)]=Xn;for(var eu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Jn=0;Jn<eu.length;Jn++)Fr[eu.charCodeAt(Jn)]=Jn;for(var Uw=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Fr[i.charCodeAt(A)],s=Fr[i.charCodeAt(A+1)],o=Fr[i.charCodeAt(A+2)],l=Fr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Sw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Ew=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Ei=5,oa=11,aa=2,Lw=oa-Ei,tu=65536>>Ei,Mw=1<<Ei,la=Mw-1,Hw=1024>>Ei,Iw=tu+Hw,Dw=Iw,_w=32,Pw=Dw+_w,Nw=65536>>oa,Ow=1<<Lw,kw=Ow-1,Au=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Kw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Vw=function(i,e){var t=Uw(i),A=Array.isArray(t)?Ew(t):new Uint32Array(t),r=Array.isArray(t)?Sw(t):new Uint16Array(t),n=24,s=Au(r,n/2,A[4]/2),o=A[5]===2?Au(r,(n+A[4])/2):Kw(A,Math.ceil((n+A[4])/4));return new zw(A[0],A[1],A[2],A[3],s,o)},zw=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Ei],t=(t<<aa)+(e&la),this.data[t];if(e<=65535)return t=this.index[tu+(e-55296>>Ei)],t=(t<<aa)+(e&la),this.data[t];if(e<this.highStart)return t=Pw-Nw+(e>>oa),t=this.index[t],t+=e>>Ei&kw,t=this.index[t],t=(t<<aa)+(e&la),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),iu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ww=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<iu.length;Zn++)Ww[iu.charCodeAt(Zn)]=Zn;var Rw="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",ru=50,Gw=1,nu=2,su=3,$w=4,Xw=5,ou=7,au=8,lu=9,ai=10,ca=11,cu=12,ha=13,Jw=14,Ur=15,ua=16,Yn=17,Sr=18,Zw=19,hu=20,da=21,Er=22,pa=23,Ri=24,pA=25,Lr=26,Mr=27,Gi=28,Yw=29,Li=30,qw=31,qn=32,jn=33,fa=34,ma=35,ga=36,Hr=37,wa=38,es=39,ts=40,Ba=41,uu=42,jw=43,eB=[9001,65288],du="!",ct="×",As="÷",ya=Vw(Rw),jA=[Li,ga],Ca=[Gw,nu,su,Xw],pu=[ai,au],fu=[Mr,Lr],tB=Ca.concat(pu),mu=[wa,es,ts,fa,ma],AB=[Ur,ha],iB=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ya.get(n);if(o>ru?(r.push(!0),o-=ru):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(ua);if(o===$w||o===ca){if(s===0)return A.push(s),t.push(Li);var l=t[s-1];return tB.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(Li))}if(A.push(s),o===qw)return t.push(e==="strict"?da:Hr);if(o===uu||o===Yw)return t.push(Li);if(o===jw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Hr):t.push(Li);t.push(o)}),[A,t,r]},va=function(i,e,t,A){var r=A[t];if(Array.isArray(i)?i.indexOf(r)!==-1:i===r)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==ai)break}if(r===ai)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(i)?i.indexOf(o)!==-1:i===o)for(var l=t;l<=A.length;){l++;var s=A[l];if(s===e)return!0;if(s!==ai)break}if(o!==ai)break}return!1},gu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===ai)t--;else return A}return 0},rB=function(i,e,t,A,r){if(t[A]===0)return ct;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return ct;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===nu&&u===su)return ct;if(Ca.indexOf(l)!==-1)return du;if(Ca.indexOf(u)!==-1||pu.indexOf(u)!==-1)return ct;if(gu(n,e)===au)return As;if(ya.get(i[n])===ca||(l===qn||l===jn)&&ya.get(i[o])===ca||l===ou||u===ou||l===lu||[ai,ha,Ur].indexOf(l)===-1&&u===lu||[Yn,Sr,Zw,Ri,Gi].indexOf(u)!==-1||gu(n,e)===Er||va(pa,Er,n,e)||va([Yn,Sr],da,n,e)||va(cu,cu,n,e))return ct;if(l===ai)return As;if(l===pa||u===pa)return ct;if(u===ua||l===ua)return As;if([ha,Ur,da].indexOf(u)!==-1||l===Jw||c===ga&&AB.indexOf(l)!==-1||l===Gi&&u===ga||u===hu||jA.indexOf(u)!==-1&&l===pA||jA.indexOf(l)!==-1&&u===pA||l===Mr&&[Hr,qn,jn].indexOf(u)!==-1||[Hr,qn,jn].indexOf(l)!==-1&&u===Lr||jA.indexOf(l)!==-1&&fu.indexOf(u)!==-1||fu.indexOf(l)!==-1&&jA.indexOf(u)!==-1||[Mr,Lr].indexOf(l)!==-1&&(u===pA||[Er,Ur].indexOf(u)!==-1&&e[o+1]===pA)||[Er,Ur].indexOf(l)!==-1&&u===pA||l===pA&&[pA,Gi,Ri].indexOf(u)!==-1)return ct;if([pA,Gi,Ri,Yn,Sr].indexOf(u)!==-1)for(var g=n;g>=0;){var B=e[g];if(B===pA)return ct;if([Gi,Ri].indexOf(B)!==-1)g--;else break}if([Mr,Lr].indexOf(u)!==-1)for(var g=[Yn,Sr].indexOf(l)!==-1?s:n;g>=0;){var B=e[g];if(B===pA)return ct;if([Gi,Ri].indexOf(B)!==-1)g--;else break}if(wa===l&&[wa,es,fa,ma].indexOf(u)!==-1||[es,fa].indexOf(l)!==-1&&[es,ts].indexOf(u)!==-1||[ts,ma].indexOf(l)!==-1&&u===ts||mu.indexOf(l)!==-1&&[hu,Lr].indexOf(u)!==-1||mu.indexOf(u)!==-1&&l===Mr||jA.indexOf(l)!==-1&&jA.indexOf(u)!==-1||l===Ri&&jA.indexOf(u)!==-1||jA.concat(pA).indexOf(l)!==-1&&u===Er&&eB.indexOf(i[o])===-1||jA.concat(pA).indexOf(u)!==-1&&l===Sr)return ct;if(l===Ba&&u===Ba){for(var v=t[n],b=1;v>0&&(v--,e[v]===Ba);)b++;if(b%2!==0)return ct}return l===qn&&u===jn?ct:As},nB=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=iB(i,e.lineBreak),A=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[pA,Li,uu].indexOf(o)!==-1?Hr:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&i[l]>=19968&&i[l]<=40959}):void 0;return[A,r,s]},sB=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===du,this.start=A,this.end=r}return i.prototype.slice=function(){return Mt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),oB=function(i,e){var t=$n(i),A=nB(t,e),r=A[0],n=A[1],s=A[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var u=ct;c<o&&(u=rB(t,n,r,++c,s))===ct;);if(u!==ct||c===o){var g=new sB(t,u,l,c);return l=c,{value:g,done:!1}}return{done:!0,value:null}}}},aB=1,lB=2,Ir=4,wu=8,is=10,Bu=47,Dr=92,cB=9,hB=32,rs=34,_r=61,uB=35,dB=36,pB=37,ns=39,ss=40,Pr=41,fB=95,oA=45,mB=33,gB=60,wB=62,BB=64,yB=91,CB=93,vB=61,TB=123,os=63,bB=125,yu=124,xB=126,QB=128,Cu=65533,Ta=42,Mi=43,FB=44,UB=58,SB=59,Nr=46,EB=0,LB=8,MB=11,HB=14,IB=31,DB=127,kA=-1,vu=48,Tu=97,bu=101,_B=102,PB=117,NB=122,xu=65,Qu=69,Fu=70,OB=85,kB=90,Yt=function(i){return i>=vu&&i<=57},KB=function(i){return i>=55296&&i<=57343},$i=function(i){return Yt(i)||i>=xu&&i<=Fu||i>=Tu&&i<=_B},VB=function(i){return i>=Tu&&i<=NB},zB=function(i){return i>=xu&&i<=kB},WB=function(i){return VB(i)||zB(i)},RB=function(i){return i>=QB},as=function(i){return i===is||i===cB||i===hB},ls=function(i){return WB(i)||RB(i)||i===fB},Uu=function(i){return ls(i)||Yt(i)||i===oA},GB=function(i){return i>=EB&&i<=LB||i===MB||i>=HB&&i<=IB||i===DB},li=function(i,e){return i!==Dr?!1:e!==is},cs=function(i,e,t){return i===oA?ls(e)||li(e,t):ls(i)?!0:!!(i===Dr&&li(i,e))},ba=function(i,e,t){return i===Mi||i===oA?Yt(e)?!0:e===Nr&&Yt(t):Yt(i===Nr?e:i)},$B=function(i){var e=0,t=1;(i[e]===Mi||i[e]===oA)&&(i[e]===oA&&(t=-1),e++);for(var A=[];Yt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Mt.apply(void 0,A),10):0;i[e]===Nr&&e++;for(var n=[];Yt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Mt.apply(void 0,n),10):0;(i[e]===Qu||i[e]===bu)&&e++;var l=1;(i[e]===Mi||i[e]===oA)&&(i[e]===oA&&(l=-1),e++);for(var c=[];Yt(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Mt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},XB={type:2},JB={type:3},ZB={type:4},YB={type:13},qB={type:8},jB={type:21},e2={type:9},t2={type:10},A2={type:11},i2={type:12},r2={type:14},hs={type:23},n2={type:1},s2={type:25},o2={type:24},a2={type:26},l2={type:27},c2={type:28},h2={type:29},u2={type:31},xa={type:32},Su=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat($n(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==xa;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case rs:return this.consumeStringToken(rs);case uB:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Uu(t)||li(A,r)){var n=cs(t,A,r)?lB:aB,s=this.consumeName();return{type:5,value:s,flags:n}}break;case dB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),YB;break;case ns:return this.consumeStringToken(ns);case ss:return XB;case Pr:return JB;case Ta:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),r2;break;case Mi:if(ba(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case FB:return ZB;case oA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(ba(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(cs(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===oA&&c===wB)return this.consumeCodePoint(),this.consumeCodePoint(),o2;break;case Nr:if(ba(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Bu:if(this.peekCodePoint(0)===Ta)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===Ta&&(u=this.consumeCodePoint(),u===Bu))return this.consumeToken();if(u===kA)return this.consumeToken()}break;case UB:return a2;case SB:return l2;case gB:if(this.peekCodePoint(0)===mB&&this.peekCodePoint(1)===oA&&this.peekCodePoint(2)===oA)return this.consumeCodePoint(),this.consumeCodePoint(),s2;break;case BB:var g=this.peekCodePoint(0),B=this.peekCodePoint(1),v=this.peekCodePoint(2);if(cs(g,B,v)){var s=this.consumeName();return{type:7,value:s}}break;case yB:return c2;case Dr:if(li(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case CB:return h2;case vB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),qB;break;case TB:return A2;case bB:return i2;case PB:case OB:var b=this.peekCodePoint(0),C=this.peekCodePoint(1);return b===Mi&&($i(C)||C===os)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case yu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),e2;if(this.peekCodePoint(0)===yu)return this.consumeCodePoint(),jB;break;case xB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),t2;break;case kA:return xa}return as(e)?(this.consumeWhiteSpace(),u2):Yt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ls(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Mt(e)}},i.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},i.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},i.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},i.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();$i(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===os&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Mt.apply(void 0,e.map(function(l){return l===os?vu:l})),16),n=parseInt(Mt.apply(void 0,e.map(function(l){return l===os?Fu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Mt.apply(void 0,e),16);if(this.peekCodePoint(0)===oA&&$i(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];$i(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Mt.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},i.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ss?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ss?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===kA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ns||t===rs){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===kA||this.peekCodePoint(0)===Pr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),hs)}for(;;){var r=this.consumeCodePoint();if(r===kA||r===Pr)return{type:22,value:Mt.apply(void 0,e)};if(as(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===kA||this.peekCodePoint(0)===Pr?(this.consumeCodePoint(),{type:22,value:Mt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),hs);if(r===rs||r===ns||r===ss||GB(r))return this.consumeBadUrlRemnants(),hs;if(r===Dr)if(li(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),hs;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;as(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Pr||e===kA)return;li(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},i.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var r=Math.min(t,e);A+=Mt.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),A},i.prototype.consumeStringToken=function(e){var t="",A=0;do{var r=this._value[A];if(r===kA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===is)return this._value.splice(0,A),n2;if(r===Dr){var n=this._value[A+1];n!==kA&&n!==void 0&&(n===is?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):li(r,n)&&(t+=this.consumeStringSlice(A),t+=Mt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Ir,A=this.peekCodePoint(0);for((A===Mi||A===oA)&&e.push(this.consumeCodePoint());Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Nr&&Yt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=wu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===Qu||A===bu)&&((r===Mi||r===oA)&&Yt(n)||Yt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=wu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[$B(e),t]},i.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(cs(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===pB?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if($i(e)){for(var t=Mt(e);$i(this.peekCodePoint(0))&&t.length<6;)t+=Mt(this.consumeCodePoint());as(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||KB(A)||A>1114111?Cu:A}return e===kA?Cu:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Uu(t))e+=Mt(t);else if(li(t,this.peekCodePoint(0)))e+=Mt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),Eu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new Su;return t.write(e),new i(t.read())},i.parseValue=function(e){return i.create(e).parseComponentValue()},i.parseValues=function(e){return i.create(e).parseComponentValues()},i.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},i.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},i.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},i.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},A=this.consumeToken();;){if(A.type===32||p2(A,e))return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue()),A=this.consumeToken()}},i.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var A=this.consumeToken();if(A.type===32||A.type===3)return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue())}},i.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?xa:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),Or=function(i){return i.type===15},Xi=function(i){return i.type===17},wt=function(i){return i.type===20},d2=function(i){return i.type===0},Qa=function(i,e){return wt(i)&&i.value===e},Lu=function(i){return i.type!==31},Ji=function(i){return i.type!==31&&i.type!==4},KA=function(i){var e=[],t=[];return i.forEach(function(A){if(A.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}A.type!==31&&t.push(A)}),t.length&&e.push(t),e},p2=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},ci=function(i){return i.type===17||i.type===15},Pt=function(i){return i.type===16||ci(i)},Mu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},Wt={type:17,number:0,flags:Ir},Fa={type:16,number:50,flags:Ir},hi={type:16,number:100,flags:Ir},kr=function(i,e,t){var A=i[0],r=i[1];return[Tt(A,e),Tt(typeof r<"u"?r:A,t)]},Tt=function(i,e){if(i.type===16)return i.number/100*e;if(Or(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},Hu="deg",Iu="grad",Du="rad",_u="turn",us={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case Hu:return Math.PI*e.number/180;case Iu:return Math.PI/200*e.number;case Du:return e.number;case _u:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Pu=function(i){return i.type===15&&(i.unit===Hu||i.unit===Iu||i.unit===Du||i.unit===_u)},Nu=function(i){var e=i.filter(wt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Wt,Wt];case"to top":case"bottom":return vA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Wt,hi];case"to right":case"left":return vA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[hi,hi];case"to bottom":case"top":return vA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[hi,Wt];case"to left":case"right":return vA(270)}return 0},vA=function(i){return Math.PI*i/180},ui={name:"color",parse:function(i,e){if(e.type===18){var t=f2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(i,e.values)}if(e.type===5){if(e.value.length===3){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return pi(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return pi(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return pi(parseInt(A,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return pi(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ei[e.value.toUpperCase()];if(typeof o<"u")return o}return ei.TRANSPARENT}},di=function(i){return(255&i)===0},kt=function(i){var e=255&i,t=255&i>>8,A=255&i>>16,r=255&i>>24;return e<255?"rgba("+r+","+A+","+t+","+e/255+")":"rgb("+r+","+A+","+t+")"},pi=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},Ou=function(i,e){if(i.type===17)return i.number;if(i.type===16){var t=e===3?1:255;return e===3?i.number/100*t:Math.round(i.number/100*t)}return 0},ku=function(i,e){var t=e.filter(Ji);if(t.length===3){var A=t.map(Ou),r=A[0],n=A[1],s=A[2];return pi(r,n,s,1)}if(t.length===4){var o=t.map(Ou),r=o[0],n=o[1],s=o[2],l=o[3];return pi(r,n,s,l)}return 0};function Ua(i,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-i)*t*6+i:t<1/2?e:t<2/3?(e-i)*6*(2/3-t)+i:i}var Ku=function(i,e){var t=e.filter(Ji),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?vA(A.number):us.parse(i,A))/(Math.PI*2),l=Pt(r)?r.number/100:0,c=Pt(n)?n.number/100:0,u=typeof s<"u"&&Pt(s)?Tt(s,1):1;if(l===0)return pi(c*255,c*255,c*255,1);var g=c<=.5?c*(l+1):c+l-c*l,B=c*2-g,v=Ua(B,g,o+1/3),b=Ua(B,g,o),C=Ua(B,g,o-1/3);return pi(v*255,b*255,C*255,u)},f2={hsl:Ku,hsla:Ku,rgb:ku,rgba:ku},Kr=function(i,e){return ui.parse(i,Eu.create(e).parseComponentValue())},ei={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},m2={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},g2={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ds=function(i,e){var t=ui.parse(i,e[0]),A=e[1];return A&&Pt(A)?{color:t,stop:A}:{color:t,stop:null}},Vu=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=Wt),A.stop===null&&(A.stop=hi);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=Tt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var g=s-c,B=r[c-1],v=(u-B)/(g+1),b=1;b<=g;b++)r[c+b-1]=v*b;c=null}}return i.map(function(C,U){var F=C.color;return{color:F,stop:Math.max(Math.min(1,r[U]/e),0)}})},w2=function(i,e,t){var A=e/2,r=t/2,n=Tt(i[0],e)-A,s=r-Tt(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},B2=function(i,e,t){var A=typeof i=="number"?i:w2(i,e,t),r=Math.abs(e*Math.sin(A))+Math.abs(t*Math.cos(A)),n=e/2,s=t/2,o=r/2,l=Math.sin(A-Math.PI/2)*o,c=Math.cos(A-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},LA=function(i,e){return Math.sqrt(i*i+e*e)},zu=function(i,e,t,A,r){var n=[[0,0],[0,e],[i,0],[i,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],u=LA(t-l,A-c);return(r?u<s.optimumDistance:u>s.optimumDistance)?{optimumCorner:o,optimumDistance:u}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},y2=function(i,e,t,A,r){var n=0,s=0;switch(i.size){case 0:i.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-A)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(i.shape===0)n=s=Math.min(LA(e,t),LA(e,t-r),LA(e-A,t),LA(e-A,t-r));else if(i.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-A)),l=zu(A,r,e,t,!0),c=l[0],u=l[1];n=LA(c-e,(u-t)/o),s=o*n}break;case 1:i.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-A)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(i.shape===0)n=s=Math.max(LA(e,t),LA(e,t-r),LA(e-A,t),LA(e-A,t-r));else if(i.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-A)),g=zu(A,r,e,t,!1),c=g[0],u=g[1];n=LA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=Tt(i.size[0],A),s=i.size.length===2?Tt(i.size[1],r):n),[n,s]},C2=function(i,e){var t=vA(180),A=[];return KA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Nu(r);return}else if(Pu(s)){t=us.parse(i,s);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},ps=function(i,e){var t=vA(180),A=[];return KA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=Nu(r);return}else if(Pu(s)){t=(us.parse(i,s)+vA(270))%vA(360);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},v2=function(i,e){var t=vA(180),A=[],r=1,n=0,s=3,o=[];return KA(e).forEach(function(l,c){var u=l[0];if(c===0){if(wt(u)&&u.value==="linear"){r=1;return}else if(wt(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var g=ui.parse(i,u.values[0]);A.push({stop:Wt,color:g})}else if(u.name==="to"){var g=ui.parse(i,u.values[0]);A.push({stop:hi,color:g})}else if(u.name==="color-stop"){var B=u.values.filter(Ji);if(B.length===2){var g=ui.parse(i,B[1]),v=B[0];Xi(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:g})}}}}),r===1?{angle:(t+vA(180))%vA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},Wu="closest-side",Ru="farthest-side",Gu="closest-corner",$u="farthest-corner",Xu="circle",Ju="ellipse",Zu="cover",Yu="contain",T2=function(i,e){var t=0,A=3,r=[],n=[];return KA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(g,B){if(c)if(wt(B))switch(B.value){case"center":return n.push(Fa),g;case"top":case"left":return n.push(Wt),g;case"right":case"bottom":return n.push(hi),g}else(Pt(B)||ci(B))&&n.push(B);else if(wt(B))switch(B.value){case Xu:return t=0,!1;case Ju:return t=1,!1;case"at":return c=!0,!1;case Wu:return A=0,!1;case Zu:case Ru:return A=1,!1;case Yu:case Gu:return A=2,!1;case $u:return A=3,!1}else if(ci(B)||Pt(B))return Array.isArray(A)||(A=[]),A.push(B),!1;return g},l)}if(l){var u=ds(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},fs=function(i,e){var t=0,A=3,r=[],n=[];return KA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,g){if(wt(g))switch(g.value){case"center":return n.push(Fa),!1;case"top":case"left":return n.push(Wt),!1;case"right":case"bottom":return n.push(hi),!1}else if(Pt(g)||ci(g))return n.push(g),!1;return u},l):o===1&&(l=s.reduce(function(u,g){if(wt(g))switch(g.value){case Xu:return t=0,!1;case Ju:return t=1,!1;case Yu:case Wu:return A=0,!1;case Ru:return A=1,!1;case Gu:return A=2,!1;case Zu:case $u:return A=3,!1}else if(ci(g)||Pt(g))return Array.isArray(A)||(A=[]),A.push(g),!1;return u},l)),l){var c=ds(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},b2=function(i){return i.type===1},x2=function(i){return i.type===2},Sa={name:"image",parse:function(i,e){if(e.type===22){var t={url:e.value,type:0};return i.cache.addImage(e.value),t}if(e.type===18){var A=qu[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return A(i,e.values)}throw new Error("Unsupported image type "+e.type)}};function Q2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!qu[i.name])}var qu={"linear-gradient":C2,"-moz-linear-gradient":ps,"-ms-linear-gradient":ps,"-o-linear-gradient":ps,"-webkit-linear-gradient":ps,"radial-gradient":T2,"-moz-radial-gradient":fs,"-ms-radial-gradient":fs,"-o-radial-gradient":fs,"-webkit-radial-gradient":fs,"-webkit-gradient":v2},F2={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(A){return Ji(A)&&Q2(A)}).map(function(A){return Sa.parse(i,A)})}},U2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},S2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return KA(e).map(function(t){return t.filter(Pt)}).map(Mu)}},E2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return KA(e).map(function(t){return t.filter(wt).map(function(A){return A.value}).join(" ")}).map(L2)}},L2=function(i){switch(i){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},Zi;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Zi||(Zi={}));var M2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return KA(e).map(function(t){return t.filter(H2)})}},H2=function(i){return wt(i)||Pt(i)},ms=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},I2=ms("top"),D2=ms("right"),_2=ms("bottom"),P2=ms("left"),gs=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Mu(t.filter(Pt))}}},N2=gs("top-left"),O2=gs("top-right"),k2=gs("bottom-right"),K2=gs("bottom-left"),ws=function(i){return{name:"border-"+i+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},V2=ws("top"),z2=ws("right"),W2=ws("bottom"),R2=ws("left"),Bs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Or(t)?t.number:0}}},G2=Bs("top"),$2=Bs("right"),X2=Bs("bottom"),J2=Bs("left"),Z2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Y2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},q2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).reduce(function(t,A){return t|j2(A.value)},0)}},j2=function(i){switch(i){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},ey={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},ty={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(i,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},ys;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ys||(ys={}));var Ay={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ys.STRICT:ys.NORMAL}},iy={name:"line-height",initialValue:"normal",prefix:!1,type:4},ju=function(i,e){return wt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Pt(i)?Tt(i,e):e},ry={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:Sa.parse(i,e)}},ny={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},Ea={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Cs=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},sy=Cs("top"),oy=Cs("right"),ay=Cs("bottom"),ly=Cs("left"),cy={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},hy={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},vs=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},uy=vs("top"),dy=vs("right"),py=vs("bottom"),fy=vs("left"),my={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(i,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},gy={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(i,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},wy={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Qa(e[0],"none")?[]:KA(e).map(function(t){for(var A={color:ei.TRANSPARENT,offsetX:Wt,offsetY:Wt,blur:Wt},r=0,n=0;n<t.length;n++){var s=t[n];ci(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=ui.parse(i,s)}return A})}},By={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},yy={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(i,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=Ty[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Cy=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},vy=function(i){var e=i.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],A=e[1];e[2],e[3];var r=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,A,r,n,s,o]:null},Ty={matrix:Cy,matrix3d:vy},ed={type:16,number:50,flags:Ir},by=[ed,ed],xy={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Pt);return t.length!==2?by:[t[0],t[1]]}},Qy={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Vr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var Fy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},Uy={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Xi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},td={name:"time",parse:function(i,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Sy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:1}},Ey={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ly={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},My={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(i,e){var t=[],A=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:A.push(t.join(" ")),t.length=0;break}}),t.length&&A.push(t.join(" ")),A.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},Hy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Iy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:wt(e)&&e.value==="bold"?700:400}},Dy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(wt).map(function(t){return t.value})}},_y={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Nt=function(i,e){return(i&e)!==0},Py={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},Ny={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var A=[],r=e.filter(Lu),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Xi(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},Oy={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(Lu),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(wt(n)&&n.value!=="none"){var o=s&&Xi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},ky={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(Or).map(function(t){return td.parse(i,t)})}},Ky={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var A=[],r=e.filter(d2);if(r.length%2!==0)return null;for(var n=0;n<r.length;n+=2){var s=r[n].value,o=r[n+1].value;A.push({open:s,close:o})}return A}},Ad=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},Vy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Qa(e[0],"none")?[]:KA(e).map(function(t){for(var A={color:255,offsetX:Wt,offsetY:Wt,blur:Wt,spread:Wt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];Qa(s,"inset")?A.inset=!0:ci(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=ui.parse(i,s)}return A})}},zy={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(wt).forEach(function(r){switch(r.value){case"stroke":A.push(1);break;case"fill":A.push(0);break;case"markers":A.push(2);break}}),t.forEach(function(r){A.indexOf(r)===-1&&A.push(r)}),A}},Wy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Ry={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return Or(e)?e.number:0}},Gy=(function(){function i(e,t){var A,r;this.animationDuration=De(e,ky,t.animationDuration),this.backgroundClip=De(e,m2,t.backgroundClip),this.backgroundColor=De(e,g2,t.backgroundColor),this.backgroundImage=De(e,F2,t.backgroundImage),this.backgroundOrigin=De(e,U2,t.backgroundOrigin),this.backgroundPosition=De(e,S2,t.backgroundPosition),this.backgroundRepeat=De(e,E2,t.backgroundRepeat),this.backgroundSize=De(e,M2,t.backgroundSize),this.borderTopColor=De(e,I2,t.borderTopColor),this.borderRightColor=De(e,D2,t.borderRightColor),this.borderBottomColor=De(e,_2,t.borderBottomColor),this.borderLeftColor=De(e,P2,t.borderLeftColor),this.borderTopLeftRadius=De(e,N2,t.borderTopLeftRadius),this.borderTopRightRadius=De(e,O2,t.borderTopRightRadius),this.borderBottomRightRadius=De(e,k2,t.borderBottomRightRadius),this.borderBottomLeftRadius=De(e,K2,t.borderBottomLeftRadius),this.borderTopStyle=De(e,V2,t.borderTopStyle),this.borderRightStyle=De(e,z2,t.borderRightStyle),this.borderBottomStyle=De(e,W2,t.borderBottomStyle),this.borderLeftStyle=De(e,R2,t.borderLeftStyle),this.borderTopWidth=De(e,G2,t.borderTopWidth),this.borderRightWidth=De(e,$2,t.borderRightWidth),this.borderBottomWidth=De(e,X2,t.borderBottomWidth),this.borderLeftWidth=De(e,J2,t.borderLeftWidth),this.boxShadow=De(e,Vy,t.boxShadow),this.color=De(e,Z2,t.color),this.direction=De(e,Y2,t.direction),this.display=De(e,q2,t.display),this.float=De(e,ey,t.cssFloat),this.fontFamily=De(e,My,t.fontFamily),this.fontSize=De(e,Hy,t.fontSize),this.fontStyle=De(e,_y,t.fontStyle),this.fontVariant=De(e,Dy,t.fontVariant),this.fontWeight=De(e,Iy,t.fontWeight),this.letterSpacing=De(e,ty,t.letterSpacing),this.lineBreak=De(e,Ay,t.lineBreak),this.lineHeight=De(e,iy,t.lineHeight),this.listStyleImage=De(e,ry,t.listStyleImage),this.listStylePosition=De(e,ny,t.listStylePosition),this.listStyleType=De(e,Ea,t.listStyleType),this.marginTop=De(e,sy,t.marginTop),this.marginRight=De(e,oy,t.marginRight),this.marginBottom=De(e,ay,t.marginBottom),this.marginLeft=De(e,ly,t.marginLeft),this.opacity=De(e,Sy,t.opacity);var n=De(e,cy,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=De(e,hy,t.overflowWrap),this.paddingTop=De(e,uy,t.paddingTop),this.paddingRight=De(e,dy,t.paddingRight),this.paddingBottom=De(e,py,t.paddingBottom),this.paddingLeft=De(e,fy,t.paddingLeft),this.paintOrder=De(e,zy,t.paintOrder),this.position=De(e,gy,t.position),this.textAlign=De(e,my,t.textAlign),this.textDecorationColor=De(e,Ey,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=De(e,Ly,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=De(e,wy,t.textShadow),this.textTransform=De(e,By,t.textTransform),this.transform=De(e,yy,t.transform),this.transformOrigin=De(e,xy,t.transformOrigin),this.visibility=De(e,Qy,t.visibility),this.webkitTextStrokeColor=De(e,Wy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=De(e,Ry,t.webkitTextStrokeWidth),this.wordBreak=De(e,Fy,t.wordBreak),this.zIndex=De(e,Uy,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return di(this.backgroundColor)},i.prototype.isTransformed=function(){return this.transform!==null},i.prototype.isPositioned=function(){return this.position!==0},i.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},i.prototype.isFloating=function(){return this.float!==0},i.prototype.isInlineLevel=function(){return Nt(this.display,4)||Nt(this.display,33554432)||Nt(this.display,268435456)||Nt(this.display,536870912)||Nt(this.display,67108864)||Nt(this.display,134217728)},i})(),$y=(function(){function i(e,t){this.content=De(e,Py,t.content),this.quotes=De(e,Ky,t.quotes)}return i})(),id=(function(){function i(e,t){this.counterIncrement=De(e,Ny,t.counterIncrement),this.counterReset=De(e,Oy,t.counterReset)}return i})(),De=function(i,e,t){var A=new Su,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new Eu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,wt(s)?s.value:e.initialValue);case 0:return e.parse(i,n.parseComponentValue());case 1:return e.parse(i,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return us.parse(i,n.parseComponentValue());case"color":return ui.parse(i,n.parseComponentValue());case"image":return Sa.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return ci(o)?o:Wt;case"length-percentage":var l=n.parseComponentValue();return Pt(l)?l:Wt;case"time":return td.parse(i,n.parseComponentValue())}break}},Xy="data-html2canvas-debug",Jy=function(i){var e=i.getAttribute(Xy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},La=function(i,e){var t=Jy(i);return t===1||e===t},VA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,La(t,3))debugger;this.styles=new Gy(e,window.getComputedStyle(t,null)),Ra(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Gn(this.context,t),La(t,4)&&(this.flags|=16)}return i})(),Zy="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",rd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<rd.length;Ts++)zr[rd.charCodeAt(Ts)]=Ts;for(var Yy=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=zr[i.charCodeAt(A)],s=zr[i.charCodeAt(A+1)],o=zr[i.charCodeAt(A+2)],l=zr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},qy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},jy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Hi=5,Ma=11,Ha=2,eC=Ma-Hi,nd=65536>>Hi,tC=1<<Hi,Ia=tC-1,AC=1024>>Hi,iC=nd+AC,rC=iC,nC=32,sC=rC+nC,oC=65536>>Ma,aC=1<<eC,lC=aC-1,sd=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},cC=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},hC=function(i,e){var t=Yy(i),A=Array.isArray(t)?jy(t):new Uint32Array(t),r=Array.isArray(t)?qy(t):new Uint16Array(t),n=24,s=sd(r,n/2,A[4]/2),o=A[5]===2?sd(r,(n+A[4])/2):cC(A,Math.ceil((n+A[4])/4));return new uC(A[0],A[1],A[2],A[3],s,o)},uC=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Hi],t=(t<<Ha)+(e&Ia),this.data[t];if(e<=65535)return t=this.index[nd+(e-55296>>Hi)],t=(t<<Ha)+(e&Ia),this.data[t];if(e<this.highStart)return t=sC-oC+(e>>Ma),t=this.index[t],t+=e>>Hi&lC,t=this.index[t],t=(t<<Ha)+(e&Ia),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),od="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dC=typeof Uint8Array>"u"?[]:new Uint8Array(256),bs=0;bs<od.length;bs++)dC[od.charCodeAt(bs)]=bs;var pC=1,Da=2,_a=3,ad=4,ld=5,fC=7,cd=8,Pa=9,Na=10,hd=11,ud=12,dd=13,pd=14,Oa=15,mC=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},gC=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},wC=hC(Zy),TA="×",ka="÷",BC=function(i){return wC.get(i)},yC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===Da&&s===_a)return TA;if(n===Da||n===_a||n===ad||s===Da||s===_a||s===ad)return ka;if(n===cd&&[cd,Pa,hd,ud].indexOf(s)!==-1||(n===hd||n===Pa)&&(s===Pa||s===Na)||(n===ud||n===Na)&&s===Na||s===dd||s===ld||s===fC||n===pC)return TA;if(n===dd&&s===pd){for(;r===ld;)r=e[--A];if(r===pd)return TA}if(n===Oa&&s===Oa){for(var o=0;r===Oa;)o++,r=e[--A];if(o%2===0)return TA}return ka},CC=function(i){var e=mC(i),t=e.length,A=0,r=0,n=e.map(BC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=TA;A<t&&(s=yC(e,n,++A))===TA;);if(s!==TA||A===t){var o=gC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},vC=function(i){for(var e=CC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},TC=function(i){var e=123;if(i.createRange){var t=i.createRange();if(t.getBoundingClientRect){var A=i.createElement("boundtest");A.style.height=e+"px",A.style.display="block",i.body.appendChild(A),t.selectNode(A);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(i.body.removeChild(A),n===e)return!0}}return!1},bC=function(i){var e=i.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",i.body.appendChild(e);var t=i.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var A=e.firstChild,r=$n(A.data).map(function(l){return Mt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var g=u.x>s.x||u.y>s.y;return s=u,c===0?!0:g});return i.body.removeChild(e),o},xC=function(){return typeof new Image().crossOrigin<"u"},QC=function(){return typeof new XMLHttpRequest().responseType=="string"},FC=function(i){var e=new Image,t=i.createElement("canvas"),A=t.getContext("2d");if(!A)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{A.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},fd=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},UC=function(i){var e=i.createElement("canvas"),t=100;e.width=t,e.height=t;var A=e.getContext("2d");if(!A)return Promise.reject(!1);A.fillStyle="rgb(0, 255, 0)",A.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Ka(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),md(s).then(function(o){A.drawImage(o,0,0);var l=A.getImageData(0,0,t,t).data;A.fillStyle="red",A.fillRect(0,0,t,t);var c=i.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",fd(l)?md(Ka(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),fd(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ka=function(i,e,t,A,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",i.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",A.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},md=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){return e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Rt={get SUPPORT_RANGE_BOUNDS(){var i=TC(document);return Object.defineProperty(Rt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Rt.SUPPORT_RANGE_BOUNDS&&bC(document);return Object.defineProperty(Rt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=FC(document);return Object.defineProperty(Rt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?UC(document):Promise.resolve(!1);return Object.defineProperty(Rt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=xC();return Object.defineProperty(Rt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=QC();return Object.defineProperty(Rt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Rt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Rt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Wr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),SC=function(i,e,t,A){var r=MC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Rt.SUPPORT_RANGE_BOUNDS){var l=gd(A,s,o.length).getClientRects();if(l.length>1){var c=Va(o),u=0;c.forEach(function(B){n.push(new Wr(B,qA.fromDOMRectList(i,gd(A,u+s,B.length).getClientRects()))),u+=B.length})}else n.push(new Wr(o,qA.fromDOMRectList(i,l)))}else{var g=A.splitText(o.length);n.push(new Wr(o,EC(i,A))),A=g}else Rt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},EC=function(i,e){var t=e.ownerDocument;if(t){var A=t.createElement("html2canvaswrapper");A.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(A,e);var n=Gn(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return qA.EMPTY},gd=function(i,e,t){var A=i.ownerDocument;if(!A)throw new Error("Node has no owner document");var r=A.createRange();return r.setStart(i,e),r.setEnd(i,e+t),r},Va=function(i){if(Rt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(i)).map(function(t){return t.segment})}return vC(i)},LC=function(i,e){if(Rt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(i)).map(function(A){return A.segment})}return IC(i,e)},MC=function(i,e){return e.letterSpacing!==0?Va(i):LC(i,e)},HC=[32,160,4961,65792,65793,4153,4241],IC=function(i,e){for(var t=oB(i,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),A=[],r,n=function(){if(r.value){var s=r.value.slice(),o=$n(s),l="";o.forEach(function(c){HC.indexOf(c)===-1?l+=Mt(c):(l.length&&A.push(l),A.push(Mt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},DC=(function(){function i(e,t,A){this.text=_C(t.data,A.textTransform),this.textBounds=SC(e,this.text,A,t)}return i})(),_C=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(PC,NC);case 2:return i.toUpperCase();default:return i}},PC=/(^|\s|:|-|\(|\))([a-z])/g,NC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},wd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.src=A.currentSrc||A.src,r.intrinsicWidth=A.naturalWidth,r.intrinsicHeight=A.naturalHeight,r.context.cache.addImage(r.src),r}return e})(VA),Bd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A,r.intrinsicWidth=A.width,r.intrinsicHeight=A.height,r}return e})(VA),yd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Gn(t,A);return A.setAttribute("width",s.width+"px"),A.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),r.intrinsicWidth=A.width.baseVal.value,r.intrinsicHeight=A.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})(VA),Cd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(VA),za=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.start=A.start,r.reversed=typeof A.reversed=="boolean"&&A.reversed===!0,r}return e})(VA),OC=[{type:15,flags:0,unit:"px",number:3}],kC=[{type:16,flags:0,number:50}],KC=function(i){return i.width>i.height?new qA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new qA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},VC=function(i){var e=i.type===zC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},xs="checkbox",Qs="radio",zC="password",vd=707406591,Wa=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;switch(r.type=A.type.toLowerCase(),r.checked=A.checked,r.value=VC(A),(r.type===xs||r.type===Qs)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=KC(r.bounds)),r.type){case xs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=OC;break;case Qs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=kC;break}return r}return e})(VA),Td=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=A.options[A.selectedIndex||0];return r.value=n&&n.text||"",r}return e})(VA),bd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(VA),xd=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;r.src=A.src,r.width=parseInt(A.width,10)||0,r.height=parseInt(A.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(A.contentWindow&&A.contentWindow.document&&A.contentWindow.document.documentElement){r.tree=Fd(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Kr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):ei.TRANSPARENT,s=A.contentWindow.document.body?Kr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):ei.TRANSPARENT;r.backgroundColor=di(n)?di(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(VA),WC=["OL","UL","MENU"],Fs=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,Ud(r)&&r.data.trim().length>0)t.textNodes.push(new DC(i,r,t.styles));else if(Yi(r))if(Id(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Fs(i,o,t,A)});else{var s=Qd(i,r);s.styles.isVisible()&&(RC(r,s,A)?s.flags|=4:GC(s.styles)&&(s.flags|=2),WC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Fs(i,r.shadowRoot,s,A):!Ss(r)&&!Sd(r)&&!Es(r)&&Fs(i,r,s,A))}},Qd=function(i,e){return $a(e)?new wd(i,e):Ed(e)?new Bd(i,e):Sd(e)?new yd(i,e):$C(e)?new Cd(i,e):XC(e)?new za(i,e):JC(e)?new Wa(i,e):Es(e)?new Td(i,e):Ss(e)?new bd(i,e):Md(e)?new xd(i,e):new VA(i,e)},Fd=function(i,e){var t=Qd(i,e);return t.flags|=4,Fs(i,e,t,t),t},RC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ga(i)&&t.styles.isTransparent()},GC=function(i){return i.isPositioned()||i.isFloating()},Ud=function(i){return i.nodeType===Node.TEXT_NODE},Yi=function(i){return i.nodeType===Node.ELEMENT_NODE},Ra=function(i){return Yi(i)&&typeof i.style<"u"&&!Us(i)},Us=function(i){return typeof i.className=="object"},$C=function(i){return i.tagName==="LI"},XC=function(i){return i.tagName==="OL"},JC=function(i){return i.tagName==="INPUT"},ZC=function(i){return i.tagName==="HTML"},Sd=function(i){return i.tagName==="svg"},Ga=function(i){return i.tagName==="BODY"},Ed=function(i){return i.tagName==="CANVAS"},Ld=function(i){return i.tagName==="VIDEO"},$a=function(i){return i.tagName==="IMG"},Md=function(i){return i.tagName==="IFRAME"},Hd=function(i){return i.tagName==="STYLE"},YC=function(i){return i.tagName==="SCRIPT"},Ss=function(i){return i.tagName==="TEXTAREA"},Es=function(i){return i.tagName==="SELECT"},Id=function(i){return i.tagName==="SLOT"},Dd=function(i){return i.tagName.indexOf("-")>0},qC=(function(){function i(){this.counters={}}return i.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},i.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},i.prototype.pop=function(e){var t=this;e.forEach(function(A){return t.counters[A].pop()})},i.prototype.parse=function(e){var t=this,A=e.counterIncrement,r=e.counterReset,n=!0;A!==null&&A.forEach(function(o){var l=t.counters[o.counter];l&&o.increment!==0&&(n=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var s=[];return n&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},i})(),_d={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Pd={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},jC={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},ev={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},qi=function(i,e,t,A,r,n){return i<e||i>t?Gr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Nd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},Ht=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Nd(Math.abs(i),n,A,function(s){return Mt(Math.floor(s%n)+e)})+r)},Ii=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Nd(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},ji=1,fi=2,mi=4,Rr=8,ti=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Gr(i,4,r.length>0);var s=Math.abs(i),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&Nt(n,ji)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Nt(n,fi)||c===1&&l===1&&Nt(n,mi)&&i>100||c===1&&l>1&&Nt(n,Rr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(i<0?A:"")+o},Od="十百千萬",kd="拾佰仟萬",Kd="マイナス",Xa="마이너스",Gr=function(i,e,t){var A=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=Ht(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Ii(i,"〇一二三四五六七八九",r);case 6:return qi(i,1,3999,_d,3,A).toLowerCase();case 7:return qi(i,1,3999,_d,3,A);case 8:return Ht(i,945,969,!1,A);case 9:return Ht(i,97,122,!1,A);case 10:return Ht(i,65,90,!1,A);case 11:return Ht(i,1632,1641,!0,A);case 12:case 49:return qi(i,1,9999,Pd,3,A);case 35:return qi(i,1,9999,Pd,3,A).toLowerCase();case 13:return Ht(i,2534,2543,!0,A);case 14:case 30:return Ht(i,6112,6121,!0,A);case 15:return Ii(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Ii(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ti(i,"零一二三四五六七八九",Od,"負",r,fi|mi|Rr);case 47:return ti(i,"零壹貳參肆伍陸柒捌玖",kd,"負",r,ji|fi|mi|Rr);case 42:return ti(i,"零一二三四五六七八九",Od,"负",r,fi|mi|Rr);case 41:return ti(i,"零壹贰叁肆伍陆柒捌玖",kd,"负",r,ji|fi|mi|Rr);case 26:return ti(i,"〇一二三四五六七八九","十百千万",Kd,r,0);case 25:return ti(i,"零壱弐参四伍六七八九","拾百千万",Kd,r,ji|fi|mi);case 31:return ti(i,"영일이삼사오육칠팔구","십백천만",Xa,n,ji|fi|mi);case 33:return ti(i,"零一二三四五六七八九","十百千萬",Xa,n,0);case 32:return ti(i,"零壹貳參四五六七八九","拾百千",Xa,n,ji|fi|mi);case 18:return Ht(i,2406,2415,!0,A);case 20:return qi(i,1,19999,ev,3,A);case 21:return Ht(i,2790,2799,!0,A);case 22:return Ht(i,2662,2671,!0,A);case 22:return qi(i,1,10999,jC,3,A);case 23:return Ii(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Ii(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ht(i,3302,3311,!0,A);case 28:return Ii(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Ii(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Ht(i,3792,3801,!0,A);case 37:return Ht(i,6160,6169,!0,A);case 38:return Ht(i,4160,4169,!0,A);case 39:return Ht(i,2918,2927,!0,A);case 40:return Ht(i,1776,1785,!0,A);case 43:return Ht(i,3046,3055,!0,A);case 44:return Ht(i,3174,3183,!0,A);case 45:return Ht(i,3664,3673,!0,A);case 46:return Ht(i,3872,3881,!0,A);default:return Ht(i,48,57,!0,A)}},Vd="data-html2canvas-ignore",zd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new qC,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return i.prototype.toIFrame=function(e,t){var A=this,r=tv(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=r.contentWindow,l=o.document,c=rv(r).then(function(){return tA(A,void 0,void 0,function(){var u,g;return Zt(this,function(B){switch(B.label){case 0:return this.scrolledElements.forEach(av),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,g=this.clonedReferenceElement,typeof g>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:B.sent(),B.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,iv(l)]:[3,4];case 3:B.sent(),B.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,g)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(sv(document.doctype)+"<html></html>"),ov(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(La(e,2))debugger;if(Ed(e))return this.createCanvasClone(e);if(Ld(e))return this.createVideoClone(e);if(Hd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return $a(t)&&($a(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Dd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ja(e.style,t),t},i.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var A=[].slice.call(t.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),r=e.cloneNode(!1);return r.textContent=A,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},i.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var A=e.ownerDocument.createElement("img");try{return A.src=e.toDataURL(),A}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var l=o.getContextAttributes();l?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},i.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var A=t.getContext("2d");try{return A&&(A.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||A.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},i.prototype.appendChildNode=function(e,t,A){(!Yi(t)||!YC(t)&&!t.hasAttribute(Vd)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Yi(t)||!Hd(t))&&e.appendChild(this.cloneNode(t,A))},i.prototype.cloneChildNodes=function(e,t,A){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(Yi(n)&&Id(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,A)})}else this.appendChildNode(t,n,A)},i.prototype.cloneNode=function(e,t){if(Ud(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Yi(e)&&(Ra(e)||Us(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),o=A.getComputedStyle(e,":after");this.referenceElement===e&&Ra(r)&&(this.clonedReferenceElement=r),Ga(r)&&hv(r);var l=this.counters.parse(new id(this.context,n)),c=this.resolvePseudoContent(e,r,s,$r.BEFORE);Dd(e)&&(t=!0),Ld(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,o,$r.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||Us(e))&&!Md(e)||t)&&Ja(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ss(e)||Es(e))&&(Ss(r)||Es(r))&&(r.value=e.value),r}return e.cloneNode(!1)},i.prototype.resolvePseudoContent=function(e,t,A,r){var n=this;if(A){var s=A.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||A.display==="none")){this.counters.parse(new id(this.context,A));var l=new $y(this.context,A),c=o.createElement("html2canvaspseudoelement");Ja(A,c),l.content.forEach(function(g){if(g.type===0)c.appendChild(o.createTextNode(g.value));else if(g.type===22){var B=o.createElement("img");B.src=g.value,B.style.opacity="1",c.appendChild(B)}else if(g.type===18){if(g.name==="attr"){var v=g.values.filter(wt);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(g.name==="counter"){var b=g.values.filter(Ji),C=b[0],U=b[1];if(C&&wt(C)){var F=n.counters.getCounterValue(C.value),S=U&&wt(U)?Ea.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Gr(F,S,!1)))}}else if(g.name==="counters"){var K=g.values.filter(Ji),C=K[0],G=K[1],U=K[2];if(C&&wt(C)){var M=n.counters.getCounterValues(C.value),W=U&&wt(U)?Ea.parse(n.context,U.value):3,ne=G&&G.type===0?G.value:"",J=M.map(function(re){return Gr(re,W,!1)}).join(ne);c.appendChild(o.createTextNode(J))}}}else if(g.type===20)switch(g.value){case"open-quote":c.appendChild(o.createTextNode(Ad(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Ad(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(g.value))}}),c.className=Za+" "+Ya;var u=r===$r.BEFORE?" "+Za:" "+Ya;return Us(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),$r;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})($r||($r={}));var tv=function(i,e){var t=i.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(Vd,"true"),i.body.appendChild(t),t},Av=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},iv=function(i){return Promise.all([].slice.call(i.images,0).map(Av))},rv=function(i){return new Promise(function(e,t){var A=i.contentWindow;if(!A)return t("No window assigned for iframe");var r=A.document;A.onload=i.onload=function(){A.onload=i.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(i))},50)}})},nv=["all","d","content"],Ja=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);nv.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},sv=function(i){var e="";return i&&(e+="<!DOCTYPE ",i.name&&(e+=i.name),i.internalSubset&&(e+=i.internalSubset),i.publicId&&(e+='"'+i.publicId+'"'),i.systemId&&(e+='"'+i.systemId+'"'),e+=">"),e},ov=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},av=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},lv=":before",cv=":after",Za="___html2canvas___pseudoelement_before",Ya="___html2canvas___pseudoelement_after",Wd=`{
7
7
  content: "" !important;
8
8
  display: none !important;
9
- }`,lv=function(i){cv(i,"."+Ja+ov+Vp+`
10
- .`+Za+av+Vp)},cv=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},zp=(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})(),hv=(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)||(qa(e)||fv(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},i.prototype.match=function(e){return this._cache[e]},i.prototype.loadImage=function(e){return tA(this,void 0,void 0,function(){var t,A,r,n,s=this;return Zt(this,function(o){switch(o.label){case 0:return t=zp.isSameOrigin(e),A=!Ya(e)&&this._options.useCORS===!0&&Rt.SUPPORT_CORS_IMAGES&&!t,r=!Ya(e)&&!t&&!qa(e)&&typeof this._options.proxy=="string"&&Rt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Ya(e)&&!qa(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=Rt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var g=new FileReader;g.addEventListener("load",function(){return n(g.result)},!1),g.addEventListener("error",function(B){return s(B)},!1),g.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),uv=/^data:image\/svg\+xml/i,pv=/^data:image\/.*;base64,/i,dv=/^data:image\/.*/i,fv=function(i){return Rt.SUPPORT_SVG_DRAWING||!gv(i)},Ya=function(i){return dv.test(i)},mv=function(i){return pv.test(i)},qa=function(i){return i.substr(0,4)==="blob"},gv=function(i){return i.substr(-3).toLowerCase()==="svg"||uv.test(i)},Ie=(function(){function i(e,t){this.type=0,this.x=e,this.y=t}return i.prototype.add=function(e,t){return new i(this.x+e,this.y+t)},i})(),er=function(i,e,t){return new Ie(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},Ls=(function(){function i(e,t,A,r){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=r}return i.prototype.subdivide=function(e,t){var A=er(this.start,this.startControl,e),r=er(this.startControl,this.endControl,e),n=er(this.endControl,this.end,e),s=er(A,r,e),o=er(r,n,e),l=er(s,o,e);return t?new i(this.start,A,s,l):new i(l,o,n,this.end)},i.prototype.add=function(e,t){return new i(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},i.prototype.reverse=function(){return new i(this.end,this.endControl,this.startControl,this.start)},i})(),TA=function(i){return i.type===1},wv=(function(){function i(e){var t=e.styles,A=e.bounds,r=kr(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=kr(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=kr(t.borderBottomRightRadius,A.width,A.height),g=u[0],B=u[1],v=kr(t.borderBottomLeftRadius,A.width,A.height),T=v[0],y=v[1],S=[];S.push((n+l)/A.width),S.push((T+g)/A.width),S.push((s+y)/A.height),S.push((c+B)/A.height);var F=Math.max.apply(Math,S);F>1&&(n/=F,s/=F,l/=F,c/=F,g/=F,B/=F,T/=F,y/=F);var E=A.width-l,k=A.height-B,R=A.width-g,M=A.height-y,z=t.borderTopWidth,ne=t.borderRightWidth,J=t.borderBottomWidth,V=t.borderLeftWidth,Ae=vt(t.paddingTop,e.bounds.width),re=vt(t.paddingRight,e.bounds.width),he=vt(t.paddingBottom,e.bounds.width),Y=vt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?xt(A.left+V/3,A.top+z/3,n-V/3,s-z/3,dt.TOP_LEFT):new Ie(A.left+V/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?xt(A.left+E,A.top+z/3,l-ne/3,c-z/3,dt.TOP_RIGHT):new Ie(A.left+A.width-ne/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=g>0||B>0?xt(A.left+R,A.top+k,g-ne/3,B-J/3,dt.BOTTOM_RIGHT):new Ie(A.left+A.width-ne/3,A.top+A.height-J/3),this.bottomLeftBorderDoubleOuterBox=T>0||y>0?xt(A.left+V/3,A.top+M,T-V/3,y-J/3,dt.BOTTOM_LEFT):new Ie(A.left+V/3,A.top+A.height-J/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?xt(A.left+V*2/3,A.top+z*2/3,n-V*2/3,s-z*2/3,dt.TOP_LEFT):new Ie(A.left+V*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?xt(A.left+E,A.top+z*2/3,l-ne*2/3,c-z*2/3,dt.TOP_RIGHT):new Ie(A.left+A.width-ne*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=g>0||B>0?xt(A.left+R,A.top+k,g-ne*2/3,B-J*2/3,dt.BOTTOM_RIGHT):new Ie(A.left+A.width-ne*2/3,A.top+A.height-J*2/3),this.bottomLeftBorderDoubleInnerBox=T>0||y>0?xt(A.left+V*2/3,A.top+M,T-V*2/3,y-J*2/3,dt.BOTTOM_LEFT):new Ie(A.left+V*2/3,A.top+A.height-J*2/3),this.topLeftBorderStroke=n>0||s>0?xt(A.left+V/2,A.top+z/2,n-V/2,s-z/2,dt.TOP_LEFT):new Ie(A.left+V/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?xt(A.left+E,A.top+z/2,l-ne/2,c-z/2,dt.TOP_RIGHT):new Ie(A.left+A.width-ne/2,A.top+z/2),this.bottomRightBorderStroke=g>0||B>0?xt(A.left+R,A.top+k,g-ne/2,B-J/2,dt.BOTTOM_RIGHT):new Ie(A.left+A.width-ne/2,A.top+A.height-J/2),this.bottomLeftBorderStroke=T>0||y>0?xt(A.left+V/2,A.top+M,T-V/2,y-J/2,dt.BOTTOM_LEFT):new Ie(A.left+V/2,A.top+A.height-J/2),this.topLeftBorderBox=n>0||s>0?xt(A.left,A.top,n,s,dt.TOP_LEFT):new Ie(A.left,A.top),this.topRightBorderBox=l>0||c>0?xt(A.left+E,A.top,l,c,dt.TOP_RIGHT):new Ie(A.left+A.width,A.top),this.bottomRightBorderBox=g>0||B>0?xt(A.left+R,A.top+k,g,B,dt.BOTTOM_RIGHT):new Ie(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=T>0||y>0?xt(A.left,A.top+M,T,y,dt.BOTTOM_LEFT):new Ie(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?xt(A.left+V,A.top+z,Math.max(0,n-V),Math.max(0,s-z),dt.TOP_LEFT):new Ie(A.left+V,A.top+z),this.topRightPaddingBox=l>0||c>0?xt(A.left+Math.min(E,A.width-ne),A.top+z,E>A.width+ne?0:Math.max(0,l-ne),Math.max(0,c-z),dt.TOP_RIGHT):new Ie(A.left+A.width-ne,A.top+z),this.bottomRightPaddingBox=g>0||B>0?xt(A.left+Math.min(R,A.width-V),A.top+Math.min(k,A.height-J),Math.max(0,g-ne),Math.max(0,B-J),dt.BOTTOM_RIGHT):new Ie(A.left+A.width-ne,A.top+A.height-J),this.bottomLeftPaddingBox=T>0||y>0?xt(A.left+V,A.top+Math.min(M,A.height-J),Math.max(0,T-V),Math.max(0,y-J),dt.BOTTOM_LEFT):new Ie(A.left+V,A.top+A.height-J),this.topLeftContentBox=n>0||s>0?xt(A.left+V+Y,A.top+z+Ae,Math.max(0,n-(V+Y)),Math.max(0,s-(z+Ae)),dt.TOP_LEFT):new Ie(A.left+V+Y,A.top+z+Ae),this.topRightContentBox=l>0||c>0?xt(A.left+Math.min(E,A.width+V+Y),A.top+z+Ae,E>A.width+V+Y?0:l-V+Y,c-(z+Ae),dt.TOP_RIGHT):new Ie(A.left+A.width-(ne+re),A.top+z+Ae),this.bottomRightContentBox=g>0||B>0?xt(A.left+Math.min(R,A.width-(V+Y)),A.top+Math.min(k,A.height+z+Ae),Math.max(0,g-(ne+re)),B-(J+he),dt.BOTTOM_RIGHT):new Ie(A.left+A.width-(ne+re),A.top+A.height-(J+he)),this.bottomLeftContentBox=T>0||y>0?xt(A.left+V+Y,A.top+M,Math.max(0,T-(V+Y)),y-(J+he),dt.BOTTOM_LEFT):new Ie(A.left+V+Y,A.top+A.height-(J+he))}return i})(),dt;(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"})(dt||(dt={}));var xt=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 dt.TOP_LEFT:return new Ls(new Ie(i,c),new Ie(i,c-o),new Ie(l-s,e),new Ie(l,e));case dt.TOP_RIGHT:return new Ls(new Ie(i,e),new Ie(i+s,e),new Ie(l,c-o),new Ie(l,c));case dt.BOTTOM_RIGHT:return new Ls(new Ie(l,e),new Ie(l,e+o),new Ie(i+s,c),new Ie(i,c));case dt.BOTTOM_LEFT:default:return new Ls(new Ie(l,c),new Ie(l-s,c),new Ie(i,e+o),new Ie(i,e))}},Ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},Bv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Hs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},yv=(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})(),Cv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),vv=function(i){return i.type===0},Wp=function(i){return i.type===1},Tv=function(i){return i.type===2},Rp=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},bv=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})},Gp=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),$p=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new wv(this.container),this.container.styles.opacity<1&&this.effects.push(new Cv(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 yv(A,r,n))}if(this.container.styles.overflowX!==0){var s=Ms(this.curves),o=Hs(this.curves);Rp(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!Wp(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);Rp(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})(),ja=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Nt(r.flags,4),s=Nt(r.flags,2),o=new $p(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 Gp(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var g=r.styles.zIndex.order;if(g<0){var B=0;c.negativeZIndex.some(function(T,y){return g>T.element.container.styles.zIndex.order?(B=y,!1):B>0}),c.negativeZIndex.splice(B,0,u)}else if(g>0){var v=0;c.positiveZIndex.some(function(T,y){return g>=T.element.container.styles.zIndex.order?(v=y+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);ja(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),ja(o,e,t,l);Nt(r.flags,8)&&Xp(r,l)})},Xp=function(i,e){for(var t=i instanceof Va?i.start:1,A=i instanceof Va?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Bp&&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}},xv=function(i){var e=new $p(i,null),t=new Gp(e),A=[];return ja(e,t,t,A),Xp(e.container,A),t},Jp=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)}},Qv=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)}},Fv=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)}},Uv=function(i,e){switch(e){case 0:return Ds(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return Ds(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return Ds(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return Ds(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},Ds=function(i,e){var t=[];return 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},Zp=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},_s=function(i){var e=i.styles,t=i.bounds,A=vt(e.paddingLeft,t.width),r=vt(e.paddingRight,t.width),n=vt(e.paddingTop,t.width),s=vt(e.paddingBottom,t.width);return t.add(A+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},Sv=function(i,e){return i===0?e.bounds:i===2?_s(e):Zp(e)},Ev=function(i,e){return i===0?e.bounds:i===2?_s(e):Zp(e)},el=function(i,e,t){var A=Sv(Ar(i.styles.backgroundOrigin,e),i),r=Ev(Ar(i.styles.backgroundClip,e),i),n=Lv(Ar(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=kr(Ar(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=Mv(Ar(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),g=Math.round(A.top+l[1]);return[c,u,g,s,o]},tr=function(i){return wt(i)&&i.value===Zi.AUTO},Ps=function(i){return typeof i=="number"},Lv=function(i,e,t){var A=e[0],r=e[1],n=e[2],s=i[0],o=i[1];if(!s)return[0,0];if(Pt(s)&&o&&Pt(o))return[vt(s,t.width),vt(o,t.height)];var l=Ps(n);if(wt(s)&&(s.value===Zi.CONTAIN||s.value===Zi.COVER)){if(Ps(n)){var c=t.width/t.height;return c<n!=(s.value===Zi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=Ps(A),g=Ps(r),B=u||g;if(tr(s)&&(!o||tr(o))){if(u&&g)return[A,r];if(!l&&!B)return[t.width,t.height];if(B&&l){var v=u?A:r*n,T=g?r:A/n;return[v,T]}var y=u?A:t.width,S=g?r:t.height;return[y,S]}if(l){var F=0,E=0;return Pt(s)?F=vt(s,t.width):Pt(o)&&(E=vt(o,t.height)),tr(s)?F=E*n:(!o||tr(o))&&(E=F/n),[F,E]}var k=null,R=null;if(Pt(s)?k=vt(s,t.width):o&&Pt(o)&&(R=vt(o,t.height)),k!==null&&(!o||tr(o))&&(R=u&&g?k/A*r:t.height),R!==null&&tr(s)&&(k=u&&g?R/r*A:t.width),k!==null&&R!==null)return[k,R];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},Mv=function(i,e,t,A,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(i){case 2:return[new Ie(Math.round(A.left),Math.round(A.top+s)),new Ie(Math.round(A.left+A.width),Math.round(A.top+s)),new Ie(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Ie(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Ie(Math.round(A.left+n),Math.round(A.top)),new Ie(Math.round(A.left+n+o),Math.round(A.top)),new Ie(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Ie(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Ie(Math.round(A.left+n),Math.round(A.top+s)),new Ie(Math.round(A.left+n+o),Math.round(A.top+s)),new Ie(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Ie(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Ie(Math.round(r.left),Math.round(r.top)),new Ie(Math.round(r.left+r.width),Math.round(r.top)),new Ie(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Ie(Math.round(r.left),Math.round(r.height+r.top))]}},Hv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Yp="Hidden Text",Iv=(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=Hv,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(Yp)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Yp)),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})(),qp=(function(){function i(e,t){this.context=e,this.options=t}return i})(),Dv=1e4,_v=(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 Iv(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(),Tv(t)&&(this.ctx.globalAlpha=t.opacity),vv(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)),Wp(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return tA(this,void 0,void 0,function(){return Zt(this,function(A){switch(A.label){case 0:if(Nt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return A.sent(),[4,this.renderNodeContent(t)];case 2:A.sent(),A.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,A,r){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=Ka(t.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,t.bounds.top+r),o+n.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var A=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=Kv(t.fontFamily).join(", "),n=Or(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,A){return tA(this,void 0,void 0,function(){var r,n,s,o,l,c,u,g,B=this;return Zt(this,function(v){return r=this.createFontStyle(A),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,u=l.middle,g=A.paintOrder,t.textBounds.forEach(function(T){g.forEach(function(y){switch(y){case 0:B.ctx.fillStyle=kt(A.color),B.renderTextWithLetterSpacing(T,A.letterSpacing,c);var S=A.textShadow;S.length&&T.text.trim().length&&(S.slice(0).reverse().forEach(function(F){B.ctx.shadowColor=kt(F.color),B.ctx.shadowOffsetX=F.offsetX.number*B.options.scale,B.ctx.shadowOffsetY=F.offsetY.number*B.options.scale,B.ctx.shadowBlur=F.blur.number,B.renderTextWithLetterSpacing(T,A.letterSpacing,c)}),B.ctx.shadowColor="",B.ctx.shadowOffsetX=0,B.ctx.shadowOffsetY=0,B.ctx.shadowBlur=0),A.textDecorationLine.length&&(B.ctx.fillStyle=kt(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:B.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top+c),T.bounds.width,1);break;case 2:B.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top),T.bounds.width,1);break;case 3:B.ctx.fillRect(T.bounds.left,Math.ceil(T.bounds.top+u),T.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&T.text.trim().length&&(B.ctx.strokeStyle=kt(A.webkitTextStrokeColor),B.ctx.lineWidth=A.webkitTextStrokeWidth,B.ctx.lineJoin=window.chrome?"miter":"round",B.ctx.strokeText(T.text,T.bounds.left,T.bounds.top+c)),B.ctx.strokeStyle="",B.ctx.lineWidth=0,B.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=_s(t),s=Hs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,E,E,c,u,g,B,R,v,T,M,y,S,F,E,k,R,M;return Zt(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 mp))return[3,8];z.label=5;case 5:return z.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof gp&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof wp))return[3,12];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,12];case 11:return z.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof Tp&&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 za&&(g=Math.min(A.bounds.width,A.bounds.height),A.type===xs?A.checked&&(this.ctx.save(),this.path([new Ie(A.bounds.left+g*.39363,A.bounds.top+g*.79),new Ie(A.bounds.left+g*.16,A.bounds.top+g*.5549),new Ie(A.bounds.left+g*.27347,A.bounds.top+g*.44071),new Ie(A.bounds.left+g*.39694,A.bounds.top+g*.5649),new Ie(A.bounds.left+g*.72983,A.bounds.top+g*.23),new Ie(A.bounds.left+g*.84,A.bounds.top+g*.34085),new Ie(A.bounds.left+g*.39363,A.bounds.top+g*.79)]),this.ctx.fillStyle=kt(yp),this.ctx.fill(),this.ctx.restore()):A.type===Qs&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+g/2,A.bounds.top+g/2,g/4,0,Math.PI*2,!0),this.ctx.fillStyle=kt(yp),this.ctx.fill(),this.ctx.restore())),Pv(A)&&A.value.length){switch(B=this.createFontStyle(n),R=B[0],v=B[1],T=this.fontMetrics.getMetrics(R,v).baseline,this.ctx.font=R,this.ctx.fillStyle=kt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Ov(A.styles.textAlign),M=_s(A),y=0,A.styles.textAlign){case 1:y+=M.width/2;break;case 2:y+=M.width;break}S=M.add(y,0,0,-M.height/2+1),this.ctx.save(),this.path([new Ie(M.left,M.top),new Ie(M.left+M.width,M.top),new Ie(M.left+M.width,M.top+M.height),new Ie(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Wr(A.value,S),n.letterSpacing,T),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];E=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 E=z.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.bounds.top),[3,18];case 17:return z.sent(),this.context.logger.error("Error loading list-style-image "+k),[3,18];case 18:return[3,20];case 19:t.listValue&&A.styles.listStyleType!==-1&&(R=this.createFontStyle(n)[0],this.ctx.font=R,this.ctx.fillStyle=kt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new qA(A.bounds.left,A.bounds.top+vt(A.styles.paddingTop,A.bounds.width),A.bounds.width,Yu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Wr(t.listValue,M),n.letterSpacing,Yu(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),z.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return tA(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,g,B,F,v,T,F,y,S,F;return Zt(this,function(E){switch(E.label){case 0:if(Nt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:E.sent(),A=0,r=t.negativeZIndex,E.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:E.sent(),E.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:E.sent(),n=0,s=t.nonInlineLevel,E.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:E.sent(),E.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,E.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,E.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:g=0,B=t.inlineLevel,E.label=19;case 19:return g<B.length?(F=B[g],[4,this.renderNode(F)]):[3,22];case 20:E.sent(),E.label=21;case 21:return g++,[3,19];case 22:v=0,T=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return v<T.length?(F=T[v],[4,this.renderStack(F)]):[3,26];case 24:E.sent(),E.label=25;case 25:return v++,[3,23];case 26:y=0,S=t.positiveZIndex,E.label=27;case 27:return y<S.length?(F=S[y],[4,this.renderStack(F)]):[3,30];case 28:E.sent(),E.label=29;case 29:return y++,[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 tA(this,void 0,void 0,function(){var A,r,n,s,o,l;return Zt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var g,B,v,Ae,ce,se,Y,te,J,T,Ae,ce,se,Y,te,y,S,F,E,k,R,M,z,ne,J,V,Ae,re,he,Y,te,oe,ce,se,ae,de,we,Fe,Ue,Be,Te,Ce;return Zt(this,function(xe){switch(xe.label){case 0:if(u.type!==0)return[3,5];g=void 0,B=u.url,xe.label=1;case 1:return xe.trys.push([1,3,,4]),[4,n.context.cache.match(B)];case 2:return g=xe.sent(),[3,4];case 3:return xe.sent(),n.context.logger.error("Error loading background-image "+B),[3,4];case 4:return g&&(v=el(t,A,[g.width,g.height,g.width/g.height]),Ae=v[0],ce=v[1],se=v[2],Y=v[3],te=v[4],J=n.ctx.createPattern(n.resizeImage(g,Y,te),"repeat"),n.renderRepeat(Ae,J,ce,se)),[3,6];case 5:v2(u)?(T=el(t,A,[null,null,null]),Ae=T[0],ce=T[1],se=T[2],Y=T[3],te=T[4],y=g2(u.angle,Y,te),S=y[0],F=y[1],E=y[2],k=y[3],R=y[4],M=document.createElement("canvas"),M.width=Y,M.height=te,z=M.getContext("2d"),ne=z.createLinearGradient(F,k,E,R),ku(u.stops,S).forEach(function(Le){return ne.addColorStop(Le.stop,kt(Le.color))}),z.fillStyle=ne,z.fillRect(0,0,Y,te),Y>0&&te>0&&(J=n.ctx.createPattern(M,"repeat"),n.renderRepeat(Ae,J,ce,se))):T2(u)&&(V=el(t,A,[null,null,null]),Ae=V[0],re=V[1],he=V[2],Y=V[3],te=V[4],oe=u.position.length===0?[Qa]:u.position,ce=vt(oe[0],Y),se=vt(oe[oe.length-1],te),ae=w2(u,ce,se,Y,te),de=ae[0],we=ae[1],de>0&&we>0&&(Fe=n.ctx.createRadialGradient(re+ce,he+se,0,re+ce,he+se,de),ku(u.stops,de*2).forEach(function(Le){return Fe.addColorStop(Le.stop,kt(Le.color))}),n.path(Ae),n.ctx.fillStyle=Fe,de!==we?(Ue=t.bounds.left+.5*t.bounds.width,Be=t.bounds.top+.5*t.bounds.height,Te=we/de,Ce=1/Te,n.ctx.save(),n.ctx.translate(Ue,Be),n.ctx.transform(1,0,0,Te,0,0),n.ctx.translate(-Ue,-Be),n.ctx.fillRect(re,Ce*(he-Be)+Be,Y,te*Ce),n.ctx.restore()):n.ctx.fill())),xe.label=6;case 6:return A--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,A,r){return tA(this,void 0,void 0,function(){return Zt(this,function(n){return this.path(Jp(r,A)),this.ctx.fillStyle=kt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return tA(this,void 0,void 0,function(){var s,o;return Zt(this,function(l){switch(l.label){case 0:return A<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=Qv(n,r),this.path(s),this.ctx.fillStyle=kt(t),this.ctx.fill(),o=Fv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,g=this;return Zt(this,function(B){switch(B.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!ui(A.backgroundColor)||A.backgroundImage.length,n=[{style:A.borderTopStyle,color:A.borderTopColor,width:A.borderTopWidth},{style:A.borderRightStyle,color:A.borderRightColor,width:A.borderRightWidth},{style:A.borderBottomStyle,color:A.borderBottomColor,width:A.borderBottomWidth},{style:A.borderLeftStyle,color:A.borderLeftColor,width:A.borderLeftWidth}],s=Nv(Ar(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),ui(A.backgroundColor)||(this.ctx.fillStyle=kt(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:B.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){g.ctx.save();var T=Ms(t.curves),y=v.inset?0:Dv,S=bv(T,-y+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(g.path(T),g.ctx.clip(),g.mask(S)):(g.mask(T),g.ctx.clip(),g.path(S)),g.ctx.shadowOffsetX=v.offsetX.number+y,g.ctx.shadowOffsetY=v.offsetY.number,g.ctx.shadowColor=kt(v.color),g.ctx.shadowBlur=v.blur.number,g.ctx.fillStyle=v.inset?kt(v.color):"rgba(0,0,0,1)",g.ctx.fill(),g.ctx.restore()}),B.label=2;case 2:o=0,l=0,c=n,B.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!ui(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return B.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return B.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return B.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:B.sent(),B.label=11;case 11:o++,B.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return tA(this,void 0,void 0,function(){var o,l,c,u,g,B,v,T,y,S,F,E,k,R,M,z,M,z;return Zt(this,function(ne){return this.ctx.save(),o=Uv(n,r),l=Jp(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])?(g=l[1].end.x,B=l[1].end.y):(g=l[1].x,B=l[1].y),r===0||r===2?v=Math.abs(c-g):v=Math.abs(u-B),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),T=A<3?A*3:A*2,y=A<3?A*2:A,s===3&&(T=A,y=A),S=!0,v<=T*2?S=!1:v<=T*2+y?(F=v/(2*T+y),T*=F,y*=F):(E=Math.floor((v+y)/(T+y)),k=(v-E*T)/(E-1),R=(v-(E+1)*T)/E,y=R<=0||Math.abs(y-k)<Math.abs(y-R)?k:R),S&&(s===3?this.ctx.setLineDash([0,T+y]):this.ctx.setLineDash([T,y])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=kt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(TA(l[0])&&(M=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Ie(M.end.x,M.end.y),new Ie(z.start.x,z.start.y)]),this.ctx.stroke()),TA(l[1])&&(M=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Ie(M.end.x,M.end.y),new Ie(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=kt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=xv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(qp),Pv=function(i){return i instanceof vp||i instanceof Cp?!0:i instanceof za&&i.type!==Qs&&i.type!==xs},Nv=function(i,e){switch(i){case 0:return Ms(e);case 2:return Bv(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"],Kv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return kv.indexOf(e)===-1}):i},Vv=(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 tA(this,void 0,void 0,function(){var A,r;return Zt(this,function(n){switch(n.label){case 0:return A=ka(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,zv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=kt(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(qp),zv=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))})},Wv=(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})(),Rv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Wv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new hv(this,e)}return i.instanceCount=1,i})(),Gv=function(i,e){return e===void 0&&(e={}),$v(i,e)};typeof window<"u"&&zp.setContext(window);var $v=function(i,e){return tA(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,g,B,v,T,y,S,F,E,k,R,M,ne,z,ne,J,V,Ae,re,he,Y,te,oe,ce,se,ae,de,we,Fe,Ue,Be,Te;return Zt(this,function(Ce){switch(Ce.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:(J=e.allowTaint)!==null&&J!==void 0?J:!1,imageTimeout:(V=e.imageTimeout)!==null&&V!==void 0?V:15e3,proxy:e.proxy,useCORS:(Ae=e.useCORS)!==null&&Ae!==void 0?Ae:!1},n=na({logging:(re=e.logging)!==null&&re!==void 0?re:!0,cache:e.cache},r),s={windowWidth:(he=e.windowWidth)!==null&&he!==void 0?he:A.innerWidth,windowHeight:(Y=e.windowHeight)!==null&&Y!==void 0?Y:A.innerHeight,scrollX:(te=e.scrollX)!==null&&te!==void 0?te:A.pageXOffset,scrollY:(oe=e.scrollY)!==null&&oe!==void 0?oe:A.pageYOffset},o=new qA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new Rv(n,o),c=(ce=e.foreignObjectRendering)!==null&&ce!==void 0?ce:!1,u={allowTaint:(se=e.allowTaint)!==null&&se!==void 0?se:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),g=new Kp(l,i,u),B=g.clonedReferenceElement,B?[4,g.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=Ce.sent(),T=Ra(B)||XC(B)?bw(B.ownerDocument):Gn(l,B),y=T.width,S=T.height,F=T.left,E=T.top,k=Xv(l,B,e.backgroundColor),R={canvas:e.canvas,backgroundColor:k,scale:(de=(ae=e.scale)!==null&&ae!==void 0?ae:A.devicePixelRatio)!==null&&de!==void 0?de:1,x:((we=e.x)!==null&&we!==void 0?we:0)+F,y:((Fe=e.y)!==null&&Fe!==void 0?Fe:0)+E,width:(Ue=e.width)!==null&&Ue!==void 0?Ue:Math.ceil(y),height:(Be=e.height)!==null&&Be!==void 0?Be:Math.ceil(S)},c?(l.logger.debug("Document cloned, using foreign object rendering"),ne=new Vv(l,R),[4,ne.render(B)]):[3,3];case 2:return M=Ce.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+E+" with size "+y+"x"+S+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=xp(l,B),k===z.styles.backgroundColor&&(z.styles.backgroundColor=ei.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),ne=new _v(l,R),[4,ne.render(z)];case 4:M=Ce.sent(),Ce.label=5;case 5:return(!((Te=e.removeContainer)!==null&&Te!==void 0)||Te)&&(Kp.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Xv=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?ui(r)?ui(n)?s:n:r:s};const Jv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class Zv{constructor(e,t,A="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=r,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=o.context,c=n._chart,u=n._series;if(!c||!u)return;const g=u.priceToCoordinate(n.price);if(g==null)return;const B=Math.round(g*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),T=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),y=o.bitmapSize.width;if(T>=y)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(T,B),l.lineTo(y,B),l.stroke(),l.beginPath(),l.fillStyle=n.color;const S=3*o.verticalPixelRatio;l.arc(T,B,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 jp{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!A.visible||!A.text||!A._series)return;const c=A._series.priceToCoordinate(A.price);if(c==null)return;const u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const g=Math.round(8*o),B=Math.round(14*l),v=s.width;let T;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);T=F!=null?Math.round(F*o):g,n.textAlign="right"}else T=g,n.textAlign="left";else A.hAlign==="right"?(T=v-g,n.textAlign="right"):(T=v/2,n.textAlign="center");const y=Math.round(c*l);let S;A.vAlign==="top"?S=y-B:A.vAlign==="bottom"?S=y+B:S=y,n.fillStyle=A.textColor,n.fillText(A.text,T,S)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Yv{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const g=l.horizontalPixelRatio,B=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),y=u.priceToCoordinate(s.p1.price),S=u.priceToCoordinate(s.p2.price);if(v==null||T==null||y==null||S==null)return;const F=Math.round(v*g),E=Math.round(y*B),k=Math.round(T*g),R=Math.round(S*B),M=l.context;if(M.save(),M.beginPath(),M.strokeStyle=s.color,M.lineWidth=s.lineWidth*B,M.setLineDash([]),M.moveTo(F,E),M.lineTo(k,R),M.stroke(),M.beginPath(),M.fillStyle=s.color,M.arc(F,E,3*B,0,Math.PI*2),M.fill(),M.beginPath(),M.arc(k,R,3*B,0,Math.PI*2),M.fill(),!s.statsShowAlways&&!s.isActive){M.restore();return}const{priceDiff:z,pricePct:ne,bars:J,days:V,angle:Ae}=s.info,re=z>=0?"+":"",he=[];if(s.statsPriceRange!==!1&&he.push(`${re}${z.toFixed(5)} (${re}${ne.toFixed(2)}%)`),s.statsBarsRange!==!1&&he.push(`${J} bars`),s.statsDateRange!==!1&&he.push(`${V} days`),s.statsAngle!==!1&&he.push(`∠ ${Ae.toFixed(1)}°`),s.statsDistance&&he.push(`Δ ${Math.abs(z).toFixed(5)}`),he.length===0){M.restore();return}const Y=Math.round(11*B);M.font=`${Y}px sans-serif`;const te=Y*1.6,oe=8*B,ce=Math.max(...he.map(Re=>M.measureText(Re).width))+oe*2,se=he.length*te+oe*2,ae=s.statsPosition??"right";let de,we;ae==="left"?(de=F,we=E):ae==="center"?(de=Math.round((F+k)/2),we=Math.round((E+R)/2)):(de=k,we=R);let Fe,Ue;ae==="left"?(Fe=de-ce-10*g,Ue=we-se-4*B):ae==="center"?(Fe=de-ce/2,Ue=we-se-8*B):(Fe=de+10*g,Ue=we-se-4*B);const Be=l.bitmapSize.width,Te=l.bitmapSize.height,Ce=Math.min(Math.max(0,Fe),Be-ce-4*g),xe=Math.min(Math.max(4*B,Ue),Te-se-4*B),Le=4*B;M.beginPath(),M.moveTo(Ce+Le,xe),M.lineTo(Ce+ce-Le,xe),M.quadraticCurveTo(Ce+ce,xe,Ce+ce,xe+Le),M.lineTo(Ce+ce,xe+se-Le),M.quadraticCurveTo(Ce+ce,xe+se,Ce+ce-Le,xe+se),M.lineTo(Ce+Le,xe+se),M.quadraticCurveTo(Ce,xe+se,Ce,xe+se-Le),M.lineTo(Ce,xe+Le),M.quadraticCurveTo(Ce,xe,Ce+Le,xe),M.closePath(),M.fillStyle="rgba(30, 41, 59, 0.92)",M.fill(),M.strokeStyle=s.statsColor||s.color,M.lineWidth=1*B,M.stroke(),M.fillStyle="#e2e8f0",M.textAlign="left",he.forEach((Re,Ke)=>{M.fillText(Re,Ce+oe,xe+oe+Y+Ke*te)}),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ed{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const g=l.horizontalPixelRatio,B=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),y=u.priceToCoordinate(s.p1.price),S=u.priceToCoordinate(s.p2.price);if(v==null||T==null||y==null||S==null)return;const F=Math.round(v*g),E=Math.round(y*B),k=Math.round(T*g),R=Math.round(S*B),M=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,k),Math.min(E,R),Math.abs(k-F),Math.abs(R-E)),z.strokeStyle=M,z.lineWidth=1*B,z.setLineDash([]),z.strokeRect(Math.min(F,k),Math.min(E,R),Math.abs(k-F),Math.abs(R-E))),z.beginPath(),z.strokeStyle=M,z.lineWidth=2*B,z.moveTo(F,E),z.lineTo(k,R),z.stroke(),z.fillStyle=M,z.beginPath(),z.arc(F,E,3*B,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(k,R,3*B,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:ne,pricePct:J,bars:V,days:Ae}=s.info,re=ne>=0?"+":"",he=[];if(s.statsPriceRange&&he.push(re+ne.toFixed(5)+" ("+re+J.toFixed(2)+"%)"),s.statsBarsRange&&he.push(V+" bars"),s.statsDateRange&&he.push(Ae+" days"),he.length===0){z.restore();return}const Y=Math.round(11*B);z.font=Y+"px sans-serif";const te=Y*1.6,oe=8*B,ce=Math.max(...he.map(Ce=>z.measureText(Ce).width))+oe*2,se=he.length*te+oe*2,ae=l.bitmapSize.width,de=l.bitmapSize.height;let we,Fe;if(s.statsPosition==="left")we=F-ce-10*g,Fe=E-se-4*B;else if(s.statsPosition==="center"){const Ce=(F+k)/2,xe=(E+R)/2;we=Ce-ce/2,Fe=xe-se-4*B}else we=k+10*g,Fe=R-se-4*B;const Ue=Math.min(Math.max(0,we),ae-ce-4*g),Be=Math.min(Math.max(4*B,Fe),de-se-4*B),Te=4*B;z.beginPath(),z.moveTo(Ue+Te,Be),z.lineTo(Ue+ce-Te,Be),z.quadraticCurveTo(Ue+ce,Be,Ue+ce,Be+Te),z.lineTo(Ue+ce,Be+se-Te),z.quadraticCurveTo(Ue+ce,Be+se,Ue+ce-Te,Be+se),z.lineTo(Ue+Te,Be+se),z.quadraticCurveTo(Ue,Be+se,Ue,Be+se-Te),z.lineTo(Ue,Be+Te),z.quadraticCurveTo(Ue,Be,Ue+Te,Be),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||M,z.lineWidth=1*B,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",he.forEach((Ce,xe)=>{z.fillText(Ce,Ue+oe,Be+oe+Y+xe*te)}),z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class qv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.fillColor=A.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||T==null)return;const y=Math.min(g,B)*c,S=Math.max(g,B)*c,F=Math.min(v,T)*u,E=Math.max(v,T)*u,k=S-y,R=E-F;if(k<.5||R<.5)return;const M=s.context;M.save(),M.fillStyle=r.fillColor,M.fillRect(y,F,k,R),M.strokeStyle=r.strokeColor,M.lineWidth=r.lineWidth*u,M.setLineDash([]),M.strokeRect(y,F,k,R),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class jv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||T==null)return;const y=g*c,S=B*u,F=v*c,E=T*u,k=Math.hypot(F-y,E-S);if(k<.5)return;const R=s.context;R.save(),R.strokeStyle=r.strokeColor,R.lineWidth=r.lineWidth*u,R.setLineDash([]),R.beginPath(),R.arc(y,S,k,0,Math.PI*2),R.stroke(),R.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class eT{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,c=n._series;if(!l||!c)return;const u=o.horizontalPixelRatio,g=o.verticalPixelRatio,B=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),T=l.timeScale().timeToCoordinate(n.p2.rawTime),y=c.priceToCoordinate(n.p2.price),S=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(B==null||v==null||T==null||y==null||S==null||F==null)return;const E=B*u,k=v*g,R=T*u,M=y*g,z=S*u,ne=F*g,J=o.context;J.save(),J.beginPath(),J.moveTo(E,k),J.lineTo(R,M),J.lineTo(z,ne),J.closePath(),J.fillStyle=n.fillColor,J.fill(),J.strokeStyle=n.strokeColor,J.lineWidth=n.lineWidth*g,J.setLineDash([]),J.stroke(),J.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.minorRatio=A.minorRatio??.45,this.previewAsLine=A.previewAsLine??!1,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||T==null)return;const y=g*c,S=B*u,F=v*c,E=T*u,k=F-y,R=E-S,M=Math.hypot(k,R);if(M<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*u,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(y,S),z.lineTo(F,E),z.stroke();else{const ne=(y+F)/2,J=(S+E)/2,V=Math.atan2(R,k),Ae=M/2,re=Math.max(1,Ae*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(ne,J,Ae,re,V,0,Math.PI*2),z.stroke()}z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class td{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#f59e0b",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight!==!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||T==null)return;const y=Math.round(g*c),S=Math.round(v*u),F=Math.round(B*c),E=Math.round(T*u),k=F-y,R=E-S,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const he=S+z*(0-y);M.beginPath(),M.moveTo(0,he),M.lineTo(y,S),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(y,S),M.lineTo(F,E),M.stroke();const ne=Math.atan2(E-S,F-y),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),he=E-J*Math.sin(ne-V),Y=F-J*Math.cos(ne+V),te=E-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Y,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=y-J*Math.cos(re-V),Y=S-J*Math.sin(re-V),te=y-J*Math.cos(re+V),oe=S-J*Math.sin(re+V);M.beginPath(),M.moveTo(y,S),M.lineTo(he,Y),M.lineTo(te,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,Y=r.p1.price,te=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(te-Y),ae=Y!==0?Math.abs((te-Y)/Y*100):0,de=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(de)+" ("+ae.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(he);if(se!=null&&ae!=null){const de=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);de!=null&&we!=null&&ce.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),ae=Math.floor(se/86400),de=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Fe=ae>0?ae+" day"+(ae!==1?"s":""):"";de>0&&(Fe+=(Fe?" ":"")+de+" hour"+(de!==1?"s":"")),!ae&&!de&&(Fe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=k/c,ae=R/u;ce.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(ce.length>0&&oe.push(ce.join(", ")),r.statsAngle){const se=k/c,ae=R/u,de=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+de.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,de=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Ue=oe.reduce((ye,pe)=>Math.max(ye,M.measureText(pe).width),0)+we*2,Be=oe.length*de+we*2,[Te,Ce,xe,Le]=y<=F?[y,S,F,E]:[F,E,y,S];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=Ce):r.statsPosition==="center"?(Re=(Te+xe)/2,Ke=(Ce+Le)/2):(Re=xe,Ke=Le);const be=Re-Ue/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(be,_e,Ue,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(be,_e,Ue,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,pe)=>{M.fillText(ye,be+we,_e+we+pe*de)})}}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 AT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||T==null)return;const y=Math.round(g*c),S=Math.round(v*u),F=Math.round(B*c),E=Math.round(T*u),k=F-y,R=E-S,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const he=S+z*(0-y);M.beginPath(),M.moveTo(0,he),M.lineTo(y,S),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(y,S),M.lineTo(F,E),M.stroke();const ne=Math.atan2(E-S,F-y),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),he=E-J*Math.sin(ne-V),Y=F-J*Math.cos(ne+V),te=E-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Y,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=y-J*Math.cos(re-V),Y=S-J*Math.sin(re-V),te=y-J*Math.cos(re+V),oe=S-J*Math.sin(re+V);M.beginPath(),M.moveTo(y,S),M.lineTo(he,Y),M.lineTo(te,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,Y=r.p1.price,te=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(te-Y),ae=Y!==0?Math.abs((te-Y)/Y*100):0,de=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(de)+" ("+ae.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(he);if(se!=null&&ae!=null){const de=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);de!=null&&we!=null&&ce.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),ae=Math.floor(se/86400),de=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Fe=ae>0?ae+" day"+(ae!==1?"s":""):"";de>0&&(Fe+=(Fe?" ":"")+de+" hour"+(de!==1?"s":"")),!ae&&!de&&(Fe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=k/c,ae=R/u;ce.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(ce.length>0&&oe.push(ce.join(", ")),r.statsAngle){const se=k/c,ae=R/u,de=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+de.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,de=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Ue=oe.reduce((ye,pe)=>Math.max(ye,M.measureText(pe).width),0)+we*2,Be=oe.length*de+we*2,[Te,Ce,xe,Le]=y<=F?[y,S,F,E]:[F,E,y,S];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=Ce):r.statsPosition==="center"?(Re=(Te+xe)/2,Ke=(Ce+Le)/2):(Re=xe,Ke=Le);const be=Re-Ue/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(be,_e,Ue,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(be,_e,Ue,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,pe)=>{M.fillText(ye,be+we,_e+we+pe*de)})}}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 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,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||T==null)return;const y=Math.round(g*c),S=Math.round(v*u),F=Math.round(B*c),E=Math.round(T*u),k=F-y,R=E-S,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const he=S+z*(0-y);M.beginPath(),M.moveTo(0,he),M.lineTo(y,S),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(y,S),M.lineTo(F,E),M.stroke();const ne=Math.atan2(E-S,F-y),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),he=E-J*Math.sin(ne-V),Y=F-J*Math.cos(ne+V),te=E-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Y,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=y-J*Math.cos(re-V),Y=S-J*Math.sin(re-V),te=y-J*Math.cos(re+V),oe=S-J*Math.sin(re+V);M.beginPath(),M.moveTo(y,S),M.lineTo(he,Y),M.lineTo(te,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,Y=r.p1.price,te=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(te-Y),ae=Y!==0?Math.abs((te-Y)/Y*100):0,de=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(de)+" ("+ae.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(he);if(se!=null&&ae!=null){const de=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);de!=null&&we!=null&&ce.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),ae=Math.floor(se/86400),de=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Fe=ae>0?ae+" day"+(ae!==1?"s":""):"";de>0&&(Fe+=(Fe?" ":"")+de+" hour"+(de!==1?"s":"")),!ae&&!de&&(Fe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=k/c,ae=R/u;ce.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(ce.length>0&&oe.push(ce.join(", ")),r.statsAngle){const se=k/c,ae=R/u,de=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+de.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,de=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Ue=oe.reduce((ye,pe)=>Math.max(ye,M.measureText(pe).width),0)+we*2,Be=oe.length*de+we*2,[Te,Ce,xe,Le]=y<=F?[y,S,F,E]:[F,E,y,S];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=Ce):r.statsPosition==="center"?(Re=(Te+xe)/2,Ke=(Ce+Le)/2):(Re=xe,Ke=Le);const be=Re-Ue/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(be,_e,Ue,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(be,_e,Ue,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,pe)=>{M.fillText(ye,be+we,_e+we+pe*de)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class rT{constructor(e,t,A="#22c55e",r=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const u=n._chart,g=n._series;if(!u||!g)return;const B=o.horizontalPixelRatio,v=o.verticalPixelRatio,T=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),y=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),S=g.priceToCoordinate(n.p1.price),F=g.priceToCoordinate(n.p2.price);if(T==null||y==null||S==null||F==null)return;const E=T*B,k=S*v,R=y*B,M=F*v,[z,ne,J,V]=E<=R?[E,k,R,M]:[R,M,E,k];let Ae=J-z,re=V-ne;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,Y=o.context;if(Y.save(),Y.strokeStyle=n.color,Y.fillStyle=n.color,Y.lineWidth=n.lineWidth*v,Y.setLineDash([]),n.rayLeft){const ae=ne+he*(0-z);Y.beginPath(),Y.moveTo(0,ae),Y.lineTo(z,ne),Y.stroke()}if(n.rayRight){const se=o.bitmapSize.width,ae=V+he*(se-J);Y.beginPath(),Y.moveTo(J,V),Y.lineTo(se,ae),Y.stroke()}const te=Math.atan2(re,Ae),oe=(n.lineWidth*4+4)*v,ce=Math.PI/7;if(n.arrowRight){const se=J-oe*Math.cos(te-ce),ae=V-oe*Math.sin(te-ce),de=J-oe*Math.cos(te+ce),we=V-oe*Math.sin(te+ce);Y.beginPath(),Y.moveTo(J,V),Y.lineTo(se,ae),Y.lineTo(de,we),Y.closePath(),Y.fill()}if(n.arrowLeft){const se=te+Math.PI,ae=z-oe*Math.cos(se-ce),de=ne-oe*Math.sin(se-ce),we=z-oe*Math.cos(se+ce),Fe=ne-oe*Math.sin(se+ce);Y.beginPath(),Y.moveTo(z,ne),Y.lineTo(ae,de),Y.lineTo(we,Fe),Y.closePath(),Y.fill()}if(c){const se=n.p1.rawTime??n.p1.time,ae=n.p2.rawTime??n.p2.time,de=n.p1.price,we=n.p2.price,Fe=[];if(n.statsPriceRange){const Be=Math.abs(we-de),Te=de!==0?Math.abs((we-de)/de*100):0,Ce=Be<1e-4?6:Be<.01?5:Be<1?4:2;Fe.push("↕ "+Be.toFixed(Ce)+" ("+Te.toFixed(2)+"%)")}const Ue=[];if(n.statsBarsRange)try{const Be=u.timeScale().timeToCoordinate(se),Te=u.timeScale().timeToCoordinate(ae);if(Be!=null&&Te!=null){const Ce=u.timeScale().coordinateToLogical(Be),xe=u.timeScale().coordinateToLogical(Te);Ce!=null&&xe!=null&&Ue.push("↔ "+Math.abs(Math.round(xe-Ce))+" bars")}}catch{}if(n.statsDateRange){const Be=Math.abs(ae-se),Te=Math.floor(Be/86400),Ce=Math.floor(Be%86400/3600),xe=Math.floor(Be%3600/60);let Le=Te>0?Te+" day"+(Te!==1?"s":""):"";Ce>0&&(Le+=(Le?" ":"")+Ce+" hour"+(Ce!==1?"s":"")),!Te&&!Ce&&(Le=xe+" min"+(xe!==1?"s":"")),n.statsBarsRange&&Ue.length>0?Ue[Ue.length-1]+=" ("+Le+")":Ue.push(Le)}if(n.statsDistance){const Be=(R-E)/B,Te=(M-k)/v;Ue.push("distance: "+Math.sqrt(Be*Be+Te*Te).toFixed(2))}if(Ue.length>0&&Fe.push(Ue.join(", ")),n.statsAngle){const Be=Ae/B,Te=re/v,Ce=Math.atan2(Te,Be)*180/Math.PI;Fe.push("∠ "+Ce.toFixed(0)+"°")}if(Fe.length>0){const Be=Math.min(B,v),Te=11*Be,Ce=Te*1.5,xe=5*Be;Y.font=Te+"px sans-serif";const Re=Fe.reduce((Pe,tt)=>Math.max(Pe,Y.measureText(tt).width),0)+xe*2,Ke=Fe.length*Ce+xe*2;let be,_e;n.statsPosition==="left"?(be=z,_e=ne):n.statsPosition==="center"?(be=(z+J)/2,_e=(ne+V)/2):(be=J,_e=V);const ye=be-Re/2,pe=_e-Ke-12*Be;Y.fillStyle="rgba(20, 20, 30, 0.72)",Y.fillRect(ye,pe,Re,Ke),Y.strokeStyle=n.statsColor,Y.lineWidth=1*Be,Y.strokeRect(ye,pe,Re,Ke),Y.fillStyle=n.statsColor,Y.textBaseline="top",Y.textAlign="left",Fe.forEach((Pe,tt)=>{Y.fillText(Pe,ye+xe,pe+xe+tt*Ce)})}}Y.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={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=s.timeScale().timeToCoordinate(A.center.rawTime),g=o.priceToCoordinate(A.center.price);if(u==null||g==null)return;const B=Math.round(u*l),v=Math.round(g*c),T=n.bitmapSize.width,y=n.bitmapSize.height,S=n.context;if(S.save(),S.strokeStyle=A.color,S.lineWidth=A.lineWidth*c,S.setLineDash([]),S.beginPath(),S.moveTo(0,v),S.lineTo(T,v),S.stroke(),S.beginPath(),S.moveTo(B,0),S.lineTo(B,y),S.stroke(),A.showPrice){const F=A.center.price.toFixed(5),E=Math.round(11*c);S.font=E+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="left";const k=S.measureText(F).width,R=Math.round(6*l),M=Math.round(3*c),z=E+2*M,ne=k+2*R,J=T-ne-Math.round(2*l),V=v-z/2;S.fillStyle=A.color,S.fillRect(J,V,ne,z),S.fillStyle="#ffffff",S.fillText(F,J+R,v)}if(A.showTime){const F=A.center.rawTime,E=new Date(F*1e3),k=Y=>String(Y).padStart(2,"0"),R=k(E.getUTCDate())+"."+k(E.getUTCMonth()+1)+"."+E.getUTCFullYear()+" "+k(E.getUTCHours())+":"+k(E.getUTCMinutes())+":"+k(E.getUTCSeconds()),M=Math.round(11*c);S.font=M+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="center";const z=S.measureText(R).width,ne=Math.round(6*l),J=Math.round(3*c),V=M+2*J,Ae=z+2*ne,re=B-Ae/2,he=y-V-Math.round(4*c);S.fillStyle=A.color,S.fillRect(re,he,Ae,V),S.fillStyle="#ffffff",S.fillText(R,B,he+V/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 sT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||T==null)return;const y=g*c,S=v*u,F=B*c,E=T*u,k=y-F,R=S-E,M=F-y,z=E-S;if(Math.hypot(k,R)<1e-4)return;const J=Math.atan2(R,k),V=Math.round(Math.abs(J*180/Math.PI)),Ae=s.context;Ae.save(),Ae.strokeStyle=r.color,Ae.fillStyle=r.color,Ae.lineWidth=r.lineWidth*u,Ae.setLineDash([]);const re=Math.abs(M)<1e-4?0:z/M;if(r.rayLeft){const we=S+re*(0-y);Ae.beginPath(),Ae.moveTo(0,we),Ae.lineTo(y,S),Ae.stroke()}if(r.rayRight){const de=s.bitmapSize.width,we=E+re*(de-F);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(de,we),Ae.stroke()}Ae.beginPath(),Ae.moveTo(y,S),Ae.lineTo(F,E),Ae.stroke();const he=Math.atan2(z,M),Y=(r.lineWidth*4+4)*u,te=Math.PI/7;if(r.arrowRight){const de=F-Y*Math.cos(he-te),we=E-Y*Math.sin(he-te),Fe=F-Y*Math.cos(he+te),Ue=E-Y*Math.sin(he+te);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(de,we),Ae.lineTo(Fe,Ue),Ae.closePath(),Ae.fill()}if(r.arrowLeft){const de=he+Math.PI,we=y-Y*Math.cos(de-te),Fe=S-Y*Math.sin(de-te),Ue=y-Y*Math.cos(de+te),Be=S-Y*Math.sin(de+te);Ae.beginPath(),Ae.moveTo(y,S),Ae.lineTo(we,Fe),Ae.lineTo(Ue,Be),Ae.closePath(),Ae.fill()}const oe=28*u;Ae.strokeStyle="rgba(122,166,174,0.55)",Ae.fillStyle=r.color,Ae.lineWidth=1*u,Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(F+oe,E),Ae.stroke(),Ae.beginPath(),Ae.strokeStyle="rgba(122,166,174,0.45)",Ae.arc(F,E,oe,0,J,J<0),Ae.stroke(),Ae.fillStyle="#4b7c86",Ae.font=`${Math.round(10*u)}px sans-serif`,Ae.textAlign="left",Ae.textBaseline="middle";const ce=F+(oe+10*u)*Math.cos(J/2),se=E+(oe+10*u)*Math.sin(J/2);if(Ae.fillText(`${V}°`,ce,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const de=r.p1.price,we=r.p2.price,Fe=[];if(r.statsPriceRange){const Be=Math.abs(we-de),Te=de!==0?Math.abs((we-de)/de*100):0,Ce=Be<1e-4?6:Be<.01?5:Be<1?4:2;Fe.push("↕ "+Be.toFixed(Ce)+" ("+Te.toFixed(2)+"%)")}const Ue=[];if(r.statsDistance){const Be=M/c,Te=z/u;Ue.push("distance: "+Math.sqrt(Be*Be+Te*Te).toFixed(2))}if(Ue.length>0&&Fe.push(Ue.join(", ")),Fe.length>0){const Be=Math.min(c,u),Te=11*Be,Ce=Te*1.5,xe=5*Be;Ae.font=Te+"px sans-serif";const Re=Fe.reduce((ut,dA)=>Math.max(ut,Ae.measureText(dA).width),0)+xe*2,Ke=Fe.length*Ce+xe*2,[be,_e,ye,pe]=y<=F?[y,S,F,E]:[F,E,y,S];let Pe,tt;r.statsPosition==="left"?(Pe=be,tt=_e):r.statsPosition==="center"?(Pe=(be+ye)/2,tt=(_e+pe)/2):(Pe=ye,tt=pe);const rt=Pe-Re/2,nt=tt-Ke-12*Be;Ae.fillStyle="rgba(20, 20, 30, 0.72)",Ae.fillRect(rt,nt,Re,Ke),Ae.strokeStyle=r.statsColor,Ae.lineWidth=1*Be,Ae.strokeRect(rt,nt,Re,Ke),Ae.fillStyle=r.statsColor,Ae.textBaseline="top",Ae.textAlign="left",Fe.forEach((ut,dA)=>{Ae.fillText(ut,rt+xe,nt+xe+dA*Ce)})}}Ae.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class oT{constructor(e,t,A){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=s.context,B=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),y=l.priceToCoordinate(r.p2.price),S=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(B==null||v==null||T==null||y==null||S==null||F==null)return;const E=B*c,k=v*u,R=T*c,M=y*u,z=S*c,ne=F*u,J=(R+z)/2,V=(M+ne)/2;let Ae=J-E,re=V-k;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,Y=s.bitmapSize.width,te=(R-z)/2,oe=(M-ne)/2,ce=Be=>({x:J+te*Be,y:V+oe*Be}),se=(Be,Te)=>({x:Y,y:Te+he*(Y-Be)}),ae=ce(1),de=ce(-1),we=se(ae.x,ae.y),Fe=se(de.x,de.y);g.save(),g.beginPath(),g.moveTo(ae.x,ae.y),g.lineTo(we.x,we.y),g.lineTo(Fe.x,Fe.y),g.lineTo(de.x,de.y),g.closePath(),g.fillStyle="rgba(148, 163, 184, 0.2)",g.fill(),g.beginPath(),g.strokeStyle="rgba(148, 163, 184, 0.9)",g.lineWidth=1*u,g.moveTo(R,M),g.lineTo(z,ne),g.stroke(),r._levels.forEach(Be=>{const Te=ce(Be.k),Ce=se(Te.x,Te.y);g.beginPath(),g.strokeStyle=Be.color,g.lineWidth=Be.width*u,g.moveTo(Te.x,Te.y),g.lineTo(Ce.x,Ce.y),g.stroke()});const Ue=se(E,k);g.beginPath(),g.strokeStyle="rgba(161, 98, 7, 0.9)",g.lineWidth=1.1*u,g.moveTo(E,k),g.lineTo(Ue.x,Ue.y),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class aT{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,g=s.timeScale().timeToCoordinate(A.p1.rawTime),B=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),T=o.priceToCoordinate(A.p2.price);if(g==null||B==null||v==null||T==null)return;const y=g*l,S=B*c,F=v*l,E=T*c,k=n.bitmapSize.width,R=Math.abs(F-y)<1e-4?1:F-y,M=(E-S)/R,z=F>=y?1:-1,ne=z>0?k:0,J=y+z*Math.min(220*l,Math.max(80*l,k*.35)),V=A._rays.map(re=>{const he=M*re.ratio;return{...re,yEnd:S+he*(ne-y),yLabel:S+he*(J-y)}});u.save();const Ae=(re,he,Y)=>{!re||!he||(u.beginPath(),u.moveTo(y,S),u.lineTo(ne,re.yEnd),u.lineTo(ne,he.yEnd),u.closePath(),u.fillStyle=Y,u.fill())};Ae(V[0],V[3],"rgba(161, 98, 7, 0.10)"),Ae(V[3],V[4],"rgba(5, 150, 105, 0.10)"),Ae(V[4],V[5],"rgba(107, 114, 128, 0.12)"),V.forEach(re=>{u.beginPath(),u.strokeStyle=re.color,u.lineWidth=1*c,u.moveTo(y,S),u.lineTo(ne,re.yEnd),u.stroke()}),u.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,u.textAlign=z>0?"left":"right",u.textBaseline="middle",V.forEach(re=>{u.fillStyle=re.color;const he=J+(z>0?4*l:-4*l),Y=re.yLabel;Y<-20||Y>n.bitmapSize.height+20||u.fillText(re.label,he,Y)}),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 lT{constructor(e,t,A=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,A),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=s.context,B=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),y=l.priceToCoordinate(r.p2.price);if(B==null||v==null||T==null||y==null)return;const S=B*c,F=v*u,E=T*c,k=y*u,R=E-S,M=k-F,z=Math.hypot(R,M);if(z<1e-4)return;const ne=R/z,J=M/z,V=-J,Ae=ne,re=E+V*z,he=k+Ae*z,Y=S+V*z,te=F+Ae*z,oe=(se,ae)=>({x:S+ne*z*se+V*z*ae,y:F+J*z*se+Ae*z*ae});g.save();const ce=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let se=0;se<r.divisions;se++){const ae=se/r.divisions,de=(se+1)/r.divisions,we=oe(0,ae),Fe=oe(1,ae),Ue=oe(1,de),Be=oe(0,de);g.beginPath(),g.moveTo(we.x,we.y),g.lineTo(Fe.x,Fe.y),g.lineTo(Ue.x,Ue.y),g.lineTo(Be.x,Be.y),g.closePath(),g.fillStyle=ce[se%ce.length],g.fill()}g.lineWidth=1*u,g.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const ae=se/r.divisions,de=oe(0,ae),we=oe(1,ae),Fe=oe(ae,0),Ue=oe(ae,1);g.beginPath(),g.moveTo(de.x,de.y),g.lineTo(we.x,we.y),g.stroke(),g.beginPath(),g.moveTo(Fe.x,Fe.y),g.lineTo(Ue.x,Ue.y),g.stroke()}g.strokeStyle="rgba(100, 116, 139, 0.85)",g.lineWidth=1*u,g.beginPath(),g.moveTo(S,F),g.lineTo(re,he),g.stroke(),g.beginPath(),g.moveTo(E,k),g.lineTo(Y,te),g.stroke(),g.strokeStyle="rgba(122, 166, 174, 0.95)",g.lineWidth=1.2*u,g.beginPath(),g.moveTo(S,F),g.lineTo(E,k),g.lineTo(re,he),g.lineTo(Y,te),g.closePath(),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tl{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:g=!0,pricesColor:B="#129f5c",rayLeft:v=!1,rayRight:T=!1,arrowLeft:y=!1,arrowRight:S=!1}=n;this.p1=e,this.p2=t,this.p3=A,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=u,this.showPrices=g,this.pricesColor=B,this.rayLeft=v,this.rayRight=T,this.arrowLeft=y,this.arrowRight=S,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(E){E.useBitmapCoordinateSpace(k=>{if(!F.visible)return;const R=F._chart,M=F._series;if(!R||!M)return;const z=k.horizontalPixelRatio,ne=k.verticalPixelRatio,J=[F.p1,F.p3,F.p4,F.p2].map(Ke=>{const be=R.timeScale().timeToCoordinate(Ke.rawTime),_e=M.priceToCoordinate(Ke.price);return be==null||_e==null?null:{x:be*z,y:_e*ne}}).filter(Boolean);if(J.length!==4)return;const[V,Ae,re,he]=J,Y=k.context;Y.save();const te=Ae.x-V.x,oe=Ae.y-V.y,ce=Math.sqrt(te*te+oe*oe)||1,se=te/ce,ae=oe/ce,de=re.x-he.x,we=re.y-he.y,Fe=Math.sqrt(de*de+we*we)||1,Ue=de/Fe,Be=we/Fe,Te=1e5,Ce=F.rayLeft?{x:V.x-se*Te,y:V.y-ae*Te}:V,xe=F.rayRight?{x:Ae.x+se*Te,y:Ae.y+ae*Te}:Ae,Le=F.rayLeft?{x:he.x-Ue*Te,y:he.y-Be*Te}:he,Re=F.rayRight?{x:re.x+Ue*Te,y:re.y+Be*Te}:re;if(F.showBackground){const Ke=F.fillColor||"#6aa84f",be=parseInt(Ke.slice(1,3),16),_e=parseInt(Ke.slice(3,5),16),ye=parseInt(Ke.slice(5,7),16);Y.beginPath(),Y.moveTo(V.x,V.y),Y.lineTo(Ae.x,Ae.y),Y.lineTo(re.x,re.y),Y.lineTo(he.x,he.y),Y.closePath(),Y.fillStyle=`rgba(${be},${_e},${ye},${F.fillOpacity??.1})`,Y.fill()}if(Y.strokeStyle=F.lineColor,Y.lineWidth=F.lineWidth*ne,Y.setLineDash([]),Y.beginPath(),Y.moveTo(Ce.x,Ce.y),Y.lineTo(xe.x,xe.y),Y.moveTo(Le.x,Le.y),Y.lineTo(Re.x,Re.y),Y.moveTo(V.x,V.y),Y.lineTo(he.x,he.y),Y.moveTo(Ae.x,Ae.y),Y.lineTo(re.x,re.y),Y.stroke(),F.arrowLeft||F.arrowRight){const Ke=8*ne,be=(_e,ye,pe)=>{Y.save(),Y.translate(_e,ye),Y.rotate(pe),Y.beginPath(),Y.moveTo(0,0),Y.lineTo(-Ke,-Ke/2),Y.lineTo(-Ke,Ke/2),Y.closePath(),Y.fillStyle=F.lineColor,Y.fill(),Y.restore()};F.arrowLeft&&(be(Ce.x,Ce.y,Math.atan2(-ae,-se)),be(Le.x,Le.y,Math.atan2(-Be,-Ue))),F.arrowRight&&(be(xe.x,xe.y,Math.atan2(ae,se)),be(Re.x,Re.y,Math.atan2(Be,Ue)))}if(Y.fillStyle="#ffffff",Y.strokeStyle="#3b82f6",Y.lineWidth=2*ne,[V,Ae,re,he].forEach(Ke=>{Y.beginPath(),Y.arc(Ke.x,Ke.y,6*ne,0,Math.PI*2),Y.fill(),Y.stroke()}),F.showPrices){const Ke=[F.p1,F.p3,F.p2,F.p4],be=[V,Ae,he,re];Y.fillStyle=F.pricesColor||F.lineColor,Y.font=`${Math.round(10*ne)}px sans-serif`,Y.textAlign="left",Y.textBaseline="middle",be.forEach((_e,ye)=>{const pe=Ke[ye]?.price;typeof pe=="number"&&Y.fillText(pe.toFixed(5),_e.x+8*z,_e.y)})}Y.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ad extends tl{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class id{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const u=o._chart,g=o._series;if(!u||!g)return;const B=c.horizontalPixelRatio,v=c.verticalPixelRatio,T=c.context,y=R=>{const M=u.timeScale().timeToCoordinate(R.rawTime),z=g.priceToCoordinate(R.price);return M==null||z==null?null:{x:M*B,y:z*v}},S=y(o.p1),F=y(o.p2),E=y(o.b2),k=y(o.b1);!S||!F||!E||!k||(T.save(),T.beginPath(),T.moveTo(S.x,S.y),T.lineTo(F.x,F.y),T.lineTo(E.x,E.y),T.lineTo(k.x,k.y),T.closePath(),T.fillStyle=o.fillColor,T.fill(),T.strokeStyle=o.strokeColor,T.lineWidth=o.lineWidth*v,T.setLineDash([]),T.beginPath(),T.moveTo(S.x,S.y),T.lineTo(F.x,F.y),T.stroke(),T.beginPath(),T.moveTo(k.x,k.y),T.lineTo(E.x,E.y),T.stroke(),T.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Al{constructor(e,t,A,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=r,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(u=>{if(!l.visible)return;const g=l._chart,B=l._series;if(!g||!B)return;const v=u.horizontalPixelRatio,T=u.verticalPixelRatio,y=u.context,S=J=>{const V=g.timeScale().timeToCoordinate(J.rawTime),Ae=B.priceToCoordinate(J.price);return V==null||Ae==null?null:{x:V*v,y:Ae*T}},F=S(l.mid1),E=S(l.mid2),k=S(l.top1),R=S(l.top2),M=S(l.bot1),z=S(l.bot2);if(!F||!E||!k||!R||!M||!z)return;y.save(),y.beginPath(),y.moveTo(F.x,F.y),y.lineTo(E.x,E.y),y.lineTo(R.x,R.y),y.lineTo(k.x,k.y),y.closePath(),y.fillStyle=l.upperFillColor,y.fill(),y.beginPath(),y.moveTo(M.x,M.y),y.lineTo(z.x,z.y),y.lineTo(E.x,E.y),y.lineTo(F.x,F.y),y.closePath(),y.fillStyle=l.lowerFillColor,y.fill();const ne=(J,V,Ae)=>{y.beginPath(),y.strokeStyle=Ae,y.lineWidth=l.lineWidth*T,y.setLineDash([]),y.moveTo(J.x,J.y),y.lineTo(V.x,V.y),y.stroke()};if(ne(k,R,l.upperStrokeColor),ne(F,E,l.centerStrokeColor),ne(M,z,l.lowerStrokeColor),l.showDeviationLabel){const J=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite(J)?J.toFixed(5):null;if(V){const Ae=Math.max(10,Math.round(10*T));y.fillStyle=l.labelColor,y.font=`${Ae}px sans-serif`,y.textAlign="left",y.textBaseline="top",y.fillText(V,M.x+2*v,M.y+10*T)}}y.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class rd extends Al{}class nd{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,g=n.bitmapSize.width;n.bitmapSize.height;const B=A.p1.price,v=A.p2.price,T=B-v,y=J=>v+T*J,S=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(B),k=o.priceToCoordinate(v),R=S!=null&&F!=null?Math.round(Math.min(S,F)*l):0,M=S!=null&&F!=null?Math.round(Math.max(S,F)*l):g,z=M-R;u.save(),A._zoneFills.forEach(({from:J,to:V,color:Ae})=>{const re=y(J),he=y(V),Y=o.priceToCoordinate(re),te=o.priceToCoordinate(he);if(Y==null||te==null)return;const oe=Math.round(Y*c),ce=Math.round(te*c);u.fillStyle=Ae,u.fillRect(R,Math.min(oe,ce),z,Math.abs(ce-oe))}),A._levels.forEach(({ratio:J,label:V})=>{const Ae=y(J),re=o.priceToCoordinate(Ae);if(re==null)return;const he=Math.round(re*c),Y=A._levelColors[J]||"#888888";u.beginPath(),u.strokeStyle=Y,u.lineWidth=J===0||J===1?1.5*c:1*c,J!==0&&J!==1&&J<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(R,he),u.lineTo(M,he),u.stroke(),u.setLineDash([])});const ne=Math.round(11*c);if(u.font=`${ne}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:J,label:V})=>{const Ae=y(J),re=o.priceToCoordinate(Ae);if(re==null)return;const he=Math.round(re*c),Y=A._levelColors[J]||"#888888",te=`${V} (${Ae.toFixed(5)})`;u.fillStyle=Y,u.textAlign="right",u.fillText(te,R-4*l,he-4*c)}),S!=null&&F!=null&&E!=null&&k!=null){const J=Math.round(S*l),V=Math.round(E*c),Ae=Math.round(F*l),re=Math.round(k*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo(J,V),u.lineTo(Ae,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(J,V,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(Ae,re,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke()}u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cT{constructor(e,t="#3b82f6",A=2,r=!0){this.time=e,this.color=t,this.lineWidth=A,this.showDate=r,this.showDot=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const u=Math.round(c*o.horizontalPixelRatio),g=o.bitmapSize.height,B=o.context;B.save(),B.beginPath(),B.strokeStyle=n.color,B.lineWidth=n.lineWidth*o.horizontalPixelRatio,B.setLineDash([]),B.moveTo(u,0),B.lineTo(u,g),B.stroke();const v=Math.round(g/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){B.beginPath(),B.strokeStyle=n.color,B.lineWidth=1.5*o.horizontalPixelRatio;const T=5*o.horizontalPixelRatio;B.arc(u,v,T,0,Math.PI*2),B.stroke()}if(n.showDate!==!1){const T=n.time,y=new Date(typeof T=="number"?T*1e3:T),S=Ae=>String(Ae).padStart(2,"0"),F=`${S(y.getUTCDate())}.${S(y.getUTCMonth()+1)}.${y.getUTCFullYear()} ${S(y.getUTCHours())}:${S(y.getUTCMinutes())}:${S(y.getUTCSeconds())}`,E=Math.round(11*o.verticalPixelRatio);B.font=`${E}px ui-sans-serif, system-ui, sans-serif`,B.textBaseline="middle",B.textAlign="center";const k=B.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),z=E+2*M,ne=k+2*R,J=u-ne/2,V=g-z-Math.round(4*o.verticalPixelRatio);B.fillStyle=n.color,B.fillRect(J,V,ne,z),B.fillStyle="#ffffff",B.fillText(F,u,V+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 sd(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 hT(i,e,t){const A=`${i??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let u=c;for(;u.length>s;){let g=u.lastIndexOf(" ",s);g<=0&&(g=s),o.push(u.slice(0,g)),u=u.slice(g).trimStart()}o.push(u)};return A.split(`
11
- `).forEach(l),o.length===0&&o.push(""),o}function od(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=hT(A.text??i?.text??"Text",r,n),o=s.reduce((T,y)=>Math.max(T,y.length),1),c=Math.max(20,o*r*.58)+16,u=r*1.2,g=s.length*u+10,B=e-c/2,v=t-g;return{left:B,right:B+c,top:v,bottom:v+g+12}}class uT{constructor(e,t,A={}){this.rawTime=e,this.price=t,this.text=A.text??"Text",this.color=A.color??"#5f8f96",this.fontSize=A.fontSize??12,this.fontWeight=A.fontWeight??"normal",this.fontStyle=A.fontStyle??"normal",this.textAlign=A.textAlign??"center",this.textWrap=A.textWrap??!1,this.borderEnabled=A.borderEnabled??!1,this.borderColor=A.borderColor??"#5f8f96",this.borderOpacity=A.borderOpacity??.1,this.borderWidth=A.borderWidth??1,this.bgEnabled=A.bgEnabled??!1,this.bgColor=A.bgColor??"#5f8f96",this.bgOpacity=A.bgOpacity??.1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=o.timeScale().timeToCoordinate(r.rawTime),u=l.priceToCoordinate(r.price);if(c==null||u==null)return;const g=s.horizontalPixelRatio,B=s.verticalPixelRatio,v=Math.round(c*g),T=Math.round(u*B),y=s.context;y.save();const S=Math.round(r.fontSize*B);y.font=`${r.fontStyle} ${r.fontWeight} ${S}px sans-serif`;const F=`${r.text??""}`,E=220*g,k=[],R=ae=>{if(!r.textWrap||ae.length===0){k.push(ae);return}const de=ae.split(/\s+/);let we="";for(const Fe of de){const Ue=we?`${we} ${Fe}`:Fe;y.measureText(Ue).width<=E||!we?we=Ue:(k.push(we),we=Fe)}k.push(we)};F.split(`
12
- `).forEach(R),k.length===0&&k.push("");const M=k.map(ae=>y.measureText(ae).width),z=Math.max(...M,20*g),ne=8*g,J=5*B,V=z+ne*2,Ae=S*1.2,re=Ae*k.length+J*2,he=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Y=v-V/2,te=T-re;r.bgEnabled&&(y.fillStyle=sd(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),y.beginPath(),y.rect(Y,te,V,re),y.fill()),r.borderEnabled&&(y.strokeStyle=sd(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),y.lineWidth=Math.max(.5,(r.borderWidth??1)*B),y.beginPath(),y.rect(Y,te,V,re),y.stroke()),y.fillStyle=r.color,y.textAlign=he,y.textBaseline="middle";const oe=he==="left"?Y+ne:he==="right"?Y+V-ne:Y+V/2;for(let ae=0;ae<k.length;ae++)y.fillText(k[ae],oe,te+J+Ae*(ae+.5));const ce=5*B,se=T+10*B;y.beginPath(),y.strokeStyle="#3b82f6",y.lineWidth=1.5*B,y.arc(v,se,ce,0,Math.PI*2),y.stroke(),y.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 ad(i){if(!i)return 7;const e=String(i).toUpperCase();return pT[e]??7}function dT(i,e){const t=String(i||"").toUpperCase(),A=e||ad(i),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(A*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const zA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:j(A.time)})).filter(A=>A.time!=null);e.sort((A,r)=>A.time-r.time);const t=new Map;for(const A of e)t.set(A.time,A);return Array.from(t.values()).sort((A,r)=>A.time-r.time)};function ht(i,e,t,A,r,n){const s=r-t,o=n-A,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/(l*l);c=Math.max(0,Math.min(1,c));const u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function fT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/l;c<0&&(c=0);const u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function 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,g=A+c*o;return Math.hypot(i-u,e-g)}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 ld(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??j(i.rawTime),r=e.normalizedTime??j(e.rawTime),n=t.normalizedTime??j(t.rawTime);if(A==null||r==null||n==null)return null;const s=r-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-i.price)/s,l=t.price+o*(A-n),c=t.price+o*(r-n),u=j((A+r)/2),g=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:g}}}function ir(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??j(e.rawTime),n=t.normalizedTime??j(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map(J=>({time:j(J.time),close:typeof J.close=="number"?J.close:parseFloat(J.close)})).filter(J=>J.time!=null&&Number.isFinite(J.close)&&J.time>=s&&J.time<=o).sort((J,V)=>J.time-V.time);if(l.length<2)return null;const c=l.length;let u=0,g=0,B=0,v=0;for(let J=0;J<c;J++){const V=J,Ae=l[J].close;u+=V,g+=Ae,B+=V*Ae,v+=V*V}const T=c*v-u*u,y=Math.abs(T)<1e-12?0:(c*B-u*g)/T,S=(g-y*u)/c;let F=0;for(let J=0;J<c;J++){const V=S+y*J,Ae=l[J].close-V;F+=Ae*Ae}const E=Math.sqrt(F/c),k=Math.max(E*A,1e-8),R=l[0].time,M=l[c-1].time,z=S,ne=S+y*(c-1);return{slope:y,intercept:S,stdDev:E,offset:k,barCount:c,p1:{rawTime:R,normalizedTime:R,price:z},p2:{rawTime:M,normalizedTime:M,price:ne},top1:{rawTime:R,normalizedTime:R,price:z+k},top2:{rawTime:M,normalizedTime:M,price:ne+k},bot1:{rawTime:R,normalizedTime:R,price:z-k},bot2:{rawTime:M,normalizedTime:M,price:ne-k}}}function Xr(i,e,t,A=1){return ir(i,e,t,A)}const gT={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}},wT={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 BT(i,e){if(!i||!i.type)return!1;const t=gT[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function yT(i){return i?wT[i]??"#22c55e":"#22c55e"}const CT=300,cd=24,vT=150,hd=150;function il(i,e,t=CT){if(!Array.isArray(i)||i.length===0)return[];const A=hA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=j(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function TT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=j(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function bT(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=j(e),n=j(t),s=hA(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=bT(i,B);if(v<=0)return 0;if(v>=i.length)return i.length-1;const T=i[v-1],y=i[v];return Math.abs(B-T)<=Math.abs(y-B)?v-1:v},u=c(r),g=c(n);return Math.max(1,Math.abs(g-u)+1)}function ud(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=TT(e);if(r==null)return!1;const n=A.timeToCoordinate(r);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const u=A.getVisibleLogicalRange(),g=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,B=Number.isFinite(g)&&g>20?g:120,v=Math.min(hd,B/2),T=Math.max(20,B-v),y={from:c-T,to:c+v};try{return A.setVisibleLogicalRange(y),!0}catch{}}}const s=hA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-vT*o,to:r+hd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}function rl(i,e){if(i.length<e)return[];const t=2/(e+1);let A=i.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:i[e-1].time,value:A}];for(let n=e;n<i.length;n++)A=i[n].close*t+A*(1-t),r.push({time:i[n].time,value:A});return r}function Os(i,e){if(i.length<e)return null;const t=i[i.length-1],A=i.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:A}}function pd(i,e){const t=rl(i,e);return t.length?t[t.length-1]:null}function dd(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 fd(i,e=12,t=26,A=9){if(i.length<t+A)return null;const r=rl(i,e),n=rl(i,t);if(!r.length||!n.length)return null;const s=n.map((u,g)=>{const B=r[r.length-n.length+g];return{time:u.time,value:B.value-u.value}});if(s.length<A)return null;const o=2/(A+1);let l=s.slice(0,A).reduce((u,g)=>u+g.value,0)/A;for(let u=A;u<s.length;u++)l=s[u].value*o+l*(1-o);const c=s[s.length-1];return{time:c.time,value:c.value,signal:l,histogram:c.value-l}}const xT=q.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=q.useRef(null),l=q.useRef(null),c=q.useRef(null),u=q.useRef(null),g=q.useRef(null),B=q.useRef(null),v=q.useRef([]),T=q.useRef(!1),y=q.useRef(null),S=q.useRef(null),F=q.useRef(null),E=q.useRef(null),k=q.useRef([]),[R,M]=q.useState(null),[z,ne]=q.useState(null),[J,V]=q.useState([]),[Ae,re]=q.useState(null),[he,Y]=q.useState([]),te=q.useRef(null),oe=q.useRef(null),ce=q.useRef(null),se=q.useRef(!1),ae=q.useRef(!1);q.useEffect(()=>{ce.current=R;let d=!1;v.current.forEach(f=>{if(f.type==="trendline"&&f.decoration){const O=f===R;f.decoration.isSelected!==O&&(f.decoration.isSelected=O,d=!0)}}),d&&c.current?.applyOptions({})},[R]);const de=q.useRef(new Map),we=q.useRef(null),Fe=q.useRef(null),Ue=(d,f)=>`${d}_${f}`,Be=()=>{const d=Ue(ye,pe);return de.current.get(d)||null},Te=d=>{if(!d)return;const f=Ue(ye,pe);de.current.set(f,d)},{activeTool:Ce,setActiveTool:xe,showGrid:Le,snapToGrid:Re,chartObjects:Ke,setChartObjects:be,orders:_e,selectedSymbol:ye,selectedTimeframe:pe,drawingsVisible:Pe,chartType:tt,chartLocked:rt,theme:nt,candleColors:ut,showTradeOrders:dA,showTradePosition:Je,showTradeHistory:Oe,showSLTP:at,showAskPrice:it,showChartControls:Ct,showCrosshair:bt,showOHLC:GA,currentSymbolData:$A,baseUrl:Gt,endpoints:fA,endpointParams:XA,indicators:Kt,indicatorSettings:Ft}=zt(),mA=q.useRef({}),[st,mt]=q.useState({}),Ut=q.useRef(0),It=q.useRef(Kt),$e=q.useRef(Ft);It.current=Kt,$e.current=Ft;const He=q.useRef([]),[At,Xe]=q.useState(!1),[Me,ze]=q.useState(null),[ve,qe]=q.useState([]),[Ne,Ze]=q.useState(!0),[ft,St]=q.useState(null),[LA,Ai]=q.useState(0),Ks=q.useMemo(()=>{const d=ve.map(f=>j(f?.time)).filter(f=>Number.isFinite(f));return d.sort((f,O)=>f-O),d},[ve]),Vs=q.useRef(null),gi=q.useRef(new Map);q.useRef(null);const vd=q.useRef(0),MA=q.useRef(null),rr=q.useRef(!1),jr=q.useRef(!1);q.useEffect(()=>{const d=g.current;d&&d.setData(il(ve,pe))},[ve,pe]),q.useImperativeHandle(s,()=>({zoomIn:()=>{const d=c.current?.timeScale();if(!d)return;const f=d.getVisibleRange();if(!f||!f.from||!f.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*.8;try{d.setVisibleRange({from:me-H/2,to:me+H/2}),Te(d.getVisibleRange())}catch{}},zoomOut:()=>{const d=c.current?.timeScale();if(!d)return;const f=d.getVisibleRange();if(!f||!f.from||!f.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*1.25;try{d.setVisibleRange({from:me-H/2,to:me+H/2}),Te(d.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const d=o.current;if(!d){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const f=d.querySelectorAll("canvas"),O=nt==="light"?"#ffffff":"#12161d";let me=null,H=0;if(f.forEach($=>{if($.width>0&&$.height>0){const X=$.width*$.height;X>H&&(H=X,me=$)}}),me)try{const $=document.createElement("canvas");$.width=me.width,$.height=me.height;const X=$.getContext("2d");X.fillStyle=O,X.fillRect(0,0,$.width,$.height),X.drawImage(me,0,0);const ie=document.createElement("a");ie.download=`chart-${ye}-${pe}-${Date.now()}.png`,ie.href=$.toDataURL("image/png"),ie.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch($){console.warn("Canvas export failed, trying html2canvas",$)}Gv(d,{useCORS:!0,allowTaint:!0,backgroundColor:O,scale:2,logging:!1}).then($=>{const X=document.createElement("a");X.download=`chart-${ye}-${pe}-${Date.now()}.png`,X.href=$.toDataURL("image/png"),X.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch($=>{console.error("Chart screenshot failed",$),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,pe,nt]);const ol=q.useMemo(()=>ve.length===0?[]:tt==="line"||tt==="area"?ve.map(d=>({time:d.time,value:d.close})):ve,[ve,tt]),XT=d=>{r?r(d):(ze("BUY"),Xe(!0))},JT=d=>{n?n(d):(ze("SELL"),Xe(!0))},ZT=()=>{Xe(!1),ze(null)},YT=d=>{const f=z;if(!f||!d)return;const O=($,X)=>{if(typeof $!="string")return X;const ie=$.trim(),le=ie.startsWith("#")?ie:`#${ie}`;return/^#[0-9A-Fa-f]{6}$/.test(le)?le.toLowerCase():X},me=($,X)=>{const ie=Number($);return Number.isFinite(ie)?Math.max(0,Math.min(1,ie)):X};let H={...f,visibleTimeframes:Array.isArray(d.visibleTimeframes)?[...d.visibleTimeframes]:f.visibleTimeframes};if(f.type==="text"){const $=Number.isFinite(Number(d.price))?Number(d.price):f.price,X=f.primitive;X&&(X.text=typeof d.text=="string"?d.text:X.text,X.color=O(d.color,X.color??"#5f8f96"),X.fontSize=Number.isFinite(Number(d.fontSize))?Number(d.fontSize):X.fontSize,X.fontWeight=d.fontWeight==="bold"?"bold":"normal",X.fontStyle=d.fontStyle==="italic"?"italic":"normal",X.textAlign=["left","center","right"].includes(d.textAlign)?d.textAlign:X.textAlign,X.textWrap=!!d.textWrap,X.borderEnabled=!!d.borderEnabled,X.borderColor=O(d.borderColor,X.borderColor??"#5f8f96"),X.borderOpacity=me(d.borderOpacity,X.borderOpacity??.1),X.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(d.borderWidth))?Number(d.borderWidth):1)),X.bgEnabled=!!d.bgEnabled,X.bgColor=O(d.bgColor,X.bgColor??"#5f8f96"),X.bgOpacity=me(d.bgOpacity,X.bgOpacity??.1),X.price=$),H={...H,price:$,text:typeof d.text=="string"?d.text:f.text}}if(f.type==="trendline"){const $=O(d.lineColor,"#22c55e"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2));if(f.series)try{f.series.applyOptions({color:$,lineWidth:X})}catch{}const ie=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.point1?.price,le=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.point2?.price;if(f.series&&f.point1&&f.point2){const Z=f.point1.time??f.point1.rawTime,C=f.point2.time??f.point2.rawTime;try{const h=zA([{time:Z,value:ie},{time:C,value:le}]);h.length>0&&f.series.setData(h)}catch{}}const U={...f.point1,price:ie},_={...f.point2,price:le};f.decoration&&(f.decoration.color=$,f.decoration.lineWidth=X,f.decoration.arrowLeft=!!d.arrowLeft,f.decoration.arrowRight=!!d.arrowRight,f.decoration.rayLeft=!!d.rayLeft,f.decoration.rayRight=!!d.rayRight,f.decoration.statsColor=O(d.statsColor,"#5f8f96"),f.decoration.statsPosition=d.statsPosition??"right",f.decoration.statsShowAlways=!!d.statsShowAlways,f.decoration.statsPriceRange=!!d.statsPriceRange,f.decoration.statsBarsRange=!!d.statsBarsRange,f.decoration.statsDateRange=!!d.statsDateRange,f.decoration.statsAngle=!!d.statsAngle,f.decoration.statsDistance=!!d.statsDistance,f.decoration.p1=U,f.decoration.p2=_),H={...H,lineColor:$,lineWidth:X,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:U,point2:_,decoration:f.decoration}}if(f.type==="pricelevel"){const $=O(d.lineColor,"#3b82f6"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=d.showPrice!==!1,le=!!d.showText,U=typeof d.textContent=="string"?d.textContent:"",_=O(d.textColor,"#ffffff"),Z=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",h=Number.isFinite(Number(d.price))?Number(d.price):f.price;if(f.priceLine)try{f.priceLine.applyOptions({price:h,color:$,lineWidth:X,axisLabelVisible:ie,title:ie&&typeof h=="number"?h.toFixed(5):""})}catch{}const x=u.current;if(le&&U&&x)if(f.textPrimitive)f.textPrimitive.text=U,f.textPrimitive.textColor=_,f.textPrimitive.hAlign=Z,f.textPrimitive.vAlign=C,f.textPrimitive.price=h;else{const I=new jp(h,{text:U,textColor:_,hAlign:Z,vAlign:C});try{x.attachPrimitive(I)}catch{}f.textPrimitive=I}else if(f.textPrimitive&&x){try{x.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:$,lineWidth:X,showPrice:ie,showText:le,textContent:U,textColor:_,textHAlign:Z,textVAlign:C,textPrimitive:f.textPrimitive}}if(f.type==="horizontalray"){const $=O(d.lineColor,"#3b82f6"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=d.showPrice!==!1,le=!!d.showText,U=typeof d.textContent=="string"?d.textContent:"",_=O(d.textColor,"#ffffff"),Z=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",h=Number.isFinite(Number(d.price))?Number(d.price):f.price,x=f.primitive;if(x&&(x.price=h,x.color=$,x.lineWidth=X),f.priceLine)try{f.priceLine.applyOptions({price:h,color:$,axisLabelVisible:ie,title:ie&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(le&&U&&I)if(f.textPrimitive)f.textPrimitive.text=U,f.textPrimitive.textColor=_,f.textPrimitive.hAlign=Z,f.textPrimitive.vAlign=C,f.textPrimitive.price=h,f.textPrimitive.originTime=f.rawOriginTime;else{const w=new jp(h,{text:U,textColor:_,hAlign:Z,vAlign:C,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:$,lineWidth:X,showPrice:ie,showText:le,textContent:U,textColor:_,textHAlign:Z,textVAlign:C,textPrimitive:f.textPrimitive}}if(f.type==="verticalline"){const $=O(d.lineColor,"#3b82f6"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=d.showDate!==!1,le=f.primitive;le&&(le.color=$,le.lineWidth=X,le.showDate=ie),H={...H,lineColor:$,lineWidth:X,showDate:ie}}if(f.type==="infoline"){const $=O(d.lineColor,"#3b82f6"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=d.statsShowAlways!==!1,le=O(d.statsColor,"#5f8f96"),U=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",_=!!d.statsPriceRange,Z=!!d.statsBarsRange,C=!!d.statsDateRange,h=!!d.statsAngle,x=!!d.statsDistance,I=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.p1.price,w=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.p2.price,p=f.p1.rawTime,P=f.p2.rawTime,Q=w-I,L=I!==0?Q/Math.abs(I)*100:0,b=f.p1.normalizedTime??0,m=f.p2.normalizedTime??0,D=hA(pe)||3600,N=Math.abs(m-b),K=Math.max(1,Math.round(N/D)),W=Math.max(1,Math.round(N/86400)),G=c.current,ee=u.current,ue=G?G.timeScale().timeToCoordinate(p):null,ge=ee?ee.priceToCoordinate(I):null,Qe=G?G.timeScale().timeToCoordinate(P):null,Ee=ee?ee.priceToCoordinate(w):null,We=ue!=null&&ge!=null&&Qe!=null&&Ee!=null?Math.atan2(-(Ee-ge),Qe-ue)*(180/Math.PI):f.primitive?.info?.angle??0,je={priceDiff:Q,pricePct:L,bars:K,days:W,angle:We},Ve=f.primitive;Ve&&(Ve.color=$,Ve.lineWidth=X,Ve.statsShowAlways=ie,Ve.statsColor=le,Ve.statsPosition=U,Ve.statsPriceRange=_,Ve.statsBarsRange=Z,Ve.statsDateRange=C,Ve.statsAngle=h,Ve.statsDistance=x,Ve.p1={...f.p1,price:I},Ve.p2={...f.p2,price:w},Ve.info=je),H={...H,lineColor:$,lineWidth:X,statsShowAlways:ie,statsColor:le,statsPosition:U,statsPriceRange:_,statsBarsRange:Z,statsDateRange:C,statsAngle:h,statsDistance:x,p1:{...f.p1,price:I},p2:{...f.p2,price:w}}}if(f.type==="rulerline"){const $=O(d.lineColor,"#3b82f6"),X=d.showArea!==!1,ie=!!d.statsShowAlways,le=O(d.statsColor,"#5f8f96"),U=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",_=!!d.statsPriceRange,Z=!!d.statsBarsRange,C=!!d.statsDateRange,h=f.primitive;h&&(h.lineColor=$,h.showArea=X,h.statsShowAlways=ie,h.statsColor=le,h.statsPosition=U,h.statsPriceRange=_,h.statsBarsRange=Z,h.statsDateRange=C),H={...H,lineColor:$,showArea:X,statsShowAlways:ie,statsColor:le,statsPosition:U,statsPriceRange:_,statsBarsRange:Z,statsDateRange:C}}if(f.type==="arrowedline"){const $=O(d.lineColor,"#f59e0b"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.p1.price,le=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.p2.price,U=f.primitive;U&&(U.color=$,U.lineWidth=X,U.arrowLeft=!!d.arrowLeft,U.arrowRight=!!d.arrowRight,U.rayLeft=!!d.rayLeft,U.rayRight=!!d.rayRight,U.statsShowAlways=!!d.statsShowAlways,U.statsColor=O(d.statsColor,"#5f8f96"),U.statsPosition=d.statsPosition??"right",U.statsPriceRange=!!d.statsPriceRange,U.statsBarsRange=!!d.statsBarsRange,U.statsDateRange=!!d.statsDateRange,U.statsAngle=!!d.statsAngle,U.statsDistance=!!d.statsDistance,U.p1={...f.p1,price:ie},U.p2={...f.p2,price:le}),H={...H,lineColor:$,lineWidth:X,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:{...f.p1,price:ie},p2:{...f.p2,price:le}}}if(f.type==="rayline"){const $=O(d.lineColor,"#7aa6ae"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.p1.price,le=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.p2.price,U=f.primitive;U&&(U.color=$,U.lineWidth=X,U.arrowLeft=!!d.arrowLeft,U.arrowRight=!!d.arrowRight,U.rayLeft=!!d.rayLeft,U.rayRight=!!d.rayRight,U.statsShowAlways=!!d.statsShowAlways,U.statsColor=O(d.statsColor,"#5f8f96"),U.statsPosition=d.statsPosition??"right",U.statsPriceRange=!!d.statsPriceRange,U.statsBarsRange=!!d.statsBarsRange,U.statsDateRange=!!d.statsDateRange,U.statsAngle=!!d.statsAngle,U.statsDistance=!!d.statsDistance,U.p1={...f.p1,price:ie},U.p2={...f.p2,price:le}),H={...H,lineColor:$,lineWidth:X,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:{...f.p1,price:ie},p2:{...f.p2,price:le}}}if(f.type==="extendedline"){const $=O(d.lineColor,"#7aa6ae"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.p1.price,le=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.p2.price,U=f.primitive;U&&(U.color=$,U.lineWidth=X,U.arrowLeft=!!d.arrowLeft,U.arrowRight=!!d.arrowRight,U.rayLeft=!!d.rayLeft,U.rayRight=!!d.rayRight,U.statsShowAlways=!!d.statsShowAlways,U.statsColor=O(d.statsColor,"#5f8f96"),U.statsPosition=d.statsPosition??"right",U.statsPriceRange=!!d.statsPriceRange,U.statsBarsRange=!!d.statsBarsRange,U.statsDateRange=!!d.statsDateRange,U.statsAngle=!!d.statsAngle,U.statsDistance=!!d.statsDistance,U.p1={...f.p1,price:ie},U.p2={...f.p2,price:le}),H={...H,lineColor:$,lineWidth:X,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:{...f.p1,price:ie},p2:{...f.p2,price:le}}}if(f.type==="crossline"){const $=O(d.lineColor,"#06a0e3"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=Number.isFinite(Number(d.price))?Number(d.price):f.p.price,le=f.primitive;le&&(le.color=$,le.lineWidth=X,le.showTime=!!d.showTime,le.showPrice=!!d.showPrice,le.center={...f.p,price:ie}),H={...H,lineColor:$,lineWidth:X,showTime:!!d.showTime,showPrice:!!d.showPrice,p:{...f.p,price:ie}}}if(f.type==="trendbyangle"){const $=O(d.lineColor,"#7aa6ae"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.p1.price,le=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.p2.price,U=f.primitive;U&&(U.color=$,U.lineWidth=X,U.arrowLeft=!!d.arrowLeft,U.arrowRight=!!d.arrowRight,U.rayLeft=!!d.rayLeft,U.rayRight=!!d.rayRight,U.statsShowAlways=!!d.statsShowAlways,U.statsColor=O(d.statsColor,"#5f8f96"),U.statsPosition=d.statsPosition??"right",U.statsPriceRange=!!d.statsPriceRange,U.statsDistance=!!d.statsDistance,U.p1={...f.p1,price:ie},U.p2={...f.p2,price:le}),H={...H,lineColor:$,lineWidth:X,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:{...f.p1,price:ie},p2:{...f.p2,price:le}}}if(f.type==="disjointchannel"){const $=O(d.lineColor,"#129f5c"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=O(d.fillColor,"#6aa84f"),le=me(d.fillOpacity,.1),U=O(d.pricesColor,"#129f5c"),_=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.p1.price,Z=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=$,h.lineWidth=X,h.fillColor=ie,h.fillOpacity=le,h.showBackground=!!d.showBackground,h.showPrices=!!d.showPrices,h.pricesColor=U,h.rayLeft=!!d.rayLeft,h.rayRight=!!d.rayRight,h.arrowLeft=!!d.arrowLeft,h.arrowRight=!!d.arrowRight,h.p1={...f.p1,price:_},h.p3={...f.p3,price:Z},h.p2={...f.p2,price:C}),H={...H,lineColor:$,lineWidth:X,fillColor:ie,fillOpacity:le,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:U,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...f.p1,price:_},p3:{...f.p3,price:Z},p2:{...f.p2,price:C}}}if(f.type==="flattopbottom"){const $=O(d.lineColor,"#3b82f6"),X=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),ie=O(d.fillColor,"#3b82f6"),le=me(d.fillOpacity,.12),U=O(d.pricesColor,"#3b82f6"),_=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):f.p1.price,Z=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):f.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=$,h.lineWidth=X,h.fillColor=ie,h.fillOpacity=le,h.showBackground=!!d.showBackground,h.showPrices=!!d.showPrices,h.pricesColor=U,h.rayLeft=!!d.rayLeft,h.rayRight=!!d.rayRight,h.arrowLeft=!!d.arrowLeft,h.arrowRight=!!d.arrowRight,h.p1={...f.p1,price:_},h.p3={...f.p3,price:Z},h.p2={...f.p2,price:C}),H={...H,lineColor:$,lineWidth:X,fillColor:ie,fillOpacity:le,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:U,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...f.p1,price:_},p3:{...f.p3,price:Z},p2:{...f.p2,price:C}}}be($=>{const X=$.map(ie=>ie===f?H:ie);return v.current=X,X}),ce.current===f&&(ce.current=H),M($=>$===f?H:$),re($=>$===f?H:$),ne(H);try{c.current?.applyOptions({})}catch{}};q.useEffect(()=>{const d=o.current;if(!d)return;const f=d.getBoundingClientRect(),O=w=>{const p=Math.abs(Number(w));return Number.isFinite(p)?p>=1e3?p.toFixed(2):p.toFixed(5):"0"},me=nt==="light",H=pm(d,{width:f.width||d.clientWidth,height:f.height||d.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:me?"#FFFFFF":"#0d1117",type:"solid"},textColor:me?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Le,color:Le?me?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?me?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}},rightPriceScale:{borderColor:me?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:me?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:me?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:Ce===1?1:0,vertLine:{width:1,color:me?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:me?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:me?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:me?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Ce===1,horzLineVisible:Ce===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Ce===null||Ce===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),$=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=$.includes("JPY"),ie=tn($),le=en($);let U,_;X?(U=.001,_=w=>Math.abs(Number(w)).toFixed(3)):ie?$.startsWith("BTC")||$.startsWith("ETH")?(U=.01,_=w=>Math.abs(Number(w)).toFixed(2)):(U=1e-4,_=w=>Math.abs(Number(w)).toFixed(4)):le&&($.startsWith("XAU")||$.startsWith("XAG"))?(U=.01,_=w=>Math.abs(Number(w)).toFixed(2)):(U=1e-4,_=w=>Math.abs(Number(w)).toFixed(5));const Z=H.addCandlestickSeries({upColor:me?"#089981":"#26a69a",downColor:me?"#f23645":"#ef5350",wickUpColor:me?"#089981":"#26a69a",wickDownColor:me?"#f23645":"#ef5350",borderUpColor:me?"#089981":"#26a69a",borderDownColor:me?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:U,formatter:_}}),C=H.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=H,u.current=Z,g.current=C,C.setData(il(ve,pe)),requestAnimationFrame(()=>{if(d&&H){const w=d.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),x=()=>{if(ae.current&&gi.current.size>0){const w=h.getVisibleRange();w&&Te(w)}};h.subscribeVisibleTimeRangeChange(x);const I=new ResizeObserver(w=>{for(const p of w){const{width:P,height:Q}=p.contentRect;if(P>0&&Q>0&&H){const L=h.getVisibleRange();H.resize(P,Q),L&&setTimeout(()=>{try{h.setVisibleRange(L)}catch{}},0)}}});return I.observe(d),()=>{h.unsubscribeVisibleTimeRangeChange(x),I.disconnect(),H.remove(),c.current=null,u.current=null,g.current=null,B.current=null,v.current=[],MA.current&&clearTimeout(MA.current)}},[]),q.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}}})},[Le]),q.useEffect(()=>{const d=c.current;if(!d)return;const f=nt==="light";d.applyOptions({layout:{background:{color:f?"#FFFFFF":"#12161d"},textColor:f?"#020617":"#fff"},grid:{vertLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:f?"#e5e7eb":"#1e293b"},timeScale:{borderColor:f?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1},horzLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1}}})},[nt,Le]),q.useEffect(()=>{const d=u.current;!d||!ut||d.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor})},[ut]),q.useEffect(()=>{if(!c.current)return;const f=!rt&&!(Ce!==null&&Ce!==1&&Ce!==0),O=!rt;c.current.applyOptions({crosshair:{mode:Ce===1?1:0,vertLine:{visible:Ce===1||bt,width:1,color:nt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:nt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Ce===1||bt,width:1,color:nt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:nt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:f,horzTouchDrag:f,vertTouchDrag:f},handleScale:{axisPressedMouseMove:{time:f,price:f},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:f,price:f},mouseWheel:O,pinch:O}})},[Ce,rt,bt,nt]);const qT=()=>{const d=u.current;v.current.forEach(f=>{if(f.primitive){try{d&&d.detachPrimitive(f.primitive)}catch{}if(f.series&&f.series!==d)try{f.series.detachPrimitive(f.primitive)}catch{}}if(f.priceLine&&d)try{d.removePriceLine(f.priceLine)}catch{}if(f.textPrimitive&&d)try{d.detachPrimitive(f.textPrimitive)}catch{}}),v.current=[],be([]),xe(null)},Td=(d,f=!1)=>{d&&v.current.forEach(O=>{if(O.primitive){try{d.detachPrimitive(O.primitive)}catch{}try{d.attachPrimitive(O.primitive)}catch{}}if(f&&O.type==="pricelevel"&&O.priceLine)try{const me=O.showPrice!==!1,H=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:me,title:me&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}if(f&&O.type==="horizontalray"&&O.priceLine)try{const me=O.showPrice!==!1,H=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:me,title:me&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}})};q.useEffect(()=>{(async()=>{if(!ye||!pe){qe([]),ae.current=!1;return}try{if(MA.current&&(clearTimeout(MA.current),MA.current=null),rr.current=!0,Ze(!0),St(null),qe([]),ae.current=!1,jr.current=!1,Fe.current!==null&&Fe.current!==ye&&qT(),Fe.current=ye,u.current)try{u.current.setData([])}catch{}const f=ad(pe),O=dT(pe,f),me=Gt||Jv?.VITE_BASE_URL||"http://localhost:5002",H=fA?.candles||"/api/chart/candles",$=XA?.candles||{},X={symbol:$.symbol||"symbol",timeframe:$.timeframe||"timeframe",limit:$.limit||"limit",daysBack:$.daysBack||"daysBack"},ie={};ie[X.symbol]=ye,ie[X.timeframe]=pe,ie[X.limit]=O,$.daysBack!==!1&&(ie[X.daysBack]=f);const le=await gt.get(`${me}${H}`,{params:ie,timeout:1e4});let U=[];if(Array.isArray(le.data)?U=le.data:le.data&&le.data.data&&Array.isArray(le.data.data)?U=le.data.data:le.data&&Array.isArray(le.data)&&(U=le.data),U&&U.length>0){const{candles:_,stats:Z}=dl(U,ye,pe);_.length>0?(qe(_),gi.current=new Map,_.forEach(C=>{gi.current.set(C.time,C)}),jr.current=!0,rr.current=!1,Vs.current?.connected&&ye&&pe&&Vs.current.emit("subscribeCandles",{symbol:ye,timeframe:pe})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),rr.current=!1,qe([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),rr.current=!1,qe([])}catch(f){console.error(`❌ Error fetching ${ye}:`,f.message);const O=f.code==="ECONNABORTED"||f.message&&f.message.includes("timeout");St(O?"Request timed out. No data available for this symbol.":f.message||"Failed to load candles."),rr.current=!1,qe([]),Ze(!1)}})()},[ye,pe,LA]),q.useEffect(()=>{Vs.current=kn.getSocket();const d=Vs.current,f=()=>{if(jr.current&&ye&&pe&&d.connected){const ie={symbol:ye,timeframe:pe};d.emit("subscribeCandles",ie)}},O=()=>{setTimeout(()=>{ye&&pe&&f()},200)},me=ie=>{},H=ie=>{};d.on("connect",O),d.on("disconnect",me),d.on("connect_error",H),d.on("subscription:confirmed",ie=>{ie.type});const $=ie=>{if(!jr.current||!ie||!ie.candle||!ie.symbol)return;const le=P=>String(P||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(le(ie.symbol)!==le(ye)||ie.timeframe&&ie.timeframe!==pe)return;const{candle:U}=ie,_=fl(U,ye,pe);if(!_)return;const Z=Date.now();if(Z-vd.current<200)return;vd.current=Z;const C=c.current?.timeScale(),h=C?.getVisibleRange(),x=u.current,I=c.current;if(!(!x||!I||!ae.current&&!jr.current||x?.seriesType?.()!==(tt==="line"?"Line":tt==="area"?"Area":tt==="bars"?"Bar":"Candlestick")))try{const P=gi.current.get(_.time),Q=!P,L=P?{time:_.time,open:P.open,high:Math.max(P.high,_.high),low:Math.min(P.low,_.low),close:_.close}:_;gi.current.set(_.time,L),Q&&g.current&&g.current.setData(il(Array.from(gi.current.values()),pe));try{tt==="line"||tt==="area"?x.update({time:L.time,value:L.close}):x.update(L),C&&h&&Te(h)}catch(N){throw N}const b=It.current||{},m=$e.current||{},D=mA.current;if(Object.keys(D).length>0){const N=Array.from(gi.current.values()).sort((K,W)=>K.time-W.time);if(b.sma20&&D.sma20){const K=Os(N,m.smaPeriod||20);if(K)try{D.sma20.update(K)}catch{}}if(b.sma50&&D.sma50){const K=Os(N,50);if(K)try{D.sma50.update(K)}catch{}}if(b.ema12&&D.ema12){const K=pd(N,m.emaPeriod||12);if(K)try{D.ema12.update(K)}catch{}}if(b.rsi&&D.rsi){const K=dd(N,m.rsiPeriod||14);if(K){try{D.rsi.update(K)}catch{}if(D.rsi70)try{D.rsi70.update({time:K.time,value:70})}catch{}if(D.rsi30)try{D.rsi30.update({time:K.time,value:30})}catch{}}}if(b.macd&&D.macdLine){const K=fd(N,12,26,9);if(K){try{D.macdLine.update({time:K.time,value:K.value})}catch{}try{D.macdSignal.update({time:K.time,value:K.signal})}catch{}try{D.macdHist.update({time:K.time,value:K.histogram,color:K.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}}}catch{}};d.on("candleUpdate",$);const X=()=>{d.connected&&ye&&pe&&f()};if(d.connected)X();else{const ie=()=>{setTimeout(X,200)};d.once("connect",ie),setTimeout(()=>{d.connected&&X()},500)}return()=>{d.off("candleUpdate",$),d.off("connect",O),d.off("disconnect",me),d.off("connect_error",H),d.off("subscription:confirmed"),ye&&pe&&d.connected&&d.emit("unsubscribeCandles",{symbol:ye,timeframe:pe})}},[ye,pe,Gt]),q.useEffect(()=>{const d=u.current,f=c.current;if(!(!d||!f)&&!(rr.current&&ve.length>0)&&!(ve.length===0&&ae.current)){if(ve.length===0&&!ae.current){if(Ne)return;const O=f.timeScale();d.setData([]),O.fitContent(),MA.current&&clearTimeout(MA.current),MA.current=setTimeout(()=>requestAnimationFrame(()=>Ze(!1)),400);return}if(!ae.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),me=O.includes("JPY"),H=en(O),$=tn(O);let X,ie;me?(X=.001,ie=h=>Math.abs(Number(h)).toFixed(3)):$?O.startsWith("BTC")||O.startsWith("ETH")?(X=.01,ie=h=>Math.abs(Number(h)).toFixed(2)):(X=1e-4,ie=h=>Math.abs(Number(h)).toFixed(4)):H&&(O.startsWith("XAU")||O.startsWith("XAG"))?(X=.01,ie=h=>Math.abs(Number(h)).toFixed(2)):(X=1e-4,ie=h=>Math.abs(Number(h)).toFixed(5));try{d.applyOptions({priceFormat:{type:"custom",minMove:X,formatter:ie}})}catch{}const le=f.timeScale(),U=Ue(ye,pe);we.current,we.current=U;const _=[...ve].sort((h,x)=>h.time-x.time);if(tt==="line"||tt==="area"){const h=_?.map(x=>({time:x.time,value:x.close})).filter(x=>x.time!=null);h.length>0&&d.setData(h)}else _?.length>0&&d.setData(_);ut&&d.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor}),Td(d);const Z=hA(pe)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,L=ke(Q,Z);h.primitive.originTime=L,h.originTime=L;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,L=ke(Q,Z);h.primitive.time=L,h.time=j(L);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,b=_.length>0?_[0].time:null,m=_.length>0?_[_.length-1].time:null,D=W=>{const G=ke(W,Z);return b==null||m==null?G:Math.min(Math.max(G,b),m)},N=D(Q),K=D(L);h.p1.rawTime=N,h.p1.normalizedTime=j(N),h.p2.rawTime=K,h.p2.normalizedTime=j(K),h.primitive.p1={rawTime:N,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,b=_.length>0?_[0].time:null,m=_.length>0?_[_.length-1].time:null,D=ue=>{const ge=ke(ue,Z);return b==null||m==null?ge:Math.min(Math.max(ge,b),m)},N=D(Q),K=D(L);h.p1.rawTime=N,h.p2.rawTime=K,h.primitive.p1={rawTime:N,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};const W=j(N),G=j(K),ee=Math.abs((G??0)-(W??0));h.primitive.info={priceDiff:h.p2.price-h.p1.price,pricePct:(h.p2.price-h.p1.price)/Math.abs(h.p1.price||1)*100,bars:Ns(Ks,N,K,pe),days:Math.max(1,Math.round(ee/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,b=ke(Q,Z),m=ke(L,Z);h.p1.rawTime=b,h.p1.normalizedTime=j(b),h.p2.rawTime=m,h.p2.normalizedTime=j(m),h.primitive.p1={rawTime:b,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="rayline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,b=ke(Q,Z),m=ke(L,Z);h.p1.rawTime=b,h.p1.normalizedTime=j(b),h.p2.rawTime=m,h.p2.normalizedTime=j(m),h.primitive.p1={rawTime:b,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="extendedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,b=ke(Q,Z),m=ke(L,Z);h.p1.rawTime=b,h.p1.normalizedTime=j(b),h.p2.rawTime=m,h.p2.normalizedTime=j(m),h.primitive.p1={rawTime:b,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="trendbyangle"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,b=ke(Q,Z),m=ke(L,Z);h.p1.rawTime=b,h.p1.normalizedTime=j(b),h.p2.rawTime=m,h.p2.normalizedTime=j(m),h.primitive.p1={rawTime:b,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const b=ke(L.rawTime,Z);L.rawTime=b,L.normalizedTime=j(b)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="flattopbottom"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const b=ke(L.rawTime,Z);L.rawTime=b,L.normalizedTime=j(b)};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(_,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.intercept=Q.intercept,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="stddevchannel"&&h.primitive&&h.p1&&h.p2){const Q=Xr(_,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="andrewspitchfork"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ke(h.p1.rawTime,Z),L=ke(h.p2.rawTime,Z),b=ke(h.p3.rawTime,Z);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.p3.rawTime=b,h.p3.normalizedTime=j(b),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:b,price:h.p3.price};return}if((h.type==="gannfan"||h.type==="ganngrid")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,Z),L=ke(h.p2.rawTime,Z);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if((h.type==="circle"||h.type==="ellipse")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,Z),L=ke(h.p2.rawTime,Z);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type==="triangle"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ke(h.p1.rawTime,Z),L=ke(h.p2.rawTime,Z),b=ke(h.p3.rawTime,Z);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.p3.rawTime=b,h.p3.normalizedTime=j(b),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:b,price:h.p3.price};return}if((h.type==="fibonacci"||h.type==="rectangle")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,Z),L=ke(h.p2.rawTime,Z);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type!=="trendline"&&h.type!=="gannline"||!h.series||!h.point1||!h.point2)return;const x=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=ke(x,Z),p=ke(I,Z);h.point1.time=w,h.point2.time=p;const P=zA([{time:w,value:h.point1.price},{time:p,value:h.point2.price}]);try{P.length>0&&h.series.setData(P)}catch{}}),_?.length>0){const h=_[_?.length-1].time,x=hA(pe)||60,w=h-(pe==="M1"?150:pe==="M5"?120:100)*x;try{le.setVisibleRange({from:w,to:h+x*cd})}catch{le.fitContent()}}else le.fitContent();try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0;const C=le.getVisibleRange();Te(C),MA.current&&clearTimeout(MA.current),MA.current=setTimeout(()=>requestAnimationFrame(()=>Ze(!1)),400)}}},[ve.length,tt,ye,pe]),q.useEffect(()=>{const d=c.current;if(!d||!ae.current||ve.length===0)return;const f=d.timeScale(),O=f.getVisibleRange()||Be();if(u.current)try{d.removeSeries(u.current)}catch{}if(B.current)try{d.removeSeries(B.current),B.current=null}catch{}let me;const H=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),$=H.includes("JPY"),X=en(H),ie=tn(H);let le,U;$?(le=.001,U=C=>Math.abs(Number(C)).toFixed(3)):ie?H.startsWith("BTC")||H.startsWith("ETH")?(le=.01,U=C=>Math.abs(Number(C)).toFixed(2)):(le=1e-4,U=C=>Math.abs(Number(C)).toFixed(4)):X&&(H.startsWith("XAU")||H.startsWith("XAG"))?(le=.01,U=C=>Math.abs(Number(C)).toFixed(2)):(le=1e-4,U=C=>Math.abs(Number(C)).toFixed(5));const _={type:"custom",minMove:le,formatter:U};if(tt==="bars"){const C=nt==="light";me=d.addBarSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",priceFormat:_,scaleMargins:{top:.1,bottom:.1}});const h=[...ve].sort((x,I)=>x.time-I.time);h?.length>0&&me.setData(h)}else if(tt==="line"){me=d.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:_,scaleMargins:{top:.1,bottom:.1}});const C=zA(ol);C.length>0&&me.setData(C)}else if(tt==="area"){me=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:_,scaleMargins:{top:.1,bottom:.1}});const C=zA(ol);C.length>0&&me.setData(C)}else if(tt==="volume ticks"||tt==="volume"){const C=nt==="light";me=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:_,priceScaleId:"right"});const h=[...ve].sort((w,p)=>w.time-p.time);h?.length>0&&me.setData(h);const x=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 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&&x.setData(I),B.current=x}else{const C=nt==="light";me=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:_,scaleMargins:{top:.1,bottom:.1}});const h=[...ve].sort((x,I)=>x.time-I.time);h?.length>0&&me.setData(h)}if(u.current=me,ut&&me)try{me.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor})}catch{}Td(me,!0);const Z=hA(pe)||60;if(v.current.forEach(C=>{if(C.type==="horizontalray"&&C.primitive){const L=C.rawOriginTime??C.primitive.originTime,b=ke(L,Z);C.primitive.originTime=b,C.originTime=b;return}if(C.type==="verticalline"&&C.primitive){const L=C.rawTime??C.primitive.time,b=ke(L,Z);C.primitive.time=b,C.time=j(b);return}if(C.type==="infoline"&&C.primitive&&C.p1&&C.p2){const L=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,m=[...ve].sort((ee,ue)=>ee.time-ue.time),D=m.length>0?m[0].time:null,N=m.length>0?m[m.length-1].time:null,K=ee=>{const ue=ke(ee,Z);return D==null||N==null?ue:Math.min(Math.max(ue,D),N)},W=K(L),G=K(b);C.p1.rawTime=W,C.p1.normalizedTime=j(W),C.p2.rawTime=G,C.p2.normalizedTime=j(G),C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:G,price:C.p2.price};return}if(C.type==="rulerline"&&C.primitive&&C.p1&&C.p2){const L=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,m=[...ve].sort((Qe,Ee)=>Qe.time-Ee.time),D=m.length>0?m[0].time:null,N=m.length>0?m[m.length-1].time:null,K=Qe=>{const Ee=ke(Qe,Z);return D==null||N==null?Ee:Math.min(Math.max(Ee,D),N)},W=K(L),G=K(b);C.p1.rawTime=W,C.p2.rawTime=G,C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:G,price:C.p2.price};const ee=j(W),ue=j(G),ge=Math.abs((ue??0)-(ee??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:Ns(Ks,W,G,pe),days:Math.max(1,Math.round(ge/86400))};return}if(C.type==="arrowedline"&&C.primitive&&C.p1&&C.p2){const L=C.p1.rawTime,b=C.p2.rawTime,m=ke(L,Z),D=ke(b,Z);C.p1.rawTime=m,C.p1.normalizedTime=j(m),C.p2.rawTime=D,C.p2.normalizedTime=j(D),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:D,price:C.p2.price};return}if(C.type==="rayline"&&C.primitive&&C.p1&&C.p2){const L=C.p1.rawTime,b=C.p2.rawTime,m=ke(L,Z),D=ke(b,Z);C.p1.rawTime=m,C.p1.normalizedTime=j(m),C.p2.rawTime=D,C.p2.normalizedTime=j(D),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:D,price:C.p2.price};return}if(C.type==="extendedline"&&C.primitive&&C.p1&&C.p2){const L=C.p1.rawTime,b=C.p2.rawTime,m=ke(L,Z),D=ke(b,Z);C.p1.rawTime=m,C.p1.normalizedTime=j(m),C.p2.rawTime=D,C.p2.normalizedTime=j(D),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:D,price:C.p2.price};return}if(C.type==="trendbyangle"&&C.primitive&&C.p1&&C.p2){const L=C.p1.rawTime,b=C.p2.rawTime,m=ke(L,Z),D=ke(b,Z);C.p1.rawTime=m,C.p1.normalizedTime=j(m),C.p2.rawTime=D,C.p2.normalizedTime=j(D),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:D,price:C.p2.price};return}if(C.type==="disjointchannel"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const L=b=>{const m=ke(b.rawTime,Z);b.rawTime=m,b.normalizedTime=j(m)};L(C.p1),L(C.p2),L(C.p3),L(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 L=b=>{const m=ke(b.rawTime,Z);b.rawTime=m,b.normalizedTime=j(m)};L(C.p1),L(C.p2),L(C.p3),L(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 L=[...ve].sort((D,N)=>D.time-N.time),b=ir(L,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const m=C.primitive;m.mid1={rawTime:b.p1.rawTime,price:b.p1.price},m.mid2={rawTime:b.p2.rawTime,price:b.p2.price},m.top1={rawTime:b.top1.rawTime,price:b.top1.price},m.top2={rawTime:b.top2.rawTime,price:b.top2.price},m.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},m.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 L=[...ve].sort((D,N)=>D.time-N.time),b=Xr(L,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const m=C.primitive;m.mid1={rawTime:b.p1.rawTime,price:b.p1.price},m.mid2={rawTime:b.p2.rawTime,price:b.p2.price},m.top1={rawTime:b.top1.rawTime,price:b.top1.price},m.top2={rawTime:b.top2.rawTime,price:b.top2.price},m.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},m.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 L=ke(C.p1.rawTime,Z),b=ke(C.p2.rawTime,Z),m=ke(C.p3.rawTime,Z);C.p1.rawTime=L,C.p1.normalizedTime=j(L),C.p2.rawTime=b,C.p2.normalizedTime=j(b),C.p3.rawTime=m,C.p3.normalizedTime=j(m),C.primitive.p1={rawTime:L,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:m,price:C.p3.price};return}if((C.type==="gannfan"||C.type==="ganngrid")&&C.primitive&&C.p1&&C.p2){const L=ke(C.p1.rawTime,Z),b=ke(C.p2.rawTime,Z);C.p1.rawTime=L,C.p1.normalizedTime=j(L),C.p2.rawTime=b,C.p2.normalizedTime=j(b),C.primitive.p1={rawTime:L,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 L=ke(C.p1.rawTime,Z),b=ke(C.p2.rawTime,Z);C.p1.rawTime=L,C.p1.normalizedTime=j(L),C.p2.rawTime=b,C.p2.normalizedTime=j(b),C.primitive.p1={rawTime:L,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 L=ke(C.p1.rawTime,Z),b=ke(C.p2.rawTime,Z),m=ke(C.p3.rawTime,Z);C.p1.rawTime=L,C.p1.normalizedTime=j(L),C.p2.rawTime=b,C.p2.normalizedTime=j(b),C.p3.rawTime=m,C.p3.normalizedTime=j(m),C.primitive.p1={rawTime:L,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:m,price:C.p3.price};return}if((C.type==="fibonacci"||C.type==="rectangle")&&C.primitive&&C.p1&&C.p2){const L=ke(C.p1.rawTime,Z),b=ke(C.p2.rawTime,Z);C.p1.rawTime=L,C.p1.normalizedTime=j(L),C.p2.rawTime=b,C.p2.normalizedTime=j(b),C.primitive.p1={rawTime:L,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 h=C.type==="gannline"?"#7aa6ae":"#22c55e";try{d.removeSeries(C.series)}catch{}const x=d.addLineSeries({color:C.lineColor??h,lineWidth:C.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),I=C.point1.rawTime??C.point1.time,w=C.point2.rawTime??C.point2.time,p=ke(I,Z),P=ke(w,Z);C.point1.time=p,C.point2.time=P;const Q=zA([{time:p,value:C.point1.price},{time:P,value:C.point2.price}]);try{Q.length>0&&x.setData(Q)}catch{}if(C.decoration)try{x.attachPrimitive(C.decoration)}catch{}C.series=x}),O&&ae.current)setTimeout(()=>{try{f.setVisibleRange(O),Te(O)}catch{if(ve.length>0)try{const h=ve[ve.length-1].time,x=hA(pe)||60,I=h-100*x;f.setVisibleRange({from:I,to:h+x*cd}),Te(f.getVisibleRange())}catch{f.fitContent(),Te(f.getVisibleRange())}}try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!ae.current){f.fitContent();try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0,Te(f.getVisibleRange())}},[tt,ve.length,ol.length,ye,ut]),q.useEffect(()=>{const d=c.current,f=B.current;if(!d||!f||!ae.current||ve.length===0||tt!=="volume"&&tt!=="volume ticks")return;const me=[...ve].sort((H,$)=>H.time-$.time)?.map(H=>({time:H.time,value:H.volume||0,color:H.close>=H.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));me.length>0&&f.setData(me)},[ve,tt]),q.useEffect(()=>{if(!ye||!pe||!Kt)return;const f=Object.entries(Kt).filter(([X,ie])=>ie).map(([X])=>X).filter(X=>X.startsWith("sma")||X.startsWith("ema")||X==="rsi"||X==="macd");if(f.length===0){mt({});return}const O=f.map(X=>X==="sma20"?`sma:${Ft?.smaPeriod||20}`:X==="sma50"?"sma:50":X==="ema12"?`ema:${Ft?.emaPeriod||12}`:X==="rsi"?`rsi:${Ft?.rsiPeriod||14}`:X==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const me=++Ut.current,H=Gt||"http://localhost:5002",$=fA?.indicators||"/api/market-data/indicators";gt.get(`${H}${$}`,{params:{symbol:ye,timeframe:pe,indicators:O}}).then(X=>{me===Ut.current&&mt(X.data?.data||{})}).catch(X=>{console.error("[ChartArea] Indicator fetch error:",X?.message),me===Ut.current&&mt({})})},[ye,pe,Kt,Ft,Gt,fA]),q.useEffect(()=>{const d=c.current;if(!d||!ae.current)return;const f=mA.current,O=(U,_)=>(f[U]||(f[U]=d.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,..._})),f[U]),me=U=>{if(f[U]){try{d.removeSeries(f[U])}catch{}delete f[U]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(me)},$=Kt||{};if($.sma20&&st.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(st.sma20.data.map(_=>({time:_.time,value:_.value}))):me("sma20"),$.sma50&&st.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(st.sma50.data.map(_=>({time:_.time,value:_.value}))):me("sma50"),$.ema12&&st.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(st.ema12.data.map(_=>({time:_.time,value:_.value}))):me("ema12"),$.rsi&&st.rsi?.data?.length){const U=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:h=>h.toFixed(1)}});d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),U.setData(st.rsi.data.map(h=>({time:h.time,value:h.value}))),f.rsi70||(f.rsi70=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),f.rsi30||(f.rsi30=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const _=st.rsi.data,Z=_[0]?.time,C=_[_.length-1]?.time;Z&&C&&(f.rsi70.setData([{time:Z,value:70},{time:C,value:70}]),f.rsi30.setData([{time:Z,value:30},{time:C,value:30}]))}else me("rsi"),me("rsi70"),me("rsi30");if($.macd&&st.macd?.data?.length){const U=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:h=>h.toFixed(4)}}),_=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});f.macdHist||(f.macdHist=d.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:h=>h.toFixed(4)}}));const Z=$.rsi?.65:.8;d.priceScale("macd").applyOptions({scaleMargins:{top:Z,bottom:0},borderVisible:!1,autoScale:!0}),$.rsi&&d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const C=st.macd.data;U.setData(C.map(h=>({time:h.time,value:h.value}))),_.setData(C.map(h=>({time:h.time,value:h.signal}))),f.macdHist.setData(C.map(h=>({time:h.time,value:h.histogram,color:h.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else H();const X=Array.from(gi.current.values()).sort((U,_)=>U.time-_.time);if(X.length>0){const U=$e.current||{};if($.sma20&&f.sma20){const _=Os(X,U.smaPeriod||20);if(_)try{f.sma20.update(_)}catch{}}if($.sma50&&f.sma50){const _=Os(X,50);if(_)try{f.sma50.update(_)}catch{}}if($.ema12&&f.ema12){const _=pd(X,U.emaPeriod||12);if(_)try{f.ema12.update(_)}catch{}}if($.rsi&&f.rsi){const _=dd(X,U.rsiPeriod||14);if(_){try{f.rsi.update(_)}catch{}if(f.rsi70)try{f.rsi70.update({time:_.time,value:70})}catch{}if(f.rsi30)try{f.rsi30.update({time:_.time,value:30})}catch{}}}if($.macd&&f.macdLine){const _=fd(X,12,26,9);if(_){try{f.macdLine.update({time:_.time,value:_.value})}catch{}try{f.macdSignal.update({time:_.time,value:_.signal})}catch{}try{f.macdHist.update({time:_.time,value:_.histogram,color:_.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}}const ie=$.rsi&&st.rsi?.data?.length||$.macd&&st.macd?.data?.length,le=$.rsi&&st.rsi?.data?.length&&$.macd&&st.macd?.data?.length;try{d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:le?.4:ie?.25:.05}})}catch{}},[st,Kt,ve.length]),q.useEffect(()=>()=>{const d=c.current;if(!d)return;const f=mA.current;Object.keys(f).forEach(O=>{try{d.removeSeries(f[O])}catch{}}),mA.current={}},[ye,pe]),q.useEffect(()=>{const d=c.current,f=u.current,O=o.current;if(!d||!f||!O)return;const H=Ce!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][Ce]:null,$=(U,_)=>{const Z=Math.min(U.time,_.time),C=Math.max(U.time,_.time),h=U.time<=_.time?U.rawTime:_.rawTime,x=U.time<=_.time?_.rawTime:U.rawTime,I=Math.max(U.price,_.price),w=Math.min(U.price,_.price),p=j(Math.round((Z+C)/2));return p==null?null:{p1:{rawTime:p,normalizedTime:p,price:I},p2:{rawTime:h,normalizedTime:Z,price:w},p3:{rawTime:x,normalizedTime:C,price:w}}};if(!H){if(T.current=!1,y.current=null,S.current=null,E.current=null,F.current?.series)try{d.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const p={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};be(P=>[...P,p]),v.current.push(p),xe(null)};return O.addEventListener("click",U),()=>{O.removeEventListener("click",U)}}if(H==="horizontalray"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=new Zv(I,x);f.attachPrimitive(w);const p=f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),P=j(x),Q={type:"horizontalray",primitive:w,priceLine:p,price:I,originTime:P,rawOriginTime:x,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};be(L=>[...L,Q]),v.current.push(Q),xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="verticalline"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=d.timeScale().coordinateToTime(C);if(h==null)return;const x=new cT(h);f.attachPrimitive(x);const I=j(h),w={type:"verticalline",primitive:x,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};be(p=>[...p,w]),v.current.push(w),xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="text"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=new uT(x,I);f.attachPrimitive(w);const p={type:"text",primitive:w,rawTime:x,price:I,text:"Text"};be(P=>[...P,p]),v.current.push(p),xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="infoline"){let U=null,_=null;const Z=h=>{if(!U)return;const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top,p=d.timeScale().coordinateToTime(I),P=f.coordinateToPrice(w);if(p==null||P==null)return;_||(_=d.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=U.normalizedTime,L=j(p);if(Q==null||L==null||Q===L)return;const b=Q<=L?[{time:Q,value:U.price},{time:L,value:P}]:[{time:L,value:P},{time:Q,value:U.price}];try{_.setData(b)}catch{}},C=h=>{const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top,p=d.timeScale().coordinateToTime(I),P=f.coordinateToPrice(w);if(p==null||P==null)return;if(!U){U={rawTime:p,price:P,normalizedTime:j(p),x:I,y:w};return}if(_){try{d.removeSeries(_)}catch{}_=null}const Q=U.normalizedTime,L=j(p);if(Q==null||L==null)return;const b=P-U.price,m=b/Math.abs(U.price)*100,D=hA(pe)||3600,N=Math.abs(L-Q),K=Math.max(1,Math.round(N/D)),W=Math.max(1,Math.round(N/86400)),G=U.x,ee=U.y,ue=I,Qe=Math.atan2(-(w-ee),ue-G)*(180/Math.PI),Ee={priceDiff:b,pricePct:m,bars:K,days:W,angle:Qe},We=new Yv({rawTime:U.rawTime,price:U.price},{rawTime:p,price:P},Ee);f.attachPrimitive(We);const je={type:"infoline",primitive:We,rawP1Time:U.rawTime,rawP2Time:p,p1:{rawTime:U.rawTime,normalizedTime:Q,price:U.price},p2:{rawTime:p,normalizedTime:L,price:P},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};be(Ve=>[...Ve,je]),v.current.push(je),U=null,xe(null)};return O.addEventListener("mousemove",Z),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",Z),O.removeEventListener("click",C),_)try{d.removeSeries(_)}catch{}}}if(H==="rulerline"){let U=null,_=null;const Z=(x,I,w,p)=>{const P=j(x),Q=j(w),L=p-I,b=L/Math.abs(I)*100,m=Ns(Ks,x,w,pe),D=Math.abs((Q??0)-(P??0)),N=Math.max(1,Math.round(D/86400));return{priceDiff:L,pricePct:b,bars:m,days:N}},C=x=>{if(!U)return;const I=O.getBoundingClientRect(),w=x.clientX-I.left,p=x.clientY-I.top,P=d.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(p);if(P==null||Q==null)return;const L=j(P);if(L==null||L===U.normalizedTime)return;const b=Z(U.rawTime,U.price,P,Q);if(!_)_=new ed({rawTime:U.rawTime,price:U.price},{rawTime:P,price:Q},b),f.attachPrimitive(_);else{_.p2={rawTime:P,price:Q},_.info=b;const m=Q>=U.price;_.color=m?"#3b82f6":"#ef5350",_.fillColor=m?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=x=>{const I=O.getBoundingClientRect(),w=x.clientX-I.left,p=x.clientY-I.top,P=d.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(p);if(P==null||Q==null)return;if(!U){U={rawTime:P,price:Q,normalizedTime:j(P)};return}if(_){try{f.detachPrimitive(_)}catch{}_=null}const L=U.normalizedTime,b=j(P);if(L==null||b==null)return;const m=Z(U.rawTime,U.price,P,Q),D=new ed({rawTime:U.rawTime,price:U.price},{rawTime:P,price:Q},m);f.attachPrimitive(D);const N={type:"rulerline",primitive:D,rawP1Time:U.rawTime,rawP2Time:P,p1:{rawTime:U.rawTime,normalizedTime:L,price:U.price},p2:{rawTime:P,normalizedTime:b,price:Q},lineColor:Q>=U.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};be(K=>[...K,N]),v.current.push(N),U=null,xe(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",h),_)try{f.detachPrimitive(_)}catch{}}}if(H==="arrowedline"){let U=null,_=null;const Z=h=>{if(!U)return;const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top,p=d.timeScale().coordinateToTime(I),P=f.coordinateToPrice(w);if(p==null||P==null)return;const Q=j(p);if(!(Q==null||Q===U.normalizedTime))if(!_)_=new td({rawTime:U.rawTime,price:U.price},{rawTime:p,price:P}),f.attachPrimitive(_);else{_.p2={rawTime:p,price:P};try{c.current?.applyOptions({})}catch{}}},C=h=>{const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top,p=d.timeScale().coordinateToTime(I),P=f.coordinateToPrice(w);if(p==null||P==null)return;if(!U){U={rawTime:p,price:P,normalizedTime:j(p)};return}if(_){try{f.detachPrimitive(_)}catch{}_=null}const Q=U.normalizedTime,L=j(p);if(Q==null||L==null||Q===L)return;const b=new td({rawTime:U.rawTime,price:U.price},{rawTime:p,price:P});f.attachPrimitive(b);const m={type:"arrowedline",primitive:b,p1:{rawTime:U.rawTime,normalizedTime:Q,price:U.price},p2:{rawTime:p,normalizedTime:L,price:P},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};be(D=>[...D,m]),v.current.push(m),U=null,xe(null)};return O.addEventListener("mousemove",Z),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",Z),O.removeEventListener("click",C),_)try{f.detachPrimitive(_)}catch{}}}if(H==="rayline"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const P=j(x),Q=j(p);if(P==null||Q==null)return;const L=new AT({rawTime:x,price:I},{rawTime:p,price:I});f.attachPrimitive(L);const b={type:"rayline",primitive:L,p1:{rawTime:x,normalizedTime:P,price:I},p2:{rawTime:p,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};be(m=>[...m,b]),v.current.push(b),xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="extendedline"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const P=j(x),Q=j(p);if(P==null||Q==null)return;const L=new iT({rawTime:x,price:I},{rawTime:p,price:I});f.attachPrimitive(L);const b={type:"extendedline",primitive:L,p1:{rawTime:x,normalizedTime:P,price:I},p2:{rawTime:p,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};be(m=>[...m,b]),v.current.push(b),xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="crossline"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=j(x);if(w==null)return;const p=new nT({rawTime:x,price:I});f.attachPrimitive(p);const P={type:"crossline",primitive:p,p:{rawTime:x,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};be(Q=>[...Q,P]),v.current.push(P),xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="trendbyangle"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const P=j(x),Q=j(p);if(P==null||Q==null)return;const L=new sT({rawTime:x,price:I},{rawTime:p,price:I});f.attachPrimitive(L);const b={type:"trendbyangle",primitive:L,p1:{rawTime:x,normalizedTime:P,price:I},p2:{rawTime:p,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};be(m=>[...m,b]),v.current.push(b),xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="disjointchannel"){let U=null,_=null,Z=null,C=null,h=0,x=null;const I=(P,Q,L,b)=>{if(!x)x=new tl(P,Q,L,b),f.attachPrimitive(x);else{x.p1=P,x.p2=Q,x.p3=L,x.p4=b;try{c.current?.applyOptions({})}catch{}}},w=P=>{if(h===0||!U)return;const Q=O.getBoundingClientRect(),L=P.clientX-Q.left,b=P.clientY-Q.top;if(h===1){const m=f.coordinateToPrice(b);if(m==null)return;_={rawTime:U.rawTime,normalizedTime:U.normalizedTime,price:m},I({rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price},{rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price});return}if(h===2&&_){const m=d.timeScale().coordinateToTime(L),D=f.coordinateToPrice(b);if(m==null||D==null)return;const N=j(m);if(N==null)return;const K=(U.price+_.price)/2;D>=K?(Z={rawTime:m,normalizedTime:N,price:D},C={rawTime:m,normalizedTime:N,price:2*K-D}):(C={rawTime:m,normalizedTime:N,price:D},Z={rawTime:m,normalizedTime:N,price:2*K-D}),I({rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price},{rawTime:Z.rawTime,price:Z.price},{rawTime:C.rawTime,price:C.price})}},p=P=>{const Q=O.getBoundingClientRect(),L=P.clientX-Q.left,b=P.clientY-Q.top,m=d.timeScale().coordinateToTime(L),D=f.coordinateToPrice(b);if(m==null||D==null)return;const N=j(m);if(N!=null){if(h===0){U={rawTime:m,normalizedTime:N,price:D},_={rawTime:m,normalizedTime:N,price:D},h=1,I({rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price},{rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price});return}if(h===1){const K=f.coordinateToPrice(b);if(K==null||Math.abs(K-U.price)<1e-7)return;_={rawTime:U.rawTime,normalizedTime:U.normalizedTime,price:K},h=2;return}if(h===2&&x){try{f.detachPrimitive(x)}catch{}const K=new tl(x.p1,x.p2,x.p3,x.p4);f.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:U,p2:_,p3:{rawTime:x.p3.rawTime,normalizedTime:j(x.p3.rawTime),price:x.p3.price},p4:{rawTime:x.p4.rawTime,normalizedTime:j(x.p4.rawTime),price:x.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};be(G=>[...G,W]),v.current.push(W),xe(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),x)try{f.detachPrimitive(x)}catch{}}}if(H==="flattopbottom"){let U=null,_=null,Z=null,C=null,h=0,x=null;const I=(P,Q,L,b)=>{if(!x)x=new Ad(P,Q,L,b),f.attachPrimitive(x);else{x.p1=P,x.p2=Q,x.p3=L,x.p4=b;try{c.current?.applyOptions({})}catch{}}},w=P=>{if(h===0||!U)return;const Q=O.getBoundingClientRect(),L=P.clientX-Q.left,b=P.clientY-Q.top;if(h===1){const m=f.coordinateToPrice(b);if(m==null)return;_={rawTime:U.rawTime,normalizedTime:U.normalizedTime,price:m},I({rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price},{rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price});return}if(h===2&&_){const m=d.timeScale().coordinateToTime(L),D=f.coordinateToPrice(b);if(m==null||D==null)return;const N=j(m);if(N==null)return;Z={rawTime:m,normalizedTime:N,price:D},C={rawTime:m,normalizedTime:N,price:_.price},I({rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price},{rawTime:Z.rawTime,price:Z.price},{rawTime:C.rawTime,price:C.price})}},p=P=>{const Q=O.getBoundingClientRect(),L=P.clientX-Q.left,b=P.clientY-Q.top,m=d.timeScale().coordinateToTime(L),D=f.coordinateToPrice(b);if(m==null||D==null)return;const N=j(m);if(N!=null){if(h===0){U={rawTime:m,normalizedTime:N,price:D},_={rawTime:m,normalizedTime:N,price:D},h=1,I({rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price},{rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price});return}if(h===1){const K=f.coordinateToPrice(b);if(K==null||Math.abs(K-U.price)<1e-7)return;_={rawTime:U.rawTime,normalizedTime:U.normalizedTime,price:K},h=2;return}if(h===2&&x){try{f.detachPrimitive(x)}catch{}const K=new Ad(x.p1,x.p2,x.p3,x.p4);f.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:U,p2:_,p3:{rawTime:x.p3.rawTime,normalizedTime:j(x.p3.rawTime),price:x.p3.price},p4:{rawTime:x.p4.rawTime,normalizedTime:j(x.p4.rawTime),price:x.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};be(G=>[...G,W]),v.current.push(W),xe(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),x)try{f.detachPrimitive(x)}catch{}}}if(H==="regressionchannel"){let U=null,_=null;const Z=(x,I)=>{x.mid1={rawTime:I.p1.rawTime,price:I.p1.price},x.mid2={rawTime:I.p2.rawTime,price:I.p2.price},x.top1={rawTime:I.top1.rawTime,price:I.top1.price},x.top2={rawTime:I.top2.rawTime,price:I.top2.price},x.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},x.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},C=x=>{if(!U)return;const I=O.getBoundingClientRect(),w=x.clientX-I.left,p=x.clientY-I.top,P=d.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(p);if(P==null||Q==null)return;const L=j(P);if(L==null)return;const m=ir(ve,U,{rawTime:P,normalizedTime:L},1);if(m)if(!_)_=new Al({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(_);else{Z(_,m);try{d.applyOptions({})}catch{}}},h=x=>{const I=O.getBoundingClientRect(),w=x.clientX-I.left,p=x.clientY-I.top,P=d.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(p);if(P==null||Q==null)return;const L=j(P);if(L==null)return;if(!U){U={rawTime:P,normalizedTime:L,price:Q};return}const m=ir(ve,U,{rawTime:P,normalizedTime:L},1);if(!m)return;if(_){try{f.detachPrimitive(_)}catch{}_=null}const D=new Al({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(D);const N={type:"regressionchannel",primitive:D,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,intercept:m.intercept,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};be(K=>[...K,N]),v.current.push(N),U=null,xe(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",h),_)try{f.detachPrimitive(_)}catch{}}}if(H==="stddevchannel"){let U=null,_=null;const Z=(x,I)=>{x.mid1={rawTime:I.p1.rawTime,price:I.p1.price},x.mid2={rawTime:I.p2.rawTime,price:I.p2.price},x.top1={rawTime:I.top1.rawTime,price:I.top1.price},x.top2={rawTime:I.top2.rawTime,price:I.top2.price},x.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},x.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},C=x=>{if(!U)return;const I=O.getBoundingClientRect(),w=x.clientX-I.left,p=x.clientY-I.top,P=d.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(p);if(P==null||Q==null)return;const L=j(P);if(L==null)return;const m=Xr(ve,U,{rawTime:P,normalizedTime:L},1);if(m)if(!_)_=new rd({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(_);else{Z(_,m);try{d.applyOptions({})}catch{}}},h=x=>{const I=O.getBoundingClientRect(),w=x.clientX-I.left,p=x.clientY-I.top,P=d.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(p);if(P==null||Q==null)return;const L=j(P);if(L==null)return;if(!U){U={rawTime:P,normalizedTime:L,price:Q};return}const m=Xr(ve,U,{rawTime:P,normalizedTime:L},1);if(!m)return;if(_){try{f.detachPrimitive(_)}catch{}_=null}const D=new rd({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(D);const N={type:"stddevchannel",primitive:D,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};be(K=>[...K,N]),v.current.push(N),U=null,xe(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",h),_)try{f.detachPrimitive(_)}catch{}}}if(H==="andrewspitchfork"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=j(x);if(w==null)return;const p=C+140,P=d.timeScale().coordinateToTime(p);if(P==null)return;const Q=j(P);if(Q==null)return;const L={rawTime:x,normalizedTime:w,price:I},b={rawTime:P,normalizedTime:Q,price:I},m={rawTime:x,normalizedTime:w,price:I},D=new oT({rawTime:L.rawTime,price:L.price},{rawTime:b.rawTime,price:b.price},{rawTime:m.rawTime,price:m.price});f.attachPrimitive(D);const N={type:"andrewspitchfork",primitive:D,p1:L,p2:b,p3:m};be(K=>[...K,N]),v.current.push(N),M(N),ce.current=N,xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="gannfan"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=j(x);if(w==null)return;const p={rawTime:x,normalizedTime:w,price:I},P={rawTime:x,normalizedTime:w,price:I},Q=new aT({rawTime:p.rawTime,price:p.price},{rawTime:P.rawTime,price:P.price});f.attachPrimitive(Q);const L={type:"gannfan",primitive:Q,p1:p,p2:P};be(b=>[...b,L]),v.current.push(L),M(L),ce.current=L,xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="ganngrid"){const U=_=>{const Z=O.getBoundingClientRect(),C=_.clientX-Z.left,h=_.clientY-Z.top,x=d.timeScale().coordinateToTime(C),I=f.coordinateToPrice(h);if(x==null||I==null)return;const w=j(x);if(w==null)return;const p={rawTime:x,normalizedTime:w,price:I},P={rawTime:x,normalizedTime:w,price:I},Q=new lT({rawTime:p.rawTime,price:p.price},{rawTime:P.rawTime,price:P.price});f.attachPrimitive(Q);const L={type:"ganngrid",primitive:Q,p1:p,p2:P};be(b=>[...b,L]),v.current.push(L),M(L),ce.current=L,xe(null)};return O.addEventListener("click",U),()=>O.removeEventListener("click",U)}if(H==="trendline"||H==="gannline"){const U=H,_=U==="gannline"?"#7aa6ae":"#22c55e",Z=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=O.getBoundingClientRect(),p=I.clientX-w.left,P=I.clientY-w.top;let Q=d.timeScale().coordinateToTime(p);const L=f.coordinateToPrice(P);if(!(Q==null||L==null)&&(Q=j(Q),Q!=null))if(E.current===null){E.current={time:Q,price:L};const b=d.addLineSeries({color:_,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:U,series:b},b.setData([{time:Q,value:L}])}else{const b=E.current,m={time:Q,price:L},D=1,N=1e-5,K=Math.abs(m.time-b.time),W=Math.abs(m.price-b.price);if(K<D&&W<N){try{d.removeSeries(F.current.series)}catch{}E.current=null,F.current=null;return}const G={time:b.time,rawTime:b.time,price:b.price},ee={time:m.time,rawTime:m.time,price:m.price},ue=zA([{time:G.time,value:G.price},{time:ee.time,value:ee.price}]);if(ue.length>0){F.current.series.setData(ue);const ge=new rT(G,ee,_,2);try{F.current.series.attachPrimitive(ge)}catch{}const Qe={type:U,series:F.current.series,point1:G,point2:ee,decoration:ge};be(Ee=>[...Ee,Qe]),v.current.push(Qe)}xe(null),E.current=null,F.current=null}},C=I=>{if(E.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=O.getBoundingClientRect(),p=I.clientX-w.left,P=I.clientY-w.top;let Q=d.timeScale().coordinateToTime(p);const L=f.coordinateToPrice(P);if(Q==null||L==null||(Q=j(Q),Q==null))return;const b=E.current,m=zA([{time:b.time,value:b.price},{time:Q,value:L}]);m.length>0&&F.current.series.setData(m)},h=I=>{I.stopPropagation()},x={capture:!0,passive:!1};return O.addEventListener("click",Z,x),O.addEventListener("mousemove",C,x),O.addEventListener("mousemove",h,x),()=>{if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{d.removeSeries(F.current.series)}catch{}F.current=null}O.removeEventListener("click",Z,x),O.removeEventListener("mousemove",C,x),O.removeEventListener("mousemove",h,x)}}if(H==="parallellines"){let U=null,_=null,Z=null,C=0,h=null;const x=(L,b,m,D)=>{L.p1={rawTime:b.rawTime,price:b.price},L.p2={rawTime:m.rawTime,price:m.price},L.b1={rawTime:D.b1.rawTime,price:D.b1.price},L.b2={rawTime:D.b2.rawTime,price:D.b2.price},L.p3={rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}},I=(L,b,m)=>{const D=ld(L,b,m);if(!D)return null;if(!h)h=new id({rawTime:L.rawTime,price:L.price},{rawTime:b.rawTime,price:b.price},{rawTime:D.b1.rawTime,price:D.b1.price},{rawTime:D.b2.rawTime,price:D.b2.price},{rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}),f.attachPrimitive(h);else{x(h,L,b,D);try{d.applyOptions({})}catch{}}return D},w=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const b=O.getBoundingClientRect(),m=L.clientX-b.left,D=L.clientY-b.top,N=d.timeScale().coordinateToTime(m),K=f.coordinateToPrice(D);if(N==null||K==null)return;const W=j(N);if(W!=null){if(C===0){U={rawTime:N,normalizedTime:W,price:K},C=1;return}if(C===1){if(_={rawTime:N,normalizedTime:W,price:K},Math.abs(_.normalizedTime-U.normalizedTime)<1)return;const G=j((U.normalizedTime+_.normalizedTime)/2);if(G==null)return;const ee=(U.price+_.price)/2;Z={rawTime:G,normalizedTime:G,price:ee},I(U,_,Z),C=2;return}if(C===2&&U&&_){Z={rawTime:N,normalizedTime:W,price:K};const G=I(U,_,Z);if(!G||!h)return;try{f.detachPrimitive(h)}catch{}const ee=new id({rawTime:U.rawTime,price:U.price},{rawTime:_.rawTime,price:_.price},{rawTime:G.b1.rawTime,price:G.b1.price},{rawTime:G.b2.rawTime,price:G.b2.price},{rawTime:G.bottomMid.rawTime,price:G.bottomMid.price});f.attachPrimitive(ee);const ue={type:"equidistantchannel",primitive:ee,p1:U,p2:_,p3:G.bottomMid,b1:G.b1,b2:G.b2,bottomMid:G.bottomMid};be(ge=>[...ge,ue]),v.current.push(ue),xe(null),C=0,U=null,_=null,Z=null,h=null}}},p=L=>{if(C===0||!U)return;const b=O.getBoundingClientRect(),m=L.clientX-b.left,D=L.clientY-b.top,N=d.timeScale().coordinateToTime(m),K=f.coordinateToPrice(D);if(N==null||K==null)return;const W=j(N);if(W!=null){if(C===1){const G={rawTime:N,normalizedTime:W,price:K},ee=j((U.normalizedTime+G.normalizedTime)/2);if(ee==null)return;const ue=(U.price+G.price)/2;I(U,G,{rawTime:ee,normalizedTime:ee,price:ue});return}C===2&&_&&I(U,_,{rawTime:N,normalizedTime:W,price:K})}},P=L=>{L.stopPropagation()},Q={capture:!0,passive:!1};return O.addEventListener("click",w,Q),O.addEventListener("mousemove",p,Q),O.addEventListener("mousemove",P,Q),()=>{if(C=0,U=null,_=null,Z=null,k.current=[],h)try{f.detachPrimitive(h)}catch{}h=null,O.removeEventListener("click",w,Q),O.removeEventListener("mousemove",p,Q),O.removeEventListener("mousemove",P,Q)}}if(H==="fibonacci"){let U=null,_=null;const Z=h=>{if(!U)return;const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top,p=d.timeScale().coordinateToTime(I),P=f.coordinateToPrice(w);if(!(p==null||P==null))if(!_)_=new nd({rawTime:U.rawTime,price:U.price},{rawTime:p,price:P}),f.attachPrimitive(_);else{_.p2={rawTime:p,price:P};try{d.applyOptions({})}catch{}}},C=h=>{const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top,p=d.timeScale().coordinateToTime(I),P=f.coordinateToPrice(w);if(p==null||P==null)return;if(!U){U={rawTime:p,price:P,normalizedTime:j(p)};return}if(_){try{f.detachPrimitive(_)}catch{}_=null}const Q=U.normalizedTime,L=j(p);if(Q==null||L==null)return;if(Math.abs(P-U.price)<1e-5){U=null;return}const b=new nd({rawTime:U.rawTime,price:U.price},{rawTime:p,price:P});f.attachPrimitive(b);const m={type:"fibonacci",primitive:b,p1:{rawTime:U.rawTime,normalizedTime:Q,price:U.price},p2:{rawTime:p,normalizedTime:L,price:P}};be(D=>[...D,m]),v.current.push(m),U=null,xe(null)};return O.addEventListener("mousemove",Z),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",Z),O.removeEventListener("click",C),_)try{f.detachPrimitive(_)}catch{}}}if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{d.removeSeries(F.current.series)}catch{}F.current=null}const X=U=>{if(U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const _=O.getBoundingClientRect(),Z=U.clientX-_.left,C=U.clientY-_.top;let h=d.timeScale().coordinateToTime(Z);const x=f.coordinateToPrice(C);if(h==null||x==null)return;const I=h;if(h=j(h),h!=null){if(T.current=!0,y.current={time:h,normalizedTime:h,rawTime:I,price:x},S.current=null,H==="rectangle"){const w=new qv({rawTime:I,price:x},{rawTime:I,price:x},{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 jv({rawTime:I,price:x},{rawTime:I,price:x},{strokeColor:"#7aa6ae",lineWidth:1});f.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new eT({rawTime:I,price:x},{rawTime:I,price:x},{rawTime:I,price:x},{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 tT({rawTime:I,price:x},{rawTime:I,price:x},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});f.attachPrimitive(w),F.current={type:"ellipse",primitive:w}}if(H==="parallellines"){const w=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},ie=U=>{if(!T.current||!y.current||!F.current)return;U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const _=O.getBoundingClientRect(),Z=U.clientX-_.left,C=U.clientY-_.top;let h=d.timeScale().coordinateToTime(Z);const x=f.coordinateToPrice(C);if(h==null||x==null)return;const I=h;if(h=j(h),h==null)return;S.current={time:h,normalizedTime:h,rawTime:I,price:x};const w=y.current;if(F.current.type==="rectangle"){const p=F.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:I,price:x};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const p=F.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:I,price:x};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const p=F.current.primitive,P=$(w,{time:h,rawTime:I,price:x});if(!P)return;p.p1={rawTime:P.p1.rawTime,price:P.p1.price},p.p2={rawTime:P.p2.rawTime,price:P.p2.price},p.p3={rawTime:P.p3.rawTime,price:P.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const p=F.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:I,price:x};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const p=F.current.firstLine;p.endTime-p.startTime;const P=p.endPrice-p.startPrice,Q=x,L=Q+P;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:L}]);else{const b=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});b.setData([{time:w.time,value:Q},{time:h,value:L}]),F.current.secondLine=b}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:x}])},le=U=>{if(U&&(U.preventDefault(),U.stopPropagation()),!T.current||!F.current||!y.current)return;const _=y.current,Z=S.current||_;if(F.current.type==="parallellines")if(F.current.firstLine){const C={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};be(h=>[...h,C]),v.current.push(C),xe(null),F.current=null,T.current=!1,y.current=null,S.current=null;return}else{F.current.firstLine={startTime:_.time,startPrice:_.price,endTime:Z.time,endPrice:Z.price},T.current=!1,y.current=null,S.current=null;return}if(F.current.type==="rectangle"){const C=y.current,h=S.current||C,x=Math.max(C.price,h.price),I=Math.min(C.price,h.price),w=j(Math.min(C.time,h.time)),p=j(Math.max(C.time,h.time));if(w!=null&&p!=null&&Math.abs(p-w)>=1&&Math.abs(x-I)>=1e-5){const P=F.current.primitive,Q=C.time<=h.time?C.rawTime:h.rawTime,L=C.time<=h.time?h.rawTime:C.rawTime,b={rawTime:Q,normalizedTime:w,price:x},m={rawTime:L,normalizedTime:p,price:I};P.p1={rawTime:b.rawTime,price:b.price},P.p2={rawTime:m.rawTime,price:m.price};const D={type:"rectangle",primitive:P,p1:b,p2:m};be(N=>[...N,D]),v.current.push(D),xe(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const C=F.current.primitive,h={rawTime:_.rawTime,normalizedTime:_.time,price:_.price},x={rawTime:Z.rawTime,normalizedTime:Z.time,price:Z.price},I=d.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),p=d.timeScale().timeToCoordinate(x.rawTime),P=f.priceToCoordinate(x.price);if((I!=null&&w!=null&&p!=null&&P!=null?Math.hypot(p-I,P-w):0)>=3){C.p1={rawTime:h.rawTime,price:h.price},C.p2={rawTime:x.rawTime,price:x.price};const L={type:"circle",primitive:C,p1:h,p2:x};be(b=>[...b,L]),v.current.push(L),xe(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const C=F.current.primitive,h=$(_,Z);if(h){const x=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(x>=1&&I>=1e-5){C.p1={rawTime:h.p1.rawTime,price:h.p1.price},C.p2={rawTime:h.p2.rawTime,price:h.p2.price},C.p3={rawTime:h.p3.rawTime,price:h.p3.price};const w={type:"triangle",primitive:C,p1:h.p1,p2:h.p2,p3:h.p3};be(p=>[...p,w]),v.current.push(w),xe(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const C=F.current.primitive,h={rawTime:_.rawTime,normalizedTime:_.time,price:_.price},x={rawTime:Z.rawTime,normalizedTime:Z.time,price:Z.price},I=d.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),p=d.timeScale().timeToCoordinate(x.rawTime),P=f.priceToCoordinate(x.price);if((I!=null&&w!=null&&p!=null&&P!=null?Math.hypot(p-I,P-w):0)>=4){C.p1={rawTime:h.rawTime,price:h.price},C.p2={rawTime:x.rawTime,price:x.price},C.previewAsLine=!1,C.minorRatio=.45;const L={type:"ellipse",primitive:C,p1:h,p2:x,minorRatio:.45};be(b=>[...b,L]),v.current.push(L),xe(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}T.current=!1,y.current=null,S.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const U={capture:!0,passive:!1},_=Z=>{T.current||Z.stopPropagation()};return O.addEventListener("mousedown",X,U),O.addEventListener("mousemove",ie,U),O.addEventListener("mousemove",_,U),O.addEventListener("mouseup",le,U),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null,T.current=!1,y.current=null,S.current=null,O.removeEventListener("mousedown",X,U),O.removeEventListener("mousemove",ie,U),O.removeEventListener("mousemove",_,U),O.removeEventListener("mouseup",le,U)}}},[Ce,ve,be,xe]),q.useEffect(()=>{const d=c.current,f=u.current,O=o.current,me=Ce===null||Ce===1;if(!me||!d||!f||!O){me||(M(null),V([]),re(null),Y([]));return}const H=10,$=8;function X(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const x=d.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=d.timeScale().timeToCoordinate(h.point2.time),p=f.priceToCoordinate(h.point2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="gannline"&&h.point1&&h.point2){const x=d.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=d.timeScale().timeToCoordinate(h.point2.time),p=f.priceToCoordinate(h.point2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:(x+w)/2,y:(I+p)/2},{x:w,y:p}]}if(h.type==="rectangle"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);if(x==null||I==null||w==null||p==null)return[];const P=Math.min(x,w),Q=Math.max(x,w),L=Math.min(I,p),b=Math.max(I,p),m=(P+Q)/2,D=(L+b)/2;return[{x:P,y:L},{x:m,y:L},{x:Q,y:L},{x:P,y:D},{x:Q,y:D},{x:P,y:b},{x:m,y:b},{x:Q,y:b}]}if(h.type==="circle"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price),P=d.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return x==null||I==null||w==null||p==null||P==null||Q==null?[]:[{x,y:I},{x:w,y:p},{x:P,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);if(x==null||I==null||w==null||p==null)return[];const P=(x+w)/2,Q=(I+p)/2,L=w-x,b=p-I,m=Math.hypot(L,b);if(m<.001)return[];const D=L/m,N=b/m,K=-N,W=D,G=m/2,ee=G*Math.max(.05,h.minorRatio??.45);return[{x:P-D*G,y:Q-N*G},{x:P+K*ee,y:Q+W*ee},{x:P+D*G,y:Q+N*G},{x:P-K*ee,y:Q-W*ee}]}if(h.type==="gannfan"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="rayline"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="extendedline"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="crossline"&&h.p){const x=d.timeScale().timeToCoordinate(h.p.rawTime),I=f.priceToCoordinate(h.p.price);return x==null||I==null?[]:[{x,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const x=f.priceToCoordinate(h.price);return x==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:x}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const x=d.timeScale().timeToCoordinate(h.rawTime),I=f.priceToCoordinate(h.price);return x==null||I==null?[]:[{x,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price),P=d.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return x==null||I==null||w==null||p==null||P==null||Q==null?[]:[{x,y:I},{x:w,y:p},{x:P,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price),P=d.timeScale().timeToCoordinate(h.b1.rawTime),Q=f.priceToCoordinate(h.b1.price),L=d.timeScale().timeToCoordinate(h.b2.rawTime),b=f.priceToCoordinate(h.b2.price);return x==null||I==null||w==null||p==null||P==null||Q==null||L==null||b==null?[]:[{x,y:I},{x:w,y:p},{x:(P+L)/2,y:(Q+b)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price),P=d.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),L=d.timeScale().timeToCoordinate(h.p4.rawTime),b=f.priceToCoordinate(h.p4.price);return x==null||I==null||w==null||p==null||P==null||Q==null||L==null||b==null?[]:[{x,y:I},{x:w,y:p},{x:P,y:Q},{x:L,y:b}]}if(h.type==="flattopbottom"&&h.p1&&h.p2&&h.p3&&h.p4){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price),P=d.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),L=d.timeScale().timeToCoordinate(h.p4.rawTime),b=f.priceToCoordinate(h.p4.price);return x==null||I==null||w==null||p==null||P==null||Q==null||L==null||b==null?[]:[{x,y:I},{x:w,y:p},{x:P,y:Q},{x:L,y:b}]}if(h.type==="infoline"&&h.p1&&h.p2){const x=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=d.timeScale().timeToCoordinate(x),p=f.priceToCoordinate(h.p1.price),P=d.timeScale().timeToCoordinate(I),Q=f.priceToCoordinate(h.p2.price);return w==null||p==null||P==null||Q==null?[]:[{x:w,y:p},{x:P,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:(x+w)/2,y:(I+p)/2},{x:w,y:p}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const x=d.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=d.timeScale().timeToCoordinate(h.p2.rawTime),p=f.priceToCoordinate(h.p2.price);return x==null||I==null||w==null||p==null?[]:[{x,y:I},{x:w,y:p}]}if(h.type==="horizontalray"&&h.primitive){const x=h.primitive,I=d.timeScale().timeToCoordinate(x.originTime),w=f.priceToCoordinate(x.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const x=h.primitive,I=d.timeScale().timeToCoordinate(x.time);if(I==null)return[];const w=x.midYCss??200;return[{x:I,y:w}]}return[]}function ie(h,x){for(let I=Ke.length-1;I>=0;I--){const w=Ke[I];if(w.type==="trendline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),P=f.priceToCoordinate(w.point1.price),Q=d.timeScale().timeToCoordinate(w.point2.time),L=f.priceToCoordinate(w.point2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-p,x-P),m=Math.hypot(h-Q,x-L);if(b<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ht(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),P=f.priceToCoordinate(w.point1.price),Q=d.timeScale().timeToCoordinate(w.point2.time),L=f.priceToCoordinate(w.point2.price);if(p==null||P==null||Q==null||L==null)continue;const b=(p+Q)/2,m=(P+L)/2,D=Math.hypot(h-p,x-P),N=Math.hypot(h-Q,x-L),K=Math.hypot(h-b,x-m);if(D<H)return{object:w,mode:"handle1"};if(N<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"line"};if(ht(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.min(p,Q),m=Math.max(p,Q),D=Math.min(P,L),N=Math.max(P,L),K=(b+m)/2,W=(D+N)/2,G=[{x:b,y:D,mode:"handle1"},{x:K,y:D,mode:"handle2"},{x:m,y:D,mode:"handle3"},{x:b,y:W,mode:"handle4"},{x:m,y:W,mode:"handle5"},{x:b,y:N,mode:"handle6"},{x:K,y:N,mode:"handle7"},{x:m,y:N,mode:"handle8"}];for(const Ee of G)if(Math.hypot(h-Ee.x,x-Ee.y)<H)return{object:w,mode:Ee.mode};const ee=ht(h,x,b,D,m,D),ue=ht(h,x,b,N,m,N),ge=ht(h,x,b,D,b,N),Qe=ht(h,x,m,D,m,N);if(ee<$||ue<$||ge<$||Qe<$||mi(h,x,[{x:b,y:D},{x:m,y:D},{x:m,y:N},{x:b,y:N}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(Q-p,L-P);if(b<2)continue;const m=Math.hypot(h-p,x-P),D=Math.hypot(h-Q,x-L);if(m<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(m-b)<$||m<b)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(p==null||P==null||Q==null||L==null||b==null||m==null)continue;const D=Math.hypot(h-p,x-P),N=Math.hypot(h-Q,x-L),K=Math.hypot(h-b,x-m);if(D<H)return{object:w,mode:"handle1"};if(N<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=ht(h,x,p,P,Q,L),G=ht(h,x,Q,L,b,m),ee=ht(h,x,b,m,p,P);if(W<$||G<$||ee<$||mi(h,x,[{x:p,y:P},{x:Q,y:L},{x:b,y:m}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=(p+Q)/2,m=(P+L)/2,D=Q-p,N=L-P,K=Math.hypot(D,N);if(K<2)continue;const W=D/K,G=N/K,ee=-G,ue=W,ge=K/2,Qe=ge*Math.max(.05,w.minorRatio??.45);if(ge<2||Qe<2)continue;const Ee=b-W*ge,We=m-G*ge,je=b+ee*Qe,Ve=m+ue*Qe,Bt=b+W*ge,pt=m+G*ge,yt=b-ee*Qe,Dt=m-ue*Qe,qt=Math.hypot(h-Ee,x-We),iA=Math.hypot(h-je,x-Ve),cA=Math.hypot(h-Bt,x-pt),JA=Math.hypot(h-yt,x-Dt);if(qt<H)return{object:w,mode:"handle1"};if(iA<H)return{object:w,mode:"handle2"};if(cA<H)return{object:w,mode:"handle3"};if(JA<H)return{object:w,mode:"handle4"};const Di=(h-b)*W+(x-m)*G,zs=(h-b)*ee+(x-m)*ue,Qd=Di/ge,Fd=zs/Qe,Ud=Qd*Qd+Fd*Fd;if(Math.abs(Ud-1)<.2||Ud<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-Q,x-L),m=Math.hypot(h-p,x-P);if(b<H)return{object:w,mode:"handle2"};if(m<H)return{object:w,mode:"handle1"};if(ht(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-Q,x-L),m=Math.hypot(h-p,x-P);if(b<H)return{object:w,mode:"handle2"};if(m<H)return{object:w,mode:"handle1"};if(ht(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-p,x-P),m=Math.hypot(h-Q,x-L);if(b<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ht(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-p,x-P),m=Math.hypot(h-Q,x-L);if(b<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(fT(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-p,x-P),m=Math.hypot(h-Q,x-L);if(b<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(mT(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const p=d.timeScale().timeToCoordinate(w.p.rawTime),P=f.priceToCoordinate(w.p.price);if(p==null||P==null)continue;if(Math.hypot(h-p,x-P)<H)return{object:w,mode:"handle1"};const L=Math.abs(x-P),b=Math.abs(h-p);if(L<$||b<$)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const p=d.timeScale().timeToCoordinate(w.rawTime),P=f.priceToCoordinate(w.price);if(p==null||P==null)continue;const Q=od(w,p,P);if(h>=Q.left&&h<=Q.right&&x>=Q.top&&x<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-p,x-P),m=Math.hypot(h-Q,x-L);if(b<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ht(h,x,p,P,Q,L)<$)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),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.b1.rawTime),m=f.priceToCoordinate(w.b1.price),D=d.timeScale().timeToCoordinate(w.b2.rawTime),N=f.priceToCoordinate(w.b2.price),K=b!=null&&D!=null?(b+D)/2:null,W=m!=null&&N!=null?(m+N)/2:null;if(p==null||P==null||Q==null||L==null||K==null||W==null||b==null||m==null||D==null||N==null)continue;const G=Math.hypot(h-p,x-P),ee=Math.hypot(h-Q,x-L),ue=Math.hypot(h-K,x-W),ge=Math.hypot(p-K,P-W)<H*1.5;if(ge&&Math.min(G,ue)<H*1.5)return{object:w,mode:"handle3"};if(ue<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle2"};if(ge)continue;if(G<H)return{object:w,mode:"handle1"};const Qe=ht(h,x,p,P,Q,L),Ee=ht(h,x,b,m,D,N);if(Qe<$||Ee<$||mi(h,x,[{x:p,y:P},{x:Q,y:L},{x:D,y:N},{x:b,y:m}]))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),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),D=d.timeScale().timeToCoordinate(w.top2.rawTime),N=f.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=f.priceToCoordinate(w.bot1.price),G=d.timeScale().timeToCoordinate(w.bot2.rawTime),ee=f.priceToCoordinate(w.bot2.price);if(p==null||P==null||Q==null||L==null||b==null||m==null||D==null||N==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-p,x-P),ge=Math.hypot(h-Q,x-L);if(ue<H)return{object:w,mode:"handle1"};if(ge<H)return{object:w,mode:"handle2"};const Qe=ht(h,x,p,P,Q,L),Ee=ht(h,x,b,m,D,N),We=ht(h,x,K,W,G,ee);if(Qe<$||Ee<$||We<$||mi(h,x,[{x:b,y:m},{x:D,y:N},{x:G,y:ee},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),D=d.timeScale().timeToCoordinate(w.top2.rawTime),N=f.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=f.priceToCoordinate(w.bot1.price),G=d.timeScale().timeToCoordinate(w.bot2.rawTime),ee=f.priceToCoordinate(w.bot2.price);if(p==null||P==null||Q==null||L==null||b==null||m==null||D==null||N==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-p,x-P),ge=Math.hypot(h-Q,x-L);if(ue<H)return{object:w,mode:"handle1"};if(ge<H)return{object:w,mode:"handle2"};const Qe=ht(h,x,p,P,Q,L),Ee=ht(h,x,b,m,D,N),We=ht(h,x,K,W,G,ee);if(Qe<$||Ee<$||We<$||mi(h,x,[{x:b,y:m},{x:D,y:N},{x:G,y:ee},{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),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(p==null||P==null||Q==null||L==null||b==null||m==null)continue;const D=Math.hypot(h-p,x-P),N=Math.hypot(h-Q,x-L),K=Math.hypot(h-b,x-m);if(D<H)return{object:w,mode:"handle1"};if(N<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=(Q+b)/2,G=(L+m)/2;let ee=W-p,ue=G-P;Math.abs(ee)<1e-4&&(ee=1e-4);const ge=ue/ee,Qe=O.clientWidth,Ee=L+ge*(Qe-Q),We=m+ge*(Qe-b),je=ht(h,x,Q,L,Qe,Ee),Ve=ht(h,x,b,m,Qe,We);if(je<$||Ve<$||mi(h,x,[{x:Q,y:L},{x:Qe,y:Ee},{x:Qe,y:We},{x:b,y:m}]))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),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),D=d.timeScale().timeToCoordinate(w.p4.rawTime),N=f.priceToCoordinate(w.p4.price);if(p==null||P==null||Q==null||L==null||b==null||m==null||D==null||N==null)continue;const K=Math.hypot(h-p,x-P),W=Math.hypot(h-Q,x-L),G=Math.hypot(h-b,x-m),ee=Math.hypot(h-D,x-N);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle4"};const ue=ht(h,x,p,P,b,m),ge=ht(h,x,Q,L,D,N),Qe=ht(h,x,p,P,Q,L),Ee=ht(h,x,b,m,D,N);if(ue<$||ge<$||Qe<$||Ee<$||mi(h,x,[{x:p,y:P},{x:b,y:m},{x:D,y:N},{x:Q,y:L}]))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),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),D=d.timeScale().timeToCoordinate(w.p4.rawTime),N=f.priceToCoordinate(w.p4.price);if(p==null||P==null||Q==null||L==null||b==null||m==null||D==null||N==null)continue;const K=Math.hypot(h-p,x-P),W=Math.hypot(h-Q,x-L),G=Math.hypot(h-b,x-m),ee=Math.hypot(h-D,x-N);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle4"};const ue=ht(h,x,p,P,b,m),ge=ht(h,x,Q,L,D,N),Qe=ht(h,x,p,P,Q,L),Ee=ht(h,x,b,m,D,N);if(ue<$||ge<$||Qe<$||Ee<$||mi(h,x,[{x:p,y:P},{x:b,y:m},{x:D,y:N},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=(p+Q)/2,m=(P+L)/2,D=Math.hypot(h-p,x-P),N=Math.hypot(h-Q,x-L),K=Math.hypot(h-b,x-m);if(D<H)return{object:w,mode:"handle1"};if(N<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"line"};if(ht(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const p=w.p1.rawTime??w.p1.time,P=w.p2.rawTime??w.p2.time,Q=d.timeScale().timeToCoordinate(p),L=f.priceToCoordinate(w.p1.price),b=d.timeScale().timeToCoordinate(P),m=f.priceToCoordinate(w.p2.price);if(Q==null||L==null||b==null||m==null)continue;const D=Math.hypot(h-Q,x-L),N=Math.hypot(h-b,x-m);if(D<H)return{object:w,mode:"handle1"};if(N<H)return{object:w,mode:"handle2"};if(ht(h,x,Q,L,b,m)<$)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),P=f.priceToCoordinate(w.p1.price),Q=d.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(p==null||P==null||Q==null||L==null)continue;const b=Math.hypot(h-p,x-P),m=Math.hypot(h-Q,x-L);if(b<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ht(h,x,p,P,Q,L)<$)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const p=w.primitive,P=d.timeScale().timeToCoordinate(p.originTime),Q=f.priceToCoordinate(p.price);if(Q==null)continue;if(P!=null&&Math.hypot(h-P,x-Q)<H)return{object:w,mode:"handle1"};const L=P==null?0:Math.max(0,P);if(h>=L&&Math.abs(x-Q)<$)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const p=w.primitive,P=d.timeScale().timeToCoordinate(p.time);if(P==null)continue;const Q=p.midYCss??200;if(Math.hypot(h-P,x-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-P)<$)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const p=f.priceToCoordinate(w.price);if(p==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,x-p)<H)return{object:w,mode:"line"};if(Math.abs(x-p)<$)return{object:w,mode:"line"}}}return null}const le=h=>{const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top,p=ie(I,w);if(p){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,ne(p.object),te.current=null,oe.current=null;return}M(p.object),re(null),Y([]),te.current=p.mode,p.object.type==="rayline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="extendedline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="crossline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:I,y:w,p:{...p.object.p}}),p.object.type==="text"&&p.mode==="line"&&(oe.current={x:I,y:w,rawTime:p.object.rawTime,price:p.object.price}),p.object.type==="trendbyangle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:I,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:I,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:I,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:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="stddevchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:I,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:I,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:I,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:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="gannfan"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="ganngrid"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:I,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:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="circle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:I,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:I,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:I,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:I,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:I,y:w,time:p.object.primitive.time}),p.mode==="line"&&(p.object.type==="rulerline"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="infoline"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="arrowedline"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rayline"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="extendedline"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="crossline"?oe.current={x:I,y:w,p:{...p.object.p}}:p.object.type==="text"?oe.current={x:I,y:w,rawTime:p.object.rawTime,price:p.object.price}:p.object.type==="trendbyangle"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="equidistantchannel"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="andrewspitchfork"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="regressionchannel"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="stddevchannel"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="disjointchannel"?oe.current={x:I,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:I,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:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="gannfan"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rectangle"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="circle"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="triangle"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="ellipse"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}:p.object.type==="ganngrid"?oe.current={x:I,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="horizontalray"?oe.current={x:I,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}:p.object.type==="verticalline"?oe.current={x:I,y:w,time:p.object.primitive.time}:p.object.type==="pricelevel"?oe.current={y:w,price:p.object.price}:oe.current={x:I,y:w,point1:{...p.object.point1},point2:{...p.object.point2}})}else M(null),te.current=null,V([]),re(null),Y([])},U=h=>{const x=O.getBoundingClientRect(),I=h.clientX-x.left,w=h.clientY-x.top;if(!te.current){const b=ie(I,w);if(b?.object&&!ce.current){const m=X(b.object);re(D=>D===b.object?D:b.object),Y(D=>D.length===m.length&&D.every((N,K)=>N.x===m[K].x&&N.y===m[K].y)?D:m)}else re(m=>m==null?m:null),Y(m=>m.length===0?m:[]);return}const p=ce.current;if(!p)return;const P=d.timeScale().coordinateToTime(I),Q=f.coordinateToPrice(w);if(P==null||Q==null)return;let L=j(P);if(L!=null){if(p.type==="infoline"&&p.p1&&p.p2){const b=K=>{const W=K.rawTime??K.time,G=K.normalizedTime??j(W);return{rawTime:W,normalizedTime:G,price:K.price}},m=(K,W)=>{const G=K.normalizedTime??j(K.rawTime),ee=W.normalizedTime??j(W.rawTime);if(G==null||ee==null)return;const ue=W.price-K.price,ge=ue/Math.abs(K.price)*100,Qe=hA(pe)||3600,Ee=Math.abs(ee-G),We=Math.max(1,Math.round(Ee/Qe)),je=Math.max(1,Math.round(Ee/86400)),Ve=d.timeScale().timeToCoordinate(K.rawTime),Bt=f.priceToCoordinate(K.price),pt=d.timeScale().timeToCoordinate(W.rawTime),yt=f.priceToCoordinate(W.price),Dt=Ve!=null&&Bt!=null&&pt!=null&&yt!=null?Math.atan2(-(yt-Bt),pt-Ve)*(180/Math.PI):p.primitive?.info?.angle??0,qt={priceDiff:ue,pricePct:ge,bars:We,days:je,angle:Dt},iA=p.primitive;if(iA){iA.p1={rawTime:K.rawTime,price:K.price},iA.p2={rawTime:W.rawTime,price:W.price},iA.info=qt;try{c.current?.applyOptions({})}catch{}}const cA={...p,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:G,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:ee,price:W.price}};be(JA=>{const Di=JA.map(zs=>zs===p?cA:zs);return v.current=Di,Di}),M(cA),ce.current=cA,Ve!=null&&Bt!=null&&pt!=null&&yt!=null&&V([{x:Ve,y:Bt},{x:pt,y:yt}])},D=b(p.p1),N=b(p.p2);if(D.rawTime==null||D.normalizedTime==null||N.rawTime==null||N.normalizedTime==null)return;if(te.current==="handle1"){const K=d.timeScale().coordinateToTime(I)??P;m({rawTime:K,normalizedTime:L,price:Q},N)}else if(te.current==="handle2"){const K=d.timeScale().coordinateToTime(I)??P;m(D,{rawTime:K,normalizedTime:L,price:Q})}else if(te.current==="line"){const K=oe.current;if(!K)return;const W=b(K.p1),G=b(K.p2);if(W.rawTime==null||W.normalizedTime==null||G.rawTime==null||G.normalizedTime==null)return;const ee=d.timeScale().coordinateToTime(K.x)??W.rawTime,ue=f.coordinateToPrice(K.y);if(ee==null||ue==null)return;const ge=j(ee)??W.normalizedTime;if(ge==null)return;const Qe=L-ge,Ee=Q-ue,We=j(W.normalizedTime+Qe),je=j(G.normalizedTime+Qe);if(We==null||je==null)return;const Ve=P-ee;m({rawTime:W.rawTime+Ve,normalizedTime:We,price:W.price+Ee},{rawTime:G.rawTime+Ve,normalizedTime:je,price:G.price+Ee})}return}if(p.type==="rulerline"&&p.p1&&p.p2){const b=(m,D)=>{const N=m.normalizedTime??m.rawTime,K=D.normalizedTime??D.rawTime,W=D.price-m.price,G=W/Math.abs(m.price)*100,ee=Ns(Ks,m.rawTime,D.rawTime,pe),ue=Math.abs(K-N),ge=Math.max(1,Math.round(ue/86400)),Qe={priceDiff:W,pricePct:G,bars:ee,days:ge},Ee=p.primitive;if(Ee){Ee.p1={rawTime:m.rawTime,price:m.price},Ee.p2={rawTime:D.rawTime,price:D.price},Ee.info=Qe;const yt=D.price>=m.price;Ee.color=yt?"#3b82f6":"#ef5350",Ee.fillColor=yt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const We={...p,rawP1Time:m.rawTime,rawP2Time:D.rawTime,p1:m,p2:D};be(yt=>{const Dt=yt.map(qt=>qt===p?We:qt);return v.current=Dt,Dt}),M(We),ce.current=We;const je=d.timeScale().timeToCoordinate(m.rawTime),Ve=f.priceToCoordinate(m.price),Bt=d.timeScale().timeToCoordinate(D.rawTime),pt=f.priceToCoordinate(D.price);je!=null&&Ve!=null&&Bt!=null&&pt!=null&&V([{x:je,y:Ve},{x:(je+Bt)/2,y:(Ve+pt)/2},{x:Bt,y:pt}])};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q})}else if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="arrowedline"&&p.p1&&p.p2){const b=(m,D)=>{const N=p.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:D};be(ge=>{const Qe=ge.map(Ee=>Ee===p?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=d.timeScale().timeToCoordinate(m.rawTime),G=f.priceToCoordinate(m.price),ee=d.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q})}else if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="rayline"&&p.p1&&p.p2){const b=(m,D)=>{const N=p.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:D};be(ge=>{const Qe=ge.map(Ee=>Ee===p?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=d.timeScale().timeToCoordinate(m.rawTime),G=f.priceToCoordinate(m.price),ee=d.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;const D=j(m);if(D==null)return;b(p.p1,{rawTime:m,normalizedTime:D,price:Q})}else if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="extendedline"&&p.p1&&p.p2){const b=(m,D)=>{const N=p.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:D};be(ge=>{const Qe=ge.map(Ee=>Ee===p?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=d.timeScale().timeToCoordinate(m.rawTime),G=f.priceToCoordinate(m.price),ee=d.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q})}else if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="crossline"&&p.p){const b=D=>{const N=p.primitive;if(N){N.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p:D};be(ee=>{const ue=ee.map(ge=>ge===p?K:ge);return v.current=ue,ue}),M(K),ce.current=K;const W=d.timeScale().timeToCoordinate(D.rawTime),G=f.priceToCoordinate(D.price);W!=null&&G!=null&&V([{x:W,y:G}])},m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q});return}if(p.type==="pricelevel"&&p.price!=null){const b=f.coordinateToPrice(w);if(b==null)return;try{p.priceLine.applyOptions({price:b,title:b.toFixed(5)})}catch{}p.textPrimitive&&(p.textPrimitive.price=b);const m=c.current?c.current.paneSize().width:400,D=f.priceToCoordinate(b);D!=null&&V([{x:m/2,y:D}]);const N={...p,price:b};be(K=>{const W=K.map(G=>G===p?N:G);return v.current=W,W}),M(N),ce.current=N;return}if(p.type==="text"){const b=d.timeScale().coordinateToTime(I);if(b==null)return;const m=p.primitive;if(m){m.rawTime=b,m.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...p,rawTime:b,price:Q};be(N=>{const K=N.map(W=>W===p?D:W);return v.current=K,K}),M(D),ce.current=D;return}if(p.type==="trendbyangle"&&p.p1&&p.p2){const b=(m,D)=>{const N=p.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:D};be(ge=>{const Qe=ge.map(Ee=>Ee===p?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=d.timeScale().timeToCoordinate(m.rawTime),G=f.priceToCoordinate(m.price),ee=d.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"||te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="equidistantchannel"&&p.p1&&p.p2&&p.p3){const b=(m,D,N)=>{const K=ld(m,D,N);if(!K)return;const W=p.primitive;if(W){W.p1={rawTime:m.rawTime,price:m.price},W.p2={rawTime:D.rawTime,price:D.price},W.b1={rawTime:K.b1.rawTime,price:K.b1.price},W.b2={rawTime:K.b2.rawTime,price:K.b2.price},W.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const G={...p,p1:m,p2:D,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};be(ee=>{const ue=ee.map(ge=>ge===p?G:ge);return v.current=ue,ue}),M(G),ce.current=G};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2,p.p3);return}if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q},p.p3);return}if(te.current==="handle3"){b(p.p1,p.p2,{rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??j(p.p3.rawTime),price:Q});return}if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K),ue=j(m.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const ge=P-D;b({rawTime:m.p1.rawTime+ge,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ge,normalizedTime:ee,price:m.p2.price+W},{rawTime:m.p3.rawTime+ge,normalizedTime:ue,price:m.p3.price+W});return}}if(p.type==="regressionchannel"&&p.p1&&p.p2){const b=(m,D)=>{const N=ir(ve,m,D,p.stdMultiplier??1);if(!N)return;const K=p.primitive;if(K){K.mid1={rawTime:N.p1.rawTime,price:N.p1.price},K.mid2={rawTime:N.p2.rawTime,price:N.p2.price},K.top1={rawTime:N.top1.rawTime,price:N.top1.price},K.top2={rawTime:N.top2.rawTime,price:N.top2.price},K.bot1={rawTime:N.bot1.rawTime,price:N.bot1.price},K.bot2={rawTime:N.bot2.rawTime,price:N.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:N.p1,p2:N.p2,top1:N.top1,top2:N.top2,bot1:N.bot1,bot2:N.bot2,slope:N.slope,intercept:N.intercept,stdDev:N.stdDev,offset:N.offset,barCount:N.barCount};be(G=>{const ee=G.map(ue=>ue===p?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L},p.p2);return}if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L});return}if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W});return}}if(p.type==="stddevchannel"&&p.p1&&p.p2){const b=(m,D)=>{const N=Xr(ve,m,D,p.stdMultiplier??1);if(!N)return;const K=p.primitive;if(K){K.mid1={rawTime:N.p1.rawTime,price:N.p1.price},K.mid2={rawTime:N.p2.rawTime,price:N.p2.price},K.top1={rawTime:N.top1.rawTime,price:N.top1.price},K.top2={rawTime:N.top2.rawTime,price:N.top2.price},K.bot1={rawTime:N.bot1.rawTime,price:N.bot1.price},K.bot2={rawTime:N.bot2.rawTime,price:N.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:N.p1,p2:N.p2,top1:N.top1,top2:N.top2,bot1:N.bot1,bot2:N.bot2,slope:N.slope,stdDev:N.stdDev,offset:N.offset,barCount:N.barCount};be(G=>{const ee=G.map(ue=>ue===p?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L},p.p2);return}if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L});return}if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W});return}}if(p.type==="andrewspitchfork"&&p.p1&&p.p2&&p.p3){const b=(m,D,N)=>{const K=p.primitive;if(K){K.p1={rawTime:m.rawTime,price:m.price},K.p2={rawTime:D.rawTime,price:D.price},K.p3={rawTime:N.rawTime,price:N.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:m,p2:D,p3:N};be(G=>{const ee=G.map(ue=>ue===p?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2,p.p3);return}if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q},p.p3);return}if(te.current==="handle3"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,p.p2,{rawTime:m,normalizedTime:L,price:Q});return}if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K),ue=j(m.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const ge=P-D;b({rawTime:m.p1.rawTime+ge,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ge,normalizedTime:ee,price:m.p2.price+W},{rawTime:m.p3.rawTime+ge,normalizedTime:ue,price:m.p3.price+W});return}}if(p.type==="disjointchannel"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,G,ee,ue)=>{const ge=p.primitive;if(ge){ge.p1={rawTime:W.rawTime,price:W.price},ge.p2={rawTime:G.rawTime,price:G.price},ge.p3={rawTime:ee.rawTime,price:ee.price},ge.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Qe={...p,p1:W,p2:G,p3:ee,p4:ue};be(Ee=>{const We=Ee.map(je=>je===p?Qe:je);return v.current=We,We}),M(Qe),ce.current=Qe},m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(I);if(D==null)return;const N=j(D);if(N==null)return;const K=(W,G,ee,ue)=>{const ge=W.normalizedTime??j(W.rawTime);if(ge==null)return null;const Qe=j(ge+ee);return Qe==null?null:{rawTime:W.rawTime+G,normalizedTime:Qe,price:W.price+ue}};if(te.current==="line"){const W=d.timeScale().coordinateToTime(m.x),G=f.coordinateToPrice(m.y);if(W==null||G==null)return;const ee=j(W);if(ee==null)return;const ue=D-W,ge=N-ee,Qe=Q-G,Ee=K(m.p1,ue,ge,Qe),We=K(m.p2,ue,ge,Qe),je=K(m.p3,ue,ge,Qe),Ve=K(m.p4,ue,ge,Qe);if(!Ee||!We||!je||!Ve)return;b(Ee,We,je,Ve);return}if(te.current==="handle1"){const W=(m.p1.price+m.p2.price)/2,G={rawTime:D,normalizedTime:N,price:Q},ee={rawTime:D,normalizedTime:N,price:2*W-Q};b(G,ee,m.p3,m.p4);return}if(te.current==="handle3"){const W=(m.p3.price+m.p4.price)/2,G={rawTime:D,normalizedTime:N,price:Q},ee={rawTime:D,normalizedTime:N,price:2*W-Q};b(m.p1,m.p2,G,ee);return}if(te.current==="handle2"){const W=(m.p1.price+m.p2.price)/2,G={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??j(m.p1.rawTime),price:Q};if(G.normalizedTime==null)return;const ee={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??j(m.p1.rawTime),price:2*W-Q};if(ee.normalizedTime==null)return;b(ee,G,m.p3,m.p4);return}if(te.current==="handle4"){const W=Q-m.p4.price,G={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??j(m.p3.rawTime),price:m.p4.price+W};if(G.normalizedTime==null)return;const ee={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??j(m.p1.rawTime),price:m.p2.price+W};if(ee.normalizedTime==null)return;b(m.p1,ee,m.p3,G);return}}if(p.type==="flattopbottom"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,G,ee,ue)=>{const ge=p.primitive;if(ge){ge.p1={rawTime:W.rawTime,price:W.price},ge.p2={rawTime:G.rawTime,price:G.price},ge.p3={rawTime:ee.rawTime,price:ee.price},ge.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Qe={...p,p1:W,p2:G,p3:ee,p4:ue};be(Ee=>{const We=Ee.map(je=>je===p?Qe:je);return v.current=We,We}),M(Qe),ce.current=Qe},m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(I);if(D==null)return;const N=j(D);if(N==null)return;const K=(W,G,ee,ue)=>{const ge=W.normalizedTime??j(W.rawTime);if(ge==null)return null;const Qe=j(ge+ee);return Qe==null?null:{rawTime:W.rawTime+G,normalizedTime:Qe,price:W.price+ue}};if(te.current==="line"){const W=d.timeScale().coordinateToTime(m.x),G=f.coordinateToPrice(m.y);if(W==null||G==null)return;const ee=j(W);if(ee==null)return;const ue=D-W,ge=N-ee,Qe=Q-G,Ee=K(m.p1,ue,ge,Qe),We=K(m.p2,ue,ge,Qe),je=K(m.p3,ue,ge,Qe),Ve=K(m.p4,ue,ge,Qe);if(!Ee||!We||!je||!Ve)return;b(Ee,We,je,Ve);return}if(te.current==="handle1"){const W={rawTime:D,normalizedTime:N,price:Q},G={rawTime:D,normalizedTime:N,price:m.p2.price};b(W,G,m.p3,m.p4);return}if(te.current==="handle3"){const W={rawTime:D,normalizedTime:N,price:Q},G={rawTime:D,normalizedTime:N,price:m.p4.price};b(m.p1,m.p2,W,G);return}if(te.current==="handle2"||te.current==="handle4"){const W=te.current==="handle2"?m.p2:m.p4,G=Q-W.price,ee={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??j(m.p1.rawTime),price:m.p2.price+G},ue={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??j(m.p3.rawTime),price:m.p4.price+G};if(ee.normalizedTime==null||ue.normalizedTime==null)return;b(m.p1,ee,m.p3,ue);return}}if(p.type==="fibonacci"&&p.p1&&p.p2){const b=(m,D)=>{const N=p.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:D};be(W=>{const G=W.map(ee=>ee===p?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q})}else if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="rectangle"&&p.p1&&p.p2){const b=(pt,yt)=>{const Dt=p.primitive;if(Dt){Dt.p1={rawTime:pt.rawTime,price:pt.price},Dt.p2={rawTime:yt.rawTime,price:yt.price};try{c.current?.applyOptions({})}catch{}}const qt={...p,p1:pt,p2:yt};be(iA=>{const cA=iA.map(JA=>JA===p?qt:JA);return v.current=cA,cA}),M(qt),ce.current=qt},m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(I);if(D==null)return;const N=j(D);if(N==null)return;if(te.current==="line"){const pt=d.timeScale().coordinateToTime(m.x),yt=f.coordinateToPrice(m.y);if(pt==null||yt==null)return;const Dt=j(pt);if(Dt==null)return;const qt=N-Dt,iA=Q-yt,cA=j(m.p1.normalizedTime+qt),JA=j(m.p2.normalizedTime+qt);if(cA==null||JA==null)return;const Di=P-pt;b({rawTime:m.p1.rawTime+Di,normalizedTime:cA,price:m.p1.price+iA},{rawTime:m.p2.rawTime+Di,normalizedTime:JA,price:m.p2.price+iA});return}const K=Math.min(m.p1.normalizedTime,m.p2.normalizedTime),W=Math.max(m.p1.normalizedTime,m.p2.normalizedTime),G=Math.max(m.p1.price,m.p2.price),ee=Math.min(m.p1.price,m.p2.price),ue=m.p1.normalizedTime<=m.p2.normalizedTime?m.p1.rawTime:m.p2.rawTime,ge=m.p1.normalizedTime<=m.p2.normalizedTime?m.p2.rawTime:m.p1.rawTime;let Qe=K,Ee=W,We=G,je=ee,Ve=ue,Bt=ge;if((te.current==="handle1"||te.current==="handle4"||te.current==="handle6")&&(Qe=N,Ve=D),(te.current==="handle3"||te.current==="handle5"||te.current==="handle8")&&(Ee=N,Bt=D),(te.current==="handle1"||te.current==="handle2"||te.current==="handle3")&&(We=Q),(te.current==="handle6"||te.current==="handle7"||te.current==="handle8")&&(je=Q),Qe>Ee){const pt=Qe,yt=Ve;Qe=Ee,Ve=Bt,Ee=pt,Bt=yt}if(We<je){const pt=We;We=je,je=pt}b({rawTime:Ve,normalizedTime:Qe,price:We},{rawTime:Bt,normalizedTime:Ee,price:je});return}if(p.type==="circle"&&p.p1&&p.p2){const b=(We,je)=>{const Ve=p.primitive;if(Ve){Ve.p1={rawTime:We.rawTime,price:We.price},Ve.p2={rawTime:je.rawTime,price:je.price};try{c.current?.applyOptions({})}catch{}}const Bt={...p,p1:We,p2:je};be(pt=>{const yt=pt.map(Dt=>Dt===p?Bt:Dt);return v.current=yt,yt}),M(Bt),ce.current=Bt},m=d.timeScale().coordinateToTime(I);if(m==null)return;const D=j(m);if(D==null)return;if(te.current==="handle2"){b(p.p1,{rawTime:m,normalizedTime:D,price:Q});return}const N=oe.current;if(!N)return;const K=d.timeScale().coordinateToTime(N.x),W=f.coordinateToPrice(N.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=D-G,ue=Q-W,ge=j(N.p1.normalizedTime+ee),Qe=j(N.p2.normalizedTime+ee);if(ge==null||Qe==null)return;const Ee=P-K;b({rawTime:N.p1.rawTime+Ee,normalizedTime:ge,price:N.p1.price+ue},{rawTime:N.p2.rawTime+Ee,normalizedTime:Qe,price:N.p2.price+ue});return}if(p.type==="triangle"&&p.p1&&p.p2&&p.p3){const b=(Ve,Bt,pt)=>{const yt=p.primitive;if(yt){yt.p1={rawTime:Ve.rawTime,price:Ve.price},yt.p2={rawTime:Bt.rawTime,price:Bt.price},yt.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const Dt={...p,p1:Ve,p2:Bt,p3:pt};be(qt=>{const iA=qt.map(cA=>cA===p?Dt:cA);return v.current=iA,iA}),M(Dt),ce.current=Dt},m=d.timeScale().coordinateToTime(I);if(m==null)return;const D=j(m);if(D==null)return;if(te.current==="handle1"){b({rawTime:m,normalizedTime:D,price:Q},p.p2,p.p3);return}if(te.current==="handle2"){b(p.p1,{rawTime:m,normalizedTime:D,price:Q},p.p3);return}if(te.current==="handle3"){b(p.p1,p.p2,{rawTime:m,normalizedTime:D,price:Q});return}const N=oe.current;if(!N)return;const K=d.timeScale().coordinateToTime(N.x),W=f.coordinateToPrice(N.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=D-G,ue=Q-W,ge=P-K,Qe=Ve=>{const Bt=Ve.normalizedTime??j(Ve.rawTime);if(Bt==null)return null;const pt=j(Bt+ee);return pt==null?null:{rawTime:Ve.rawTime+ge,normalizedTime:pt,price:Ve.price+ue}},Ee=Qe(N.p1),We=Qe(N.p2),je=Qe(N.p3);if(!Ee||!We||!je)return;b(Ee,We,je);return}if(p.type==="ellipse"&&p.p1&&p.p2){const b=(K,W,G=p.minorRatio??.45)=>{const ee=p.primitive;if(ee){ee.p1={rawTime:K.rawTime,price:K.price},ee.p2={rawTime:W.rawTime,price:W.price},ee.minorRatio=Math.max(.05,G);try{c.current?.applyOptions({})}catch{}}const ue={...p,p1:K,p2:W,minorRatio:Math.max(.05,G)};be(ge=>{const Qe=ge.map(Ee=>Ee===p?ue:Ee);return v.current=Qe,Qe}),M(ue),ce.current=ue},m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(I);if(D==null)return;const N=j(D);if(N==null)return;if(te.current==="line"){const K=d.timeScale().coordinateToTime(m.x),W=f.coordinateToPrice(m.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=N-G,ue=Q-W,ge=j(m.p1.normalizedTime+ee),Qe=j(m.p2.normalizedTime+ee);if(ge==null||Qe==null)return;const Ee=P-K;b({rawTime:m.p1.rawTime+Ee,normalizedTime:ge,price:m.p1.price+ue},{rawTime:m.p2.rawTime+Ee,normalizedTime:Qe,price:m.p2.price+ue},m.minorRatio??p.minorRatio??.45);return}if(te.current==="handle1"){b({rawTime:D,normalizedTime:N,price:Q},p.p2,p.minorRatio??.45);return}if(te.current==="handle3"){b(p.p1,{rawTime:D,normalizedTime:N,price:Q},p.minorRatio??.45);return}if(te.current==="handle2"||te.current==="handle4"){const K=d.timeScale().timeToCoordinate(p.p1.rawTime),W=f.priceToCoordinate(p.p1.price),G=d.timeScale().timeToCoordinate(p.p2.rawTime),ee=f.priceToCoordinate(p.p2.price);if(K==null||W==null||G==null||ee==null)return;const ue=(K+G)/2,ge=(W+ee)/2,Qe=G-K,Ee=ee-W,We=Math.hypot(Qe,Ee);if(We<.001)return;const je=-Ee/We,Ve=Qe/We,Bt=Math.abs((I-ue)*je+(w-ge)*Ve),pt=Math.max(.05,Bt*2/We);b(p.p1,p.p2,pt);return}return}if(p.type==="gannfan"&&p.p1&&p.p2){const b=(m,D)=>{const N=p.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:D};be(W=>{const G=W.map(ee=>ee===p?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q})}else if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="ganngrid"&&p.p1&&p.p2){const b=(m,D)=>{const N=p.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:D};be(W=>{const G=W.map(ee=>ee===p?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b({rawTime:m,normalizedTime:L,price:Q},p.p2)}else if(te.current==="handle2"){const m=d.timeScale().coordinateToTime(I);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:L,price:Q})}else if(te.current==="line"){const m=oe.current;if(!m)return;const D=d.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(D==null||N==null)return;const K=L-j(D),W=Q-N,G=j(m.p1.normalizedTime+K),ee=j(m.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=P-D;b({rawTime:m.p1.rawTime+ue,normalizedTime:G,price:m.p1.price+W},{rawTime:m.p2.rawTime+ue,normalizedTime:ee,price:m.p2.price+W})}return}if(p.type==="verticalline"&&p.primitive){const b=p.primitive;b.time=P;const m={...p,time:j(P),rawTime:P};be(N=>{const K=N.map(W=>W===p?m:W);return v.current=K,K}),M(m),ce.current=m;const D=d.timeScale().timeToCoordinate(P);D!=null&&V([{x:D,y:b.midYCss??200}]),c.current?.applyOptions({});return}if(p.type==="horizontalray"&&p.primitive){const b=p.primitive,m=oe.current;if(!m)return;if(te.current==="handle1"){if(b.price=Q,b.originTime=P,p.priceLine)try{p.priceLine.applyOptions({price:Q,title:p.showPrice!==!1?Q.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=Q,p.textPrimitive.originTime=P);const D={...p,price:b.price,originTime:b.originTime,rawOriginTime:P};be(N=>{const K=N.map(W=>W===p?D:W);return v.current=K,K}),M(D),ce.current=D,c.current?.applyOptions({})}else if(te.current==="line"){const D=f.coordinateToPrice(m.y);if(D==null)return;const N=Q-D;if(b.price=m.price+N,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};be(W=>{const G=W.map(ee=>ee===p?K:ee);return v.current=G,G}),M(K),ce.current=K,c.current?.applyOptions({})}return}if(!(p.type!=="trendline"&&p.type!=="gannline")&&!(!p.point1||!p.point2)){if(te.current==="handle1"){const b={time:L,price:Q},m=zA([{time:b.time,value:b.price},{time:p.point2.time,value:p.point2.price}]);m.length>0&&p.series.setData(m),p.decoration&&(p.decoration.p1=b);const D={...p,point1:b};be(N=>{const K=N.map(W=>W===p?D:W);return v.current=K,K}),M(D),ce.current=D}else if(te.current==="handle2"){const b={time:L,price:Q},m=zA([{time:p.point1.time,value:p.point1.price},{time:b.time,value:b.price}]);m.length>0&&p.series.setData(m),p.decoration&&(p.decoration.p2=b);const D={...p,point2:b};be(N=>{const K=N.map(W=>W===p?D:W);return v.current=K,K}),M(D),ce.current=D}else if(te.current==="line"){const b=oe.current;if(!b)return;const m=d.timeScale().coordinateToTime(b.x),D=f.coordinateToPrice(b.y);if(m==null||D==null)return;const N=L-m,K=Q-D,W={time:j(b.point1.time+N),price:b.point1.price+K},G={time:j(b.point2.time+N),price:b.point2.price+K},ee=zA([{time:W.time,value:W.price},{time:G.time,value:G.price}]);ee.length>0&&p.series.setData(ee),p.decoration&&(p.decoration.p1=W,p.decoration.p2=G);const ue={...p,point1:W,point2:G};be(ge=>{const Qe=ge.map(Ee=>Ee===p?ue:Ee);return v.current=Qe,Qe}),M(ue),ce.current=ue}}}},_=()=>{te.current=null,oe.current=null},Z=()=>{te.current||ce.current||(re(null),Y([]))},C={capture:!0,passive:!1};return O.addEventListener("mousedown",le,C),O.addEventListener("mousemove",U,C),O.addEventListener("mouseup",_,C),O.addEventListener("mouseleave",Z,C),()=>{O.removeEventListener("mousedown",le,C),O.removeEventListener("mousemove",U,C),O.removeEventListener("mouseup",_,C),O.removeEventListener("mouseleave",Z,C)}},[Ce,ve,Ke,be]),q.useEffect(()=>{const d=c.current,f=u.current;if(!d||!f)return;const O=()=>{const H=R;if(!H){V([]);return}const $=d.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const X=H.p1.rawTime??H.p1.time,ie=H.p2.rawTime??H.p2.time,le=$.timeToCoordinate(X),U=f.priceToCoordinate(H.p1.price),_=$.timeToCoordinate(ie),Z=f.priceToCoordinate(H.p2.price);le!=null&&U!=null&&_!=null&&Z!=null?V([{x:le,y:U},{x:_,y:Z}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:(X+le)/2,y:(ie+U)/2},{x:le,y:U}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="crossline"&&H.p){const X=$.timeToCoordinate(H.p.rawTime),ie=f.priceToCoordinate(H.p.price);X!=null&&ie!=null?V([{x:X,y:ie}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const X=$.timeToCoordinate(H.rawTime),ie=f.priceToCoordinate(H.price);X!=null&&ie!=null?V([{x:X,y:ie}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price),_=$.timeToCoordinate(H.b1.rawTime),Z=f.priceToCoordinate(H.b1.price),C=$.timeToCoordinate(H.b2.rawTime),h=f.priceToCoordinate(H.b2.price);X!=null&&ie!=null&&le!=null&&U!=null&&_!=null&&Z!=null&&C!=null&&h!=null?V([{x:X,y:ie},{x:le,y:U},{x:(_+C)/2,y:(Z+h)/2}]):V([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price),_=$.timeToCoordinate(H.p3.rawTime),Z=f.priceToCoordinate(H.p3.price);X!=null&&ie!=null&&le!=null&&U!=null&&_!=null&&Z!=null?V([{x:X,y:ie},{x:le,y:U},{x:_,y:Z}]):V([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price),_=$.timeToCoordinate(H.p3.rawTime),Z=f.priceToCoordinate(H.p3.price),C=$.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);X!=null&&ie!=null&&le!=null&&U!=null&&_!=null&&Z!=null&&C!=null&&h!=null?V([{x:X,y:ie},{x:le,y:U},{x:_,y:Z},{x:C,y:h}]):V([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price),_=$.timeToCoordinate(H.p3.rawTime),Z=f.priceToCoordinate(H.p3.price),C=$.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);X!=null&&ie!=null&&le!=null&&U!=null&&_!=null&&Z!=null&&C!=null&&h!=null?V([{x:X,y:ie},{x:le,y:U},{x:_,y:Z},{x:C,y:h}]):V([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const X=$.timeToCoordinate(H.point1.time),ie=f.priceToCoordinate(H.point1.price),le=$.timeToCoordinate(H.point2.time),U=f.priceToCoordinate(H.point2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const X=$.timeToCoordinate(H.point1.time),ie=f.priceToCoordinate(H.point1.price),le=$.timeToCoordinate(H.point2.time),U=f.priceToCoordinate(H.point2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:(X+le)/2,y:(ie+U)/2},{x:le,y:U}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);if(X!=null&&ie!=null&&le!=null&&U!=null){const _=Math.min(X,le),Z=Math.max(X,le),C=Math.min(ie,U),h=Math.max(ie,U),x=(_+Z)/2,I=(C+h)/2;V([{x:_,y:C},{x,y:C},{x:Z,y:C},{x:_,y:I},{x:Z,y:I},{x:_,y:h},{x,y:h},{x:Z,y:h}])}else V([]);return}if(H.type==="circle"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price),_=$.timeToCoordinate(H.p3.rawTime),Z=f.priceToCoordinate(H.p3.price);X!=null&&ie!=null&&le!=null&&U!=null&&_!=null&&Z!=null?V([{x:X,y:ie},{x:le,y:U},{x:_,y:Z}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);if(X!=null&&ie!=null&&le!=null&&U!=null){const _=(X+le)/2,Z=(ie+U)/2,C=le-X,h=U-ie,x=Math.hypot(C,h);if(x<.001){V([]);return}const I=C/x,w=h/x,p=-w,P=I,Q=x/2,L=Q*Math.max(.05,H.minorRatio??.45);V([{x:_-I*Q,y:Z-w*Q},{x:_+p*L,y:Z+P*L},{x:_+I*Q,y:Z+w*Q},{x:_-p*L,y:Z-P*L}])}else V([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const X=$.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),le=$.timeToCoordinate(H.p2.rawTime),U=f.priceToCoordinate(H.p2.price);X!=null&&ie!=null&&le!=null&&U!=null?V([{x:X,y:ie},{x:le,y:U}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const X=H.primitive,ie=$.timeToCoordinate(X.originTime),le=f.priceToCoordinate(X.price);ie!=null&&le!=null?V([{x:ie,y:le}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const X=H.primitive,ie=$.timeToCoordinate(X.time);if(ie!=null){const le=X.midYCss??200;V([{x:ie,y:le}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const X=u.current?.priceToCoordinate(H.price);if(X!=null){const ie=c.current?c.current.paneSize().width:400;V([{x:ie/2,y:X}])}else V([]);return}V([])};O();const me=d.timeScale();return me.subscribeVisibleTimeRangeChange(O),()=>{me.unsubscribeVisibleTimeRangeChange(O)}},[R]),q.useEffect(()=>{let d=!1;v.current.forEach(f=>{if(f.type==="verticalline"&&f.primitive){const O=f===R||f===Ae;f.primitive.showDot!==O&&(f.primitive.showDot=O,d=!0)}}),d&&c.current?.applyOptions({})},[R,Ae]),q.useEffect(()=>{let d=!1;v.current.forEach(f=>{if((f.type==="infoline"||f.type==="rulerline"||f.type==="arrowedline"||f.type==="rayline"||f.type==="extendedline"||f.type==="trendbyangle")&&f.primitive){const O=f===R||f===Ae;f.primitive.isActive!==O&&(f.primitive.isActive=O,d=!0)}}),d&&c.current?.applyOptions({})},[R,Ae]),q.useEffect(()=>{!c.current||!u.current||v.current.forEach(d=>{if(d.series&&d.series.applyOptions({visible:Pe}),d.priceLine){const f=Pe&&d.showPrice!==!1;d.priceLine.applyOptions(Pe?{color:d.lineColor??"#3b82f6",axisLabelVisible:f,title:f&&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=Pe;try{c.current?.applyOptions({})}catch{}}if(d.type==="rectangle"&&d.primitive){d.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}if(d.type==="parallellines"&&(d.baseLine&&d.baseLine.applyOptions({visible:Pe}),d.parallelLine&&d.parallelLine.applyOptions({visible:Pe}),d.firstLine&&d.firstLine.applyOptions({visible:Pe}),d.secondLine&&d.secondLine.applyOptions({visible:Pe})),(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=Pe;try{c.current?.applyOptions({})}catch{}}})},[Pe,Ke]),q.useEffect(()=>{!Pe&&R&&(M(null),V([]))},[Pe,R]),q.useEffect(()=>{if(v.current.length>Ke.length){const d=v.current.filter((f,O)=>!Ke.includes(f));R&&d.some(f=>f===R)&&(M(null),V([])),d.forEach(f=>{if(f.series&&c.current?.removeSeries(f.series),f.priceLine&&u.current?.removePriceLine(f.priceLine),f.textPrimitive)try{u.current?.detachPrimitive(f.textPrimitive)}catch{}if(f.type==="horizontalray"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="verticalline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="infoline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rulerline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="arrowedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rayline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="extendedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="crossline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="trendbyangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="equidistantchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="regressionchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="stddevchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="gannfan"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ganngrid"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="andrewspitchfork"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="disjointchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="flattopbottom"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="fibonacci"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rectangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="circle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="triangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ellipse"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="text"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="parallellines")try{f.baseLine&&c.current?.removeSeries(f.baseLine),f.parallelLine&&c.current?.removeSeries(f.parallelLine),f.firstLine&&c.current?.removeSeries(f.firstLine),f.secondLine&&c.current?.removeSeries(f.secondLine)}catch{}}),v.current=Ke}},[Ke,R]),q.useEffect(()=>{const d=u.current;return d?(He.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),He.current=[],_e.filter(O=>O.symbol===ye).forEach(O=>{const me=parseFloat(O.openPrice??O.price),$=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(dA&&!isNaN(me)&&He.current.push(d.createPriceLine({price:me,color:$,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),at){const X=parseFloat(O.stopLoss),ie=parseFloat(O.takeProfit);!isNaN(X)&&X>0&&He.current.push(d.createPriceLine({price:X,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(ie)&&ie>0&&He.current.push(d.createPriceLine({price:ie,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{He.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),He.current=[]}):void 0},[_e,ye,dA,at]),q.useEffect(()=>{const d=u.current;if(!d||!it)return;const f=parseFloat($A?.ask);if(isNaN(f)||f<=0)return;let O;try{O=d.createPriceLine({price:f,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{d.removePriceLine(O)}catch{}}},[it,$A]),q.useEffect(()=>{const d=o.current;if(!d)return;const f=O=>{if(se.current){se.current=!1;return}if(T.current||!c.current)return;const me=c.current,H=u.current;if(me&&H&&v.current.length>0){const $=d.getBoundingClientRect(),X=O.clientX-$.left,ie=O.clientY-$.top,le=15;for(let U=v.current.length-1;U>=0;U--){const _=v.current[U];let Z=!1;if(_.type==="text"&&_.rawTime!=null&&_.price!=null){const C=me.timeScale().timeToCoordinate(_.rawTime),h=H.priceToCoordinate(_.price);if(C!=null&&h!=null){const x=od(_,C,h);X>=x.left&&X<=x.right&&ie>=x.top&&ie<=x.bottom&&(Z=!0)}}else if(_.point1&&_.point2){const C=me.timeScale().timeToCoordinate(_.point1.time??_.point1.rawTime),h=H.priceToCoordinate(_.point1.price),x=me.timeScale().timeToCoordinate(_.point2.time??_.point2.rawTime),I=H.priceToCoordinate(_.point2.price);if(C!=null&&h!=null&&x!=null&&I!=null){const w=Math.hypot(X-C,ie-h),p=Math.hypot(X-x,ie-I),P=(C+x)/2,Q=(h+I)/2,L=Math.hypot(X-P,ie-Q);(w<le||p<le||L<le)&&(Z=!0)}}else if(_.p1&&_.p2){const C=me.timeScale().timeToCoordinate(_.p1.rawTime),h=H.priceToCoordinate(_.p1.price),x=me.timeScale().timeToCoordinate(_.p2.rawTime),I=H.priceToCoordinate(_.p2.price);if(C!=null&&h!=null&&x!=null&&I!=null){const w=Math.min(C,x),p=Math.max(C,x),P=Math.min(h,I),Q=Math.max(h,I);X>=w-5&&X<=p+5&&ie>=P-5&&ie<=Q+5&&(Z=!0)}}else if(_.p){const C=me.timeScale().timeToCoordinate(_.p.rawTime),h=H.priceToCoordinate(_.p.price);C!=null&&h!=null&&Math.hypot(X-C,ie-h)<le&&(Z=!0)}else if(_.type==="pricelevel"&&_.price!=null){const C=H.priceToCoordinate(_.price);C!=null&&Math.abs(ie-C)<le&&(Z=!0)}if(Z){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),ne(_);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;ud(c.current,ve,pe)||c.current.timeScale().fitContent();const X=c.current.timeScale().getVisibleRange();Te(X)},80)};return d.addEventListener("dblclick",f,!0),()=>{d.removeEventListener("dblclick",f,!0)}},[ve,pe]);const bd=R??Ae,xd=R?J:he,jT=Pe&&BT(bd,xd),eb=yT(bd?.type);q.useEffect(()=>{const d=o.current,f=l.current;if(!d||!f)return;const O=80,me=$=>{const X=d.getBoundingClientRect();f.style.opacity=X.bottom-$.clientY<=O?"1":"0"},H=()=>{f.style.opacity="0"};return d.addEventListener("mousemove",me),d.addEventListener("mouseleave",H),()=>{d.removeEventListener("mousemove",me),d.removeEventListener("mouseleave",H)}},[]);const tb=q.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const f=d.getVisibleRange();if(!f?.from||!f?.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*.8;try{d.setVisibleRange({from:me-H/2,to:me+H/2}),Te(d.getVisibleRange())}catch{}},[Te]),Ab=q.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const f=d.getVisibleRange();if(!f?.from||!f?.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*1.25;try{d.setVisibleRange({from:me-H/2,to:me+H/2}),Te(d.getVisibleRange())}catch{}},[Te]),ib=q.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const f=d.getVisibleLogicalRange();if(!f)return;const O=Math.max(1,Math.round((f.to-f.from)*.1));try{d.setVisibleLogicalRange({from:f.from-O,to:f.to-O})}catch{}},[]),rb=q.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const f=d.getVisibleLogicalRange();if(!f)return;const O=Math.max(1,Math.round((f.to-f.from)*.1));try{d.setVisibleLogicalRange({from:f.from+O,to:f.to+O})}catch{}},[]),nb=q.useCallback(()=>{if(!c.current)return;ud(c.current,ve,pe)||c.current.timeScale().fitContent();const f=c.current.timeScale().getVisibleRange();Te(f)},[ve,pe,Te]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${nt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:Ce===1||Ce!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Ne&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof ye=="object"?ye?.symbol:ye,"..."]})]})}),!Ne&&ft&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:nt==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:nt==="light"?"#64748b":"#94a3b8"},children:ft})]})}),!Ne&&!ft&&ve.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:nt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),GA&&ve.length>0&&(()=>{const d=ve[ve.length-1],f=O=>{const me=Number(O);return Number.isFinite(me)?me>=100?me.toFixed(2):me.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:nt==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:nt==="light"?"#1e293b":"#e2e8f0"},children:f(d?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:f(d?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:f(d?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:nt==="light"?"#1e293b":"#e2e8f0"},children:f(d?.close)})]})]})})(),(A||Ct)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Wh,{bidPrice:e,askPrice:t,onBuyClick:XT,onSellClick:JT})}),a.jsx(Rh,{isOpen:At,onClose:ZT,orderType:Me,bidPrice:e,askPrice:t}),a.jsx(Zh,{isOpen:z!==null,onClose:()=>ne(null),chartObject:z,onUpdate:YT}),Ne&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),jT&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:xd.map((d,f)=>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:eb}},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:Ab,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:tb,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:ib,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: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:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:nb,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:f,icon:O})=>a.jsx("button",{title:d,onClick:f,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:nt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:nt==="light"?"#374151":"#94a3b8",border:"1px solid "+(nt==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=nt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",me.currentTarget.style.color=nt==="light"?"#111827":"#e2e8f0"},onMouseLeave:me=>{me.currentTarget.style.backgroundColor=nt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",me.currentTarget.style.color=nt==="light"?"#374151":"#94a3b8"},children:O},d))})]})})}),Qt={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 md({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=zt(),[s,o]=q.useState(!1),[l,c]=q.useState(""),[u,g]=q.useState(-1),B=q.useRef(null),v=q.useRef(null);q.useEffect(()=>{const E=k=>{B.current&&!B.current.contains(k.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),q.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const T=r.filter(E=>E.symbol.toLowerCase().includes(l.toLowerCase())),y=T.filter(E=>!E.symbol.endsWith("USDT")),S=T.filter(E=>E.symbol.endsWith("USDT")),F=E=>{A(E),o(!1),c("")};return r.find(E=>E.symbol===t),a.jsxs("div",{ref:B,style:{...Qt.container,...i},className:e,children:[a.jsxs("button",{style:Qt.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,Qt.buttonHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Qt.arrow,...s?Qt.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Qt.dropdown,children:[a.jsx("div",{style:Qt.searchContainer,children:a.jsx("input",{ref:v,style:Qt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:E=>c(E.target.value)})}),a.jsx("div",{style:Qt.list,children:T.length===0?a.jsx("div",{style:Qt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[y.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Qt.categoryLabel,children:"Forex & Metals"}),y.map(E=>a.jsxs("div",{style:{...Qt.item,...E.symbol===t?Qt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Qt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Qt.symbolPrice,...parseFloat(E.change)>=0?Qt.priceUp:Qt.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Qt.categoryLabel,children:"Crypto"}),S.map(E=>a.jsxs("div",{style:{...Qt.item,...E.symbol===t?Qt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Qt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Qt.symbolPrice,...parseFloat(E.change)>=0?Qt.priceUp:Qt.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const WA={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},QT=[.01,.05,.1,.5,1];function gd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=QT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[g,B]=q.useState(.1),v=i!==void 0?i:g,T=q.useCallback(E=>{const k=Math.max(t,Math.min(A,parseFloat(E)||t)),R=Math.round(k/r)*r,M=parseFloat(R.toFixed(8));i!==void 0||B(M),e?.(M)},[t,A,r,i,e]),y=()=>T(v+r),S=()=>T(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...WA.container,...c},className:u,children:[o&&a.jsx("span",{style:WA.label,children:l}),a.jsx("button",{style:WA.btn,onClick:S,onMouseEnter:E=>Object.assign(E.currentTarget.style,WA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:WA.input,type:"text",value:F,onChange:E=>{const k=E.target.value;if(k===""||k==="."||k==="0.")return;const R=parseFloat(k);isNaN(R)||T(R)},onBlur:()=>T(v)}),a.jsx("button",{style:WA.btn,onClick:y,onMouseEnter:E=>Object.assign(E.currentTarget.style,WA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:WA.presets,children:n.map(E=>a.jsx("button",{style:{...WA.preset,...Math.abs(v-E)<1e-4?WA.presetActive:{}},onClick:()=>T(E),onMouseEnter:k=>{Math.abs(v-E)>=1e-4&&Object.assign(k.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:k=>{Math.abs(v-E)>=1e-4&&(k.currentTarget.style.borderColor="#334155")},children:E},E))})]})}const aA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function wd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:u,className:g}){const{currentSymbolData:B}=zt(),[v,T]=q.useState(""),[y,S]=q.useState(!1),[F,E]=q.useState("price"),k=i!==void 0?i:v,R=t!==void 0?t:y,M=r!==void 0?r:F,z=q.useCallback(re=>{t!==void 0||S(re),A?.(re)},[t,A]),ne=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),J=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){J(he);return}const Y=parseFloat(he);isNaN(Y)||J(he)},Ae=M==="price"?B?.bid?parseFloat(B.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...aA.container,...u},className:g,children:[l&&a.jsx("span",{style:aA.label,children:c}),s&&a.jsx("button",{style:{...aA.toggle,...R?aA.toggleOn:aA.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...aA.toggleKnob,...R?aA.knobOn:aA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:aA.inputGroup,children:[a.jsx("input",{style:aA.input,type:"text",value:k,onChange:V,placeholder:Ae,onFocus:re=>re.currentTarget.style.borderColor="#EF5350",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...aA.modeBtn,...M==="price"?aA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...aA.modeBtn,...M==="pips"?aA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const lA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Bd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:u,className:g}){const{currentSymbolData:B}=zt(),[v,T]=q.useState(""),[y,S]=q.useState(!1),[F,E]=q.useState("price"),k=i!==void 0?i:v,R=t!==void 0?t:y,M=r!==void 0?r:F,z=q.useCallback(re=>{t!==void 0||S(re),A?.(re)},[t,A]),ne=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),J=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){J(he);return}const Y=parseFloat(he);isNaN(Y)||J(he)},Ae=M==="price"?B?.ask?parseFloat(B.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...lA.container,...u},className:g,children:[l&&a.jsx("span",{style:lA.label,children:c}),s&&a.jsx("button",{style:{...lA.toggle,...R?lA.toggleOn:lA.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...lA.toggleKnob,...R?lA.knobOn:lA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:lA.inputGroup,children:[a.jsx("input",{style:lA.input,type:"text",value:k,onChange:V,placeholder:Ae,onFocus:re=>re.currentTarget.style.borderColor="#26A69A",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...lA.modeBtn,...M==="price"?lA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...lA.modeBtn,...M==="pips"?lA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const FT=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],RA={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function yd({showLabel:i=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:u,chartObjects:g,setChartObjects:B}=zt(),[v,T]=q.useState(null),y=A||FT,S=k=>{l(o===k?null:k)},F=()=>{B([]),l(null)},E=()=>{u(!c)};return a.jsxs("div",{style:{...RA.container,...n},className:s,children:[i&&a.jsx("span",{style:RA.label,children:r}),y.map(k=>a.jsxs("button",{style:{...RA.btn,...o===k.id?RA.btnActive:{}},onClick:()=>S(k.id),onMouseEnter:R=>{T(k.id),o!==k.id&&Object.assign(R.currentTarget.style,RA.btnHover)},onMouseLeave:R=>{T(null),o!==k.id&&(R.currentTarget.style.borderColor="#334155",R.currentTarget.style.backgroundColor="#1e293b",R.currentTarget.style.color="#94a3b8")},title:k.name,children:[k.icon,v===k.id&&a.jsx("div",{style:RA.tooltip,children:k.name})]},k.id)),(e||t)&&a.jsx("div",{style:RA.divider}),t&&a.jsx("button",{style:{...RA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:E,onMouseEnter:k=>{k.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:k=>{k.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:RA.deleteBtn,onClick:F,onMouseEnter:k=>Object.assign(k.currentTarget.style,RA.deleteBtnHover),onMouseLeave:k=>{k.currentTarget.style.borderColor="#334155",k.currentTarget.style.backgroundColor="#1e293b",k.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Cd={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 UT({showCoinSelector:i=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:u,onStopLossEnabledChange:g,takeProfit:B,onTakeProfitChange:v,takeProfitEnabled:T,onTakeProfitEnabledChange:y,coinSelectorProps:S={},volumeControlProps:F={},stopLossProps:E={},takeProfitProps:k={},drawingToolsProps:R={},style:M,className:z}){const ne=[];i&&ne.push(a.jsx(md,{...S},"coin")),e&&ne.push(a.jsx(gd,{value:s,onChange:o,...F},"volume")),t&&ne.push(a.jsx(wd,{value:l,onChange:c,enabled:u,onEnabledChange:g,...E},"sl")),A&&ne.push(a.jsx(Bd,{value:B,onChange:v,enabled:T,onEnabledChange:y,...k},"tp")),r&&ne.push(a.jsx(yd,{...R},"draw"));const J=[];return ne.forEach((V,Ae)=>{J.push(V),n&&Ae<ne.length-1&&J.push(a.jsx("div",{style:Cd.divider},`div-${Ae}`))}),a.jsx("div",{style:{...Cd.toolbar,...M},className:z,children:J})}const ST=[{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"}],nl={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 ET({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=zt();return a.jsx("div",{style:{...nl.container,...i},className:e,children:ST.map(r=>a.jsx("button",{style:{...nl.btn,...t===r.value?nl.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 LT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],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",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function MT({style:i,className:e}){const{chartType:t,setChartType:A}=zt();return a.jsx("div",{style:{...sl.container,...i},className:e,children:LT.map(r=>a.jsxs("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")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const AA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function HT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=zt(),[u,g]=q.useState(null),B=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),T=v>0&&B>0?Math.abs(v-B):0,y=E=>!E||E===0?"-.-----":E>=1e3?E.toFixed(2):E>=1?E.toFixed(4):E.toFixed(5),S=E=>E===0?"-":E>=1?E.toFixed(1):E>=.01?E.toFixed(3):(E*1e4).toFixed(1)+"p",F=q.useCallback(E=>{if(!s)return;const k=E==="BUY"?v:B;if(!k||k<=0){g({type:"error",message:"No price available"});return}const R={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:E,volume:i,price: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,R]);const M=i*k*.01;c(z=>z-M),g({type:"success",message:`${E} executed`}),A?.(R),setTimeout(()=>g(null),3e3)},[s,v,B,i,e,t,l,c,A]);return a.jsxs("div",{style:{...AA.container,...r},className:n,children:[a.jsx("button",{style:AA.sellBtn,onClick:()=>F("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,AA.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...AA.priceValue,color:"#EF5350"},children:y(B)})]}),a.jsxs("div",{style:AA.spread,children:[a.jsx("span",{style:AA.spreadLabel,children:"Spread"}),a.jsx("span",{style:AA.spreadValue,children:S(T)})]}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...AA.priceValue,color:"#26A69A"},children:y(v)})]}),a.jsx("button",{style:AA.buyBtn,onClick:()=>F("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,AA.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...AA.status,backgroundColor:u.type==="success"?"#14532d":"#7f1d1d",color:u.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${u.type==="success"?"#166534":"#991b1b"}`},children:u.message})]})}const ot={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function IT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=zt(),[l,c]=q.useState(null),u=A.filter(y=>y.status==="OPEN"||!y.closeAt),g=q.useCallback((y,S)=>{const F=n.find(E=>E.symbol===y);return F?S?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),B=q.useCallback(y=>{if(l)return;c(y.id);const S=g(y.symbol,y.type),E=(y.type?.toUpperCase()==="BUY"?S-y.price:y.price-S)*y.volume,k=y.volume*y.price*.01;r(R=>R.filter(M=>M.id!==y.id)),o(R=>R+k+E),c(null)},[l,g,r,o]),v=y=>{const S=parseFloat(y);return!S||isNaN(S)?"-":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5)},T=y=>{const S=parseFloat(y);return isNaN(S)?"-":(S>=0?"+":"")+S.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...i},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):u.map(y=>{const S=g(y.symbol,y.type),F=y.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:y.symbol}),a.jsx("td",{style:{...ot.td,...y.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:y.type}),a.jsx("td",{style:ot.td,children:y.volume}),a.jsx("td",{style:ot.td,children:v(y.price)}),a.jsx("td",{style:ot.td,children:v(S)}),a.jsx("td",{style:ot.td,children:y.stopLoss?v(y.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:y.takeProfit?v(y.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:T(F)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===y.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>B(y),disabled:l===y.id,onMouseEnter:E=>{l!==y.id&&(E.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d"},children:l===y.id?"...":"Close"})})]},y.id)})})]})})]})}function DT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(i)}function _T(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(i)}function PT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(i)}function NT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(i)}const 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:g=!0,onToggleMarketWatch:B,buySellPanelOpen:v,onMove:T})=>{const{theme:y}=zt(),S=y==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],E={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return a.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b min-w-max ${S?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${S?"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?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:k,children:E[k]},k))}),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(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?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:k,children:E[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?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:k},k)),a.jsx("div",{className:`border-r h-6 mx-1 ${S?"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?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(DT,{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(_T,{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",{onClick:T,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-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${S?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>B?.(),title:g?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${g?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:()=>u?.(),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"})})})]})]})},Jr=[{label:"Trendline",toolId:2,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})},{label:"Horizontal Line",toolId:20,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M19 9l3 3-3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Vertical Line",toolId:22,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),a.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),a.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),a.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M5.054 17.988a2.988 2.988 0 0 1-1.31-.312 2.994 2.994 0 1 1 2.69 1.693 2.988 2.988 0 0 1-1.38-.381Zm-1 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),a.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),a.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Zr=[{label:"Regression Channel",toolId:40,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Equidistant Channel",toolId:3,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M15 8a2.966 2.966 0 0 1-1.308-.312l-6 6c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l6-6A2.992 2.992 0 1 1 15 8ZM5 14a1 1 0 1 0 0 2.001A1 1 0 0 0 5 14ZM15 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm6.714 6.666-7.026 7.026a3.03 3.03 0 1 1-1.381-1.381l7.026-7.026a.977.977 0 1 1 1.381 1.381ZM12 18a1 1 0 1 0 0 2.001A1 1 0 0 0 12 18Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"StdDev Channel",toolId:41,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.381-1.382ZM10 15H9v4a1 1 0 1 1-2 0v-1H6a1 1 0 0 1 0-2h1v-4a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm7-7h-1v4a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1V5a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm-4.714 12.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.382-1.382h.001Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Andrews Pitchfork",toolId:42,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m21.714 13.666-4.026 4.026c.203.406.31.854.312 1.308a3 3 0 0 1-6 0c.002-.454.11-.902.312-1.308L10 15.381l-2.312 2.311a3.03 3.03 0 1 1-1.381-1.381L8.619 14l-2.311-2.312a3 3 0 1 1-.001-5.377l4.026-4.026a.976.976 0 1 1 1.381 1.381L7.688 7.692a2.9 2.9 0 0 1 0 2.615L10 12.619l8.333-8.334a.976.976 0 1 1 1.381 1.381L11.381 14l2.312 2.312a2.9 2.9 0 0 1 2.614 0l4.026-4.026a.977.977 0 1 1 1.381 1.38ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],Yr=[{label:"Gann Line",toolId:43,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3 3 0 0 1-3 3 2.965 2.965 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l3-3a2.98 2.98 0 0 1 4-4l3-3A2.992 2.992 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2.001A1 1 0 0 0 5 18Zm7-7a1 1 0 1 0 0 2.001A1 1 0 0 0 12 11Zm7-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Fan",toolId:44,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M21.72 3.584 17.694 7.61c.202.407.31.854.312 1.308a3 3 0 0 1-3 3 2.967 2.967 0 0 1-1.308-.312l-4.45 4.45 10.109-4.042a.987.987 0 0 1 .834 1.79L8.167 18.61l7.75-.7a1.004 1.004 0 1 1 .18 2l-8.684.79a2.992 2.992 0 1 1-4.2-4.164l.794-8.7a1.004 1.004 0 1 1 2 .181L5.3 15.765 9.673 4.591a.969.969 0 0 1 1.3-.48 1 1 0 0 1 .47 1.32L7.79 14.77l4.538-4.538a2.98 2.98 0 0 1 4-4l4.026-4.026a.977.977 0 0 1 1.367 1.377ZM5.006 19.918a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm10-12a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Grid",toolId:45,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-.5.5L21 12l-3.809 3.809.5.5a3.034 3.034 0 1 1-1.381 1.381l-.5-.5L12 21l-3.809-3.809-.5.5c.202.407.308.855.309 1.309a3.03 3.03 0 1 1-1.693-2.689l.5-.5L3 12l3.81-3.81-.5-.5A2.966 2.966 0 0 1 5 8a3.031 3.031 0 1 1 2.689-1.693l.5.5L12 3l3.809 3.81.5-.5A2.993 2.993 0 1 1 19 8Zm0 12a1 1 0 1 0 0-2.002A1 1 0 0 0 19 20ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm7 14.452 2.536-2.536L12 13.381l-2.536 2.535L12 18.452ZM5.547 12l2.536 2.535L10.619 12 8.083 9.464 5.547 12ZM12 5.547 9.464 8.083 12 10.619l2.535-2.536L12 5.547Zm3.916 3.917L13.381 12l2.536 2.535L18.452 12l-2.536-2.536ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],qr=[{label:"Rectangle",toolId:5,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})},{label:"Circle",toolId:46,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12C22 10.2504 21.5507 8.60571 20.7611 7.17509C20.9149 6.81421 21 6.41704 21 6C21 4.34315 19.6569 3 18 3C17.583 3 17.1858 3.0851 16.8249 3.23888C15.3943 2.44933 13.7496 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12ZM12 20C16.4183 20 20 16.4183 20 12C20 10.8264 19.7473 9.7118 19.2933 8.70768C18.9017 8.89507 18.4631 9 18 9C17.5369 9 17.0983 8.89506 16.7066 8.70766L14.7077 10.7066C14.8951 11.0983 15 11.5369 15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.4632 9 12.9018 9.10496 13.2935 9.2924L15.2924 7.29348C15.105 6.90183 15 6.46317 15 6C15 5.5369 15.1049 5.09831 15.2923 4.7067C14.2882 4.25272 13.1736 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7Z",fill:"currentColor"})})},{label:"Triangle",toolId:47,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6C15 7.65685 13.6569 9 12 9C11.763 9 11.5324 8.97252 11.3113 8.92057L7.37081 16.1613C6.95686 15.6284 6.36717 15.2388 5.68872 15.0794L9.62925 7.83858C9.23484 7.33074 9 6.6928 9 6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6ZM13 6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.3708 7.83867C13.9569 8.37162 13.3672 8.76126 12.6887 8.9206L16.6292 16.1614C16.4344 16.4122 16.2786 16.6948 16.1707 17H7.82941C7.93996 17.3128 8.00012 17.6494 8.00012 18C8.00012 18.3506 7.93996 18.6872 7.8294 19H16.1707C16.5826 20.1652 17.6938 21 19 21C20.6569 21 22 19.6569 22 18C22 16.3431 20.6569 15 19 15C18.763 15 18.5324 15.0275 18.3113 15.0794L14.3708 7.83867ZM19 19C19.5523 19 20 18.5523 20 18C20 17.4477 19.5523 17 19 17C18.4477 17 18 17.4477 18 18C18 18.5523 18.4477 19 19 19Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00012 18C8.00012 19.6569 6.65685 21 5 21C3.34315 21 2 19.6569 2 18C2 16.3431 3.34315 15 5 15C6.65685 15 8.00012 16.3431 8.00012 18ZM6 18C6 18.5523 5.55228 19 5 19C4.44772 19 4 18.5523 4 18C4 17.4477 4.44772 17 5 17C5.55228 17 6 17.4477 6 18Z",fill:"currentColor"})]})},{label:"Ellipse",toolId:48,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3a3.001 3.001 0 0 0-2.935 2.378c-1.25.333-2.381.874-3.322 1.58a7.344 7.344 0 0 0-1.886 2.045 3 3 0 0 0 0 5.994 7.343 7.343 0 0 0 1.886 2.046C7.38 18.27 9.595 19 12 19s4.62-.73 6.257-1.957a7.343 7.343 0 0 0 1.886-2.046 3 3 0 0 0 0-5.994 7.344 7.344 0 0 0-1.886-2.046c-.94-.705-2.073-1.246-3.322-1.579A3.001 3.001 0 0 0 12 3Zm-1 3a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm7.156 3.634a5.584 5.584 0 0 0-1.1-1.077 7.61 7.61 0 0 0-2.391-1.177 3 3 0 0 1-5.33 0 7.61 7.61 0 0 0-2.392 1.177c-.437.328-.805.69-1.099 1.076A2.995 2.995 0 0 1 7 12c0 .962-.452 1.818-1.156 2.367.294.386.662.748 1.1 1.076C8.201 16.387 9.985 17 12 17c2.014 0 3.798-.613 5.057-1.557.437-.328.805-.69 1.099-1.077A2.995 2.995 0 0 1 17 12c0-.961.452-1.817 1.156-2.366ZM3 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm16 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z",fill:"currentColor"})})}],ks=({children:i,top:e,panelRef:t,isLight:A})=>a.jsx("div",{ref:t,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${A?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:a.jsx("div",{className:"py-1",children:i})}),kT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:g,setDrawingsVisible:B,chartLocked:v,setChartLocked:T,theme:y,setTheme:S,setCandleColors:F,setShowTradeOrders:E,showTradeOrders:k,setShowTradePosition:R,showTradePosition:M,setShowTradeHistory:z,showTradeHistory:ne,setShowSLTP:J,showSLTP:V,setShowAskPrice:Ae,showAskPrice:re,setShowChartControls:he,showChartControls:Y,setShowTradeNotification:te,showTradeNotification:oe,setShowCrosshair:ce,showCrosshair:se,setShowOHLC:ae,showOHLC:de,setIsShow:we}=zt(),Fe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[Ue,Be]=q.useState(!1),[Te,Ce]=q.useState(null),[xe,Le]=q.useState(null),[Re,Ke]=q.useState(0),[be,_e]=q.useState(!1),[ye,pe]=q.useState(0),[Pe,tt]=q.useState(!1),[rt,nt]=q.useState(0),[ut,dA]=q.useState(!1),[Je,Oe]=q.useState(0),[at,it]=q.useState(!1),[Ct,bt]=q.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),GA=q.useRef(null),$A=q.useRef(null),Gt=q.useRef(null),fA=q.useRef(null),XA=q.useRef(null),Kt=q.useRef(null);q.useEffect(()=>{const He=At=>{const Xe=GA.current;Ue&&Xe&&!Xe.contains(At.target)&&(Be(!1),Ce(null));const Me=$A.current;xe==="line"&&Me&&!Me.contains(At.target)&&Le(null);const ze=Gt.current;xe==="channel"&&ze&&!ze.contains(At.target)&&Le(null);const ve=fA.current;xe==="gann"&&ve&&!ve.contains(At.target)&&Le(null);const qe=XA.current;xe==="shape"&&qe&&!qe.contains(At.target)&&Le(null)};return window.addEventListener("mousedown",He),()=>window.removeEventListener("mousedown",He)},[Ue,xe]),q.useEffect(()=>{const He=At=>{At.key==="Escape"&&(Be(!1),Ce(null),Le(null))};return window.addEventListener("keydown",He),()=>window.removeEventListener("keydown",He)},[]);const Ft=q.useMemo(()=>[{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 13H15.874C15.5122 14.4056 14.4056 15.5122 13 15.874V20C13 20.2652 12.8946 20.5196 12.7071 20.7071C12.5196 20.8946 12.2652 21 12 21C11.7348 21 11.4804 20.8946 11.2929 20.7071C11.1054 20.5196 11 20.2652 11 20V15.874C9.59439 15.5122 8.4878 14.4056 8.12602 13H4C3.73478 13 3.48043 12.8946 3.29289 12.7071C3.10536 12.5196 3 12.2652 3 12C3 11.7348 3.10536 11.4804 3.29289 11.2929C3.48043 11.1054 3.73478 11 4 11H8.12602C8.4878 9.59439 9.59439 8.4878 11 8.12602V4C11 3.73478 11.1054 3.48043 11.2929 3.29289C11.4804 3.10536 11.7348 3 12 3C12.2652 3 12.5196 3.10536 12.7071 3.29289C12.8946 3.48043 13 3.73478 13 4V8.12602C14.4056 8.4878 15.5122 9.59439 15.874 11H20C20.2652 11 20.5196 11.1054 20.7071 11.2929C20.8946 11.4804 21 11.7348 21 12C21 12.2652 20.8946 12.5196 20.7071 12.7071C20.5196 12.8946 20.2652 13 20 13ZM12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10Z",fill:"currentColor"})]})}),label:"Crosshair",description:"Precise cursor positioning for measurement on chart"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})}),label:"Trend Line",description:"Draw trend line (drag from first point to second point)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Parallel Lines",description:"Draw two parallel trend lines (draw first line, then second)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:a.jsx("path",{d:"M21 15H3a1 1 0 0 1 0-2h18a1 1 0 0 1 0 2Zm-2-3a2.99 2.99 0 0 1-2.816-2H3a1 1 0 0 1 0-2h13.184A2.995 2.995 0 1 1 19 12Zm0-4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2-3H3a1 1 0 0 1 0-2h18a1 1 0 1 1 0 2ZM5 16a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2H7.816A2.995 2.995 0 1 1 5 16Zm0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Fibonacci",description:"Draw Fibonacci retracement levels"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Rectangle",description:"Draw support/resistance zone (drag from corner to corner)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M12.76 17.958c-.504.07-1.016.07-1.52 0C6.07 17.532 2 12.932 2 12c0-.977 4.48-6 10-6s10 5.043 10 6c0 .912-4.07 5.529-9.24 5.958ZM3.63 12a11.724 11.724 0 0 0 3.03 2.741 5.963 5.963 0 0 1 .02-5.492A11.7 11.7 0 0 0 3.63 12ZM12 7.57a4.443 4.443 0 1 0-.006 8.886A4.443 4.443 0 0 0 12 7.57Zm5.31 1.652a5.954 5.954 0 0 1 .01 5.546A11.45 11.45 0 0 0 20.37 12a11.525 11.525 0 0 0-3.06-2.778ZM12 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Eye",description:"Show or hide all drawing objects on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M16 20H8a2 2 0 0 1-2-2v-7a2 2 0 0 1 1.05-1.749A1.044 1.044 0 0 1 7 9a5 5 0 0 1 8.75-3.3 1.008 1.008 0 0 1-.09 1.411 1 1 0 0 1-1.41-.09A3 3 0 0 0 9 9h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2Zm0-9H8v7h8v-7Zm-4 2a1 1 0 0 1 1 1v1a1 1 0 0 1-2 0v-1a1 1 0 0 1 1-1Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Lock",description:"Lock chart (disable pan and zoom)"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),label:"Delete",description:"Remove last drawn object from chart"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16M6 4v16M12 4v16M18 4v16"})}),label:"Grid",description:"Toggle grid display on/off for chart alignment"},{icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fill:"currentColor",d:"M12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C9.068 22 6.43 20.738 4.602 18.728L6.081 17.382C7.544 18.99 9.654 20 12 20C16.418 20 20 16.418 20 12C20 7.582 16.418 4 12 4C7.92 4 4.554 7.054 4.062 11H5.828L3 13.828L0.171997 11H2.049C2.551 5.947 6.815 2 12 2ZM13 7V12.186L16.657 15.843L15.243 17.257L11 13V7H13Z"})}),label:"History",description:"View trade history"},{icon:a.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),mA=He=>{const At=Ft[He].label;if(At==="Menu"){Be(Xe=>!Xe),Ce(null);return}if(At==="Grid"){s(!n);return}if(At==="Magnet"){l(!o),r(o?null:He);return}if(At==="Delete"){if(c.length>0){const Xe=[...c];Xe.pop(),u(Xe)}return}if(At==="Eye"){B(!g);return}if(At==="Lock"){T(!v);return}if(At==="Light Theme"||At==="Dark Theme"){S(y==="light"?"dark":"light"),Be(!1),Ce(null);return}if(At==="History"){we(!0);return}r(A===He?null:He)};Ft.slice(0,12);const st=Ft.slice(12),mt=[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:y==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.408 12.954-2.265-.756a.209.209 0 0 1 0-.396l2.265-.755a.209.209 0 0 1 .276.198v1.51c0 .143-.14.244-.276.198ZM5.959 7.306 4.89 5.17c-.09-.18.1-.37.28-.28l2.136 1.068a.209.209 0 0 1 .054.334L6.293 7.36c-.1.101-.27.074-.334-.054ZM11.802 21.857l-.755-2.265a.209.209 0 0 1 .198-.276h1.51c.143 0 .244.14.198.276l-.755 2.265a.21.21 0 0 1-.396 0ZM11.802 2.143l-.755 2.265a.209.209 0 0 0 .198.276h1.51c.143 0 .244-.14.198-.276l-.755-2.265a.209.209 0 0 0-.396 0ZM18.83 19.11l-2.137-1.068a.209.209 0 0 1-.054-.335l1.068-1.068c.1-.1.27-.073.334.055l1.069 2.136c.09.18-.101.37-.28.28ZM16.693 5.958 18.83 4.89c.18-.09.37.1.28.28l-1.068 2.136a.209.209 0 0 1-.334.054l-1.068-1.068a.209.209 0 0 1 .054-.334ZM4.89 18.83l1.069-2.136a.209.209 0 0 1 .334-.055l1.068 1.068c.101.101.074.271-.054.335L5.171 19.11c-.18.09-.37-.1-.28-.28ZM21.857 12.198l-2.265.755a.209.209 0 0 1-.276-.198v-1.51c0-.143.14-.244.276-.198l2.265.755a.21.21 0 0 1 0 .396Z",fill:"#FEBC5A"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fillRule:"evenodd",d:"M20.775 8.992C20.922 9.638 21 10.31 21 11a8.354 8.354 0 0 0-.787 0c-1.467.072-2.422.564-3.082 1.283l-1.18-1.65c.761-.718 1.697-1.205 2.81-1.452A7 7 0 1 0 12 18c.396-.001.565-.082.63-.12.07-.042.17-.124.295-.34.218-.375.36-.835.534-1.49l1.518 1.822C14.485 19.102 13.705 20 12 20a9 9 0 1 1 8.775-11.008Z","clip-rule":"evenodd",fill:"currentColor"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M13.892 14.693c-2.034.46-2.59-1.07-2.892-4.693 3.85.352 5.232 1.05 4.697 3.012L20 17.192s.038 1.023-.361 1.447c-.463.49-1.687.361-1.687.361l-4.06-4.307Z",fill:"currentColor"})]})})}),submenu:[{label:"Green & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#26a69a"})]})})})},{label:"Blue & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#578cf2"})]})})})},{label:"Black & White",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#76ac85"})]})})})}]},{key:"lang",label:"Language",rightText:"EN",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.9 17.39C17.64 16.59 16.89 16 16 16H15V13C15 12.4477 14.5523 12 14 12H8V10H10C10.5523 10 11 9.55228 11 9V7H13C14.1046 7 15 6.10457 15 5V4.59C17.93 5.77 20 8.64 20 12C20 14.08 19.2 15.97 17.9 17.39ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.78 4.21 10.21L9 15V16C9 17.1046 9.89543 18 11 18V19.93ZM12 2C6.47715 2 2 6.47715 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C6.8043 20.9464 9.34784 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z",fill:"currentColor"})})})}),submenu:[{label:"English",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}]}],It=({item:He})=>{const At=!!He.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Kt.current&&(clearTimeout(Kt.current),Kt.current=null),At&&Ce(He.key)},onMouseLeave:()=>{At&&(Kt.current=setTimeout(()=>Ce(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{At?Ce(Xe=>Xe===He.key?null:He.key):(He.key==="theme"&&S(Xe=>Xe==="light"?"dark":"light"),Be(!1),Ce(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:He.label}),He.rightText&&a.jsx("span",{className:`text-xs ${$e?"text-slate-500":"text-slate-400"}`,children:He.rightText}),At&&a.jsx("svg",{className:`w-4 h-4 ${$e?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),At&&Te===He.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${$e?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:He.submenu.map((Xe,Me)=>{const ze=Ct[He.key],ve=Array.isArray(ze)?ze.includes(Xe.label):ze===Xe.label||Xe.selected&&ze==null;return a.jsxs("button",{type:"button",onClick:()=>{He.key==="chart"?(bt(Ne=>{const Ze=Array.isArray(Ne.chart)?Ne.chart:[Ne.chart],ft=Ze.includes(Xe.label)?Ze.filter(St=>St!==Xe.label):[...Ze,Xe.label];return{...Ne,chart:ft}}),{Grid:()=>s(!n),"Trade Orders":()=>E(!k),"Ask Price":()=>Ae(!re),"Chart Controls":()=>he(!Y),"Trade Notification":()=>te(!oe),"Crosshair cursor":()=>ce(!se),"Show OHLC":()=>ae(!de)}[Xe.label]?.()):(bt(qe=>({...qe,[He.key]:Xe.label})),He.key==="colors"&&Fe[Xe.label]&&F(Fe[Xe.label]))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:Xe.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Xe.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"})})})]},Me)})})})]})},$e=y==="light";return a.jsxs("div",{className:"relative h-full",children:[a.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${$e?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:mt.map((He,At)=>{const Xe=He==="gann",Me=Xe?null:Ft[He],ze=Xe?-1:He;return a.jsxs(q.Fragment,{children:[ze===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ve=Jr[Re].toolId;r(A===ve?null:ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
- ${A===Jr[Re].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Jr[Re].label,children:Jr[Re].icon}),a.jsx("span",{onMouseEnter:()=>_e(!0),onMouseLeave:()=>_e(!1),onMouseDown:ve=>{ve.stopPropagation(),Le(qe=>qe==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:be?10:7,height:be?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):ze===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ve=Zr[ye].toolId;r(A===ve?null:ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
- ${A===Zr[ye].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Zr[ye].label,children:Zr[ye].icon}),a.jsx("span",{onMouseEnter:()=>tt(!0),onMouseLeave:()=>tt(!1),onMouseDown:ve=>{ve.stopPropagation(),Le(qe=>qe==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:Pe?10:7,height:Pe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):Xe?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ve=Yr[rt].toolId;r(A===ve?null:ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
- ${A===Yr[rt].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Yr[rt].label,children:Yr[rt].icon}),a.jsx("span",{onMouseEnter:()=>dA(!0),onMouseLeave:()=>dA(!1),onMouseDown:ve=>{ve.stopPropagation(),Le(qe=>qe==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:ut?10:7,height:ut?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):ze===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const ve=qr[Je].toolId;r(A===ve?null:ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
- ${A===qr[Je].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:qr[Je].label,children:qr[Je].icon}),a.jsx("span",{onMouseEnter:()=>it(!0),onMouseLeave:()=>it(!1),onMouseDown:ve=>{ve.stopPropagation(),Le(qe=>qe==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:at?10:7,height:at?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>mA(ze),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
- ${Me.label==="Grid"&&n||Me.label==="Eye"&&!g||Me.label==="Lock"&&v||A===ze?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Me.label}: ${Me.description}`,children:Me.icon}),!Xe&&Me.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${$e?"border-slate-200":"border-slate-700"}`})]},Xe?"gann-slot":`${Me.label}-${He}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:st.map((He,At)=>{const Xe=12+At;return a.jsx("button",{onClick:()=>mA(Xe),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
- ${He.label==="Grid"&&n||He.label==="Eye"&&!g||He.label==="Lock"&&v||A===Xe?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${He.label}: ${He.description}`,children:He.icon},He.label)})})]}),xe==="line"&&a.jsx(ks,{top:84,panelRef:$A,isLight:$e,children:Jr.map((He,At)=>{const Xe=Re===At;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),Ke(At),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Xe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),xe==="channel"&&a.jsx(ks,{top:128,panelRef:Gt,isLight:$e,children:Zr.map((He,At)=>{const Xe=ye===At;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),pe(At),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Xe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),xe==="gann"&&a.jsx(ks,{top:210,panelRef:fA,isLight:$e,children:Yr.map((He,At)=>{const Xe=rt===At;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),nt(At),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Xe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),xe==="shape"&&a.jsx(ks,{top:250,panelRef:XA,isLight:$e,children:qr.map((He,At)=>{const Xe=Je===At;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),Oe(At),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Xe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),Ue&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{Be(!1),Ce(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:GA,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${$e?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${$e?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${$e?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),i!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${$e?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:Ut.map(He=>a.jsx(It,{item:He},He.key))})]})]})]})};function KT(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M337.509 305.372h-17.501l-6.571-5.486c20.791-25.232 33.922-57.054 33.922-93.257C347.358 127.632 283.896 64 205.135 64 127.452 64 64 127.632 64 206.629s63.452 142.628 142.225 142.628c35.011 0 67.831-13.167 92.991-34.008l6.561 5.487v17.551L415.18 448 448 415.086 337.509 305.372zm-131.284 0c-54.702 0-98.463-43.887-98.463-98.743 0-54.858 43.761-98.742 98.463-98.742 54.7 0 98.462 43.884 98.462 98.742 0 54.856-43.762 98.743-98.462 98.743z"},child:[]}]})(i)}const VT={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},zT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},WT={binance:"CRYPTO"},RT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=zt(),o=s==="light",[l,c]=q.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),g=q.useMemo(()=>{const v={};for(const S of u){const F=(S.category||"other").toLowerCase();v[F]||(v[F]=[]),v[F].push(S)}const T=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(v).sort((S,F)=>{const E=T.indexOf(S),k=T.indexOf(F);return E!==-1&&k!==-1?E-k:E!==-1?-1:k!==-1?1:S.localeCompare(F)}).map(S=>({category:S,symbols:v[S]}))},[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(NT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(PT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(X1,{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
+ }`,hv=function(i){uv(i,"."+Za+lv+Wd+`
10
+ .`+Ya+cv+Wd)},uv=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Rd=(function(){function i(){}return i.getOrigin=function(e){var t=i._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},i.isSameOrigin=function(e){return i.getOrigin(e)===i._origin},i.setContext=function(e){i._link=e.document.createElement("a"),i._origin=i.getOrigin(e.location.href)},i._origin="about:blank",i})(),dv=(function(){function i(e,t){this.context=e,this._options=t,this._cache={}}return i.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(ja(e)||gv(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},i.prototype.match=function(e){return this._cache[e]},i.prototype.loadImage=function(e){return tA(this,void 0,void 0,function(){var t,A,r,n,s=this;return Zt(this,function(o){switch(o.label){case 0:return t=Rd.isSameOrigin(e),A=!qa(e)&&this._options.useCORS===!0&&Rt.SUPPORT_CORS_IMAGES&&!t,r=!qa(e)&&!t&&!ja(e)&&typeof this._options.proxy=="string"&&Rt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!qa(e)&&!ja(e)&&!r&&!A?[2]:(n=e,r?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,c){var u=new Image;u.onload=function(){return l(u)},u.onerror=c,(wv(n)||A)&&(u.crossOrigin="anonymous"),u.src=n,u.complete===!0&&setTimeout(function(){return l(u)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},i.prototype.has=function(e){return typeof this._cache[e]<"u"},i.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},i.prototype.proxy=function(e){var t=this,A=this._options.proxy;if(!A)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var o=Rt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var g=new FileReader;g.addEventListener("load",function(){return n(g.result)},!1),g.addEventListener("error",function(B){return s(B)},!1),g.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),pv=/^data:image\/svg\+xml/i,fv=/^data:image\/.*;base64,/i,mv=/^data:image\/.*/i,gv=function(i){return Rt.SUPPORT_SVG_DRAWING||!Bv(i)},qa=function(i){return mv.test(i)},wv=function(i){return fv.test(i)},ja=function(i){return i.substr(0,4)==="blob"},Bv=function(i){return i.substr(-3).toLowerCase()==="svg"||pv.test(i)},Ie=(function(){function i(e,t){this.type=0,this.x=e,this.y=t}return i.prototype.add=function(e,t){return new i(this.x+e,this.y+t)},i})(),er=function(i,e,t){return new Ie(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},Ls=(function(){function i(e,t,A,r){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=r}return i.prototype.subdivide=function(e,t){var A=er(this.start,this.startControl,e),r=er(this.startControl,this.endControl,e),n=er(this.endControl,this.end,e),s=er(A,r,e),o=er(r,n,e),l=er(s,o,e);return t?new i(this.start,A,s,l):new i(l,o,n,this.end)},i.prototype.add=function(e,t){return new i(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},i.prototype.reverse=function(){return new i(this.end,this.endControl,this.startControl,this.start)},i})(),bA=function(i){return i.type===1},yv=(function(){function i(e){var t=e.styles,A=e.bounds,r=kr(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=kr(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=kr(t.borderBottomRightRadius,A.width,A.height),g=u[0],B=u[1],v=kr(t.borderBottomLeftRadius,A.width,A.height),b=v[0],C=v[1],U=[];U.push((n+l)/A.width),U.push((b+g)/A.width),U.push((s+C)/A.height),U.push((c+B)/A.height);var F=Math.max.apply(Math,U);F>1&&(n/=F,s/=F,l/=F,c/=F,g/=F,B/=F,b/=F,C/=F);var S=A.width-l,K=A.height-B,G=A.width-g,M=A.height-C,W=t.borderTopWidth,ne=t.borderRightWidth,J=t.borderBottomWidth,V=t.borderLeftWidth,ie=Tt(t.paddingTop,e.bounds.width),re=Tt(t.paddingRight,e.bounds.width),ce=Tt(t.paddingBottom,e.bounds.width),Z=Tt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?Qt(A.left+V/3,A.top+W/3,n-V/3,s-W/3,ft.TOP_LEFT):new Ie(A.left+V/3,A.top+W/3),this.topRightBorderDoubleOuterBox=n>0||s>0?Qt(A.left+S,A.top+W/3,l-ne/3,c-W/3,ft.TOP_RIGHT):new Ie(A.left+A.width-ne/3,A.top+W/3),this.bottomRightBorderDoubleOuterBox=g>0||B>0?Qt(A.left+G,A.top+K,g-ne/3,B-J/3,ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne/3,A.top+A.height-J/3),this.bottomLeftBorderDoubleOuterBox=b>0||C>0?Qt(A.left+V/3,A.top+M,b-V/3,C-J/3,ft.BOTTOM_LEFT):new Ie(A.left+V/3,A.top+A.height-J/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?Qt(A.left+V*2/3,A.top+W*2/3,n-V*2/3,s-W*2/3,ft.TOP_LEFT):new Ie(A.left+V*2/3,A.top+W*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?Qt(A.left+S,A.top+W*2/3,l-ne*2/3,c-W*2/3,ft.TOP_RIGHT):new Ie(A.left+A.width-ne*2/3,A.top+W*2/3),this.bottomRightBorderDoubleInnerBox=g>0||B>0?Qt(A.left+G,A.top+K,g-ne*2/3,B-J*2/3,ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne*2/3,A.top+A.height-J*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||C>0?Qt(A.left+V*2/3,A.top+M,b-V*2/3,C-J*2/3,ft.BOTTOM_LEFT):new Ie(A.left+V*2/3,A.top+A.height-J*2/3),this.topLeftBorderStroke=n>0||s>0?Qt(A.left+V/2,A.top+W/2,n-V/2,s-W/2,ft.TOP_LEFT):new Ie(A.left+V/2,A.top+W/2),this.topRightBorderStroke=n>0||s>0?Qt(A.left+S,A.top+W/2,l-ne/2,c-W/2,ft.TOP_RIGHT):new Ie(A.left+A.width-ne/2,A.top+W/2),this.bottomRightBorderStroke=g>0||B>0?Qt(A.left+G,A.top+K,g-ne/2,B-J/2,ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne/2,A.top+A.height-J/2),this.bottomLeftBorderStroke=b>0||C>0?Qt(A.left+V/2,A.top+M,b-V/2,C-J/2,ft.BOTTOM_LEFT):new Ie(A.left+V/2,A.top+A.height-J/2),this.topLeftBorderBox=n>0||s>0?Qt(A.left,A.top,n,s,ft.TOP_LEFT):new Ie(A.left,A.top),this.topRightBorderBox=l>0||c>0?Qt(A.left+S,A.top,l,c,ft.TOP_RIGHT):new Ie(A.left+A.width,A.top),this.bottomRightBorderBox=g>0||B>0?Qt(A.left+G,A.top+K,g,B,ft.BOTTOM_RIGHT):new Ie(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=b>0||C>0?Qt(A.left,A.top+M,b,C,ft.BOTTOM_LEFT):new Ie(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?Qt(A.left+V,A.top+W,Math.max(0,n-V),Math.max(0,s-W),ft.TOP_LEFT):new Ie(A.left+V,A.top+W),this.topRightPaddingBox=l>0||c>0?Qt(A.left+Math.min(S,A.width-ne),A.top+W,S>A.width+ne?0:Math.max(0,l-ne),Math.max(0,c-W),ft.TOP_RIGHT):new Ie(A.left+A.width-ne,A.top+W),this.bottomRightPaddingBox=g>0||B>0?Qt(A.left+Math.min(G,A.width-V),A.top+Math.min(K,A.height-J),Math.max(0,g-ne),Math.max(0,B-J),ft.BOTTOM_RIGHT):new Ie(A.left+A.width-ne,A.top+A.height-J),this.bottomLeftPaddingBox=b>0||C>0?Qt(A.left+V,A.top+Math.min(M,A.height-J),Math.max(0,b-V),Math.max(0,C-J),ft.BOTTOM_LEFT):new Ie(A.left+V,A.top+A.height-J),this.topLeftContentBox=n>0||s>0?Qt(A.left+V+Z,A.top+W+ie,Math.max(0,n-(V+Z)),Math.max(0,s-(W+ie)),ft.TOP_LEFT):new Ie(A.left+V+Z,A.top+W+ie),this.topRightContentBox=l>0||c>0?Qt(A.left+Math.min(S,A.width+V+Z),A.top+W+ie,S>A.width+V+Z?0:l-V+Z,c-(W+ie),ft.TOP_RIGHT):new Ie(A.left+A.width-(ne+re),A.top+W+ie),this.bottomRightContentBox=g>0||B>0?Qt(A.left+Math.min(G,A.width-(V+Z)),A.top+Math.min(K,A.height+W+ie),Math.max(0,g-(ne+re)),B-(J+ce),ft.BOTTOM_RIGHT):new Ie(A.left+A.width-(ne+re),A.top+A.height-(J+ce)),this.bottomLeftContentBox=b>0||C>0?Qt(A.left+V+Z,A.top+M,Math.max(0,b-(V+Z)),C-(J+ce),ft.BOTTOM_LEFT):new Ie(A.left+V+Z,A.top+A.height-(J+ce))}return i})(),ft;(function(i){i[i.TOP_LEFT=0]="TOP_LEFT",i[i.TOP_RIGHT=1]="TOP_RIGHT",i[i.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",i[i.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ft||(ft={}));var Qt=function(i,e,t,A,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,l=i+t,c=e+A;switch(r){case ft.TOP_LEFT:return new Ls(new Ie(i,c),new Ie(i,c-o),new Ie(l-s,e),new Ie(l,e));case ft.TOP_RIGHT:return new Ls(new Ie(i,e),new Ie(i+s,e),new Ie(l,c-o),new Ie(l,c));case ft.BOTTOM_RIGHT:return new Ls(new Ie(l,e),new Ie(l,e+o),new Ie(i+s,c),new Ie(i,c));case ft.BOTTOM_LEFT:default:return new Ls(new Ie(l,c),new Ie(l-s,c),new Ie(i,e+o),new Ie(i,e))}},Ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},Cv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Hs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},vv=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),Is=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),Tv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),bv=function(i){return i.type===0},Gd=function(i){return i.type===1},xv=function(i){return i.type===2},$d=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},Qv=function(i,e,t,A,r){return i.map(function(n,s){switch(s){case 0:return n.add(e,t);case 1:return n.add(e+A,t);case 2:return n.add(e+A,t+r);case 3:return n.add(e,t+r)}return n})},Xd=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Jd=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new yv(this.container),this.container.styles.opacity<1&&this.effects.push(new Tv(this.container.styles.opacity)),this.container.styles.transform!==null){var A=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new vv(A,r,n))}if(this.container.styles.overflowX!==0){var s=Ms(this.curves),o=Hs(this.curves);$d(s,o)?this.effects.push(new Is(s,6)):(this.effects.push(new Is(s,2)),this.effects.push(new Is(o,4)))}}return i.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,A=this.parent,r=this.effects.slice(0);A;){var n=A.effects.filter(function(l){return!Gd(l)});if(t||A.container.styles.position!==0||!A.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(A.container.styles.position)===-1,A.container.styles.overflowX!==0){var s=Ms(A.curves),o=Hs(A.curves);$d(s,o)||r.unshift(new Is(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return Nt(l.target,e)})},i})(),el=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Nt(r.flags,4),s=Nt(r.flags,2),o=new Jd(r,i);Nt(r.styles.display,2048)&&A.push(o);var l=Nt(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Xd(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var g=r.styles.zIndex.order;if(g<0){var B=0;c.negativeZIndex.some(function(b,C){return g>b.element.container.styles.zIndex.order?(B=C,!1):B>0}),c.negativeZIndex.splice(B,0,u)}else if(g>0){var v=0;c.positiveZIndex.some(function(b,C){return g>=b.element.container.styles.zIndex.order?(v=C+1,!1):v>0}),c.positiveZIndex.splice(v,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);el(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),el(o,e,t,l);Nt(r.flags,8)&&Zd(r,l)})},Zd=function(i,e){for(var t=i instanceof za?i.start:1,A=i instanceof za?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Cd&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Gr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},Fv=function(i){var e=new Jd(i,null),t=new Xd(e),A=[];return el(e,t,t,A),Zd(e.container,A),t},Yd=function(i,e){switch(e){case 0:return xA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return xA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return xA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return xA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},Uv=function(i,e){switch(e){case 0:return xA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return xA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return xA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return xA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},Sv=function(i,e){switch(e){case 0:return xA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return xA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return xA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return xA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},Ev=function(i,e){switch(e){case 0:return Ds(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return Ds(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return Ds(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return Ds(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},Ds=function(i,e){var t=[];return bA(i)?t.push(i.subdivide(.5,!1)):t.push(i),bA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},xA=function(i,e,t,A){var r=[];return bA(i)?r.push(i.subdivide(.5,!1)):r.push(i),bA(t)?r.push(t.subdivide(.5,!0)):r.push(t),bA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),bA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},qd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},_s=function(i){var e=i.styles,t=i.bounds,A=Tt(e.paddingLeft,t.width),r=Tt(e.paddingRight,t.width),n=Tt(e.paddingTop,t.width),s=Tt(e.paddingBottom,t.width);return t.add(A+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},Lv=function(i,e){return i===0?e.bounds:i===2?_s(e):qd(e)},Mv=function(i,e){return i===0?e.bounds:i===2?_s(e):qd(e)},tl=function(i,e,t){var A=Lv(Ar(i.styles.backgroundOrigin,e),i),r=Mv(Ar(i.styles.backgroundClip,e),i),n=Hv(Ar(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=kr(Ar(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=Iv(Ar(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),g=Math.round(A.top+l[1]);return[c,u,g,s,o]},tr=function(i){return wt(i)&&i.value===Zi.AUTO},Ps=function(i){return typeof i=="number"},Hv=function(i,e,t){var A=e[0],r=e[1],n=e[2],s=i[0],o=i[1];if(!s)return[0,0];if(Pt(s)&&o&&Pt(o))return[Tt(s,t.width),Tt(o,t.height)];var l=Ps(n);if(wt(s)&&(s.value===Zi.CONTAIN||s.value===Zi.COVER)){if(Ps(n)){var c=t.width/t.height;return c<n!=(s.value===Zi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=Ps(A),g=Ps(r),B=u||g;if(tr(s)&&(!o||tr(o))){if(u&&g)return[A,r];if(!l&&!B)return[t.width,t.height];if(B&&l){var v=u?A:r*n,b=g?r:A/n;return[v,b]}var C=u?A:t.width,U=g?r:t.height;return[C,U]}if(l){var F=0,S=0;return Pt(s)?F=Tt(s,t.width):Pt(o)&&(S=Tt(o,t.height)),tr(s)?F=S*n:(!o||tr(o))&&(S=F/n),[F,S]}var K=null,G=null;if(Pt(s)?K=Tt(s,t.width):o&&Pt(o)&&(G=Tt(o,t.height)),K!==null&&(!o||tr(o))&&(G=u&&g?K/A*r:t.height),G!==null&&tr(s)&&(K=u&&g?G/r*A:t.width),K!==null&&G!==null)return[K,G];throw new Error("Unable to calculate background-size for element")},Ar=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},Iv=function(i,e,t,A,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(i){case 2:return[new Ie(Math.round(A.left),Math.round(A.top+s)),new Ie(Math.round(A.left+A.width),Math.round(A.top+s)),new Ie(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Ie(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Ie(Math.round(A.left+n),Math.round(A.top)),new Ie(Math.round(A.left+n+o),Math.round(A.top)),new Ie(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Ie(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Ie(Math.round(A.left+n),Math.round(A.top+s)),new Ie(Math.round(A.left+n+o),Math.round(A.top+s)),new Ie(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Ie(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Ie(Math.round(r.left),Math.round(r.top)),new Ie(Math.round(r.left+r.width),Math.round(r.top)),new Ie(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Ie(Math.round(r.left),Math.round(r.height+r.top))]}},Dv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",jd="Hidden Text",_v=(function(){function i(e){this._data={},this._document=e}return i.prototype.parseMetrics=function(e,t){var A=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;A.style.visibility="hidden",A.style.fontFamily=e,A.style.fontSize=t,A.style.margin="0",A.style.padding="0",A.style.whiteSpace="nowrap",s.appendChild(A),r.src=Dv,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(jd)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(jd)),A.style.lineHeight="normal",r.style.verticalAlign="super";var l=r.offsetTop-A.offsetTop+2;return s.removeChild(A),{baseline:o,middle:l}},i.prototype.getMetrics=function(e,t){var A=e+" "+t;return typeof this._data[A]>"u"&&(this._data[A]=this.parseMetrics(e,t)),this._data[A]},i})(),ep=(function(){function i(e,t){this.context=e,this.options=t}return i})(),Pv=1e4,Nv=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r._activeEffects=[],r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),A.canvas||(r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px"),r.fontMetrics=new _v(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+A.width+"x"+A.height+") with scale "+A.scale),r}return e.prototype.applyEffects=function(t){for(var A=this;this._activeEffects.length;)this.popEffect();t.forEach(function(r){return A.applyEffect(r)})},e.prototype.applyEffect=function(t){this.ctx.save(),xv(t)&&(this.ctx.globalAlpha=t.opacity),bv(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Gd(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return tA(this,void 0,void 0,function(){return Zt(this,function(A){switch(A.label){case 0:if(Nt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return A.sent(),[4,this.renderNodeContent(t)];case 2:A.sent(),A.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,A,r){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=Va(t.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,t.bounds.top+r),o+n.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var A=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=zv(t.fontFamily).join(", "),n=Or(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,A){return tA(this,void 0,void 0,function(){var r,n,s,o,l,c,u,g,B=this;return Zt(this,function(v){return r=this.createFontStyle(A),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,u=l.middle,g=A.paintOrder,t.textBounds.forEach(function(b){g.forEach(function(C){switch(C){case 0:B.ctx.fillStyle=kt(A.color),B.renderTextWithLetterSpacing(b,A.letterSpacing,c);var U=A.textShadow;U.length&&b.text.trim().length&&(U.slice(0).reverse().forEach(function(F){B.ctx.shadowColor=kt(F.color),B.ctx.shadowOffsetX=F.offsetX.number*B.options.scale,B.ctx.shadowOffsetY=F.offsetY.number*B.options.scale,B.ctx.shadowBlur=F.blur.number,B.renderTextWithLetterSpacing(b,A.letterSpacing,c)}),B.ctx.shadowColor="",B.ctx.shadowOffsetX=0,B.ctx.shadowOffsetY=0,B.ctx.shadowBlur=0),A.textDecorationLine.length&&(B.ctx.fillStyle=kt(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:B.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+c),b.bounds.width,1);break;case 2:B.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:B.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+u),b.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&b.text.trim().length&&(B.ctx.strokeStyle=kt(A.webkitTextStrokeColor),B.ctx.lineWidth=A.webkitTextStrokeWidth,B.ctx.lineJoin=window.chrome?"miter":"round",B.ctx.strokeText(b.text,b.bounds.left,b.bounds.top+c)),B.ctx.strokeStyle="",B.ctx.lineWidth=0,B.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=_s(t),s=Hs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,S,S,c,u,g,B,G,v,b,M,C,U,F,S,K,G,M;return Zt(this,function(W){switch(W.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,r=t.curves,n=A.styles,s=0,o=A.textNodes,W.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,n)]):[3,4];case 2:W.sent(),W.label=3;case 3:return s++,[3,1];case 4:if(!(A instanceof wd))return[3,8];W.label=5;case 5:return W.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return S=W.sent(),this.renderReplacedElement(A,r,S),[3,8];case 7:return W.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Bd&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof yd))return[3,12];W.label=9;case 9:return W.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return S=W.sent(),this.renderReplacedElement(A,r,S),[3,12];case 11:return W.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof xd&&A.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:A.backgroundColor,x:0,y:0,width:A.width,height:A.height}),[4,c.render(A.tree)]):[3,14];case 13:u=W.sent(),A.width&&A.height&&this.ctx.drawImage(u,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),W.label=14;case 14:if(A instanceof Wa&&(g=Math.min(A.bounds.width,A.bounds.height),A.type===xs?A.checked&&(this.ctx.save(),this.path([new Ie(A.bounds.left+g*.39363,A.bounds.top+g*.79),new Ie(A.bounds.left+g*.16,A.bounds.top+g*.5549),new Ie(A.bounds.left+g*.27347,A.bounds.top+g*.44071),new Ie(A.bounds.left+g*.39694,A.bounds.top+g*.5649),new Ie(A.bounds.left+g*.72983,A.bounds.top+g*.23),new Ie(A.bounds.left+g*.84,A.bounds.top+g*.34085),new Ie(A.bounds.left+g*.39363,A.bounds.top+g*.79)]),this.ctx.fillStyle=kt(vd),this.ctx.fill(),this.ctx.restore()):A.type===Qs&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+g/2,A.bounds.top+g/2,g/4,0,Math.PI*2,!0),this.ctx.fillStyle=kt(vd),this.ctx.fill(),this.ctx.restore())),Ov(A)&&A.value.length){switch(B=this.createFontStyle(n),G=B[0],v=B[1],b=this.fontMetrics.getMetrics(G,v).baseline,this.ctx.font=G,this.ctx.fillStyle=kt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Kv(A.styles.textAlign),M=_s(A),C=0,A.styles.textAlign){case 1:C+=M.width/2;break;case 2:C+=M.width;break}U=M.add(C,0,0,-M.height/2+1),this.ctx.save(),this.path([new Ie(M.left,M.top),new Ie(M.left+M.width,M.top),new Ie(M.left+M.width,M.top+M.height),new Ie(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Wr(A.value,U),n.letterSpacing,b),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Nt(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(F=A.styles.listStyleImage,F.type!==0)return[3,18];S=void 0,K=F.url,W.label=15;case 15:return W.trys.push([15,17,,18]),[4,this.context.cache.match(K)];case 16:return S=W.sent(),this.ctx.drawImage(S,A.bounds.left-(S.width+10),A.bounds.top),[3,18];case 17:return W.sent(),this.context.logger.error("Error loading list-style-image "+K),[3,18];case 18:return[3,20];case 19:t.listValue&&A.styles.listStyleType!==-1&&(G=this.createFontStyle(n)[0],this.ctx.font=G,this.ctx.fillStyle=kt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new qA(A.bounds.left,A.bounds.top+Tt(A.styles.paddingTop,A.bounds.width),A.bounds.width,ju(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Wr(t.listValue,M),n.letterSpacing,ju(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),W.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return tA(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,g,B,F,v,b,F,C,U,F;return Zt(this,function(S){switch(S.label){case 0:if(Nt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:S.sent(),A=0,r=t.negativeZIndex,S.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:S.sent(),S.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:S.sent(),n=0,s=t.nonInlineLevel,S.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:S.sent(),S.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,S.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:S.sent(),S.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,S.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:S.sent(),S.label=17;case 17:return c++,[3,15];case 18:g=0,B=t.inlineLevel,S.label=19;case 19:return g<B.length?(F=B[g],[4,this.renderNode(F)]):[3,22];case 20:S.sent(),S.label=21;case 21:return g++,[3,19];case 22:v=0,b=t.zeroOrAutoZIndexOrTransformedOrOpacity,S.label=23;case 23:return v<b.length?(F=b[v],[4,this.renderStack(F)]):[3,26];case 24:S.sent(),S.label=25;case 25:return v++,[3,23];case 26:C=0,U=t.positiveZIndex,S.label=27;case 27:return C<U.length?(F=U[C],[4,this.renderStack(F)]):[3,30];case 28:S.sent(),S.label=29;case 29:return C++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var A=this;t.forEach(function(r,n){var s=bA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),bA(r)&&A.ctx.bezierCurveTo(r.startControl.x,r.startControl.y,r.endControl.x,r.endControl.y,r.end.x,r.end.y)})},e.prototype.renderRepeat=function(t,A,r,n){this.path(t),this.ctx.fillStyle=A,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,A,r){var n;if(t.width===A&&t.height===r)return t;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,A),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,A,r),o},e.prototype.renderBackgroundImage=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l;return Zt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var g,B,v,ie,le,se,Z,Ae,J,b,ie,le,se,Z,Ae,C,U,F,S,K,G,M,W,ne,J,V,ie,re,ce,Z,Ae,oe,le,se,ae,pe,we,Qe,Fe,Be,ve,Ce;return Zt(this,function(be){switch(be.label){case 0:if(u.type!==0)return[3,5];g=void 0,B=u.url,be.label=1;case 1:return be.trys.push([1,3,,4]),[4,n.context.cache.match(B)];case 2:return g=be.sent(),[3,4];case 3:return be.sent(),n.context.logger.error("Error loading background-image "+B),[3,4];case 4:return g&&(v=tl(t,A,[g.width,g.height,g.width/g.height]),ie=v[0],le=v[1],se=v[2],Z=v[3],Ae=v[4],J=n.ctx.createPattern(n.resizeImage(g,Z,Ae),"repeat"),n.renderRepeat(ie,J,le,se)),[3,6];case 5:b2(u)?(b=tl(t,A,[null,null,null]),ie=b[0],le=b[1],se=b[2],Z=b[3],Ae=b[4],C=B2(u.angle,Z,Ae),U=C[0],F=C[1],S=C[2],K=C[3],G=C[4],M=document.createElement("canvas"),M.width=Z,M.height=Ae,W=M.getContext("2d"),ne=W.createLinearGradient(F,K,S,G),Vu(u.stops,U).forEach(function(Le){return ne.addColorStop(Le.stop,kt(Le.color))}),W.fillStyle=ne,W.fillRect(0,0,Z,Ae),Z>0&&Ae>0&&(J=n.ctx.createPattern(M,"repeat"),n.renderRepeat(ie,J,le,se))):x2(u)&&(V=tl(t,A,[null,null,null]),ie=V[0],re=V[1],ce=V[2],Z=V[3],Ae=V[4],oe=u.position.length===0?[Fa]:u.position,le=Tt(oe[0],Z),se=Tt(oe[oe.length-1],Ae),ae=y2(u,le,se,Z,Ae),pe=ae[0],we=ae[1],pe>0&&we>0&&(Qe=n.ctx.createRadialGradient(re+le,ce+se,0,re+le,ce+se,pe),Vu(u.stops,pe*2).forEach(function(Le){return Qe.addColorStop(Le.stop,kt(Le.color))}),n.path(ie),n.ctx.fillStyle=Qe,pe!==we?(Fe=t.bounds.left+.5*t.bounds.width,Be=t.bounds.top+.5*t.bounds.height,ve=we/pe,Ce=1/ve,n.ctx.save(),n.ctx.translate(Fe,Be),n.ctx.transform(1,0,0,ve,0,0),n.ctx.translate(-Fe,-Be),n.ctx.fillRect(re,Ce*(ce-Be)+Be,Z,Ae*Ce),n.ctx.restore()):n.ctx.fill())),be.label=6;case 6:return A--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,A,r){return tA(this,void 0,void 0,function(){return Zt(this,function(n){return this.path(Yd(r,A)),this.ctx.fillStyle=kt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return tA(this,void 0,void 0,function(){var s,o;return Zt(this,function(l){switch(l.label){case 0:return A<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=Uv(n,r),this.path(s),this.ctx.fillStyle=kt(t),this.ctx.fill(),o=Sv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,g=this;return Zt(this,function(B){switch(B.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!di(A.backgroundColor)||A.backgroundImage.length,n=[{style:A.borderTopStyle,color:A.borderTopColor,width:A.borderTopWidth},{style:A.borderRightStyle,color:A.borderRightColor,width:A.borderRightWidth},{style:A.borderBottomStyle,color:A.borderBottomColor,width:A.borderBottomWidth},{style:A.borderLeftStyle,color:A.borderLeftColor,width:A.borderLeftWidth}],s=kv(Ar(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),di(A.backgroundColor)||(this.ctx.fillStyle=kt(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:B.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){g.ctx.save();var b=Ms(t.curves),C=v.inset?0:Pv,U=Qv(b,-C+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(g.path(b),g.ctx.clip(),g.mask(U)):(g.mask(b),g.ctx.clip(),g.path(U)),g.ctx.shadowOffsetX=v.offsetX.number+C,g.ctx.shadowOffsetY=v.offsetY.number,g.ctx.shadowColor=kt(v.color),g.ctx.shadowBlur=v.blur.number,g.ctx.fillStyle=v.inset?kt(v.color):"rgba(0,0,0,1)",g.ctx.fill(),g.ctx.restore()}),B.label=2;case 2:o=0,l=0,c=n,B.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!di(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return B.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return B.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return B.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:B.sent(),B.label=11;case 11:o++,B.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return tA(this,void 0,void 0,function(){var o,l,c,u,g,B,v,b,C,U,F,S,K,G,M,W,M,W;return Zt(this,function(ne){return this.ctx.save(),o=Ev(n,r),l=Yd(n,r),s===2&&(this.path(l),this.ctx.clip()),bA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),bA(l[1])?(g=l[1].end.x,B=l[1].end.y):(g=l[1].x,B=l[1].y),r===0||r===2?v=Math.abs(c-g):v=Math.abs(u-B),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),b=A<3?A*3:A*2,C=A<3?A*2:A,s===3&&(b=A,C=A),U=!0,v<=b*2?U=!1:v<=b*2+C?(F=v/(2*b+C),b*=F,C*=F):(S=Math.floor((v+C)/(b+C)),K=(v-S*b)/(S-1),G=(v-(S+1)*b)/S,C=G<=0||Math.abs(C-K)<Math.abs(C-G)?K:G),U&&(s===3?this.ctx.setLineDash([0,b+C]):this.ctx.setLineDash([b,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=kt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(bA(l[0])&&(M=l[3],W=l[0],this.ctx.beginPath(),this.formatPath([new Ie(M.end.x,M.end.y),new Ie(W.start.x,W.start.y)]),this.ctx.stroke()),bA(l[1])&&(M=l[1],W=l[2],this.ctx.beginPath(),this.formatPath([new Ie(M.end.x,M.end.y),new Ie(W.start.x,W.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=kt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=Fv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(ep),Ov=function(i){return i instanceof bd||i instanceof Td?!0:i instanceof Wa&&i.type!==Qs&&i.type!==xs},kv=function(i,e){switch(i){case 0:return Ms(e);case 2:return Cv(e);default:return Hs(e)}},Kv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},Vv=["-apple-system","system-ui"],zv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return Vv.indexOf(e)===-1}):i},Wv=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=A,r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale),r}return e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A,r;return Zt(this,function(n){switch(n.label){case 0:return A=Ka(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Rv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=kt(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(ep),Rv=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Gv=(function(){function i(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return i.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.getTime=function(){return Date.now()-this.start},i.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Rn([this.id,this.getTime()+"ms"],e))},i.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),$v=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Gv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new dv(this,e)}return i.instanceCount=1,i})(),Xv=function(i,e){return e===void 0&&(e={}),Jv(i,e)};typeof window<"u"&&Rd.setContext(window);var Jv=function(i,e){return tA(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,g,B,v,b,C,U,F,S,K,G,M,ne,W,ne,J,V,ie,re,ce,Z,Ae,oe,le,se,ae,pe,we,Qe,Fe,Be,ve;return Zt(this,function(Ce){switch(Ce.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:(J=e.allowTaint)!==null&&J!==void 0?J:!1,imageTimeout:(V=e.imageTimeout)!==null&&V!==void 0?V:15e3,proxy:e.proxy,useCORS:(ie=e.useCORS)!==null&&ie!==void 0?ie:!1},n=sa({logging:(re=e.logging)!==null&&re!==void 0?re:!0,cache:e.cache},r),s={windowWidth:(ce=e.windowWidth)!==null&&ce!==void 0?ce:A.innerWidth,windowHeight:(Z=e.windowHeight)!==null&&Z!==void 0?Z:A.innerHeight,scrollX:(Ae=e.scrollX)!==null&&Ae!==void 0?Ae:A.pageXOffset,scrollY:(oe=e.scrollY)!==null&&oe!==void 0?oe:A.pageYOffset},o=new qA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new $v(n,o),c=(le=e.foreignObjectRendering)!==null&&le!==void 0?le:!1,u={allowTaint:(se=e.allowTaint)!==null&&se!==void 0?se:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),g=new zd(l,i,u),B=g.clonedReferenceElement,B?[4,g.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=Ce.sent(),b=Ga(B)||ZC(B)?Qw(B.ownerDocument):Gn(l,B),C=b.width,U=b.height,F=b.left,S=b.top,K=Zv(l,B,e.backgroundColor),G={canvas:e.canvas,backgroundColor:K,scale:(pe=(ae=e.scale)!==null&&ae!==void 0?ae:A.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((we=e.x)!==null&&we!==void 0?we:0)+F,y:((Qe=e.y)!==null&&Qe!==void 0?Qe:0)+S,width:(Fe=e.width)!==null&&Fe!==void 0?Fe:Math.ceil(C),height:(Be=e.height)!==null&&Be!==void 0?Be:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),ne=new Wv(l,G),[4,ne.render(B)]):[3,3];case 2:return M=Ce.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+S+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),W=Fd(l,B),K===W.styles.backgroundColor&&(W.styles.backgroundColor=ei.TRANSPARENT),l.logger.debug("Starting renderer for element at "+G.x+","+G.y+" with size "+G.width+"x"+G.height),ne=new Nv(l,G),[4,ne.render(W)];case 4:M=Ce.sent(),Ce.label=5;case 5:return(!((ve=e.removeContainer)!==null&&ve!==void 0)||ve)&&(zd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Zv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Kr(i,getComputedStyle(A.documentElement).backgroundColor):ei.TRANSPARENT,n=A.body?Kr(i,getComputedStyle(A.body).backgroundColor):ei.TRANSPARENT,s=typeof t=="string"?Kr(i,t):t===null?ei.TRANSPARENT:4294967295;return e===A.documentElement?di(r)?di(n)?s:n:r:s};const Yv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class qv{constructor(e,t,A="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=r,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=o.context,c=n._chart,u=n._series;if(!c||!u)return;const g=u.priceToCoordinate(n.price);if(g==null)return;const B=Math.round(g*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),b=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(b>=C)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(b,B),l.lineTo(C,B),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(b,B,U,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tp{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!A.visible||!A.text||!A._series)return;const c=A._series.priceToCoordinate(A.price);if(c==null)return;const u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const g=Math.round(8*o),B=Math.round(14*l),v=s.width;let b;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);b=F!=null?Math.round(F*o):g,n.textAlign="right"}else b=g,n.textAlign="left";else A.hAlign==="right"?(b=v-g,n.textAlign="right"):(b=v/2,n.textAlign="center");const C=Math.round(c*l);let U;A.vAlign==="top"?U=C-B:A.vAlign==="bottom"?U=C+B:U=C,n.fillStyle=A.textColor,n.fillText(A.text,b,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class jv{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const g=l.horizontalPixelRatio,B=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||b==null||C==null||U==null)return;const F=Math.round(v*g),S=Math.round(C*B),K=Math.round(b*g),G=Math.round(U*B),M=l.context;if(M.save(),M.beginPath(),M.strokeStyle=s.color,M.lineWidth=s.lineWidth*B,M.setLineDash([]),M.moveTo(F,S),M.lineTo(K,G),M.stroke(),M.beginPath(),M.fillStyle=s.color,M.arc(F,S,3*B,0,Math.PI*2),M.fill(),M.beginPath(),M.arc(K,G,3*B,0,Math.PI*2),M.fill(),!s.statsShowAlways&&!s.isActive){M.restore();return}const{priceDiff:W,pricePct:ne,bars:J,days:V,angle:ie}=s.info,re=W>=0?"+":"",ce=[];if(s.statsPriceRange!==!1&&ce.push(`${re}${W.toFixed(5)} (${re}${ne.toFixed(2)}%)`),s.statsBarsRange!==!1&&ce.push(`${J} bars`),s.statsDateRange!==!1&&ce.push(`${V} days`),s.statsAngle!==!1&&ce.push(`∠ ${ie.toFixed(1)}°`),s.statsDistance&&ce.push(`Δ ${Math.abs(W).toFixed(5)}`),ce.length===0){M.restore();return}const Z=Math.round(11*B);M.font=`${Z}px sans-serif`;const Ae=Z*1.6,oe=8*B,le=Math.max(...ce.map(Ge=>M.measureText(Ge).width))+oe*2,se=ce.length*Ae+oe*2,ae=s.statsPosition??"right";let pe,we;ae==="left"?(pe=F,we=S):ae==="center"?(pe=Math.round((F+K)/2),we=Math.round((S+G)/2)):(pe=K,we=G);let Qe,Fe;ae==="left"?(Qe=pe-le-10*g,Fe=we-se-4*B):ae==="center"?(Qe=pe-le/2,Fe=we-se-8*B):(Qe=pe+10*g,Fe=we-se-4*B);const Be=l.bitmapSize.width,ve=l.bitmapSize.height,Ce=Math.min(Math.max(0,Qe),Be-le-4*g),be=Math.min(Math.max(4*B,Fe),ve-se-4*B),Le=4*B;M.beginPath(),M.moveTo(Ce+Le,be),M.lineTo(Ce+le-Le,be),M.quadraticCurveTo(Ce+le,be,Ce+le,be+Le),M.lineTo(Ce+le,be+se-Le),M.quadraticCurveTo(Ce+le,be+se,Ce+le-Le,be+se),M.lineTo(Ce+Le,be+se),M.quadraticCurveTo(Ce,be+se,Ce,be+se-Le),M.lineTo(Ce,be+Le),M.quadraticCurveTo(Ce,be,Ce+Le,be),M.closePath(),M.fillStyle="rgba(30, 41, 59, 0.92)",M.fill(),M.strokeStyle=s.statsColor||s.color,M.lineWidth=1*B,M.stroke(),M.fillStyle="#e2e8f0",M.textAlign="left",ce.forEach((Ge,Ke)=>{M.fillText(Ge,Ce+oe,be+oe+Z+Ke*Ae)}),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ap{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const g=l.horizontalPixelRatio,B=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||b==null||C==null||U==null)return;const F=Math.round(v*g),S=Math.round(C*B),K=Math.round(b*g),G=Math.round(U*B),M=s.lineColor??s.color,W=l.context;if(W.save(),s.showArea&&(W.fillStyle=s.fillColor,W.fillRect(Math.min(F,K),Math.min(S,G),Math.abs(K-F),Math.abs(G-S)),W.strokeStyle=M,W.lineWidth=1*B,W.setLineDash([]),W.strokeRect(Math.min(F,K),Math.min(S,G),Math.abs(K-F),Math.abs(G-S))),W.beginPath(),W.strokeStyle=M,W.lineWidth=2*B,W.moveTo(F,S),W.lineTo(K,G),W.stroke(),W.fillStyle=M,W.beginPath(),W.arc(F,S,3*B,0,Math.PI*2),W.fill(),W.beginPath(),W.arc(K,G,3*B,0,Math.PI*2),W.fill(),!s.statsShowAlways&&!s.isActive){W.restore();return}const{priceDiff:ne,pricePct:J,bars:V,days:ie}=s.info,re=ne>=0?"+":"",ce=[];if(s.statsPriceRange&&ce.push(re+ne.toFixed(5)+" ("+re+J.toFixed(2)+"%)"),s.statsBarsRange&&ce.push(V+" bars"),s.statsDateRange&&ce.push(ie+" days"),ce.length===0){W.restore();return}const Z=Math.round(11*B);W.font=Z+"px sans-serif";const Ae=Z*1.6,oe=8*B,le=Math.max(...ce.map(Ce=>W.measureText(Ce).width))+oe*2,se=ce.length*Ae+oe*2,ae=l.bitmapSize.width,pe=l.bitmapSize.height;let we,Qe;if(s.statsPosition==="left")we=F-le-10*g,Qe=S-se-4*B;else if(s.statsPosition==="center"){const Ce=(F+K)/2,be=(S+G)/2;we=Ce-le/2,Qe=be-se-4*B}else we=K+10*g,Qe=G-se-4*B;const Fe=Math.min(Math.max(0,we),ae-le-4*g),Be=Math.min(Math.max(4*B,Qe),pe-se-4*B),ve=4*B;W.beginPath(),W.moveTo(Fe+ve,Be),W.lineTo(Fe+le-ve,Be),W.quadraticCurveTo(Fe+le,Be,Fe+le,Be+ve),W.lineTo(Fe+le,Be+se-ve),W.quadraticCurveTo(Fe+le,Be+se,Fe+le-ve,Be+se),W.lineTo(Fe+ve,Be+se),W.quadraticCurveTo(Fe,Be+se,Fe,Be+se-ve),W.lineTo(Fe,Be+ve),W.quadraticCurveTo(Fe,Be,Fe+ve,Be),W.closePath(),W.fillStyle="rgba(30, 41, 59, 0.92)",W.fill(),W.strokeStyle=s.statsColor||M,W.lineWidth=1*B,W.stroke(),W.fillStyle="#e2e8f0",W.textAlign="left",ce.forEach((Ce,be)=>{W.fillText(Ce,Fe+oe,Be+oe+Z+be*Ae)}),W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class eT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.fillColor=A.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.min(g,B)*c,U=Math.max(g,B)*c,F=Math.min(v,b)*u,S=Math.max(v,b)*u,K=U-C,G=S-F;if(K<.5||G<.5)return;const M=s.context;M.save(),M.fillStyle=r.fillColor,M.fillRect(C,F,K,G),M.strokeStyle=r.strokeColor,M.lineWidth=r.lineWidth*u,M.setLineDash([]),M.strokeRect(C,F,K,G),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*c,U=B*u,F=v*c,S=b*u,K=Math.hypot(F-C,S-U);if(K<.5)return;const G=s.context;G.save(),G.strokeStyle=r.strokeColor,G.lineWidth=r.lineWidth*u,G.setLineDash([]),G.beginPath(),G.arc(C,U,K,0,Math.PI*2),G.stroke(),G.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class AT{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,c=n._series;if(!l||!c)return;const u=o.horizontalPixelRatio,g=o.verticalPixelRatio,B=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),b=l.timeScale().timeToCoordinate(n.p2.rawTime),C=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(B==null||v==null||b==null||C==null||U==null||F==null)return;const S=B*u,K=v*g,G=b*u,M=C*g,W=U*u,ne=F*g,J=o.context;J.save(),J.beginPath(),J.moveTo(S,K),J.lineTo(G,M),J.lineTo(W,ne),J.closePath(),J.fillStyle=n.fillColor,J.fill(),J.strokeStyle=n.strokeColor,J.lineWidth=n.lineWidth*g,J.setLineDash([]),J.stroke(),J.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class iT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.minorRatio=A.minorRatio??.45,this.previewAsLine=A.previewAsLine??!1,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*c,U=B*u,F=v*c,S=b*u,K=F-C,G=S-U,M=Math.hypot(K,G);if(M<.5)return;const W=s.context;if(W.save(),W.strokeStyle=r.strokeColor,W.lineWidth=r.lineWidth*u,W.setLineDash([]),r.previewAsLine)W.beginPath(),W.moveTo(C,U),W.lineTo(F,S),W.stroke();else{const ne=(C+F)/2,J=(U+S)/2,V=Math.atan2(G,K),ie=M/2,re=Math.max(1,ie*Math.max(.05,r.minorRatio));W.beginPath(),W.ellipse(ne,J,ie,re,V,0,Math.PI*2),W.stroke()}W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ip{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#f59e0b",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight!==!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.round(g*c),U=Math.round(v*u),F=Math.round(B*c),S=Math.round(b*u),K=F-C,G=S-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const W=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const ce=U+W*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=S+W*(re-F);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,S),M.stroke();const ne=Math.atan2(S-U,F-C),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),ce=S-J*Math.sin(ne-V),Z=F-J*Math.cos(ne+V),Ae=S-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.lineTo(Z,Ae),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,ce=C-J*Math.cos(re-V),Z=U-J*Math.sin(re-V),Ae=C-J*Math.cos(re+V),oe=U-J*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(Ae,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,Ae=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(Ae-Z),ae=Z!==0?Math.abs((Ae-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+ae.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(ce);if(se!=null&&ae!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);pe!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),ae=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ae>0?ae+" day"+(ae!==1?"s":""):"";pe>0&&(Qe+=(Qe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!ae&&!pe&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+Qe+")":le.push(Qe)}if(r.statsDistance){const se=K/c,ae=G/u;le.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=K/c,ae=G/u,pe=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,pe=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Fe=oe.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Be=oe.length*pe+we*2,[ve,Ce,be,Le]=C<=F?[C,U,F,S]:[F,S,C,U];let Ge,Ke;r.statsPosition==="left"?(Ge=ve,Ke=Ce):r.statsPosition==="center"?(Ge=(ve+be)/2,Ke=(Ce+Le)/2):(Ge=be,Ke=Le);const Te=Ge-Fe/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,_e,Fe,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,_e,Fe,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,de)=>{M.fillText(ye,Te+we,_e+we+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class rT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.round(g*c),U=Math.round(v*u),F=Math.round(B*c),S=Math.round(b*u),K=F-C,G=S-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const W=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const ce=U+W*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=S+W*(re-F);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,S),M.stroke();const ne=Math.atan2(S-U,F-C),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),ce=S-J*Math.sin(ne-V),Z=F-J*Math.cos(ne+V),Ae=S-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.lineTo(Z,Ae),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,ce=C-J*Math.cos(re-V),Z=U-J*Math.sin(re-V),Ae=C-J*Math.cos(re+V),oe=U-J*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(Ae,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,Ae=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(Ae-Z),ae=Z!==0?Math.abs((Ae-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+ae.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(ce);if(se!=null&&ae!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);pe!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),ae=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ae>0?ae+" day"+(ae!==1?"s":""):"";pe>0&&(Qe+=(Qe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!ae&&!pe&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+Qe+")":le.push(Qe)}if(r.statsDistance){const se=K/c,ae=G/u;le.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=K/c,ae=G/u,pe=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,pe=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Fe=oe.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Be=oe.length*pe+we*2,[ve,Ce,be,Le]=C<=F?[C,U,F,S]:[F,S,C,U];let Ge,Ke;r.statsPosition==="left"?(Ge=ve,Ke=Ce):r.statsPosition==="center"?(Ge=(ve+be)/2,Ke=(Ce+Le)/2):(Ge=be,Ke=Le);const Te=Ge-Fe/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,_e,Fe,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,_e,Fe,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,de)=>{M.fillText(ye,Te+we,_e+we+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class nT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft!==!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=Math.round(g*c),U=Math.round(v*u),F=Math.round(B*c),S=Math.round(b*u),K=F-C,G=S-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const W=Math.abs(K)<1e-4?0:G/K;if(r.rayLeft){const ce=U+W*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=S+W*(re-F);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,S),M.stroke();const ne=Math.atan2(S-U,F-C),J=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-J*Math.cos(ne-V),ce=S-J*Math.sin(ne-V),Z=F-J*Math.cos(ne+V),Ae=S-J*Math.sin(ne+V);M.beginPath(),M.moveTo(F,S),M.lineTo(re,ce),M.lineTo(Z,Ae),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,ce=C-J*Math.cos(re-V),Z=U-J*Math.sin(re-V),Ae=C-J*Math.cos(re+V),oe=U-J*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(Ae,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,Ae=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(Ae-Z),ae=Z!==0?Math.abs((Ae-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+ae.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ae=o.timeScale().timeToCoordinate(ce);if(se!=null&&ae!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ae);pe!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),ae=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ae>0?ae+" day"+(ae!==1?"s":""):"";pe>0&&(Qe+=(Qe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!ae&&!pe&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+Qe+")":le.push(Qe)}if(r.statsDistance){const se=K/c,ae=G/u;le.push("distance: "+Math.sqrt(se*se+ae*ae).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=K/c,ae=G/u,pe=Math.atan2(ae,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ae=11*se,pe=ae*1.5,we=5*se;M.font=ae+"px sans-serif";const Fe=oe.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Be=oe.length*pe+we*2,[ve,Ce,be,Le]=C<=F?[C,U,F,S]:[F,S,C,U];let Ge,Ke;r.statsPosition==="left"?(Ge=ve,Ke=Ce):r.statsPosition==="center"?(Ge=(ve+be)/2,Ke=(Ce+Le)/2):(Ge=be,Ke=Le);const Te=Ge-Fe/2,_e=Ke-Be-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,_e,Fe,Be),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,_e,Fe,Be),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((ye,de)=>{M.fillText(ye,Te+we,_e+we+de*pe)})}}M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class sT{constructor(e,t,A="#22c55e",r=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const u=n._chart,g=n._series;if(!u||!g)return;const B=o.horizontalPixelRatio,v=o.verticalPixelRatio,b=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),C=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=g.priceToCoordinate(n.p1.price),F=g.priceToCoordinate(n.p2.price);if(b==null||C==null||U==null||F==null)return;const S=b*B,K=U*v,G=C*B,M=F*v,[W,ne,J,V]=S<=G?[S,K,G,M]:[G,M,S,K];let ie=J-W,re=V-ne;Math.abs(ie)<1e-4&&(ie=1e-4);const ce=re/ie,Z=o.context;if(Z.save(),Z.strokeStyle=n.color,Z.fillStyle=n.color,Z.lineWidth=n.lineWidth*v,Z.setLineDash([]),n.rayLeft){const ae=ne+ce*(0-W);Z.beginPath(),Z.moveTo(0,ae),Z.lineTo(W,ne),Z.stroke()}if(n.rayRight){const se=o.bitmapSize.width,ae=V+ce*(se-J);Z.beginPath(),Z.moveTo(J,V),Z.lineTo(se,ae),Z.stroke()}const Ae=Math.atan2(re,ie),oe=(n.lineWidth*4+4)*v,le=Math.PI/7;if(n.arrowRight){const se=J-oe*Math.cos(Ae-le),ae=V-oe*Math.sin(Ae-le),pe=J-oe*Math.cos(Ae+le),we=V-oe*Math.sin(Ae+le);Z.beginPath(),Z.moveTo(J,V),Z.lineTo(se,ae),Z.lineTo(pe,we),Z.closePath(),Z.fill()}if(n.arrowLeft){const se=Ae+Math.PI,ae=W-oe*Math.cos(se-le),pe=ne-oe*Math.sin(se-le),we=W-oe*Math.cos(se+le),Qe=ne-oe*Math.sin(se+le);Z.beginPath(),Z.moveTo(W,ne),Z.lineTo(ae,pe),Z.lineTo(we,Qe),Z.closePath(),Z.fill()}if(c){const se=n.p1.rawTime??n.p1.time,ae=n.p2.rawTime??n.p2.time,pe=n.p1.price,we=n.p2.price,Qe=[];if(n.statsPriceRange){const Be=Math.abs(we-pe),ve=pe!==0?Math.abs((we-pe)/pe*100):0,Ce=Be<1e-4?6:Be<.01?5:Be<1?4:2;Qe.push("↕ "+Be.toFixed(Ce)+" ("+ve.toFixed(2)+"%)")}const Fe=[];if(n.statsBarsRange)try{const Be=u.timeScale().timeToCoordinate(se),ve=u.timeScale().timeToCoordinate(ae);if(Be!=null&&ve!=null){const Ce=u.timeScale().coordinateToLogical(Be),be=u.timeScale().coordinateToLogical(ve);Ce!=null&&be!=null&&Fe.push("↔ "+Math.abs(Math.round(be-Ce))+" bars")}}catch{}if(n.statsDateRange){const Be=Math.abs(ae-se),ve=Math.floor(Be/86400),Ce=Math.floor(Be%86400/3600),be=Math.floor(Be%3600/60);let Le=ve>0?ve+" day"+(ve!==1?"s":""):"";Ce>0&&(Le+=(Le?" ":"")+Ce+" hour"+(Ce!==1?"s":"")),!ve&&!Ce&&(Le=be+" min"+(be!==1?"s":"")),n.statsBarsRange&&Fe.length>0?Fe[Fe.length-1]+=" ("+Le+")":Fe.push(Le)}if(n.statsDistance){const Be=(G-S)/B,ve=(M-K)/v;Fe.push("distance: "+Math.sqrt(Be*Be+ve*ve).toFixed(2))}if(Fe.length>0&&Qe.push(Fe.join(", ")),n.statsAngle){const Be=ie/B,ve=re/v,Ce=Math.atan2(ve,Be)*180/Math.PI;Qe.push("∠ "+Ce.toFixed(0)+"°")}if(Qe.length>0){const Be=Math.min(B,v),ve=11*Be,Ce=ve*1.5,be=5*Be;Z.font=ve+"px sans-serif";const Ge=Qe.reduce((Pe,et)=>Math.max(Pe,Z.measureText(et).width),0)+be*2,Ke=Qe.length*Ce+be*2;let Te,_e;n.statsPosition==="left"?(Te=W,_e=ne):n.statsPosition==="center"?(Te=(W+J)/2,_e=(ne+V)/2):(Te=J,_e=V);const ye=Te-Ge/2,de=_e-Ke-12*Be;Z.fillStyle="rgba(20, 20, 30, 0.72)",Z.fillRect(ye,de,Ge,Ke),Z.strokeStyle=n.statsColor,Z.lineWidth=1*Be,Z.strokeRect(ye,de,Ge,Ke),Z.fillStyle=n.statsColor,Z.textBaseline="top",Z.textAlign="left",Qe.forEach((Pe,et)=>{Z.fillText(Pe,ye+be,de+be+et*Ce)})}}Z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class oT{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=s.timeScale().timeToCoordinate(A.center.rawTime),g=o.priceToCoordinate(A.center.price);if(u==null||g==null)return;const B=Math.round(u*l),v=Math.round(g*c),b=n.bitmapSize.width,C=n.bitmapSize.height,U=n.context;if(U.save(),U.strokeStyle=A.color,U.lineWidth=A.lineWidth*c,U.setLineDash([]),U.beginPath(),U.moveTo(0,v),U.lineTo(b,v),U.stroke(),U.beginPath(),U.moveTo(B,0),U.lineTo(B,C),U.stroke(),A.showPrice){const F=A.center.price.toFixed(5),S=Math.round(11*c);U.font=S+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="left";const K=U.measureText(F).width,G=Math.round(6*l),M=Math.round(3*c),W=S+2*M,ne=K+2*G,J=b-ne-Math.round(2*l),V=v-W/2;U.fillStyle=A.color,U.fillRect(J,V,ne,W),U.fillStyle="#ffffff",U.fillText(F,J+G,v)}if(A.showTime){const F=A.center.rawTime,S=new Date(F*1e3),K=Z=>String(Z).padStart(2,"0"),G=K(S.getUTCDate())+"."+K(S.getUTCMonth()+1)+"."+S.getUTCFullYear()+" "+K(S.getUTCHours())+":"+K(S.getUTCMinutes())+":"+K(S.getUTCSeconds()),M=Math.round(11*c);U.font=M+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const W=U.measureText(G).width,ne=Math.round(6*l),J=Math.round(3*c),V=M+2*J,ie=W+2*ne,re=B-ie/2,ce=C-V-Math.round(4*c);U.fillStyle=A.color,U.fillRect(re,ce,ie,V),U.fillStyle="#ffffff",U.fillText(G,B,ce+V/2)}U.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class aT{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),B=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*c,U=v*u,F=B*c,S=b*u,K=C-F,G=U-S,M=F-C,W=S-U;if(Math.hypot(K,G)<1e-4)return;const J=Math.atan2(G,K),V=Math.round(Math.abs(J*180/Math.PI)),ie=s.context;ie.save(),ie.strokeStyle=r.color,ie.fillStyle=r.color,ie.lineWidth=r.lineWidth*u,ie.setLineDash([]);const re=Math.abs(M)<1e-4?0:W/M;if(r.rayLeft){const we=U+re*(0-C);ie.beginPath(),ie.moveTo(0,we),ie.lineTo(C,U),ie.stroke()}if(r.rayRight){const pe=s.bitmapSize.width,we=S+re*(pe-F);ie.beginPath(),ie.moveTo(F,S),ie.lineTo(pe,we),ie.stroke()}ie.beginPath(),ie.moveTo(C,U),ie.lineTo(F,S),ie.stroke();const ce=Math.atan2(W,M),Z=(r.lineWidth*4+4)*u,Ae=Math.PI/7;if(r.arrowRight){const pe=F-Z*Math.cos(ce-Ae),we=S-Z*Math.sin(ce-Ae),Qe=F-Z*Math.cos(ce+Ae),Fe=S-Z*Math.sin(ce+Ae);ie.beginPath(),ie.moveTo(F,S),ie.lineTo(pe,we),ie.lineTo(Qe,Fe),ie.closePath(),ie.fill()}if(r.arrowLeft){const pe=ce+Math.PI,we=C-Z*Math.cos(pe-Ae),Qe=U-Z*Math.sin(pe-Ae),Fe=C-Z*Math.cos(pe+Ae),Be=U-Z*Math.sin(pe+Ae);ie.beginPath(),ie.moveTo(C,U),ie.lineTo(we,Qe),ie.lineTo(Fe,Be),ie.closePath(),ie.fill()}const oe=28*u;ie.strokeStyle="rgba(122,166,174,0.55)",ie.fillStyle=r.color,ie.lineWidth=1*u,ie.beginPath(),ie.moveTo(F,S),ie.lineTo(F+oe,S),ie.stroke(),ie.beginPath(),ie.strokeStyle="rgba(122,166,174,0.45)",ie.arc(F,S,oe,0,J,J<0),ie.stroke(),ie.fillStyle="#4b7c86",ie.font=`${Math.round(10*u)}px sans-serif`,ie.textAlign="left",ie.textBaseline="middle";const le=F+(oe+10*u)*Math.cos(J/2),se=S+(oe+10*u)*Math.sin(J/2);if(ie.fillText(`${V}°`,le,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const pe=r.p1.price,we=r.p2.price,Qe=[];if(r.statsPriceRange){const Be=Math.abs(we-pe),ve=pe!==0?Math.abs((we-pe)/pe*100):0,Ce=Be<1e-4?6:Be<.01?5:Be<1?4:2;Qe.push("↕ "+Be.toFixed(Ce)+" ("+ve.toFixed(2)+"%)")}const Fe=[];if(r.statsDistance){const Be=M/c,ve=W/u;Fe.push("distance: "+Math.sqrt(Be*Be+ve*ve).toFixed(2))}if(Fe.length>0&&Qe.push(Fe.join(", ")),Qe.length>0){const Be=Math.min(c,u),ve=11*Be,Ce=ve*1.5,be=5*Be;ie.font=ve+"px sans-serif";const Ge=Qe.reduce((dt,fA)=>Math.max(dt,ie.measureText(fA).width),0)+be*2,Ke=Qe.length*Ce+be*2,[Te,_e,ye,de]=C<=F?[C,U,F,S]:[F,S,C,U];let Pe,et;r.statsPosition==="left"?(Pe=Te,et=_e):r.statsPosition==="center"?(Pe=(Te+ye)/2,et=(_e+de)/2):(Pe=ye,et=de);const it=Pe-Ge/2,rt=et-Ke-12*Be;ie.fillStyle="rgba(20, 20, 30, 0.72)",ie.fillRect(it,rt,Ge,Ke),ie.strokeStyle=r.statsColor,ie.lineWidth=1*Be,ie.strokeRect(it,rt,Ge,Ke),ie.fillStyle=r.statsColor,ie.textBaseline="top",ie.textAlign="left",Qe.forEach((dt,fA)=>{ie.fillText(dt,it+be,rt+be+fA*Ce)})}}ie.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class lT{constructor(e,t,A){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=s.context,B=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(B==null||v==null||b==null||C==null||U==null||F==null)return;const S=B*c,K=v*u,G=b*c,M=C*u,W=U*c,ne=F*u,J=(G+W)/2,V=(M+ne)/2;let ie=J-S,re=V-K;Math.abs(ie)<1e-4&&(ie=1e-4);const ce=re/ie,Z=s.bitmapSize.width,Ae=(G-W)/2,oe=(M-ne)/2,le=Be=>({x:J+Ae*Be,y:V+oe*Be}),se=(Be,ve)=>({x:Z,y:ve+ce*(Z-Be)}),ae=le(1),pe=le(-1),we=se(ae.x,ae.y),Qe=se(pe.x,pe.y);g.save(),g.beginPath(),g.moveTo(ae.x,ae.y),g.lineTo(we.x,we.y),g.lineTo(Qe.x,Qe.y),g.lineTo(pe.x,pe.y),g.closePath(),g.fillStyle="rgba(148, 163, 184, 0.2)",g.fill(),g.beginPath(),g.strokeStyle="rgba(148, 163, 184, 0.9)",g.lineWidth=1*u,g.moveTo(G,M),g.lineTo(W,ne),g.stroke(),r._levels.forEach(Be=>{const ve=le(Be.k),Ce=se(ve.x,ve.y);g.beginPath(),g.strokeStyle=Be.color,g.lineWidth=Be.width*u,g.moveTo(ve.x,ve.y),g.lineTo(Ce.x,Ce.y),g.stroke()});const Fe=se(S,K);g.beginPath(),g.strokeStyle="rgba(161, 98, 7, 0.9)",g.lineWidth=1.1*u,g.moveTo(S,K),g.lineTo(Fe.x,Fe.y),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cT{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,g=s.timeScale().timeToCoordinate(A.p1.rawTime),B=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),b=o.priceToCoordinate(A.p2.price);if(g==null||B==null||v==null||b==null)return;const C=g*l,U=B*c,F=v*l,S=b*c,K=n.bitmapSize.width,G=Math.abs(F-C)<1e-4?1:F-C,M=(S-U)/G,W=F>=C?1:-1,ne=W>0?K:0,J=C+W*Math.min(220*l,Math.max(80*l,K*.35)),V=A._rays.map(re=>{const ce=M*re.ratio;return{...re,yEnd:U+ce*(ne-C),yLabel:U+ce*(J-C)}});u.save();const ie=(re,ce,Z)=>{!re||!ce||(u.beginPath(),u.moveTo(C,U),u.lineTo(ne,re.yEnd),u.lineTo(ne,ce.yEnd),u.closePath(),u.fillStyle=Z,u.fill())};ie(V[0],V[3],"rgba(161, 98, 7, 0.10)"),ie(V[3],V[4],"rgba(5, 150, 105, 0.10)"),ie(V[4],V[5],"rgba(107, 114, 128, 0.12)"),V.forEach(re=>{u.beginPath(),u.strokeStyle=re.color,u.lineWidth=1*c,u.moveTo(C,U),u.lineTo(ne,re.yEnd),u.stroke()}),u.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,u.textAlign=W>0?"left":"right",u.textBaseline="middle",V.forEach(re=>{u.fillStyle=re.color;const ce=J+(W>0?4*l:-4*l),Z=re.yLabel;Z<-20||Z>n.bitmapSize.height+20||u.fillText(re.label,ce,Z)}),u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hT{constructor(e,t,A=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,A),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,g=s.context,B=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price);if(B==null||v==null||b==null||C==null)return;const U=B*c,F=v*u,S=b*c,K=C*u,G=S-U,M=K-F,W=Math.hypot(G,M);if(W<1e-4)return;const ne=G/W,J=M/W,V=-J,ie=ne,re=S+V*W,ce=K+ie*W,Z=U+V*W,Ae=F+ie*W,oe=(se,ae)=>({x:U+ne*W*se+V*W*ae,y:F+J*W*se+ie*W*ae});g.save();const le=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let se=0;se<r.divisions;se++){const ae=se/r.divisions,pe=(se+1)/r.divisions,we=oe(0,ae),Qe=oe(1,ae),Fe=oe(1,pe),Be=oe(0,pe);g.beginPath(),g.moveTo(we.x,we.y),g.lineTo(Qe.x,Qe.y),g.lineTo(Fe.x,Fe.y),g.lineTo(Be.x,Be.y),g.closePath(),g.fillStyle=le[se%le.length],g.fill()}g.lineWidth=1*u,g.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const ae=se/r.divisions,pe=oe(0,ae),we=oe(1,ae),Qe=oe(ae,0),Fe=oe(ae,1);g.beginPath(),g.moveTo(pe.x,pe.y),g.lineTo(we.x,we.y),g.stroke(),g.beginPath(),g.moveTo(Qe.x,Qe.y),g.lineTo(Fe.x,Fe.y),g.stroke()}g.strokeStyle="rgba(100, 116, 139, 0.85)",g.lineWidth=1*u,g.beginPath(),g.moveTo(U,F),g.lineTo(re,ce),g.stroke(),g.beginPath(),g.moveTo(S,K),g.lineTo(Z,Ae),g.stroke(),g.strokeStyle="rgba(122, 166, 174, 0.95)",g.lineWidth=1.2*u,g.beginPath(),g.moveTo(U,F),g.lineTo(S,K),g.lineTo(re,ce),g.lineTo(Z,Ae),g.closePath(),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Al{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:g=!0,pricesColor:B="#129f5c",rayLeft:v=!1,rayRight:b=!1,arrowLeft:C=!1,arrowRight:U=!1}=n;this.p1=e,this.p2=t,this.p3=A,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=u,this.showPrices=g,this.pricesColor=B,this.rayLeft=v,this.rayRight=b,this.arrowLeft=C,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(S){S.useBitmapCoordinateSpace(K=>{if(!F.visible)return;const G=F._chart,M=F._series;if(!G||!M)return;const W=K.horizontalPixelRatio,ne=K.verticalPixelRatio,J=[F.p1,F.p3,F.p4,F.p2].map(Ke=>{const Te=G.timeScale().timeToCoordinate(Ke.rawTime),_e=M.priceToCoordinate(Ke.price);return Te==null||_e==null?null:{x:Te*W,y:_e*ne}}).filter(Boolean);if(J.length!==4)return;const[V,ie,re,ce]=J,Z=K.context;Z.save();const Ae=ie.x-V.x,oe=ie.y-V.y,le=Math.sqrt(Ae*Ae+oe*oe)||1,se=Ae/le,ae=oe/le,pe=re.x-ce.x,we=re.y-ce.y,Qe=Math.sqrt(pe*pe+we*we)||1,Fe=pe/Qe,Be=we/Qe,ve=1e5,Ce=F.rayLeft?{x:V.x-se*ve,y:V.y-ae*ve}:V,be=F.rayRight?{x:ie.x+se*ve,y:ie.y+ae*ve}:ie,Le=F.rayLeft?{x:ce.x-Fe*ve,y:ce.y-Be*ve}:ce,Ge=F.rayRight?{x:re.x+Fe*ve,y:re.y+Be*ve}:re;if(F.showBackground){const Ke=F.fillColor||"#6aa84f",Te=parseInt(Ke.slice(1,3),16),_e=parseInt(Ke.slice(3,5),16),ye=parseInt(Ke.slice(5,7),16);Z.beginPath(),Z.moveTo(V.x,V.y),Z.lineTo(ie.x,ie.y),Z.lineTo(re.x,re.y),Z.lineTo(ce.x,ce.y),Z.closePath(),Z.fillStyle=`rgba(${Te},${_e},${ye},${F.fillOpacity??.1})`,Z.fill()}if(Z.strokeStyle=F.lineColor,Z.lineWidth=F.lineWidth*ne,Z.setLineDash([]),Z.beginPath(),Z.moveTo(Ce.x,Ce.y),Z.lineTo(be.x,be.y),Z.moveTo(Le.x,Le.y),Z.lineTo(Ge.x,Ge.y),Z.moveTo(V.x,V.y),Z.lineTo(ce.x,ce.y),Z.moveTo(ie.x,ie.y),Z.lineTo(re.x,re.y),Z.stroke(),F.arrowLeft||F.arrowRight){const Ke=8*ne,Te=(_e,ye,de)=>{Z.save(),Z.translate(_e,ye),Z.rotate(de),Z.beginPath(),Z.moveTo(0,0),Z.lineTo(-Ke,-Ke/2),Z.lineTo(-Ke,Ke/2),Z.closePath(),Z.fillStyle=F.lineColor,Z.fill(),Z.restore()};F.arrowLeft&&(Te(Ce.x,Ce.y,Math.atan2(-ae,-se)),Te(Le.x,Le.y,Math.atan2(-Be,-Fe))),F.arrowRight&&(Te(be.x,be.y,Math.atan2(ae,se)),Te(Ge.x,Ge.y,Math.atan2(Be,Fe)))}if(Z.fillStyle="#ffffff",Z.strokeStyle="#3b82f6",Z.lineWidth=2*ne,[V,ie,re,ce].forEach(Ke=>{Z.beginPath(),Z.arc(Ke.x,Ke.y,6*ne,0,Math.PI*2),Z.fill(),Z.stroke()}),F.showPrices){const Ke=[F.p1,F.p3,F.p2,F.p4],Te=[V,ie,ce,re];Z.fillStyle=F.pricesColor||F.lineColor,Z.font=`${Math.round(10*ne)}px sans-serif`,Z.textAlign="left",Z.textBaseline="middle",Te.forEach((_e,ye)=>{const de=Ke[ye]?.price;typeof de=="number"&&Z.fillText(de.toFixed(5),_e.x+8*W,_e.y)})}Z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class rp extends Al{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class np{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const u=o._chart,g=o._series;if(!u||!g)return;const B=c.horizontalPixelRatio,v=c.verticalPixelRatio,b=c.context,C=G=>{const M=u.timeScale().timeToCoordinate(G.rawTime),W=g.priceToCoordinate(G.price);return M==null||W==null?null:{x:M*B,y:W*v}},U=C(o.p1),F=C(o.p2),S=C(o.b2),K=C(o.b1);!U||!F||!S||!K||(b.save(),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(F.x,F.y),b.lineTo(S.x,S.y),b.lineTo(K.x,K.y),b.closePath(),b.fillStyle=o.fillColor,b.fill(),b.strokeStyle=o.strokeColor,b.lineWidth=o.lineWidth*v,b.setLineDash([]),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(F.x,F.y),b.stroke(),b.beginPath(),b.moveTo(K.x,K.y),b.lineTo(S.x,S.y),b.stroke(),b.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class il{constructor(e,t,A,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=r,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(u=>{if(!l.visible)return;const g=l._chart,B=l._series;if(!g||!B)return;const v=u.horizontalPixelRatio,b=u.verticalPixelRatio,C=u.context,U=J=>{const V=g.timeScale().timeToCoordinate(J.rawTime),ie=B.priceToCoordinate(J.price);return V==null||ie==null?null:{x:V*v,y:ie*b}},F=U(l.mid1),S=U(l.mid2),K=U(l.top1),G=U(l.top2),M=U(l.bot1),W=U(l.bot2);if(!F||!S||!K||!G||!M||!W)return;C.save(),C.beginPath(),C.moveTo(F.x,F.y),C.lineTo(S.x,S.y),C.lineTo(G.x,G.y),C.lineTo(K.x,K.y),C.closePath(),C.fillStyle=l.upperFillColor,C.fill(),C.beginPath(),C.moveTo(M.x,M.y),C.lineTo(W.x,W.y),C.lineTo(S.x,S.y),C.lineTo(F.x,F.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const ne=(J,V,ie)=>{C.beginPath(),C.strokeStyle=ie,C.lineWidth=l.lineWidth*b,C.setLineDash([]),C.moveTo(J.x,J.y),C.lineTo(V.x,V.y),C.stroke()};if(ne(K,G,l.upperStrokeColor),ne(F,S,l.centerStrokeColor),ne(M,W,l.lowerStrokeColor),l.showDeviationLabel){const J=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite(J)?J.toFixed(5):null;if(V){const ie=Math.max(10,Math.round(10*b));C.fillStyle=l.labelColor,C.font=`${ie}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(V,M.x+2*v,M.y+10*b)}}C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class sp extends il{}class op{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,g=n.bitmapSize.width;n.bitmapSize.height;const B=A.p1.price,v=A.p2.price,b=B-v,C=J=>v+b*J,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),S=o.priceToCoordinate(B),K=o.priceToCoordinate(v),G=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,M=U!=null&&F!=null?Math.round(Math.max(U,F)*l):g,W=M-G;u.save(),A._zoneFills.forEach(({from:J,to:V,color:ie})=>{const re=C(J),ce=C(V),Z=o.priceToCoordinate(re),Ae=o.priceToCoordinate(ce);if(Z==null||Ae==null)return;const oe=Math.round(Z*c),le=Math.round(Ae*c);u.fillStyle=ie,u.fillRect(G,Math.min(oe,le),W,Math.abs(le-oe))}),A._levels.forEach(({ratio:J,label:V})=>{const ie=C(J),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[J]||"#888888";u.beginPath(),u.strokeStyle=Z,u.lineWidth=J===0||J===1?1.5*c:1*c,J!==0&&J!==1&&J<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(G,ce),u.lineTo(M,ce),u.stroke(),u.setLineDash([])});const ne=Math.round(11*c);if(u.font=`${ne}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:J,label:V})=>{const ie=C(J),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[J]||"#888888",Ae=`${V} (${ie.toFixed(5)})`;u.fillStyle=Z,u.textAlign="right",u.fillText(Ae,G-4*l,ce-4*c)}),U!=null&&F!=null&&S!=null&&K!=null){const J=Math.round(U*l),V=Math.round(S*c),ie=Math.round(F*l),re=Math.round(K*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo(J,V),u.lineTo(ie,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(J,V,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(ie,re,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke()}u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class uT{constructor(e,t="#3b82f6",A=2,r=!0){this.time=e,this.color=t,this.lineWidth=A,this.showDate=r,this.showDot=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const u=Math.round(c*o.horizontalPixelRatio),g=o.bitmapSize.height,B=o.context;B.save(),B.beginPath(),B.strokeStyle=n.color,B.lineWidth=n.lineWidth*o.horizontalPixelRatio,B.setLineDash([]),B.moveTo(u,0),B.lineTo(u,g),B.stroke();const v=Math.round(g/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){B.beginPath(),B.strokeStyle=n.color,B.lineWidth=1.5*o.horizontalPixelRatio;const b=5*o.horizontalPixelRatio;B.arc(u,v,b,0,Math.PI*2),B.stroke()}if(n.showDate!==!1){const b=n.time,C=new Date(typeof b=="number"?b*1e3:b),U=ie=>String(ie).padStart(2,"0"),F=`${U(C.getUTCDate())}.${U(C.getUTCMonth()+1)}.${C.getUTCFullYear()} ${U(C.getUTCHours())}:${U(C.getUTCMinutes())}:${U(C.getUTCSeconds())}`,S=Math.round(11*o.verticalPixelRatio);B.font=`${S}px ui-sans-serif, system-ui, sans-serif`,B.textBaseline="middle",B.textAlign="center";const K=B.measureText(F).width,G=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),W=S+2*M,ne=K+2*G,J=u-ne/2,V=g-W-Math.round(4*o.verticalPixelRatio);B.fillStyle=n.color,B.fillRect(J,V,ne,W),B.fillStyle="#ffffff",B.fillText(F,u,V+W/2)}B.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function ap(i,e){const t=typeof i=="string"?i.trim():"",A=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(A))return`rgba(95, 143, 150, ${e})`;const r=parseInt(A.slice(0,2),16),n=parseInt(A.slice(2,4),16),s=parseInt(A.slice(4,6),16);return`rgba(${r}, ${n}, ${s}, ${e})`}function dT(i,e,t){const A=`${i??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let u=c;for(;u.length>s;){let g=u.lastIndexOf(" ",s);g<=0&&(g=s),o.push(u.slice(0,g)),u=u.slice(g).trimStart()}o.push(u)};return A.split(`
11
+ `).forEach(l),o.length===0&&o.push(""),o}function lp(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=dT(A.text??i?.text??"Text",r,n),o=s.reduce((b,C)=>Math.max(b,C.length),1),c=Math.max(20,o*r*.58)+16,u=r*1.2,g=s.length*u+10,B=e-c/2,v=t-g;return{left:B,right:B+c,top:v,bottom:v+g+12}}class pT{constructor(e,t,A={}){this.rawTime=e,this.price=t,this.text=A.text??"Text",this.color=A.color??"#5f8f96",this.fontSize=A.fontSize??12,this.fontWeight=A.fontWeight??"normal",this.fontStyle=A.fontStyle??"normal",this.textAlign=A.textAlign??"center",this.textWrap=A.textWrap??!1,this.borderEnabled=A.borderEnabled??!1,this.borderColor=A.borderColor??"#5f8f96",this.borderOpacity=A.borderOpacity??.1,this.borderWidth=A.borderWidth??1,this.bgEnabled=A.bgEnabled??!1,this.bgColor=A.bgColor??"#5f8f96",this.bgOpacity=A.bgOpacity??.1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=o.timeScale().timeToCoordinate(r.rawTime),u=l.priceToCoordinate(r.price);if(c==null||u==null)return;const g=s.horizontalPixelRatio,B=s.verticalPixelRatio,v=Math.round(c*g),b=Math.round(u*B),C=s.context;C.save();const U=Math.round(r.fontSize*B);C.font=`${r.fontStyle} ${r.fontWeight} ${U}px sans-serif`;const F=`${r.text??""}`,S=220*g,K=[],G=ae=>{if(!r.textWrap||ae.length===0){K.push(ae);return}const pe=ae.split(/\s+/);let we="";for(const Qe of pe){const Fe=we?`${we} ${Qe}`:Qe;C.measureText(Fe).width<=S||!we?we=Fe:(K.push(we),we=Qe)}K.push(we)};F.split(`
12
+ `).forEach(G),K.length===0&&K.push("");const M=K.map(ae=>C.measureText(ae).width),W=Math.max(...M,20*g),ne=8*g,J=5*B,V=W+ne*2,ie=U*1.2,re=ie*K.length+J*2,ce=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Z=v-V/2,Ae=b-re;r.bgEnabled&&(C.fillStyle=ap(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(Z,Ae,V,re),C.fill()),r.borderEnabled&&(C.strokeStyle=ap(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),C.lineWidth=Math.max(.5,(r.borderWidth??1)*B),C.beginPath(),C.rect(Z,Ae,V,re),C.stroke()),C.fillStyle=r.color,C.textAlign=ce,C.textBaseline="middle";const oe=ce==="left"?Z+ne:ce==="right"?Z+V-ne:Z+V/2;for(let ae=0;ae<K.length;ae++)C.fillText(K[ae],oe,Ae+J+ie*(ae+.5));const le=5*B,se=b+10*B;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*B,C.arc(v,se,le,0,Math.PI*2),C.stroke(),C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const fT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function cp(i){if(!i)return 7;const e=String(i).toUpperCase();return fT[e]??7}function mT(i,e){const t=String(i||"").toUpperCase(),A=e||cp(i),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(A*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const zA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:ee(A.time)})).filter(A=>A.time!=null);e.sort((A,r)=>A.time-r.time);const t=new Map;for(const A of e)t.set(A.time,A);return Array.from(t.values()).sort((A,r)=>A.time-r.time)};function ut(i,e,t,A,r,n){const s=r-t,o=n-A,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/(l*l);c=Math.max(0,Math.min(1,c));const u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function gT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/l;c<0&&(c=0);const u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function wT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);const c=((i-t)*s+(e-A)*o)/l,u=t+c*s,g=A+c*o;return Math.hypot(i-u,e-g)}function gi(i,e,t){let A=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r].x,o=t[r].y,l=t[n].x,c=t[n].y;o>e!=c>e&&i<(l-s)*(e-o)/(c-o+1e-7)+s&&(A=!A)}return A}function hp(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??ee(i.rawTime),r=e.normalizedTime??ee(e.rawTime),n=t.normalizedTime??ee(t.rawTime);if(A==null||r==null||n==null)return null;const s=r-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-i.price)/s,l=t.price+o*(A-n),c=t.price+o*(r-n),u=ee((A+r)/2),g=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:g}}}function ir(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??ee(e.rawTime),n=t.normalizedTime??ee(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map(J=>({time:ee(J.time),close:typeof J.close=="number"?J.close:parseFloat(J.close)})).filter(J=>J.time!=null&&Number.isFinite(J.close)&&J.time>=s&&J.time<=o).sort((J,V)=>J.time-V.time);if(l.length<2)return null;const c=l.length;let u=0,g=0,B=0,v=0;for(let J=0;J<c;J++){const V=J,ie=l[J].close;u+=V,g+=ie,B+=V*ie,v+=V*V}const b=c*v-u*u,C=Math.abs(b)<1e-12?0:(c*B-u*g)/b,U=(g-C*u)/c;let F=0;for(let J=0;J<c;J++){const V=U+C*J,ie=l[J].close-V;F+=ie*ie}const S=Math.sqrt(F/c),K=Math.max(S*A,1e-8),G=l[0].time,M=l[c-1].time,W=U,ne=U+C*(c-1);return{slope:C,intercept:U,stdDev:S,offset:K,barCount:c,p1:{rawTime:G,normalizedTime:G,price:W},p2:{rawTime:M,normalizedTime:M,price:ne},top1:{rawTime:G,normalizedTime:G,price:W+K},top2:{rawTime:M,normalizedTime:M,price:ne+K},bot1:{rawTime:G,normalizedTime:G,price:W-K},bot2:{rawTime:M,normalizedTime:M,price:ne-K}}}function Xr(i,e,t,A=1){return ir(i,e,t,A)}const BT={trendline:{requiredKeys:["point1","point2"],handleCount:2},gannline:{requiredKeys:["point1","point2"],handleCount:3},rectangle:{requiredKeys:["p1","p2"],handleCount:8},circle:{requiredKeys:["p1","p2"],handleCount:2},triangle:{requiredKeys:["p1","p2","p3"],handleCount:3},ellipse:{requiredKeys:["p1","p2"],handleCount:4},infoline:{requiredKeys:["p1","p2"],handleCount:2},arrowedline:{requiredKeys:["p1","p2"],handleCount:2},rayline:{requiredKeys:["p1","p2"],handleCount:2},extendedline:{requiredKeys:["p1","p2"],handleCount:2},crossline:{requiredKeys:["p"],handleCount:1},trendbyangle:{requiredKeys:["p1","p2"],handleCount:2},equidistantchannel:{requiredKeys:["p1","p2","p3"],handleCount:3},regressionchannel:{requiredKeys:["p1","p2"],handleCount:2},stddevchannel:{requiredKeys:["p1","p2"],handleCount:2},gannfan:{requiredKeys:["p1","p2"],handleCount:2},ganngrid:{requiredKeys:["p1","p2"],handleCount:2},andrewspitchfork:{requiredKeys:["p1","p2","p3"],handleCount:3},disjointchannel:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},flattopbottom:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},rulerline:{requiredKeys:["p1","p2"],handleCount:3},horizontalray:{requiredKeys:["primitive"],handleCount:1},verticalline:{requiredKeys:["primitive"],handleCount:1},pricelevel:{requiredKeys:["priceLine"],handleCount:1}},yT={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6",pricelevel:"#3b82f6"};function CT(i,e){if(!i||!i.type)return!1;const t=BT[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function vT(i){return i?yT[i]??"#22c55e":"#22c55e"}const TT=300,up=24,bT=150,dp=150;function rl(i,e,t=TT){if(!Array.isArray(i)||i.length===0)return[];const A=uA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=ee(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function xT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=ee(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function QT(i,e){let t=0,A=i.length;for(;t<A;){const r=t+A>>1;i[r]<e?t=r+1:A=r}return t}function Ns(i,e,t,A){const r=ee(e),n=ee(t),s=uA(A)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(i)||i.length===0)return l;if(r==null||n==null)return 1;const c=B=>{const v=QT(i,B);if(v<=0)return 0;if(v>=i.length)return i.length-1;const b=i[v-1],C=i[v];return Math.abs(B-b)<=Math.abs(C-B)?v-1:v},u=c(r),g=c(n);return Math.max(1,Math.abs(g-u)+1)}function pp(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=xT(e);if(r==null)return!1;const n=A.timeToCoordinate(r);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const u=A.getVisibleLogicalRange(),g=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,B=Number.isFinite(g)&&g>20?g:120,v=Math.min(dp,B/2),b=Math.max(20,B-v),C={from:c-b,to:c+v};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=uA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-bT*o,to:r+dp*o};try{return A.setVisibleRange(l),!0}catch{return!1}}function nl(i,e){if(i.length<e)return[];const t=2/(e+1);let A=i.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:i[e-1].time,value:A}];for(let n=e;n<i.length;n++)A=i[n].close*t+A*(1-t),r.push({time:i[n].time,value:A});return r}function Os(i,e){if(i.length<e)return null;const t=i[i.length-1],A=i.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:A}}function fp(i,e){const t=nl(i,e);return t.length?t[t.length-1]:null}function mp(i,e){if(i.length<e+1)return null;let t=0,A=0;for(let s=1;s<=e;s++){const o=i[s].close-i[s-1].close;o>0?t+=o:A-=o}t/=e,A/=e;for(let s=e+1;s<i.length;s++){const o=i[s].close-i[s-1].close;t=(t*(e-1)+Math.max(o,0))/e,A=(A*(e-1)+Math.max(-o,0))/e}const r=i[i.length-1],n=A===0?100:100-100/(1+t/A);return{time:r.time,value:n}}function gp(i,e=12,t=26,A=9){if(i.length<t+A)return null;const r=nl(i,e),n=nl(i,t);if(!r.length||!n.length)return null;const s=n.map((u,g)=>{const B=r[r.length-n.length+g];return{time:u.time,value:B.value-u.value}});if(s.length<A)return null;const o=2/(A+1);let l=s.slice(0,A).reduce((u,g)=>u+g.value,0)/A;for(let u=A;u<s.length;u++)l=s[u].value*o+l*(1-o);const c=s[s.length-1];return{time:c.time,value:c.value,signal:l,histogram:c.value-l}}const FT=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=Y.useRef(null),l=Y.useRef(null),c=Y.useRef(null),u=Y.useRef(null),g=Y.useRef(null),B=Y.useRef(null),v=Y.useRef([]),b=Y.useRef(!1),C=Y.useRef(null),U=Y.useRef(null),F=Y.useRef(null),S=Y.useRef(null),K=Y.useRef([]),[G,M]=Y.useState(null),[W,ne]=Y.useState(null),[J,V]=Y.useState([]),[ie,re]=Y.useState(null),[ce,Z]=Y.useState([]),Ae=Y.useRef(null),oe=Y.useRef(null),le=Y.useRef(null),se=Y.useRef(!1),ae=Y.useRef(!1);Y.useEffect(()=>{le.current=G;let p=!1;v.current.forEach(f=>{if(f.type==="trendline"&&f.decoration){const O=f===G;f.decoration.isSelected!==O&&(f.decoration.isSelected=O,p=!0)}}),p&&c.current?.applyOptions({})},[G]);const pe=Y.useRef(new Map),we=Y.useRef(null),Qe=Y.useRef(null),Fe=(p,f)=>`${p}_${f}`,Be=()=>{const p=Fe(ye,de);return pe.current.get(p)||null},ve=p=>{if(!p)return;const f=Fe(ye,de);pe.current.set(f,p)},{activeTool:Ce,setActiveTool:be,showGrid:Le,snapToGrid:Ge,chartObjects:Ke,setChartObjects:Te,orders:_e,selectedSymbol:ye,selectedTimeframe:de,drawingsVisible:Pe,chartType:et,chartLocked:it,theme:rt,candleColors:dt,showTradeOrders:fA,showTradePosition:Ze,showTradeHistory:Oe,showSLTP:at,showAskPrice:At,showChartControls:Ct,showCrosshair:xt,showOHLC:GA,currentSymbolData:$A,baseUrl:Gt,endpoints:mA,endpointParams:XA,indicators:Kt,indicatorSettings:Ut}=zt(),gA=Y.useRef({}),[nt,mt]=Y.useState({}),St=Y.useRef(0),It=Y.useRef(Kt),$e=Y.useRef(Ut);It.current=Kt,$e.current=Ut;const He=Y.useRef([]),[tt,Je]=Y.useState(!1),[Me,ze]=Y.useState(null),[Ue,We]=Y.useState([]),[Ne,st]=Y.useState(!0),[lt,vt]=Y.useState(null),[cA,Ai]=Y.useState(0),Ks=Y.useMemo(()=>{const p=Ue.map(f=>ee(f?.time)).filter(f=>Number.isFinite(f));return p.sort((f,O)=>f-O),p},[Ue]),Vs=Y.useRef(null),ii=Y.useRef(new Map);Y.useRef(null);const bp=Y.useRef(0),MA=Y.useRef(null),rr=Y.useRef(!1),jr=Y.useRef(!1);Y.useEffect(()=>{const p=g.current;p&&p.setData(rl(Ue,de))},[Ue,de]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*.8;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*1.25;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const f=p.querySelectorAll("canvas"),O=rt==="light"?"#ffffff":"#12161d";let me=null,H=0;if(f.forEach(X=>{if(X.width>0&&X.height>0){const j=X.width*X.height;j>H&&(H=j,me=X)}}),me)try{const X=document.createElement("canvas");X.width=me.width,X.height=me.height;const j=X.getContext("2d");j.fillStyle=O,j.fillRect(0,0,X.width,X.height),j.drawImage(me,0,0);const q=document.createElement("a");q.download=`chart-${ye}-${de}-${Date.now()}.png`,q.href=X.toDataURL("image/png"),q.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(X){console.warn("Canvas export failed, trying html2canvas",X)}Xv(p,{useCORS:!0,allowTaint:!0,backgroundColor:O,scale:2,logging:!1}).then(X=>{const j=document.createElement("a");j.download=`chart-${ye}-${de}-${Date.now()}.png`,j.href=X.toDataURL("image/png"),j.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(X=>{console.error("Chart screenshot failed",X),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,de,rt]);const al=Y.useMemo(()=>Ue.length===0?[]:et==="line"||et==="area"?Ue.map(p=>({time:p.time,value:p.close})):Ue,[Ue,et]),ZT=p=>{r?r(p):(ze("BUY"),Je(!0))},YT=p=>{n?n(p):(ze("SELL"),Je(!0))},qT=()=>{Je(!1),ze(null)},jT=p=>{const f=W;if(!f||!p)return;const O=(X,j)=>{if(typeof X!="string")return j;const q=X.trim(),ue=q.startsWith("#")?q:`#${q}`;return/^#[0-9A-Fa-f]{6}$/.test(ue)?ue.toLowerCase():j},me=(X,j)=>{const q=Number(X);return Number.isFinite(q)?Math.max(0,Math.min(1,q)):j};let H={...f,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:f.visibleTimeframes};if(f.type==="text"){const X=Number.isFinite(Number(p.price))?Number(p.price):f.price,j=f.primitive;j&&(j.text=typeof p.text=="string"?p.text:j.text,j.color=O(p.color,j.color??"#5f8f96"),j.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):j.fontSize,j.fontWeight=p.fontWeight==="bold"?"bold":"normal",j.fontStyle=p.fontStyle==="italic"?"italic":"normal",j.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:j.textAlign,j.textWrap=!!p.textWrap,j.borderEnabled=!!p.borderEnabled,j.borderColor=O(p.borderColor,j.borderColor??"#5f8f96"),j.borderOpacity=me(p.borderOpacity,j.borderOpacity??.1),j.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),j.bgEnabled=!!p.bgEnabled,j.bgColor=O(p.bgColor,j.bgColor??"#5f8f96"),j.bgOpacity=me(p.bgOpacity,j.bgOpacity??.1),j.price=X),H={...H,price:X,text:typeof p.text=="string"?p.text:f.text}}if(f.type==="trendline"){const X=O(p.lineColor,"#22c55e"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(f.series)try{f.series.applyOptions({color:X,lineWidth:j})}catch{}const q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.point1?.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.point2?.price;if(f.series&&f.point1&&f.point2){const R=f.point1.time??f.point1.rawTime,y=f.point2.time??f.point2.rawTime;try{const h=zA([{time:R,value:q},{time:y,value:ue}]);h.length>0&&f.series.setData(h)}catch{}}const L={...f.point1,price:q},N={...f.point2,price:ue};f.decoration&&(f.decoration.color=X,f.decoration.lineWidth=j,f.decoration.arrowLeft=!!p.arrowLeft,f.decoration.arrowRight=!!p.arrowRight,f.decoration.rayLeft=!!p.rayLeft,f.decoration.rayRight=!!p.rayRight,f.decoration.statsColor=O(p.statsColor,"#5f8f96"),f.decoration.statsPosition=p.statsPosition??"right",f.decoration.statsShowAlways=!!p.statsShowAlways,f.decoration.statsPriceRange=!!p.statsPriceRange,f.decoration.statsBarsRange=!!p.statsBarsRange,f.decoration.statsDateRange=!!p.statsDateRange,f.decoration.statsAngle=!!p.statsAngle,f.decoration.statsDistance=!!p.statsDistance,f.decoration.p1=L,f.decoration.p2=N),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsShowAlways:!!p.statsShowAlways,statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,point1:L,point2:N,decoration:f.decoration}}if(f.type==="pricelevel"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.showPrice!==!1,ue=!!p.showText,L=typeof p.textContent=="string"?p.textContent:"",N=O(p.textColor,"#ffffff"),R=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",y=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):f.price;if(f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,lineWidth:j,axisLabelVisible:q,title:q&&typeof h=="number"?h.toFixed(5):""})}catch{}const T=u.current;if(ue&&L&&T)if(f.textPrimitive)f.textPrimitive.text=L,f.textPrimitive.textColor=N,f.textPrimitive.hAlign=R,f.textPrimitive.vAlign=y,f.textPrimitive.price=h;else{const I=new tp(h,{text:L,textColor:N,hAlign:R,vAlign:y});try{T.attachPrimitive(I)}catch{}f.textPrimitive=I}else if(f.textPrimitive&&T){try{T.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:j,showPrice:q,showText:ue,textContent:L,textColor:N,textHAlign:R,textVAlign:y,textPrimitive:f.textPrimitive}}if(f.type==="horizontalray"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.showPrice!==!1,ue=!!p.showText,L=typeof p.textContent=="string"?p.textContent:"",N=O(p.textColor,"#ffffff"),R=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",y=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):f.price,T=f.primitive;if(T&&(T.price=h,T.color=X,T.lineWidth=j),f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,axisLabelVisible:q,title:q&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(ue&&L&&I)if(f.textPrimitive)f.textPrimitive.text=L,f.textPrimitive.textColor=N,f.textPrimitive.hAlign=R,f.textPrimitive.vAlign=y,f.textPrimitive.price=h,f.textPrimitive.originTime=f.rawOriginTime;else{const w=new tp(h,{text:L,textColor:N,hAlign:R,vAlign:y,originTime:f.rawOriginTime});try{I.attachPrimitive(w)}catch{}f.textPrimitive=w}else if(f.textPrimitive&&I){try{I.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:j,showPrice:q,showText:ue,textContent:L,textColor:N,textHAlign:R,textVAlign:y,textPrimitive:f.textPrimitive}}if(f.type==="verticalline"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.showDate!==!1,ue=f.primitive;ue&&(ue.color=X,ue.lineWidth=j,ue.showDate=q),H={...H,lineColor:X,lineWidth:j,showDate:q}}if(f.type==="infoline"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=p.statsShowAlways!==!1,ue=O(p.statsColor,"#5f8f96"),L=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,R=!!p.statsBarsRange,y=!!p.statsDateRange,h=!!p.statsAngle,T=!!p.statsDistance,I=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,d=f.p1.rawTime,_=f.p2.rawTime,Q=w-I,E=I!==0?Q/Math.abs(I)*100:0,x=f.p1.normalizedTime??0,m=f.p2.normalizedTime??0,D=uA(de)||3600,P=Math.abs(m-x),k=Math.max(1,Math.round(P/D)),z=Math.max(1,Math.round(P/86400)),$=c.current,te=u.current,he=$?$.timeScale().timeToCoordinate(d):null,ge=te?te.priceToCoordinate(I):null,xe=$?$.timeScale().timeToCoordinate(_):null,Ee=te?te.priceToCoordinate(w):null,Re=he!=null&&ge!=null&&xe!=null&&Ee!=null?Math.atan2(-(Ee-ge),xe-he)*(180/Math.PI):f.primitive?.info?.angle??0,je={priceDiff:Q,pricePct:E,bars:k,days:z,angle:Re},Ve=f.primitive;Ve&&(Ve.color=X,Ve.lineWidth=j,Ve.statsShowAlways=q,Ve.statsColor=ue,Ve.statsPosition=L,Ve.statsPriceRange=N,Ve.statsBarsRange=R,Ve.statsDateRange=y,Ve.statsAngle=h,Ve.statsDistance=T,Ve.p1={...f.p1,price:I},Ve.p2={...f.p2,price:w},Ve.info=je),H={...H,lineColor:X,lineWidth:j,statsShowAlways:q,statsColor:ue,statsPosition:L,statsPriceRange:N,statsBarsRange:R,statsDateRange:y,statsAngle:h,statsDistance:T,p1:{...f.p1,price:I},p2:{...f.p2,price:w}}}if(f.type==="rulerline"){const X=O(p.lineColor,"#3b82f6"),j=p.showArea!==!1,q=!!p.statsShowAlways,ue=O(p.statsColor,"#5f8f96"),L=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,R=!!p.statsBarsRange,y=!!p.statsDateRange,h=f.primitive;h&&(h.lineColor=X,h.showArea=j,h.statsShowAlways=q,h.statsColor=ue,h.statsPosition=L,h.statsPriceRange=N,h.statsBarsRange=R,h.statsDateRange=y),H={...H,lineColor:X,showArea:j,statsShowAlways:q,statsColor:ue,statsPosition:L,statsPriceRange:N,statsBarsRange:R,statsDateRange:y}}if(f.type==="arrowedline"){const X=O(p.lineColor,"#f59e0b"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsBarsRange=!!p.statsBarsRange,L.statsDateRange=!!p.statsDateRange,L.statsAngle=!!p.statsAngle,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="rayline"){const X=O(p.lineColor,"#7aa6ae"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsBarsRange=!!p.statsBarsRange,L.statsDateRange=!!p.statsDateRange,L.statsAngle=!!p.statsAngle,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="extendedline"){const X=O(p.lineColor,"#7aa6ae"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsBarsRange=!!p.statsBarsRange,L.statsDateRange=!!p.statsDateRange,L.statsAngle=!!p.statsAngle,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="crossline"){const X=O(p.lineColor,"#06a0e3"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.price))?Number(p.price):f.p.price,ue=f.primitive;ue&&(ue.color=X,ue.lineWidth=j,ue.showTime=!!p.showTime,ue.showPrice=!!p.showPrice,ue.center={...f.p,price:q}),H={...H,lineColor:X,lineWidth:j,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...f.p,price:q}}}if(f.type==="trendbyangle"){const X=O(p.lineColor,"#7aa6ae"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,ue=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,L=f.primitive;L&&(L.color=X,L.lineWidth=j,L.arrowLeft=!!p.arrowLeft,L.arrowRight=!!p.arrowRight,L.rayLeft=!!p.rayLeft,L.rayRight=!!p.rayRight,L.statsShowAlways=!!p.statsShowAlways,L.statsColor=O(p.statsColor,"#5f8f96"),L.statsPosition=p.statsPosition??"right",L.statsPriceRange=!!p.statsPriceRange,L.statsDistance=!!p.statsDistance,L.p1={...f.p1,price:q},L.p2={...f.p2,price:ue}),H={...H,lineColor:X,lineWidth:j,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:O(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsDistance:!!p.statsDistance,p1:{...f.p1,price:q},p2:{...f.p2,price:ue}}}if(f.type==="disjointchannel"){const X=O(p.lineColor,"#129f5c"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=O(p.fillColor,"#6aa84f"),ue=me(p.fillOpacity,.1),L=O(p.pricesColor,"#129f5c"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,R=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,y=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=j,h.fillColor=q,h.fillOpacity=ue,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=L,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...f.p1,price:N},h.p3={...f.p3,price:R},h.p2={...f.p2,price:y}),H={...H,lineColor:X,lineWidth:j,fillColor:q,fillOpacity:ue,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:L,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:N},p3:{...f.p3,price:R},p2:{...f.p2,price:y}}}if(f.type==="flattopbottom"){const X=O(p.lineColor,"#3b82f6"),j=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),q=O(p.fillColor,"#3b82f6"),ue=me(p.fillOpacity,.12),L=O(p.pricesColor,"#3b82f6"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,R=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,y=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=j,h.fillColor=q,h.fillOpacity=ue,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=L,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...f.p1,price:N},h.p3={...f.p3,price:R},h.p2={...f.p2,price:y}),H={...H,lineColor:X,lineWidth:j,fillColor:q,fillOpacity:ue,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:L,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:N},p3:{...f.p3,price:R},p2:{...f.p2,price:y}}}Te(X=>{const j=X.map(q=>q===f?H:q);return v.current=j,j}),le.current===f&&(le.current=H),M(X=>X===f?H:X),re(X=>X===f?H:X),ne(H);try{c.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const p=o.current;if(!p)return;const f=p.getBoundingClientRect(),O=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},me=rt==="light",H=fm(p,{width:f.width||p.clientWidth,height:f.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:me?"#FFFFFF":"#0d1117",type:"solid"},textColor:me?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Le,color:Le?me?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?me?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}},rightPriceScale:{borderColor:me?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:me?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:me?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:Ce===1?1:0,vertLine:{width:1,color:me?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:me?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:me?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:me?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Ce===1,horzLineVisible:Ce===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Ce===null||Ce===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),X=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),j=X.includes("JPY"),q=tn(X),ue=en(X);let L,N;j?(L=.001,N=w=>Math.abs(Number(w)).toFixed(3)):q?X.startsWith("BTC")||X.startsWith("ETH")?(L=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(L=1e-4,N=w=>Math.abs(Number(w)).toFixed(4)):ue&&(X.startsWith("XAU")||X.startsWith("XAG"))?(L=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(L=1e-4,N=w=>Math.abs(Number(w)).toFixed(5));const R=H.addCandlestickSeries({upColor:me?"#089981":"#26a69a",downColor:me?"#f23645":"#ef5350",wickUpColor:me?"#089981":"#26a69a",wickDownColor:me?"#f23645":"#ef5350",borderUpColor:me?"#089981":"#26a69a",borderDownColor:me?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:L,formatter:N}}),y=H.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=H,u.current=R,g.current=y,y.setData(rl(Ue,de)),requestAnimationFrame(()=>{if(p&&H){const w=p.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),T=()=>{if(ae.current&&ii.current.size>0){const w=h.getVisibleRange();w&&ve(w)}};h.subscribeVisibleTimeRangeChange(T);const I=new ResizeObserver(w=>{for(const d of w){const{width:_,height:Q}=d.contentRect;if(_>0&&Q>0&&H){const E=h.getVisibleRange();H.resize(_,Q),E&&setTimeout(()=>{try{h.setVisibleRange(E)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(T),I.disconnect(),H.remove(),c.current=null,u.current=null,g.current=null,B.current=null,v.current=[],MA.current&&clearTimeout(MA.current)}},[]),Y.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}}})},[Le]),Y.useEffect(()=>{const p=c.current;if(!p)return;const f=rt==="light";p.applyOptions({layout:{background:{color:f?"#FFFFFF":"#12161d"},textColor:f?"#020617":"#fff"},grid:{vertLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:f?"#e5e7eb":"#1e293b"},timeScale:{borderColor:f?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1},horzLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1}}})},[rt,Le]),Y.useEffect(()=>{const p=u.current;!p||!dt||p.applyOptions({upColor:dt.upColor,downColor:dt.downColor,wickUpColor:dt.upColor,wickDownColor:dt.downColor,borderUpColor:dt.upColor,borderDownColor:dt.downColor})},[dt]),Y.useEffect(()=>{if(!c.current)return;const f=!it&&!(Ce!==null&&Ce!==1&&Ce!==0),O=!it;c.current.applyOptions({crosshair:{mode:Ce===1?1:0,vertLine:{visible:Ce===1||xt,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Ce===1||xt,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:f,horzTouchDrag:f,vertTouchDrag:f},handleScale:{axisPressedMouseMove:{time:f,price:f},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:f,price:f},mouseWheel:O,pinch:O}})},[Ce,it,xt,rt]);const eb=()=>{const p=u.current;v.current.forEach(f=>{if(f.primitive){try{p&&p.detachPrimitive(f.primitive)}catch{}if(f.series&&f.series!==p)try{f.series.detachPrimitive(f.primitive)}catch{}}if(f.priceLine&&p)try{p.removePriceLine(f.priceLine)}catch{}if(f.textPrimitive&&p)try{p.detachPrimitive(f.textPrimitive)}catch{}}),v.current=[],Te([]),be(null)},xp=(p,f=!1)=>{p&&v.current.forEach(O=>{if(O.primitive){try{p.detachPrimitive(O.primitive)}catch{}try{p.attachPrimitive(O.primitive)}catch{}}if(f&&O.type==="pricelevel"&&O.priceLine)try{const me=O.showPrice!==!1,H=p.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:me,title:me&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}if(f&&O.type==="horizontalray"&&O.priceLine)try{const me=O.showPrice!==!1,H=p.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:me,title:me&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}})};Y.useEffect(()=>{(async()=>{if(!ye||!de){We([]),ae.current=!1;return}try{if(MA.current&&(clearTimeout(MA.current),MA.current=null),rr.current=!0,st(!0),vt(null),We([]),ae.current=!1,jr.current=!1,Qe.current!==null&&Qe.current!==ye&&eb(),Qe.current=ye,u.current)try{u.current.setData([])}catch{}const f=cp(de),O=mT(de,f),me=Gt||Yv?.VITE_BASE_URL||"http://localhost:5002",H=mA?.candles||"/api/chart/candles",X=XA?.candles||{},j={symbol:X.symbol||"symbol",timeframe:X.timeframe||"timeframe",limit:X.limit||"limit",daysBack:X.daysBack||"daysBack"},q={};q[j.symbol]=ye,q[j.timeframe]=de,q[j.limit]=O,X.daysBack!==!1&&(q[j.daysBack]=f);const ue=localStorage.getItem("token")??localStorage.getItem("authToken"),L=await gt.get(`${me}${H}`,{params:q,timeout:1e4,headers:ue?{Authorization:`Bearer ${ue}`}:{}});let N=[];if(Array.isArray(L.data)?N=L.data:L.data&&L.data.data&&Array.isArray(L.data.data)?N=L.data.data:L.data&&Array.isArray(L.data)&&(N=L.data),N&&N.length>0){const{candles:R,stats:y}=fl(N,ye,de);R.length>0?(We(R),ii.current=new Map,R.forEach(h=>{ii.current.set(h.time,h)}),jr.current=!0,rr.current=!1,Vs.current?.connected&&ye&&de&&Vs.current.emit("subscribeCandles",{symbol:ye,timeframe:de})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),rr.current=!1,We([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),rr.current=!1,We([])}catch(f){console.error(`❌ Error fetching ${ye}:`,f.message);const O=f.code==="ECONNABORTED"||f.message&&f.message.includes("timeout");vt(O?"Request timed out. No data available for this symbol.":f.message||"Failed to load candles."),rr.current=!1,We([]),st(!1)}})()},[ye,de,cA]),Y.useEffect(()=>{Vs.current=kn.getSocket();const p=Vs.current,f=()=>{if(jr.current&&ye&&de&&p.connected){const q={symbol:ye,timeframe:de};p.emit("subscribeCandles",q)}},O=()=>{setTimeout(()=>{ye&&de&&f()},200)},me=q=>{},H=q=>{};p.on("connect",O),p.on("disconnect",me),p.on("connect_error",H),p.on("subscription:confirmed",q=>{q.type});const X=q=>{if(!jr.current||!q||!q.candle||!q.symbol)return;const ue=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(ue(q.symbol)!==ue(ye)||q.timeframe&&q.timeframe!==de)return;const{candle:L}=q,N=ml(L,ye,de);if(!N)return;const R=Date.now();if(R-bp.current<200)return;bp.current=R;const y=c.current?.timeScale(),h=y?.getVisibleRange(),T=u.current,I=c.current;if(!(!T||!I||!ae.current&&!jr.current||T?.seriesType?.()!==(et==="line"?"Line":et==="area"?"Area":et==="bars"?"Bar":"Candlestick")))try{const _=ii.current.get(N.time),Q=!_,E=_?{time:N.time,open:_.open,high:Math.max(_.high,N.high),low:Math.min(_.low,N.low),close:N.close}:N;ii.current.set(N.time,E),Q&&g.current&&g.current.setData(rl(Array.from(ii.current.values()),de));try{et==="line"||et==="area"?T.update({time:E.time,value:E.close}):T.update(E),y&&h&&ve(h)}catch(P){throw P}const x=It.current||{},m=$e.current||{},D=gA.current;if(Object.keys(D).length>0){const P=Array.from(ii.current.values()).sort((k,z)=>k.time-z.time);if(x.sma20&&D.sma20){const k=Os(P,m.smaPeriod||20);if(k)try{D.sma20.update(k)}catch{}}if(x.sma50&&D.sma50){const k=Os(P,50);if(k)try{D.sma50.update(k)}catch{}}if(x.ema12&&D.ema12){const k=fp(P,m.emaPeriod||12);if(k)try{D.ema12.update(k)}catch{}}if(x.rsi&&D.rsi){const k=mp(P,m.rsiPeriod||14);if(k){try{D.rsi.update(k)}catch{}if(D.rsi70)try{D.rsi70.update({time:k.time,value:70})}catch{}if(D.rsi30)try{D.rsi30.update({time:k.time,value:30})}catch{}}}if(x.macd&&D.macdLine){const k=gp(P,12,26,9);if(k){try{D.macdLine.update({time:k.time,value:k.value})}catch{}try{D.macdSignal.update({time:k.time,value:k.signal})}catch{}try{D.macdHist.update({time:k.time,value:k.histogram,color:k.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(x.bollinger&&D.bbMiddle){const k=Rs(P,m.bbPeriod||20,m.bbStdDev||2);if(k){try{D.bbUpper.update({time:k.time,value:k.upper})}catch{}try{D.bbMiddle.update({time:k.time,value:k.middle})}catch{}try{D.bbLower.update({time:k.time,value:k.lower})}catch{}}}}}catch{}};p.on("candleUpdate",X);const j=()=>{p.connected&&ye&&de&&f()};if(p.connected)j();else{const q=()=>{setTimeout(j,200)};p.once("connect",q),setTimeout(()=>{p.connected&&j()},500)}return()=>{p.off("candleUpdate",X),p.off("connect",O),p.off("disconnect",me),p.off("connect_error",H),p.off("subscription:confirmed"),ye&&de&&p.connected&&p.emit("unsubscribeCandles",{symbol:ye,timeframe:de})}},[ye,de,Gt]),Y.useEffect(()=>{const p=u.current,f=c.current;if(!(!p||!f)&&!(rr.current&&Ue.length>0)&&!(Ue.length===0&&ae.current)){if(Ue.length===0&&!ae.current){if(Ne)return;const O=f.timeScale();p.setData([]),O.fitContent(),MA.current&&clearTimeout(MA.current),MA.current=setTimeout(()=>requestAnimationFrame(()=>st(!1)),400);return}if(!ae.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),me=O.includes("JPY"),H=en(O),X=tn(O);let j,q;me?(j=.001,q=h=>Math.abs(Number(h)).toFixed(3)):X?O.startsWith("BTC")||O.startsWith("ETH")?(j=.01,q=h=>Math.abs(Number(h)).toFixed(2)):(j=1e-4,q=h=>Math.abs(Number(h)).toFixed(4)):H&&(O.startsWith("XAU")||O.startsWith("XAG"))?(j=.01,q=h=>Math.abs(Number(h)).toFixed(2)):(j=1e-4,q=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:j,formatter:q}})}catch{}const ue=f.timeScale(),L=Fe(ye,de);we.current,we.current=L;const N=[...Ue].sort((h,T)=>h.time-T.time);if(et==="line"||et==="area"){const h=N?.map(T=>({time:T.time,value:T.close})).filter(T=>T.time!=null);h.length>0&&p.setData(h)}else N?.length>0&&p.setData(N);dt&&p.applyOptions({upColor:dt.upColor,downColor:dt.downColor,wickUpColor:dt.upColor,wickDownColor:dt.downColor,borderUpColor:dt.upColor,borderDownColor:dt.downColor}),xp(p);const R=uA(de)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,E=ke(Q,R);h.primitive.originTime=E,h.originTime=E;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,E=ke(Q,R);h.primitive.time=E,h.time=ee(E);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,E=h.rawP2Time??h.p2.rawTime,x=N.length>0?N[0].time:null,m=N.length>0?N[N.length-1].time:null,D=z=>{const $=ke(z,R);return x==null||m==null?$:Math.min(Math.max($,x),m)},P=D(Q),k=D(E);h.p1.rawTime=P,h.p1.normalizedTime=ee(P),h.p2.rawTime=k,h.p2.normalizedTime=ee(k),h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:k,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,E=h.rawP2Time??h.p2.rawTime,x=N.length>0?N[0].time:null,m=N.length>0?N[N.length-1].time:null,D=he=>{const ge=ke(he,R);return x==null||m==null?ge:Math.min(Math.max(ge,x),m)},P=D(Q),k=D(E);h.p1.rawTime=P,h.p2.rawTime=k,h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:k,price:h.p2.price};const z=ee(P),$=ee(k),te=Math.abs(($??0)-(z??0));h.primitive.info={priceDiff:h.p2.price-h.p1.price,pricePct:(h.p2.price-h.p1.price)/Math.abs(h.p1.price||1)*100,bars:Ns(Ks,P,k,de),days:Math.max(1,Math.round(te/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="rayline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="extendedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="trendbyangle"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,E=h.p2.rawTime,x=ke(Q,R),m=ke(E,R);h.p1.rawTime=x,h.p1.normalizedTime=ee(x),h.p2.rawTime=m,h.p2.normalizedTime=ee(m),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:m,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=E=>{const x=ke(E.rawTime,R);E.rawTime=x,E.normalizedTime=ee(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="flattopbottom"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=E=>{const x=ke(E.rawTime,R);E.rawTime=x,E.normalizedTime=ee(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="regressionchannel"&&h.primitive&&h.p1&&h.p2){const Q=ir(N,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const E=h.primitive;E.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},E.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},E.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},E.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},E.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},E.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.intercept=Q.intercept,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="stddevchannel"&&h.primitive&&h.p1&&h.p2){const Q=Xr(N,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const E=h.primitive;E.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},E.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},E.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},E.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},E.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},E.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="andrewspitchfork"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R),x=ke(h.p3.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.p3.rawTime=x,h.p3.normalizedTime=ee(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="gannfan"||h.type==="ganngrid")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price};return}if((h.type==="circle"||h.type==="ellipse")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price};return}if(h.type==="triangle"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R),x=ke(h.p3.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.p3.rawTime=x,h.p3.normalizedTime=ee(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="fibonacci"||h.type==="rectangle")&&h.primitive&&h.p1&&h.p2){const Q=ke(h.p1.rawTime,R),E=ke(h.p2.rawTime,R);h.p1.rawTime=Q,h.p1.normalizedTime=ee(Q),h.p2.rawTime=E,h.p2.normalizedTime=ee(E),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:E,price:h.p2.price};return}if(h.type!=="trendline"&&h.type!=="gannline"||!h.series||!h.point1||!h.point2)return;const T=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=ke(T,R),d=ke(I,R);h.point1.time=w,h.point2.time=d;const _=zA([{time:w,value:h.point1.price},{time:d,value:h.point2.price}]);try{_.length>0&&h.series.setData(_)}catch{}}),N?.length>0){const h=N[N?.length-1].time,T=uA(de)||60,w=h-(de==="M1"?150:de==="M5"?120:100)*T;try{ue.setVisibleRange({from:w,to:h+T*up})}catch{ue.fitContent()}}else ue.fitContent();try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0;const y=ue.getVisibleRange();ve(y),MA.current&&clearTimeout(MA.current),MA.current=setTimeout(()=>requestAnimationFrame(()=>st(!1)),400)}}},[Ue.length,et,ye,de]),Y.useEffect(()=>{const p=c.current;if(!p||!ae.current||Ue.length===0)return;const f=p.timeScale(),O=f.getVisibleRange()||Be();if(u.current)try{p.removeSeries(u.current)}catch{}if(B.current)try{p.removeSeries(B.current),B.current=null}catch{}let me;const H=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=H.includes("JPY"),j=en(H),q=tn(H);let ue,L;X?(ue=.001,L=y=>Math.abs(Number(y)).toFixed(3)):q?H.startsWith("BTC")||H.startsWith("ETH")?(ue=.01,L=y=>Math.abs(Number(y)).toFixed(2)):(ue=1e-4,L=y=>Math.abs(Number(y)).toFixed(4)):j&&(H.startsWith("XAU")||H.startsWith("XAG"))?(ue=.01,L=y=>Math.abs(Number(y)).toFixed(2)):(ue=1e-4,L=y=>Math.abs(Number(y)).toFixed(5));const N={type:"custom",minMove:ue,formatter:L};if(et==="bars"){const y=rt==="light";me=p.addBarSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const h=[...Ue].sort((T,I)=>T.time-I.time);h?.length>0&&me.setData(h)}else if(et==="line"){me=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const y=zA(al);y.length>0&&me.setData(y)}else if(et==="area"){me=p.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const y=zA(al);y.length>0&&me.setData(y)}else if(et==="volume ticks"||et==="volume"){const y=rt==="light";me=p.addCandlestickSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",wickUpColor:y?"#089981":"#26A69A",wickDownColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",borderVisible:!0,priceFormat:N,priceScaleId:"right"});const h=[...Ue].sort((w,d)=>w.time-d.time);h?.length>0&&me.setData(h);const T=p.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),p.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const I=h?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));I.length>0&&T.setData(I),B.current=T}else{const y=rt==="light";me=p.addCandlestickSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",wickUpColor:y?"#089981":"#26A69A",wickDownColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",borderVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const h=[...Ue].sort((T,I)=>T.time-I.time);h?.length>0&&me.setData(h)}if(u.current=me,dt&&me)try{me.applyOptions({upColor:dt.upColor,downColor:dt.downColor,wickUpColor:dt.upColor,wickDownColor:dt.downColor,borderUpColor:dt.upColor,borderDownColor:dt.downColor})}catch{}xp(me,!0);const R=uA(de)||60;if(v.current.forEach(y=>{if(y.type==="horizontalray"&&y.primitive){const E=y.rawOriginTime??y.primitive.originTime,x=ke(E,R);y.primitive.originTime=x,y.originTime=x;return}if(y.type==="verticalline"&&y.primitive){const E=y.rawTime??y.primitive.time,x=ke(E,R);y.primitive.time=x,y.time=ee(x);return}if(y.type==="infoline"&&y.primitive&&y.p1&&y.p2){const E=y.rawP1Time??y.p1.rawTime,x=y.rawP2Time??y.p2.rawTime,m=[...Ue].sort((te,he)=>te.time-he.time),D=m.length>0?m[0].time:null,P=m.length>0?m[m.length-1].time:null,k=te=>{const he=ke(te,R);return D==null||P==null?he:Math.min(Math.max(he,D),P)},z=k(E),$=k(x);y.p1.rawTime=z,y.p1.normalizedTime=ee(z),y.p2.rawTime=$,y.p2.normalizedTime=ee($),y.primitive.p1={rawTime:z,price:y.p1.price},y.primitive.p2={rawTime:$,price:y.p2.price};return}if(y.type==="rulerline"&&y.primitive&&y.p1&&y.p2){const E=y.rawP1Time??y.p1.rawTime,x=y.rawP2Time??y.p2.rawTime,m=[...Ue].sort((xe,Ee)=>xe.time-Ee.time),D=m.length>0?m[0].time:null,P=m.length>0?m[m.length-1].time:null,k=xe=>{const Ee=ke(xe,R);return D==null||P==null?Ee:Math.min(Math.max(Ee,D),P)},z=k(E),$=k(x);y.p1.rawTime=z,y.p2.rawTime=$,y.primitive.p1={rawTime:z,price:y.p1.price},y.primitive.p2={rawTime:$,price:y.p2.price};const te=ee(z),he=ee($),ge=Math.abs((he??0)-(te??0));y.primitive.info={priceDiff:y.p2.price-y.p1.price,pricePct:(y.p2.price-y.p1.price)/Math.abs(y.p1.price||1)*100,bars:Ns(Ks,z,$,de),days:Math.max(1,Math.round(ge/86400))};return}if(y.type==="arrowedline"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="rayline"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="extendedline"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="trendbyangle"&&y.primitive&&y.p1&&y.p2){const E=y.p1.rawTime,x=y.p2.rawTime,m=ke(E,R),D=ke(x,R);y.p1.rawTime=m,y.p1.normalizedTime=ee(m),y.p2.rawTime=D,y.p2.normalizedTime=ee(D),y.primitive.p1={rawTime:m,price:y.p1.price},y.primitive.p2={rawTime:D,price:y.p2.price};return}if(y.type==="disjointchannel"&&y.primitive&&y.p1&&y.p2&&y.p3&&y.p4){const E=x=>{const m=ke(x.rawTime,R);x.rawTime=m,x.normalizedTime=ee(m)};E(y.p1),E(y.p2),E(y.p3),E(y.p4),y.primitive.p1={rawTime:y.p1.rawTime,price:y.p1.price},y.primitive.p2={rawTime:y.p2.rawTime,price:y.p2.price},y.primitive.p3={rawTime:y.p3.rawTime,price:y.p3.price},y.primitive.p4={rawTime:y.p4.rawTime,price:y.p4.price};return}if(y.type==="flattopbottom"&&y.primitive&&y.p1&&y.p2&&y.p3&&y.p4){const E=x=>{const m=ke(x.rawTime,R);x.rawTime=m,x.normalizedTime=ee(m)};E(y.p1),E(y.p2),E(y.p3),E(y.p4),y.primitive.p1={rawTime:y.p1.rawTime,price:y.p1.price},y.primitive.p2={rawTime:y.p2.rawTime,price:y.p2.price},y.primitive.p3={rawTime:y.p3.rawTime,price:y.p3.price},y.primitive.p4={rawTime:y.p4.rawTime,price:y.p4.price};return}if(y.type==="regressionchannel"&&y.primitive&&y.p1&&y.p2){const E=[...Ue].sort((D,P)=>D.time-P.time),x=ir(E,y.p1,y.p2,y.stdMultiplier??1);if(!x)return;const m=y.primitive;m.mid1={rawTime:x.p1.rawTime,price:x.p1.price},m.mid2={rawTime:x.p2.rawTime,price:x.p2.price},m.top1={rawTime:x.top1.rawTime,price:x.top1.price},m.top2={rawTime:x.top2.rawTime,price:x.top2.price},m.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},m.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},y.p1=x.p1,y.p2=x.p2,y.top1=x.top1,y.top2=x.top2,y.bot1=x.bot1,y.bot2=x.bot2,y.slope=x.slope,y.intercept=x.intercept,y.stdDev=x.stdDev,y.offset=x.offset,y.barCount=x.barCount;return}if(y.type==="stddevchannel"&&y.primitive&&y.p1&&y.p2){const E=[...Ue].sort((D,P)=>D.time-P.time),x=Xr(E,y.p1,y.p2,y.stdMultiplier??1);if(!x)return;const m=y.primitive;m.mid1={rawTime:x.p1.rawTime,price:x.p1.price},m.mid2={rawTime:x.p2.rawTime,price:x.p2.price},m.top1={rawTime:x.top1.rawTime,price:x.top1.price},m.top2={rawTime:x.top2.rawTime,price:x.top2.price},m.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},m.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},y.p1=x.p1,y.p2=x.p2,y.top1=x.top1,y.top2=x.top2,y.bot1=x.bot1,y.bot2=x.bot2,y.slope=x.slope,y.stdDev=x.stdDev,y.offset=x.offset,y.barCount=x.barCount;return}if(y.type==="andrewspitchfork"&&y.primitive&&y.p1&&y.p2&&y.p3){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R),m=ke(y.p3.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.p3.rawTime=m,y.p3.normalizedTime=ee(m),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price},y.primitive.p3={rawTime:m,price:y.p3.price};return}if((y.type==="gannfan"||y.type==="ganngrid")&&y.primitive&&y.p1&&y.p2){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price};return}if((y.type==="circle"||y.type==="ellipse")&&y.primitive&&y.p1&&y.p2){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price};return}if(y.type==="triangle"&&y.primitive&&y.p1&&y.p2&&y.p3){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R),m=ke(y.p3.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.p3.rawTime=m,y.p3.normalizedTime=ee(m),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price},y.primitive.p3={rawTime:m,price:y.p3.price};return}if((y.type==="fibonacci"||y.type==="rectangle")&&y.primitive&&y.p1&&y.p2){const E=ke(y.p1.rawTime,R),x=ke(y.p2.rawTime,R);y.p1.rawTime=E,y.p1.normalizedTime=ee(E),y.p2.rawTime=x,y.p2.normalizedTime=ee(x),y.primitive.p1={rawTime:E,price:y.p1.price},y.primitive.p2={rawTime:x,price:y.p2.price};return}if(y.type!=="trendline"&&y.type!=="gannline"||!y.series||!y.point1||!y.point2)return;const h=y.type==="gannline"?"#7aa6ae":"#22c55e";try{p.removeSeries(y.series)}catch{}const T=p.addLineSeries({color:y.lineColor??h,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),I=y.point1.rawTime??y.point1.time,w=y.point2.rawTime??y.point2.time,d=ke(I,R),_=ke(w,R);y.point1.time=d,y.point2.time=_;const Q=zA([{time:d,value:y.point1.price},{time:_,value:y.point2.price}]);try{Q.length>0&&T.setData(Q)}catch{}if(y.decoration)try{T.attachPrimitive(y.decoration)}catch{}y.series=T}),O&&ae.current)setTimeout(()=>{try{f.setVisibleRange(O),ve(O)}catch{if(Ue.length>0)try{const h=Ue[Ue.length-1].time,T=uA(de)||60,I=h-100*T;f.setVisibleRange({from:I,to:h+T*up}),ve(f.getVisibleRange())}catch{f.fitContent(),ve(f.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!ae.current){f.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0,ve(f.getVisibleRange())}},[et,Ue.length,al.length,ye,dt]),Y.useEffect(()=>{const p=c.current,f=B.current;if(!p||!f||!ae.current||Ue.length===0||et!=="volume"&&et!=="volume ticks")return;const me=[...Ue].sort((H,X)=>H.time-X.time)?.map(H=>({time:H.time,value:H.volume||0,color:H.close>=H.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));me.length>0&&f.setData(me)},[Ue,et]),Y.useEffect(()=>{if(!ye||!de||!Kt)return;const f=Object.entries(Kt).filter(([q,ue])=>ue).map(([q])=>q).filter(q=>q.startsWith("sma")||q.startsWith("ema")||q==="rsi"||q==="macd");if(f.length===0){mt({});return}const O=f.map(q=>q==="sma20"?`sma:${Ut?.smaPeriod||20}`:q==="sma50"?"sma:50":q==="ema12"?`ema:${Ut?.emaPeriod||12}`:q==="rsi"?`rsi:${Ut?.rsiPeriod||14}`:q==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const me=++St.current,H=Gt||"http://localhost:5002",X=mA?.indicators||"/api/market-data/indicators",j=localStorage.getItem("token")??localStorage.getItem("authToken");gt.get(`${H}${X}`,{params:{symbol:ye,timeframe:de,indicators:O},headers:j?{Authorization:`Bearer ${j}`}:{}}).then(q=>{me===St.current&&mt(q.data?.data||{})}).catch(q=>{console.error("[ChartArea] Indicator fetch error:",q?.message),me===St.current&&mt({})})},[ye,de,Kt,Ut,Gt,mA]),Y.useEffect(()=>{const p=c.current;if(!p||!ae.current)return;const f=gA.current,O=(N,R)=>(f[N]||(f[N]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...R})),f[N]),me=N=>{if(f[N]){try{p.removeSeries(f[N])}catch{}delete f[N]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(me)},X=Kt||{};if(X.sma20&&nt.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(nt.sma20.data.map(R=>({time:R.time,value:R.value}))):me("sma20"),X.sma50&&nt.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(nt.sma50.data.map(R=>({time:R.time,value:R.value}))):me("sma50"),X.ema12&&nt.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(nt.ema12.data.map(R=>({time:R.time,value:R.value}))):me("ema12"),X.rsi&&nt.rsi?.data?.length){const N=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:T=>T.toFixed(1)}});p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),N.setData(nt.rsi.data.map(T=>({time:T.time,value:T.value}))),f.rsi70||(f.rsi70=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),f.rsi30||(f.rsi30=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const R=nt.rsi.data,y=R[0]?.time,h=R[R.length-1]?.time;y&&h&&(f.rsi70.setData([{time:y,value:70},{time:h,value:70}]),f.rsi30.setData([{time:y,value:30},{time:h,value:30}]))}else me("rsi"),me("rsi70"),me("rsi30");if(X.macd&&nt.macd?.data?.length){const N=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:T=>T.toFixed(4)}}),R=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});f.macdHist||(f.macdHist=p.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:T=>T.toFixed(4)}}));const y=X.rsi?.65:.8;p.priceScale("macd").applyOptions({scaleMargins:{top:y,bottom:0},borderVisible:!1,autoScale:!0}),X.rsi&&p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const h=nt.macd.data;N.setData(h.map(T=>({time:T.time,value:T.value}))),R.setData(h.map(T=>({time:T.time,value:T.signal}))),f.macdHist.setData(h.map(T=>({time:T.time,value:T.histogram,color:T.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else H();const j=()=>{["bbUpper","bbMiddle","bbLower"].forEach(me)};if(X.bollinger){const N=Array.from(ii.current.values()).sort((T,I)=>T.time-I.time),R=$e.current?.bbPeriod||20,y=$e.current?.bbStdDev||2,h=gl(N,R,y);if(h){const T=O("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),I=O("bbMiddle",{color:"rgba(33,150,243,0.8)",lineWidth:1.5}),w=O("bbLower",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2});T.setData(h.upper),I.setData(h.middle),w.setData(h.lower)}}else j();const q=Array.from(ii.current.values()).sort((N,R)=>N.time-R.time);if(q.length>0){const N=$e.current||{};if(X.sma20&&f.sma20){const R=Os(q,N.smaPeriod||20);if(R)try{f.sma20.update(R)}catch{}}if(X.sma50&&f.sma50){const R=Os(q,50);if(R)try{f.sma50.update(R)}catch{}}if(X.ema12&&f.ema12){const R=fp(q,N.emaPeriod||12);if(R)try{f.ema12.update(R)}catch{}}if(X.rsi&&f.rsi){const R=mp(q,N.rsiPeriod||14);if(R){try{f.rsi.update(R)}catch{}if(f.rsi70)try{f.rsi70.update({time:R.time,value:70})}catch{}if(f.rsi30)try{f.rsi30.update({time:R.time,value:30})}catch{}}}if(X.macd&&f.macdLine){const R=gp(q,12,26,9);if(R){try{f.macdLine.update({time:R.time,value:R.value})}catch{}try{f.macdSignal.update({time:R.time,value:R.signal})}catch{}try{f.macdHist.update({time:R.time,value:R.histogram,color:R.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(X.bollinger&&f.bbMiddle){const R=Rs(q,N.bbPeriod||20,N.bbStdDev||2);if(R){try{f.bbUpper.update({time:R.time,value:R.upper})}catch{}try{f.bbMiddle.update({time:R.time,value:R.middle})}catch{}try{f.bbLower.update({time:R.time,value:R.lower})}catch{}}}}const ue=X.rsi&&nt.rsi?.data?.length||X.macd&&nt.macd?.data?.length,L=X.rsi&&nt.rsi?.data?.length&&X.macd&&nt.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:L?.4:ue?.25:.05}})}catch{}},[nt,Kt,Ue.length]),Y.useEffect(()=>()=>{const p=c.current;if(!p)return;const f=gA.current;Object.keys(f).forEach(O=>{try{p.removeSeries(f[O])}catch{}}),gA.current={}},[ye,de]),Y.useEffect(()=>{const p=c.current,f=u.current,O=o.current;if(!p||!f||!O)return;const H=Ce!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][Ce]:null,X=(L,N)=>{const R=Math.min(L.time,N.time),y=Math.max(L.time,N.time),h=L.time<=N.time?L.rawTime:N.rawTime,T=L.time<=N.time?N.rawTime:L.rawTime,I=Math.max(L.price,N.price),w=Math.min(L.price,N.price),d=ee(Math.round((R+y)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:R,price:w},p3:{rawTime:T,normalizedTime:y,price:w}}};if(!H){if(b.current=!1,C.current=null,U.current=null,S.current=null,F.current?.series)try{p.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const d={type:"pricelevel",priceLine:f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};Te(_=>[..._,d]),v.current.push(d),be(null)};return O.addEventListener("click",L),()=>{O.removeEventListener("click",L)}}if(H==="horizontalray"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=new qv(I,T);f.attachPrimitive(w);const d=f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),_=ee(T),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:_,rawOriginTime:T,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};Te(E=>[...E,Q]),v.current.push(Q),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="verticalline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=p.timeScale().coordinateToTime(y);if(h==null)return;const T=new uT(h);f.attachPrimitive(T);const I=ee(h),w={type:"verticalline",primitive:T,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};Te(d=>[...d,w]),v.current.push(w),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="text"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=new pT(T,I);f.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:T,price:I,text:"Text"};Te(_=>[..._,d]),v.current.push(d),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="infoline"){let L=null,N=null;const R=h=>{if(!L)return;const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;N||(N=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null||Q===E)return;const x=Q<=E?[{time:Q,value:L.price},{time:E,value:_}]:[{time:E,value:_},{time:Q,value:L.price}];try{N.setData(x)}catch{}},y=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!L){L={rawTime:d,price:_,normalizedTime:ee(d),x:I,y:w};return}if(N){try{p.removeSeries(N)}catch{}N=null}const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null)return;const x=_-L.price,m=x/Math.abs(L.price)*100,D=uA(de)||3600,P=Math.abs(E-Q),k=Math.max(1,Math.round(P/D)),z=Math.max(1,Math.round(P/86400)),$=L.x,te=L.y,he=I,xe=Math.atan2(-(w-te),he-$)*(180/Math.PI),Ee={priceDiff:x,pricePct:m,bars:k,days:z,angle:xe},Re=new jv({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_},Ee);f.attachPrimitive(Re);const je={type:"infoline",primitive:Re,rawP1Time:L.rawTime,rawP2Time:d,p1:{rawTime:L.rawTime,normalizedTime:Q,price:L.price},p2:{rawTime:d,normalizedTime:E,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};Te(Ve=>[...Ve,je]),v.current.push(je),L=null,be(null)};return O.addEventListener("mousemove",R),O.addEventListener("click",y),()=>{if(O.removeEventListener("mousemove",R),O.removeEventListener("click",y),N)try{p.removeSeries(N)}catch{}}}if(H==="rulerline"){let L=null,N=null;const R=(T,I,w,d)=>{const _=ee(T),Q=ee(w),E=d-I,x=E/Math.abs(I)*100,m=Ns(Ks,T,w,de),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:E,pricePct:x,bars:m,days:P}},y=T=>{if(!L)return;const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null||E===L.normalizedTime)return;const x=R(L.rawTime,L.price,_,Q);if(!N)N=new Ap({rawTime:L.rawTime,price:L.price},{rawTime:_,price:Q},x),f.attachPrimitive(N);else{N.p2={rawTime:_,price:Q},N.info=x;const m=Q>=L.price;N.color=m?"#3b82f6":"#ef5350",N.fillColor=m?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=T=>{const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;if(!L){L={rawTime:_,price:Q,normalizedTime:ee(_)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const E=L.normalizedTime,x=ee(_);if(E==null||x==null)return;const m=R(L.rawTime,L.price,_,Q),D=new Ap({rawTime:L.rawTime,price:L.price},{rawTime:_,price:Q},m);f.attachPrimitive(D);const P={type:"rulerline",primitive:D,rawP1Time:L.rawTime,rawP2Time:_,p1:{rawTime:L.rawTime,normalizedTime:E,price:L.price},p2:{rawTime:_,normalizedTime:x,price:Q},lineColor:Q>=L.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};Te(k=>[...k,P]),v.current.push(P),L=null,be(null)};return O.addEventListener("mousemove",y),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",y),O.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="arrowedline"){let L=null,N=null;const R=h=>{if(!L)return;const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;const Q=ee(d);if(!(Q==null||Q===L.normalizedTime))if(!N)N=new ip({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_}),f.attachPrimitive(N);else{N.p2={rawTime:d,price:_};try{c.current?.applyOptions({})}catch{}}},y=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!L){L={rawTime:d,price:_,normalizedTime:ee(d)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null||Q===E)return;const x=new ip({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_});f.attachPrimitive(x);const m={type:"arrowedline",primitive:x,p1:{rawTime:L.rawTime,normalizedTime:Q,price:L.price},p2:{rawTime:d,normalizedTime:E,price:_},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(D=>[...D,m]),v.current.push(m),L=null,be(null)};return O.addEventListener("mousemove",R),O.addEventListener("click",y),()=>{if(O.removeEventListener("mousemove",R),O.removeEventListener("click",y),N)try{f.detachPrimitive(N)}catch{}}}if(H==="rayline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=y+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=ee(T),Q=ee(d);if(_==null||Q==null)return;const E=new rT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(E);const x={type:"rayline",primitive:E,p1:{rawTime:T,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(m=>[...m,x]),v.current.push(x),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="extendedline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=y+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=ee(T),Q=ee(d);if(_==null||Q==null)return;const E=new nT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(E);const x={type:"extendedline",primitive:E,p1:{rawTime:T,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(m=>[...m,x]),v.current.push(x),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="crossline"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d=new oT({rawTime:T,price:I});f.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:T,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};Te(Q=>[...Q,_]),v.current.push(_),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="trendbyangle"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=y+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=ee(T),Q=ee(d);if(_==null||Q==null)return;const E=new aT({rawTime:T,price:I},{rawTime:d,price:I});f.attachPrimitive(E);const x={type:"trendbyangle",primitive:E,p1:{rawTime:T,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};Te(m=>[...m,x]),v.current.push(x),be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="disjointchannel"){let L=null,N=null,R=null,y=null,h=0,T=null;const I=(_,Q,E,x)=>{if(!T)T=new Al(_,Q,E,x),f.attachPrimitive(T);else{T.p1=_,T.p2=Q,T.p3=E,T.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!L)return;const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const m=f.coordinateToPrice(x);if(m==null)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:m},I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P==null)return;const k=(L.price+N.price)/2;D>=k?(R={rawTime:m,normalizedTime:P,price:D},y={rawTime:m,normalizedTime:P,price:2*k-D}):(y={rawTime:m,normalizedTime:P,price:D},R={rawTime:m,normalizedTime:P,price:2*k-D}),I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:R.rawTime,price:R.price},{rawTime:y.rawTime,price:y.price})}},d=_=>{const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top,m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P!=null){if(h===0){L={rawTime:m,normalizedTime:P,price:D},N={rawTime:m,normalizedTime:P,price:D},h=1,I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const k=f.coordinateToPrice(x);if(k==null||Math.abs(k-L.price)<1e-7)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:k},h=2;return}if(h===2&&T){try{f.detachPrimitive(T)}catch{}const k=new Al(T.p1,T.p2,T.p3,T.p4);f.attachPrimitive(k);const z={type:"disjointchannel",primitive:k,p1:L,p2:N,p3:{rawTime:T.p3.rawTime,normalizedTime:ee(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:ee(T.p4.rawTime),price:T.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Te($=>[...$,z]),v.current.push(z),be(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",d),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",d),T)try{f.detachPrimitive(T)}catch{}}}if(H==="flattopbottom"){let L=null,N=null,R=null,y=null,h=0,T=null;const I=(_,Q,E,x)=>{if(!T)T=new rp(_,Q,E,x),f.attachPrimitive(T);else{T.p1=_,T.p2=Q,T.p3=E,T.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!L)return;const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const m=f.coordinateToPrice(x);if(m==null)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:m},I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P==null)return;R={rawTime:m,normalizedTime:P,price:D},y={rawTime:m,normalizedTime:P,price:N.price},I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:R.rawTime,price:R.price},{rawTime:y.rawTime,price:y.price})}},d=_=>{const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top,m=p.timeScale().coordinateToTime(E),D=f.coordinateToPrice(x);if(m==null||D==null)return;const P=ee(m);if(P!=null){if(h===0){L={rawTime:m,normalizedTime:P,price:D},N={rawTime:m,normalizedTime:P,price:D},h=1,I({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const k=f.coordinateToPrice(x);if(k==null||Math.abs(k-L.price)<1e-7)return;N={rawTime:L.rawTime,normalizedTime:L.normalizedTime,price:k},h=2;return}if(h===2&&T){try{f.detachPrimitive(T)}catch{}const k=new rp(T.p1,T.p2,T.p3,T.p4);f.attachPrimitive(k);const z={type:"flattopbottom",primitive:k,p1:L,p2:N,p3:{rawTime:T.p3.rawTime,normalizedTime:ee(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:ee(T.p4.rawTime),price:T.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Te($=>[...$,z]),v.current.push(z),be(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",d),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",d),T)try{f.detachPrimitive(T)}catch{}}}if(H==="regressionchannel"){let L=null,N=null;const R=(T,I)=>{T.mid1={rawTime:I.p1.rawTime,price:I.p1.price},T.mid2={rawTime:I.p2.rawTime,price:I.p2.price},T.top1={rawTime:I.top1.rawTime,price:I.top1.price},T.top2={rawTime:I.top2.rawTime,price:I.top2.price},T.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},T.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},y=T=>{if(!L)return;const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;const m=ir(Ue,L,{rawTime:_,normalizedTime:E},1);if(m)if(!N)N=new il({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(N);else{R(N,m);try{p.applyOptions({})}catch{}}},h=T=>{const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;if(!L){L={rawTime:_,normalizedTime:E,price:Q};return}const m=ir(Ue,L,{rawTime:_,normalizedTime:E},1);if(!m)return;if(N){try{f.detachPrimitive(N)}catch{}N=null}const D=new il({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,intercept:m.intercept,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Te(k=>[...k,P]),v.current.push(P),L=null,be(null)};return O.addEventListener("mousemove",y),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",y),O.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="stddevchannel"){let L=null,N=null;const R=(T,I)=>{T.mid1={rawTime:I.p1.rawTime,price:I.p1.price},T.mid2={rawTime:I.p2.rawTime,price:I.p2.price},T.top1={rawTime:I.top1.rawTime,price:I.top1.price},T.top2={rawTime:I.top2.rawTime,price:I.top2.price},T.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},T.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},y=T=>{if(!L)return;const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;const m=Xr(Ue,L,{rawTime:_,normalizedTime:E},1);if(m)if(!N)N=new sp({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(N);else{R(N,m);try{p.applyOptions({})}catch{}}},h=T=>{const I=O.getBoundingClientRect(),w=T.clientX-I.left,d=T.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=f.coordinateToPrice(d);if(_==null||Q==null)return;const E=ee(_);if(E==null)return;if(!L){L={rawTime:_,normalizedTime:E,price:Q};return}const m=Xr(Ue,L,{rawTime:_,normalizedTime:E},1);if(!m)return;if(N){try{f.detachPrimitive(N)}catch{}N=null}const D=new sp({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Te(k=>[...k,P]),v.current.push(P),L=null,be(null)};return O.addEventListener("mousemove",y),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",y),O.removeEventListener("click",h),N)try{f.detachPrimitive(N)}catch{}}}if(H==="andrewspitchfork"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d=y+140,_=p.timeScale().coordinateToTime(d);if(_==null)return;const Q=ee(_);if(Q==null)return;const E={rawTime:T,normalizedTime:w,price:I},x={rawTime:_,normalizedTime:Q,price:I},m={rawTime:T,normalizedTime:w,price:I},D=new lT({rawTime:E.rawTime,price:E.price},{rawTime:x.rawTime,price:x.price},{rawTime:m.rawTime,price:m.price});f.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:E,p2:x,p3:m};Te(k=>[...k,P]),v.current.push(P),M(P),le.current=P,be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="gannfan"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d={rawTime:T,normalizedTime:w,price:I},_={rawTime:T,normalizedTime:w,price:I},Q=new cT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const E={type:"gannfan",primitive:Q,p1:d,p2:_};Te(x=>[...x,E]),v.current.push(E),M(E),le.current=E,be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="ganngrid"){const L=N=>{const R=O.getBoundingClientRect(),y=N.clientX-R.left,h=N.clientY-R.top,T=p.timeScale().coordinateToTime(y),I=f.coordinateToPrice(h);if(T==null||I==null)return;const w=ee(T);if(w==null)return;const d={rawTime:T,normalizedTime:w,price:I},_={rawTime:T,normalizedTime:w,price:I},Q=new hT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const E={type:"ganngrid",primitive:Q,p1:d,p2:_};Te(x=>[...x,E]),v.current.push(E),M(E),le.current=E,be(null)};return O.addEventListener("click",L),()=>O.removeEventListener("click",L)}if(H==="trendline"||H==="gannline"){const L=H,N=L==="gannline"?"#7aa6ae":"#22c55e",R=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=O.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const E=f.coordinateToPrice(_);if(!(Q==null||E==null)&&(Q=ee(Q),Q!=null))if(S.current===null){S.current={time:Q,price:E};const x=p.addLineSeries({color:N,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:L,series:x},x.setData([{time:Q,value:E}])}else{const x=S.current,m={time:Q,price:E},D=1,P=1e-5,k=Math.abs(m.time-x.time),z=Math.abs(m.price-x.price);if(k<D&&z<P){try{p.removeSeries(F.current.series)}catch{}S.current=null,F.current=null;return}const $={time:x.time,rawTime:x.time,price:x.price},te={time:m.time,rawTime:m.time,price:m.price},he=zA([{time:$.time,value:$.price},{time:te.time,value:te.price}]);if(he.length>0){F.current.series.setData(he);const ge=new sT($,te,N,2);try{F.current.series.attachPrimitive(ge)}catch{}const xe={type:L,series:F.current.series,point1:$,point2:te,decoration:ge};Te(Ee=>[...Ee,xe]),v.current.push(xe)}be(null),S.current=null,F.current=null}},y=I=>{if(S.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=O.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const E=f.coordinateToPrice(_);if(Q==null||E==null||(Q=ee(Q),Q==null))return;const x=S.current,m=zA([{time:x.time,value:x.price},{time:Q,value:E}]);m.length>0&&F.current.series.setData(m)},h=I=>{I.stopPropagation()},T={capture:!0,passive:!1};return O.addEventListener("click",R,T),O.addEventListener("mousemove",y,T),O.addEventListener("mousemove",h,T),()=>{if(S.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}O.removeEventListener("click",R,T),O.removeEventListener("mousemove",y,T),O.removeEventListener("mousemove",h,T)}}if(H==="parallellines"){let L=null,N=null,R=null,y=0,h=null;const T=(E,x,m,D)=>{E.p1={rawTime:x.rawTime,price:x.price},E.p2={rawTime:m.rawTime,price:m.price},E.b1={rawTime:D.b1.rawTime,price:D.b1.price},E.b2={rawTime:D.b2.rawTime,price:D.b2.price},E.p3={rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}},I=(E,x,m)=>{const D=hp(E,x,m);if(!D)return null;if(!h)h=new np({rawTime:E.rawTime,price:E.price},{rawTime:x.rawTime,price:x.price},{rawTime:D.b1.rawTime,price:D.b1.price},{rawTime:D.b2.rawTime,price:D.b2.price},{rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}),f.attachPrimitive(h);else{T(h,E,x,D);try{p.applyOptions({})}catch{}}return D},w=E=>{E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const x=O.getBoundingClientRect(),m=E.clientX-x.left,D=E.clientY-x.top,P=p.timeScale().coordinateToTime(m),k=f.coordinateToPrice(D);if(P==null||k==null)return;const z=ee(P);if(z!=null){if(y===0){L={rawTime:P,normalizedTime:z,price:k},y=1;return}if(y===1){if(N={rawTime:P,normalizedTime:z,price:k},Math.abs(N.normalizedTime-L.normalizedTime)<1)return;const $=ee((L.normalizedTime+N.normalizedTime)/2);if($==null)return;const te=(L.price+N.price)/2;R={rawTime:$,normalizedTime:$,price:te},I(L,N,R),y=2;return}if(y===2&&L&&N){R={rawTime:P,normalizedTime:z,price:k};const $=I(L,N,R);if(!$||!h)return;try{f.detachPrimitive(h)}catch{}const te=new np({rawTime:L.rawTime,price:L.price},{rawTime:N.rawTime,price:N.price},{rawTime:$.b1.rawTime,price:$.b1.price},{rawTime:$.b2.rawTime,price:$.b2.price},{rawTime:$.bottomMid.rawTime,price:$.bottomMid.price});f.attachPrimitive(te);const he={type:"equidistantchannel",primitive:te,p1:L,p2:N,p3:$.bottomMid,b1:$.b1,b2:$.b2,bottomMid:$.bottomMid};Te(ge=>[...ge,he]),v.current.push(he),be(null),y=0,L=null,N=null,R=null,h=null}}},d=E=>{if(y===0||!L)return;const x=O.getBoundingClientRect(),m=E.clientX-x.left,D=E.clientY-x.top,P=p.timeScale().coordinateToTime(m),k=f.coordinateToPrice(D);if(P==null||k==null)return;const z=ee(P);if(z!=null){if(y===1){const $={rawTime:P,normalizedTime:z,price:k},te=ee((L.normalizedTime+$.normalizedTime)/2);if(te==null)return;const he=(L.price+$.price)/2;I(L,$,{rawTime:te,normalizedTime:te,price:he});return}y===2&&N&&I(L,N,{rawTime:P,normalizedTime:z,price:k})}},_=E=>{E.stopPropagation()},Q={capture:!0,passive:!1};return O.addEventListener("click",w,Q),O.addEventListener("mousemove",d,Q),O.addEventListener("mousemove",_,Q),()=>{if(y=0,L=null,N=null,R=null,K.current=[],h)try{f.detachPrimitive(h)}catch{}h=null,O.removeEventListener("click",w,Q),O.removeEventListener("mousemove",d,Q),O.removeEventListener("mousemove",_,Q)}}if(H==="fibonacci"){let L=null,N=null;const R=h=>{if(!L)return;const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(!(d==null||_==null))if(!N)N=new op({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_}),f.attachPrimitive(N);else{N.p2={rawTime:d,price:_};try{p.applyOptions({})}catch{}}},y=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=p.timeScale().coordinateToTime(I),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!L){L={rawTime:d,price:_,normalizedTime:ee(d)};return}if(N){try{f.detachPrimitive(N)}catch{}N=null}const Q=L.normalizedTime,E=ee(d);if(Q==null||E==null)return;if(Math.abs(_-L.price)<1e-5){L=null;return}const x=new op({rawTime:L.rawTime,price:L.price},{rawTime:d,price:_});f.attachPrimitive(x);const m={type:"fibonacci",primitive:x,p1:{rawTime:L.rawTime,normalizedTime:Q,price:L.price},p2:{rawTime:d,normalizedTime:E,price:_}};Te(D=>[...D,m]),v.current.push(m),L=null,be(null)};return O.addEventListener("mousemove",R),O.addEventListener("click",y),()=>{if(O.removeEventListener("mousemove",R),O.removeEventListener("click",y),N)try{f.detachPrimitive(N)}catch{}}}if(S.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}const j=L=>{if(L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const N=O.getBoundingClientRect(),R=L.clientX-N.left,y=L.clientY-N.top;let h=p.timeScale().coordinateToTime(R);const T=f.coordinateToPrice(y);if(h==null||T==null)return;const I=h;if(h=ee(h),h!=null){if(b.current=!0,C.current={time:h,normalizedTime:h,rawTime:I,price:T},U.current=null,H==="rectangle"){const w=new eT({rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new tT({rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",lineWidth:1});f.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new AT({rawTime:I,price:T},{rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new iT({rawTime:I,price:T},{rawTime:I,price:T},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});f.attachPrimitive(w),F.current={type:"ellipse",primitive:w}}if(H==="parallellines"){const w=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},q=L=>{if(!b.current||!C.current||!F.current)return;L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const N=O.getBoundingClientRect(),R=L.clientX-N.left,y=L.clientY-N.top;let h=p.timeScale().coordinateToTime(R);const T=f.coordinateToPrice(y);if(h==null||T==null)return;const I=h;if(h=ee(h),h==null)return;U.current={time:h,normalizedTime:h,rawTime:I,price:T};const w=C.current;if(F.current.type==="rectangle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:T};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:T};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const d=F.current.primitive,_=X(w,{time:h,rawTime:I,price:T});if(!_)return;d.p1={rawTime:_.p1.rawTime,price:_.p1.price},d.p2={rawTime:_.p2.rawTime,price:_.p2.price},d.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:T};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const d=F.current.firstLine;d.endTime-d.startTime;const _=d.endPrice-d.startPrice,Q=T,E=Q+_;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:E}]);else{const x=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});x.setData([{time:w.time,value:Q},{time:h,value:E}]),F.current.secondLine=x}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:T}])},ue=L=>{if(L&&(L.preventDefault(),L.stopPropagation()),!b.current||!F.current||!C.current)return;const N=C.current,R=U.current||N;if(F.current.type==="parallellines")if(F.current.firstLine){const y={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};Te(h=>[...h,y]),v.current.push(y),be(null),F.current=null,b.current=!1,C.current=null,U.current=null;return}else{F.current.firstLine={startTime:N.time,startPrice:N.price,endTime:R.time,endPrice:R.price},b.current=!1,C.current=null,U.current=null;return}if(F.current.type==="rectangle"){const y=C.current,h=U.current||y,T=Math.max(y.price,h.price),I=Math.min(y.price,h.price),w=ee(Math.min(y.time,h.time)),d=ee(Math.max(y.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(T-I)>=1e-5){const _=F.current.primitive,Q=y.time<=h.time?y.rawTime:h.rawTime,E=y.time<=h.time?h.rawTime:y.rawTime,x={rawTime:Q,normalizedTime:w,price:T},m={rawTime:E,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:m.rawTime,price:m.price};const D={type:"rectangle",primitive:_,p1:x,p2:m};Te(P=>[...P,D]),v.current.push(D),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const y=F.current.primitive,h={rawTime:N.rawTime,normalizedTime:N.time,price:N.price},T={rawTime:R.rawTime,normalizedTime:R.time,price:R.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(T.rawTime),_=f.priceToCoordinate(T.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=3){y.p1={rawTime:h.rawTime,price:h.price},y.p2={rawTime:T.rawTime,price:T.price};const E={type:"circle",primitive:y,p1:h,p2:T};Te(x=>[...x,E]),v.current.push(E),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const y=F.current.primitive,h=X(N,R);if(h){const T=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(T>=1&&I>=1e-5){y.p1={rawTime:h.p1.rawTime,price:h.p1.price},y.p2={rawTime:h.p2.rawTime,price:h.p2.price},y.p3={rawTime:h.p3.rawTime,price:h.p3.price};const w={type:"triangle",primitive:y,p1:h.p1,p2:h.p2,p3:h.p3};Te(d=>[...d,w]),v.current.push(w),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}else try{f.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const y=F.current.primitive,h={rawTime:N.rawTime,normalizedTime:N.time,price:N.price},T={rawTime:R.rawTime,normalizedTime:R.time,price:R.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(T.rawTime),_=f.priceToCoordinate(T.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=4){y.p1={rawTime:h.rawTime,price:h.price},y.p2={rawTime:T.rawTime,price:T.price},y.previewAsLine=!1,y.minorRatio=.45;const E={type:"ellipse",primitive:y,p1:h,p2:T,minorRatio:.45};Te(x=>[...x,E]),v.current.push(E),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}b.current=!1,C.current=null,U.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const L={capture:!0,passive:!1},N=R=>{b.current||R.stopPropagation()};return O.addEventListener("mousedown",j,L),O.addEventListener("mousemove",q,L),O.addEventListener("mousemove",N,L),O.addEventListener("mouseup",ue,L),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{f.detachPrimitive(F.current.primitive)}catch{}F.current=null,b.current=!1,C.current=null,U.current=null,O.removeEventListener("mousedown",j,L),O.removeEventListener("mousemove",q,L),O.removeEventListener("mousemove",N,L),O.removeEventListener("mouseup",ue,L)}}},[Ce,Ue,Te,be]),Y.useEffect(()=>{const p=c.current,f=u.current,O=o.current,me=Ce===null||Ce===1;if(!me||!p||!f||!O){me||(M(null),V([]),re(null),Z([]));return}const H=10,X=8;function j(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const T=p.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.priceToCoordinate(h.point2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="gannline"&&h.point1&&h.point2){const T=p.timeScale().timeToCoordinate(h.point1.time),I=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.priceToCoordinate(h.point2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:(T+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="rectangle"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);if(T==null||I==null||w==null||d==null)return[];const _=Math.min(T,w),Q=Math.max(T,w),E=Math.min(I,d),x=Math.max(I,d),m=(_+Q)/2,D=(E+x)/2;return[{x:_,y:E},{x:m,y:E},{x:Q,y:E},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:m,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return T==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);if(T==null||I==null||w==null||d==null)return[];const _=(T+w)/2,Q=(I+d)/2,E=w-T,x=d-I,m=Math.hypot(E,x);if(m<.001)return[];const D=E/m,P=x/m,k=-P,z=D,$=m/2,te=$*Math.max(.05,h.minorRatio??.45);return[{x:_-D*$,y:Q-P*$},{x:_+k*te,y:Q+z*te},{x:_+D*$,y:Q+P*$},{x:_-k*te,y:Q-z*te}]}if(h.type==="gannfan"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="rayline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="extendedline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="crossline"&&h.p){const T=p.timeScale().timeToCoordinate(h.p.rawTime),I=f.priceToCoordinate(h.p.price);return T==null||I==null?[]:[{x:T,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const T=f.priceToCoordinate(h.price);return T==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:T}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const T=p.timeScale().timeToCoordinate(h.rawTime),I=f.priceToCoordinate(h.price);return T==null||I==null?[]:[{x:T,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price);return T==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=f.priceToCoordinate(h.b1.price),E=p.timeScale().timeToCoordinate(h.b2.rawTime),x=f.priceToCoordinate(h.b2.price);return T==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:(_+E)/2,y:(Q+x)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),E=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return T==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q},{x:E,y:x}]}if(h.type==="flattopbottom"&&h.p1&&h.p2&&h.p3&&h.p4){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),E=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.priceToCoordinate(h.p4.price);return T==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:T,y:I},{x:w,y:d},{x:_,y:Q},{x:E,y:x}]}if(h.type==="infoline"&&h.p1&&h.p2){const T=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=p.timeScale().timeToCoordinate(T),d=f.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=f.priceToCoordinate(h.p2.price);return w==null||d==null||_==null||Q==null?[]:[{x:w,y:d},{x:_,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:(T+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const T=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price);return T==null||I==null||w==null||d==null?[]:[{x:T,y:I},{x:w,y:d}]}if(h.type==="horizontalray"&&h.primitive){const T=h.primitive,I=p.timeScale().timeToCoordinate(T.originTime),w=f.priceToCoordinate(T.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const T=h.primitive,I=p.timeScale().timeToCoordinate(T.time);if(I==null)return[];const w=T.midYCss??200;return[{x:I,y:w}]}return[]}function q(h,T){for(let I=Ke.length-1;I>=0;I--){const w=Ke[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),E=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),E=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,m=(_+E)/2,D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"line"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.min(d,Q),m=Math.max(d,Q),D=Math.min(_,E),P=Math.max(_,E),k=(x+m)/2,z=(D+P)/2,$=[{x,y:D,mode:"handle1"},{x:k,y:D,mode:"handle2"},{x:m,y:D,mode:"handle3"},{x,y:z,mode:"handle4"},{x:m,y:z,mode:"handle5"},{x,y:P,mode:"handle6"},{x:k,y:P,mode:"handle7"},{x:m,y:P,mode:"handle8"}];for(const Ee of $)if(Math.hypot(h-Ee.x,T-Ee.y)<H)return{object:w,mode:Ee.mode};const te=ut(h,T,x,D,m,D),he=ut(h,T,x,P,m,P),ge=ut(h,T,x,D,x,P),xe=ut(h,T,m,D,m,P);if(te<X||he<X||ge<X||xe<X||gi(h,T,[{x,y:D},{x:m,y:D},{x:m,y:P},{x,y:P}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(Q-d,E-_);if(x<2)continue;const m=Math.hypot(h-d,T-_),D=Math.hypot(h-Q,T-E);if(m<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(m-x)<X||m<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||E==null||x==null||m==null)continue;const D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"handle3"};const z=ut(h,T,d,_,Q,E),$=ut(h,T,Q,E,x,m),te=ut(h,T,x,m,d,_);if(z<X||$<X||te<X||gi(h,T,[{x:d,y:_},{x:Q,y:E},{x,y:m}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,m=(_+E)/2,D=Q-d,P=E-_,k=Math.hypot(D,P);if(k<2)continue;const z=D/k,$=P/k,te=-$,he=z,ge=k/2,xe=ge*Math.max(.05,w.minorRatio??.45);if(ge<2||xe<2)continue;const Ee=x-z*ge,Re=m-$*ge,je=x+te*xe,Ve=m+he*xe,Bt=x+z*ge,pt=m+$*ge,yt=x-te*xe,Dt=m-he*xe,qt=Math.hypot(h-Ee,T-Re),iA=Math.hypot(h-je,T-Ve),hA=Math.hypot(h-Bt,T-pt),JA=Math.hypot(h-yt,T-Dt);if(qt<H)return{object:w,mode:"handle1"};if(iA<H)return{object:w,mode:"handle2"};if(hA<H)return{object:w,mode:"handle3"};if(JA<H)return{object:w,mode:"handle4"};const Di=(h-x)*z+(T-m)*$,zs=(h-x)*te+(T-m)*he,Up=Di/ge,Sp=zs/xe,Ep=Up*Up+Sp*Sp;if(Math.abs(Ep-1)<.2||Ep<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-Q,T-E),m=Math.hypot(h-d,T-_);if(x<H)return{object:w,mode:"handle2"};if(m<H)return{object:w,mode:"handle1"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-Q,T-E),m=Math.hypot(h-d,T-_);if(x<H)return{object:w,mode:"handle2"};if(m<H)return{object:w,mode:"handle1"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(gT(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(wT(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),_=f.priceToCoordinate(w.p.price);if(d==null||_==null)continue;if(Math.hypot(h-d,T-_)<H)return{object:w,mode:"handle1"};const E=Math.abs(T-_),x=Math.abs(h-d);if(E<X||x<X)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),_=f.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=lp(w,d,_);if(h>=Q.left&&h<=Q.right&&T>=Q.top&&T<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),m=f.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=f.priceToCoordinate(w.b2.price),k=x!=null&&D!=null?(x+D)/2:null,z=m!=null&&P!=null?(m+P)/2:null;if(d==null||_==null||Q==null||E==null||k==null||z==null||x==null||m==null||D==null||P==null)continue;const $=Math.hypot(h-d,T-_),te=Math.hypot(h-Q,T-E),he=Math.hypot(h-k,T-z),ge=Math.hypot(d-k,_-z)<H*1.5;if(ge&&Math.min($,he)<H*1.5)return{object:w,mode:"handle3"};if(he<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle2"};if(ge)continue;if($<H)return{object:w,mode:"handle1"};const xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P);if(xe<X||Ee<X||gi(h,T,[{x:d,y:_},{x:Q,y:E},{x:D,y:P},{x,y:m}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),k=p.timeScale().timeToCoordinate(w.bot1.rawTime),z=f.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null||k==null||z==null||$==null||te==null)continue;const he=Math.hypot(h-d,T-_),ge=Math.hypot(h-Q,T-E);if(he<H)return{object:w,mode:"handle1"};if(ge<H)return{object:w,mode:"handle2"};const xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P),Re=ut(h,T,k,z,$,te);if(xe<X||Ee<X||Re<X||gi(h,T,[{x,y:m},{x:D,y:P},{x:$,y:te},{x:k,y:z}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),k=p.timeScale().timeToCoordinate(w.bot1.rawTime),z=f.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null||k==null||z==null||$==null||te==null)continue;const he=Math.hypot(h-d,T-_),ge=Math.hypot(h-Q,T-E);if(he<H)return{object:w,mode:"handle1"};if(ge<H)return{object:w,mode:"handle2"};const xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P),Re=ut(h,T,k,z,$,te);if(xe<X||Ee<X||Re<X||gi(h,T,[{x,y:m},{x:D,y:P},{x:$,y:te},{x:k,y:z}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||E==null||x==null||m==null)continue;const D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"handle3"};const z=(Q+x)/2,$=(E+m)/2;let te=z-d,he=$-_;Math.abs(te)<1e-4&&(te=1e-4);const ge=he/te,xe=O.clientWidth,Ee=E+ge*(xe-Q),Re=m+ge*(xe-x),je=ut(h,T,Q,E,xe,Ee),Ve=ut(h,T,x,m,xe,Re);if(je<X||Ve<X||gi(h,T,[{x:Q,y:E},{x:xe,y:Ee},{x:xe,y:Re},{x,y:m}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null)continue;const k=Math.hypot(h-d,T-_),z=Math.hypot(h-Q,T-E),$=Math.hypot(h-x,T-m),te=Math.hypot(h-D,T-P);if(k<H)return{object:w,mode:"handle1"};if(z<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const he=ut(h,T,d,_,x,m),ge=ut(h,T,Q,E,D,P),xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P);if(he<X||ge<X||xe<X||Ee<X||gi(h,T,[{x:d,y:_},{x,y:m},{x:D,y:P},{x:Q,y:E}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||E==null||x==null||m==null||D==null||P==null)continue;const k=Math.hypot(h-d,T-_),z=Math.hypot(h-Q,T-E),$=Math.hypot(h-x,T-m),te=Math.hypot(h-D,T-P);if(k<H)return{object:w,mode:"handle1"};if(z<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const he=ut(h,T,d,_,x,m),ge=ut(h,T,Q,E,D,P),xe=ut(h,T,d,_,Q,E),Ee=ut(h,T,x,m,D,P);if(he<X||ge<X||xe<X||Ee<X||gi(h,T,[{x:d,y:_},{x,y:m},{x:D,y:P},{x:Q,y:E}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,m=(_+E)/2,D=Math.hypot(h-d,T-_),P=Math.hypot(h-Q,T-E),k=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(k<H)return{object:w,mode:"line"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const d=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,Q=p.timeScale().timeToCoordinate(d),E=f.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),m=f.priceToCoordinate(w.p2.price);if(Q==null||E==null||x==null||m==null)continue;const D=Math.hypot(h-Q,T-E),P=Math.hypot(h-x,T-m);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ut(h,T,Q,E,x,m)<X)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,T-_),m=Math.hypot(h-Q,T-E);if(x<H)return{object:w,mode:"handle1"};if(m<H)return{object:w,mode:"handle2"};if(ut(h,T,d,_,Q,E)<X)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.originTime),Q=f.priceToCoordinate(d.price);if(Q==null)continue;if(_!=null&&Math.hypot(h-_,T-Q)<H)return{object:w,mode:"handle1"};const E=_==null?0:Math.max(0,_);if(h>=E&&Math.abs(T-Q)<X)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.time);if(_==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-_,T-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-_)<X)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const d=f.priceToCoordinate(w.price);if(d==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,T-d)<H)return{object:w,mode:"line"};if(Math.abs(T-d)<X)return{object:w,mode:"line"}}}return null}const ue=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top,d=q(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,ne(d.object),Ae.current=null,oe.current=null;return}M(d.object),re(null),Z([]),Ae.current=d.mode,d.object.type==="rayline"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="extendedline"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="crossline"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,p:{...d.object.p}}),d.object.type==="text"&&d.mode==="line"&&(oe.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}),d.object.type==="trendbyangle"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="equidistantchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="andrewspitchfork"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="regressionchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="stddevchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="disjointchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="flattopbottom"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="fibonacci"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="gannfan"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="ganngrid"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="rectangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4"||d.mode==="handle5"||d.mode==="handle6"||d.mode==="handle7"||d.mode==="handle8")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="circle"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="triangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="ellipse"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}),d.object.type==="horizontalray"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}),d.object.type==="verticalline"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,time:d.object.primitive.time}),d.mode==="line"&&(d.object.type==="rulerline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="infoline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="arrowedline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rayline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="extendedline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="crossline"?oe.current={x:I,y:w,p:{...d.object.p}}:d.object.type==="text"?oe.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}:d.object.type==="trendbyangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="equidistantchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="andrewspitchfork"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="regressionchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="stddevchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="disjointchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="flattopbottom"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="fibonacci"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="gannfan"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rectangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="circle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="triangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="ellipse"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}:d.object.type==="ganngrid"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="horizontalray"?oe.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}:d.object.type==="verticalline"?oe.current={x:I,y:w,time:d.object.primitive.time}:d.object.type==="pricelevel"?oe.current={y:w,price:d.object.price}:oe.current={x:I,y:w,point1:{...d.object.point1},point2:{...d.object.point2}})}else M(null),Ae.current=null,V([]),re(null),Z([])},L=h=>{const T=O.getBoundingClientRect(),I=h.clientX-T.left,w=h.clientY-T.top;if(!Ae.current){const x=q(I,w);if(x?.object&&!le.current){const m=j(x.object);re(D=>D===x.object?D:x.object),Z(D=>D.length===m.length&&D.every((P,k)=>P.x===m[k].x&&P.y===m[k].y)?D:m)}else re(m=>m==null?m:null),Z(m=>m.length===0?m:[]);return}const d=le.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=f.coordinateToPrice(w);if(_==null||Q==null)return;let E=ee(_);if(E!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=k=>{const z=k.rawTime??k.time,$=k.normalizedTime??ee(z);return{rawTime:z,normalizedTime:$,price:k.price}},m=(k,z)=>{const $=k.normalizedTime??ee(k.rawTime),te=z.normalizedTime??ee(z.rawTime);if($==null||te==null)return;const he=z.price-k.price,ge=he/Math.abs(k.price)*100,xe=uA(de)||3600,Ee=Math.abs(te-$),Re=Math.max(1,Math.round(Ee/xe)),je=Math.max(1,Math.round(Ee/86400)),Ve=p.timeScale().timeToCoordinate(k.rawTime),Bt=f.priceToCoordinate(k.price),pt=p.timeScale().timeToCoordinate(z.rawTime),yt=f.priceToCoordinate(z.price),Dt=Ve!=null&&Bt!=null&&pt!=null&&yt!=null?Math.atan2(-(yt-Bt),pt-Ve)*(180/Math.PI):d.primitive?.info?.angle??0,qt={priceDiff:he,pricePct:ge,bars:Re,days:je,angle:Dt},iA=d.primitive;if(iA){iA.p1={rawTime:k.rawTime,price:k.price},iA.p2={rawTime:z.rawTime,price:z.price},iA.info=qt;try{c.current?.applyOptions({})}catch{}}const hA={...d,rawP1Time:k.rawTime,rawP2Time:z.rawTime,p1:{rawTime:k.rawTime,normalizedTime:$,price:k.price},p2:{rawTime:z.rawTime,normalizedTime:te,price:z.price}};Te(JA=>{const Di=JA.map(zs=>zs===d?hA:zs);return v.current=Di,Di}),M(hA),le.current=hA,Ve!=null&&Bt!=null&&pt!=null&&yt!=null&&V([{x:Ve,y:Bt},{x:pt,y:yt}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(Ae.current==="handle1"){const k=p.timeScale().coordinateToTime(I)??_;m({rawTime:k,normalizedTime:E,price:Q},P)}else if(Ae.current==="handle2"){const k=p.timeScale().coordinateToTime(I)??_;m(D,{rawTime:k,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const k=oe.current;if(!k)return;const z=x(k.p1),$=x(k.p2);if(z.rawTime==null||z.normalizedTime==null||$.rawTime==null||$.normalizedTime==null)return;const te=p.timeScale().coordinateToTime(k.x)??z.rawTime,he=f.coordinateToPrice(k.y);if(te==null||he==null)return;const ge=ee(te)??z.normalizedTime;if(ge==null)return;const xe=E-ge,Ee=Q-he,Re=ee(z.normalizedTime+xe),je=ee($.normalizedTime+xe);if(Re==null||je==null)return;const Ve=_-te;m({rawTime:z.rawTime+Ve,normalizedTime:Re,price:z.price+Ee},{rawTime:$.rawTime+Ve,normalizedTime:je,price:$.price+Ee})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(m,D)=>{const P=m.normalizedTime??m.rawTime,k=D.normalizedTime??D.rawTime,z=D.price-m.price,$=z/Math.abs(m.price)*100,te=Ns(Ks,m.rawTime,D.rawTime,de),he=Math.abs(k-P),ge=Math.max(1,Math.round(he/86400)),xe={priceDiff:z,pricePct:$,bars:te,days:ge},Ee=d.primitive;if(Ee){Ee.p1={rawTime:m.rawTime,price:m.price},Ee.p2={rawTime:D.rawTime,price:D.price},Ee.info=xe;const yt=D.price>=m.price;Ee.color=yt?"#3b82f6":"#ef5350",Ee.fillColor=yt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const Re={...d,rawP1Time:m.rawTime,rawP2Time:D.rawTime,p1:m,p2:D};Te(yt=>{const Dt=yt.map(qt=>qt===d?Re:qt);return v.current=Dt,Dt}),M(Re),le.current=Re;const je=p.timeScale().timeToCoordinate(m.rawTime),Ve=f.priceToCoordinate(m.price),Bt=p.timeScale().timeToCoordinate(D.rawTime),pt=f.priceToCoordinate(D.price);je!=null&&Ve!=null&&Bt!=null&&pt!=null&&V([{x:je,y:Ve},{x:(je+Bt)/2,y:(Ve+pt)/2},{x:Bt,y:pt}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;const D=ee(m);if(D==null)return;x(d.p1,{rawTime:m,normalizedTime:D,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="crossline"&&d.p){const x=D=>{const P=d.primitive;if(P){P.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p:D};Te(te=>{const he=te.map(ge=>ge===d?k:ge);return v.current=he,he}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(D.rawTime),$=f.priceToCoordinate(D.price);z!=null&&$!=null&&V([{x:z,y:$}])},m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=f.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const m=c.current?c.current.paneSize().width:400,D=f.priceToCoordinate(x);D!=null&&V([{x:m/2,y:D}]);const P={...d,price:x};Te(k=>{const z=k.map($=>$===d?P:$);return v.current=z,z}),M(P),le.current=P;return}if(d.type==="text"){const x=p.timeScale().coordinateToTime(I);if(x==null)return;const m=d.primitive;if(m){m.rawTime=x,m.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(ge=>{const xe=ge.map(Ee=>Ee===d?k:Ee);return v.current=xe,xe}),M(k),le.current=k;const z=p.timeScale().timeToCoordinate(m.rawTime),$=f.priceToCoordinate(m.price),te=p.timeScale().timeToCoordinate(D.rawTime),he=f.priceToCoordinate(D.price);z!=null&&$!=null&&te!=null&&he!=null&&V([{x:z,y:$},{x:te,y:he}])};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"||Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(m,D,P)=>{const k=hp(m,D,P);if(!k)return;const z=d.primitive;if(z){z.p1={rawTime:m.rawTime,price:m.price},z.p2={rawTime:D.rawTime,price:D.price},z.b1={rawTime:k.b1.rawTime,price:k.b1.price},z.b2={rawTime:k.b2.rawTime,price:k.b2.price},z.p3={rawTime:k.bottomMid.rawTime,price:k.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const $={...d,p1:m,p2:D,p3:k.bottomMid,b1:k.b1,b2:k.b2,bottomMid:k.bottomMid};Te(te=>{const he=te.map(ge=>ge===d?$:ge);return v.current=he,he}),M($),le.current=$};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2,d.p3);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q},d.p3);return}if(Ae.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??ee(d.p3.rawTime),price:Q});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k),he=ee(m.p3.normalizedTime+k);if($==null||te==null||he==null)return;const ge=_-D;x({rawTime:m.p1.rawTime+ge,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+ge,normalizedTime:te,price:m.p2.price+z},{rawTime:m.p3.rawTime+ge,normalizedTime:he,price:m.p3.price+z});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(m,D)=>{const P=ir(Ue,m,D,d.stdMultiplier??1);if(!P)return;const k=d.primitive;if(k){k.mid1={rawTime:P.p1.rawTime,price:P.p1.price},k.mid2={rawTime:P.p2.rawTime,price:P.p2.price},k.top1={rawTime:P.top1.rawTime,price:P.top1.price},k.top2={rawTime:P.top2.rawTime,price:P.top2.price},k.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},k.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const z={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,intercept:P.intercept,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};Te($=>{const te=$.map(he=>he===d?z:he);return v.current=te,te}),M(z),le.current=z};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E},d.p2);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(m,D)=>{const P=Xr(Ue,m,D,d.stdMultiplier??1);if(!P)return;const k=d.primitive;if(k){k.mid1={rawTime:P.p1.rawTime,price:P.p1.price},k.mid2={rawTime:P.p2.rawTime,price:P.p2.price},k.top1={rawTime:P.top1.rawTime,price:P.top1.price},k.top2={rawTime:P.top2.rawTime,price:P.top2.price},k.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},k.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const z={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};Te($=>{const te=$.map(he=>he===d?z:he);return v.current=te,te}),M(z),le.current=z};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E},d.p2);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(m,D,P)=>{const k=d.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:D.rawTime,price:D.price},k.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const z={...d,p1:m,p2:D,p3:P};Te($=>{const te=$.map(he=>he===d?z:he);return v.current=te,te}),M(z),le.current=z};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2,d.p3);return}if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q},d.p3);return}if(Ae.current==="handle3"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,d.p2,{rawTime:m,normalizedTime:E,price:Q});return}if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k),he=ee(m.p3.normalizedTime+k);if($==null||te==null||he==null)return;const ge=_-D;x({rawTime:m.p1.rawTime+ge,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+ge,normalizedTime:te,price:m.p2.price+z},{rawTime:m.p3.rawTime+ge,normalizedTime:he,price:m.p3.price+z});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(z,$,te,he)=>{const ge=d.primitive;if(ge){ge.p1={rawTime:z.rawTime,price:z.price},ge.p2={rawTime:$.rawTime,price:$.price},ge.p3={rawTime:te.rawTime,price:te.price},ge.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:z,p2:$,p3:te,p4:he};Te(Ee=>{const Re=Ee.map(je=>je===d?xe:je);return v.current=Re,Re}),M(xe),le.current=xe},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;const k=(z,$,te,he)=>{const ge=z.normalizedTime??ee(z.rawTime);if(ge==null)return null;const xe=ee(ge+te);return xe==null?null:{rawTime:z.rawTime+$,normalizedTime:xe,price:z.price+he}};if(Ae.current==="line"){const z=p.timeScale().coordinateToTime(m.x),$=f.coordinateToPrice(m.y);if(z==null||$==null)return;const te=ee(z);if(te==null)return;const he=D-z,ge=P-te,xe=Q-$,Ee=k(m.p1,he,ge,xe),Re=k(m.p2,he,ge,xe),je=k(m.p3,he,ge,xe),Ve=k(m.p4,he,ge,xe);if(!Ee||!Re||!je||!Ve)return;x(Ee,Re,je,Ve);return}if(Ae.current==="handle1"){const z=(m.p1.price+m.p2.price)/2,$={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*z-Q};x($,te,m.p3,m.p4);return}if(Ae.current==="handle3"){const z=(m.p3.price+m.p4.price)/2,$={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*z-Q};x(m.p1,m.p2,$,te);return}if(Ae.current==="handle2"){const z=(m.p1.price+m.p2.price)/2,$={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:Q};if($.normalizedTime==null)return;const te={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:2*z-Q};if(te.normalizedTime==null)return;x(te,$,m.p3,m.p4);return}if(Ae.current==="handle4"){const z=Q-m.p4.price,$={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??ee(m.p3.rawTime),price:m.p4.price+z};if($.normalizedTime==null)return;const te={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:m.p2.price+z};if(te.normalizedTime==null)return;x(m.p1,te,m.p3,$);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(z,$,te,he)=>{const ge=d.primitive;if(ge){ge.p1={rawTime:z.rawTime,price:z.price},ge.p2={rawTime:$.rawTime,price:$.price},ge.p3={rawTime:te.rawTime,price:te.price},ge.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:z,p2:$,p3:te,p4:he};Te(Ee=>{const Re=Ee.map(je=>je===d?xe:je);return v.current=Re,Re}),M(xe),le.current=xe},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;const k=(z,$,te,he)=>{const ge=z.normalizedTime??ee(z.rawTime);if(ge==null)return null;const xe=ee(ge+te);return xe==null?null:{rawTime:z.rawTime+$,normalizedTime:xe,price:z.price+he}};if(Ae.current==="line"){const z=p.timeScale().coordinateToTime(m.x),$=f.coordinateToPrice(m.y);if(z==null||$==null)return;const te=ee(z);if(te==null)return;const he=D-z,ge=P-te,xe=Q-$,Ee=k(m.p1,he,ge,xe),Re=k(m.p2,he,ge,xe),je=k(m.p3,he,ge,xe),Ve=k(m.p4,he,ge,xe);if(!Ee||!Re||!je||!Ve)return;x(Ee,Re,je,Ve);return}if(Ae.current==="handle1"){const z={rawTime:D,normalizedTime:P,price:Q},$={rawTime:D,normalizedTime:P,price:m.p2.price};x(z,$,m.p3,m.p4);return}if(Ae.current==="handle3"){const z={rawTime:D,normalizedTime:P,price:Q},$={rawTime:D,normalizedTime:P,price:m.p4.price};x(m.p1,m.p2,z,$);return}if(Ae.current==="handle2"||Ae.current==="handle4"){const z=Ae.current==="handle2"?m.p2:m.p4,$=Q-z.price,te={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ee(m.p1.rawTime),price:m.p2.price+$},he={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??ee(m.p3.rawTime),price:m.p4.price+$};if(te.normalizedTime==null||he.normalizedTime==null)return;x(m.p1,te,m.p3,he);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(pt,yt)=>{const Dt=d.primitive;if(Dt){Dt.p1={rawTime:pt.rawTime,price:pt.price},Dt.p2={rawTime:yt.rawTime,price:yt.price};try{c.current?.applyOptions({})}catch{}}const qt={...d,p1:pt,p2:yt};Te(iA=>{const hA=iA.map(JA=>JA===d?qt:JA);return v.current=hA,hA}),M(qt),le.current=qt},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;if(Ae.current==="line"){const pt=p.timeScale().coordinateToTime(m.x),yt=f.coordinateToPrice(m.y);if(pt==null||yt==null)return;const Dt=ee(pt);if(Dt==null)return;const qt=P-Dt,iA=Q-yt,hA=ee(m.p1.normalizedTime+qt),JA=ee(m.p2.normalizedTime+qt);if(hA==null||JA==null)return;const Di=_-pt;x({rawTime:m.p1.rawTime+Di,normalizedTime:hA,price:m.p1.price+iA},{rawTime:m.p2.rawTime+Di,normalizedTime:JA,price:m.p2.price+iA});return}const k=Math.min(m.p1.normalizedTime,m.p2.normalizedTime),z=Math.max(m.p1.normalizedTime,m.p2.normalizedTime),$=Math.max(m.p1.price,m.p2.price),te=Math.min(m.p1.price,m.p2.price),he=m.p1.normalizedTime<=m.p2.normalizedTime?m.p1.rawTime:m.p2.rawTime,ge=m.p1.normalizedTime<=m.p2.normalizedTime?m.p2.rawTime:m.p1.rawTime;let xe=k,Ee=z,Re=$,je=te,Ve=he,Bt=ge;if((Ae.current==="handle1"||Ae.current==="handle4"||Ae.current==="handle6")&&(xe=P,Ve=D),(Ae.current==="handle3"||Ae.current==="handle5"||Ae.current==="handle8")&&(Ee=P,Bt=D),(Ae.current==="handle1"||Ae.current==="handle2"||Ae.current==="handle3")&&(Re=Q),(Ae.current==="handle6"||Ae.current==="handle7"||Ae.current==="handle8")&&(je=Q),xe>Ee){const pt=xe,yt=Ve;xe=Ee,Ve=Bt,Ee=pt,Bt=yt}if(Re<je){const pt=Re;Re=je,je=pt}x({rawTime:Ve,normalizedTime:xe,price:Re},{rawTime:Bt,normalizedTime:Ee,price:je});return}if(d.type==="circle"&&d.p1&&d.p2){const x=(Re,je)=>{const Ve=d.primitive;if(Ve){Ve.p1={rawTime:Re.rawTime,price:Re.price},Ve.p2={rawTime:je.rawTime,price:je.price};try{c.current?.applyOptions({})}catch{}}const Bt={...d,p1:Re,p2:je};Te(pt=>{const yt=pt.map(Dt=>Dt===d?Bt:Dt);return v.current=yt,yt}),M(Bt),le.current=Bt},m=p.timeScale().coordinateToTime(I);if(m==null)return;const D=ee(m);if(D==null)return;if(Ae.current==="handle2"){x(d.p1,{rawTime:m,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const k=p.timeScale().coordinateToTime(P.x),z=f.coordinateToPrice(P.y);if(k==null||z==null)return;const $=ee(k);if($==null)return;const te=D-$,he=Q-z,ge=ee(P.p1.normalizedTime+te),xe=ee(P.p2.normalizedTime+te);if(ge==null||xe==null)return;const Ee=_-k;x({rawTime:P.p1.rawTime+Ee,normalizedTime:ge,price:P.p1.price+he},{rawTime:P.p2.rawTime+Ee,normalizedTime:xe,price:P.p2.price+he});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(Ve,Bt,pt)=>{const yt=d.primitive;if(yt){yt.p1={rawTime:Ve.rawTime,price:Ve.price},yt.p2={rawTime:Bt.rawTime,price:Bt.price},yt.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const Dt={...d,p1:Ve,p2:Bt,p3:pt};Te(qt=>{const iA=qt.map(hA=>hA===d?Dt:hA);return v.current=iA,iA}),M(Dt),le.current=Dt},m=p.timeScale().coordinateToTime(I);if(m==null)return;const D=ee(m);if(D==null)return;if(Ae.current==="handle1"){x({rawTime:m,normalizedTime:D,price:Q},d.p2,d.p3);return}if(Ae.current==="handle2"){x(d.p1,{rawTime:m,normalizedTime:D,price:Q},d.p3);return}if(Ae.current==="handle3"){x(d.p1,d.p2,{rawTime:m,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const k=p.timeScale().coordinateToTime(P.x),z=f.coordinateToPrice(P.y);if(k==null||z==null)return;const $=ee(k);if($==null)return;const te=D-$,he=Q-z,ge=_-k,xe=Ve=>{const Bt=Ve.normalizedTime??ee(Ve.rawTime);if(Bt==null)return null;const pt=ee(Bt+te);return pt==null?null:{rawTime:Ve.rawTime+ge,normalizedTime:pt,price:Ve.price+he}},Ee=xe(P.p1),Re=xe(P.p2),je=xe(P.p3);if(!Ee||!Re||!je)return;x(Ee,Re,je);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(k,z,$=d.minorRatio??.45)=>{const te=d.primitive;if(te){te.p1={rawTime:k.rawTime,price:k.price},te.p2={rawTime:z.rawTime,price:z.price},te.minorRatio=Math.max(.05,$);try{c.current?.applyOptions({})}catch{}}const he={...d,p1:k,p2:z,minorRatio:Math.max(.05,$)};Te(ge=>{const xe=ge.map(Ee=>Ee===d?he:Ee);return v.current=xe,xe}),M(he),le.current=he},m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=ee(D);if(P==null)return;if(Ae.current==="line"){const k=p.timeScale().coordinateToTime(m.x),z=f.coordinateToPrice(m.y);if(k==null||z==null)return;const $=ee(k);if($==null)return;const te=P-$,he=Q-z,ge=ee(m.p1.normalizedTime+te),xe=ee(m.p2.normalizedTime+te);if(ge==null||xe==null)return;const Ee=_-k;x({rawTime:m.p1.rawTime+Ee,normalizedTime:ge,price:m.p1.price+he},{rawTime:m.p2.rawTime+Ee,normalizedTime:xe,price:m.p2.price+he},m.minorRatio??d.minorRatio??.45);return}if(Ae.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(Ae.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(Ae.current==="handle2"||Ae.current==="handle4"){const k=p.timeScale().timeToCoordinate(d.p1.rawTime),z=f.priceToCoordinate(d.p1.price),$=p.timeScale().timeToCoordinate(d.p2.rawTime),te=f.priceToCoordinate(d.p2.price);if(k==null||z==null||$==null||te==null)return;const he=(k+$)/2,ge=(z+te)/2,xe=$-k,Ee=te-z,Re=Math.hypot(xe,Ee);if(Re<.001)return;const je=-Ee/Re,Ve=xe/Re,Bt=Math.abs((I-he)*je+(w-ge)*Ve),pt=Math.max(.05,Bt*2/Re);x(d.p1,d.p2,pt);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(m,D)=>{const P=d.primitive;if(P){P.p1={rawTime:m.rawTime,price:m.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const k={...d,p1:m,p2:D};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k};if(Ae.current==="handle1"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x({rawTime:m,normalizedTime:E,price:Q},d.p2)}else if(Ae.current==="handle2"){const m=p.timeScale().coordinateToTime(I);if(m==null)return;x(d.p1,{rawTime:m,normalizedTime:E,price:Q})}else if(Ae.current==="line"){const m=oe.current;if(!m)return;const D=p.timeScale().coordinateToTime(m.x),P=f.coordinateToPrice(m.y);if(D==null||P==null)return;const k=E-ee(D),z=Q-P,$=ee(m.p1.normalizedTime+k),te=ee(m.p2.normalizedTime+k);if($==null||te==null)return;const he=_-D;x({rawTime:m.p1.rawTime+he,normalizedTime:$,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:te,price:m.p2.price+z})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const m={...d,time:ee(_),rawTime:_};Te(P=>{const k=P.map(z=>z===d?m:z);return v.current=k,k}),M(m),le.current=m;const D=p.timeScale().timeToCoordinate(_);D!=null&&V([{x:D,y:x.midYCss??200}]),c.current?.applyOptions({});return}if(d.type==="horizontalray"&&d.primitive){const x=d.primitive,m=oe.current;if(!m)return;if(Ae.current==="handle1"){if(x.price=Q,x.originTime=_,d.priceLine)try{d.priceLine.applyOptions({price:Q,title:d.showPrice!==!1?Q.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=Q,d.textPrimitive.originTime=_);const D={...d,price:x.price,originTime:x.originTime,rawOriginTime:_};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D,c.current?.applyOptions({})}else if(Ae.current==="line"){const D=f.coordinateToPrice(m.y);if(D==null)return;const P=Q-D;if(x.price=m.price+P,d.priceLine)try{d.priceLine.applyOptions({price:x.price,title:d.showPrice!==!1?x.price.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=x.price);const k={...d,price:x.price};Te(z=>{const $=z.map(te=>te===d?k:te);return v.current=$,$}),M(k),le.current=k,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(Ae.current==="handle1"){const x={time:E,price:Q},m=zA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);m.length>0&&d.series.setData(m),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D}else if(Ae.current==="handle2"){const x={time:E,price:Q},m=zA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);m.length>0&&d.series.setData(m),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};Te(P=>{const k=P.map(z=>z===d?D:z);return v.current=k,k}),M(D),le.current=D}else if(Ae.current==="line"){const x=oe.current;if(!x)return;const m=p.timeScale().coordinateToTime(x.x),D=f.coordinateToPrice(x.y);if(m==null||D==null)return;const P=E-m,k=Q-D,z={time:ee(x.point1.time+P),price:x.point1.price+k},$={time:ee(x.point2.time+P),price:x.point2.price+k},te=zA([{time:z.time,value:z.price},{time:$.time,value:$.price}]);te.length>0&&d.series.setData(te),d.decoration&&(d.decoration.p1=z,d.decoration.p2=$);const he={...d,point1:z,point2:$};Te(ge=>{const xe=ge.map(Ee=>Ee===d?he:Ee);return v.current=xe,xe}),M(he),le.current=he}}}},N=()=>{Ae.current=null,oe.current=null},R=()=>{Ae.current||le.current||(re(null),Z([]))},y={capture:!0,passive:!1};return O.addEventListener("mousedown",ue,y),O.addEventListener("mousemove",L,y),O.addEventListener("mouseup",N,y),O.addEventListener("mouseleave",R,y),()=>{O.removeEventListener("mousedown",ue,y),O.removeEventListener("mousemove",L,y),O.removeEventListener("mouseup",N,y),O.removeEventListener("mouseleave",R,y)}},[Ce,Ue,Ke,Te]),Y.useEffect(()=>{const p=c.current,f=u.current;if(!p||!f)return;const O=()=>{const H=G;if(!H){V([]);return}const X=p.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const j=H.p1.rawTime??H.p1.time,q=H.p2.rawTime??H.p2.time,ue=X.timeToCoordinate(j),L=f.priceToCoordinate(H.p1.price),N=X.timeToCoordinate(q),R=f.priceToCoordinate(H.p2.price);ue!=null&&L!=null&&N!=null&&R!=null?V([{x:ue,y:L},{x:N,y:R}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:(j+ue)/2,y:(q+L)/2},{x:ue,y:L}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="crossline"&&H.p){const j=X.timeToCoordinate(H.p.rawTime),q=f.priceToCoordinate(H.p.price);j!=null&&q!=null?V([{x:j,y:q}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const j=X.timeToCoordinate(H.rawTime),q=f.priceToCoordinate(H.price);j!=null&&q!=null?V([{x:j,y:q}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.b1.rawTime),R=f.priceToCoordinate(H.b1.price),y=X.timeToCoordinate(H.b2.rawTime),h=f.priceToCoordinate(H.b2.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null&&y!=null&&h!=null?V([{x:j,y:q},{x:ue,y:L},{x:(N+y)/2,y:(R+h)/2}]):V([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R}]):V([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price),y=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null&&y!=null&&h!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R},{x:y,y:h}]):V([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price),y=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null&&y!=null&&h!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R},{x:y,y:h}]):V([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const j=X.timeToCoordinate(H.point1.time),q=f.priceToCoordinate(H.point1.price),ue=X.timeToCoordinate(H.point2.time),L=f.priceToCoordinate(H.point2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const j=X.timeToCoordinate(H.point1.time),q=f.priceToCoordinate(H.point1.price),ue=X.timeToCoordinate(H.point2.time),L=f.priceToCoordinate(H.point2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:(j+ue)/2,y:(q+L)/2},{x:ue,y:L}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);if(j!=null&&q!=null&&ue!=null&&L!=null){const N=Math.min(j,ue),R=Math.max(j,ue),y=Math.min(q,L),h=Math.max(q,L),T=(N+R)/2,I=(y+h)/2;V([{x:N,y},{x:T,y},{x:R,y},{x:N,y:I},{x:R,y:I},{x:N,y:h},{x:T,y:h},{x:R,y:h}])}else V([]);return}if(H.type==="circle"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price),N=X.timeToCoordinate(H.p3.rawTime),R=f.priceToCoordinate(H.p3.price);j!=null&&q!=null&&ue!=null&&L!=null&&N!=null&&R!=null?V([{x:j,y:q},{x:ue,y:L},{x:N,y:R}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);if(j!=null&&q!=null&&ue!=null&&L!=null){const N=(j+ue)/2,R=(q+L)/2,y=ue-j,h=L-q,T=Math.hypot(y,h);if(T<.001){V([]);return}const I=y/T,w=h/T,d=-w,_=I,Q=T/2,E=Q*Math.max(.05,H.minorRatio??.45);V([{x:N-I*Q,y:R-w*Q},{x:N+d*E,y:R+_*E},{x:N+I*Q,y:R+w*Q},{x:N-d*E,y:R-_*E}])}else V([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const j=X.timeToCoordinate(H.p1.rawTime),q=f.priceToCoordinate(H.p1.price),ue=X.timeToCoordinate(H.p2.rawTime),L=f.priceToCoordinate(H.p2.price);j!=null&&q!=null&&ue!=null&&L!=null?V([{x:j,y:q},{x:ue,y:L}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const j=H.primitive,q=X.timeToCoordinate(j.originTime),ue=f.priceToCoordinate(j.price);q!=null&&ue!=null?V([{x:q,y:ue}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const j=H.primitive,q=X.timeToCoordinate(j.time);if(q!=null){const ue=j.midYCss??200;V([{x:q,y:ue}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const j=u.current?.priceToCoordinate(H.price);if(j!=null){const q=c.current?c.current.paneSize().width:400;V([{x:q/2,y:j}])}else V([]);return}V([])};O();const me=p.timeScale();return me.subscribeVisibleTimeRangeChange(O),()=>{me.unsubscribeVisibleTimeRangeChange(O)}},[G]),Y.useEffect(()=>{let p=!1;v.current.forEach(f=>{if(f.type==="verticalline"&&f.primitive){const O=f===G||f===ie;f.primitive.showDot!==O&&(f.primitive.showDot=O,p=!0)}}),p&&c.current?.applyOptions({})},[G,ie]),Y.useEffect(()=>{let p=!1;v.current.forEach(f=>{if((f.type==="infoline"||f.type==="rulerline"||f.type==="arrowedline"||f.type==="rayline"||f.type==="extendedline"||f.type==="trendbyangle")&&f.primitive){const O=f===G||f===ie;f.primitive.isActive!==O&&(f.primitive.isActive=O,p=!0)}}),p&&c.current?.applyOptions({})},[G,ie]),Y.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:Pe}),p.priceLine){const f=Pe&&p.showPrice!==!1;p.priceLine.applyOptions(Pe?{color:p.lineColor??"#3b82f6",axisLabelVisible:f,title:f&&typeof p.price=="number"?p.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(p.type==="fibonacci"&&p.primitive){p.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:Pe}),p.parallelLine&&p.parallelLine.applyOptions({visible:Pe}),p.firstLine&&p.firstLine.applyOptions({visible:Pe}),p.secondLine&&p.secondLine.applyOptions({visible:Pe})),(p.type==="horizontalray"||p.type==="verticalline"||p.type==="infoline"||p.type==="rulerline"||p.type==="arrowedline"||p.type==="rayline"||p.type==="extendedline"||p.type==="crossline"||p.type==="trendbyangle"||p.type==="equidistantchannel"||p.type==="regressionchannel"||p.type==="stddevchannel"||p.type==="gannfan"||p.type==="ganngrid"||p.type==="andrewspitchfork"||p.type==="disjointchannel"||p.type==="flattopbottom"||p.type==="circle"||p.type==="triangle"||p.type==="ellipse"||p.type==="text")&&p.primitive){p.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}})},[Pe,Ke]),Y.useEffect(()=>{!Pe&&G&&(M(null),V([]))},[Pe,G]),Y.useEffect(()=>{if(v.current.length>Ke.length){const p=v.current.filter((f,O)=>!Ke.includes(f));G&&p.some(f=>f===G)&&(M(null),V([])),p.forEach(f=>{if(f.series&&c.current?.removeSeries(f.series),f.priceLine&&u.current?.removePriceLine(f.priceLine),f.textPrimitive)try{u.current?.detachPrimitive(f.textPrimitive)}catch{}if(f.type==="horizontalray"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="verticalline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="infoline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rulerline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="arrowedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rayline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="extendedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="crossline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="trendbyangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="equidistantchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="regressionchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="stddevchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="gannfan"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ganngrid"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="andrewspitchfork"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="disjointchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="flattopbottom"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="fibonacci"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rectangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="circle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="triangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ellipse"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="text"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="parallellines")try{f.baseLine&&c.current?.removeSeries(f.baseLine),f.parallelLine&&c.current?.removeSeries(f.parallelLine),f.firstLine&&c.current?.removeSeries(f.firstLine),f.secondLine&&c.current?.removeSeries(f.secondLine)}catch{}}),v.current=Ke}},[Ke,G]),Y.useEffect(()=>{const p=u.current;return p?(He.current.forEach(O=>{try{p.removePriceLine(O)}catch{}}),He.current=[],_e.filter(O=>O.symbol===ye).forEach(O=>{const me=parseFloat(O.openPrice??O.price),X=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(fA&&!isNaN(me)&&He.current.push(p.createPriceLine({price:me,color:X,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),at){const j=parseFloat(O.stopLoss),q=parseFloat(O.takeProfit);!isNaN(j)&&j>0&&He.current.push(p.createPriceLine({price:j,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(q)&&q>0&&He.current.push(p.createPriceLine({price:q,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{He.current.forEach(O=>{try{p.removePriceLine(O)}catch{}}),He.current=[]}):void 0},[_e,ye,fA,at]),Y.useEffect(()=>{const p=u.current;if(!p||!At)return;const f=parseFloat($A?.ask);if(isNaN(f)||f<=0)return;let O;try{O=p.createPriceLine({price:f,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{p.removePriceLine(O)}catch{}}},[At,$A]),Y.useEffect(()=>{const p=o.current;if(!p)return;const f=O=>{if(se.current){se.current=!1;return}if(b.current||!c.current)return;const me=c.current,H=u.current;if(me&&H&&v.current.length>0){const X=p.getBoundingClientRect(),j=O.clientX-X.left,q=O.clientY-X.top,ue=15;for(let L=v.current.length-1;L>=0;L--){const N=v.current[L];let R=!1;if(N.type==="text"&&N.rawTime!=null&&N.price!=null){const y=me.timeScale().timeToCoordinate(N.rawTime),h=H.priceToCoordinate(N.price);if(y!=null&&h!=null){const T=lp(N,y,h);j>=T.left&&j<=T.right&&q>=T.top&&q<=T.bottom&&(R=!0)}}else if(N.point1&&N.point2){const y=me.timeScale().timeToCoordinate(N.point1.time??N.point1.rawTime),h=H.priceToCoordinate(N.point1.price),T=me.timeScale().timeToCoordinate(N.point2.time??N.point2.rawTime),I=H.priceToCoordinate(N.point2.price);if(y!=null&&h!=null&&T!=null&&I!=null){const w=Math.hypot(j-y,q-h),d=Math.hypot(j-T,q-I),_=(y+T)/2,Q=(h+I)/2,E=Math.hypot(j-_,q-Q);(w<ue||d<ue||E<ue)&&(R=!0)}}else if(N.p1&&N.p2){const y=me.timeScale().timeToCoordinate(N.p1.rawTime),h=H.priceToCoordinate(N.p1.price),T=me.timeScale().timeToCoordinate(N.p2.rawTime),I=H.priceToCoordinate(N.p2.price);if(y!=null&&h!=null&&T!=null&&I!=null){const w=Math.min(y,T),d=Math.max(y,T),_=Math.min(h,I),Q=Math.max(h,I);j>=w-5&&j<=d+5&&q>=_-5&&q<=Q+5&&(R=!0)}}else if(N.p){const y=me.timeScale().timeToCoordinate(N.p.rawTime),h=H.priceToCoordinate(N.p.price);y!=null&&h!=null&&Math.hypot(j-y,q-h)<ue&&(R=!0)}else if(N.type==="pricelevel"&&N.price!=null){const y=H.priceToCoordinate(N.price);y!=null&&Math.abs(q-y)<ue&&(R=!0)}if(R){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),ne(N);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;pp(c.current,Ue,de)||c.current.timeScale().fitContent();const j=c.current.timeScale().getVisibleRange();ve(j)},80)};return p.addEventListener("dblclick",f,!0),()=>{p.removeEventListener("dblclick",f,!0)}},[Ue,de]);const Qp=G??ie,Fp=G?J:ce,tb=Pe&&CT(Qp,Fp),Ab=vT(Qp?.type);Y.useEffect(()=>{const p=o.current,f=l.current;if(!p||!f)return;const O=80,me=X=>{const j=p.getBoundingClientRect();f.style.opacity=j.bottom-X.clientY<=O?"1":"0"},H=()=>{f.style.opacity="0"};return p.addEventListener("mousemove",me),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",me),p.removeEventListener("mouseleave",H)}},[]);const ib=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*.8;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},[ve]),rb=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const O=f.to-f.from,me=(f.from+f.to)/2,H=O*1.25;try{p.setVisibleRange({from:me-H/2,to:me+H/2}),ve(p.getVisibleRange())}catch{}},[ve]),nb=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const O=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from-O,to:f.to-O})}catch{}},[]),sb=Y.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const O=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from+O,to:f.to+O})}catch{}},[]),ob=Y.useCallback(()=>{if(!c.current)return;pp(c.current,Ue,de)||c.current.timeScale().fitContent();const f=c.current.timeScale().getVisibleRange();ve(f)},[Ue,de,ve]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${rt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:Ce===1||Ce!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Ne&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof ye=="object"?ye?.symbol:ye,"..."]})]})}),!Ne&&lt&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:rt==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:rt==="light"?"#64748b":"#94a3b8"},children:lt})]})}),!Ne&&!lt&&Ue.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:rt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),GA&&Ue.length>0&&(()=>{const p=Ue[Ue.length-1],f=O=>{const me=Number(O);return Number.isFinite(me)?me>=100?me.toFixed(2):me.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:rt==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:rt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:f(p?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:f(p?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:rt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.close)})]})]})})(),(A||Ct)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Gh,{bidPrice:e,askPrice:t,onBuyClick:ZT,onSellClick:YT})}),a.jsx($h,{isOpen:tt,onClose:qT,orderType:Me,bidPrice:e,askPrice:t}),a.jsx(qh,{isOpen:W!==null,onClose:()=>ne(null),chartObject:W,onUpdate:jT}),Ne&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),tb&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:Fp.map((p,f)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:p.x-5,top:p.y-5,backgroundColor:Ab}},f))}),a.jsx("div",{ref:l,style:{position:"absolute",bottom:"50px",left:"50%",transform:"translateX(-50%)",zIndex:30,display:"flex",alignItems:"center",gap:"4px",opacity:0,pointerEvents:"all",transition:"opacity 200ms"},children:[{title:"Zoom out",onClick:rb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})})},{title:"Zoom in",onClick:ib,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[a.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})},{title:"Scroll left",onClick:nb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"8,3 4,7 8,11"})})},{title:"Scroll right",onClick:sb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:ob,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:p,onClick:f,icon:O})=>a.jsx("button",{title:p,onClick:f,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:rt==="light"?"#374151":"#94a3b8",border:"1px solid "+(rt==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",me.currentTarget.style.color=rt==="light"?"#111827":"#e2e8f0"},onMouseLeave:me=>{me.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",me.currentTarget.style.color=rt==="light"?"#374151":"#94a3b8"},children:O},p))})]})})}),Ft={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function wp({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=zt(),[s,o]=Y.useState(!1),[l,c]=Y.useState(""),[u,g]=Y.useState(-1),B=Y.useRef(null),v=Y.useRef(null);Y.useEffect(()=>{const S=K=>{B.current&&!B.current.contains(K.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),Y.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const b=r.filter(S=>S.symbol.toLowerCase().includes(l.toLowerCase())),C=b.filter(S=>!S.symbol.endsWith("USDT")),U=b.filter(S=>S.symbol.endsWith("USDT")),F=S=>{A(S),o(!1),c("")};return r.find(S=>S.symbol===t),a.jsxs("div",{ref:B,style:{...Ft.container,...i},className:e,children:[a.jsxs("button",{style:Ft.button,onClick:()=>o(!s),onMouseEnter:S=>Object.assign(S.currentTarget.style,Ft.buttonHover),onMouseLeave:S=>{S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Ft.arrow,...s?Ft.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Ft.dropdown,children:[a.jsx("div",{style:Ft.searchContainer,children:a.jsx("input",{ref:v,style:Ft.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:S=>c(S.target.value)})}),a.jsx("div",{style:Ft.list,children:b.length===0?a.jsx("div",{style:Ft.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Forex & Metals"}),C.map(S=>a.jsxs("div",{style:{...Ft.item,...S.symbol===t?Ft.itemSelected:{}},onClick:()=>F(S.symbol),onMouseEnter:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="#334155")},onMouseLeave:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:S.symbol}),S.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(S.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(S.bid).toFixed(5)})]},S.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Crypto"}),U.map(S=>a.jsxs("div",{style:{...Ft.item,...S.symbol===t?Ft.itemSelected:{}},onClick:()=>F(S.symbol),onMouseEnter:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="#334155")},onMouseLeave:K=>{S.symbol!==t&&(K.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:S.symbol}),S.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(S.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(S.bid).toFixed(2)})]},S.symbol))]})]})})]})]})}const WA={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},UT=[.01,.05,.1,.5,1];function Bp({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=UT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[g,B]=Y.useState(.1),v=i!==void 0?i:g,b=Y.useCallback(S=>{const K=Math.max(t,Math.min(A,parseFloat(S)||t)),G=Math.round(K/r)*r,M=parseFloat(G.toFixed(8));i!==void 0||B(M),e?.(M)},[t,A,r,i,e]),C=()=>b(v+r),U=()=>b(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...WA.container,...c},className:u,children:[o&&a.jsx("span",{style:WA.label,children:l}),a.jsx("button",{style:WA.btn,onClick:U,onMouseEnter:S=>Object.assign(S.currentTarget.style,WA.btnHover),onMouseLeave:S=>{S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:WA.input,type:"text",value:F,onChange:S=>{const K=S.target.value;if(K===""||K==="."||K==="0.")return;const G=parseFloat(K);isNaN(G)||b(G)},onBlur:()=>b(v)}),a.jsx("button",{style:WA.btn,onClick:C,onMouseEnter:S=>Object.assign(S.currentTarget.style,WA.btnHover),onMouseLeave:S=>{S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:WA.presets,children:n.map(S=>a.jsx("button",{style:{...WA.preset,...Math.abs(v-S)<1e-4?WA.presetActive:{}},onClick:()=>b(S),onMouseEnter:K=>{Math.abs(v-S)>=1e-4&&Object.assign(K.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:K=>{Math.abs(v-S)>=1e-4&&(K.currentTarget.style.borderColor="#334155")},children:S},S))})]})}const aA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function yp({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:u,className:g}){const{currentSymbolData:B}=zt(),[v,b]=Y.useState(""),[C,U]=Y.useState(!1),[F,S]=Y.useState("price"),K=i!==void 0?i:v,G=t!==void 0?t:C,M=r!==void 0?r:F,W=Y.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ne=Y.useCallback(re=>{r!==void 0||S(re),n?.(re)},[r,n]),J=Y.useCallback(re=>{i!==void 0||b(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){J(ce);return}const Z=parseFloat(ce);isNaN(Z)||J(ce)},ie=M==="price"?B?.bid?parseFloat(B.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...aA.container,...u},className:g,children:[l&&a.jsx("span",{style:aA.label,children:c}),s&&a.jsx("button",{style:{...aA.toggle,...G?aA.toggleOn:aA.toggleOff},onClick:()=>W(!G),children:a.jsx("div",{style:{...aA.toggleKnob,...G?aA.knobOn:aA.knobOff}})}),(G||!s)&&a.jsxs("div",{style:aA.inputGroup,children:[a.jsx("input",{style:aA.input,type:"text",value:K,onChange:V,placeholder:ie,onFocus:re=>re.currentTarget.style.borderColor="#EF5350",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...aA.modeBtn,...M==="price"?aA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...aA.modeBtn,...M==="pips"?aA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const lA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Cp({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:u,className:g}){const{currentSymbolData:B}=zt(),[v,b]=Y.useState(""),[C,U]=Y.useState(!1),[F,S]=Y.useState("price"),K=i!==void 0?i:v,G=t!==void 0?t:C,M=r!==void 0?r:F,W=Y.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ne=Y.useCallback(re=>{r!==void 0||S(re),n?.(re)},[r,n]),J=Y.useCallback(re=>{i!==void 0||b(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){J(ce);return}const Z=parseFloat(ce);isNaN(Z)||J(ce)},ie=M==="price"?B?.ask?parseFloat(B.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...lA.container,...u},className:g,children:[l&&a.jsx("span",{style:lA.label,children:c}),s&&a.jsx("button",{style:{...lA.toggle,...G?lA.toggleOn:lA.toggleOff},onClick:()=>W(!G),children:a.jsx("div",{style:{...lA.toggleKnob,...G?lA.knobOn:lA.knobOff}})}),(G||!s)&&a.jsxs("div",{style:lA.inputGroup,children:[a.jsx("input",{style:lA.input,type:"text",value:K,onChange:V,placeholder:ie,onFocus:re=>re.currentTarget.style.borderColor="#26A69A",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...lA.modeBtn,...M==="price"?lA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...lA.modeBtn,...M==="pips"?lA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const ST=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],RA={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function vp({showLabel:i=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:u,chartObjects:g,setChartObjects:B}=zt(),[v,b]=Y.useState(null),C=A||ST,U=K=>{l(o===K?null:K)},F=()=>{B([]),l(null)},S=()=>{u(!c)};return a.jsxs("div",{style:{...RA.container,...n},className:s,children:[i&&a.jsx("span",{style:RA.label,children:r}),C.map(K=>a.jsxs("button",{style:{...RA.btn,...o===K.id?RA.btnActive:{}},onClick:()=>U(K.id),onMouseEnter:G=>{b(K.id),o!==K.id&&Object.assign(G.currentTarget.style,RA.btnHover)},onMouseLeave:G=>{b(null),o!==K.id&&(G.currentTarget.style.borderColor="#334155",G.currentTarget.style.backgroundColor="#1e293b",G.currentTarget.style.color="#94a3b8")},title:K.name,children:[K.icon,v===K.id&&a.jsx("div",{style:RA.tooltip,children:K.name})]},K.id)),(e||t)&&a.jsx("div",{style:RA.divider}),t&&a.jsx("button",{style:{...RA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:S,onMouseEnter:K=>{K.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:K=>{K.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:RA.deleteBtn,onClick:F,onMouseEnter:K=>Object.assign(K.currentTarget.style,RA.deleteBtnHover),onMouseLeave:K=>{K.currentTarget.style.borderColor="#334155",K.currentTarget.style.backgroundColor="#1e293b",K.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Tp={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function ET({showCoinSelector:i=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:u,onStopLossEnabledChange:g,takeProfit:B,onTakeProfitChange:v,takeProfitEnabled:b,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:S={},takeProfitProps:K={},drawingToolsProps:G={},style:M,className:W}){const ne=[];i&&ne.push(a.jsx(wp,{...U},"coin")),e&&ne.push(a.jsx(Bp,{value:s,onChange:o,...F},"volume")),t&&ne.push(a.jsx(yp,{value:l,onChange:c,enabled:u,onEnabledChange:g,...S},"sl")),A&&ne.push(a.jsx(Cp,{value:B,onChange:v,enabled:b,onEnabledChange:C,...K},"tp")),r&&ne.push(a.jsx(vp,{...G},"draw"));const J=[];return ne.forEach((V,ie)=>{J.push(V),n&&ie<ne.length-1&&J.push(a.jsx("div",{style:Tp.divider},`div-${ie}`))}),a.jsx("div",{style:{...Tp.toolbar,...M},className:W,children:J})}const LT=[{label:"M1",value:"M1"},{label:"M5",value:"M5"},{label:"M15",value:"M15"},{label:"M30",value:"M30"},{label:"H1",value:"H1"},{label:"H4",value:"H4"},{label:"D1",value:"D1"},{label:"W1",value:"W1"}],sl={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function MT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=zt();return a.jsx("div",{style:{...sl.container,...i},className:e,children:LT.map(r=>a.jsx("button",{style:{...sl.btn,...t===r.value?sl.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},children:r.label},r.value))})}const HT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],ol={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function IT({style:i,className:e}){const{chartType:t,setChartType:A}=zt();return a.jsx("div",{style:{...ol.container,...i},className:e,children:HT.map(r=>a.jsxs("button",{style:{...ol.btn,...t===r.value?ol.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const AA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function DT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=zt(),[u,g]=Y.useState(null),B=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),b=v>0&&B>0?Math.abs(v-B):0,C=S=>!S||S===0?"-.-----":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5),U=S=>S===0?"-":S>=1?S.toFixed(1):S>=.01?S.toFixed(3):(S*1e4).toFixed(1)+"p",F=Y.useCallback(S=>{if(!s)return;const K=S==="BUY"?v:B;if(!K||K<=0){g({type:"error",message:"No price available"});return}const G={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:S,volume:i,price:K,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(W=>[...W,G]);const M=i*K*.01;c(W=>W-M),g({type:"success",message:`${S} executed`}),A?.(G),setTimeout(()=>g(null),3e3)},[s,v,B,i,e,t,l,c,A]);return a.jsxs("div",{style:{...AA.container,...r},className:n,children:[a.jsx("button",{style:AA.sellBtn,onClick:()=>F("SELL"),onMouseEnter:S=>{Object.assign(S.currentTarget.style,AA.sellBtnHover)},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#7f1d1d",S.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...AA.priceValue,color:"#EF5350"},children:C(B)})]}),a.jsxs("div",{style:AA.spread,children:[a.jsx("span",{style:AA.spreadLabel,children:"Spread"}),a.jsx("span",{style:AA.spreadValue,children:U(b)})]}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...AA.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:AA.buyBtn,onClick:()=>F("BUY"),onMouseEnter:S=>{Object.assign(S.currentTarget.style,AA.buyBtnHover)},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#14532d",S.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...AA.status,backgroundColor:u.type==="success"?"#14532d":"#7f1d1d",color:u.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${u.type==="success"?"#166534":"#991b1b"}`},children:u.message})]})}const ot={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function _T({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=zt(),[l,c]=Y.useState(null),u=A.filter(C=>C.status==="OPEN"||!C.closeAt),g=Y.useCallback((C,U)=>{const F=n.find(S=>S.symbol===C);return F?U?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),B=Y.useCallback(C=>{if(l)return;c(C.id);const U=g(C.symbol,C.type),S=(C.type?.toUpperCase()==="BUY"?U-C.price:C.price-U)*C.volume,K=C.volume*C.price*.01;r(G=>G.filter(M=>M.id!==C.id)),o(G=>G+K+S),c(null)},[l,g,r,o]),v=C=>{const U=parseFloat(C);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},b=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...i},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):u.map(C=>{const U=g(C.symbol,C.type),F=C.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...ot.td,...C.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:C.type}),a.jsx("td",{style:ot.td,children:C.volume}),a.jsx("td",{style:ot.td,children:v(C.price)}),a.jsx("td",{style:ot.td,children:v(U)}),a.jsx("td",{style:ot.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:b(F)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>B(C),disabled:l===C.id,onMouseEnter:S=>{l!==C.id&&(S.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#7f1d1d"},children:l===C.id?"...":"Close"})})]},C.id)})})]})})]})}function PT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(i)}function NT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(i)}function OT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(i)}function kT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(i)}const KT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:u,marketWatchOpen:g=!0,onToggleMarketWatch:B,buySellPanelOpen:v,onMove:b})=>{const{theme:C}=zt(),U=C==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],S={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return a.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b min-w-max ${U?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${U?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(K=>a.jsx("button",{onClick:()=>r(K),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
+ ${A===K?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
+ `,title:K,children:S[K]},K))}),a.jsx("div",{className:`flex items-center gap-1 border-r ${U?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(K=>a.jsx("button",{onClick:()=>r(K),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
15
+ ${A===K?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
16
+ `,title:K,children:S[K]},K))}),a.jsxs("div",{className:"flex items-center gap-2",children:[F.map(K=>a.jsx("button",{onClick:()=>t(K),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===K?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:K},K)),a.jsx("div",{className:`border-r h-6 mx-1 ${U?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:v?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${v?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 5v4H9c-1.054 0-1.918.816-1.995 1.85L7 11v2c0 1.105.895 2 2 2h2.5v4H4c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h7.5z"}),a.jsx("path",{fill:"#3687ED",d:"M20 5c1.105 0 2 .895 2 2v10c0 1.105-.895 2-2 2h-7.5v-4H15c1.054 0 1.918-.816 1.995-1.85L17 13v-2c0-1.105-.895-2-2-2h-2.5V5H20z"}),a.jsx("path",{fill:"#B0BEC5",d:"M10 10h4c1.105 0 2 .895 2 2s-.895 2-2 2h-4c-1.105 0-2-.895-2-2s.895-2 2-2z"})]})})}),a.jsxs("button",{onClick:n,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 4v2.02C8.42 6.276 6 8.856 6 12c0 3.145 2.42 5.725 5.5 5.98V20H10c-4.418 0-8-3.582-8-8s3.582-8 8-8h1.5z"}),a.jsx("path",{fill:"#3687ED",d:"M14 4c4.418 0 8 3.582 8 8s-3.582 8-8 8h-1.5v-2.02c3.08-.256 5.5-2.836 5.5-5.98 0-3.145-2.42-5.725-5.5-5.98V4H14z"}),a.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),a.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:s,className:`p-1 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(PT,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(NT,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:b,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>B?.(),title:g?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${g?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[a.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14Zm-1 2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h12Z"})]})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${U?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:a.jsx("path",{d:"M22 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0-4a1 1 0 0 1-1-1V4h-1a1 1 0 1 1 0-2h1a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Zm1 7v8a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-8l3.764-1s.45-.428.789-1.105l.171-.342a.998.998 0 0 1 .894-.553h4.764a1 1 0 0 1 .894.552l.171.342c.339.678.789 1.106.789 1.106L23 13Zm-8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm0 4.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3ZM16 4h-2a1 1 0 1 1 0-2h2a1 1 0 1 1 0 2Zm-6 0H8a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2ZM4 22H3a2 2 0 0 1-2-2v-1a1 1 0 1 1 2 0v1h1a1 1 0 1 1 0 2ZM4 4H3v1a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2h1a1 1 0 0 1 0 2ZM2 8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Zm0 5a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1Z"})})}),a.jsx("button",{type:"button",onClick:()=>u?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${U?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})})]})]})},Jr=[{label:"Trendline",toolId:2,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})},{label:"Horizontal Line",toolId:20,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M19 9l3 3-3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Vertical Line",toolId:22,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),a.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),a.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),a.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M5.054 17.988a2.988 2.988 0 0 1-1.31-.312 2.994 2.994 0 1 1 2.69 1.693 2.988 2.988 0 0 1-1.38-.381Zm-1 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),a.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),a.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Zr=[{label:"Regression Channel",toolId:40,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Equidistant Channel",toolId:3,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M15 8a2.966 2.966 0 0 1-1.308-.312l-6 6c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l6-6A2.992 2.992 0 1 1 15 8ZM5 14a1 1 0 1 0 0 2.001A1 1 0 0 0 5 14ZM15 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm6.714 6.666-7.026 7.026a3.03 3.03 0 1 1-1.381-1.381l7.026-7.026a.977.977 0 1 1 1.381 1.381ZM12 18a1 1 0 1 0 0 2.001A1 1 0 0 0 12 18Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"StdDev Channel",toolId:41,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.381-1.382ZM10 15H9v4a1 1 0 1 1-2 0v-1H6a1 1 0 0 1 0-2h1v-4a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm7-7h-1v4a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1V5a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm-4.714 12.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.382-1.382h.001Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Andrews Pitchfork",toolId:42,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m21.714 13.666-4.026 4.026c.203.406.31.854.312 1.308a3 3 0 0 1-6 0c.002-.454.11-.902.312-1.308L10 15.381l-2.312 2.311a3.03 3.03 0 1 1-1.381-1.381L8.619 14l-2.311-2.312a3 3 0 1 1-.001-5.377l4.026-4.026a.976.976 0 1 1 1.381 1.381L7.688 7.692a2.9 2.9 0 0 1 0 2.615L10 12.619l8.333-8.334a.976.976 0 1 1 1.381 1.381L11.381 14l2.312 2.312a2.9 2.9 0 0 1 2.614 0l4.026-4.026a.977.977 0 1 1 1.381 1.38ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],Yr=[{label:"Gann Line",toolId:43,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3 3 0 0 1-3 3 2.965 2.965 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l3-3a2.98 2.98 0 0 1 4-4l3-3A2.992 2.992 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2.001A1 1 0 0 0 5 18Zm7-7a1 1 0 1 0 0 2.001A1 1 0 0 0 12 11Zm7-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Fan",toolId:44,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M21.72 3.584 17.694 7.61c.202.407.31.854.312 1.308a3 3 0 0 1-3 3 2.967 2.967 0 0 1-1.308-.312l-4.45 4.45 10.109-4.042a.987.987 0 0 1 .834 1.79L8.167 18.61l7.75-.7a1.004 1.004 0 1 1 .18 2l-8.684.79a2.992 2.992 0 1 1-4.2-4.164l.794-8.7a1.004 1.004 0 1 1 2 .181L5.3 15.765 9.673 4.591a.969.969 0 0 1 1.3-.48 1 1 0 0 1 .47 1.32L7.79 14.77l4.538-4.538a2.98 2.98 0 0 1 4-4l4.026-4.026a.977.977 0 0 1 1.367 1.377ZM5.006 19.918a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm10-12a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Grid",toolId:45,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-.5.5L21 12l-3.809 3.809.5.5a3.034 3.034 0 1 1-1.381 1.381l-.5-.5L12 21l-3.809-3.809-.5.5c.202.407.308.855.309 1.309a3.03 3.03 0 1 1-1.693-2.689l.5-.5L3 12l3.81-3.81-.5-.5A2.966 2.966 0 0 1 5 8a3.031 3.031 0 1 1 2.689-1.693l.5.5L12 3l3.809 3.81.5-.5A2.993 2.993 0 1 1 19 8Zm0 12a1 1 0 1 0 0-2.002A1 1 0 0 0 19 20ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm7 14.452 2.536-2.536L12 13.381l-2.536 2.535L12 18.452ZM5.547 12l2.536 2.535L10.619 12 8.083 9.464 5.547 12ZM12 5.547 9.464 8.083 12 10.619l2.535-2.536L12 5.547Zm3.916 3.917L13.381 12l2.536 2.535L18.452 12l-2.536-2.536ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],qr=[{label:"Rectangle",toolId:5,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})},{label:"Circle",toolId:46,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12C22 10.2504 21.5507 8.60571 20.7611 7.17509C20.9149 6.81421 21 6.41704 21 6C21 4.34315 19.6569 3 18 3C17.583 3 17.1858 3.0851 16.8249 3.23888C15.3943 2.44933 13.7496 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12ZM12 20C16.4183 20 20 16.4183 20 12C20 10.8264 19.7473 9.7118 19.2933 8.70768C18.9017 8.89507 18.4631 9 18 9C17.5369 9 17.0983 8.89506 16.7066 8.70766L14.7077 10.7066C14.8951 11.0983 15 11.5369 15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.4632 9 12.9018 9.10496 13.2935 9.2924L15.2924 7.29348C15.105 6.90183 15 6.46317 15 6C15 5.5369 15.1049 5.09831 15.2923 4.7067C14.2882 4.25272 13.1736 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7Z",fill:"currentColor"})})},{label:"Triangle",toolId:47,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6C15 7.65685 13.6569 9 12 9C11.763 9 11.5324 8.97252 11.3113 8.92057L7.37081 16.1613C6.95686 15.6284 6.36717 15.2388 5.68872 15.0794L9.62925 7.83858C9.23484 7.33074 9 6.6928 9 6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6ZM13 6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.3708 7.83867C13.9569 8.37162 13.3672 8.76126 12.6887 8.9206L16.6292 16.1614C16.4344 16.4122 16.2786 16.6948 16.1707 17H7.82941C7.93996 17.3128 8.00012 17.6494 8.00012 18C8.00012 18.3506 7.93996 18.6872 7.8294 19H16.1707C16.5826 20.1652 17.6938 21 19 21C20.6569 21 22 19.6569 22 18C22 16.3431 20.6569 15 19 15C18.763 15 18.5324 15.0275 18.3113 15.0794L14.3708 7.83867ZM19 19C19.5523 19 20 18.5523 20 18C20 17.4477 19.5523 17 19 17C18.4477 17 18 17.4477 18 18C18 18.5523 18.4477 19 19 19Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00012 18C8.00012 19.6569 6.65685 21 5 21C3.34315 21 2 19.6569 2 18C2 16.3431 3.34315 15 5 15C6.65685 15 8.00012 16.3431 8.00012 18ZM6 18C6 18.5523 5.55228 19 5 19C4.44772 19 4 18.5523 4 18C4 17.4477 4.44772 17 5 17C5.55228 17 6 17.4477 6 18Z",fill:"currentColor"})]})},{label:"Ellipse",toolId:48,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3a3.001 3.001 0 0 0-2.935 2.378c-1.25.333-2.381.874-3.322 1.58a7.344 7.344 0 0 0-1.886 2.045 3 3 0 0 0 0 5.994 7.343 7.343 0 0 0 1.886 2.046C7.38 18.27 9.595 19 12 19s4.62-.73 6.257-1.957a7.343 7.343 0 0 0 1.886-2.046 3 3 0 0 0 0-5.994 7.344 7.344 0 0 0-1.886-2.046c-.94-.705-2.073-1.246-3.322-1.579A3.001 3.001 0 0 0 12 3Zm-1 3a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm7.156 3.634a5.584 5.584 0 0 0-1.1-1.077 7.61 7.61 0 0 0-2.391-1.177 3 3 0 0 1-5.33 0 7.61 7.61 0 0 0-2.392 1.177c-.437.328-.805.69-1.099 1.076A2.995 2.995 0 0 1 7 12c0 .962-.452 1.818-1.156 2.367.294.386.662.748 1.1 1.076C8.201 16.387 9.985 17 12 17c2.014 0 3.798-.613 5.057-1.557.437-.328.805-.69 1.099-1.077A2.995 2.995 0 0 1 17 12c0-.961.452-1.817 1.156-2.366ZM3 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm16 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z",fill:"currentColor"})})}],ks=({children:i,top:e,panelRef:t,isLight:A})=>a.jsx("div",{ref:t,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${A?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:a.jsx("div",{className:"py-1",children:i})}),VT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:g,setDrawingsVisible:B,chartLocked:v,setChartLocked:b,theme:C,setTheme:U,setCandleColors:F,setShowTradeOrders:S,showTradeOrders:K,setShowTradePosition:G,showTradePosition:M,setShowTradeHistory:W,showTradeHistory:ne,setShowSLTP:J,showSLTP:V,setShowAskPrice:ie,showAskPrice:re,setShowChartControls:ce,showChartControls:Z,setShowTradeNotification:Ae,showTradeNotification:oe,setShowCrosshair:le,showCrosshair:se,setShowOHLC:ae,showOHLC:pe,setIsShow:we}=zt(),Qe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[Fe,Be]=Y.useState(!1),[ve,Ce]=Y.useState(null),[be,Le]=Y.useState(null),[Ge,Ke]=Y.useState(0),[Te,_e]=Y.useState(!1),[ye,de]=Y.useState(0),[Pe,et]=Y.useState(!1),[it,rt]=Y.useState(0),[dt,fA]=Y.useState(!1),[Ze,Oe]=Y.useState(0),[at,At]=Y.useState(!1),[Ct,xt]=Y.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),GA=Y.useRef(null),$A=Y.useRef(null),Gt=Y.useRef(null),mA=Y.useRef(null),XA=Y.useRef(null),Kt=Y.useRef(null);Y.useEffect(()=>{const He=tt=>{const Je=GA.current;Fe&&Je&&!Je.contains(tt.target)&&(Be(!1),Ce(null));const Me=$A.current;be==="line"&&Me&&!Me.contains(tt.target)&&Le(null);const ze=Gt.current;be==="channel"&&ze&&!ze.contains(tt.target)&&Le(null);const Ue=mA.current;be==="gann"&&Ue&&!Ue.contains(tt.target)&&Le(null);const We=XA.current;be==="shape"&&We&&!We.contains(tt.target)&&Le(null)};return window.addEventListener("mousedown",He),()=>window.removeEventListener("mousedown",He)},[Fe,be]),Y.useEffect(()=>{const He=tt=>{tt.key==="Escape"&&(Be(!1),Ce(null),Le(null))};return window.addEventListener("keydown",He),()=>window.removeEventListener("keydown",He)},[]);const Ut=Y.useMemo(()=>[{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 13H15.874C15.5122 14.4056 14.4056 15.5122 13 15.874V20C13 20.2652 12.8946 20.5196 12.7071 20.7071C12.5196 20.8946 12.2652 21 12 21C11.7348 21 11.4804 20.8946 11.2929 20.7071C11.1054 20.5196 11 20.2652 11 20V15.874C9.59439 15.5122 8.4878 14.4056 8.12602 13H4C3.73478 13 3.48043 12.8946 3.29289 12.7071C3.10536 12.5196 3 12.2652 3 12C3 11.7348 3.10536 11.4804 3.29289 11.2929C3.48043 11.1054 3.73478 11 4 11H8.12602C8.4878 9.59439 9.59439 8.4878 11 8.12602V4C11 3.73478 11.1054 3.48043 11.2929 3.29289C11.4804 3.10536 11.7348 3 12 3C12.2652 3 12.5196 3.10536 12.7071 3.29289C12.8946 3.48043 13 3.73478 13 4V8.12602C14.4056 8.4878 15.5122 9.59439 15.874 11H20C20.2652 11 20.5196 11.1054 20.7071 11.2929C20.8946 11.4804 21 11.7348 21 12C21 12.2652 20.8946 12.5196 20.7071 12.7071C20.5196 12.8946 20.2652 13 20 13ZM12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10Z",fill:"currentColor"})]})}),label:"Crosshair",description:"Precise cursor positioning for measurement on chart"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})}),label:"Trend Line",description:"Draw trend line (drag from first point to second point)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Parallel Lines",description:"Draw two parallel trend lines (draw first line, then second)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:a.jsx("path",{d:"M21 15H3a1 1 0 0 1 0-2h18a1 1 0 0 1 0 2Zm-2-3a2.99 2.99 0 0 1-2.816-2H3a1 1 0 0 1 0-2h13.184A2.995 2.995 0 1 1 19 12Zm0-4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2-3H3a1 1 0 0 1 0-2h18a1 1 0 1 1 0 2ZM5 16a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2H7.816A2.995 2.995 0 1 1 5 16Zm0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Fibonacci",description:"Draw Fibonacci retracement levels"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Rectangle",description:"Draw support/resistance zone (drag from corner to corner)"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M12.76 17.958c-.504.07-1.016.07-1.52 0C6.07 17.532 2 12.932 2 12c0-.977 4.48-6 10-6s10 5.043 10 6c0 .912-4.07 5.529-9.24 5.958ZM3.63 12a11.724 11.724 0 0 0 3.03 2.741 5.963 5.963 0 0 1 .02-5.492A11.7 11.7 0 0 0 3.63 12ZM12 7.57a4.443 4.443 0 1 0-.006 8.886A4.443 4.443 0 0 0 12 7.57Zm5.31 1.652a5.954 5.954 0 0 1 .01 5.546A11.45 11.45 0 0 0 20.37 12a11.525 11.525 0 0 0-3.06-2.778ZM12 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Eye",description:"Show or hide all drawing objects on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M16 20H8a2 2 0 0 1-2-2v-7a2 2 0 0 1 1.05-1.749A1.044 1.044 0 0 1 7 9a5 5 0 0 1 8.75-3.3 1.008 1.008 0 0 1-.09 1.411 1 1 0 0 1-1.41-.09A3 3 0 0 0 9 9h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2Zm0-9H8v7h8v-7Zm-4 2a1 1 0 0 1 1 1v1a1 1 0 0 1-2 0v-1a1 1 0 0 1 1-1Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Lock",description:"Lock chart (disable pan and zoom)"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),label:"Delete",description:"Remove last drawn object from chart"},{icon:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16M6 4v16M12 4v16M18 4v16"})}),label:"Grid",description:"Toggle grid display on/off for chart alignment"},{icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fill:"currentColor",d:"M12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C9.068 22 6.43 20.738 4.602 18.728L6.081 17.382C7.544 18.99 9.654 20 12 20C16.418 20 20 16.418 20 12C20 7.582 16.418 4 12 4C7.92 4 4.554 7.054 4.062 11H5.828L3 13.828L0.171997 11H2.049C2.551 5.947 6.815 2 12 2ZM13 7V12.186L16.657 15.843L15.243 17.257L11 13V7H13Z"})}),label:"History",description:"View trade history"},{icon:a.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),gA=He=>{const tt=Ut[He].label;if(tt==="Menu"){Be(Je=>!Je),Ce(null);return}if(tt==="Grid"){s(!n);return}if(tt==="Magnet"){l(!o),r(o?null:He);return}if(tt==="Delete"){if(c.length>0){const Je=[...c];Je.pop(),u(Je)}return}if(tt==="Eye"){B(!g);return}if(tt==="Lock"){b(!v);return}if(tt==="Light Theme"||tt==="Dark Theme"){U(C==="light"?"dark":"light"),Be(!1),Ce(null);return}if(tt==="History"){we(!0);return}r(A===He?null:He)};Ut.slice(0,12);const nt=Ut.slice(12),mt=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],St=[{key:"accounts",label:"Trading accounts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 14a6 6 0 0 0-5 2 8 8 0 0 0 5 2l5-2a6 6 0 0 0-5-2zm0-12a8 8 0 0 0-6 13 8 8 0 0 1 6-3 8 8 0 0 1 6 3 8 8 0 0 0-6-13zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",fill:"currentColor"})})})}),submenu:[{label:"Connect to account",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.jsx("path",{fillRule:"evenodd","clip-rule":"evenodd",d:"M20 6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6zm-2 3V6h-3v3h3zm-4-3h-4v2.999h4V6zM9 6H6v3l3-.001V6zm-3 4v4l3-.001v-4H6zm0 5v3h3v-3.001H6zm4 3h4v-3.001h-4V18zm5 0h3v-3h-3v3zm3-4v-4h-3v4h3zm-8-.001v-4h4v4h-4z",fill:"currentColor"})})})},{label:"Trade Orders",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m6.926 14-.418-1.16H4.547L4.148 14H3.02L5.3 8.2h.446l2.3 5.8h-1.12ZM5.523 9.95l-.687 2.113H6.21l-.688-2.114Zm2.86 3.734.375-.91c.4.28.795.421 1.183.421.597 0 .895-.208.895-.625a.886.886 0 0 0-.211-.558c-.14-.177-.431-.375-.871-.594-.438-.221-.733-.402-.887-.543a1.506 1.506 0 0 1-.351-.508 1.682 1.682 0 0 1-.121-.648c0-.443.161-.81.484-1.102.325-.291.742-.437 1.25-.437.661 0 1.147.123 1.457.37l-.309.876a1.909 1.909 0 0 0-1.129-.383c-.234 0-.416.062-.546.187a.635.635 0 0 0-.192.48c0 .33.363.67 1.09 1.024.383.188.659.361.828.52.17.156.298.34.387.55.088.209.133.442.133.7 0 .463-.184.845-.551 1.144-.365.3-.854.45-1.469.45a2.617 2.617 0 0 1-1.445-.414Zm7.613.316-1.594-2.438-.636.872V14H12.75V8.277h1.016v2.739l1.945-2.739h1.156l-1.793 2.5L17.211 14h-1.215ZM3 15h18v1H3z",fill:"#C96057"})})})})},{label:"Chart Controls",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),a.jsx("path",{d:"M11.2574 18.9959C11.1719 18.9986 11.0861 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11C19 11.0599 18.9993 11.1196 18.998 11.1791L16.9574 10.2813C16.6023 7.3064 14.0705 5 11 5C7.68629 5 5 7.68629 5 11C5 14.191 7.49101 16.8002 10.6345 16.9891L11.2574 18.9959Z",fill:"currentColor"})]})})})},{label:"Crosshair cursor",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"theme",label:C==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.408 12.954-2.265-.756a.209.209 0 0 1 0-.396l2.265-.755a.209.209 0 0 1 .276.198v1.51c0 .143-.14.244-.276.198ZM5.959 7.306 4.89 5.17c-.09-.18.1-.37.28-.28l2.136 1.068a.209.209 0 0 1 .054.334L6.293 7.36c-.1.101-.27.074-.334-.054ZM11.802 21.857l-.755-2.265a.209.209 0 0 1 .198-.276h1.51c.143 0 .244.14.198.276l-.755 2.265a.21.21 0 0 1-.396 0ZM11.802 2.143l-.755 2.265a.209.209 0 0 0 .198.276h1.51c.143 0 .244-.14.198-.276l-.755-2.265a.209.209 0 0 0-.396 0ZM18.83 19.11l-2.137-1.068a.209.209 0 0 1-.054-.335l1.068-1.068c.1-.1.27-.073.334.055l1.069 2.136c.09.18-.101.37-.28.28ZM16.693 5.958 18.83 4.89c.18-.09.37.1.28.28l-1.068 2.136a.209.209 0 0 1-.334.054l-1.068-1.068a.209.209 0 0 1 .054-.334ZM4.89 18.83l1.069-2.136a.209.209 0 0 1 .334-.055l1.068 1.068c.101.101.074.271-.054.335L5.171 19.11c-.18.09-.37-.1-.28-.28ZM21.857 12.198l-2.265.755a.209.209 0 0 1-.276-.198v-1.51c0-.143.14-.244.276-.198l2.265.755a.21.21 0 0 1 0 .396Z",fill:"#FEBC5A"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fillRule:"evenodd",d:"M20.775 8.992C20.922 9.638 21 10.31 21 11a8.354 8.354 0 0 0-.787 0c-1.467.072-2.422.564-3.082 1.283l-1.18-1.65c.761-.718 1.697-1.205 2.81-1.452A7 7 0 1 0 12 18c.396-.001.565-.082.63-.12.07-.042.17-.124.295-.34.218-.375.36-.835.534-1.49l1.518 1.822C14.485 19.102 13.705 20 12 20a9 9 0 1 1 8.775-11.008Z","clip-rule":"evenodd",fill:"currentColor"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M13.892 14.693c-2.034.46-2.59-1.07-2.892-4.693 3.85.352 5.232 1.05 4.697 3.012L20 17.192s.038 1.023-.361 1.447c-.463.49-1.687.361-1.687.361l-4.06-4.307Z",fill:"currentColor"})]})})}),submenu:[{label:"Green & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#26a69a"})]})})})},{label:"Blue & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#578cf2"})]})})})},{label:"Black & White",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#76ac85"})]})})})}]},{key:"lang",label:"Language",rightText:"EN",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.9 17.39C17.64 16.59 16.89 16 16 16H15V13C15 12.4477 14.5523 12 14 12H8V10H10C10.5523 10 11 9.55228 11 9V7H13C14.1046 7 15 6.10457 15 5V4.59C17.93 5.77 20 8.64 20 12C20 14.08 19.2 15.97 17.9 17.39ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.78 4.21 10.21L9 15V16C9 17.1046 9.89543 18 11 18V19.93ZM12 2C6.47715 2 2 6.47715 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C6.8043 20.9464 9.34784 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z",fill:"currentColor"})})})}),submenu:[{label:"English",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}]}],It=({item:He})=>{const tt=!!He.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Kt.current&&(clearTimeout(Kt.current),Kt.current=null),tt&&Ce(He.key)},onMouseLeave:()=>{tt&&(Kt.current=setTimeout(()=>Ce(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{tt?Ce(Je=>Je===He.key?null:He.key):(He.key==="theme"&&U(Je=>Je==="light"?"dark":"light"),Be(!1),Ce(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:He.label}),He.rightText&&a.jsx("span",{className:`text-xs ${$e?"text-slate-500":"text-slate-400"}`,children:He.rightText}),tt&&a.jsx("svg",{className:`w-4 h-4 ${$e?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),tt&&ve===He.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${$e?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:He.submenu.map((Je,Me)=>{const ze=Ct[He.key],Ue=Array.isArray(ze)?ze.includes(Je.label):ze===Je.label||Je.selected&&ze==null;return a.jsxs("button",{type:"button",onClick:()=>{He.key==="chart"?(xt(Ne=>{const st=Array.isArray(Ne.chart)?Ne.chart:[Ne.chart],lt=st.includes(Je.label)?st.filter(vt=>vt!==Je.label):[...st,Je.label];return{...Ne,chart:lt}}),{Grid:()=>s(!n),"Trade Orders":()=>S(!K),"Ask Price":()=>ie(!re),"Chart Controls":()=>ce(!Z),"Trade Notification":()=>Ae(!oe),"Crosshair cursor":()=>le(!se),"Show OHLC":()=>ae(!pe)}[Je.label]?.()):(xt(We=>({...We,[He.key]:Je.label})),He.key==="colors"&&Qe[Je.label]&&F(Qe[Je.label]))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:Je.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Je.label}),Ue&&a.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},Me)})})})]})},$e=C==="light";return a.jsxs("div",{className:"relative h-full",children:[a.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${$e?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:mt.map((He,tt)=>{const Je=He==="gann",Me=Je?null:Ut[He],ze=Je?-1:He;return a.jsxs(Y.Fragment,{children:[ze===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=Jr[Ge].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
+ ${A===Jr[Ge].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Jr[Ge].label,children:Jr[Ge].icon}),a.jsx("span",{onMouseEnter:()=>_e(!0),onMouseLeave:()=>_e(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:Te?10:7,height:Te?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):ze===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=Zr[ye].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
+ ${A===Zr[ye].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Zr[ye].label,children:Zr[ye].icon}),a.jsx("span",{onMouseEnter:()=>et(!0),onMouseLeave:()=>et(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:Pe?10:7,height:Pe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):Je?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=Yr[it].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
+ ${A===Yr[it].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Yr[it].label,children:Yr[it].icon}),a.jsx("span",{onMouseEnter:()=>fA(!0),onMouseLeave:()=>fA(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:dt?10:7,height:dt?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):ze===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ue=qr[Ze].toolId;r(A===Ue?null:Ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
+ ${A===qr[Ze].toolId?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:qr[Ze].label,children:qr[Ze].icon}),a.jsx("span",{onMouseEnter:()=>At(!0),onMouseLeave:()=>At(!1),onMouseDown:Ue=>{Ue.stopPropagation(),Le(We=>We==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:at?10:7,height:at?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:$e?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>gA(ze),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
+ ${Me.label==="Grid"&&n||Me.label==="Eye"&&!g||Me.label==="Lock"&&v||A===ze?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Me.label}: ${Me.description}`,children:Me.icon}),!Je&&Me.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${$e?"border-slate-200":"border-slate-700"}`})]},Je?"gann-slot":`${Me.label}-${He}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:nt.map((He,tt)=>{const Je=12+tt;return a.jsx("button",{onClick:()=>gA(Je),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
+ ${He.label==="Grid"&&n||He.label==="Eye"&&!g||He.label==="Lock"&&v||A===Je?$e?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":$e?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${He.label}: ${He.description}`,children:He.icon},He.label)})})]}),be==="line"&&a.jsx(ks,{top:84,panelRef:$A,isLight:$e,children:Jr.map((He,tt)=>{const Je=Ge===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),Ke(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),be==="channel"&&a.jsx(ks,{top:128,panelRef:Gt,isLight:$e,children:Zr.map((He,tt)=>{const Je=ye===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),de(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),be==="gann"&&a.jsx(ks,{top:210,panelRef:mA,isLight:$e,children:Yr.map((He,tt)=>{const Je=it===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),rt(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),be==="shape"&&a.jsx(ks,{top:250,panelRef:XA,isLight:$e,children:qr.map((He,tt)=>{const Je=Ze===tt;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),Oe(tt),r(He.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${$e?"text-slate-500":"text-slate-400"}`,children:He.icon}),a.jsx("span",{className:"flex-1",children:He.label}),Je&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},He.toolId)})}),Fe&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{Be(!1),Ce(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:GA,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${$e?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${$e?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${$e?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),i!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${$e?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:St.map(He=>a.jsx(It,{item:He},He.key))})]})]})]})};function zT(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M337.509 305.372h-17.501l-6.571-5.486c20.791-25.232 33.922-57.054 33.922-93.257C347.358 127.632 283.896 64 205.135 64 127.452 64 64 127.632 64 206.629s63.452 142.628 142.225 142.628c35.011 0 67.831-13.167 92.991-34.008l6.561 5.487v17.551L415.18 448 448 415.086 337.509 305.372zm-131.284 0c-54.702 0-98.463-43.887-98.463-98.743 0-54.858 43.761-98.742 98.463-98.742 54.7 0 98.462 43.884 98.462 98.742 0 54.856-43.762 98.743-98.462 98.743z"},child:[]}]})(i)}const WT={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},RT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},GT={binance:"CRYPTO"},$T=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=zt(),o=s==="light",[l,c]=Y.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),g=Y.useMemo(()=>{const v={};for(const U of u){const F=(U.category||"other").toLowerCase();v[F]||(v[F]=[]),v[F].push(U)}const b=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(v).sort((U,F)=>{const S=b.indexOf(U),K=b.indexOf(F);return S!==-1&&K!==-1?S-K:S!==-1?-1:K!==-1?1:U.localeCompare(F)}).map(U=>({category:U,symbols:v[U]}))},[u]),B=v=>a.jsxs("tr",{onClick:()=>A(v.symbol),className:`cursor-pointer transition-colors ${t===v.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[a.jsxs("td",{className:`px-3 flex items-center justify-start gap-2 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:[v.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(kT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(OT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Z1,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:v.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${v.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[v.change>=0?"+":"",v.change,"%"]})]},v.symbol);return a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
23
23
  .scrollbar-dark::-webkit-scrollbar {
24
24
  width: 8px;
25
25
  }
@@ -46,4 +46,4 @@
46
46
  .scrollbar-light::-webkit-scrollbar-thumb:hover {
47
47
  background: #94a3b8;
48
48
  }
49
- `}),a.jsxs("div",{style:{width:`${i}px`,minWidth:"220px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[a.jsx(KT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):u.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:g.map(({category:v,symbols:T})=>a.jsxs(q.Fragment,{children:[a.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:a.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?zT[v]||"text-slate-600":VT[v]||"text-slate-400"}`,children:WT[v]||v.toUpperCase()})}),T.map(B)]},v))})]})})]})]})},GT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:g}=zt(),B=i||n,v=e||s,T=u||[],y=o==="light",S=l?"history":"trade";q.useEffect(()=>{l&&g&&g()},[l,g]);const F="#26A69A",E="#EF5350",k=y?"#f8fafc":"#12161D",R=y?"#e2e8f0":"#1e293b",M=y?"#f1f5f9":"#12161D",z=y?"#F0F5F9":"#2B3543",ne=y?"#f8fafc":"#131c2e",J=y?"#12161D":"#fff",V=y?"#64748b":"#fff",Ae=(v||[]).filter(pe=>pe.status==="OPEN"||!pe.closeAt),re=B?.balance||0,he=B?.equity??re,Y=B?.margin||0,te=B?.freeMargin??he-Y,oe=Y>0?he/Y*100:0,ce=Ae.reduce((pe,Pe)=>pe+(Pe.livePnL??Pe.profit??0),0),se=pe=>{const Pe=parseFloat(pe);return Number.isFinite(Pe)?Pe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},ae=pe=>{const Pe=parseFloat(pe);return!Pe||isNaN(Pe)?"—":Pe>=1e4?Pe.toFixed(2):Pe>=10?Pe.toFixed(4):Pe.toFixed(5)},de=pe=>{const Pe=parseFloat(pe);return isNaN(Pe)?"—":(Pe>=0?"+":"")+Pe.toFixed(2)},we=pe=>{const Pe=parseFloat(pe);return isNaN(Pe)?"—":Pe.toFixed(2)},Fe=pe=>{if(!pe)return"—";const Pe=new Date(pe);return isNaN(Pe.getTime())?String(pe):`${Pe.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${Pe.toTimeString().slice(0,8)}`},Ue=q.useCallback((pe,Pe)=>{pe.stopPropagation(),t&&t(Pe.id,Pe)},[t]),Be=q.useCallback((pe,Pe)=>{pe.stopPropagation(),A&&A(Pe)},[A]),Te={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:k,borderTop:`1px solid ${R}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:J},Ce={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:z,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},xe={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},Le={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Re={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ke={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:M},be=pe=>({padding:"5px 14px",fontSize:"11px",fontWeight:pe?700:500,color:pe?y?"#0ea5e9":"#38bdf8":V,borderBottom:pe?`2px solid ${y?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),_e={padding:"4px 8px",textAlign:"left",color:V,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",backgroundColor:M,position:"sticky",top:0,zIndex:1},ye={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:J};return a.jsxs("div",{style:Te,children:[a.jsxs("div",{style:Ce,children:[a.jsxs("div",{style:xe,children:[a.jsx("span",{style:Le,children:"Balance:"}),a.jsxs("span",{style:{...Re,color:J},children:["$",se(re)]})]}),a.jsxs("div",{style:xe,children:[a.jsx("span",{style:Le,children:"Equity:"}),a.jsxs("span",{style:{...Re,color:he>=re?F:E},children:["$",se(he)]})]}),a.jsxs("div",{style:xe,children:[a.jsx("span",{style:Le,children:"Margin:"}),a.jsxs("span",{style:{...Re,color:J},children:["$",se(Y)]})]}),a.jsxs("div",{style:xe,children:[a.jsx("span",{style:Le,children:"Free Margin:"}),a.jsxs("span",{style:{...Re,color:te>=0?J:E},children:["$",se(te)]})]}),a.jsxs("div",{style:{...xe,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Le,children:"Margin Level:"}),a.jsx("span",{style:{...Re,color:oe>=100?F:E},children:Y>0?oe.toFixed(2)+"%":"—"})]}),Ae.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Le,children:"Float P/L:"}),a.jsxs("span",{style:{...Re,color:ce>=0?F:E,fontWeight:700},children:[ce>=0?"+":"",se(ce)]})]})]}),a.jsxs("div",{style:Ke,children:[a.jsx("button",{style:be(S==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:be(S==="history"),onClick:()=>c&&c(!0),children:"History"})]}),S==="trade"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:_e,children:"Symbol"}),a.jsx("th",{style:_e,children:"Ticket"}),a.jsx("th",{style:_e,children:"Time"}),a.jsx("th",{style:_e,children:"Type"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:Ae.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...ye,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):Ae.map(pe=>{const Pe=pe.livePnL??pe.profit??0,tt=Pe>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor=ne,onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:J,letterSpacing:"0.02em"},children:pe.symbol}),a.jsx("td",{style:{...ye,color:V,fontSize:"10px"},children:String(pe.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:V},children:Fe(pe.openAt||pe.time)}),a.jsx("td",{style:{...ye,fontWeight:700,color:pe.type?.toUpperCase()==="BUY"?F:E},children:pe.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(pe.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(pe.price??pe.openPrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.stopLoss?E:V},children:pe.stopLoss?ae(pe.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.takeProfit?F:V},children:pe.takeProfit?ae(pe.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:V},children:pe.currentPrice?ae(pe.currentPrice):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:tt},children:de(Pe)}),a.jsx("td",{style:{...ye,textAlign:"center"},children:a.jsx("button",{onClick:rt=>Be(rt,pe),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:V,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:rt=>rt.currentTarget.style.color="#f59e0b",onMouseLeave:rt=>rt.currentTarget.style.color=V,children:"✎"})}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:tt},children:a.jsx("button",{onClick:rt=>Ue(rt,pe),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},pe.id)})})]})}),S==="history"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:_e,children:"Symbol"}),a.jsx("th",{style:_e,children:"Ticket"}),a.jsx("th",{style:_e,children:"Open Time"}),a.jsx("th",{style:_e,children:"Type"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:_e,children:"Close Time"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:T.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...ye,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):T.map(pe=>{const Pe=pe.profit??0,tt=Pe>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor=ne,onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:J,letterSpacing:"0.02em"},children:pe.symbol}),a.jsx("td",{style:{...ye,color:V,fontSize:"10px"},children:String(pe.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:V},children:Fe(pe.openAt)}),a.jsx("td",{style:{...ye,fontWeight:700,color:pe.type?.toUpperCase()==="BUY"?F:E},children:pe.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(pe.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(pe.openPrice)}),a.jsx("td",{style:{...ye,color:V},children:Fe(pe.closeAt)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(pe.closePrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.stopLoss?E:V},children:pe.stopLoss?ae(pe.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.takeProfit?F:V},children:pe.takeProfit?ae(pe.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:tt},children:de(Pe)})]},pe.id)})})]})})]})},$T="2.3.2";et.AccountPanel=GT,et.BuySellPanel=Wh,et.Chart=xT,et.ChartTypeSelector=MT,et.CoinSelector=md,et.DrawingTools=yd,et.LeftSidebar=kT,et.MarketExecutionModal=Rh,et.MarketWatch=RT,et.PositionsPanel=IT,et.SYMBOL_CONFIG=al,et.StopLoss=wd,et.TakeProfit=Bd,et.TimeframeSelector=ET,et.ToolCustomizationModal=Zh,et.TopBar=OT,et.TradePanel=HT,et.TradingProvider=D1,et.TradingToolbar=UT,et.VolumeControl=gd,et.alignToTimeframe=ke,et.detectGaps=Md,et.getSymbolConfig=nr,et.is24x7Symbol=Ld,et.isCryptoSymbol=tn,et.isForexSymbol=en,et.isWithinTradingSession=Hd,et.normalizeCandleTimes=cl,et.normalizeTime=j,et.processCandles=dl,et.processSingleCandle=fl,et.setSocketBaseUrl=Ph,et.timeframeToSeconds=hA,et.useTrading=zt,et.validateTimeOrdering=Id,et.version=$T,Object.defineProperty(et,Symbol.toStringTag,{value:"Module"})}));
49
+ `}),a.jsxs("div",{style:{width:`${i}px`,minWidth:"220px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[a.jsx(zT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):u.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:g.map(({category:v,symbols:b})=>a.jsxs(Y.Fragment,{children:[a.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:a.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?RT[v]||"text-slate-600":WT[v]||"text-slate-400"}`,children:GT[v]||v.toUpperCase()})}),b.map(B)]},v))})]})})]})]})},XT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:g}=zt(),B=i||n,v=e||s,b=u||[],C=o==="light",U=l?"history":"trade";Y.useEffect(()=>{l&&g&&g()},[l,g]);const F="#26A69A",S="#EF5350",K=C?"#f8fafc":"#12161D",G=C?"#e2e8f0":"#1e293b",M=C?"#f1f5f9":"#12161D",W=C?"#F0F5F9":"#2B3543",ne=C?"#f8fafc":"#131c2e",J=C?"#12161D":"#fff",V=C?"#64748b":"#fff",ie=(v||[]).filter(de=>de.status==="OPEN"||!de.closeAt),re=B?.balance||0,ce=B?.equity??re,Z=B?.margin||0,Ae=B?.freeMargin??ce-Z,oe=Z>0?ce/Z*100:0,le=ie.reduce((de,Pe)=>de+(Pe.livePnL??Pe.profit??0),0),se=de=>{const Pe=parseFloat(de);return Number.isFinite(Pe)?Pe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},ae=de=>{const Pe=parseFloat(de);return!Pe||isNaN(Pe)?"—":Pe>=1e4?Pe.toFixed(2):Pe>=10?Pe.toFixed(4):Pe.toFixed(5)},pe=de=>{const Pe=parseFloat(de);return isNaN(Pe)?"—":(Pe>=0?"+":"")+Pe.toFixed(2)},we=de=>{const Pe=parseFloat(de);return isNaN(Pe)?"—":Pe.toFixed(2)},Qe=de=>{if(!de)return"—";const Pe=new Date(de);return isNaN(Pe.getTime())?String(de):`${Pe.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${Pe.toTimeString().slice(0,8)}`},Fe=Y.useCallback((de,Pe)=>{de.stopPropagation(),t&&t(Pe.id,Pe)},[t]),Be=Y.useCallback((de,Pe)=>{de.stopPropagation(),A&&A(Pe)},[A]),ve={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:K,borderTop:`1px solid ${G}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:J},Ce={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:W,borderBottom:`1px solid ${G}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},be={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${G}`,whiteSpace:"nowrap"},Le={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Ge={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ke={display:"flex",borderBottom:`1px solid ${G}`,flexShrink:0,backgroundColor:M},Te=de=>({padding:"5px 14px",fontSize:"11px",fontWeight:de?700:500,color:de?C?"#0ea5e9":"#38bdf8":V,borderBottom:de?`2px solid ${C?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),_e={padding:"4px 8px",textAlign:"left",color:V,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",backgroundColor:M,position:"sticky",top:0,zIndex:1},ye={padding:"3px 8px",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:J};return a.jsxs("div",{style:ve,children:[a.jsxs("div",{style:Ce,children:[a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Balance:"}),a.jsxs("span",{style:{...Ge,color:J},children:["$",se(re)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Equity:"}),a.jsxs("span",{style:{...Ge,color:ce>=re?F:S},children:["$",se(ce)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Margin:"}),a.jsxs("span",{style:{...Ge,color:J},children:["$",se(Z)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Free Margin:"}),a.jsxs("span",{style:{...Ge,color:Ae>=0?J:S},children:["$",se(Ae)]})]}),a.jsxs("div",{style:{...be,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Le,children:"Margin Level:"}),a.jsx("span",{style:{...Ge,color:oe>=100?F:S},children:Z>0?oe.toFixed(2)+"%":"—"})]}),ie.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Le,children:"Float P/L:"}),a.jsxs("span",{style:{...Ge,color:le>=0?F:S,fontWeight:700},children:[le>=0?"+":"",se(le)]})]})]}),a.jsxs("div",{style:Ke,children:[a.jsx("button",{style:Te(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:Te(U==="history"),onClick:()=>c&&c(!0),children:"History"})]}),U==="trade"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:_e,children:"Symbol"}),a.jsx("th",{style:_e,children:"Ticket"}),a.jsx("th",{style:_e,children:"Time"}),a.jsx("th",{style:_e,children:"Type"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{..._e,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:ie.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...ye,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):ie.map(de=>{const Pe=de.livePnL??de.profit??0,et=Pe>=0?F:S;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=ne,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:J,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...ye,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:V},children:Qe(de.openAt||de.time)}),a.jsx("td",{style:{...ye,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:S},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(de.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(de.price??de.openPrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.stopLoss?S:V},children:de.stopLoss?ae(de.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?ae(de.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:V},children:de.currentPrice?ae(de.currentPrice):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:et},children:pe(Pe)}),a.jsx("td",{style:{...ye,textAlign:"center"},children:a.jsx("button",{onClick:it=>Be(it,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:V,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:it=>it.currentTarget.style.color="#f59e0b",onMouseLeave:it=>it.currentTarget.style.color=V,children:"✎"})}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:et},children:a.jsx("button",{onClick:it=>Fe(it,de),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:it=>it.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:it=>it.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},de.id)})})]})}),U==="history"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:_e,children:"Symbol"}),a.jsx("th",{style:_e,children:"Ticket"}),a.jsx("th",{style:_e,children:"Open Time"}),a.jsx("th",{style:_e,children:"Type"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:_e,children:"Close Time"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{..._e,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:b.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...ye,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):b.map(de=>{const Pe=de.profit??0,et=Pe>=0?F:S;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=ne,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:J,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...ye,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:V},children:Qe(de.openAt)}),a.jsx("td",{style:{...ye,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:S},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(de.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(de.openPrice)}),a.jsx("td",{style:{...ye,color:V},children:Qe(de.closeAt)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ae(de.closePrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.stopLoss?S:V},children:de.stopLoss?ae(de.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?ae(de.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:et},children:pe(Pe)})]},de.id)})})]})})]})},JT="2.3.2";Ye.AccountPanel=XT,Ye.BuySellPanel=Gh,Ye.Chart=FT,Ye.ChartTypeSelector=IT,Ye.CoinSelector=wp,Ye.DrawingTools=vp,Ye.LeftSidebar=VT,Ye.MarketExecutionModal=$h,Ye.MarketWatch=$T,Ye.PositionsPanel=_T,Ye.SYMBOL_CONFIG=ll,Ye.StopLoss=yp,Ye.TakeProfit=Cp,Ye.TimeframeSelector=MT,Ye.ToolCustomizationModal=qh,Ye.TopBar=KT,Ye.TradePanel=DT,Ye.TradingProvider=P1,Ye.TradingToolbar=ET,Ye.VolumeControl=Bp,Ye.alignToTimeframe=ke,Ye.calcBollingerBands=gl,Ye.calcLiveBollingerBands=Rs,Ye.detectGaps=Ip,Ye.getSymbolConfig=nr,Ye.is24x7Symbol=Hp,Ye.isCryptoSymbol=tn,Ye.isForexSymbol=en,Ye.isWithinTradingSession=Dp,Ye.normalizeCandleTimes=hl,Ye.normalizeTime=ee,Ye.processCandles=fl,Ye.processSingleCandle=ml,Ye.setSocketBaseUrl=Oh,Ye.timeframeToSeconds=uA,Ye.useTrading=zt,Ye.validateTimeOrdering=_p,Ye.version=JT,Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"})}));