@nabeeltahirdeveloper/chart-sdk 2.3.13-beta → 2.3.14-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(je,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(je=typeof globalThis<"u"?globalThis:je||self,a(je.ChartSDK={},je.jsxRuntime,je.React))})(this,(function(je,a,ie){"use strict";var bs=typeof document<"u"?document.currentScript:null;const _t="17:00-17:00",Pt="America/New_York",wA="24x7",BA="UTC",Va={EURUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},ETHUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},BNBUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},SOLUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},ADAUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},XRPUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},DOTUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},MATICUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"},LINKUSDT:{type:"crypto",session:wA,sessionTZ:BA,priceMode:"last"}},za={type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"};function Oi(i){return i&&Va[i.toUpperCase()]||za}function _r(i){return Oi(i).type==="forex"}function Pr(i){return Oi(i).type==="crypto"}function op(i){return Oi(i).session==="24x7"}function q(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 ap(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 lp(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 Wa(i){return Array.isArray(i)?i.map(e=>({...e,time:q(e.time)})).filter(e=>e.time!=null):[]}function cp(i){if(!i||i.length<2)return!0;for(let e=1;e<i.length;e++)if(i[e].time<=i[e-1].time)return!1;return!0}function We(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function Ra(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(q(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 Ga(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 $a(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=q(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 hp(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 up(i,e){if(!Array.isArray(i)||i.length===0)return i;const t=[],A=Math.max(e*10080,604800),r=1e4;for(let o=0;o<i.length;o++)if(t.push(i[o]),o<i.length-1){const l=i[o].time,c=i[o+1].time,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const m=i[o];let y=l+e,v=0;for(y=We(y,e);y<c&&v<r;){const T=We(y,e);t.some(S=>S.time===T)||(t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),v++),y+=e}if(y<c&&v>=r){const T=We(c-e,e);t.some(S=>S.time===T)||t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function tA(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 Xa(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=Oi(e),r=tA(t),o=Wa(i).map(U=>({...U,time:We(U.time,r)})).filter(U=>Ra(U)).map(U=>Ga(U)),l=$a(o);l.sort((U,k)=>U.time-k.time);const c=Math.floor(Date.now()/1e3),u=l.filter(U=>U.time<=c),m=u.filter((U,k)=>k===0?!0:U.time>u[k-1].time),y=m.length>10?hp(m,"percentile"):m,v=$a(y);v.sort((U,k)=>U.time-k.time);const T=up(v,r),B=[];for(let U=1;U<T.length;U++){const k=T[U].time-T[U-1].time;k>r*2&&B.push({from:T[U-1].time,to:T[U].time,gapSeconds:k,gapMinutes:Math.round(k/60),fromDate:new Date(T[U-1].time*1e3).toISOString(),toDate:new Date(T[U].time*1e3).toISOString()})}const S=y.filter((U,k)=>k===0?!1:U.close===y[k-1].close&&U.open===y[k-1].close).length,F={original:i.length,processed:T.length,duplicates:i.length-l.length,outliers:S,gaps:B,filledGaps:T.length-v.length,symbolConfig:A};return{candles:T,stats:F}}function Za(i,e,t="1m"){if(!i||!e||!Ra(i))return null;const A=q(i.time);if(A==null)return null;const r=tA(t),n=We(A,r);return Ga({...i,time:n})}function pt(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 jA(i,e){return i.width===e.width&&i.height===e.height}var dp=(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 pp(i){return new dp(i)}var fp=(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=pt({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 pt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=pt(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;jA(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=pt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=jA(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&jA(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}mp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=Ja(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=pp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=Ja(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):pt({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=pt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function gp(i,e){return new fp(i,e.transform,e.options)}function Ja(i){return i.ownerDocument.defaultView}function mp(){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 pt({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 Bp=(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 ei(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 Bp(r,t,A)}const yp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Cp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},vp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Tp={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},xp={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},bp={color:"#26a69a",base:0},Ya={color:"#2196f3"},qa={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 ja,el;function ti(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 kA(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function Vt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Le(i){if(i===null)throw new Error("Value is null");return i}function wi(i){return Le(Vt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(ja||(ja={})),(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"})(el||(el={}));const Al={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 rA(i){return i<0?0:i>255?255:Math.round(i)||0}function il(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,Fp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Up=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Sp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function Ki(i){(i=i.toLowerCase())in Al&&(i=Al[i]);{const e=Sp.exec(i)||Up.exec(i);if(e)return[rA(parseInt(e[1],10)),rA(parseInt(e[2],10)),rA(parseInt(e[3],10)),il(e.length<5?1:parseFloat(e[4]))]}{const e=Fp.exec(i);if(e)return[rA(parseInt(e[1],16)),rA(parseInt(e[2],16)),rA(parseInt(e[3],16)),1]}{const e=Qp.exec(i);if(e)return[rA(17*parseInt(e[1],16)),rA(17*parseInt(e[2],16)),rA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function rl(i){return .199*i[0]+.687*i[1]+.114*i[2]}function kr(i){const e=Ki(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:rl(e)>160?"black":"white"}}class yt{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 uA(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]:uA(i[A],t[A]));return i}function yA(i){return typeof i=="number"&&isFinite(i)}function Vi(i){return typeof i=="number"&&i%1==0}function zi(i){return typeof i=="string"}function Nr(i){return typeof i=="boolean"}function MA(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"?MA(r):r);return t}function Ep(i){return i!==null}function Wi(i){return i===null?void 0:i}const Qs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Bi(i,e,t){return e===void 0&&(e=Qs),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Lp{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=Bi(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 Fs{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class dA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class Mp extends dA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const u=n.it[c],m=Math.round(u.nt*t)+s,y=u.st*A,v=l*A+s;e.moveTo(m,y),e.arc(m,y,v,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function Hp(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Ip={from:0,to:1};class Dp{constructor(e,t){this.ut=new Fs,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(Hp),this.ct=this.dt.map((A=>{const r=new Mp;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=Le(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=Ip}))}}let _p=class extends dA{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,ti(e,this.zt.Lt.Nt),(function(c,u,m,y){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,m),c.lineTo(u+v,y),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,ti(e,this.zt.Et.Nt),tl(e,l,0,t.width))}};class Pp{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 _p(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=Le(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 kp(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 Or(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function nl(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 sl(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return nl(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;nl(i,e+c,t+c,A-s,r-s,(u=-c,o.map((m=>m===0?m:m+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function ol(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 al{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,A,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const u=this.Gt(l,t,A,r),m=u.Jt;return u.Qt?sl(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):sl(c,m.ri,m.ii,m.ni,m.si,s,m.ei,[0,m.ht,m.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(m.ri,m.li,m.ai-m.ri,m.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(u.Qt?m.ui-m.ei:0,m.ii,m.ei,m.ci-m.ii)),u}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,m=this.zt.hi||!this.zt.mi?t.T:0,y=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,T=t.B+this.Xt.gi,B=t.A,S=t.I,F=this.zt.Kt,U=t.P,k=A.Mi(s,F),R=Math.ceil(A.xi(s,F)),L=U+v+T,z=t.C+B+S+R+m,te=Math.max(1,Math.floor(u));let $=Math.round(L*u);$%2!=te%2&&($+=1);const V=y>0?Math.max(1,Math.floor(y*c)):0,Ae=Math.round(z*c),re=Math.round(m*c),le=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,X=Math.round(le*u)-Math.floor(.5*u),j=Math.floor(X+te/2-$/2),oe=j+$,ae=r==="right",se=ae?l.width-y:y,ce=ae?o.width-V:V;let de,we,Qe;return ae?(de=ce-Ae,we=ce-re,Qe=se-m-B-y):(de=ce+Ae,we=ce+re,Qe=se+m+B),{Qt:ae,Jt:{ii:j,li:X,ci:oe,ni:Ae,si:$,ht:2*c,ei:V,ti:de,ri:ce,ai:we,oi:te,ui:o.width},di:{ii:j/u,ci:oe/u,fi:Qe,pi:k}}}}class Kr{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||al)(this.Ci,this.yi),this.Ri=new(e||al)(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 Np extends Kr{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=kr(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 Op=/[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:y})=>(y.font=t.R,Math.round(t.Wi.xi(y,Le(this.zt).Kt,Op)))));if(A<=0)return;const r=t.ji,n=A+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const u=c+n,m=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:y,horizontalPixelRatio:v,verticalPixelRatio:T})=>{const B=Le(this.zt);y.fillStyle=B.t;const S=Math.round(c*v),F=Math.round(0*T),U=Math.round(u*v),k=Math.round(m*T),R=Math.round(2*v);if(y.beginPath(),y.moveTo(S,F),y.lineTo(S,k-R),y.arcTo(S,k,S+R,k,R),y.lineTo(U-R,k),y.arcTo(U,k,U,k-R,R),y.lineTo(U,F),y.fill(),B.hi){const L=Math.round(B.ki*v),z=F,te=Math.round((z+t.T)*T);y.fillStyle=B.V;const $=Math.max(1,Math.floor(v)),V=Math.floor(.5*v);y.fillRect(L-V,z,$,te-z)}})),e.useMediaCoordinateSpace((({context:y})=>{const v=Le(this.zt),T=0+t.C+t.T+t.L+t.P/2;y.font=t.R,y.textAlign="left",y.textBaseline="middle",y.fillStyle=v.V;const B=t.Wi.Mi(y,"Apr0");y.translate(c+r,T+B),y.fillText(v.Kt,0,0)}))}}class Kp{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(Le(n)),e.yt=!0;const s=kr(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Us{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 cl;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(cl||(cl={}));class Vp extends Us{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 Dp(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Le(this.tn).vn())return{_t:l,ki:o};{const c=Le(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 Kp(this,e,A),this.wn=new Pp(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(Ep),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 Np(this,t,A),e.set(t,r)),r}}function Vr(i){return i==="left"||i==="right"}class Et{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 Et(2)}static es(){return new Et(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 HA(i,e){if(!yA(i))return"n/a";if(!Vi(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 zr{constructor(e,t){if(t||(t=1),yA(e)&&Vi(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+HA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=hl+HA(0,n));return A.toFixed(0)+r}}class ul extends zr{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class zp{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 m=n(i,u),y=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const T={nt:u.nt-v,st:u.st},B={nt:u.nt+v,st:u.st};o.moveTo(T.nt*l,T.st*c),o.lineTo(B.nt*l,B.st*c),s(i,m,T,B)}else{const v=(B,S)=>{s(i,m,y,S),o.beginPath(),m=B,y=S};let T=y;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let B=A.from+1;B<A.to;++B){T=e[B];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[B-1].st*c),S!==m&&(v(S,T),o.lineTo(T.nt*l,e[B-1].st*c)),o.lineTo(T.nt*l,T.st*c);break;case 2:{const[F,U]=Wp(e,B-1,B);o.bezierCurveTo(F.nt*l,F.st*c,U.nt*l,U.st*c,T.nt*l,T.st*c);break}}t!==1&&S!==m&&(v(S,T),o.moveTo(T.nt*l,T.st*c))}(y!==T||y===T&&t===1)&&s(i,m,y,T)}}const pl=6;function Ss(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function fl(i,e){return{nt:i.nt/e,st:i.st/e}}function Wp(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=fl(Ss(i[t],i[A]),pl),{nt:n.nt+s.nt,st:n.st+s.st}),Ss(i[t],fl(Ss(i[r],i[e]),pl))]}function Rp(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 gl extends dA{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,ti(u,o),u.lineWidth=1,dl(e,A,l,r,n,this.bs.bind(this),Rp.bind(null,c))}}function Es(i,e,t){return Math.min(Math.max(i,e),t)}function Wr(i,e,t){return e-i<=t}function ml(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Ls{ws(e,t){const A=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==r||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==l){const u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const m=Es(c*e.verticalPixelRatio/l,0,1);u.addColorStop(m,n),u.addColorStop(m,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class Gp extends gl{constructor(){super(...arguments),this.Ts=new Ls}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function $p(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class wl extends dA{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,ti(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&dl(e,t,n,A,r,u,$p),l&&(function(m,y,v,T,B){const{horizontalPixelRatio:S,verticalPixelRatio:F,context:U}=m;let k=null;const R=Math.max(1,Math.floor(S))%2/2,L=v*F+R;for(let z=T.to-1;z>=T.from;--z){const te=y[z];if(te){const $=B(m,te);$!==k&&(U.beginPath(),k!==null&&U.fill(),U.fillStyle=$,k=$);const V=Math.round(te.nt*S)+R,Ae=te.st*F;U.moveTo(V,Ae),U.arc(V,Ae,L,0,2*Math.PI)}}U.fill()})(e,t,l,A,u)}}class Bl extends wl{Vs(e,t){return t.lt}}function yl(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 Ri=yl.bind(null,!0),Cl=yl.bind(null,!1);function Xp(i,e){return i.ot<e}function Zp(i,e){return e<i.ot}function vl(i,e,t){const A=e.Os(),r=e.ui(),n=Ri(i,A,Xp),s=Cl(i,r,Zp);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 Ms{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 Rr extends Ms{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,Wi(this.Ls)),e.te(this.zs,A,Wi(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 Jp extends Rr{constructor(e,t){super(e,t),this.js=new Fs,this.re=new Gp,this.he=new Bl,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 Yp extends dA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),u=c-l,m=this.oe,y=u+m-1,v=Math.min(o.de,o.fe),T=Math.max(o.de,o.fe),B=Math.round(v*A)-l,S=Math.round(T*A)+l,F=Math.max(S-B,this.oe);e.fillRect(u,B,m,F);const U=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-U;let te=Math.max(B,Math.round(o.pe*A)-l),$=te+m-1;$>B+F-1&&($=B+F-1,te=$-m+1),e.fillRect(z,te,u-z,$-te+1)}const k=c+U;let R=Math.max(B,Math.round(o.me*A)-l),L=R+m-1;L>B+F-1&&(L=B+F-1,R=L-m+1),e.fillRect(y+1,R,k-y,L-R+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Le(this.zt).le,e)))}}class Tl extends Ms{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,Wi(this.Ls)),e.be(this.zs,A,Wi(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 qp extends Tl{constructor(){super(...arguments),this.js=new Yp}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 jp extends gl{constructor(){super(...arguments),this.Ts=new Ls}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 ef extends wl{constructor(){super(...arguments),this.Pe=new Ls}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 tf extends Rr{constructor(e,t){super(e,t),this.js=new Fs,this.Ve=new jp,this.Oe=new ef,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 Af extends dA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),l=Math.floor(n*o*s),c=Math.floor(n*s),u=Math.min(l,c);return Math.max(Math.floor(s),u)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",l=Math.min(Math.floor(n),Math.floor(this.zt.le*n));l=Math.max(Math.floor(n),Math.min(l,this.ae));const c=Math.floor(.5*l);let u=null;for(let m=A.from;m<A.to;m++){const y=t[m];y.Ee!==o&&(r.fillStyle=y.Ee,o=y.Ee);const v=Math.round(Math.min(y.pe,y.me)*s),T=Math.round(Math.max(y.pe,y.me)*s),B=Math.round(y.de*s),S=Math.round(y.fe*s);let F=Math.round(n*y.nt)-c;const U=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,U));const k=U-F+1;r.fillRect(F,B,k,v-B),r.fillRect(F,T+1,k,S-T),u=U}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const A=Math.max(Math.floor(e),t);return this.ae<=2*A?Math.max(Math.floor(e),Math.floor(1*e)):A}Ie(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let u=A.from;u<A.to;u++){const m=t[u];m.Ne!==o&&(r.fillStyle=m.Ne,o=m.Ne);let y=Math.round(m.nt*n)-Math.floor(.5*this.ae);const v=y+this.ae-1,T=Math.round(Math.min(m.pe,m.me)*s),B=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(y=Math.max(c+1,y),y=Math.min(y,v)),this.zt.le*n>2*l)kp(r,y,T,v-y+1,B-T+1,l);else{const S=v-y+1;r.fillRect(y,T,S,B-T+1)}c=v}}Le(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=A.from;c<A.to;c++){const u=t[c];let m=Math.round(Math.min(u.pe,u.me)*s),y=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),T=v+this.ae-1;if(u.ce!==o){const B=u.ce;r.fillStyle=B,o=B}this.zt._i&&(v+=l,m+=l,T-=l,y-=l),m>y||r.fillRect(v,m,T-v+1,y-m+1)}}}class rf extends Tl{constructor(){super(...arguments),this.js=new Af}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 nf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Hs extends Ms{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new nf(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,Wi(this.Ls))}Js(){this.wn.update({bars:this.zs.map(sf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function sf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class of extends dA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],u=Math.round(l.st*A);let m,y;e.fillStyle=l.ce,u<=n?(m=u,y=s):(m=n,y=u-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,y-m)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,c;if(A%2){const u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class af extends Rr{constructor(){super(...arguments),this.js=new of}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,Le(this.Es.Ct()).Vt)};this.js.J(e)}}class lf extends Rr{constructor(){super(...arguments),this.js=new Bl}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 cf=/[2-9]/g;class Gi{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||cf,n=String(t).replace(r,"0");if(this.tr.has(n))return Vt(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 hf{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 xl{constructor(e,t,A){this.ur=e,this.ar=new Gi(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new hf(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 uf extends dA{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),ti(e,this.zt.Nt),tl(e,n,0,t.width))}}class Is{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new uf,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 df extends Is{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 pf extends dA{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 ff=[{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 bl(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=Ki(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Ql(i,e){const t=i%2600/2600;let A;for(const l of ff)if(t>=l.Vr&&t<=l.Or){A=l;break}kA(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:bl(e,r,A.Ir,A.zr),Dr:bl(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class gf{constructor(e){this.Wt=new pf,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=Ql(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=Ql(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 $i(i,e){return ml(Math.min(Math.max(i,12),30)*e)}function Xi(i,e){switch(i){case"arrowDown":case"arrowUp":return $i(e,1);case"circle":return $i(e,.8);case"square":return $i(e,.7)}}function Fl(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})($i(i,1))}function Ul(i){return Math.max($i(i,.1),3)}function Sl(i,e,t){return e?i:t?Math.ceil(i/2):0}function El(i,e,t,A,r){const n=Xi("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function Ll(i,e,t,A){const r=(Xi("arrowUp",A)-1)/2*t.Jr,n=(ml(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 mf(i,e,t,A,r,n){return El(e,t,A,r,n)}class wf extends dA{constructor(){super(...arguments),this.zt=null,this.ar=new Gi,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=Bi(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(yf(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),Bf(o,e,t,A)}}}}function Bf(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 Ll(!1,n,s,r.Ks);case"arrowUp":return void Ll(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(Xi("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=Xi("square",c),m=(u-1)*l.Jr/2,y=l.nt-m,v=l.st-m;o.fillRect(y,v,u*l.Jr,u*l.Jr)})(n,s,r.Ks)}r.nh}})(i,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(i,t,A))}function yf(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 mf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const m=2+Xi("circle",l)/2,y=s-c,v=o-u;return Math.sqrt(y*y+v*v)<=m})(A.nt,A.st,A.Ks,r,n);case"square":return El(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function Cf(i,e,t,A,r,n,s,o,l){const c=yA(t)?t:t.Se,u=yA(t)?t:t.Me,m=yA(t)?t:t.xe,y=yA(e.size)?Math.max(e.size,0):1,v=Fl(o.le())*y,T=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-T-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-T-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(m,l)+T+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class vf{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=Ul(e),A=1.5*Fl(e)+2*t,r=this.fh();this.ah={above:Sl(A,r.aboveBar,r.inBar),below:Sl(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=Ul(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 m=A[u];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const y=this.zt.it[u];y.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(y.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(m.time);v!==null&&Cf(y,m,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Tf extends Is{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 Kr{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const u=r.mh(c.V),m=kr(u);A.t=m.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=m.i,t.V=m.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function Ml(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 $t{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 $t(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 $t(Ml(Math.min,this.Ph(),e.Ph(),-1/0),Ml(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!yA(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){yA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new $t(e.minValue,e.maxValue)}}class Gr{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 Gr($t.Ah(e.priceRange),e.margins)}}class bf extends Is{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 Kr{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=kr(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 Ff{constructor(e,t){this.jr=e,this.cn=t,this.jh=new bf(e,this),this.ur=new Qf(e,this),this.Hh=new xl(this.ur,e,e.$t())}$h(e){uA(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 Uf extends Us{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Sf={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Le(i(t,A)),l=wi(o.Vt[0])<=wi(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,u=e.borderDownColor,m=e.wickUpColor,y=e.wickDownColor,v=Le(i(t,A)),T=wi(v.Vt[0])<=wi(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:T?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:T?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:T?m:y}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Le(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Le(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=Le(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=Le(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=Le(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class Ef{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Sf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var Hl;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(Hl||(Hl={}));const NA=30;class Lf{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=$r(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 Ri(this.tl,e,((t,A)=>t.ee<A))}vl(e){return Cl(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=Le(this.el()),s=Le(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/NA)*NA,u=Math.max(c,Math.floor(l/NA)*NA);{const y=this.fl(o),v=this.vl(Math.min(l,c,t));r=$r(r,this.pl(y,v,A))}let m=this.il.get(A);m===void 0&&(m=new Map,this.il.set(A,m));for(let y=Math.max(c+1,o);y<u;y+=NA){const v=Math.floor(y/NA);let T=m.get(v);if(T===void 0){const B=this.fl(v*NA),S=this.vl((v+1)*NA-1);T=this.pl(B,S,A),m.set(v,T)}r=$r(r,T)}{const y=this.fl(u),v=this.vl(l);r=$r(r,this.pl(y,v,A))}return r}}function $r(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class Mf{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 Ds{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 Mf(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 Il(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 Hf{constructor(e,t){this.Wt=new ll,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Il(this.kl))),this.Wt}}class If extends Kr{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Il(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 Df{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 Ds(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 Hf(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 If(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 Ds(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 Ds(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 _s(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function Ps(i){return i.Pn()}function _f(i){return i.Bl()}function Pf(i){return i.Al()}class ks extends Uf{constructor(e,t,A,r,n){super(e),this.zt=new Lf,this.jh=new Tf(this),this.zl=[],this.Ll=new df(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 xl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new gf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},A=this.Dt();if(this.$t().St().Ni()||A.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const m=this.zt.sl();if(m===null)return t;s=m,o=m.ee}else{const m=this.zt.ll(r.ui(),-1);if(m===null||(s=this.zt.Gh(m.ee),s===null))return t;o=m.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),u=A.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:A.Fi(l,n.Vt),xh:A.Yl(l),Sh:A.Zl(l,n.Vt),V:c.ce,ki:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new Ef(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),uA(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 Ff(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=[];_s(this.Hl,Ps,"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),_s(this.Hl,Ps,"normal",e),e}ua(){return this.ca(Ps,"bottom")}da(e){return this.ca(_f,e)}fa(e){return this.ca(Pf,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 Gr.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 Le(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 Df(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Hs)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Hs)return e=>this.wn.je(e)}_a(){return!Vr(this.Dt().Pa())}pa(e,t){if(!Vi(e)||!Vi(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 $t(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new $t(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 $t(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,m,y;l?.margins&&(c=s,u=l.margins,s={above:Math.max((m=c?.above)!==null&&m!==void 0?m:0,u.above),below:Math.max((y=c?.below)!==null&&y!==void 0?y:0,u.below)})})),new Gr(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 zp(this.cn.priceFormat.precision);break;case"percent":this.wa=new ul(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new zr(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=Le(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Le(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Le(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 vf(this,this.$t()),this.$l){case"Bar":this.wn=new qp(this,this.$t());break;case"Candlestick":this.wn=new rf(this,this.$t());break;case"Line":this.wn=new lf(this,this.$t());break;case"Custom":this.wn=new Hs(this,this.$t(),Vt(e));break;case"Area":this.wn=new Jp(this,this.$t());break;case"Baseline":this.wn=new tf(this,this.$t());break;case"Histogram":this.wn=new af(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return _s(this.Hl,e,t,A),A}}class kf{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 ks)).reduce(((u,m)=>{if(A.vr(m)||!m.yt())return u;const y=m.Dt(),v=m.In();if(y.Ni()||!v.Kr(t))return u;const T=v.Gh(t);if(T===null)return u;const B=wi(m.Ct());return u.concat([y.Rt(T.Vt[3],B.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,m)=>Math.abs(u-o)-Math.abs(m-o)));const c=l[0];return r=n.pn(c,s),r}}class Nf extends dA{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=Le(this.zt);if(s.Aa){e.strokeStyle=s.Ia,ti(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,ti(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 Of{constructor(e){this.Wt=new Nf,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 Kf{constructor(e){this.wn=new Of(e)}qh(){return this.wn}}const Ns={$a:4,Ua:1e-4};function yi(i,e){const t=100*(i-e)/e;return e<0?-t:t}function Vf(i,e){const t=yi(i.Ph(),e),A=yi(i.Rh(),e);return new $t(t,A)}function Zi(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function zf(i,e){const t=Zi(i.Ph(),e),A=Zi(i.Rh(),e);return new $t(t,A)}function Xr(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 Ji(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 Yi(i,e){if(i===null)return null;const t=Xr(i.Ph(),e),A=Xr(i.Rh(),e);return new $t(t,A)}function Zr(i,e){if(i===null)return null;const t=Ji(i.Ph(),e),A=Ji(i.Rh(),e);return new $t(t,A)}function Os(i){if(i===null)return Ns;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return Ns;const t=Math.ceil(Math.abs(Math.log10(e))),A=Ns.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class Ks{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let r=A;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let A=this.qa;A!==1;){if(A%2==0)this.Za.push(2),A/=2;else{if(A%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),A/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,A){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const m=Wr(n,r,1e-14)&&n>r+1e-14,y=Wr(n,A*o,1e-14),v=Wr(n,1,1e-14);if(!(m&&y&&v))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];Wr(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 Dl{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 Ks(this.qa,[2,2.5,2]),s=new Ks(this.qa,[2,2,2.5]),o=new Ks(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let u=c[0];for(let m=1;m<c.length;++m)c[m]<u&&(u=c[m]);return u})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),r=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=A-1-s,c=Math.max(r,n),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let m=this.Xa(c,u),y=c%m;y+=y<0?m:0;const v=c>=u?1:-1;let T=null,B=0;for(let S=c-y;S>u;S-=m){const F=this.Ja(S,t,!0);T!==null&&Math.abs(F-T)<this.Qa()||F<o||F>l||(B<this.Ka.length?(this.Ka[B].Ea=F,this.Ka[B].so=e.eo(S)):this.Ka.push({Ea:F,so:e.eo(S)}),B++,T=F,e.ro()&&(m=this.Xa(S*v,u)))}this.Ka.length=B}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function _l(i){return i.slice().sort(((e,t)=>Le(e.Xi())-Le(t.Xi())))}var Pl;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(Pl||(Pl={}));const kl=new ul,Nl=new zr(100,1);class Wf{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 yt,this.vo=new yt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=Nl,this.xo=Os(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Dl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(uA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=Vt(e.scaleMargins.top),A=Vt(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=Ji(n.Ph(),s),l=Ji(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=Zr(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=Yi(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=yi(e,t):this.Oo()&&(e=Zi(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Le(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const B=e[T],S=B._t;if(isNaN(S))continue;let F=S;v!==null&&(F=v(B._t,t));const U=r+u*(F-s),k=c?U:this.ho-1-U;B.st=k}}be(e,t,A){this.Wo();const r=this.Fo(),n=Le(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const B=e[T];let S=B.ge,F=B.Me,U=B.xe,k=B.Se;v!==null&&(S=v(B.ge,t),F=v(B.Me,t),U=v(B.xe,t),k=v(B.Se,t));let R=r+u*(S-s),L=c?R:this.ho-1-R;B.pe=L,R=r+u*(F-s),L=c?R:this.ho-1-R,B.de=L,R=r+u*(U-s),L=c?R:this.ho-1-R,B.fe=L,R=r+u*(k-s),L=c?R:this.ho-1-R,B.me=L}}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=_l(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=Le(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=Le(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=Le(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Le(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Le(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_(yi(e,t));case 3:return this.ba().format(Zi(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,Le(this.e_()).ba())}Zl(e,t){return e=yi(e,t),this.s_(e,kl)}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=Nl,this.Mh()?(this.wa=kl,t=100):this.Oo()?(this.wa=new zr(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Dl(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?Xr(e,this.xo):e;const A=Le(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=Le(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?Ji(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const A=this.r_();let r=0,n=0;for(const l of A){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const u=l.Il(e.Os(),e.ui());let m=u&&u.Lh();if(m!==null){switch(this.cn.mode){case 1:m=Yi(m,this.xo);break;case 2:m=Vf(m,c.Vt);break;case 3:m=zf(m,c.Vt)}if(t=t===null?m:t.ts(Le(m)),u!==null){const y=u.Eh();y!==null&&(r=Math.max(r,y.above),n=Math.max(n,y.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=Zr(t,this.xo)),t=new $t(t.Ph()-c,t.Rh()+c),this.ro()&&(t=Yi(t,this.xo))}if(this.ro()){const l=Zr(t,this.xo),c=Os(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?Zr(this.ao,this.xo):null;this.xo=c,t=Yi(l,c),u!==null&&(this.ao=Yi(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new $t(-.5,.5)),this.xo=Os(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?yi:this.Oo()?Zi:this.ro()?e=>Xr(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 Rf{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new yt,this.yl=e,this.$i=t,this.d_=new Kf(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=Le(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)?Vt(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);kA(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Le(e.Dt()).Pa();if(this.o_.has(A)){const n=Vt(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=_l(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),!Vr(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},MA(t)),r=new Wf(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class Gf{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(Vt(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 qi{constructor(e,t){kA(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 Ol(i,e){return i===null||e===null?i===e:i.Ch(e)}class $f{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(Ri(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=Vt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let m=0;m<l;m++){const y=o[m],v=y.index;for(;s<n;){const T=r[s],B=T.index;if(!(B<v)){c=B;break}s++,t.push(T),u=B,c=1/0}if(c-v>=e&&v-u>=e)t.push(y),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class Ci{constructor(e){this.hu=e}lu(){return this.hu===null?null:new qi(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Ci(null)}}function Xf(i,e){return i.weight>e.weight?i:e}class Zf{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new $f,this.du=new Map,this.fu=Ci.ou(),this.vu=!0,this.pu=new yt,this.mu=new yt,this.bu=new yt,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){uA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;uA(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=Ri(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=Le(this.Bu()),n=Le(this.Au());return{from:Le(this.Ui(Math.max(r,t))),to:Le(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Le(this.Va(e.from,!0)),to:Le(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()||!Vi(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=Le(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,u=this.$u(),m=this.cn.fixLeftEdge||u,y=this.cn.fixRightEdge||u;let v=0;for(const T of o){if(!(n<=T.index&&T.index<=s))continue;let B;v<this.Mu.length?(B=this.Mu[v],B.coord=this.It(T.index),B.label=this.Uu(T),B.weight=T.weight):(B={needAlignCoordinate:!1,coord:this.It(T.index),label:this.Uu(T),weight:T.weight},this.Mu.push(B)),this.Su>t/2&&!u?B.needAlignCoordinate=!1:B.needAlignCoordinate=m&&T.index<=l||y&&T.index>=c,v++}return this.Mu.length=v,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const A=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(A-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const t=Es(this.__-e,0,this.__),A=Es(this.__-Le(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=Le(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 qi(e,t+this.cn.rightOffset))}lc(e){const t=new qi(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(Ci.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new qi(A-t+1,A);this._c(new Ci(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 Gf((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,Ol(t.lu(),this.fu.lu())||this.pu.m(),Ol(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 Jf{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 Yf extends Jf{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 qf{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Yf(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:Bi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class jf extends Us{constructor(e,t){super(),this.cn=t,this.wn=new qf(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Kl,Vl,zl,Wl,Rl;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(Kl||(Kl={}));class e0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new yt,this.Rc=new yt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Lp(this),this.yl=new Zf(this,t.timeScale,this.cn.localization,A),this.vt=new Vp(this,t.crosshair),this.Bc=new kf(t.crosshair),this.Ac=new jf(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Et.es())}Uh(){this.Nc(Et.ss())}oa(){this.Nc(new Et(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){uA(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 Rf(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=Et.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,Le(n)),o=this.yl.Va(t,!0),l=this.yl.It(Le(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),u=e!==null&&e>s&&!c,m=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,y=l&&(A!==void 0||m)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!y){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.S())),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(e,t,A){const r=this.yc[0],n=this.fd(t,e,r,A);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),A=this.Cc.indexOf(e);kA(A!==-1,"Series not found"),this.Cc.splice(A,1),Le(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Le(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=Et.ss();e.$n(),this.Nc(e)}pd(e){const t=Et.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Et.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Et.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Et.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Et.ss();t.Zn(e),this.Nc(t)}Un(){const e=Et.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,u,m]=Ki(n),[y,v,T,B]=Ki(s),S=[rA(l+o*(y-l)),rA(c+o*(v-c)),rA(u+o*(T-u)),il(m+o*(B-m))];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 Et(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 ks(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),Vr(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 Vs(i){return!yA(i)&&!zi(i)}function Gl(i){return yA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(Vl||(Vl={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(zl||(zl={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(Wl||(Wl={})),(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"})(Rl||(Rl={}));const $l=i=>i.getUTCFullYear();function t0(i,e,t){return e.replace(/yyyy/g,(A=>HA($l(A),4))(i)).replace(/yy/g,(A=>HA($l(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=>HA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>HA((r=>r.getUTCDate())(A),2))(i))}class Xl{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return t0(e,this.gd,this.Md)}}class A0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",HA(e.getUTCHours(),2)).replace("%m",HA(e.getUTCMinutes(),2)).replace("%s",HA(e.getUTCSeconds(),2))}}const i0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class r0{constructor(e={}){const t=Object.assign(Object.assign({},i0),e);this.Td=new Xl(t.Sd,t.Cd),this.Pd=new A0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function Jr(i){return 60*i*60*1e3}function zs(i){return 60*i*1e3}const Yr=[{Dd:(Zl=1,1e3*Zl),Vd:10},{Dd:zs(1),Vd:20},{Dd:zs(5),Vd:21},{Dd:zs(30),Vd:22},{Dd:Jr(1),Vd:30},{Dd:Jr(3),Vd:31},{Dd:Jr(6),Vd:32},{Dd:Jr(12),Vd:33}];var Zl;function Jl(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=Yr.length-1;t>=0;--t)if(Math.floor(e.getTime()/Yr[t].Dd)!==Math.floor(i.getTime()/Yr[t].Dd))return Yr[t].Vd;return 0}function Ws(i){let e=i;if(zi(i)&&(e=Rs(i)),!Vs(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 Yl(i){if(!Gl(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function Rs(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 ql(i){zi(i.time)&&(i.time=Rs(i.time))}class jl{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(ql)})(e):ql(e)}createConverterToInternalObj(e){return Le((function(t){return t.length===0?null:Vs(t[0].time)||zi(t[0].time)?Ws:Yl})(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 Gl(t=e)?Yl(t):Vs(t)?Ws(t):Ws(Rs(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new r0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Xl(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(Xf,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=Jl(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=Jl(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return uA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const vi=typeof window<"u";function ec(){return!!vi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Gs(){return!!vi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function $s(i){return i+i%2}function Xs(i,e){return i.zd-e.zd}function Zs(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class n0{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=Zs(this.Ld,this.Ed,this.Ud),n=Xs(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=Zs(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=Xs(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const m=Zs(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const y=Xs(this.Nd,this.Fd);s.push(m),o.push(y),A+=y}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/A*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,u){const m=Math.log(u);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Le(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-Le(this.Wd).ot;return Math.min(t,this.jd)}}class s0{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 rl(Ki(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 Ai(i,e){const t=Le(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=gp(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 ii(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function Js(i,e,t,A){i.gl&&i.gl(e,t,A)}function qr(i,e,t,A){i.X(e,t,A)}function Ys(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function o0(i){vi&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class qs{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=!Gs(),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(CA(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(CA(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=js(e.changedTouches,Le(this.Of));if(t===null||(this.Vf=jr(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(CA(t),Le(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),Ti(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(CA(e),Le(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=js(e.changedTouches,Le(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=jr(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(CA(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&&Ti(e));this._f===0&&Ti(e),e.touches.length===0&&this.ff&&(this.ff=!1,Ti(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),ec()&&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(CA(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=jr(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=CA(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=CA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;ec()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=CA(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=CA(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})}Gs()&&(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}),o0(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),Ti(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=!Gs()}vv(e){const t=js(e.touches,Le(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:jr(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"&&Ti(e)}}}}function tc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Ti(i){i.cancelable&&i.preventDefault()}function CA(i){return{nt:i.pageX,st:i.pageY}}function jr(i){return i.timeStamp||performance.now()}function js(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function en(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function a0(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 eo(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 Ac(i,e,t,A){if(!i.length)return;let r=0;const n=t/2,s=i[0].At(A,!0);let o=e===1?n-(i[0].Vi()-s/2):i[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<i.length;l++){const c=i[l],u=i[l-1],m=u.At(A,!1),y=c.Vi(),v=u.Vi();if(e===1?y>v-m:y<v+m){const T=v-m*e;c.Oi(T);const B=T-e*m/2;if((e===1?B<0:B>t)&&o>0){const S=e===1?-1-B:B-t,F=Math.min(S,o);for(let U=r;U<i.length;U++)i[U].Oi(i[U].Vi()+e*F);o-=F}}else r=l,o=e===1?v-m-y:y-(v+m)}}class ic{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Gi(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=eo("normal",r),this.Zv=eo("top",r),this.Xv=eo("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=Ai(this.Kv,pt({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=Ai(this.Kv,pt({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 qs(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),ii(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ii(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=Le(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 $s(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&jA(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 Le(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,Le(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=ei(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=ei(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?Or(e,0,0,A,r,s):ol(e,0,0,A,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(l)),u=Math.floor(.5*l),m=Math.round(r.T*o);s.beginPath();for(const y of t)s.rect(Math.floor(n*o),Math.round(y.Ea*l)-u,m,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-r.A):Math.round(n+r.T+r.A),c=t.map((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const m=t[u];s.fillText(m.so,l,m.Ea+c[u])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),r=this.ap();this.Li===A.pr()&&this.tn.fp().Uo().forEach((s=>{A.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(A,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,r)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,r=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));r.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),l=s.ki();l>-o&&l<o&&s.Oi(o),l>this.Ev.height-o&&l<this.Ev.height+o&&s.Oi(this.Ev.height-o)}Ac(r,1,this.Ev.height,t),Ac(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(Le(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(Le(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 Bi(this.ko.fontSize,this.ko.fontFamily)}}function l0(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 tn(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 c0(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 h0(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 to{constructor(e,t){this.Ev=pt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new yt,this.Op=new yt,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=Ai(A,pt({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=Ai(A,pt({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 qs(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),ii(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ii(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Le(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(to.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 s0(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(Le(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Le(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=Le(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,u,m){var y,v;let T,B;for(const U of c){const k=(v=(y=U.va)===null||y===void 0?void 0:y.call(U,u,m))!==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,B=U)}var S,F;return T&&B?{zv:T,Hc:B}:null})(o,n,s);if(l?.zv.zOrder==="top")return en(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return en(l);const u=a0(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 en(l)}return l?.zv?en(l):null})(A,e,t)}_m(e,t){Le(t==="left"?this.Cp:this.Tp).cp(pt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){jA(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=Le(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=ei(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,l0),this.vm(A),this.pm(A),this.fm(A,tn),this.fm(A,c0)))}this.Jv.applySuggestedBitmapSize();const t=ei(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,h0))}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?Or(e,0,0,A,r,o):ol(e,0,0,A,r,s,o)}vm(e){const t=Le(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,tn,Js,t),this.Mm(e,tn,qr,t)}bm(e){this.Mm(e,tn,qr,this.$i().Zc())}fm(e,t){const A=Le(this.Np).Uo();for(const r of A)this.Mm(e,t,Js,r);for(const r of A)this.Mm(e,t,qr,r)}Mm(e,t,A,r){const n=Le(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;Ys(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 ic(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new ic(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,Le(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)Le(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 n0(.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 rc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=pt({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=Ai(this.Kv,pt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ii(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){jA(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=ei(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}){Or(e,0,0,t.width,t.height,this.Pm())}}function Ao(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 u0=Ao("normal"),d0=Ao("top"),p0=Ao("bottom");class f0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=pt({width:0,height:0}),this.Om=new yt,this.Fv=new Gi(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=Ai(this.Im,pt({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=Ai(this.Im,pt({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 qs(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),ii(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),ii(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){jA(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(pt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(pt({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=ei(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,p0)})),this.wp(A),this.$m(A,u0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=ei(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,d0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)Ys(t,(n=>Js(n,e,!1,void 0)),r,void 0);for(const r of A)Ys(t,(n=>qr(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){Or(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const u=Math.max(1,Math.floor(l)),m=Math.floor(.5*l);o.beginPath();const y=Math.round(n.T*c);for(let v=A.length;v--;){const T=Math.round(A[v].coord*l);o.rect(T-m,0,u,y)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const l=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}}))}Ym(e,t,A){const r=this.Fv.xi(e,A),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const A=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return Bi(this.j(),this.cn.fontFamily)}Zm(){return Bi(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 Gi,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 rc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new rc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const g0=!!vi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!vi&&(!((io=navigator?.userAgentData)===null||io===void 0)&&io.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var io;class m0{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 yt,this.Op=new yt,this.Rc=new yt,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),ro(this.cn)&&this.hb(!0),this.$i=new e0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new f0(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=[],Le(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 pt({width:l-l%2,height:c-c%2})})(pt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Le(this.Xd).style.height=n,Le(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Et.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Et.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=ro(this.cn);this.$i.$h(e);const A=ro(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=Le(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Le(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 Vt(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let u=0;u<this.Xm.length;u++){const m=this.Xm[u],y=Le(o==="left"?m.wm():m.gm()),v=y.xp();e!==null&&y.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Le(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+=Le(r.gm()).xp().width);const s=(o,l,c)=>{Le(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Le(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=Le(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return pt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const T of this.Xm)this.xb()&&(t=Math.max(t,Le(T.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Le(T.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=T.M_();t=$s(t),A=$s(A);const r=this.__,n=this.ho,s=Math.max(r-t-A,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const u=0+l,m=n<u?0:n-u,y=m/e;let v=0;for(let T=0;T<this.Xm.length;++T){const B=this.Xm[T];B.qp(this.$i.qc()[T]);let S=0,F=0;F=T===this.Xm.length-1?m-v:Math.round(B.M_()*y),S=Math.max(F,2),v+=S,B.cp(pt({width:s,height:S})),this.xb()&&B._m(t,"left"),this.Sb()&&B._m(A,"right"),B.fp()&&this.$i.Kc(B.fp(),S)}this.ab.Fm(pt({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 g0?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=Vt(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 to(this,e[r]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var r;const n=new Map;e!==null&&this.$i.wt().forEach((u=>{const m=u.In().ll(e);m!==null&&n.set(u,m)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof ks?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 ro(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 nc(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 sc(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 B0(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 y0(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 C0(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 v0(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 T0(i,e,t,A,r){const n=Vt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:m,color:y}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:nc(u,["time","color"]),V:y}}function An(i){return i.Vt!==void 0}function oc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function ri(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)?oc({ot:e,ee:t,zb:r},A):oc(i(e,t,A,r,n),A)}function ac(i){return{Candlestick:ri(v0),Bar:ri(C0),Area:ri(B0),Baseline:ri(y0),Histogram:ri(sc),Line:ri(sc),Custom:ri(T0)}[i]}function lc(i){return{ee:0,Hb:new Map,la:i}}function cc(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)})),Vt(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=ac(e.Qh()),m=e.Ca(),y=e.Ta();s=t.map(((v,T)=>{const B=c(v.time),S=this.q_.key(B);let F=this.qb.get(S);F===void 0&&(F=lc(B),this.qb.set(S,F),r=!0);const U=u(B,F.ee,v,l[T],m,y);return F.Hb.set(e,U),U}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:hc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const m=cc(l,u),y=cc(c,u);if(m!==void 0&&y!==void 0)return{ta:m.Ub>=y.Ub&&m.$b>=y.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(B){B.zb===void 0&&(B.zb=B.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=ac(e.Qh()),c=e.Ca(),u=e.Ta(),m=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,m),this.nw(e,m);const y={ta:An(m)};if(!o)return this.tw(e,-1,y);const v={timeWeight:0,time:s.la,pointData:s,originalTime:hc(s.Hb)},T=Ri(this.Xb,this.q_.key(v.time),((B,S)=>this.q_.key(B.time)<S));this.Xb.splice(T,0,v);for(let B=T;B<this.Xb.length;++B)no(this.Xb[B].pointData,B);return this.q_.fillWeightsForPoints(this.Xb,T),this.tw(e,T,y)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const r=A.length!==0?A[A.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?An(t)&&A.push(t):An(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(An)),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,no(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)no(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 no(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function so(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function uc(i){const e=so(i);return i.V!==void 0&&(e.color=i.V),e}function b0(i){const e=so(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=so(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 F0(i){const e=dc(i);return i.V!==void 0&&(e.color=i.V),e}function U0(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 oo(i){return{Area:b0,Line:uc,Baseline:Q0,Histogram:uc,Bar:F0,Candlestick:U0,Custom:S0}[i]}function S0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const E0={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},L0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},M0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Qs,attributionLogo:!0},ao={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},H0={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},I0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Qs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function pc(){return{width:0,height:0,autoSize:!1,layout:M0,crosshair:E0,grid:L0,overlayPriceScales:Object.assign({},ao),leftPriceScale:Object.assign(Object.assign({},ao),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},ao),{visible:!0}),timeScale:H0,watermark:I0,localization:{locale:vi?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 D0{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 Vr(this.ow)?this.aw.Mb(this.ow):0}Li(){return Le(this.aw.$t().Uc(this.ow)).Dt}}function fc(i,e,t){const A=nc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const _0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class P0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class k0{constructor(e,t,A,r,n){this.uw=new yt,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 Ci(new qi(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=Le(A.el()),o=Le(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:oo(this.seriesType())(A)}data(){const e=oo(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=>fc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>fc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return MA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=uA(MA(_0),e),A=this.Es.ea(t);return new P0(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 N0{constructor(e,t,A){this.ww=new yt,this.mu=new yt,this.Om=new yt,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){kA(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({},MA(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 O0(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 gc(i){return(function(e){if(Nr(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;Nr(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),Nr(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;Nr(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class K0{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new yt,this.Cw=new yt,this.Tw=new yt,this.Pw=new x0(t);const r=A===void 0?MA(pc()):uA(MA(pc()),gc(A));this.q_=t,this.aw=new m0(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 N0(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=wi(e),r=Object.assign(Object.assign({},Ya),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Tp,e)}addBaselineSeries(e){return this.Vw("Baseline",xp,e)}addBarSeries(e){return this.Vw("Bar",Cp,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",yp,e)}addHistogramSeries(e){return this.Vw("Histogram",bp,e)}addLineSeries(e){return this.Vw("Line",vp,e)}removeSeries(e){const t=Vt(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 D0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(gc(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){O0(A.priceFormat);const n=uA(MA(qa),MA(t),A),s=this.aw.$t().dd(e,n,r),o=new k0(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((A,r)=>r.J(A.$e,A.rw))),t.Wu()}Bw(e){return Vt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=oo(s)(r);if(s!=="Custom")kA(w0(o));else{const l=n.Ta();kA(!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 V0(i,e,t){let A;if(zi(i)){const n=document.getElementById(i);kA(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new K0(A,e,t);return e.setOptions(r.options()),r}function z0(i,e){return V0(i,new jl,jl.Id(e))}Object.assign(Object.assign({},qa),Ya);function mc(i,e){return function(){return i.apply(e,arguments)}}const{toString:W0}=Object.prototype,{getPrototypeOf:lo}=Object,{iterator:rn,toStringTag:wc}=Symbol,nn=(i=>e=>{const t=W0.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),pA=i=>(i=i.toLowerCase(),e=>nn(e)===i),sn=i=>e=>typeof e===i,{isArray:xi}=Array,bi=sn("undefined");function ji(i){return i!==null&&!bi(i)&&i.constructor!==null&&!bi(i.constructor)&&Xt(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Bc=pA("ArrayBuffer");function R0(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Bc(i.buffer),e}const G0=sn("string"),Xt=sn("function"),yc=sn("number"),er=i=>i!==null&&typeof i=="object",$0=i=>i===!0||i===!1,on=i=>{if(nn(i)!=="object")return!1;const e=lo(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(wc in i)&&!(rn in i)},X0=i=>{if(!er(i)||ji(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},Z0=pA("Date"),J0=pA("File"),Y0=pA("Blob"),q0=pA("FileList"),j0=i=>er(i)&&Xt(i.pipe),e1=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Xt(i.append)&&((e=nn(i))==="formdata"||e==="object"&&Xt(i.toString)&&i.toString()==="[object FormData]"))},t1=pA("URLSearchParams"),[A1,i1,r1,n1]=["ReadableStream","Request","Response","Headers"].map(pA),s1=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),xi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(ji(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 Cc(i,e){if(ji(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 ni=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,vc=i=>!bi(i)&&i!==ni;function co(){const{caseless:i,skipUndefined:e}=vc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&Cc(t,n)||n;on(t[s])&&on(r)?t[s]=co(t[s],r):on(r)?t[s]=co({},r):xi(r)?t[s]=r.slice():(!e||!bi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&tr(arguments[r],A);return t}const o1=(i,e,t,{allOwnKeys:A}={})=>(tr(e,(r,n)=>{t&&Xt(r)?Object.defineProperty(i,n,{value:mc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),a1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),l1=(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)},c1=(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&&lo(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},h1=(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},u1=i=>{if(!i)return null;if(xi(i))return i;let e=i.length;if(!yc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},d1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&lo(Uint8Array)),p1=(i,e)=>{const A=(i&&i[rn]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},f1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},g1=pA("HTMLFormElement"),m1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Tc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),w1=pA("RegExp"),xc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};tr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},B1=i=>{xc(i,(e,t)=>{if(Xt(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(Xt(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+"'")})}})},y1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return xi(i)?A(i):A(String(i).split(e)),t},C1=()=>{},v1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function T1(i){return!!(i&&Xt(i.append)&&i[wc]==="FormData"&&i[rn])}const x1=i=>{const e=new Array(10),t=(A,r)=>{if(er(A)){if(e.indexOf(A)>=0)return;if(ji(A))return A;if(!("toJSON"in A)){e[r]=A;const n=xi(A)?[]:{};return tr(A,(s,o)=>{const l=t(s,r+1);!bi(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},b1=pA("AsyncFunction"),Q1=i=>i&&(er(i)||Xt(i))&&Xt(i.then)&&Xt(i.catch),bc=((i,e)=>i?setImmediate:e?((t,A)=>(ni.addEventListener("message",({source:r,data:n})=>{r===ni&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),ni.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Xt(ni.postMessage)),F1=typeof queueMicrotask<"u"?queueMicrotask.bind(ni):typeof process<"u"&&process.nextTick||bc,fe={isArray:xi,isArrayBuffer:Bc,isBuffer:ji,isFormData:e1,isArrayBufferView:R0,isString:G0,isNumber:yc,isBoolean:$0,isObject:er,isPlainObject:on,isEmptyObject:X0,isReadableStream:A1,isRequest:i1,isResponse:r1,isHeaders:n1,isUndefined:bi,isDate:Z0,isFile:J0,isBlob:Y0,isRegExp:w1,isFunction:Xt,isStream:j0,isURLSearchParams:t1,isTypedArray:d1,isFileList:q0,forEach:tr,merge:co,extend:o1,trim:s1,stripBOM:a1,inherits:l1,toFlatObject:c1,kindOf:nn,kindOfTest:pA,endsWith:h1,toArray:u1,forEachEntry:p1,matchAll:f1,isHTMLForm:g1,hasOwnProperty:Tc,hasOwnProp:Tc,reduceDescriptors:xc,freezeMethods:B1,toObjectSet:y1,toCamelCase:m1,noop:C1,toFiniteNumber:v1,findKey:Cc,global:ni,isContextDefined:vc,isSpecCompliantForm:T1,toJSONObject:x1,isAsyncFn:b1,isThenable:Q1,setImmediate:bc,asap:F1,isIterable:i=>i!=null&&Xt(i[rn])};let Xe=class np extends Error{static from(e,t,A,r,n,s){const o=new np(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 U1=null;function ho(i){return fe.isPlainObject(i)||fe.isArray(i)}function Qc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function Fc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Qc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function S1(i){return fe.isArray(i)&&!i.some(ho)}const E1=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function an(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(B,S){return!fe.isUndefined(S[B])});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 Xe("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,B,S){let F=T;if(T&&!S&&typeof T=="object"){if(fe.endsWith(B,"{}"))B=A?B:B.slice(0,-2),T=JSON.stringify(T);else if(fe.isArray(T)&&S1(T)||(fe.isFileList(T)||fe.endsWith(B,"[]"))&&(F=fe.toArray(T)))return B=Qc(B),F.forEach(function(k,R){!(fe.isUndefined(k)||k===null)&&e.append(s===!0?Fc([B],R,n):s===null?B:B+"[]",c(k))}),!1}return ho(T)?!0:(e.append(Fc(S,B,n),c(T)),!1)}const m=[],y=Object.assign(E1,{defaultVisitor:u,convertValue:c,isVisitable:ho});function v(T,B){if(!fe.isUndefined(T)){if(m.indexOf(T)!==-1)throw Error("Circular reference detected in "+B.join("."));m.push(T),fe.forEach(T,function(F,U){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(U)?U.trim():U,B,y))===!0&&v(F,B?B.concat(U):[U])}),m.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Uc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function uo(i,e){this._pairs=[],i&&an(i,this,e)}const Sc=uo.prototype;Sc.append=function(e,t){this._pairs.push([e,t])},Sc.toString=function(e){const t=e?function(A){return e.call(this,A,Uc)}:Uc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function L1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ec(i,e,t){if(!e)return i;const A=t&&t.encode||L1,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 uo(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Lc{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 po={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},M1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:uo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},fo=typeof window<"u"&&typeof document<"u",go=typeof navigator=="object"&&navigator||void 0,H1=fo&&(!go||["ReactNative","NativeScript","NS"].indexOf(go.product)<0),I1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",D1=fo&&window.location.href||"http://localhost",kt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fo,hasStandardBrowserEnv:H1,hasStandardBrowserWebWorkerEnv:I1,navigator:go,origin:D1},Symbol.toStringTag,{value:"Module"})),...M1};function _1(i,e){return an(i,new kt.classes.URLSearchParams,{visitor:function(t,A,r,n){return kt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function P1(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function k1(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 Mc(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]=k1(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(P1(A),r,t,0)}),t}return null}function N1(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 Ar={transitional:po,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(Mc(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 _1(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return an(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),N1(e)):e}],transformResponse:[function(e){const t=this.transitional||Ar.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:kt.classes.FormData,Blob:kt.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=>{Ar.headers[i]={}});const O1=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"]),K1=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]&&O1[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},Hc=Symbol("internals");function ir(i){return i&&String(i).trim().toLowerCase()}function ln(i){return i===!1||i==null?i:fe.isArray(i)?i.map(ln):String(i)}function V1(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 z1=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function mo(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 W1(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function R1(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 Zt=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=ir(l);if(!u)throw new Error("header name must be a non-empty string");const m=fe.findKey(r,u);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=ln(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())&&!z1(e))s(K1(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=ir(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return V1(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=ir(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||mo(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=ir(s),s){const o=fe.findKey(A,s);o&&(!t||mo(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||mo(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]=ln(r),delete t[n];return}const o=e?W1(n):String(n).trim();o!==n&&delete t[n],t[o]=ln(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[Hc]=this[Hc]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=ir(s);A[o]||(R1(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};Zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Zt.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(Zt);function wo(i,e){const t=this||Ar,A=e||t,r=Zt.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 Ic(i){return!!(i&&i.__CANCEL__)}let rr=class extends Xe{constructor(e,t,A){super(e??"canceled",Xe.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function Dc(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 G1(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function $1(i,e){i=i||10;const t=new Array(i),A=new Array(i);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let m=n,y=0;for(;m!==r;)y+=t[m++],m=m%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(y*1e3/v):void 0}}function X1(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),m=u-t;m>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-m)))},()=>r&&s(r)]}const cn=(i,e,t=3)=>{let A=0;const r=$1(50,250);return X1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(m)},t)},_c=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},Pc=i=>(...e)=>fe.asap(()=>i(...e)),Z1=kt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,kt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(kt.origin),kt.navigator&&/(msie|trident)/i.test(kt.navigator.userAgent)):()=>!0,J1=kt.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 Y1(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function q1(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function kc(i,e,t){let A=!Y1(e);return i&&(A||t==!1)?q1(i,e):e}const Nc=i=>i instanceof Zt?{...i}:i;function si(i,e){e=e||{};const t={};function A(c,u,m,y){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:y},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,m,y){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,m,y)}else return A(c,u,m,y)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,m){if(m in e)return A(c,u);if(m in i)return A(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,u,m)=>r(Nc(c),Nc(u),m,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=fe.hasOwnProp(l,u)?l[u]:r,y=m(i[u],e[u],u);fe.isUndefined(y)&&m!==o||(t[u]=y)}),t}const Oc=i=>{const e=si({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=Zt.from(s),e.url=Ec(kc(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(kt.hasStandardBrowserEnv||kt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,m])=>{c.includes(u.toLowerCase())&&s.set(u,m)})}}if(kt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&Z1(e.url))){const l=r&&n&&J1.read(n);l&&s.set(r,l)}return e},j1=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=Oc(i);let n=r.data;const s=Zt.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,m,y,v,T;function B(){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=Zt.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),L={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:k,config:i,request:S};Dc(function(te){t(te),B()},function(te){A(te),B()},L),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 Xe("Request aborted",Xe.ECONNABORTED,i,S)),S=null)},S.onerror=function(R){const L=R&&R.message?R.message:"Network Error",z=new Xe(L,Xe.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 L=r.transitional||po;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Xe(R,L.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,i,S)),S=null},n===void 0&&s.setContentType(null),"setRequestHeader"in S&&fe.forEach(s.toJSON(),function(R,L){S.setRequestHeader(L,R)}),fe.isUndefined(r.withCredentials)||(S.withCredentials=!!r.withCredentials),o&&o!=="json"&&(S.responseType=r.responseType),c&&([y,T]=cn(c,!0),S.addEventListener("progress",y)),l&&S.upload&&([m,v]=cn(l),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=k=>{S&&(A(!k||k.type?new rr(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 U=G1(r.url);if(U&&kt.protocols.indexOf(U)===-1){A(new Xe("Unsupported protocol "+U+":",Xe.ERR_BAD_REQUEST,i));return}S.send(n||null)})},eg=(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 rr(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}},tg=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},Ag=async function*(i,e){for await(const t of ig(i))yield*tg(t,e)},ig=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()}},Kc=(i,e,t,A)=>{const r=Ag(i,e);let n=0,s,o=l=>{s||(s=!0,A&&A(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){o(),l.close();return}let m=u.byteLength;if(t){let y=n+=m;t(y)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},Vc=64*1024,{isFunction:hn}=fe,rg=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:zc,TextEncoder:Wc}=fe.global,Rc=(i,...e)=>{try{return!!i(...e)}catch{return!1}},ng=i=>{i=fe.merge.call({skipUndefined:!0},rg,i);const{fetch:e,Request:t,Response:A}=i,r=e?hn(e):typeof fetch=="function",n=hn(t),s=hn(A);if(!r)return!1;const o=r&&hn(zc),l=r&&(typeof Wc=="function"?(T=>B=>T.encode(B))(new Wc):async T=>new Uint8Array(await new t(T).arrayBuffer())),c=n&&o&&Rc(()=>{let T=!1;const B=new t(kt.origin,{body:new zc,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!B}),u=s&&o&&Rc(()=>fe.isReadableStream(new A("").body)),m={stream:u&&(T=>T.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!m[T]&&(m[T]=(B,S)=>{let F=B&&B[T];if(F)return F.call(B);throw new Xe(`Response type '${T}' is not supported`,Xe.ERR_NOT_SUPPORT,S)})});const y=async T=>{if(T==null)return 0;if(fe.isBlob(T))return T.size;if(fe.isSpecCompliantForm(T))return(await new t(kt.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,B)=>{const S=fe.toFiniteNumber(T.getContentLength());return S??y(B)};return async T=>{let{url:B,method:S,data:F,signal:U,cancelToken:k,timeout:R,onDownloadProgress:L,onUploadProgress:z,responseType:te,headers:$,withCredentials:V="same-origin",fetchOptions:Ae}=Oc(T),re=e||fetch;te=te?(te+"").toLowerCase():"text";let le=eg([U,k&&k.toAbortSignal()],R),X=null;const j=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let oe;try{if(z&&c&&S!=="get"&&S!=="head"&&(oe=await v($,F))!==0){let Qe=new t(B,{method:"POST",body:F,duplex:"half"}),Se;if(fe.isFormData(F)&&(Se=Qe.headers.get("content-type"))&&$.setContentType(Se),Qe.body){const[Ce,Te]=_c(oe,cn(Pc(z)));F=Kc(Qe.body,Vc,Ce,Te)}}fe.isString(V)||(V=V?"include":"omit");const ae=n&&"credentials"in t.prototype,se={...Ae,signal:le,method:S.toUpperCase(),headers:$.normalize().toJSON(),body:F,duplex:"half",credentials:ae?V:void 0};X=n&&new t(B,se);let ce=await(n?re(X,Ae):re(B,se));const de=u&&(te==="stream"||te==="response");if(u&&(L||de&&j)){const Qe={};["status","statusText","headers"].forEach(Ue=>{Qe[Ue]=ce[Ue]});const Se=fe.toFiniteNumber(ce.headers.get("content-length")),[Ce,Te]=L&&_c(Se,cn(Pc(L),!0))||[];ce=new A(Kc(ce.body,Vc,Ce,()=>{Te&&Te(),j&&j()}),Qe)}te=te||"text";let we=await m[fe.findKey(m,te)||"text"](ce,T);return!de&&j&&j(),await new Promise((Qe,Se)=>{Dc(Qe,Se,{data:we,headers:Zt.from(ce.headers),status:ce.status,statusText:ce.statusText,config:T,request:X})})}catch(ae){throw j&&j(),ae&&ae.name==="TypeError"&&/Load failed|fetch/i.test(ae.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,T,X,ae&&ae.response),{cause:ae.cause||ae}):Xe.from(ae,ae&&ae.code,T,X,ae&&ae.response)}}},sg=new Map,Gc=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=sg;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:ng(e)),u=c;return c};Gc();const Bo={http:U1,xhr:j1,fetch:{get:Gc}};fe.forEach(Bo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const $c=i=>`- ${i}`,og=i=>fe.isFunction(i)||i===null||i===!1;function ag(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,!og(A)&&(r=Bo[(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($c).join(`
5
- `):" "+$c(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 Xc={getAdapter:ag,adapters:Bo};function yo(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new rr(null,i)}function Zc(i){return yo(i),i.headers=Zt.from(i.headers),i.data=wo.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),Xc.getAdapter(i.adapter||Ar.adapter,i)(i).then(function(A){return yo(i),A.data=wo.call(i,i.transformResponse,A),A.headers=Zt.from(A.headers),A},function(A){return Ic(A)||(yo(i),A&&A.response&&(A.response.data=wo.call(i,i.transformResponse,A.response),A.response.headers=Zt.from(A.response.headers))),Promise.reject(A)})}const Jc="1.13.5",un={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{un[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const Yc={};un.transitional=function(e,t,A){function r(n,s){return"[Axios v"+Jc+"] 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&&!Yc[s]&&(Yc[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}},un.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function lg(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 dn={assertOptions:lg,validators:un},nA=dn.validators;let oi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Lc,response:new Lc}}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=si(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&dn.assertOptions(A,{silentJSONParsing:nA.transitional(nA.boolean),forcedJSONParsing:nA.transitional(nA.boolean),clarifyTimeoutError:nA.transitional(nA.boolean),legacyInterceptorReqResOrdering:nA.transitional(nA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:dn.assertOptions(r,{encode:nA.function,serialize:nA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),dn.assertOptions(t,{baseUrl:nA.spelling("baseURL"),withXsrfToken:nA.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=Zt.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(B){if(typeof B.runWhen=="function"&&B.runWhen(t)===!1)return;l=l&&B.synchronous;const S=t.transitional||po;S&&S.legacyInterceptorReqResOrdering?o.unshift(B.fulfilled,B.rejected):o.push(B.fulfilled,B.rejected)});const c=[];this.interceptors.response.forEach(function(B){c.push(B.fulfilled,B.rejected)});let u,m=0,y;if(!l){const T=[Zc.bind(this),void 0];for(T.unshift(...o),T.push(...c),y=T.length,u=Promise.resolve(t);m<y;)u=u.then(T[m++],T[m++]);return u}y=o.length;let v=t;for(;m<y;){const T=o[m++],B=o[m++];try{v=T(v)}catch(S){B.call(this,S);break}}try{u=Zc.call(this,v)}catch(T){return Promise.reject(T)}for(m=0,y=c.length;m<y;)u=u.then(c[m++],c[m++]);return u}getUri(e){e=si(this.defaults,e);const t=kc(e.baseURL,e.url,e.allowAbsoluteUrls);return Ec(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){oi.prototype[e]=function(t,A){return this.request(si(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(si(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}oi.prototype[e]=t(),oi.prototype[e+"Form"]=t(!0)});let cg=class sp{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 rr(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 sp(function(r){e=r}),cancel:e}}};function hg(i){return function(t){return i.apply(null,t)}}function ug(i){return fe.isObject(i)&&i.isAxiosError===!0}const Co={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(Co).forEach(([i,e])=>{Co[e]=i});function qc(i){const e=new oi(i),t=mc(oi.prototype.request,e);return fe.extend(t,oi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return qc(si(i,r))},t}const ut=qc(Ar);ut.Axios=oi,ut.CanceledError=rr,ut.CancelToken=cg,ut.isCancel=Ic,ut.VERSION=Jc,ut.toFormData=an,ut.AxiosError=Xe,ut.Cancel=ut.CanceledError,ut.all=function(e){return Promise.all(e)},ut.spread=hg,ut.isAxiosError=ug,ut.mergeConfig=si,ut.AxiosHeaders=Zt,ut.formToJSON=i=>Mc(fe.isHTMLForm(i)?new FormData(i):i),ut.getAdapter=Xc.getAdapter,ut.HttpStatusCode=Co,ut.default=ut;const{Axios:VT,AxiosError:zT,CanceledError:WT,isCancel:RT,CancelToken:GT,VERSION:$T,all:XT,Cancel:ZT,isAxiosError:JT,spread:YT,toFormData:qT,AxiosHeaders:jT,HttpStatusCode:ex,formToJSON:tx,getAdapter:Ax,mergeConfig:ix}=ut,vA=Object.create(null);vA.open="0",vA.close="1",vA.ping="2",vA.pong="3",vA.message="4",vA.upgrade="5",vA.noop="6";const pn=Object.create(null);Object.keys(vA).forEach(i=>{pn[vA[i]]=i});const vo={type:"error",data:"parser error"},jc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",eh=typeof ArrayBuffer=="function",th=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,To=({type:i,data:e},t,A)=>jc&&e instanceof Blob?t?A(e):Ah(e,A):eh&&(e instanceof ArrayBuffer||th(e))?t?A(e):Ah(new Blob([e]),A):A(vA[i]+(e||"")),Ah=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function ih(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let xo;function dg(i,e){if(jc&&i.data instanceof Blob)return i.data.arrayBuffer().then(ih).then(e);if(eh&&(i.data instanceof ArrayBuffer||th(i.data)))return e(ih(i.data));To(i,!1,t=>{xo||(xo=new TextEncoder),e(xo.encode(t))})}const rh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<rh.length;i++)nr[rh.charCodeAt(i)]=i;const pg=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=nr[i.charCodeAt(A)],s=nr[i.charCodeAt(A+1)],o=nr[i.charCodeAt(A+2)],l=nr[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},fg=typeof ArrayBuffer=="function",bo=(i,e)=>{if(typeof i!="string")return{type:"message",data:nh(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:gg(i.substring(1),e)}:pn[t]?i.length>1?{type:pn[t],data:i.substring(1)}:{type:pn[t]}:vo},gg=(i,e)=>{if(fg){const t=pg(i);return nh(t,e)}else return{base64:!0,data:i}},nh=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,sh="",mg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{To(n,!1,o=>{A[s]=o,++r===t&&e(A.join(sh))})})},wg=(i,e)=>{const t=i.split(sh),A=[];for(let r=0;r<t.length;r++){const n=bo(t[r],e);if(A.push(n),n.type==="error")break}return A};function Bg(){return new TransformStream({transform(i,e){dg(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 Qo;function fn(i){return i.reduce((e,t)=>e+t.length,0)}function gn(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 yg(i,e){Qo||(Qo=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(fn(t)<1)break;const l=gn(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(fn(t)<2)break;const l=gn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(fn(t)<8)break;const l=gn(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(fn(t)<r)break;const l=gn(t,r);o.enqueue(bo(n?l:Qo.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(vo);break}}}})}const oh=4;function xt(i){if(i)return Cg(i)}function Cg(i){for(var e in xt.prototype)i[e]=xt.prototype[e];return i}xt.prototype.on=xt.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},xt.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},xt.prototype.off=xt.prototype.removeListener=xt.prototype.removeAllListeners=xt.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},xt.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},xt.prototype.emitReserved=xt.prototype.emit,xt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},xt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const mn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),sA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),vg="arraybuffer";function rx(){}function ah(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Tg=sA.setTimeout,xg=sA.clearTimeout;function wn(i,e){e.useNativeTimers?(i.setTimeoutFn=Tg.bind(sA),i.clearTimeoutFn=xg.bind(sA)):(i.setTimeoutFn=sA.setTimeout.bind(sA),i.clearTimeoutFn=sA.clearTimeout.bind(sA))}const bg=1.33;function Qg(i){return typeof i=="string"?Fg(i):Math.ceil((i.byteLength||i.size)*bg)}function Fg(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 Ug(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Sg(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 Eg extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class Fo extends xt{constructor(e){super(),this.writable=!1,wn(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 Eg(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=bo(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=Ug(e);return t.length?"?"+t:""}}class Lg extends Fo{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,mg(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 ch=!1;try{ch=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Mg=ch;function Hg(){}class Ig extends Lg{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 TA extends xt{constructor(e,t,A){super(),this.createRequest=e,wn(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=ah(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=TA.requestsCount++,TA.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=Hg,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete TA.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(TA.requestsCount=0,TA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",hh);else if(typeof addEventListener=="function"){const i="onpagehide"in sA?"pagehide":"unload";addEventListener(i,hh,!1)}}function hh(){for(let i in TA.requests)TA.requests.hasOwnProperty(i)&&TA.requests[i].abort()}const Dg=(function(){const i=uh({xdomain:!1});return i&&i.responseType!==null})();class _g extends Ig{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Dg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new TA(uh,this.uri(),e)}}function uh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Mg))return new XMLHttpRequest}catch{}if(!e)try{return new sA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const dh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Pg extends Fo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=dh?{}:ah(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;To(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&mn(()=>{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 Uo=sA.WebSocket||sA.MozWebSocket;class kg extends Pg{createSocket(e,t,A){return dh?new Uo(e,t,A):t?new Uo(e,t):new Uo(e)}doWrite(e,t){this.ws.send(t)}}class Ng extends Fo{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=yg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=Bg();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&&mn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Og={websocket:kg,webtransport:Ng,polling:_g},Kg=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Vg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function So(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=Kg.exec(i||""),n={},s=14;for(;s--;)n[Vg[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=zg(n,n.path),n.queryKey=Wg(n,n.query),n}function zg(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 Wg(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Eo=typeof addEventListener=="function"&&typeof removeEventListener=="function",Bn=[];Eo&&addEventListener("offline",()=>{Bn.forEach(i=>i())},!1);class OA extends xt{constructor(e,t){if(super(),this.binaryType=vg,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=So(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=So(t.host).host);wn(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=Sg(this.opts.query)),Eo&&(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"})},Bn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=oh,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&&OA.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",OA.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,mn(()=>{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(OA.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(),Eo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Bn.indexOf(this._offlineEventListener);A!==-1&&Bn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}OA.protocol=oh;class Rg extends OA{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;OA.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!A)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;OA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const y=new Error("probe error");y.transport=t.name,this.emitReserved("upgradeError",y)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=m=>{const y=new Error("probe error: "+m);y.transport=t.name,n(),this.emitReserved("upgradeError",y)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const u=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{A||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let A=0;A<e.length;A++)~this.transports.indexOf(e[A])&&t.push(e[A]);return t}}let Gg=class extends Rg{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=>Og[r]).filter(r=>!!r)),super(e,A)}};function $g(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=So(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 Xg=typeof ArrayBuffer=="function",Zg=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,ph=Object.prototype.toString,Jg=typeof Blob=="function"||typeof Blob<"u"&&ph.call(Blob)==="[object BlobConstructor]",Yg=typeof File=="function"||typeof File<"u"&&ph.call(File)==="[object FileConstructor]";function Lo(i){return Xg&&(i instanceof ArrayBuffer||Zg(i))||Jg&&i instanceof Blob||Yg&&i instanceof File}function yn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(yn(i[t]))return!0;return!1}if(Lo(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return yn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&yn(i[t]))return!0;return!1}function qg(i){const e=[],t=i.data,A=i;return A.data=Mo(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Mo(i,e){if(!i)return i;if(Lo(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]=Mo(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]=Mo(i[A],e));return t}return i}function jg(i,e){return i.data=Ho(i.data,e),delete i.attachments,i}function Ho(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]=Ho(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Ho(i[t],e));return i}const em=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var At;(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"})(At||(At={}));class tm{constructor(e){this.replacer=e}encode(e){return(e.type===At.EVENT||e.type===At.ACK)&&yn(e)?this.encodeAsBinary({type:e.type===At.EVENT?At.BINARY_EVENT:At.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===At.BINARY_EVENT||e.type===At.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=qg(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class Io extends xt{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===At.BINARY_EVENT;A||t.type===At.BINARY_ACK?(t.type=A?At.EVENT:At.ACK,this.reconstructor=new Am(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Lo(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(At[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===At.BINARY_EVENT||A.type===At.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(Io.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 At.CONNECT:return fh(t);case At.DISCONNECT:return t===void 0;case At.CONNECT_ERROR:return typeof t=="string"||fh(t);case At.EVENT:case At.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&em.indexOf(t[0])===-1);case At.ACK:case At.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Am{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=jg(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function fh(i){return Object.prototype.toString.call(i)==="[object Object]"}const im=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Io,Encoder:tm,get PacketType(){return At}},Symbol.toStringTag,{value:"Module"}));function fA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const rm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class gh extends xt{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=[fA(e,"open",this.onopen.bind(this)),fA(e,"packet",this.onpacket.bind(this)),fA(e,"error",this.onerror.bind(this)),fA(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(rm.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:At.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,m=t.pop();this._registerAckCallback(u,m),s.id=u}const o=(r=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const r=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,r)=>{const n=(s,o)=>s?r(s):A(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const A={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),A.pending=!1,this._drainQueue())),this._queue.push(A),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:At.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 At.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 At.EVENT:case At.BINARY_EVENT:this.onevent(e);break;case At.ACK:case At.BINARY_ACK:this.onack(e);break;case At.DISCONNECT:this.ondisconnect();break;case At.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:At.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:At.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 Qi(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}Qi.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},Qi.prototype.reset=function(){this.attempts=0},Qi.prototype.setMin=function(i){this.ms=i},Qi.prototype.setMax=function(i){this.max=i},Qi.prototype.setJitter=function(i){this.jitter=i};class Do extends xt{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,wn(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 Qi({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||im;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 Gg(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=fA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=fA(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(fA(e,"ping",this.onping.bind(this)),fA(e,"data",this.ondata.bind(this)),fA(e,"error",this.onerror.bind(this)),fA(e,"close",this.onclose.bind(this)),fA(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){mn(()=>{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 gh(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 sr={};function Cn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=$g(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=sr[r]&&n in sr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new Do(A,e):(sr[r]||(sr[r]=new Do(A,e)),l=sr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Cn,{Manager:Do,Socket:gh,io:Cn,connect:Cn});function _o(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 AA=_o("http://localhost:8000");function mh(i){const e=_o(i);e&&e!==AA&&(AA=e,wt&&(wt.disconnect(),wt.removeAllListeners(),wt=null))}let wt=null;function nm(){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:AA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=Cn(AA,{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:AA,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:AA,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:AA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:AA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function Po(){const i=_o(wt?.io?.uri||null);return!wt||wt.io&&i&&AA&&i!==AA?(wt&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:AA,wasConnected:wt.connected,reason:"baseUrl changed"}),wt.disconnect(),wt.removeAllListeners(),wt=null),wt=nm()):wt.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:wt.id,connected:wt.connected,baseUrl:AA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:wt.id,baseUrl:AA}),wt}function sm(i,e){const t=Po();return t.on(i,e),()=>t.off(i,e)}function om(i,e){wt&&wt.off(i,e)}function am(i,e){Po().emit(i,e)}function lm(){return wt?wt.connected?"connected":"connecting":"disconnected"}const vn={getSocket:Po,on:sm,off:om,emit:am,getStatus:lm,setBaseUrl:mh},cm={},wh=ie.createContext(),Lt=()=>{const i=ie.useContext(wh);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},hm=({children:i,baseUrl:e,endpoints:t,accountId:A,initialSymbol:r,initialTimeframe:n})=>{const s=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:bs&&bs.tagName.toUpperCase()==="SCRIPT"&&bs.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&cm?.VITE_BASE_URL)??"http://localhost:5002";vn.setBaseUrl(s);const l={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account"},...t},c=t?.params||{},[u,m]=ie.useState(r||"BTC/USD"),[y,v]=ie.useState(n||"M1"),[T,B]=ie.useState([]),[S,F]=ie.useState(!0),[U,k]=ie.useState([]),[R,L]=ie.useState(!1),[z,te]=ie.useState(1e5),[$,V]=ie.useState(null),[Ae,re]=ie.useState([]),[le,X]=ie.useState(!0),[j,oe]=ie.useState(!1),[ae,se]=ie.useState(!0),[ce,de]=ie.useState("candles"),[we,Qe]=ie.useState(!1),[Se,Ce]=ie.useState("dark"),[Te,Ue]=ie.useState(!1),[Ee,Ie]=ie.useState([]),Ze=ie.useRef(null),ze=ie.useRef(new Map),ve=ie.useRef(null),Ne=1e3,ye=ie.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;L(!0);const ge=await ut.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let He=[];Array.isArray(ge.data)?He=ge.data:ge.data?.data&&Array.isArray(ge.data.data)&&(He=ge.data.data);const _e=He.filter(Fe=>Fe.closePrice===null||Fe.closePrice===void 0).map(Fe=>({id:Fe.id,ticket:23,symbol:Fe.symbol,type:Fe.type,volume:Fe.volume,openPrice:Fe.openPrice??Fe.price,stopLoss:Fe.stopLoss,takeProfit:Fe.takeProfit,comment:Fe.comment||"",status:"OPEN",swap:0,profit:Fe.profit||0,profitCurrency:"USD",time:new Date(Fe.openedAt||Fe.openAt||Date.now()).toLocaleTimeString(),openAt:Fe.openedAt||Fe.openAt,closeAt:Fe.closedAt||Fe.closeAt}));k(_e)}catch(me){console.error("❌ Error fetching orders:",me.response?.data||me.message),k([])}finally{L(!1)}},[s,A]),pe=ie.useCallback((me,ge)=>!ge||!me.price||isNaN(ge)||isNaN(me.price)?me.profit||0:(me?.type?.toUpperCase()==="BUY"?ge-me.price:me.price-ge)*me.volume,[]),Pe=ie.useCallback(async()=>{try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;const ge=await ut.get(`${s}${l.account}`,{headers:{Authorization:`Bearer ${me}`}});if(ge.data&&ge.data.data){const He=parseFloat(ge.data.data.balance);isNaN(He)||te(He)}}catch(me){console.error("❌ Error fetching user balance:",me.response?.data||me.message)}},[s]),Je=ie.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;const ge=await ut.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let He=[];Array.isArray(ge.data)?He=ge.data:ge.data?.data&&Array.isArray(ge.data.data)&&(He=ge.data.data);const _e=He.filter(Fe=>Fe.closePrice!==null&&Fe.closePrice!==void 0).map(Fe=>({id:Fe.id,ticket:23,symbol:Fe.symbol,type:Fe.type,volume:Fe.volume,openPrice:Fe.openPrice??Fe.price,closePrice:Fe.closePrice,stopLoss:Fe.stopLoss,takeProfit:Fe.takeProfit,profit:Fe.profit??Fe.profitLoss??0,profitCurrency:"USD",openAt:Fe.openedAt||Fe.openAt,closeAt:Fe.closedAt||Fe.closeAt,closeReason:Fe.closeReason||"",status:"CLOSED"}));Ie(_e)}catch(me){console.error("❌ Error fetching history orders:",me.response?.data||me.message),Ie([])}},[s,A]),it=ie.useMemo(()=>{const me=z,ge=U.reduce((Ve,at)=>Ve+at.volume*at.price*.01,0),He=U.reduce((Ve,at)=>{const Bt=T.find(It=>It.symbol===at.symbol);if(Bt){const It=at.type?.toUpperCase()==="BUY"?parseFloat(Bt.bid||0):parseFloat(Bt.ask||0);if(It&&It>0&&!isNaN(It))return Ve+pe(at,It)}return Ve+(at.profit||0)},0),_e=me+He,Fe=_e-ge,Ke=ge>0?_e/ge*100:0;return{balance:me,equity:_e,margin:ge,freeMargin:Fe,level:Ke.toFixed(2)}},[U,T,z,pe]);ie.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(ye(),Pe(),Je())},[ye,Pe,Je,A]),ie.useEffect(()=>{(async()=>{try{F(!0);const ge=l.symbols.includes("?")?`${s}${l.symbols}`:`${s}${l.symbols}`,He=await ut.get(ge);let _e=[];Array.isArray(He.data)?_e=He.data:He.data&&He.data.data&&Array.isArray(He.data.data)?_e=He.data.data:He.data&&He.data.prices&&Array.isArray(He.data.prices)?_e=He.data.prices:He.data&&Array.isArray(He.data)&&(_e=He.data);const Fe=_e.map(Ke=>{const Ve=Ke.symbol||Ke.name||"",at=Ke.category||null;return Ve&&(Ke.bid!==void 0||Ke.price!==void 0)?{symbol:Ve,bid:Ke.bid??Ke.price??0,ask:Ke.ask??Ke.price??0,change:Ke.change??0,category:at}:{...Ke,symbol:Ve,category:at}});Fe.length>0?(B(Fe),Fe.find(Ve=>Ve.symbol===u)||m(Fe[0].symbol)):B([])}catch(ge){console.error("❌ Error fetching symbols:",ge.response?.data||ge.message),B([])}finally{F(!1)}})()},[s,l.symbols]);const rt=ie.useCallback(()=>{const me=ze.current;if(me.size===0)return;const ge=new Map(me);me.clear(),B(He=>He.map(_e=>{const Fe=ge.get(_e.symbol);return Fe?{..._e,...Fe}:_e})),k(He=>{let _e=!1;const Fe=He.map(Ke=>{const Ve=ge.get(Ke.symbol);if(!Ve)return Ke;const at=Ke.type?.toUpperCase()==="BUY"?parseFloat(Ve.bid||0):parseFloat(Ve.ask||0);if(!at||isNaN(at)||at<=0)return Ke;const Bt=pe(Ke,at);return Bt===Ke.profit?Ke:(_e=!0,{...Ke,profit:Bt})});return _e?Fe:He})},[pe]);ie.useEffect(()=>{Ze.current||(Ze.current=vn.getSocket());const me=Ze.current,ge=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&me.emit("joinUserRoom",{userId:Number(A)})},He=()=>console.log("⚠️ TradingContext: Disconnected"),_e=Ke=>{Ke?.symbol&&(ze.current.set(Ke.symbol,Ke),ve.current||(ve.current=setTimeout(()=>{ve.current=null,rt()},Ne)))},Fe=async Ke=>{if(Ke){if(Ke.newBalance!==void 0){const Ve=parseFloat(Ke.newBalance);isNaN(Ve)||te(Ve)}if(window.notify){const Ve=Ke.profitLoss||Ke.profit||0,at=Ve>=0?`+${Ve.toFixed(2)}`:Ve.toFixed(2),Bt=Ke.symbol||"Trade",It=Ke.reason||"Closed";window.notify(`Trade Closed: ${It} | ${Bt} | P/L: ${at} USD`,Ve>=0?"success":"error")}Ke.tradeId&&k(Ve=>Ve.filter(at=>at.id!==Ke.tradeId)),await ye(),await Pe()}};return me.on("connect",ge),me.on("disconnect",He),me.on("priceUpdate",_e),me.on("tradeClosed",Fe),me.connected&&A&&Number.isFinite(Number(A))&&me.emit("joinUserRoom",{userId:Number(A)}),()=>{me.off("connect",ge),me.off("disconnect",He),me.off("priceUpdate",_e),me.off("tradeClosed",Fe),ve.current&&(clearTimeout(ve.current),ve.current=null),ze.current.clear()}},[rt,ye,Pe]),ie.useEffect(()=>{try{const me=document.documentElement;if(!me)return;me.dataset.theme=Se}catch{}},[Se]);const Ge=ie.useMemo(()=>T.find(me=>me.symbol===u)||{bid:"0.00000",ask:"0.00000",change:0},[T,u]),ke=ie.useMemo(()=>({selectedSymbol:u,setSelectedSymbol:m,selectedTimeframe:y,setSelectedTimeframe:v,symbols:T,setSymbols:B,symbolsLoading:S,orders:U,setOrders:k,ordersLoading:R,fetchOrders:ye,fetchUserBalance:Pe,userBalance:z,setUserBalance:te,accountSummary:it,currentSymbolData:Ge,activeTool:$,setActiveTool:V,chartObjects:Ae,setChartObjects:re,showGrid:le,setShowGrid:X,snapToGrid:j,setSnapToGrid:oe,drawingsVisible:ae,setDrawingsVisible:se,chartType:ce,setChartType:de,chartLocked:we,setChartLocked:Qe,theme:Se,setTheme:Ce,baseUrl:s,endpoints:l,endpointParams:c,accountId:A,isShow:Te,setIsShow:Ue,historyOrders:Ee,setHistoryOrders:Ie,fetchHistoryOrders:Je}),[u,y,T,S,U,R,ye,Pe,z,it,Ge,$,Ae,le,j,ae,ce,we,Se,s,l,c,Te,Ee,Je]);return a.jsx(wh.Provider,{value:ke,children:i})};var Bh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},yh=ie.createContext&&ie.createContext(Bh),um=["attr","size","title"];function dm(i,e){if(i==null)return{};var t=pm(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 pm(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 Tn(){return Tn=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},Tn.apply(this,arguments)}function Ch(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 xn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ch(Object(t),!0).forEach(function(A){fm(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ch(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function fm(i,e,t){return e=gm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function gm(i){var e=mm(i,"string");return typeof e=="symbol"?e:e+""}function mm(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)=>ie.createElement(e.tag,xn({key:t},e.attr),vh(e.child)))}function zt(i){return e=>ie.createElement(wm,Tn({attr:xn({},i.attr)},e),vh(i.child))}function wm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=dm(i,um),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),ie.createElement("svg",Tn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:xn(xn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&ie.createElement("title",null,n),i.children)};return yh!==void 0?ie.createElement(yh.Consumer,null,t=>e(t)):e(Bh)}function Bm(i){return zt({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 ym(i){return zt({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 Cm(i){return zt({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 vm(i){return zt({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 Th(i){return zt({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 Tm(i){return zt({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 xm(i){return zt({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 bm(i){return zt({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 Qm(i){return zt({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 Fm(i){return zt({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 Um={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},xh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=Lt(),c=r==="light",[u,m]=ie.useState("0.01"),[y,v]=ie.useState(""),[T,B]=ie.useState(!1),S=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",U=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",k=L=>{const z=parseFloat(u)||.01,te=Math.max(.01,z+L);m(te.toFixed(2))},R=async L=>{v("");const z=L,te=parseFloat(z==="BUY"?e:i),$=parseFloat(u);if(!$||$<=0||isNaN($)){v("Please enter a valid volume (minimum 0.01)");return}if($<.01){v("Volume must be at least 0.01");return}if(!te||te<=0||isNaN(te)){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}B(!0);const Ae=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:Ae,type:z,volume:$,openPrice:te,takeProfit:null,stopLoss:null};try{const le=o||Um?.VITE_BASE_URL||"http://localhost:8000",X=l?.trades||"/api/trades",j=await ut.post(`${le}${X}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(j.status<200||j.status>=300){v(j.data?.message||`Failed to place trade (${j.status})`);return}s&&s(),A&&A()}catch(le){const X=le?.response?.data?.message||le?.message||"Network error. Please try again.";v(X)}finally{B(!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} ${U} transition-colors`,children:a.jsx(Th,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:L=>{const z=L.target.value;(z===""||/^\d*\.?\d{0,2}$/.test(z))&&m(z)},onBlur:()=>{const L=parseFloat(u);m(isNaN(L)||L<.01?"0.01":L.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} ${U} transition-colors`,children:a.jsx(Tm,{size:8})})]}),a.jsxs("button",{onClick:()=>R("BUY"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),y&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:y})]})},Sm={},bh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:m,selectedTimeframe:y,setOrders:v,symbols:T,fetchOrders:B,theme:S,baseUrl:F,endpoints:U}=Lt(),k=S==="light",R={getContractSpec:me=>{const ge=String(me||"").toUpperCase();return ge.includes("BTC")||ge.includes("ETH")||ge.includes("SOL")||ge.includes("XRP")||ge.includes("ADA")||ge.includes("DOGE")||ge.includes("BNB")||ge.includes("AVAX")||ge.includes("DOT")||ge.includes("LINK")||ge.endsWith("USDT")?{contractSize:1}:ge.includes("XAU")||ge.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:me,volume:ge})=>{const He=R.getContractSpec(me);return(parseFloat(ge)||0)*(He.contractSize||1)}},L=u||R,[z,te]=ie.useState("0.01"),[$,V]=ie.useState(""),[Ae,re]=ie.useState(""),[le,X]=ie.useState(""),[j,oe]=ie.useState(!1),[ae,se]=ie.useState(null),[ce,de]=ie.useState(""),[we,Qe]=ie.useState(t||"BUY"),[Se,Ce]=ie.useState(parseFloat(A)||0),[Te,Ue]=ie.useState(parseFloat(r)||0),[Ee,Ie]=ie.useState("text-white"),[Ze,ze]=ie.useState("text-white"),ve=ie.useRef(parseFloat(A)||0),Ne=ie.useRef(parseFloat(r)||0);ie.useEffect(()=>{if(!i)return;const me=vn.getSocket(),ge=_e=>{if(!(!_e||!_e.symbol)&&_e.symbol.toUpperCase()===m?.toUpperCase()){const Fe=parseFloat(_e.bid)||0,Ke=parseFloat(_e.ask)||0;Fe>0&&(Fe>ve.current?(Ie("text-green-400"),setTimeout(()=>Ie("text-white"),500)):Fe<ve.current&&ve.current>0&&(Ie("text-red-400"),setTimeout(()=>Ie("text-white"),500)),Ce(Fe),ve.current=Fe),Ke>0&&(Ke>Ne.current?(ze("text-green-400"),setTimeout(()=>ze("text-white"),500)):Ke<Ne.current&&Ne.current>0&&(ze("text-red-400"),setTimeout(()=>ze("text-white"),500)),Ue(Ke),Ne.current=Ke)}};me.on("priceUpdate",ge);const He=T.find(_e=>_e.symbol===m);if(He){const _e=parseFloat(He.bid)||0,Fe=parseFloat(He.ask)||0;_e>0&&(Ce(_e),ve.current=_e),Fe>0&&(Ue(Fe),Ne.current=Fe)}return()=>{me.off("priceUpdate",ge)}},[i,m,T]),ie.useEffect(()=>{if(i){te(o?String(o):"0.01"),V(""),re(""),X(""),de(""),Qe(t||"BUY");const me=parseFloat(A)||0,ge=parseFloat(r)||0;me>0&&(Ce(me),ve.current=me),ge>0&&(Ue(ge),Ne.current=ge)}},[i,t,A,r,o]);const ye=Se||0,pe=Te||0,Pe=me=>{const ge=parseFloat(z)||.01,He=Math.max(.01,ge+me);te(He.toFixed(2))},Je=me=>{const ge=parseFloat($)||0,He=parseFloat(we==="BUY"?Te:Se)||0;if(!He){de("Current price not available. Please wait...");return}let _e=ge+me;we==="BUY"?_e=Math.max(1e-5,Math.min(_e,He-1e-5)):_e=Math.max(He+1e-5,_e),V(_e>0?_e.toFixed(5):""),de("")},it=me=>{const ge=parseFloat(Ae)||0,He=parseFloat(we==="BUY"?Te:Se)||0;if(!He){de("Current price not available. Please wait...");return}let _e=ge+me;we==="BUY"?_e=Math.max(He+1e-5,_e):_e=Math.max(1e-5,Math.min(_e,He-1e-5)),re(_e>0?_e.toFixed(5):""),de("")},rt=async me=>{de("");const ge=me||we,He=parseFloat(ge==="BUY"?Te:Se),_e=parseFloat(z),Fe=$?parseFloat($):null,Ke=Ae?parseFloat(Ae):null;if(!_e||_e<=0||isNaN(_e)){de("Please enter a valid volume (minimum 0.01)");return}if(_e<.01){de("Volume must be at least 0.01");return}if(!He||He<=0||isNaN(He)){de("Invalid price. Please refresh and try again.");return}if(Fe!==null&&Fe!==""){if(isNaN(Fe)||Fe<=0){de("Stop Loss must be a valid positive number");return}if(ge==="BUY"&&Fe>=He){de("Stop Loss must be below the current price for BUY orders");return}if(ge==="SELL"&&Fe<=He){de("Stop Loss must be above the current price for SELL orders");return}}if(Ke!==null&&Ke!==""){if(isNaN(Ke)||Ke<=0){de("Take Profit must be a valid positive number");return}if(ge==="BUY"){if(Ke<=He){de(`Take Profit must be above the entry price (${He.toFixed(5)}) for BUY orders`);return}}else if(ge==="SELL"&&Ke>=He){de(`Take Profit must be below the entry price (${He.toFixed(5)}) for SELL orders`);return}}Qe(ge),se(ge),oe(!0);const Ve=new Date,at=Ve.toLocaleTimeString(),Bt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,It=localStorage.getItem("token")??localStorage.getItem("authToken");if(!It){de("Please login to place trades"),oe(!1),se(null);return}const Ir={accountId:s,symbol:m,type:ge,volume:_e,price:He,takeProfit:Ke,stopLoss:Fe,comment:le.trim()||null},vs={ticket:Bt.substring(0,8),symbol:m,type:ge,volume:parseFloat(_e),price:parseFloat(He),time:at,stopLoss:Fe?parseFloat(Fe):null,takeProfit:Ke?parseFloat(Ke):null,swap:0,profit:0,profitCurrency:"USD",comment:le.trim()||"",id:Bt,status:"OPEN",openAt:Ve.toISOString()};if(!l&&v&&v(gi=>[...gi,vs]),c&&!n){de("Execution handler is required in forceParentExecution mode"),oe(!1),se(null);return}if(n){oe(!1),se(null),e();const gi={symbol:m,type:ge,lotSize:_e,entryPrice:He,stopLoss:Fe,takeProfit:Ke,comment:le.trim()||null};Promise.resolve(n(gi)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),B&&B()}).catch(Ts=>{console.error("❌ Trade execution failed:",Ts),!l&&v&&v(Dt=>Dt.filter(mt=>mt.id!==Bt))})}else{if(c){de("Fallback API path disabled in forceParentExecution mode"),oe(!1),se(null);return}oe(!1),se(null),e();const gi=F||Sm?.VITE_BASE_URL||"http://localhost:8000",Ts=U?.trades||"/api/trades";ut.post(`${gi}${Ts}`,Ir,{headers:{Authorization:`Bearer ${It}`,"Content-Type":"application/json"}}).then(Dt=>{if(Dt.data&&Dt.data.data){const mt=Dt.data.data.trade;!l&&v&&v(St=>St.map(jt=>jt.id===Bt?{...jt,id:mt.id,ticket:mt.id.substring(0,8),time:at,openAt:mt.openAt}:jt)),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(jt=>jt.id!==Bt));const mt=Dt.data?.message||"Failed to place trade";window.notify&&window.notify(mt,"error")}}).catch(Dt=>{console.error("Error placing trade:",Dt),!l&&v&&v(St=>St.filter(jt=>jt.id!==Bt));let mt="Failed to place trade";if(Dt.response){const St=Dt.response.status,jt=Dt.response.data;St===400?mt=jt?.message||"Invalid trade data. Please check your inputs.":St===401?mt="Authentication failed. Please login again.":St===404?mt=jt?.message||"Symbol not found. Please select a valid symbol.":St===500?mt="Server error. Please try again later.":mt=jt?.message||`Error: ${St}`}else Dt.request&&(mt="Network error. Please check your internet connection.");window.notify&&window.notify(mt,"error")})}},ke=(L?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return i?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${k?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${k?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${k?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${k?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${k?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[ce&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:ce}),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:[ke," ",m]})]}),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:me=>{const ge=me.target.value;(ge===""||/^\d*\.?\d{0,2}$/.test(ge))&&(te(ge),de(""))},onBlur:()=>{const me=parseFloat(z);te(isNaN(me)||me<.01?"0.01":me.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:()=>Je(-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:$,onChange:me=>{const ge=me.target.value;(ge===""||/^\d*\.?\d*$/.test(ge))&&(V(ge),de(""))},onBlur:me=>{const ge=parseFloat(me.target.value);!isNaN(ge)&&ge>0?V(ge.toFixed(5)):me.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:()=>Je(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:Ae,onChange:me=>{const ge=me.target.value;(ge===""||/^\d*\.?\d*$/.test(ge))&&(re(ge),de(""))},onBlur:me=>{const ge=parseFloat(me.target.value);!isNaN(ge)&&ge>0?re(ge.toFixed(5)):me.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:le,onChange:me=>X(me.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:`${Ee} 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:`${Ze} 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:()=>rt("SELL"),disabled:j,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:j&&ae==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>rt("BUY"),disabled:j,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:j&&ae==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},Em={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"},Lm=[10,11,12,14,16,20,24,28,30,40],bn=[{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"}],KA={width:"78%",height:"78%",display:"block"},Qh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Mm(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 xA(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 Hm=()=>a.jsx(Qm,{style:KA}),Im=()=>a.jsx(Fm,{style:KA}),Dm=()=>a.jsx(vm,{style:KA}),_m=()=>a.jsx(bm,{style:KA}),Pm=()=>a.jsx(ym,{style:KA}),km=()=>a.jsx(Bm,{style:KA}),Nm=()=>a.jsx(Cm,{style:KA}),Om=()=>a.jsx(Th,{style:KA}),ko=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function or({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(ko,{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:Qh}),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 Ft({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=xA(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:{...Qh,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:u=>{const m=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:A,style:c})]})}function oA({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 ai({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(Om,{})})]})}function Km({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===bn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:bn.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:bn.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 Vm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,xA(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(Ft,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(ai,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Lm.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(or,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(Dm,{})}),a.jsx(or,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(_m,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(or,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(Pm,{})}),a.jsx(or,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(km,{})}),a.jsx(or,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(Nm,{})})]})]}),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(Ft,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(oA,{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(Ft,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(oA,{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 Qn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,xA(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(Ft,{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(Ft,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ai,{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 zm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,xA(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(Ft,{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(Ft,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ai,{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 Wm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,xA(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(Ft,{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(Ft,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ai,{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 Rm({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(oA,{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 li(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 ci({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:li(i.point1Time),style:n}),a.jsx(oA,{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:li(i.point2Time),style:n}),a.jsx(oA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Fh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,xA(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(Ft,{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(Ft,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ai,{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(ai,{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 Gm({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(oA,{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 $m({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:li(i.originTime),style:r}),a.jsx(oA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Xm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,xA(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(Ft,{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 Zm({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:li(i.rawTime),style:t})]})})}function Jm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,xA(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(Ft,{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(Ft,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ai,{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 Ym({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,xA(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(Ft,{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 qm({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:li(i.rawTime),style:r}),a.jsx(oA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Uh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,xA(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(Ft,{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(Ft,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(oA,{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(Ft,{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 Sh({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:li(i.point1Time),style:n}),a.jsx(oA,{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:li(i.point2Time),style:n}),a.jsx(oA,{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(oA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function jm(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||bn.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 Eh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Lt(),s=Mm(r==="light"),[o,l]=ie.useState("style"),[c,u]=ie.useState({}),[m,y]=ie.useState(null),v=ie.useRef(null),T=ie.useRef(null);ie.useEffect(()=>{t&&(u(jm(t)),l("style"))},[t]),ie.useEffect(()=>{i||y(null)},[i]);const B=L=>{if(L.button!==0)return;L.preventDefault();const z=v.current;if(!z)return;const te=z.offsetParent,$=te?te.getBoundingClientRect():{left:0,top:0},V=z.getBoundingClientRect(),Ae=V.left-$.left,re=V.top-$.top;T.current={startMX:L.clientX,startMY:L.clientY,startX:Ae,startY:re},y({x:Ae,y:re});const le=j=>{const{startMX:oe,startMY:ae,startX:se,startY:ce}=T.current;y({x:se+j.clientX-oe,y:ce+j.clientY-ae})},X=()=>{T.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",X)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",X)};if(!i||!t)return null;const S=Em[t.type]||t.type,F=["style","coordinates","visualization"],U=()=>{if(o==="visualization")return a.jsx(Km,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Vm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Rm,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Fh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Gm,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Fh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx($m,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(Xm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Zm,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Wm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(zm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:u,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(Ym,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(qm,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(Jm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Uh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Sh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Uh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Sh,{draft:c,setDraft:u,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},k=()=>{A(c),e()};return a.jsxs("div",{ref:v,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...m===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:m.y,left:m.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:B,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(ko,{size:"18px",children:a.jsx(Hm,{})})})]})}),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(ko,{size:"20px",children:a.jsx(Im,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(L=>{const z=o===L;return a.jsxs("button",{type:"button",onClick:()=>l(L),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:[L.charAt(0).toUpperCase()+L.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},L)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:U()}),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 No=function(i,e){return No=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])},No(i,e)};function gA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");No(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Oo=function(){return Oo=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},Oo.apply(this,arguments)};function Wt(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(u){try{c(A.next(u))}catch(m){s(m)}}function l(u){try{c(A.throw(u))}catch(m){s(m)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Nt(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 Fn(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 IA=(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})(),Un=function(i,e){return IA.fromClientRect(i,e.getBoundingClientRect())},ew=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 IA(0,0,A,r)},Sn=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},Ct=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},Lh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tw=typeof Uint8Array>"u"?[]:new Uint8Array(256),En=0;En<Lh.length;En++)tw[Lh.charCodeAt(En)]=En;for(var Mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ar=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ln=0;Ln<Mh.length;Ln++)ar[Mh.charCodeAt(Ln)]=Ln;for(var Aw=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=ar[i.charCodeAt(A)],s=ar[i.charCodeAt(A+1)],o=ar[i.charCodeAt(A+2)],l=ar[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},iw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},rw=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,Ko=11,Vo=2,nw=Ko-hi,Hh=65536>>hi,sw=1<<hi,zo=sw-1,ow=1024>>hi,aw=Hh+ow,lw=aw,cw=32,hw=lw+cw,uw=65536>>Ko,dw=1<<nw,pw=dw-1,Ih=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},fw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},gw=function(i,e){var t=Aw(i),A=Array.isArray(t)?rw(t):new Uint32Array(t),r=Array.isArray(t)?iw(t):new Uint16Array(t),n=24,s=Ih(r,n/2,A[4]/2),o=A[5]===2?Ih(r,(n+A[4])/2):fw(A,Math.ceil((n+A[4])/4));return new mw(A[0],A[1],A[2],A[3],s,o)},mw=(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<<Vo)+(e&zo),this.data[t];if(e<=65535)return t=this.index[Hh+(e-55296>>hi)],t=(t<<Vo)+(e&zo),this.data[t];if(e<this.highStart)return t=hw-uw+(e>>Ko),t=this.index[t],t+=e>>hi&pw,t=this.index[t],t=(t<<Vo)+(e&zo),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Dh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ww=typeof Uint8Array>"u"?[]:new Uint8Array(256),Mn=0;Mn<Dh.length;Mn++)ww[Dh.charCodeAt(Mn)]=Mn;var Bw="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==",_h=50,yw=1,Ph=2,kh=3,Cw=4,vw=5,Nh=7,Oh=8,Kh=9,VA=10,Wo=11,Vh=12,Ro=13,Tw=14,lr=15,Go=16,Hn=17,cr=18,xw=19,zh=20,$o=21,hr=22,Xo=23,Fi=24,iA=25,ur=26,dr=27,Ui=28,bw=29,ui=30,Qw=31,In=32,Dn=33,Zo=34,Jo=35,Yo=36,pr=37,qo=38,_n=39,Pn=40,jo=41,Wh=42,Fw=43,Uw=[9001,65288],Rh="!",tt="×",kn="÷",ea=gw(Bw),DA=[ui,Yo],ta=[yw,Ph,kh,vw],Gh=[VA,Oh],$h=[dr,ur],Sw=ta.concat(Gh),Xh=[qo,_n,Pn,Zo,Jo],Ew=[lr,Ro],Lw=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ea.get(n);if(o>_h?(r.push(!0),o-=_h):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(Go);if(o===Cw||o===Wo){if(s===0)return A.push(s),t.push(ui);var l=t[s-1];return Sw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(ui))}if(A.push(s),o===Qw)return t.push(e==="strict"?$o:pr);if(o===Wh||o===bw)return t.push(ui);if(o===Fw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(pr):t.push(ui);t.push(o)}),[A,t,r]},Aa=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!==VA)break}if(r===VA)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!==VA)break}if(o!==VA)break}return!1},Zh=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===VA)t--;else return A}return 0},Mw=function(i,e,t,A,r){if(t[A]===0)return tt;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return tt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===Ph&&u===kh)return tt;if(ta.indexOf(l)!==-1)return Rh;if(ta.indexOf(u)!==-1||Gh.indexOf(u)!==-1)return tt;if(Zh(n,e)===Oh)return kn;if(ea.get(i[n])===Wo||(l===In||l===Dn)&&ea.get(i[o])===Wo||l===Nh||u===Nh||l===Kh||[VA,Ro,lr].indexOf(l)===-1&&u===Kh||[Hn,cr,xw,Fi,Ui].indexOf(u)!==-1||Zh(n,e)===hr||Aa(Xo,hr,n,e)||Aa([Hn,cr],$o,n,e)||Aa(Vh,Vh,n,e))return tt;if(l===VA)return kn;if(l===Xo||u===Xo)return tt;if(u===Go||l===Go)return kn;if([Ro,lr,$o].indexOf(u)!==-1||l===Tw||c===Yo&&Ew.indexOf(l)!==-1||l===Ui&&u===Yo||u===zh||DA.indexOf(u)!==-1&&l===iA||DA.indexOf(l)!==-1&&u===iA||l===dr&&[pr,In,Dn].indexOf(u)!==-1||[pr,In,Dn].indexOf(l)!==-1&&u===ur||DA.indexOf(l)!==-1&&$h.indexOf(u)!==-1||$h.indexOf(l)!==-1&&DA.indexOf(u)!==-1||[dr,ur].indexOf(l)!==-1&&(u===iA||[hr,lr].indexOf(u)!==-1&&e[o+1]===iA)||[hr,lr].indexOf(l)!==-1&&u===iA||l===iA&&[iA,Ui,Fi].indexOf(u)!==-1)return tt;if([iA,Ui,Fi,Hn,cr].indexOf(u)!==-1)for(var m=n;m>=0;){var y=e[m];if(y===iA)return tt;if([Ui,Fi].indexOf(y)!==-1)m--;else break}if([dr,ur].indexOf(u)!==-1)for(var m=[Hn,cr].indexOf(l)!==-1?s:n;m>=0;){var y=e[m];if(y===iA)return tt;if([Ui,Fi].indexOf(y)!==-1)m--;else break}if(qo===l&&[qo,_n,Zo,Jo].indexOf(u)!==-1||[_n,Zo].indexOf(l)!==-1&&[_n,Pn].indexOf(u)!==-1||[Pn,Jo].indexOf(l)!==-1&&u===Pn||Xh.indexOf(l)!==-1&&[zh,ur].indexOf(u)!==-1||Xh.indexOf(u)!==-1&&l===dr||DA.indexOf(l)!==-1&&DA.indexOf(u)!==-1||l===Fi&&DA.indexOf(u)!==-1||DA.concat(iA).indexOf(l)!==-1&&u===hr&&Uw.indexOf(i[o])===-1||DA.concat(iA).indexOf(u)!==-1&&l===cr)return tt;if(l===jo&&u===jo){for(var v=t[n],T=1;v>0&&(v--,e[v]===jo);)T++;if(T%2!==0)return tt}return l===In&&u===Dn?tt:kn},Hw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Lw(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[iA,ui,Wh].indexOf(o)!==-1?pr: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]},Iw=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===Rh,this.start=A,this.end=r}return i.prototype.slice=function(){return Ct.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),Dw=function(i,e){var t=Sn(i),A=Hw(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=tt;c<o&&(u=Mw(t,n,r,++c,s))===tt;);if(u!==tt||c===o){var m=new Iw(t,u,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},_w=1,Pw=2,fr=4,Jh=8,Nn=10,Yh=47,gr=92,kw=9,Nw=32,On=34,mr=61,Ow=35,Kw=36,Vw=37,Kn=39,Vn=40,wr=41,zw=95,Jt=45,Ww=33,Rw=60,Gw=62,$w=64,Xw=91,Zw=93,Jw=61,Yw=123,zn=63,qw=125,qh=124,jw=126,eB=128,jh=65533,ia=42,di=43,tB=44,AB=58,iB=59,Br=46,rB=0,nB=8,sB=11,oB=14,aB=31,lB=127,bA=-1,eu=48,tu=97,Au=101,cB=102,hB=117,uB=122,iu=65,ru=69,nu=70,dB=85,pB=90,Ot=function(i){return i>=eu&&i<=57},fB=function(i){return i>=55296&&i<=57343},Si=function(i){return Ot(i)||i>=iu&&i<=nu||i>=tu&&i<=cB},gB=function(i){return i>=tu&&i<=uB},mB=function(i){return i>=iu&&i<=pB},wB=function(i){return gB(i)||mB(i)},BB=function(i){return i>=eB},Wn=function(i){return i===Nn||i===kw||i===Nw},Rn=function(i){return wB(i)||BB(i)||i===zw},su=function(i){return Rn(i)||Ot(i)||i===Jt},yB=function(i){return i>=rB&&i<=nB||i===sB||i>=oB&&i<=aB||i===lB},zA=function(i,e){return i!==gr?!1:e!==Nn},Gn=function(i,e,t){return i===Jt?Rn(e)||zA(e,t):Rn(i)?!0:!!(i===gr&&zA(i,e))},ra=function(i,e,t){return i===di||i===Jt?Ot(e)?!0:e===Br&&Ot(t):Ot(i===Br?e:i)},CB=function(i){var e=0,t=1;(i[e]===di||i[e]===Jt)&&(i[e]===Jt&&(t=-1),e++);for(var A=[];Ot(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Ct.apply(void 0,A),10):0;i[e]===Br&&e++;for(var n=[];Ot(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Ct.apply(void 0,n),10):0;(i[e]===ru||i[e]===Au)&&e++;var l=1;(i[e]===di||i[e]===Jt)&&(i[e]===Jt&&(l=-1),e++);for(var c=[];Ot(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Ct.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},vB={type:2},TB={type:3},xB={type:4},bB={type:13},QB={type:8},FB={type:21},UB={type:9},SB={type:10},EB={type:11},LB={type:12},MB={type:14},$n={type:23},HB={type:1},IB={type:25},DB={type:24},_B={type:26},PB={type:27},kB={type:28},NB={type:29},OB={type:31},na={type:32},ou=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat(Sn(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==na;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case On:return this.consumeStringToken(On);case Ow:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(su(t)||zA(A,r)){var n=Gn(t,A,r)?Pw:_w,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Kw:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),bB;break;case Kn:return this.consumeStringToken(Kn);case Vn:return vB;case wr:return TB;case ia:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),MB;break;case di:if(ra(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case tB:return xB;case Jt:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(ra(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Gn(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Jt&&c===Gw)return this.consumeCodePoint(),this.consumeCodePoint(),DB;break;case Br:if(ra(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Yh:if(this.peekCodePoint(0)===ia)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===ia&&(u=this.consumeCodePoint(),u===Yh))return this.consumeToken();if(u===bA)return this.consumeToken()}break;case AB:return _B;case iB:return PB;case Rw:if(this.peekCodePoint(0)===Ww&&this.peekCodePoint(1)===Jt&&this.peekCodePoint(2)===Jt)return this.consumeCodePoint(),this.consumeCodePoint(),IB;break;case $w:var m=this.peekCodePoint(0),y=this.peekCodePoint(1),v=this.peekCodePoint(2);if(Gn(m,y,v)){var s=this.consumeName();return{type:7,value:s}}break;case Xw:return kB;case gr:if(zA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Zw:return NB;case Jw:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),QB;break;case Yw:return EB;case qw:return LB;case hB:case dB:var T=this.peekCodePoint(0),B=this.peekCodePoint(1);return T===di&&(Si(B)||B===zn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case qh:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),UB;if(this.peekCodePoint(0)===qh)return this.consumeCodePoint(),FB;break;case jw:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),SB;break;case bA:return na}return Wn(e)?(this.consumeWhiteSpace(),OB):Ot(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Rn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ct(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();Si(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===zn&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Ct.apply(void 0,e.map(function(l){return l===zn?eu:l})),16),n=parseInt(Ct.apply(void 0,e.map(function(l){return l===zn?nu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Ct.apply(void 0,e),16);if(this.peekCodePoint(0)===Jt&&Si(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Si(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Ct.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)===Vn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Vn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===bA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===Kn||t===On){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===bA||this.peekCodePoint(0)===wr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),$n)}for(;;){var r=this.consumeCodePoint();if(r===bA||r===wr)return{type:22,value:Ct.apply(void 0,e)};if(Wn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===bA||this.peekCodePoint(0)===wr?(this.consumeCodePoint(),{type:22,value:Ct.apply(void 0,e)}):(this.consumeBadUrlRemnants(),$n);if(r===On||r===Kn||r===Vn||yB(r))return this.consumeBadUrlRemnants(),$n;if(r===gr)if(zA(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),$n;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;Wn(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===wr||e===bA)return;zA(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+=Ct.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===bA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===Nn)return this._value.splice(0,A),HB;if(r===gr){var n=this._value[A+1];n!==bA&&n!==void 0&&(n===Nn?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):zA(r,n)&&(t+=this.consumeStringSlice(A),t+=Ct(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=fr,A=this.peekCodePoint(0);for((A===di||A===Jt)&&e.push(this.consumeCodePoint());Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Br&&Ot(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Jh;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===ru||A===Au)&&((r===di||r===Jt)&&Ot(n)||Ot(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Jh;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[CB(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(Gn(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===Vw?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Si(e)){for(var t=Ct(e);Si(this.peekCodePoint(0))&&t.length<6;)t+=Ct(this.consumeCodePoint());Wn(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||fB(A)||A>1114111?jh:A}return e===bA?jh:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(su(t))e+=Ct(t);else if(zA(t,this.peekCodePoint(0)))e+=Ct(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),au=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new ou;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||VB(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"?na:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),yr=function(i){return i.type===15},Ei=function(i){return i.type===17},lt=function(i){return i.type===20},KB=function(i){return i.type===0},sa=function(i,e){return lt(i)&&i.value===e},lu=function(i){return i.type!==31},Li=function(i){return i.type!==31&&i.type!==4},QA=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},VB=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},WA=function(i){return i.type===17||i.type===15},bt=function(i){return i.type===16||WA(i)},cu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},Mt={type:17,number:0,flags:fr},oa={type:16,number:50,flags:fr},RA={type:16,number:100,flags:fr},Cr=function(i,e,t){var A=i[0],r=i[1];return[dt(A,e),dt(typeof r<"u"?r:A,t)]},dt=function(i,e){if(i.type===16)return i.number/100*e;if(yr(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},hu="deg",uu="grad",du="rad",pu="turn",Xn={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case hu:return Math.PI*e.number/180;case uu:return Math.PI/200*e.number;case du:return e.number;case pu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},fu=function(i){return i.type===15&&(i.unit===hu||i.unit===uu||i.unit===du||i.unit===pu)},gu=function(i){var e=i.filter(lt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Mt,Mt];case"to top":case"bottom":return aA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Mt,RA];case"to right":case"left":return aA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[RA,RA];case"to bottom":case"top":return aA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[RA,Mt];case"to left":case"right":return aA(270)}return 0},aA=function(i){return Math.PI*i/180},GA={name:"color",parse:function(i,e){if(e.type===18){var t=zB[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 XA(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 XA(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 XA(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 XA(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=_A[e.value.toUpperCase()];if(typeof o<"u")return o}return _A.TRANSPARENT}},$A=function(i){return(255&i)===0},Ut=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+")"},XA=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},mu=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},wu=function(i,e){var t=e.filter(Li);if(t.length===3){var A=t.map(mu),r=A[0],n=A[1],s=A[2];return XA(r,n,s,1)}if(t.length===4){var o=t.map(mu),r=o[0],n=o[1],s=o[2],l=o[3];return XA(r,n,s,l)}return 0};function aa(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 Bu=function(i,e){var t=e.filter(Li),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?aA(A.number):Xn.parse(i,A))/(Math.PI*2),l=bt(r)?r.number/100:0,c=bt(n)?n.number/100:0,u=typeof s<"u"&&bt(s)?dt(s,1):1;if(l===0)return XA(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,y=c*2-m,v=aa(y,m,o+1/3),T=aa(y,m,o),B=aa(y,m,o-1/3);return XA(v*255,T*255,B*255,u)},zB={hsl:Bu,hsla:Bu,rgb:wu,rgba:wu},vr=function(i,e){return GA.parse(i,au.create(e).parseComponentValue())},_A={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},WB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(lt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},RB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Zn=function(i,e){var t=GA.parse(i,e[0]),A=e[1];return A&&bt(A)?{color:t,stop:A}:{color:t,stop:null}},yu=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=Mt),A.stop===null&&(A.stop=RA);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=dt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,y=r[c-1],v=(u-y)/(m+1),T=1;T<=m;T++)r[c+T-1]=v*T;c=null}}return i.map(function(B,S){var F=B.color;return{color:F,stop:Math.max(Math.min(1,r[S]/e),0)}})},GB=function(i,e,t){var A=e/2,r=t/2,n=dt(i[0],e)-A,s=r-dt(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},$B=function(i,e,t){var A=typeof i=="number"?i:GB(i,e,t),r=Math.abs(e*Math.sin(A))+Math.abs(t*Math.cos(A)),n=e/2,s=t/2,o=r/2,l=Math.sin(A-Math.PI/2)*o,c=Math.cos(A-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},mA=function(i,e){return Math.sqrt(i*i+e*e)},Cu=function(i,e,t,A,r){var n=[[0,0],[0,e],[i,0],[i,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],u=mA(t-l,A-c);return(r?u<s.optimumDistance:u>s.optimumDistance)?{optimumCorner:o,optimumDistance:u}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},XB=function(i,e,t,A,r){var n=0,s=0;switch(i.size){case 0:i.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-A)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(i.shape===0)n=s=Math.min(mA(e,t),mA(e,t-r),mA(e-A,t),mA(e-A,t-r));else if(i.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-A)),l=Cu(A,r,e,t,!0),c=l[0],u=l[1];n=mA(c-e,(u-t)/o),s=o*n}break;case 1:i.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-A)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(i.shape===0)n=s=Math.max(mA(e,t),mA(e,t-r),mA(e-A,t),mA(e-A,t-r));else if(i.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-A)),m=Cu(A,r,e,t,!1),c=m[0],u=m[1];n=mA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=dt(i.size[0],A),s=i.size.length===2?dt(i.size[1],r):n),[n,s]},ZB=function(i,e){var t=aA(180),A=[];return QA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=gu(r);return}else if(fu(s)){t=Xn.parse(i,s);return}}var o=Zn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},Jn=function(i,e){var t=aA(180),A=[];return QA(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=gu(r);return}else if(fu(s)){t=(Xn.parse(i,s)+aA(270))%aA(360);return}}var o=Zn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},JB=function(i,e){var t=aA(180),A=[],r=1,n=0,s=3,o=[];return QA(e).forEach(function(l,c){var u=l[0];if(c===0){if(lt(u)&&u.value==="linear"){r=1;return}else if(lt(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var m=GA.parse(i,u.values[0]);A.push({stop:Mt,color:m})}else if(u.name==="to"){var m=GA.parse(i,u.values[0]);A.push({stop:RA,color:m})}else if(u.name==="color-stop"){var y=u.values.filter(Li);if(y.length===2){var m=GA.parse(i,y[1]),v=y[0];Ei(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:m})}}}}),r===1?{angle:(t+aA(180))%aA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},vu="closest-side",Tu="farthest-side",xu="closest-corner",bu="farthest-corner",Qu="circle",Fu="ellipse",Uu="cover",Su="contain",YB=function(i,e){var t=0,A=3,r=[],n=[];return QA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,y){if(c)if(lt(y))switch(y.value){case"center":return n.push(oa),m;case"top":case"left":return n.push(Mt),m;case"right":case"bottom":return n.push(RA),m}else(bt(y)||WA(y))&&n.push(y);else if(lt(y))switch(y.value){case Qu:return t=0,!1;case Fu:return t=1,!1;case"at":return c=!0,!1;case vu:return A=0,!1;case Uu:case Tu:return A=1,!1;case Su:case xu:return A=2,!1;case bu:return A=3,!1}else if(WA(y)||bt(y))return Array.isArray(A)||(A=[]),A.push(y),!1;return m},l)}if(l){var u=Zn(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},Yn=function(i,e){var t=0,A=3,r=[],n=[];return QA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,m){if(lt(m))switch(m.value){case"center":return n.push(oa),!1;case"top":case"left":return n.push(Mt),!1;case"right":case"bottom":return n.push(RA),!1}else if(bt(m)||WA(m))return n.push(m),!1;return u},l):o===1&&(l=s.reduce(function(u,m){if(lt(m))switch(m.value){case Qu:return t=0,!1;case Fu:return t=1,!1;case Su:case vu:return A=0,!1;case Tu:return A=1,!1;case xu:return A=2,!1;case Uu:case bu:return A=3,!1}else if(WA(m)||bt(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return u},l)),l){var c=Zn(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},qB=function(i){return i.type===1},jB=function(i){return i.type===2},la={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=Eu[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 e2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Eu[i.name])}var Eu={"linear-gradient":ZB,"-moz-linear-gradient":Jn,"-ms-linear-gradient":Jn,"-o-linear-gradient":Jn,"-webkit-linear-gradient":Jn,"radial-gradient":YB,"-moz-radial-gradient":Yn,"-ms-radial-gradient":Yn,"-o-radial-gradient":Yn,"-webkit-radial-gradient":Yn,"-webkit-gradient":JB},t2={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 Li(A)&&e2(A)}).map(function(A){return la.parse(i,A)})}},A2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(lt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},i2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return QA(e).map(function(t){return t.filter(bt)}).map(cu)}},r2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return QA(e).map(function(t){return t.filter(lt).map(function(A){return A.value}).join(" ")}).map(n2)}},n2=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}},Mi;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Mi||(Mi={}));var s2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return QA(e).map(function(t){return t.filter(o2)})}},o2=function(i){return lt(i)||bt(i)},qn=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},a2=qn("top"),l2=qn("right"),c2=qn("bottom"),h2=qn("left"),jn=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return cu(t.filter(bt))}}},u2=jn("top-left"),d2=jn("top-right"),p2=jn("bottom-right"),f2=jn("bottom-left"),es=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}}},g2=es("top"),m2=es("right"),w2=es("bottom"),B2=es("left"),ts=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return yr(t)?t.number:0}}},y2=ts("top"),C2=ts("right"),v2=ts("bottom"),T2=ts("left"),x2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},b2={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(lt).reduce(function(t,A){return t|F2(A.value)},0)}},F2=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},U2={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}},S2={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}},As;(function(i){i.NORMAL="normal",i.STRICT="strict"})(As||(As={}));var E2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?As.STRICT:As.NORMAL}},L2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Lu=function(i,e){return lt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:bt(i)?dt(i,e):e},M2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:la.parse(i,e)}},H2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},ca={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}}},is=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},I2=is("top"),D2=is("right"),_2=is("bottom"),P2=is("left"),k2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(lt).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}})}},N2={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},rs=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},O2=rs("top"),K2=rs("right"),V2=rs("bottom"),z2=rs("left"),W2={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}}},R2={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}},G2={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&sa(e[0],"none")?[]:QA(e).map(function(t){for(var A={color:_A.TRANSPARENT,offsetX:Mt,offsetY:Mt,blur:Mt},r=0,n=0;n<t.length;n++){var s=t[n];WA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=GA.parse(i,s)}return A})}},$2={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}},X2={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=Y2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Z2=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},J2=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},Y2={matrix:Z2,matrix3d:J2},Mu={type:16,number:50,flags:fr},q2=[Mu,Mu],j2={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(bt);return t.length!==2?q2:[t[0],t[1]]}},ey={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}}},Tr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Tr||(Tr={}));for(var ty={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Tr.BREAK_ALL;case"keep-all":return Tr.KEEP_ALL;default:return Tr.NORMAL}}},Ay={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Ei(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Hu={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")}},iy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Ei(e)?e.number:1}},ry={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ny={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(lt).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})}},sy={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+"'"})}},oy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},ay={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Ei(e)?e.number:lt(e)&&e.value==="bold"?700:400}},ly={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(lt).map(function(t){return t.value})}},cy={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"}}},Qt=function(i,e){return(i&e)!==0},hy={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}},uy={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&&Ei(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},dy={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(lt(n)&&n.value!=="none"){var o=s&&Ei(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},py={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(yr).map(function(t){return Hu.parse(i,t)})}},fy={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(KB);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}},Iu=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},gy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&sa(e[0],"none")?[]:QA(e).map(function(t){for(var A={color:255,offsetX:Mt,offsetY:Mt,blur:Mt,spread:Mt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];sa(s,"inset")?A.inset=!0:WA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=GA.parse(i,s)}return A})}},my={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(lt).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"},By={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return yr(e)?e.number:0}},yy=(function(){function i(e,t){var A,r;this.animationDuration=Oe(e,py,t.animationDuration),this.backgroundClip=Oe(e,WB,t.backgroundClip),this.backgroundColor=Oe(e,RB,t.backgroundColor),this.backgroundImage=Oe(e,t2,t.backgroundImage),this.backgroundOrigin=Oe(e,A2,t.backgroundOrigin),this.backgroundPosition=Oe(e,i2,t.backgroundPosition),this.backgroundRepeat=Oe(e,r2,t.backgroundRepeat),this.backgroundSize=Oe(e,s2,t.backgroundSize),this.borderTopColor=Oe(e,a2,t.borderTopColor),this.borderRightColor=Oe(e,l2,t.borderRightColor),this.borderBottomColor=Oe(e,c2,t.borderBottomColor),this.borderLeftColor=Oe(e,h2,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,u2,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,d2,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,p2,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,f2,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,g2,t.borderTopStyle),this.borderRightStyle=Oe(e,m2,t.borderRightStyle),this.borderBottomStyle=Oe(e,w2,t.borderBottomStyle),this.borderLeftStyle=Oe(e,B2,t.borderLeftStyle),this.borderTopWidth=Oe(e,y2,t.borderTopWidth),this.borderRightWidth=Oe(e,C2,t.borderRightWidth),this.borderBottomWidth=Oe(e,v2,t.borderBottomWidth),this.borderLeftWidth=Oe(e,T2,t.borderLeftWidth),this.boxShadow=Oe(e,gy,t.boxShadow),this.color=Oe(e,x2,t.color),this.direction=Oe(e,b2,t.direction),this.display=Oe(e,Q2,t.display),this.float=Oe(e,U2,t.cssFloat),this.fontFamily=Oe(e,sy,t.fontFamily),this.fontSize=Oe(e,oy,t.fontSize),this.fontStyle=Oe(e,cy,t.fontStyle),this.fontVariant=Oe(e,ly,t.fontVariant),this.fontWeight=Oe(e,ay,t.fontWeight),this.letterSpacing=Oe(e,S2,t.letterSpacing),this.lineBreak=Oe(e,E2,t.lineBreak),this.lineHeight=Oe(e,L2,t.lineHeight),this.listStyleImage=Oe(e,M2,t.listStyleImage),this.listStylePosition=Oe(e,H2,t.listStylePosition),this.listStyleType=Oe(e,ca,t.listStyleType),this.marginTop=Oe(e,I2,t.marginTop),this.marginRight=Oe(e,D2,t.marginRight),this.marginBottom=Oe(e,_2,t.marginBottom),this.marginLeft=Oe(e,P2,t.marginLeft),this.opacity=Oe(e,iy,t.opacity);var n=Oe(e,k2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,N2,t.overflowWrap),this.paddingTop=Oe(e,O2,t.paddingTop),this.paddingRight=Oe(e,K2,t.paddingRight),this.paddingBottom=Oe(e,V2,t.paddingBottom),this.paddingLeft=Oe(e,z2,t.paddingLeft),this.paintOrder=Oe(e,my,t.paintOrder),this.position=Oe(e,R2,t.position),this.textAlign=Oe(e,W2,t.textAlign),this.textDecorationColor=Oe(e,ry,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Oe(e,ny,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,G2,t.textShadow),this.textTransform=Oe(e,$2,t.textTransform),this.transform=Oe(e,X2,t.transform),this.transformOrigin=Oe(e,j2,t.transformOrigin),this.visibility=Oe(e,ey,t.visibility),this.webkitTextStrokeColor=Oe(e,wy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,By,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,ty,t.wordBreak),this.zIndex=Oe(e,Ay,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return $A(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 Qt(this.display,4)||Qt(this.display,33554432)||Qt(this.display,268435456)||Qt(this.display,536870912)||Qt(this.display,67108864)||Qt(this.display,134217728)},i})(),Cy=(function(){function i(e,t){this.content=Oe(e,hy,t.content),this.quotes=Oe(e,fy,t.quotes)}return i})(),Du=(function(){function i(e,t){this.counterIncrement=Oe(e,uy,t.counterIncrement),this.counterReset=Oe(e,dy,t.counterReset)}return i})(),Oe=function(i,e,t){var A=new ou,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new au(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,lt(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 Xn.parse(i,n.parseComponentValue());case"color":return GA.parse(i,n.parseComponentValue());case"image":return la.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return WA(o)?o:Mt;case"length-percentage":var l=n.parseComponentValue();return bt(l)?l:Mt;case"time":return Hu.parse(i,n.parseComponentValue())}break}},vy="data-html2canvas-debug",Ty=function(i){var e=i.getAttribute(vy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},ha=function(i,e){var t=Ty(i);return t===1||e===t},FA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,ha(t,3))debugger;this.styles=new yy(e,window.getComputedStyle(t,null)),ba(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Un(this.context,t),ha(t,4)&&(this.flags|=16)}return i})(),xy="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",_u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ns=0;ns<_u.length;ns++)xr[_u.charCodeAt(ns)]=ns;for(var by=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=xr[i.charCodeAt(A)],s=xr[i.charCodeAt(A+1)],o=xr[i.charCodeAt(A+2)],l=xr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},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},Fy=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},pi=5,ua=11,da=2,Uy=ua-pi,Pu=65536>>pi,Sy=1<<pi,pa=Sy-1,Ey=1024>>pi,Ly=Pu+Ey,My=Ly,Hy=32,Iy=My+Hy,Dy=65536>>ua,_y=1<<Uy,Py=_y-1,ku=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},ky=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Ny=function(i,e){var t=by(i),A=Array.isArray(t)?Fy(t):new Uint32Array(t),r=Array.isArray(t)?Qy(t):new Uint16Array(t),n=24,s=ku(r,n/2,A[4]/2),o=A[5]===2?ku(r,(n+A[4])/2):ky(A,Math.ceil((n+A[4])/4));return new Oy(A[0],A[1],A[2],A[3],s,o)},Oy=(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>>pi],t=(t<<da)+(e&pa),this.data[t];if(e<=65535)return t=this.index[Pu+(e-55296>>pi)],t=(t<<da)+(e&pa),this.data[t];if(e<this.highStart)return t=Iy-Dy+(e>>ua),t=this.index[t],t+=e>>pi&Py,t=this.index[t],t=(t<<da)+(e&pa),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Nu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ky=typeof Uint8Array>"u"?[]:new Uint8Array(256),ss=0;ss<Nu.length;ss++)Ky[Nu.charCodeAt(ss)]=ss;var Vy=1,fa=2,ga=3,Ou=4,Ku=5,zy=7,Vu=8,ma=9,wa=10,zu=11,Wu=12,Ru=13,Gu=14,Ba=15,Wy=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},Ry=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},Gy=Ny(xy),lA="×",ya="÷",$y=function(i){return Gy.get(i)},Xy=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===fa&&s===ga)return lA;if(n===fa||n===ga||n===Ou||s===fa||s===ga||s===Ou)return ya;if(n===Vu&&[Vu,ma,zu,Wu].indexOf(s)!==-1||(n===zu||n===ma)&&(s===ma||s===wa)||(n===Wu||n===wa)&&s===wa||s===Ru||s===Ku||s===zy||n===Vy)return lA;if(n===Ru&&s===Gu){for(;r===Ku;)r=e[--A];if(r===Gu)return lA}if(n===Ba&&s===Ba){for(var o=0;r===Ba;)o++,r=e[--A];if(o%2===0)return lA}return ya},Zy=function(i){var e=Wy(i),t=e.length,A=0,r=0,n=e.map($y);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=lA;A<t&&(s=Xy(e,n,++A))===lA;);if(s!==lA||A===t){var o=Ry.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},Jy=function(i){for(var e=Zy(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},Yy=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},qy=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=Sn(A.data).map(function(l){return Ct(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var m=u.x>s.x||u.y>s.y;return s=u,c===0?!0:m});return i.body.removeChild(e),o},jy=function(){return typeof new Image().crossOrigin<"u"},eC=function(){return typeof new XMLHttpRequest().responseType=="string"},tC=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},$u=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},AC=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=Ca(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),Xu(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",$u(l)?Xu(Ca(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),$u(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ca=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},Xu=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))})},Ht={get SUPPORT_RANGE_BOUNDS(){var i=Yy(document);return Object.defineProperty(Ht,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Ht.SUPPORT_RANGE_BOUNDS&&qy(document);return Object.defineProperty(Ht,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=tC(document);return Object.defineProperty(Ht,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?AC(document):Promise.resolve(!1);return Object.defineProperty(Ht,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=jy();return Object.defineProperty(Ht,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=eC();return Object.defineProperty(Ht,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ht,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ht,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},br=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),iC=function(i,e,t,A){var r=sC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Ht.SUPPORT_RANGE_BOUNDS){var l=Zu(A,s,o.length).getClientRects();if(l.length>1){var c=va(o),u=0;c.forEach(function(y){n.push(new br(y,IA.fromDOMRectList(i,Zu(A,u+s,y.length).getClientRects()))),u+=y.length})}else n.push(new br(o,IA.fromDOMRectList(i,l)))}else{var m=A.splitText(o.length);n.push(new br(o,rC(i,A))),A=m}else Ht.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},rC=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=Un(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return IA.EMPTY},Zu=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(Ht.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 Jy(i)},nC=function(i,e){if(Ht.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 aC(i,e)},sC=function(i,e){return e.letterSpacing!==0?va(i):nC(i,e)},oC=[32,160,4961,65792,65793,4153,4241],aC=function(i,e){for(var t=Dw(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=Sn(s),l="";o.forEach(function(c){oC.indexOf(c)===-1?l+=Ct(c):(l.length&&A.push(l),A.push(Ct(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},lC=(function(){function i(e,t,A){this.text=cC(t.data,A.textTransform),this.textBounds=iC(e,this.text,A,t)}return i})(),cC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(hC,uC);case 2:return i.toUpperCase();default:return i}},hC=/(^|\s|:|-|\(|\))([a-z])/g,uC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},Ju=(function(i){gA(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})(FA),Yu=(function(i){gA(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})(FA),qu=(function(i){gA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Un(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})(FA),ju=(function(i){gA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(FA),Ta=(function(i){gA(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})(FA),dC=[{type:15,flags:0,unit:"px",number:3}],pC=[{type:16,flags:0,number:50}],fC=function(i){return i.width>i.height?new IA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new IA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},gC=function(i){var e=i.type===mC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},os="checkbox",as="radio",mC="password",ed=707406591,xa=(function(i){gA(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=gC(A),(r.type===os||r.type===as)&&(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=fC(r.bounds)),r.type){case os:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=dC;break;case as:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=pC;break}return r}return e})(FA),td=(function(i){gA(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})(FA),Ad=(function(i){gA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(FA),id=(function(i){gA(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=nd(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?vr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):_A.TRANSPARENT,s=A.contentWindow.document.body?vr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):_A.TRANSPARENT;r.backgroundColor=$A(n)?$A(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(FA),wC=["OL","UL","MENU"],ls=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,sd(r)&&r.data.trim().length>0)t.textNodes.push(new lC(i,r,t.styles));else if(Hi(r))if(ud(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return ls(i,o,t,A)});else{var s=rd(i,r);s.styles.isVisible()&&(BC(r,s,A)?s.flags|=4:yC(s.styles)&&(s.flags|=2),wC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?ls(i,r.shadowRoot,s,A):!hs(r)&&!od(r)&&!us(r)&&ls(i,r,s,A))}},rd=function(i,e){return Fa(e)?new Ju(i,e):ad(e)?new Yu(i,e):od(e)?new qu(i,e):CC(e)?new ju(i,e):vC(e)?new Ta(i,e):TC(e)?new xa(i,e):us(e)?new td(i,e):hs(e)?new Ad(i,e):cd(e)?new id(i,e):new FA(i,e)},nd=function(i,e){var t=rd(i,e);return t.flags|=4,ls(i,e,t,t),t},BC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Qa(i)&&t.styles.isTransparent()},yC=function(i){return i.isPositioned()||i.isFloating()},sd=function(i){return i.nodeType===Node.TEXT_NODE},Hi=function(i){return i.nodeType===Node.ELEMENT_NODE},ba=function(i){return Hi(i)&&typeof i.style<"u"&&!cs(i)},cs=function(i){return typeof i.className=="object"},CC=function(i){return i.tagName==="LI"},vC=function(i){return i.tagName==="OL"},TC=function(i){return i.tagName==="INPUT"},xC=function(i){return i.tagName==="HTML"},od=function(i){return i.tagName==="svg"},Qa=function(i){return i.tagName==="BODY"},ad=function(i){return i.tagName==="CANVAS"},ld=function(i){return i.tagName==="VIDEO"},Fa=function(i){return i.tagName==="IMG"},cd=function(i){return i.tagName==="IFRAME"},hd=function(i){return i.tagName==="STYLE"},bC=function(i){return i.tagName==="SCRIPT"},hs=function(i){return i.tagName==="TEXTAREA"},us=function(i){return i.tagName==="SELECT"},ud=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})(),pd={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"]},fd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},FC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},UC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Ii=function(i,e,t,A,r,n){return i<e||i>t?Fr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},gd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},vt=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(gd(Math.abs(i),n,A,function(s){return Ct(Math.floor(s%n)+e)})+r)},fi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return gd(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},Di=1,ZA=2,JA=4,Qr=8,PA=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Fr(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&&Qt(n,Di)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Qt(n,ZA)||c===1&&l===1&&Qt(n,JA)&&i>100||c===1&&l>1&&Qt(n,Qr)?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},md="十百千萬",wd="拾佰仟萬",Bd="マイナス",Ua="마이너스",Fr=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=vt(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return fi(i,"〇一二三四五六七八九",r);case 6:return Ii(i,1,3999,pd,3,A).toLowerCase();case 7:return Ii(i,1,3999,pd,3,A);case 8:return vt(i,945,969,!1,A);case 9:return vt(i,97,122,!1,A);case 10:return vt(i,65,90,!1,A);case 11:return vt(i,1632,1641,!0,A);case 12:case 49:return Ii(i,1,9999,fd,3,A);case 35:return Ii(i,1,9999,fd,3,A).toLowerCase();case 13:return vt(i,2534,2543,!0,A);case 14:case 30:return vt(i,6112,6121,!0,A);case 15:return fi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return fi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return PA(i,"零一二三四五六七八九",md,"負",r,ZA|JA|Qr);case 47:return PA(i,"零壹貳參肆伍陸柒捌玖",wd,"負",r,Di|ZA|JA|Qr);case 42:return PA(i,"零一二三四五六七八九",md,"负",r,ZA|JA|Qr);case 41:return PA(i,"零壹贰叁肆伍陆柒捌玖",wd,"负",r,Di|ZA|JA|Qr);case 26:return PA(i,"〇一二三四五六七八九","十百千万",Bd,r,0);case 25:return PA(i,"零壱弐参四伍六七八九","拾百千万",Bd,r,Di|ZA|JA);case 31:return PA(i,"영일이삼사오육칠팔구","십백천만",Ua,n,Di|ZA|JA);case 33:return PA(i,"零一二三四五六七八九","十百千萬",Ua,n,0);case 32:return PA(i,"零壹貳參四五六七八九","拾百千",Ua,n,Di|ZA|JA);case 18:return vt(i,2406,2415,!0,A);case 20:return Ii(i,1,19999,UC,3,A);case 21:return vt(i,2790,2799,!0,A);case 22:return vt(i,2662,2671,!0,A);case 22:return Ii(i,1,10999,FC,3,A);case 23:return fi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return fi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return vt(i,3302,3311,!0,A);case 28:return fi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return fi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return vt(i,3792,3801,!0,A);case 37:return vt(i,6160,6169,!0,A);case 38:return vt(i,4160,4169,!0,A);case 39:return vt(i,2918,2927,!0,A);case 40:return vt(i,1776,1785,!0,A);case 43:return vt(i,3046,3055,!0,A);case 44:return vt(i,3174,3183,!0,A);case 45:return vt(i,3664,3673,!0,A);case 46:return vt(i,3872,3881,!0,A);default:return vt(i,48,57,!0,A)}},yd="data-html2canvas-ignore",Cd=(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=SC(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=MC(r).then(function(){return Wt(A,void 0,void 0,function(){var u,m;return Nt(this,function(y){switch(y.label){case 0:return this.scrolledElements.forEach(_C),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,m=this.clonedReferenceElement,typeof m>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:y.sent(),y.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,LC(l)]:[3,4];case 3:y.sent(),y.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(IC(document.doctype)+"<html></html>"),DC(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(ha(e,2))debugger;if(ad(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 Fa(t)&&(Fa(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 Sa(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){(!Hi(t)||!bC(t)&&!t.hasAttribute(yd)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Hi(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(Hi(n)&&ud(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,A)})}else this.appendChildNode(t,n,A)},i.prototype.cloneNode=function(e,t){if(sd(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Hi(e)&&(ba(e)||cs(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&&ba(r)&&(this.clonedReferenceElement=r),Qa(r)&&NC(r);var l=this.counters.parse(new Du(this.context,n)),c=this.resolvePseudoContent(e,r,s,Ur.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,Ur.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||cs(e))&&!cd(e)||t)&&Sa(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(hs(e)||us(e))&&(hs(r)||us(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 Du(this.context,A));var l=new Cy(this.context,A),c=o.createElement("html2canvaspseudoelement");Sa(A,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var y=o.createElement("img");y.src=m.value,y.style.opacity="1",c.appendChild(y)}else if(m.type===18){if(m.name==="attr"){var v=m.values.filter(lt);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(m.name==="counter"){var T=m.values.filter(Li),B=T[0],S=T[1];if(B&&lt(B)){var F=n.counters.getCounterValue(B.value),U=S&&lt(S)?ca.parse(n.context,S.value):3;c.appendChild(o.createTextNode(Fr(F,U,!1)))}}else if(m.name==="counters"){var k=m.values.filter(Li),B=k[0],R=k[1],S=k[2];if(B&&lt(B)){var L=n.counters.getCounterValues(B.value),z=S&&lt(S)?ca.parse(n.context,S.value):3,te=R&&R.type===0?R.value:"",$=L.map(function(re){return Fr(re,z,!1)}).join(te);c.appendChild(o.createTextNode($))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(Iu(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Iu(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=Ea+" "+La;var u=r===Ur.BEFORE?" "+Ea:" "+La;return cs(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),Ur;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})(Ur||(Ur={}));var SC=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(yd,"true"),i.body.appendChild(t),t},EC=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},LC=function(i){return Promise.all([].slice.call(i.images,0).map(EC))},MC=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)}})},HC=["all","d","content"],Sa=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);HC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},IC=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},DC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},_C=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},PC=":before",kC=":after",Ea="___html2canvas___pseudoelement_before",La="___html2canvas___pseudoelement_after",vd=`{
1
+ (function(tt,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):(tt=typeof globalThis<"u"?globalThis:tt||self,a(tt.ChartSDK={},tt.jsxRuntime,tt.React))})(this,(function(tt,a,j){"use strict";var Us=typeof document<"u"?document.currentScript:null;const _t="17:00-17:00",Pt="America/New_York",CA="24x7",vA="UTC",Ra={EURUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},ETHUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},BNBUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},SOLUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},ADAUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},XRPUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},DOTUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},MATICUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},LINKUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"}},Ga={type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"};function Wi(i){return i&&Ra[i.toUpperCase()]||Ga}function kr(i){return Wi(i).type==="forex"}function Or(i){return Wi(i).type==="crypto"}function hp(i){return Wi(i).session==="24x7"}function q(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 up(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 $a(i){return Array.isArray(i)?i.map(e=>({...e,time:q(e.time)})).filter(e=>e.time!=null):[]}function pp(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 Ve(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function Xa(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(q(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 Za(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 Ja(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=q(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 fp(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 gp(i,e){if(!Array.isArray(i)||i.length===0)return i;const t=[],A=Math.max(e*10080,604800),r=1e4;for(let o=0;o<i.length;o++)if(t.push(i[o]),o<i.length-1){const l=i[o].time,c=i[o+1].time,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const m=i[o];let y=l+e,v=0;for(y=Ve(y,e);y<c&&v<r;){const T=Ve(y,e);t.some(U=>U.time===T)||(t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),v++),y+=e}if(y<c&&v>=r){const T=Ve(c-e,e);t.some(U=>U.time===T)||t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function iA(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 Ya(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=Wi(e),r=iA(t),o=$a(i).map(E=>({...E,time:Ve(E.time,r)})).filter(E=>Xa(E)).map(E=>Za(E)),l=Ja(o);l.sort((E,N)=>E.time-N.time);const c=Math.floor(Date.now()/1e3),u=l.filter(E=>E.time<=c),m=u.filter((E,N)=>N===0?!0:E.time>u[N-1].time),y=m.length>10?fp(m,"percentile"):m,v=Ja(y);v.sort((E,N)=>E.time-N.time);const T=gp(v,r),C=[];for(let E=1;E<T.length;E++){const N=T[E].time-T[E-1].time;N>r*2&&C.push({from:T[E-1].time,to:T[E].time,gapSeconds:N,gapMinutes:Math.round(N/60),fromDate:new Date(T[E-1].time*1e3).toISOString(),toDate:new Date(T[E].time*1e3).toISOString()})}const U=y.filter((E,N)=>N===0?!1:E.close===y[N-1].close&&E.open===y[N-1].close).length,F={original:i.length,processed:T.length,duplicates:i.length-l.length,outliers:U,gaps:C,filledGaps:T.length-v.length,symbolConfig:A};return{candles:T,stats:F}}function qa(i,e,t="1m"){if(!i||!e||!Xa(i))return null;const A=q(i.time);if(A==null)return null;const r=iA(t),n=Ve(A,r);return Za({...i,time:n})}function mt(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 ii(i,e){return i.width===e.width&&i.height===e.height}var mp=(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 wp(i){return new mp(i)}var Bp=(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=mt({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 mt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=mt(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;ii(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=mt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=ii(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&ii(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}Cp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=ja(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=wp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=ja(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?vp(n[0],r):mt({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=mt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function yp(i,e){return new Bp(i,e.transform,e.options)}function ja(i){return i.ownerDocument.defaultView}function Cp(){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 vp(i,e){return mt({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 Tp=(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 ri(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 Tp(r,t,A)}const xp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},bp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Qp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Fp={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},Up={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},Sp={color:"#26a69a",base:0},el={color:"#2196f3"},tl={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 Al,il;function ni(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 rl(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 VA(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function Vt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Le(i){if(i===null)throw new Error("Value is null");return i}function Ci(i){return Le(Vt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(Al||(Al={})),(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"})(il||(il={}));const nl={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 oA(i){return i<0?0:i>255?255:Math.round(i)||0}function sl(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const Ep=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Lp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Mp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Hp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function Ri(i){(i=i.toLowerCase())in nl&&(i=nl[i]);{const e=Hp.exec(i)||Mp.exec(i);if(e)return[oA(parseInt(e[1],10)),oA(parseInt(e[2],10)),oA(parseInt(e[3],10)),sl(e.length<5?1:parseFloat(e[4]))]}{const e=Lp.exec(i);if(e)return[oA(parseInt(e[1],16)),oA(parseInt(e[2],16)),oA(parseInt(e[3],16)),1]}{const e=Ep.exec(i);if(e)return[oA(17*parseInt(e[1],16)),oA(17*parseInt(e[2],16)),oA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function ol(i){return .199*i[0]+.687*i[1]+.114*i[2]}function Kr(i){const e=Ri(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:ol(e)>160?"black":"white"}}class vt{constructor(){this.h=[]}l(e,t,A){const r={o:e,_:t,u:A===!0};this.h.push(r)}v(e){const t=this.h.findIndex((A=>e===A.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,A){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function fA(i,...e){for(const t of e)for(const A in t)t[A]!==void 0&&Object.prototype.hasOwnProperty.call(t,A)&&!["__proto__","constructor","prototype"].includes(A)&&(typeof t[A]!="object"||i[A]===void 0||Array.isArray(t[A])?i[A]=t[A]:fA(i[A],t[A]));return i}function TA(i){return typeof i=="number"&&isFinite(i)}function Gi(i){return typeof i=="number"&&i%1==0}function $i(i){return typeof i=="string"}function Vr(i){return typeof i=="boolean"}function _A(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"?_A(r):r);return t}function Ip(i){return i!==null}function Xi(i){return i===null?void 0:i}const Ss="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function vi(i,e,t){return e===void 0&&(e=Ss),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Dp{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=vi(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 Es{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class gA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class _p extends gA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const u=n.it[c],m=Math.round(u.nt*t)+s,y=u.st*A,v=l*A+s;e.moveTo(m,y),e.arc(m,y,v,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function Pp(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Np={from:0,to:1};class kp{constructor(e,t){this.ut=new Es,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(Pp),this.ct=this.dt.map((A=>{const r=new _p;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=Le(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=Np}))}}let Op=class extends gA{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,ni(e,this.zt.Lt.Nt),(function(c,u,m,y){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,m),c.lineTo(u+v,y),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,ni(e,this.zt.Et.Nt),rl(e,l,0,t.width))}};class Kp{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 Op(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=Le(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 Vp(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 zr(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function al(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 ll(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return al(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;al(i,e+c,t+c,A-s,r-s,(u=-c,o.map((m=>m===0?m:m+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function cl(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 hl{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,A,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const u=this.Gt(l,t,A,r),m=u.Jt;return u.Qt?ll(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):ll(c,m.ri,m.ii,m.ni,m.si,s,m.ei,[0,m.ht,m.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(m.ri,m.li,m.ai-m.ri,m.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(u.Qt?m.ui-m.ei:0,m.ii,m.ei,m.ci-m.ii)),u}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,m=this.zt.hi||!this.zt.mi?t.T:0,y=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,T=t.B+this.Xt.gi,C=t.A,U=t.I,F=this.zt.Kt,E=t.P,N=A.Mi(s,F),R=Math.ceil(A.xi(s,F)),M=E+v+T,z=t.C+C+U+R+m,Ae=Math.max(1,Math.floor(u));let $=Math.round(M*u);$%2!=Ae%2&&($+=1);const V=y>0?Math.max(1,Math.floor(y*c)):0,ie=Math.round(z*c),re=Math.round(m*c),ce=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,Z=Math.round(ce*u)-Math.floor(.5*u),ee=Math.floor(Z+Ae/2-$/2),oe=ee+$,le=r==="right",se=le?l.width-y:y,he=le?o.width-V:V;let pe,ge,be;return le?(pe=he-ie,ge=he-re,be=se-m-C-y):(pe=he+ie,ge=he+re,be=se+m+C),{Qt:le,Jt:{ii:ee,li:Z,ci:oe,ni:ie,si:$,ht:2*c,ei:V,ti:pe,ri:he,ai:ge,oi:Ae,ui:o.width},di:{ii:ee/u,ci:oe/u,fi:be,pi:N}}}}class Wr{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||hl)(this.Ci,this.yi),this.Ri=new(e||hl)(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 zp extends Wr{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=Kr(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 Wp=/[1-9]/g;class ul{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const A=e.useMediaCoordinateSpace((({context:y})=>(y.font=t.R,Math.round(t.Wi.xi(y,Le(this.zt).Kt,Wp)))));if(A<=0)return;const r=t.ji,n=A+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const u=c+n,m=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:y,horizontalPixelRatio:v,verticalPixelRatio:T})=>{const C=Le(this.zt);y.fillStyle=C.t;const U=Math.round(c*v),F=Math.round(0*T),E=Math.round(u*v),N=Math.round(m*T),R=Math.round(2*v);if(y.beginPath(),y.moveTo(U,F),y.lineTo(U,N-R),y.arcTo(U,N,U+R,N,R),y.lineTo(E-R,N),y.arcTo(E,N,E,N-R,R),y.lineTo(E,F),y.fill(),C.hi){const M=Math.round(C.ki*v),z=F,Ae=Math.round((z+t.T)*T);y.fillStyle=C.V;const $=Math.max(1,Math.floor(v)),V=Math.floor(.5*v);y.fillRect(M-V,z,$,Ae-z)}})),e.useMediaCoordinateSpace((({context:y})=>{const v=Le(this.zt),T=0+t.C+t.T+t.L+t.P/2;y.font=t.R,y.textAlign="left",y.textBaseline="middle",y.fillStyle=v.V;const C=t.Wi.Mi(y,"Apr0");y.translate(c+r,T+C),y.fillText(v.Kt,0,0)}))}}class Rp{constructor(e,t,A){this.ft=!0,this.Wt=new ul,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(Le(n)),e.yt=!0;const s=Kr(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Ls{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 dl;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(dl||(dl={}));class Gp extends Ls{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 kp(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Le(this.tn).vn())return{_t:l,ki:o};{const c=Le(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 Rp(this,e,A),this.wn=new Kp(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(Ip),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 zp(this,t,A),e.set(t,r)),r}}function Rr(i){return i==="left"||i==="right"}class Mt{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 Mt(2)}static es(){return new Mt(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 pl=".";function PA(i,e){if(!TA(i))return"n/a";if(!Gi(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 Gr{constructor(e,t){if(t||(t=1),TA(e)&&Gi(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=pl+PA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=pl+PA(0,n));return A.toFixed(0)+r}}class fl extends Gr{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class $p{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 gl(i,e,t,A,r,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=i,u=e[A.from];let m=n(i,u),y=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const T={nt:u.nt-v,st:u.st},C={nt:u.nt+v,st:u.st};o.moveTo(T.nt*l,T.st*c),o.lineTo(C.nt*l,C.st*c),s(i,m,T,C)}else{const v=(C,U)=>{s(i,m,y,U),o.beginPath(),m=C,y=U};let T=y;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let C=A.from+1;C<A.to;++C){T=e[C];const U=n(i,T);switch(t){case 0:o.lineTo(T.nt*l,T.st*c);break;case 1:o.lineTo(T.nt*l,e[C-1].st*c),U!==m&&(v(U,T),o.lineTo(T.nt*l,e[C-1].st*c)),o.lineTo(T.nt*l,T.st*c);break;case 2:{const[F,E]=Xp(e,C-1,C);o.bezierCurveTo(F.nt*l,F.st*c,E.nt*l,E.st*c,T.nt*l,T.st*c);break}}t!==1&&U!==m&&(v(U,T),o.moveTo(T.nt*l,T.st*c))}(y!==T||y===T&&t===1)&&s(i,m,y,T)}}const ml=6;function Ms(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function wl(i,e){return{nt:i.nt/e,st:i.st/e}}function Xp(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=wl(Ms(i[t],i[A]),ml),{nt:n.nt+s.nt,st:n.st+s.st}),Ms(i[t],wl(Ms(i[r],i[e]),ml))]}function Zp(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 Bl extends gA{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,ni(u,o),u.lineWidth=1,gl(e,A,l,r,n,this.bs.bind(this),Zp.bind(null,c))}}function Hs(i,e,t){return Math.min(Math.max(i,e),t)}function $r(i,e,t){return e-i<=t}function yl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Is{ws(e,t){const A=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==r||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==l){const u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const m=Hs(c*e.verticalPixelRatio/l,0,1);u.addColorStop(m,n),u.addColorStop(m,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class Jp extends Bl{constructor(){super(...arguments),this.Ts=new Is}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function Yp(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class Cl extends gA{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,ni(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&gl(e,t,n,A,r,u,Yp),l&&(function(m,y,v,T,C){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:E}=m;let N=null;const R=Math.max(1,Math.floor(U))%2/2,M=v*F+R;for(let z=T.to-1;z>=T.from;--z){const Ae=y[z];if(Ae){const $=C(m,Ae);$!==N&&(E.beginPath(),N!==null&&E.fill(),E.fillStyle=$,N=$);const V=Math.round(Ae.nt*U)+R,ie=Ae.st*F;E.moveTo(V,ie),E.arc(V,ie,M,0,2*Math.PI)}}E.fill()})(e,t,l,A,u)}}class vl extends Cl{Vs(e,t){return t.lt}}function Tl(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 Zi=Tl.bind(null,!0),xl=Tl.bind(null,!1);function qp(i,e){return i.ot<e}function jp(i,e){return e<i.ot}function bl(i,e,t){const A=e.Os(),r=e.ui(),n=Zi(i,A,qp),s=xl(i,r,jp);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 Ds{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=bl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class Xr extends Ds{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,Xi(this.Ls)),e.te(this.zs,A,Xi(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 ef extends Xr{constructor(e,t){super(e,t),this.js=new Es,this.re=new Jp,this.he=new vl,this.js.Z([this.re,this.he])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W();this.re.J({fs:e.lineType,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,vs:null,ps:e.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:e.lineVisible?e.lineType:void 0,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}}class tf extends gA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),u=c-l,m=this.oe,y=u+m-1,v=Math.min(o.de,o.fe),T=Math.max(o.de,o.fe),C=Math.round(v*A)-l,U=Math.round(T*A)+l,F=Math.max(U-C,this.oe);e.fillRect(u,C,m,F);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-E;let Ae=Math.max(C,Math.round(o.pe*A)-l),$=Ae+m-1;$>C+F-1&&($=C+F-1,Ae=$-m+1),e.fillRect(z,Ae,u-z,$-Ae+1)}const N=c+E;let R=Math.max(C,Math.round(o.me*A)-l),M=R+m-1;M>C+F-1&&(M=C+F-1,R=M-m+1),e.fillRect(y+1,R,N-y,M-R+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Le(this.zt).le,e)))}}class Ql extends Ds{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,Xi(this.Ls)),e.be(this.zs,A,Xi(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 Af extends Ql{constructor(){super(...arguments),this.js=new tf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class rf extends Bl{constructor(){super(...arguments),this.Ts=new Is}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 nf extends Cl{constructor(){super(...arguments),this.Pe=new Is}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 sf extends Xr{constructor(e,t){super(e,t),this.js=new Es,this.Ve=new rf,this.Oe=new nf,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 of extends gA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),l=Math.floor(n*o*s),c=Math.floor(n*s),u=Math.min(l,c);return Math.max(Math.floor(s),u)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",l=Math.min(Math.floor(n),Math.floor(this.zt.le*n));l=Math.max(Math.floor(n),Math.min(l,this.ae));const c=Math.floor(.5*l);let u=null;for(let m=A.from;m<A.to;m++){const y=t[m];y.Ee!==o&&(r.fillStyle=y.Ee,o=y.Ee);const v=Math.round(Math.min(y.pe,y.me)*s),T=Math.round(Math.max(y.pe,y.me)*s),C=Math.round(y.de*s),U=Math.round(y.fe*s);let F=Math.round(n*y.nt)-c;const E=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,E));const N=E-F+1;r.fillRect(F,C,N,v-C),r.fillRect(F,T+1,N,U-T),u=E}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const A=Math.max(Math.floor(e),t);return this.ae<=2*A?Math.max(Math.floor(e),Math.floor(1*e)):A}Ie(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let u=A.from;u<A.to;u++){const m=t[u];m.Ne!==o&&(r.fillStyle=m.Ne,o=m.Ne);let y=Math.round(m.nt*n)-Math.floor(.5*this.ae);const v=y+this.ae-1,T=Math.round(Math.min(m.pe,m.me)*s),C=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(y=Math.max(c+1,y),y=Math.min(y,v)),this.zt.le*n>2*l)Vp(r,y,T,v-y+1,C-T+1,l);else{const U=v-y+1;r.fillRect(y,T,U,C-T+1)}c=v}}Le(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=A.from;c<A.to;c++){const u=t[c];let m=Math.round(Math.min(u.pe,u.me)*s),y=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),T=v+this.ae-1;if(u.ce!==o){const C=u.ce;r.fillStyle=C,o=C}this.zt._i&&(v+=l,m+=l,T-=l,y-=l),m>y||r.fillRect(v,m,T-v+1,y-m+1)}}}class af extends Ql{constructor(){super(...arguments),this.js=new of}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 _s extends Ds{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,Xi(this.Ls))}Js(){this.wn.update({bars:this.zs.map(cf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function cf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class hf extends gA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],u=Math.round(l.st*A);let m,y;e.fillStyle=l.ce,u<=n?(m=u,y=s):(m=n,y=u-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,y-m)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,c;if(A%2){const u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class uf extends Xr{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,Le(this.Es.Ct()).Vt)};this.js.J(e)}}class df extends Xr{constructor(){super(...arguments),this.js=new vl}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 pf=/[2-9]/g;class Ji{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||pf,n=String(t).replace(r,"0");if(this.tr.has(n))return Vt(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 ff{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 Fl{constructor(e,t,A){this.ur=e,this.ar=new Ji(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new ff(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 gf extends gA{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),ni(e,this.zt.Nt),rl(e,n,0,t.width))}}class Ps{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new gf,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 mf extends Ps{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 wf extends gA{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 Bf=[{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 Ul(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=Ri(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Sl(i,e){const t=i%2600/2600;let A;for(const l of Bf)if(t>=l.Vr&&t<=l.Or){A=l;break}VA(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:Ul(e,r,A.Ir,A.zr),Dr:Ul(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class yf{constructor(e){this.Wt=new wf,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=Sl(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=Sl(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 Yi(i,e){return yl(Math.min(Math.max(i,12),30)*e)}function qi(i,e){switch(i){case"arrowDown":case"arrowUp":return Yi(e,1);case"circle":return Yi(e,.8);case"square":return Yi(e,.7)}}function El(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(Yi(i,1))}function Ll(i){return Math.max(Yi(i,.1),3)}function Ml(i,e,t){return e?i:t?Math.ceil(i/2):0}function Hl(i,e,t,A,r){const n=qi("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function Il(i,e,t,A){const r=(qi("arrowUp",A)-1)/2*t.Jr,n=(yl(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 Cf(i,e,t,A,r,n){return Hl(e,t,A,r,n)}class vf extends gA{constructor(){super(...arguments),this.zt=null,this.ar=new Ji,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=vi(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(xf(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),Tf(o,e,t,A)}}}}function Tf(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 Il(!1,n,s,r.Ks);case"arrowUp":return void Il(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(qi("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=qi("square",c),m=(u-1)*l.Jr/2,y=l.nt-m,v=l.st-m;o.fillRect(y,v,u*l.Jr,u*l.Jr)})(n,s,r.Ks)}r.nh}})(i,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(i,t,A))}function xf(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 Cf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const m=2+qi("circle",l)/2,y=s-c,v=o-u;return Math.sqrt(y*y+v*v)<=m})(A.nt,A.st,A.Ks,r,n);case"square":return Hl(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function bf(i,e,t,A,r,n,s,o,l){const c=TA(t)?t:t.Se,u=TA(t)?t:t.Me,m=TA(t)?t:t.xe,y=TA(e.size)?Math.max(e.size,0):1,v=El(o.le())*y,T=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-T-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-T-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(m,l)+T+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class Qf{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=Ll(e),A=1.5*El(e)+2*t,r=this.fh();this.ah={above:Ml(A,r.aboveBar,r.inBar),below:Ml(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=Ll(t.le()),c={sh:l,eh:l};this.zt.tt=bl(this.zt.it,n,!0);for(let u=this.zt.tt.from;u<this.zt.tt.to;u++){const m=A[u];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const y=this.zt.it[u];y.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(y.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(m.time);v!==null&&bf(y,m,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Ff extends Ps{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 Uf extends Wr{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const u=r.mh(c.V),m=Kr(u);A.t=m.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=m.i,t.V=m.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function Dl(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 Xt{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 Xt(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 Xt(Dl(Math.min,this.Ph(),e.Ph(),-1/0),Dl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!TA(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){TA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new Xt(e.minValue,e.maxValue)}}class Zr{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 Zr(Xt.Ah(e.priceRange),e.margins)}}class Sf extends Ps{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 Ef extends Wr{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=Kr(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 Lf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Sf(e,this),this.ur=new Ef(e,this),this.Hh=new Fl(this.ur,e,e.$t())}$h(e){fA(this.cn,e),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const e=this.jr,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const A=e.Ct();return A===null?null:t.Rt(this.cn.price,A.Vt)}}class Mf extends Ls{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Hf={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Le(i(t,A)),l=Ci(o.Vt[0])<=Ci(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,u=e.borderDownColor,m=e.wickUpColor,y=e.wickDownColor,v=Le(i(t,A)),T=Ci(v.Vt[0])<=Ci(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:T?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:T?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:T?m:y}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Le(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Le(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=Le(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=Le(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=Le(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class If{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Hf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var _l;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(_l||(_l={}));const zA=30;class Df{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=Jr(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 Zi(this.tl,e,((t,A)=>t.ee<A))}vl(e){return xl(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=Le(this.el()),s=Le(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/zA)*zA,u=Math.max(c,Math.floor(l/zA)*zA);{const y=this.fl(o),v=this.vl(Math.min(l,c,t));r=Jr(r,this.pl(y,v,A))}let m=this.il.get(A);m===void 0&&(m=new Map,this.il.set(A,m));for(let y=Math.max(c+1,o);y<u;y+=zA){const v=Math.floor(y/zA);let T=m.get(v);if(T===void 0){const C=this.fl(v*zA),U=this.vl((v+1)*zA-1);T=this.pl(C,U,A),m.set(v,T)}r=Jr(r,T)}{const y=this.fl(u),v=this.vl(l);r=Jr(r,this.pl(y,v,A))}return r}}function Jr(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class _f{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 Ns{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 _f(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 Pl(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 Pf{constructor(e,t){this.Wt=new ul,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Pl(this.kl))),this.Wt}}class Nf extends Wr{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Pl(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 kf{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 Ns(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 Pf(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 Nf(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 Ns(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 Ns(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 ks(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function Os(i){return i.Pn()}function Of(i){return i.Bl()}function Kf(i){return i.Al()}class Ks extends Mf{constructor(e,t,A,r,n){super(e),this.zt=new Df,this.jh=new Ff(this),this.zl=[],this.Ll=new mf(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 Uf(this);this.rn=[s],this.Hh=new Fl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new yf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},A=this.Dt();if(this.$t().St().Ni()||A.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const m=this.zt.sl();if(m===null)return t;s=m,o=m.ee}else{const m=this.zt.ll(r.ui(),-1);if(m===null||(s=this.zt.Gh(m.ee),s===null))return t;o=m.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),u=A.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:A.Fi(l,n.Vt),xh:A.Yl(l),Sh:A.Zl(l,n.Vt),V:c.ce,ki:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new If(this)),this.Nl}W(){return this.cn}$h(e){const t=e.priceScaleId;t!==void 0&&t!==this.cn.priceScaleId&&this.$t().Xl(this,t),fA(this.cn,e),e.priceFormat!==void 0&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(e,t){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(t&&t.ta?this.El.$r():e.length===0&&this.El.Hr());const A=this.$t().dr(this);this.$t().ia(A),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const t=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const t=new Lf(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=[];ks(this.Hl,Os,"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),ks(this.Hl,Os,"normal",e),e}ua(){return this.ca(Os,"bottom")}da(e){return this.ca(Of,e)}fa(e){return this.ca(Kf,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 Zr.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 Le(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 kf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof _s)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof _s)return e=>this.wn.je(e)}_a(){return!Rr(this.Dt().Pa())}pa(e,t){if(!Gi(e)||!Gi(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 Xt(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new Xt(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 Xt(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,m,y;l?.margins&&(c=s,u=l.margins,s={above:Math.max((m=c?.above)!==null&&m!==void 0?m:0,u.above),below:Math.max((y=c?.below)!==null&&y!==void 0?y:0,u.below)})})),new Zr(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 $p(this.cn.priceFormat.precision);break;case"percent":this.wa=new fl(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new Gr(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=Le(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Le(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Le(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 Qf(this,this.$t()),this.$l){case"Bar":this.wn=new Af(this,this.$t());break;case"Candlestick":this.wn=new af(this,this.$t());break;case"Line":this.wn=new df(this,this.$t());break;case"Custom":this.wn=new _s(this,this.$t(),Vt(e));break;case"Area":this.wn=new ef(this,this.$t());break;case"Baseline":this.wn=new sf(this,this.$t());break;case"Histogram":this.wn=new uf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return ks(this.Hl,e,t,A),A}}class Vf{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 Ks)).reduce(((u,m)=>{if(A.vr(m)||!m.yt())return u;const y=m.Dt(),v=m.In();if(y.Ni()||!v.Kr(t))return u;const T=v.Gh(t);if(T===null)return u;const C=Ci(m.Ct());return u.concat([y.Rt(T.Vt[3],C.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,m)=>Math.abs(u-o)-Math.abs(m-o)));const c=l[0];return r=n.pn(c,s),r}}class zf extends gA{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=Le(this.zt);if(s.Aa){e.strokeStyle=s.Ia,ni(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,ni(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 Wf{constructor(e){this.Wt=new zf,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 Rf{constructor(e){this.wn=new Wf(e)}qh(){return this.wn}}const Vs={$a:4,Ua:1e-4};function Ti(i,e){const t=100*(i-e)/e;return e<0?-t:t}function Gf(i,e){const t=Ti(i.Ph(),e),A=Ti(i.Rh(),e);return new Xt(t,A)}function ji(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function $f(i,e){const t=ji(i.Ph(),e),A=ji(i.Rh(),e);return new Xt(t,A)}function Yr(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 er(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 tr(i,e){if(i===null)return null;const t=Yr(i.Ph(),e),A=Yr(i.Rh(),e);return new Xt(t,A)}function qr(i,e){if(i===null)return null;const t=er(i.Ph(),e),A=er(i.Rh(),e);return new Xt(t,A)}function zs(i){if(i===null)return Vs;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return Vs;const t=Math.ceil(Math.abs(Math.log10(e))),A=Vs.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class Ws{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let r=A;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let A=this.qa;A!==1;){if(A%2==0)this.Za.push(2),A/=2;else{if(A%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),A/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,A){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const m=$r(n,r,1e-14)&&n>r+1e-14,y=$r(n,A*o,1e-14),v=$r(n,1,1e-14);if(!(m&&y&&v))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];$r(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 Nl{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 Ws(this.qa,[2,2.5,2]),s=new Ws(this.qa,[2,2,2.5]),o=new Ws(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let u=c[0];for(let m=1;m<c.length;++m)c[m]<u&&(u=c[m]);return u})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),r=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=A-1-s,c=Math.max(r,n),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let m=this.Xa(c,u),y=c%m;y+=y<0?m:0;const v=c>=u?1:-1;let T=null,C=0;for(let U=c-y;U>u;U-=m){const F=this.Ja(U,t,!0);T!==null&&Math.abs(F-T)<this.Qa()||F<o||F>l||(C<this.Ka.length?(this.Ka[C].Ea=F,this.Ka[C].so=e.eo(U)):this.Ka.push({Ea:F,so:e.eo(U)}),C++,T=F,e.ro()&&(m=this.Xa(U*v,u)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function kl(i){return i.slice().sort(((e,t)=>Le(e.Xi())-Le(t.Xi())))}var Ol;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(Ol||(Ol={}));const Kl=new fl,Vl=new Gr(100,1);class Xf{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 vt,this.vo=new vt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=Vl,this.xo=zs(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Nl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(fA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=Vt(e.scaleMargins.top),A=Vt(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=er(n.Ph(),s),l=er(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=qr(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=tr(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=Ti(e,t):this.Oo()&&(e=ji(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Le(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T],U=C._t;if(isNaN(U))continue;let F=U;v!==null&&(F=v(C._t,t));const E=r+u*(F-s),N=c?E:this.ho-1-E;C.st=N}}be(e,t,A){this.Wo();const r=this.Fo(),n=Le(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T];let U=C.ge,F=C.Me,E=C.xe,N=C.Se;v!==null&&(U=v(C.ge,t),F=v(C.Me,t),E=v(C.xe,t),N=v(C.Se,t));let R=r+u*(U-s),M=c?R:this.ho-1-R;C.pe=M,R=r+u*(F-s),M=c?R:this.ho-1-R,C.de=M,R=r+u*(E-s),M=c?R:this.ho-1-R,C.fe=M,R=r+u*(N-s),M=c?R:this.ho-1-R,C.me=M}}pn(e,t){const A=this.To(e,t);return this.$o(A,t)}$o(e,t){let A=e;return this.Mh()?A=(function(r,n){return n<0&&(r=-r),r/100*n+n})(A,t):this.Oo()&&(A=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(A,t)),A}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const A=this.po[t];A.Xi()===null&&A.Ki(t+1),e.push(A)}return e=kl(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=Le(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=Le(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=Le(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Le(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Le(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_(Ti(e,t));case 3:return this.ba().format(ji(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,Le(this.e_()).ba())}Zl(e,t){return e=Ti(e,t),this.s_(e,Kl)}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=Vl,this.Mh()?(this.wa=Kl,t=100):this.Oo()?(this.wa=new Gr(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Nl(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?Yr(e,this.xo):e;const A=Le(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=Le(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?er(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const A=this.r_();let r=0,n=0;for(const l of A){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const u=l.Il(e.Os(),e.ui());let m=u&&u.Lh();if(m!==null){switch(this.cn.mode){case 1:m=tr(m,this.xo);break;case 2:m=Gf(m,c.Vt);break;case 3:m=$f(m,c.Vt)}if(t=t===null?m:t.ts(Le(m)),u!==null){const y=u.Eh();y!==null&&(r=Math.max(r,y.above),n=Math.max(n,y.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=qr(t,this.xo)),t=new Xt(t.Ph()-c,t.Rh()+c),this.ro()&&(t=tr(t,this.xo))}if(this.ro()){const l=qr(t,this.xo),c=zs(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?qr(this.ao,this.xo):null;this.xo=c,t=tr(l,c),u!==null&&(this.ao=tr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new Xt(-.5,.5)),this.xo=zs(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ti:this.Oo()?ji:this.ro()?e=>Yr(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 Zf{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new vt,this.yl=e,this.$i=t,this.d_=new Rf(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=Le(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)?Vt(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);VA(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Le(e.Dt()).Pa();if(this.o_.has(A)){const n=Vt(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=kl(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),!Rr(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},_A(t)),r=new Xf(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class Jf{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(Vt(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 Ar{constructor(e,t){VA(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 zl(i,e){return i===null||e===null?i===e:i.Ch(e)}class Yf{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(Zi(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=Vt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let m=0;m<l;m++){const y=o[m],v=y.index;for(;s<n;){const T=r[s],C=T.index;if(!(C<v)){c=C;break}s++,t.push(T),u=C,c=1/0}if(c-v>=e&&v-u>=e)t.push(y),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class xi{constructor(e){this.hu=e}lu(){return this.hu===null?null:new Ar(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new xi(null)}}function qf(i,e){return i.weight>e.weight?i:e}class jf{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Yf,this.du=new Map,this.fu=xi.ou(),this.vu=!0,this.pu=new vt,this.mu=new vt,this.bu=new vt,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=A,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){fA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;fA(this.cn,e),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),e.barSpacing!==void 0&&this.$i.Gn(e.barSpacing),e.rightOffset!==void 0&&this.$i.Jn(e.rightOffset),e.minBarSpacing!==void 0&&this.$i.Gn((A=e.barSpacing)!==null&&A!==void 0?A:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var t,A;return(A=(t=this.uu[e])===null||t===void 0?void 0:t.time)!==null&&A!==void 0?A:null}Ui(e){var t;return(t=this.uu[e])!==null&&t!==void 0?t:null}Va(e,t){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return t?this.uu.length-1:null;const A=Zi(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=Le(this.Bu()),n=Le(this.Au());return{from:Le(this.Ui(Math.max(r,t))),to:Le(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Le(this.Va(e.from,!0)),to:Le(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()||!Gi(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=Le(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,u=this.$u(),m=this.cn.fixLeftEdge||u,y=this.cn.fixRightEdge||u;let v=0;for(const T of o){if(!(n<=T.index&&T.index<=s))continue;let C;v<this.Mu.length?(C=this.Mu[v],C.coord=this.It(T.index),C.label=this.Uu(T),C.weight=T.weight):(C={needAlignCoordinate:!1,coord:this.It(T.index),label:this.Uu(T),weight:T.weight},this.Mu.push(C)),this.Su>t/2&&!u?C.needAlignCoordinate=!1:C.needAlignCoordinate=m&&T.index<=l||y&&T.index>=c,v++}return this.Mu.length=v,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const A=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(A-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const t=Hs(this.__-e,0,this.__),A=Hs(this.__-Le(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=Le(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 Ar(e,t+this.cn.rightOffset))}lc(e){const t=new Ar(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(xi.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new Ar(A-t+1,A);this._c(new xi(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 Jf((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,zl(t.lu(),this.fu.lu())||this.pu.m(),zl(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 e0{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 e0{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 A0{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:vi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class i0 extends Ls{constructor(e,t){super(),this.cn=t,this.wn=new A0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Wl,Rl,Gl,$l,Xl;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(Wl||(Wl={}));class r0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new vt,this.Rc=new vt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Dp(this),this.yl=new jf(this,t.timeScale,this.cn.localization,A),this.vt=new Gp(this,t.crosshair),this.Bc=new Vf(t.crosshair),this.Ac=new i0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Mt.es())}Uh(){this.Nc(Mt.ss())}oa(){this.Nc(new Mt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){fA(this.cn,e),this.yc.forEach((t=>t.b_(e))),e.timeScale!==void 0&&this.yl.$h(e.timeScale),e.localization!==void 0&&this.yl.yu(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(e,t){if(e==="left")return void this.$h({leftPriceScale:t});if(e==="right")return void this.$h({rightPriceScale:t});const A=this.Uc(e);A!==null&&(A.Dt.$h(t),this.Pc.m())}Uc(e){for(const t of this.yc){const A=t.w_(e);if(A!==null)return{Ht:t,Dt:A}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,t){e.Lo(t),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((t=>t.S_(e))),this.Wu()}Ic(e){const t=new Zf(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=Mt.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,Le(n)),o=this.yl.Va(t,!0),l=this.yl.It(Le(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),u=e!==null&&e>s&&!c,m=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,y=l&&(A!==void 0||m)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!y){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.S())),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(e,t,A){const r=this.yc[0],n=this.fd(t,e,r,A);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),A=this.Cc.indexOf(e);VA(A!==-1,"Series not found"),this.Cc.splice(A,1),Le(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Le(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=Mt.ss();e.$n(),this.Nc(e)}pd(e){const t=Mt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Mt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Mt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Mt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Mt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Mt.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,u,m]=Ri(n),[y,v,T,C]=Ri(s),U=[oA(l+o*(y-l)),oA(c+o*(v-c)),oA(u+o*(T-u)),sl(m+o*(C-m))];return`rgba(${U[0]}, ${U[1]}, ${U[2]}, ${U[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new Mt(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 Ks(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),Rr(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 Rs(i){return!TA(i)&&!$i(i)}function Zl(i){return TA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(Rl||(Rl={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(Gl||(Gl={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})($l||($l={})),(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"})(Xl||(Xl={}));const Jl=i=>i.getUTCFullYear();function n0(i,e,t){return e.replace(/yyyy/g,(A=>PA(Jl(A),4))(i)).replace(/yy/g,(A=>PA(Jl(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=>PA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>PA((r=>r.getUTCDate())(A),2))(i))}class Yl{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return n0(e,this.gd,this.Md)}}class s0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",PA(e.getUTCHours(),2)).replace("%m",PA(e.getUTCMinutes(),2)).replace("%s",PA(e.getUTCSeconds(),2))}}const o0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class a0{constructor(e={}){const t=Object.assign(Object.assign({},o0),e);this.Td=new Yl(t.Sd,t.Cd),this.Pd=new s0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function jr(i){return 60*i*60*1e3}function Gs(i){return 60*i*1e3}const en=[{Dd:(ql=1,1e3*ql),Vd:10},{Dd:Gs(1),Vd:20},{Dd:Gs(5),Vd:21},{Dd:Gs(30),Vd:22},{Dd:jr(1),Vd:30},{Dd:jr(3),Vd:31},{Dd:jr(6),Vd:32},{Dd:jr(12),Vd:33}];var ql;function jl(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=en.length-1;t>=0;--t)if(Math.floor(e.getTime()/en[t].Dd)!==Math.floor(i.getTime()/en[t].Dd))return en[t].Vd;return 0}function $s(i){let e=i;if($i(i)&&(e=Xs(i)),!Rs(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 ec(i){if(!Zl(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function Xs(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 tc(i){$i(i.time)&&(i.time=Xs(i.time))}class Ac{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(tc)})(e):tc(e)}createConverterToInternalObj(e){return Le((function(t){return t.length===0?null:Rs(t[0].time)||$i(t[0].time)?$s:ec})(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 Zl(t=e)?ec(t):Rs(t)?$s(t):$s(Xs(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new a0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Yl(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(qf,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=jl(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=jl(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return fA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const bi=typeof window<"u";function ic(){return!!bi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Zs(){return!!bi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Js(i){return i+i%2}function Ys(i,e){return i.zd-e.zd}function qs(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=qs(this.Ld,this.Ed,this.Ud),n=Ys(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=qs(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=Ys(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const m=qs(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const y=Ys(this.Nd,this.Fd);s.push(m),o.push(y),A+=y}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/A*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,u){const m=Math.log(u);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Le(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-Le(this.Wd).ot;return Math.min(t,this.jd)}}class c0{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 ol(Ri(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 si(i,e){const t=Le(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=yp(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 oi(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function js(i,e,t,A){i.gl&&i.gl(e,t,A)}function tn(i,e,t,A){i.X(e,t,A)}function eo(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){bi&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class to{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=!Zs(),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(xA(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(xA(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=Ao(e.changedTouches,Le(this.Of));if(t===null||(this.Vf=An(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(xA(t),Le(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),Qi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(xA(e),Le(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=Ao(e.changedTouches,Le(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=An(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(xA(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&&Qi(e));this._f===0&&Qi(e),e.touches.length===0&&this.ff&&(this.ff=!1,Qi(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),ic()&&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(xA(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=An(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=xA(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=xA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;ic()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=xA(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=xA(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})}Zs()&&(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=rc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Qi(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=rc(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=!Zs()}vv(e){const t=Ao(e.touches,Le(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:An(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"&&Qi(e)}}}}function rc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Qi(i){i.cancelable&&i.preventDefault()}function xA(i){return{nt:i.pageX,st:i.pageY}}function An(i){return i.timeStamp||performance.now()}function Ao(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function rn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function u0(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 io(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 nc(i,e,t,A){if(!i.length)return;let r=0;const n=t/2,s=i[0].At(A,!0);let o=e===1?n-(i[0].Vi()-s/2):i[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<i.length;l++){const c=i[l],u=i[l-1],m=u.At(A,!1),y=c.Vi(),v=u.Vi();if(e===1?y>v-m:y<v+m){const T=v-m*e;c.Oi(T);const C=T-e*m/2;if((e===1?C<0:C>t)&&o>0){const U=e===1?-1-C:C-t,F=Math.min(U,o);for(let E=r;E<i.length;E++)i[E].Oi(i[E].Vi()+e*F);o-=F}}else r=l,o=e===1?v-m-y:y-(v+m)}}class sc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Ji(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=io("normal",r),this.Zv=io("top",r),this.Xv=io("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=si(this.Kv,mt({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=si(this.Kv,mt({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 to(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(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=Le(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 Js(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&ii(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 Le(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,Le(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=ri(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=ri(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?zr(e,0,0,A,r,s):cl(e,0,0,A,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(l)),u=Math.floor(.5*l),m=Math.round(r.T*o);s.beginPath();for(const y of t)s.rect(Math.floor(n*o),Math.round(y.Ea*l)-u,m,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-r.A):Math.round(n+r.T+r.A),c=t.map((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const m=t[u];s.fillText(m.so,l,m.Ea+c[u])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),r=this.ap();this.Li===A.pr()&&this.tn.fp().Uo().forEach((s=>{A.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(A,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,r)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,r=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));r.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),l=s.ki();l>-o&&l<o&&s.Oi(o),l>this.Ev.height-o&&l<this.Ev.height+o&&s.Oi(this.Ev.height-o)}nc(r,1,this.Ev.height,t),nc(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(Le(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(Le(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 vi(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 nn(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 p0(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 f0(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 ro{constructor(e,t){this.Ev=mt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new vt,this.Op=new vt,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=si(A,mt({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=si(A,mt({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 to(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),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Le(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(ro.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 c0(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(Le(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Le(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=Le(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,u,m){var y,v;let T,C;for(const E of c){const N=(v=(y=E.va)===null||y===void 0?void 0:y.call(E,u,m))!==null&&v!==void 0?v:[];for(const R of N)U=R.zOrder,(!(F=T?.zOrder)||U==="top"&&F!=="top"||U==="normal"&&F==="bottom")&&(T=R,C=E)}var U,F;return T&&C?{zv:T,Hc:C}:null})(o,n,s);if(l?.zv.zOrder==="top")return rn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return rn(l);const u=u0(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 rn(l)}return l?.zv?rn(l):null})(A,e,t)}_m(e,t){Le(t==="left"?this.Cp:this.Tp).cp(mt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){ii(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=Le(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=ri(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,nn),this.fm(A,p0)))}this.Jv.applySuggestedBitmapSize();const t=ri(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,f0))}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?zr(e,0,0,A,r,o):cl(e,0,0,A,r,s,o)}vm(e){const t=Le(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,nn,js,t),this.Mm(e,nn,tn,t)}bm(e){this.Mm(e,nn,tn,this.$i().Zc())}fm(e,t){const A=Le(this.Np).Uo();for(const r of A)this.Mm(e,t,js,r);for(const r of A)this.Mm(e,t,tn,r)}Mm(e,t,A,r){const n=Le(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;eo(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 sc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new sc(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,Le(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)Le(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 oc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=mt({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=si(this.Kv,mt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){ii(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=ri(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}){zr(e,0,0,t.width,t.height,this.Pm())}}function no(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 g0=no("normal"),m0=no("top"),w0=no("bottom");class B0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=mt({width:0,height:0}),this.Om=new vt,this.Fv=new Ji(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=si(this.Im,mt({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=si(this.Im,mt({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 to(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),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(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){ii(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(mt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(mt({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=ri(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,w0)})),this.wp(A),this.$m(A,g0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=ri(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,m0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)eo(t,(n=>js(n,e,!1,void 0)),r,void 0);for(const r of A)eo(t,(n=>tn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){zr(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const u=Math.max(1,Math.floor(l)),m=Math.floor(.5*l);o.beginPath();const y=Math.round(n.T*c);for(let v=A.length;v--;){const T=Math.round(A[v].coord*l);o.rect(T-m,0,u,y)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const l=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}}))}Ym(e,t,A){const r=this.Fv.xi(e,A),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const A=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return vi(this.j(),this.cn.fontFamily)}Zm(){return vi(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 Ji,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 oc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new oc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const y0=!!bi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!bi&&(!((so=navigator?.userAgentData)===null||so===void 0)&&so.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var so;class C0{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 vt,this.Op=new vt,this.Rc=new vt,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),oo(this.cn)&&this.hb(!0),this.$i=new r0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new B0(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=[],Le(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 mt({width:l-l%2,height:c-c%2})})(mt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Le(this.Xd).style.height=n,Le(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Mt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Mt.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=oo(this.cn);this.$i.$h(e);const A=oo(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=Le(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Le(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 Vt(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let u=0;u<this.Xm.length;u++){const m=this.Xm[u],y=Le(o==="left"?m.wm():m.gm()),v=y.xp();e!==null&&y.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Le(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+=Le(r.gm()).xp().width);const s=(o,l,c)=>{Le(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Le(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=Le(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return mt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const T of this.Xm)this.xb()&&(t=Math.max(t,Le(T.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Le(T.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=T.M_();t=Js(t),A=Js(A);const r=this.__,n=this.ho,s=Math.max(r-t-A,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const u=0+l,m=n<u?0:n-u,y=m/e;let v=0;for(let T=0;T<this.Xm.length;++T){const C=this.Xm[T];C.qp(this.$i.qc()[T]);let U=0,F=0;F=T===this.Xm.length-1?m-v:Math.round(C.M_()*y),U=Math.max(F,2),v+=U,C.cp(mt({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(mt({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 y0?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=Vt(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 ro(this,e[r]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var r;const n=new Map;e!==null&&this.$i.wt().forEach((u=>{const m=u.In().ll(e);m!==null&&n.set(u,m)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof Ks?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 oo(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 ac(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 lc(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 T0(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 x0(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 b0(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 Q0(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 F0(i,e,t,A,r){const n=Vt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:m,color:y}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:ac(u,["time","color"]),V:y}}function sn(i){return i.Vt!==void 0}function cc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function ai(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)?cc({ot:e,ee:t,zb:r},A):cc(i(e,t,A,r,n),A)}function hc(i){return{Candlestick:ai(Q0),Bar:ai(b0),Area:ai(T0),Baseline:ai(x0),Histogram:ai(lc),Line:ai(lc),Custom:ai(F0)}[i]}function uc(i){return{ee:0,Hb:new Map,la:i}}function dc(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 pc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),Vt(e)}class U0{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=hc(e.Qh()),m=e.Ca(),y=e.Ta();s=t.map(((v,T)=>{const C=c(v.time),U=this.q_.key(C);let F=this.qb.get(U);F===void 0&&(F=uc(C),this.qb.set(U,F),r=!0);const E=u(C,F.ee,v,l[T],m,y);return F.Hb.set(e,E),E}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:pc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const m=dc(l,u),y=dc(c,u);if(m!==void 0&&y!==void 0)return{ta:m.Ub>=y.Ub&&m.$b>=y.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(C){C.zb===void 0&&(C.zb=C.time)})(A),this.q_.preprocessData(t);const r=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(r)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${r}`);let s=this.qb.get(this.q_.key(r));const o=s===void 0;s===void 0&&(s=uc(r),this.qb.set(this.q_.key(r),s));const l=hc(e.Qh()),c=e.Ca(),u=e.Ta(),m=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,m),this.nw(e,m);const y={ta:sn(m)};if(!o)return this.tw(e,-1,y);const v={timeWeight:0,time:s.la,pointData:s,originalTime:pc(s.Hb)},T=Zi(this.Xb,this.q_.key(v.time),((C,U)=>this.q_.key(C.time)<U));this.Xb.splice(T,0,v);for(let C=T;C<this.Xb.length;++C)ao(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,T),this.tw(e,T,y)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const r=A.length!==0?A[A.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?sn(t)&&A.push(t):sn(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(sn)),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,ao(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)ao(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 ao(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function lo(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function fc(i){const e=lo(i);return i.V!==void 0&&(e.color=i.V),e}function S0(i){const e=lo(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 E0(i){const e=lo(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 gc(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 L0(i){const e=gc(i);return i.V!==void 0&&(e.color=i.V),e}function M0(i){const e=gc(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 co(i){return{Area:S0,Line:fc,Baseline:E0,Histogram:fc,Bar:L0,Candlestick:M0,Custom:H0}[i]}function H0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const I0={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},D0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},_0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Ss,attributionLogo:!0},ho={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},P0={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},N0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Ss,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function mc(){return{width:0,height:0,autoSize:!1,layout:_0,crosshair:I0,grid:D0,overlayPriceScales:Object.assign({},ho),leftPriceScale:Object.assign(Object.assign({},ho),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},ho),{visible:!0}),timeScale:P0,watermark:N0,localization:{locale:bi?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class k0{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return Rr(this.ow)?this.aw.Mb(this.ow):0}Li(){return Le(this.aw.$t().Uc(this.ow)).Dt}}function wc(i,e,t){const A=ac(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const O0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class K0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class V0{constructor(e,t,A,r,n){this.uw=new vt,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 xi(new Ar(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=Le(A.el()),o=Le(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:co(this.seriesType())(A)}data(){const e=co(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=>wc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>wc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return _A(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=fA(_A(O0),e),A=this.Es.ea(t);return new K0(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 z0{constructor(e,t,A){this.ww=new vt,this.mu=new vt,this.Om=new vt,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){VA(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({},_A(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 W0(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 Bc(i){return(function(e){if(Vr(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;Vr(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),Vr(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;Vr(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class R0{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new vt,this.Cw=new vt,this.Tw=new vt,this.Pw=new U0(t);const r=A===void 0?_A(mc()):fA(_A(mc()),Bc(A));this.q_=t,this.aw=new C0(e,r,t),this.aw.lm().l((s=>{this.yw.M()&&this.yw.m(this.Rw(s()))}),this),this.aw.am().l((s=>{this.Cw.M()&&this.Cw.m(this.Rw(s()))}),this),this.aw.Xc().l((s=>{this.Tw.M()&&this.Tw.m(this.Rw(s()))}),this);const n=this.aw.$t();this.Dw=new z0(n,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(e,t,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=Ci(e),r=Object.assign(Object.assign({},el),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Fp,e)}addBaselineSeries(e){return this.Vw("Baseline",Up,e)}addBarSeries(e){return this.Vw("Bar",bp,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",xp,e)}addHistogramSeries(e){return this.Vw("Histogram",Sp,e)}addLineSeries(e){return this.Vw("Line",Qp,e)}removeSeries(e){const t=Vt(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 k0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Bc(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){W0(A.priceFormat);const n=fA(_A(tl),_A(t),A),s=this.aw.$t().dd(e,n,r),o=new V0(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 Vt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=co(s)(r);if(s!=="Custom")VA(v0(o));else{const l=n.Ta();VA(!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 G0(i,e,t){let A;if($i(i)){const n=document.getElementById(i);VA(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new R0(A,e,t);return e.setOptions(r.options()),r}function $0(i,e){return G0(i,new Ac,Ac.Id(e))}Object.assign(Object.assign({},tl),el);function yc(i,e){return function(){return i.apply(e,arguments)}}const{toString:X0}=Object.prototype,{getPrototypeOf:uo}=Object,{iterator:on,toStringTag:Cc}=Symbol,an=(i=>e=>{const t=X0.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),mA=i=>(i=i.toLowerCase(),e=>an(e)===i),ln=i=>e=>typeof e===i,{isArray:Fi}=Array,Ui=ln("undefined");function ir(i){return i!==null&&!Ui(i)&&i.constructor!==null&&!Ui(i.constructor)&&Zt(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const vc=mA("ArrayBuffer");function Z0(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&vc(i.buffer),e}const J0=ln("string"),Zt=ln("function"),Tc=ln("number"),rr=i=>i!==null&&typeof i=="object",Y0=i=>i===!0||i===!1,cn=i=>{if(an(i)!=="object")return!1;const e=uo(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Cc in i)&&!(on in i)},q0=i=>{if(!rr(i)||ir(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},j0=mA("Date"),e1=mA("File"),t1=mA("Blob"),A1=mA("FileList"),i1=i=>rr(i)&&Zt(i.pipe),r1=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Zt(i.append)&&((e=an(i))==="formdata"||e==="object"&&Zt(i.toString)&&i.toString()==="[object FormData]"))},n1=mA("URLSearchParams"),[s1,o1,a1,l1]=["ReadableStream","Request","Response","Headers"].map(mA),c1=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function nr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Fi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(ir(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 xc(i,e){if(ir(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 li=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bc=i=>!Ui(i)&&i!==li;function po(){const{caseless:i,skipUndefined:e}=bc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&xc(t,n)||n;cn(t[s])&&cn(r)?t[s]=po(t[s],r):cn(r)?t[s]=po({},r):Fi(r)?t[s]=r.slice():(!e||!Ui(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&nr(arguments[r],A);return t}const h1=(i,e,t,{allOwnKeys:A}={})=>(nr(e,(r,n)=>{t&&Zt(r)?Object.defineProperty(i,n,{value:yc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),u1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),d1=(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)},p1=(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&&uo(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},f1=(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},g1=i=>{if(!i)return null;if(Fi(i))return i;let e=i.length;if(!Tc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},m1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&uo(Uint8Array)),w1=(i,e)=>{const A=(i&&i[on]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},B1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},y1=mA("HTMLFormElement"),C1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Qc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),v1=mA("RegExp"),Fc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};nr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},T1=i=>{Fc(i,(e,t)=>{if(Zt(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(Zt(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+"'")})}})},x1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Fi(i)?A(i):A(String(i).split(e)),t},b1=()=>{},Q1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function F1(i){return!!(i&&Zt(i.append)&&i[Cc]==="FormData"&&i[on])}const U1=i=>{const e=new Array(10),t=(A,r)=>{if(rr(A)){if(e.indexOf(A)>=0)return;if(ir(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Fi(A)?[]:{};return nr(A,(s,o)=>{const l=t(s,r+1);!Ui(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},S1=mA("AsyncFunction"),E1=i=>i&&(rr(i)||Zt(i))&&Zt(i.then)&&Zt(i.catch),Uc=((i,e)=>i?setImmediate:e?((t,A)=>(li.addEventListener("message",({source:r,data:n})=>{r===li&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),li.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Zt(li.postMessage)),L1=typeof queueMicrotask<"u"?queueMicrotask.bind(li):typeof process<"u"&&process.nextTick||Uc,fe={isArray:Fi,isArrayBuffer:vc,isBuffer:ir,isFormData:r1,isArrayBufferView:Z0,isString:J0,isNumber:Tc,isBoolean:Y0,isObject:rr,isPlainObject:cn,isEmptyObject:q0,isReadableStream:s1,isRequest:o1,isResponse:a1,isHeaders:l1,isUndefined:Ui,isDate:j0,isFile:e1,isBlob:t1,isRegExp:v1,isFunction:Zt,isStream:i1,isURLSearchParams:n1,isTypedArray:m1,isFileList:A1,forEach:nr,merge:po,extend:h1,trim:c1,stripBOM:u1,inherits:d1,toFlatObject:p1,kindOf:an,kindOfTest:mA,endsWith:f1,toArray:g1,forEachEntry:w1,matchAll:B1,isHTMLForm:y1,hasOwnProperty:Qc,hasOwnProp:Qc,reduceDescriptors:Fc,freezeMethods:T1,toObjectSet:x1,toCamelCase:C1,noop:b1,toFiniteNumber:Q1,findKey:xc,global:li,isContextDefined:bc,isSpecCompliantForm:F1,toJSONObject:U1,isAsyncFn:S1,isThenable:E1,setImmediate:Uc,asap:L1,isIterable:i=>i!=null&&Zt(i[on])};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 M1=null;function fo(i){return fe.isPlainObject(i)||fe.isArray(i)}function Sc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function Ec(i,e,t){return i?i.concat(e).map(function(r,n){return r=Sc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function H1(i){return fe.isArray(i)&&!i.some(fo)}const I1=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function hn(i,e,t){if(!fe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=fe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!fe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(r))throw new TypeError("visitor must be a function");function c(T){if(T===null)return"";if(fe.isDate(T))return T.toISOString();if(fe.isBoolean(T))return T.toString();if(!l&&fe.isBlob(T))throw new Xe("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(T)||fe.isTypedArray(T)?l&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function u(T,C,U){let F=T;if(T&&!U&&typeof T=="object"){if(fe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),T=JSON.stringify(T);else if(fe.isArray(T)&&H1(T)||(fe.isFileList(T)||fe.endsWith(C,"[]"))&&(F=fe.toArray(T)))return C=Sc(C),F.forEach(function(N,R){!(fe.isUndefined(N)||N===null)&&e.append(s===!0?Ec([C],R,n):s===null?C:C+"[]",c(N))}),!1}return fo(T)?!0:(e.append(Ec(U,C,n),c(T)),!1)}const m=[],y=Object.assign(I1,{defaultVisitor:u,convertValue:c,isVisitable:fo});function v(T,C){if(!fe.isUndefined(T)){if(m.indexOf(T)!==-1)throw Error("Circular reference detected in "+C.join("."));m.push(T),fe.forEach(T,function(F,E){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(E)?E.trim():E,C,y))===!0&&v(F,C?C.concat(E):[E])}),m.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Lc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function go(i,e){this._pairs=[],i&&hn(i,this,e)}const Mc=go.prototype;Mc.append=function(e,t){this._pairs.push([e,t])},Mc.toString=function(e){const t=e?function(A){return e.call(this,A,Lc)}:Lc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function D1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Hc(i,e,t){if(!e)return i;const A=t&&t.encode||D1,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 go(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Ic{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 mo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},_1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:go,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},wo=typeof window<"u"&&typeof document<"u",Bo=typeof navigator=="object"&&navigator||void 0,P1=wo&&(!Bo||["ReactNative","NativeScript","NS"].indexOf(Bo.product)<0),N1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",k1=wo&&window.location.href||"http://localhost",Nt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:wo,hasStandardBrowserEnv:P1,hasStandardBrowserWebWorkerEnv:N1,navigator:Bo,origin:k1},Symbol.toStringTag,{value:"Module"})),..._1};function O1(i,e){return hn(i,new Nt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Nt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function K1(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function V1(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 Dc(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]=V1(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(K1(A),r,t,0)}),t}return null}function z1(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 sr={transitional:mo,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(Dc(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 O1(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return hn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),z1(e)):e}],transformResponse:[function(e){const t=this.transitional||sr.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:Nt.classes.FormData,Blob:Nt.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=>{sr.headers[i]={}});const W1=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"]),R1=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]&&W1[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},_c=Symbol("internals");function or(i){return i&&String(i).trim().toLowerCase()}function un(i){return i===!1||i==null?i:fe.isArray(i)?i.map(un):String(i)}function G1(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 $1=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function yo(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 X1(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function Z1(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 Jt=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=or(l);if(!u)throw new Error("header name must be a non-empty string");const m=fe.findKey(r,u);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=un(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())&&!$1(e))s(R1(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=or(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return G1(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=or(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||yo(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=or(s),s){const o=fe.findKey(A,s);o&&(!t||yo(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||yo(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]=un(r),delete t[n];return}const o=e?X1(n):String(n).trim();o!==n&&delete t[n],t[o]=un(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[_c]=this[_c]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=or(s);A[o]||(Z1(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};Jt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Jt.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(Jt);function Co(i,e){const t=this||sr,A=e||t,r=Jt.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 Pc(i){return!!(i&&i.__CANCEL__)}let ar=class extends Xe{constructor(e,t,A){super(e??"canceled",Xe.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function Nc(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 J1(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function Y1(i,e){i=i||10;const t=new Array(i),A=new Array(i);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let m=n,y=0;for(;m!==r;)y+=t[m++],m=m%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(y*1e3/v):void 0}}function q1(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),m=u-t;m>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-m)))},()=>r&&s(r)]}const dn=(i,e,t=3)=>{let A=0;const r=Y1(50,250);return q1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(m)},t)},kc=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},Oc=i=>(...e)=>fe.asap(()=>i(...e)),j1=Nt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Nt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Nt.origin),Nt.navigator&&/(msie|trident)/i.test(Nt.navigator.userAgent)):()=>!0,eg=Nt.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 Ag(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function Kc(i,e,t){let A=!tg(e);return i&&(A||t==!1)?Ag(i,e):e}const Vc=i=>i instanceof Jt?{...i}:i;function ci(i,e){e=e||{};const t={};function A(c,u,m,y){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:y},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,m,y){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,m,y)}else return A(c,u,m,y)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,m){if(m in e)return A(c,u);if(m in i)return A(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,u,m)=>r(Vc(c),Vc(u),m,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=fe.hasOwnProp(l,u)?l[u]:r,y=m(i[u],e[u],u);fe.isUndefined(y)&&m!==o||(t[u]=y)}),t}const zc=i=>{const e=ci({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=Jt.from(s),e.url=Hc(Kc(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(Nt.hasStandardBrowserEnv||Nt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,m])=>{c.includes(u.toLowerCase())&&s.set(u,m)})}}if(Nt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&j1(e.url))){const l=r&&n&&eg.read(n);l&&s.set(r,l)}return e},ig=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=zc(i);let n=r.data;const s=Jt.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,m,y,v,T;function C(){v&&v(),T&&T(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function F(){if(!U)return;const N=Jt.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),M={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:N,config:i,request:U};Nc(function(Ae){t(Ae),C()},function(Ae){A(Ae),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(R){const M=R&&R.message?R.message:"Network Error",z=new Xe(M,Xe.ERR_NETWORK,i,U);z.event=R||null,A(z),U=null},U.ontimeout=function(){let R=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||mo;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Xe(R,M.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&fe.forEach(s.toJSON(),function(R,M){U.setRequestHeader(M,R)}),fe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([y,T]=dn(c,!0),U.addEventListener("progress",y)),l&&U.upload&&([m,v]=dn(l),U.upload.addEventListener("progress",m),U.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=N=>{U&&(A(!N||N.type?new ar(null,i,U):N),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const E=J1(r.url);if(E&&Nt.protocols.indexOf(E)===-1){A(new Xe("Unsupported protocol "+E+":",Xe.ERR_BAD_REQUEST,i));return}U.send(n||null)})},rg=(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 ar(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}},ng=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},sg=async function*(i,e){for await(const t of og(i))yield*ng(t,e)},og=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()}},Wc=(i,e,t,A)=>{const r=sg(i,e);let n=0,s,o=l=>{s||(s=!0,A&&A(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){o(),l.close();return}let m=u.byteLength;if(t){let y=n+=m;t(y)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},Rc=64*1024,{isFunction:pn}=fe,ag=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:Gc,TextEncoder:$c}=fe.global,Xc=(i,...e)=>{try{return!!i(...e)}catch{return!1}},lg=i=>{i=fe.merge.call({skipUndefined:!0},ag,i);const{fetch:e,Request:t,Response:A}=i,r=e?pn(e):typeof fetch=="function",n=pn(t),s=pn(A);if(!r)return!1;const o=r&&pn(Gc),l=r&&(typeof $c=="function"?(T=>C=>T.encode(C))(new $c):async T=>new Uint8Array(await new t(T).arrayBuffer())),c=n&&o&&Xc(()=>{let T=!1;const C=new t(Nt.origin,{body:new Gc,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!C}),u=s&&o&&Xc(()=>fe.isReadableStream(new A("").body)),m={stream:u&&(T=>T.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!m[T]&&(m[T]=(C,U)=>{let F=C&&C[T];if(F)return F.call(C);throw new Xe(`Response type '${T}' is not supported`,Xe.ERR_NOT_SUPPORT,U)})});const y=async T=>{if(T==null)return 0;if(fe.isBlob(T))return T.size;if(fe.isSpecCompliantForm(T))return(await new t(Nt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(T)||fe.isArrayBuffer(T))return T.byteLength;if(fe.isURLSearchParams(T)&&(T=T+""),fe.isString(T))return(await l(T)).byteLength},v=async(T,C)=>{const U=fe.toFiniteNumber(T.getContentLength());return U??y(C)};return async T=>{let{url:C,method:U,data:F,signal:E,cancelToken:N,timeout:R,onDownloadProgress:M,onUploadProgress:z,responseType:Ae,headers:$,withCredentials:V="same-origin",fetchOptions:ie}=zc(T),re=e||fetch;Ae=Ae?(Ae+"").toLowerCase():"text";let ce=rg([E,N&&N.toAbortSignal()],R),Z=null;const ee=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let oe;try{if(z&&c&&U!=="get"&&U!=="head"&&(oe=await v($,F))!==0){let be=new t(C,{method:"POST",body:F,duplex:"half"}),Ee;if(fe.isFormData(F)&&(Ee=be.headers.get("content-type"))&&$.setContentType(Ee),be.body){const[ye,Ce]=kc(oe,dn(Oc(z)));F=Wc(be.body,Rc,ye,Ce)}}fe.isString(V)||(V=V?"include":"omit");const le=n&&"credentials"in t.prototype,se={...ie,signal:ce,method:U.toUpperCase(),headers:$.normalize().toJSON(),body:F,duplex:"half",credentials:le?V:void 0};Z=n&&new t(C,se);let he=await(n?re(Z,ie):re(C,se));const pe=u&&(Ae==="stream"||Ae==="response");if(u&&(M||pe&&ee)){const be={};["status","statusText","headers"].forEach(Fe=>{be[Fe]=he[Fe]});const Ee=fe.toFiniteNumber(he.headers.get("content-length")),[ye,Ce]=M&&kc(Ee,dn(Oc(M),!0))||[];he=new A(Wc(he.body,Rc,ye,()=>{Ce&&Ce(),ee&&ee()}),be)}Ae=Ae||"text";let ge=await m[fe.findKey(m,Ae)||"text"](he,T);return!pe&&ee&&ee(),await new Promise((be,Ee)=>{Nc(be,Ee,{data:ge,headers:Jt.from(he.headers),status:he.status,statusText:he.statusText,config:T,request:Z})})}catch(le){throw ee&&ee(),le&&le.name==="TypeError"&&/Load failed|fetch/i.test(le.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,T,Z,le&&le.response),{cause:le.cause||le}):Xe.from(le,le&&le.code,T,Z,le&&le.response)}}},cg=new Map,Zc=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=cg;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};Zc();const vo={http:M1,xhr:ig,fetch:{get:Zc}};fe.forEach(vo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const Jc=i=>`- ${i}`,hg=i=>fe.isFunction(i)||i===null||i===!1;function ug(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=vo[(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(Jc).join(`
5
+ `):" "+Jc(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 Yc={getAdapter:ug,adapters:vo};function To(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new ar(null,i)}function qc(i){return To(i),i.headers=Jt.from(i.headers),i.data=Co.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),Yc.getAdapter(i.adapter||sr.adapter,i)(i).then(function(A){return To(i),A.data=Co.call(i,i.transformResponse,A),A.headers=Jt.from(A.headers),A},function(A){return Pc(A)||(To(i),A&&A.response&&(A.response.data=Co.call(i,i.transformResponse,A.response),A.response.headers=Jt.from(A.response.headers))),Promise.reject(A)})}const jc="1.13.5",fn={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{fn[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const eh={};fn.transitional=function(e,t,A){function r(n,s){return"[Axios v"+jc+"] 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&&!eh[s]&&(eh[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}},fn.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 gn={assertOptions:dg,validators:fn},aA=gn.validators;let hi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ic,response:new Ic}}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=ci(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&gn.assertOptions(A,{silentJSONParsing:aA.transitional(aA.boolean),forcedJSONParsing:aA.transitional(aA.boolean),clarifyTimeoutError:aA.transitional(aA.boolean),legacyInterceptorReqResOrdering:aA.transitional(aA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:gn.assertOptions(r,{encode:aA.function,serialize:aA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),gn.assertOptions(t,{baseUrl:aA.spelling("baseURL"),withXsrfToken:aA.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=Jt.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||mo;U&&U.legacyInterceptorReqResOrdering?o.unshift(C.fulfilled,C.rejected):o.push(C.fulfilled,C.rejected)});const c=[];this.interceptors.response.forEach(function(C){c.push(C.fulfilled,C.rejected)});let u,m=0,y;if(!l){const T=[qc.bind(this),void 0];for(T.unshift(...o),T.push(...c),y=T.length,u=Promise.resolve(t);m<y;)u=u.then(T[m++],T[m++]);return u}y=o.length;let v=t;for(;m<y;){const T=o[m++],C=o[m++];try{v=T(v)}catch(U){C.call(this,U);break}}try{u=qc.call(this,v)}catch(T){return Promise.reject(T)}for(m=0,y=c.length;m<y;)u=u.then(c[m++],c[m++]);return u}getUri(e){e=ci(this.defaults,e);const t=Kc(e.baseURL,e.url,e.allowAbsoluteUrls);return Hc(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){hi.prototype[e]=function(t,A){return this.request(ci(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(ci(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}hi.prototype[e]=t(),hi.prototype[e+"Form"]=t(!0)});let pg=class cp{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 ar(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 cp(function(r){e=r}),cancel:e}}};function fg(i){return function(t){return i.apply(null,t)}}function gg(i){return fe.isObject(i)&&i.isAxiosError===!0}const xo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(xo).forEach(([i,e])=>{xo[e]=i});function th(i){const e=new hi(i),t=yc(hi.prototype.request,e);return fe.extend(t,hi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return th(ci(i,r))},t}const ht=th(sr);ht.Axios=hi,ht.CanceledError=ar,ht.CancelToken=pg,ht.isCancel=Pc,ht.VERSION=jc,ht.toFormData=hn,ht.AxiosError=Xe,ht.Cancel=ht.CanceledError,ht.all=function(e){return Promise.all(e)},ht.spread=fg,ht.isAxiosError=gg,ht.mergeConfig=ci,ht.AxiosHeaders=Jt,ht.formToJSON=i=>Dc(fe.isHTMLForm(i)?new FormData(i):i),ht.getAdapter=Yc.getAdapter,ht.HttpStatusCode=xo,ht.default=ht;const{Axios:$T,AxiosError:XT,CanceledError:ZT,isCancel:JT,CancelToken:YT,VERSION:qT,all:jT,Cancel:ex,isAxiosError:tx,spread:Ax,toFormData:ix,AxiosHeaders:rx,HttpStatusCode:nx,formToJSON:sx,getAdapter:ox,mergeConfig:ax}=ht,bA=Object.create(null);bA.open="0",bA.close="1",bA.ping="2",bA.pong="3",bA.message="4",bA.upgrade="5",bA.noop="6";const mn=Object.create(null);Object.keys(bA).forEach(i=>{mn[bA[i]]=i});const bo={type:"error",data:"parser error"},Ah=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ih=typeof ArrayBuffer=="function",rh=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Qo=({type:i,data:e},t,A)=>Ah&&e instanceof Blob?t?A(e):nh(e,A):ih&&(e instanceof ArrayBuffer||rh(e))?t?A(e):nh(new Blob([e]),A):A(bA[i]+(e||"")),nh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function sh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Fo;function mg(i,e){if(Ah&&i.data instanceof Blob)return i.data.arrayBuffer().then(sh).then(e);if(ih&&(i.data instanceof ArrayBuffer||rh(i.data)))return e(sh(i.data));Qo(i,!1,t=>{Fo||(Fo=new TextEncoder),e(Fo.encode(t))})}const oh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<oh.length;i++)lr[oh.charCodeAt(i)]=i;const wg=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=lr[i.charCodeAt(A)],s=lr[i.charCodeAt(A+1)],o=lr[i.charCodeAt(A+2)],l=lr[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},Bg=typeof ArrayBuffer=="function",Uo=(i,e)=>{if(typeof i!="string")return{type:"message",data:ah(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:yg(i.substring(1),e)}:mn[t]?i.length>1?{type:mn[t],data:i.substring(1)}:{type:mn[t]}:bo},yg=(i,e)=>{if(Bg){const t=wg(i);return ah(t,e)}else return{base64:!0,data:i}},ah=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,lh="",Cg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{Qo(n,!1,o=>{A[s]=o,++r===t&&e(A.join(lh))})})},vg=(i,e)=>{const t=i.split(lh),A=[];for(let r=0;r<t.length;r++){const n=Uo(t[r],e);if(A.push(n),n.type==="error")break}return A};function Tg(){return new TransformStream({transform(i,e){mg(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 So;function wn(i){return i.reduce((e,t)=>e+t.length,0)}function Bn(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 xg(i,e){So||(So=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(wn(t)<1)break;const l=Bn(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(wn(t)<2)break;const l=Bn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(wn(t)<8)break;const l=Bn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(bo);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(wn(t)<r)break;const l=Bn(t,r);o.enqueue(Uo(n?l:So.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(bo);break}}}})}const ch=4;function Qt(i){if(i)return bg(i)}function bg(i){for(var e in Qt.prototype)i[e]=Qt.prototype[e];return i}Qt.prototype.on=Qt.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},Qt.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},Qt.prototype.off=Qt.prototype.removeListener=Qt.prototype.removeAllListeners=Qt.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},Qt.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},Qt.prototype.emitReserved=Qt.prototype.emit,Qt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},Qt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const yn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),lA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Qg="arraybuffer";function lx(){}function hh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Fg=lA.setTimeout,Ug=lA.clearTimeout;function Cn(i,e){e.useNativeTimers?(i.setTimeoutFn=Fg.bind(lA),i.clearTimeoutFn=Ug.bind(lA)):(i.setTimeoutFn=lA.setTimeout.bind(lA),i.clearTimeoutFn=lA.clearTimeout.bind(lA))}const Sg=1.33;function Eg(i){return typeof i=="string"?Lg(i):Math.ceil((i.byteLength||i.size)*Sg)}function Lg(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 uh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Mg(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Hg(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 Ig extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class Eo extends Qt{constructor(e){super(),this.writable=!1,Cn(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 Ig(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=Uo(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=Mg(e);return t.length?"?"+t:""}}class Dg extends Eo{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,Cg(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]=uh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let dh=!1;try{dh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _g=dh;function Pg(){}class Ng extends Dg{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 QA extends Qt{constructor(e,t,A){super(),this.createRequest=e,Cn(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=hh(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=QA.requestsCount++,QA.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=Pg,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete QA.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(QA.requestsCount=0,QA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ph);else if(typeof addEventListener=="function"){const i="onpagehide"in lA?"pagehide":"unload";addEventListener(i,ph,!1)}}function ph(){for(let i in QA.requests)QA.requests.hasOwnProperty(i)&&QA.requests[i].abort()}const kg=(function(){const i=fh({xdomain:!1});return i&&i.responseType!==null})();class Og extends Ng{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=kg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new QA(fh,this.uri(),e)}}function fh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||_g))return new XMLHttpRequest}catch{}if(!e)try{return new lA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const gh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Kg extends Eo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=gh?{}:hh(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;Qo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&yn(()=>{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]=uh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Lo=lA.WebSocket||lA.MozWebSocket;class Vg extends Kg{createSocket(e,t,A){return gh?new Lo(e,t,A):t?new Lo(e,t):new Lo(e)}doWrite(e,t){this.ws.send(t)}}class zg extends Eo{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=xg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=Tg();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&&yn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Wg={websocket:Vg,webtransport:zg,polling:Og},Rg=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Gg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Mo(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=Rg.exec(i||""),n={},s=14;for(;s--;)n[Gg[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=$g(n,n.path),n.queryKey=Xg(n,n.query),n}function $g(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 Xg(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Ho=typeof addEventListener=="function"&&typeof removeEventListener=="function",vn=[];Ho&&addEventListener("offline",()=>{vn.forEach(i=>i())},!1);class WA extends Qt{constructor(e,t){if(super(),this.binaryType=Qg,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=Mo(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=Mo(t.host).host);Cn(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=Hg(this.opts.query)),Ho&&(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"})},vn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ch,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&&WA.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",WA.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+=Eg(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,yn(()=>{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(WA.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(),Ho&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=vn.indexOf(this._offlineEventListener);A!==-1&&vn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}WA.protocol=ch;class Zg extends WA{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;WA.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!A)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;WA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const y=new Error("probe error");y.transport=t.name,this.emitReserved("upgradeError",y)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=m=>{const y=new Error("probe error: "+m);y.transport=t.name,n(),this.emitReserved("upgradeError",y)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const u=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{A||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let A=0;A<e.length;A++)~this.transports.indexOf(e[A])&&t.push(e[A]);return t}}let Jg=class extends Zg{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=>Wg[r]).filter(r=>!!r)),super(e,A)}};function Yg(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=Mo(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 qg=typeof ArrayBuffer=="function",jg=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,mh=Object.prototype.toString,em=typeof Blob=="function"||typeof Blob<"u"&&mh.call(Blob)==="[object BlobConstructor]",tm=typeof File=="function"||typeof File<"u"&&mh.call(File)==="[object FileConstructor]";function Io(i){return qg&&(i instanceof ArrayBuffer||jg(i))||em&&i instanceof Blob||tm&&i instanceof File}function Tn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(Tn(i[t]))return!0;return!1}if(Io(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Tn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&Tn(i[t]))return!0;return!1}function Am(i){const e=[],t=i.data,A=i;return A.data=Do(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Do(i,e){if(!i)return i;if(Io(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]=Do(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]=Do(i[A],e));return t}return i}function im(i,e){return i.data=_o(i.data,e),delete i.attachments,i}function _o(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]=_o(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=_o(i[t],e));return i}const rm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var st;(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"})(st||(st={}));class nm{constructor(e){this.replacer=e}encode(e){return(e.type===st.EVENT||e.type===st.ACK)&&Tn(e)?this.encodeAsBinary({type:e.type===st.EVENT?st.BINARY_EVENT:st.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===st.BINARY_EVENT||e.type===st.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=Am(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class Po extends Qt{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===st.BINARY_EVENT;A||t.type===st.BINARY_ACK?(t.type=A?st.EVENT:st.ACK,this.reconstructor=new sm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Io(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(st[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===st.BINARY_EVENT||A.type===st.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(Po.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 st.CONNECT:return wh(t);case st.DISCONNECT:return t===void 0;case st.CONNECT_ERROR:return typeof t=="string"||wh(t);case st.EVENT:case st.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&rm.indexOf(t[0])===-1);case st.ACK:case st.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class sm{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=im(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function wh(i){return Object.prototype.toString.call(i)==="[object Object]"}const om=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Po,Encoder:nm,get PacketType(){return st}},Symbol.toStringTag,{value:"Module"}));function wA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const am=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Bh extends Qt{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=[wA(e,"open",this.onopen.bind(this)),wA(e,"packet",this.onpacket.bind(this)),wA(e,"error",this.onerror.bind(this)),wA(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(am.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:st.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,m=t.pop();this._registerAckCallback(u,m),s.id=u}const o=(r=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const r=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,r)=>{const n=(s,o)=>s?r(s):A(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const A={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),A.pending=!1,this._drainQueue())),this._queue.push(A),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:st.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 st.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 st.EVENT:case st.BINARY_EVENT:this.onevent(e);break;case st.ACK:case st.BINARY_ACK:this.onack(e);break;case st.DISCONNECT:this.ondisconnect();break;case st.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:st.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:st.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 Si(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}Si.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},Si.prototype.reset=function(){this.attempts=0},Si.prototype.setMin=function(i){this.ms=i},Si.prototype.setMax=function(i){this.max=i},Si.prototype.setJitter=function(i){this.jitter=i};class No extends Qt{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,Cn(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 Si({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||om;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 Jg(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=wA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=wA(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(wA(e,"ping",this.onping.bind(this)),wA(e,"data",this.ondata.bind(this)),wA(e,"error",this.onerror.bind(this)),wA(e,"close",this.onclose.bind(this)),wA(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){yn(()=>{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 Bh(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 cr={};function xn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=Yg(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=cr[r]&&n in cr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new No(A,e):(cr[r]||(cr[r]=new No(A,e)),l=cr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(xn,{Manager:No,Socket:Bh,io:xn,connect:xn});function ko(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 rA=ko("http://localhost:8000");function yh(i){const e=ko(i);e&&e!==rA&&(rA=e,Ct&&(Ct.disconnect(),Ct.removeAllListeners(),Ct=null))}let Ct=null;function lm(){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:rA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=xn(rA,{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:rA,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:rA,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:rA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:rA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function Oo(){const i=ko(Ct?.io?.uri||null);return!Ct||Ct.io&&i&&rA&&i!==rA?(Ct&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:rA,wasConnected:Ct.connected,reason:"baseUrl changed"}),Ct.disconnect(),Ct.removeAllListeners(),Ct=null),Ct=lm()):Ct.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Ct.id,connected:Ct.connected,baseUrl:rA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Ct.id,baseUrl:rA}),Ct}function cm(i,e){const t=Oo();return t.on(i,e),()=>t.off(i,e)}function hm(i,e){Ct&&Ct.off(i,e)}function um(i,e){Oo().emit(i,e)}function dm(){return Ct?Ct.connected?"connected":"connecting":"disconnected"}const bn={getSocket:Oo,on:cm,off:hm,emit:um,getStatus:dm,setBaseUrl:yh},pm={},Ch=j.createContext(),Ht=()=>{const i=j.useContext(Ch);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},fm=({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:Us&&Us.tagName.toUpperCase()==="SCRIPT"&&Us.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&pm?.VITE_BASE_URL)??"http://localhost:5002";bn.setBaseUrl(l);const u={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[y,v]=j.useState(r||"BTC/USD"),[T,C]=j.useState(n||"M1"),[U,F]=j.useState([]),[E,N]=j.useState(!0),[R,M]=j.useState([]),[z,Ae]=j.useState(!1),[$,V]=j.useState(1e5),[ie,re]=j.useState(null),[ce,Z]=j.useState([]),[ee,oe]=j.useState(!0),[le,se]=j.useState(!1),[he,pe]=j.useState(!0),[ge,be]=j.useState("candles"),[Ee,ye]=j.useState(!1),[Ce,Fe]=j.useState("dark"),[Ue,Ne]=j.useState(!1),[Je,Ke]=j.useState([]),ve=j.useRef(null),Pe=j.useRef(new Map),Be=j.useRef(null),de=1e3,ke=j.useCallback(async()=>{if(A)try{const Te=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Te)return;Ae(!0);const He=await ht.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Te}`}});let Se=[];Array.isArray(He.data)?Se=He.data:He.data?.data&&Array.isArray(He.data.data)&&(Se=He.data.data);const Re=Se.filter(ze=>ze.closePrice===null||ze.closePrice===void 0).map(ze=>({id:ze.id,ticket:23,symbol:ze.symbol,type:ze.type,volume:ze.volume,openPrice:ze.openPrice??ze.price,stopLoss:ze.stopLoss,takeProfit:ze.takeProfit,comment:ze.comment||"",status:"OPEN",swap:0,profit:ze.profit||0,profitCurrency:"USD",time:new Date(ze.openedAt||ze.openAt||Date.now()).toLocaleTimeString(),openAt:ze.openedAt||ze.openAt,closeAt:ze.closedAt||ze.closeAt}));M(Re)}catch(Te){console.error("❌ Error fetching orders:",Te.response?.data||Te.message),M([])}finally{Ae(!1)}},[l,A]),qe=j.useCallback((Te,He)=>!He||!Te.price||isNaN(He)||isNaN(Te.price)?Te.profit||0:(Te?.type?.toUpperCase()==="BUY"?He-Te.price:Te.price-He)*Te.volume,[]),At=j.useCallback(async()=>{try{const Te=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Te)return;const He=await ht.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${Te}`}});if(He.data&&He.data.data){const Se=parseFloat(He.data.data.balance);isNaN(Se)||V(Se)}}catch(Te){console.error("❌ Error fetching user balance:",Te.response?.data||Te.message)}},[l]),rt=j.useCallback(async()=>{if(A)try{const Te=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Te)return;const He=await ht.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Te}`}});let Se=[];Array.isArray(He.data)?Se=He.data:He.data?.data&&Array.isArray(He.data.data)&&(Se=He.data.data);const Re=Se.filter(ze=>ze.closePrice!==null&&ze.closePrice!==void 0).map(ze=>({id:ze.id,ticket:23,symbol:ze.symbol,type:ze.type,volume:ze.volume,openPrice:ze.openPrice??ze.price,closePrice:ze.closePrice,stopLoss:ze.stopLoss,takeProfit:ze.takeProfit,profit:ze.profit??ze.profitLoss??0,profitCurrency:"USD",openAt:ze.openedAt||ze.openAt,closeAt:ze.closedAt||ze.closeAt,closeReason:ze.closeReason||"",status:"CLOSED"}));Ke(Re)}catch(Te){console.error("❌ Error fetching history orders:",Te.response?.data||Te.message),Ke([])}},[l,A]),Ge=j.useMemo(()=>{const Te=$,He=R.reduce((lt,gt)=>lt+gt.volume*gt.price*.01,0),Se=R.reduce((lt,gt)=>{const sA=U.find(eA=>eA.symbol===gt.symbol);if(sA){const eA=gt.type?.toUpperCase()==="BUY"?parseFloat(sA.bid||0):parseFloat(sA.ask||0);if(eA&&eA>0&&!isNaN(eA))return lt+qe(gt,eA)}return lt+(gt.profit||0)},0),Re=Te+Se,ze=Re-He,Ye=He>0?Re/He*100:0;return{balance:Te,equity:Re,margin:He,freeMargin:ze,level:Ye.toFixed(2)}},[R,U,$,qe]);j.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(ke(),At(),rt())},[ke,At,rt,A]),j.useEffect(()=>{(async()=>{try{N(!0);const He=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Se=await ht.get(He);let Re=[];Array.isArray(Se.data)?Re=Se.data:Se.data&&Se.data.data&&Array.isArray(Se.data.data)?Re=Se.data.data:Se.data&&Se.data.prices&&Array.isArray(Se.data.prices)?Re=Se.data.prices:Se.data&&Array.isArray(Se.data)&&(Re=Se.data);const ze=Re.map(Ye=>{const lt=Ye.symbol||Ye.name||"",gt=Ye.category||null;return lt&&(Ye.bid!==void 0||Ye.price!==void 0)?{symbol:lt,bid:Ye.bid??Ye.price??0,ask:Ye.ask??Ye.price??0,change:Ye.change??0,category:gt}:{...Ye,symbol:lt,category:gt}});ze.length>0?(F(ze),ze.find(lt=>lt.symbol===y)||v(ze[0].symbol)):F([])}catch(He){console.error("❌ Error fetching symbols:",He.response?.data||He.message),F([])}finally{N(!1)}})()},[l,u.symbols]);const De=j.useCallback(()=>{const Te=Pe.current;if(Te.size===0)return;const He=new Map(Te);Te.clear(),F(Se=>Se.map(Re=>{const ze=He.get(Re.symbol);return ze?{...Re,...ze}:Re})),M(Se=>{let Re=!1;const ze=Se.map(Ye=>{const lt=He.get(Ye.symbol);if(!lt)return Ye;const gt=Ye.type?.toUpperCase()==="BUY"?parseFloat(lt.bid||0):parseFloat(lt.ask||0);if(!gt||isNaN(gt)||gt<=0)return Ye;const sA=qe(Ye,gt);return sA===Ye.profit?Ye:(Re=!0,{...Ye,profit:sA})});return Re?ze:Se})},[qe]);j.useEffect(()=>{ve.current||(ve.current=bn.getSocket());const Te=ve.current,He=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Te.emit("joinUserRoom",{userId:Number(A)})},Se=()=>console.log("⚠️ TradingContext: Disconnected"),Re=Ye=>{Ye?.symbol&&(Pe.current.set(Ye.symbol,Ye),Be.current||(Be.current=setTimeout(()=>{Be.current=null,De()},de)))},ze=async Ye=>{if(Ye){if(Ye.newBalance!==void 0){const lt=parseFloat(Ye.newBalance);isNaN(lt)||V(lt)}if(window.notify){const lt=Ye.profitLoss||Ye.profit||0,gt=lt>=0?`+${lt.toFixed(2)}`:lt.toFixed(2),sA=Ye.symbol||"Trade",eA=Ye.reason||"Closed";window.notify(`Trade Closed: ${eA} | ${sA} | P/L: ${gt} USD`,lt>=0?"success":"error")}Ye.tradeId&&M(lt=>lt.filter(gt=>gt.id!==Ye.tradeId)),await ke(),await At()}};return Te.on("connect",He),Te.on("disconnect",Se),Te.on("priceUpdate",Re),Te.on("tradeClosed",ze),Te.connected&&A&&Number.isFinite(Number(A))&&Te.emit("joinUserRoom",{userId:Number(A)}),()=>{Te.off("connect",He),Te.off("disconnect",Se),Te.off("priceUpdate",Re),Te.off("tradeClosed",ze),Be.current&&(clearTimeout(Be.current),Be.current=null),Pe.current.clear()}},[De,ke,At]),j.useEffect(()=>{try{const Te=document.documentElement;if(!Te)return;Te.dataset.theme=Ce}catch{}},[Ce]);const Ie=j.useMemo(()=>U.find(Te=>Te.symbol===y)||{bid:"0.00000",ask:"0.00000",change:0},[U,y]),Qe=j.useMemo(()=>({selectedSymbol:y,setSelectedSymbol:v,selectedTimeframe:T,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:E,orders:R,setOrders:M,ordersLoading:z,fetchOrders:ke,fetchUserBalance:At,userBalance:$,setUserBalance:V,accountSummary:Ge,currentSymbolData:Ie,activeTool:ie,setActiveTool:re,chartObjects:ce,setChartObjects:Z,showGrid:ee,setShowGrid:oe,snapToGrid:le,setSnapToGrid:se,drawingsVisible:he,setDrawingsVisible:pe,chartType:ge,setChartType:be,chartLocked:Ee,setChartLocked:ye,theme:Ce,setTheme:Fe,baseUrl:l,endpoints:u,endpointParams:m,accountId:A,isShow:Ue,setIsShow:Ne,historyOrders:Je,setHistoryOrders:Ke,fetchHistoryOrders:rt,indicators:s,indicatorSettings:o}),[y,T,U,E,R,z,ke,At,$,Ge,Ie,ie,ce,ee,le,he,ge,Ee,Ce,l,u,m,Ue,Je,rt,s,o]);return a.jsx(Ch.Provider,{value:Qe,children:i})};var vh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Th=j.createContext&&j.createContext(vh),gm=["attr","size","title"];function mm(i,e){if(i==null)return{};var t=wm(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 wm(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 Qn(){return Qn=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},Qn.apply(this,arguments)}function xh(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 Fn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xh(Object(t),!0).forEach(function(A){Bm(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):xh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function Bm(i,e,t){return e=ym(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ym(i){var e=Cm(i,"string");return typeof e=="symbol"?e:e+""}function Cm(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 bh(i){return i&&i.map((e,t)=>j.createElement(e.tag,Fn({key:t},e.attr),bh(e.child)))}function zt(i){return e=>j.createElement(vm,Qn({attr:Fn({},i.attr)},e),bh(i.child))}function vm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=mm(i,gm),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),j.createElement("svg",Qn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Fn(Fn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&j.createElement("title",null,n),i.children)};return Th!==void 0?j.createElement(Th.Consumer,null,t=>e(t)):e(vh)}function Tm(i){return zt({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 xm(i){return zt({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 bm(i){return zt({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 Qm(i){return zt({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 Qh(i){return zt({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 Fm(i){return zt({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 Um(i){return zt({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 Sm(i){return zt({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 Em(i){return zt({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 Lm(i){return zt({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 Mm={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Fh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=Ht(),c=r==="light",[u,m]=j.useState("0.01"),[y,v]=j.useState(""),[T,C]=j.useState(!1),U=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",E=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",N=M=>{const z=parseFloat(u)||.01,Ae=Math.max(.01,z+M);m(Ae.toFixed(2))},R=async M=>{v("");const z=M,Ae=parseFloat(z==="BUY"?e:i),$=parseFloat(u);if(!$||$<=0||isNaN($)){v("Please enter a valid volume (minimum 0.01)");return}if($<.01){v("Volume must be at least 0.01");return}if(!Ae||Ae<=0||isNaN(Ae)){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:z,volume:$,openPrice:Ae,takeProfit:null,stopLoss:null};try{const ce=o||Mm?.VITE_BASE_URL||"http://localhost:8000",Z=l?.trades||"/api/trades",ee=await ht.post(`${ce}${Z}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(ee.status<200||ee.status>=300){v(ee.data?.message||`Failed to place trade (${ee.status})`);return}s&&s(),A&&A()}catch(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:()=>R("SELL"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:i?Number(i).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${U}`,children:[a.jsx("button",{type:"button",onClick:()=>N(-.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Qh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:M=>{const z=M.target.value;(z===""||/^\d*\.?\d{0,2}$/.test(z))&&m(z)},onBlur:()=>{const M=parseFloat(u);m(isNaN(M)||M<.01?"0.01":M.toFixed(2))},className:`w-14 text-center focus:outline-none ${U} ${F}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>N(.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Fm,{size:8})})]}),a.jsxs("button",{onClick:()=>R("BUY"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),y&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:y})]})},Hm={},Uh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:m,selectedTimeframe:y,setOrders:v,symbols:T,fetchOrders:C,theme:U,baseUrl:F,endpoints:E}=Ht(),N=U==="light",R={getContractSpec:Ie=>{const Qe=String(Ie||"").toUpperCase();return Qe.includes("BTC")||Qe.includes("ETH")||Qe.includes("SOL")||Qe.includes("XRP")||Qe.includes("ADA")||Qe.includes("DOGE")||Qe.includes("BNB")||Qe.includes("AVAX")||Qe.includes("DOT")||Qe.includes("LINK")||Qe.endsWith("USDT")?{contractSize:1}:Qe.includes("XAU")||Qe.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Ie,volume:Qe})=>{const Te=R.getContractSpec(Ie);return(parseFloat(Qe)||0)*(Te.contractSize||1)}},M=u||R,[z,Ae]=j.useState("0.01"),[$,V]=j.useState(""),[ie,re]=j.useState(""),[ce,Z]=j.useState(""),[ee,oe]=j.useState(!1),[le,se]=j.useState(null),[he,pe]=j.useState(""),[ge,be]=j.useState(t||"BUY"),[Ee,ye]=j.useState(parseFloat(A)||0),[Ce,Fe]=j.useState(parseFloat(r)||0),[Ue,Ne]=j.useState("text-white"),[Je,Ke]=j.useState("text-white"),ve=j.useRef(parseFloat(A)||0),Pe=j.useRef(parseFloat(r)||0);j.useEffect(()=>{if(!i)return;const Ie=bn.getSocket(),Qe=He=>{if(!(!He||!He.symbol)&&He.symbol.toUpperCase()===m?.toUpperCase()){const Se=parseFloat(He.bid)||0,Re=parseFloat(He.ask)||0;Se>0&&(Se>ve.current?(Ne("text-green-400"),setTimeout(()=>Ne("text-white"),500)):Se<ve.current&&ve.current>0&&(Ne("text-red-400"),setTimeout(()=>Ne("text-white"),500)),ye(Se),ve.current=Se),Re>0&&(Re>Pe.current?(Ke("text-green-400"),setTimeout(()=>Ke("text-white"),500)):Re<Pe.current&&Pe.current>0&&(Ke("text-red-400"),setTimeout(()=>Ke("text-white"),500)),Fe(Re),Pe.current=Re)}};Ie.on("priceUpdate",Qe);const Te=T.find(He=>He.symbol===m);if(Te){const He=parseFloat(Te.bid)||0,Se=parseFloat(Te.ask)||0;He>0&&(ye(He),ve.current=He),Se>0&&(Fe(Se),Pe.current=Se)}return()=>{Ie.off("priceUpdate",Qe)}},[i,m,T]),j.useEffect(()=>{if(i){Ae(o?String(o):"0.01"),V(""),re(""),Z(""),pe(""),be(t||"BUY");const Ie=parseFloat(A)||0,Qe=parseFloat(r)||0;Ie>0&&(ye(Ie),ve.current=Ie),Qe>0&&(Fe(Qe),Pe.current=Qe)}},[i,t,A,r,o]);const Be=Ee||0,de=Ce||0,ke=Ie=>{const Qe=parseFloat(z)||.01,Te=Math.max(.01,Qe+Ie);Ae(Te.toFixed(2))},qe=Ie=>{const Qe=parseFloat($)||0,Te=parseFloat(ge==="BUY"?Ce:Ee)||0;if(!Te){pe("Current price not available. Please wait...");return}let He=Qe+Ie;ge==="BUY"?He=Math.max(1e-5,Math.min(He,Te-1e-5)):He=Math.max(Te+1e-5,He),V(He>0?He.toFixed(5):""),pe("")},At=Ie=>{const Qe=parseFloat(ie)||0,Te=parseFloat(ge==="BUY"?Ce:Ee)||0;if(!Te){pe("Current price not available. Please wait...");return}let He=Qe+Ie;ge==="BUY"?He=Math.max(Te+1e-5,He):He=Math.max(1e-5,Math.min(He,Te-1e-5)),re(He>0?He.toFixed(5):""),pe("")},rt=async Ie=>{pe("");const Qe=Ie||ge,Te=parseFloat(Qe==="BUY"?Ce:Ee),He=parseFloat(z),Se=$?parseFloat($):null,Re=ie?parseFloat(ie):null;if(!He||He<=0||isNaN(He)){pe("Please enter a valid volume (minimum 0.01)");return}if(He<.01){pe("Volume must be at least 0.01");return}if(!Te||Te<=0||isNaN(Te)){pe("Invalid price. Please refresh and try again.");return}if(Se!==null&&Se!==""){if(isNaN(Se)||Se<=0){pe("Stop Loss must be a valid positive number");return}if(Qe==="BUY"&&Se>=Te){pe("Stop Loss must be below the current price for BUY orders");return}if(Qe==="SELL"&&Se<=Te){pe("Stop Loss must be above the current price for SELL orders");return}}if(Re!==null&&Re!==""){if(isNaN(Re)||Re<=0){pe("Take Profit must be a valid positive number");return}if(Qe==="BUY"){if(Re<=Te){pe(`Take Profit must be above the entry price (${Te.toFixed(5)}) for BUY orders`);return}}else if(Qe==="SELL"&&Re>=Te){pe(`Take Profit must be below the entry price (${Te.toFixed(5)}) for SELL orders`);return}}be(Qe),se(Qe),oe(!0);const ze=new Date,Ye=ze.toLocaleTimeString(),lt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,gt=localStorage.getItem("token")??localStorage.getItem("authToken");if(!gt){pe("Please login to place trades"),oe(!1),se(null);return}const sA={accountId:s,symbol:m,type:Qe,volume:He,price:Te,takeProfit:Re,stopLoss:Se,comment:ce.trim()||null},eA={ticket:lt.substring(0,8),symbol:m,type:Qe,volume:parseFloat(He),price:parseFloat(Te),time:Ye,stopLoss:Se?parseFloat(Se):null,takeProfit:Re?parseFloat(Re):null,swap:0,profit:0,profitCurrency:"USD",comment:ce.trim()||"",id:lt,status:"OPEN",openAt:ze.toISOString()};if(!l&&v&&v(Ze=>[...Ze,eA]),c&&!n){pe("Execution handler is required in forceParentExecution mode"),oe(!1),se(null);return}if(n){oe(!1),se(null),e();const Ze={symbol:m,type:Qe,lotSize:He,entryPrice:Te,stopLoss:Se,takeProfit:Re,comment:ce.trim()||null};Promise.resolve(n(Ze)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(IA=>{console.error("❌ Trade execution failed:",IA),!l&&v&&v(Lt=>Lt.filter(yt=>yt.id!==lt))})}else{if(c){pe("Fallback API path disabled in forceParentExecution mode"),oe(!1),se(null);return}oe(!1),se(null),e();const Ze=F||Hm?.VITE_BASE_URL||"http://localhost:8000",IA=E?.trades||"/api/trades";ht.post(`${Ze}${IA}`,sA,{headers:{Authorization:`Bearer ${gt}`,"Content-Type":"application/json"}}).then(Lt=>{if(Lt.data&&Lt.data.data){const yt=Lt.data.data.trade;!l&&v&&v(Gt=>Gt.map(tA=>tA.id===lt?{...tA,id:yt.id,ticket:yt.id.substring(0,8),time:Ye,openAt:yt.openAt}:tA)),console.log("✅ Trade saved successfully:",yt),window.notify&&window.notify(`Trade placed successfully: ${yt.symbol} ${yt.type}`,"success")}else{!l&&v&&v(Gt=>Gt.filter(tA=>tA.id!==lt));const yt=Lt.data?.message||"Failed to place trade";window.notify&&window.notify(yt,"error")}}).catch(Lt=>{console.error("Error placing trade:",Lt),!l&&v&&v(Gt=>Gt.filter(tA=>tA.id!==lt));let yt="Failed to place trade";if(Lt.response){const Gt=Lt.response.status,tA=Lt.response.data;Gt===400?yt=tA?.message||"Invalid trade data. Please check your inputs.":Gt===401?yt="Authentication failed. Please login again.":Gt===404?yt=tA?.message||"Symbol not found. Please select a valid symbol.":Gt===500?yt="Server error. Please try again later.":yt=tA?.message||`Error: ${Gt}`}else Lt.request&&(yt="Network error. Please check your internet connection.");window.notify&&window.notify(yt,"error")})}},De=(M?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return i?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${N?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${N?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${N?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[he&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:he}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[De," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>ke(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:z,onChange:Ie=>{const Qe=Ie.target.value;(Qe===""||/^\d*\.?\d{0,2}$/.test(Qe))&&(Ae(Qe),pe(""))},onBlur:()=>{const Ie=parseFloat(z);Ae(isNaN(Ie)||Ie<.01?"0.01":Ie.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>ke(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>qe(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:$,onChange:Ie=>{const Qe=Ie.target.value;(Qe===""||/^\d*\.?\d*$/.test(Qe))&&(V(Qe),pe(""))},onBlur:Ie=>{const Qe=parseFloat(Ie.target.value);!isNaN(Qe)&&Qe>0?V(Qe.toFixed(5)):Ie.target.value===""&&V("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>qe(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>At(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:ie,onChange:Ie=>{const Qe=Ie.target.value;(Qe===""||/^\d*\.?\d*$/.test(Qe))&&(re(Qe),pe(""))},onBlur:Ie=>{const Qe=parseFloat(Ie.target.value);!isNaN(Qe)&&Qe>0?re(Qe.toFixed(5)):Ie.target.value===""&&re("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>At(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:ce,onChange:Ie=>Z(Ie.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${Ue} font-medium transition-colors duration-400`,children:Be>0?Be.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Je} 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:ee,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:ee&&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:ee,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:ee&&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},Im={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"},Dm=[10,11,12,14,16,20,24,28,30,40],Un=[{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"}],RA={width:"78%",height:"78%",display:"block"},Sh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function _m(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 FA(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 Pm=()=>a.jsx(Em,{style:RA}),Nm=()=>a.jsx(Lm,{style:RA}),km=()=>a.jsx(Qm,{style:RA}),Om=()=>a.jsx(Sm,{style:RA}),Km=()=>a.jsx(xm,{style:RA}),Vm=()=>a.jsx(Tm,{style:RA}),zm=()=>a.jsx(bm,{style:RA}),Wm=()=>a.jsx(Qh,{style:RA}),Ko=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function hr({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(Ko,{size:"18px",children:r})})}function je({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:Sh}),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 St({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=FA(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:{...Sh,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:u=>{const m=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:A,style:c})]})}function cA({tokens:i,disabled:e=!1,style:t={},...A}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?i.fieldDisabledBg:i.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?i.fieldDisabledBg:i.fieldBg,color:e?i.fieldDisabledText:i.text,...t},...A})}function ui({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(Wm,{})})]})}function Rm({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===Un.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:Un.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(je,{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:Un.map(s=>a.jsx(je,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function Gm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,FA(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(St,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(ui,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Dm.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(hr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(km,{})}),a.jsx(hr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Om,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(hr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(Km,{})}),a.jsx(hr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Vm,{})}),a.jsx(hr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(zm,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(je,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(je,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(St,{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(je,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(St,{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 Sn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(je,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(je,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(je,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(je,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function $m({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(je,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Xm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(je,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(je,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(je,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Zm({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 di(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 pi({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:di(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:di(i.point2Time),style:n}),a.jsx(cA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Eh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,FA(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(St,{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(je,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(je,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(St,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ui,{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(ui,{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 Jm({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 Ym({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:di(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 qm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function jm({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:di(i.rawTime),style:t})]})})}function ew({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(je,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{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,FA(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(St,{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(je,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(je,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function Aw({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:di(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 Lh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(St,{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(je,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(St,{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(je,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(je,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(je,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Mh({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:di(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:di(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 iw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||Un.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 Hh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Ht(),s=_m(r==="light"),[o,l]=j.useState("style"),[c,u]=j.useState({}),[m,y]=j.useState(null),v=j.useRef(null),T=j.useRef(null);j.useEffect(()=>{t&&(u(iw(t)),l("style"))},[t]),j.useEffect(()=>{i||y(null)},[i]);const C=M=>{if(M.button!==0)return;M.preventDefault();const z=v.current;if(!z)return;const Ae=z.offsetParent,$=Ae?Ae.getBoundingClientRect():{left:0,top:0},V=z.getBoundingClientRect(),ie=V.left-$.left,re=V.top-$.top;T.current={startMX:M.clientX,startMY:M.clientY,startX:ie,startY:re},y({x:ie,y:re});const ce=ee=>{const{startMX:oe,startMY:le,startX:se,startY:he}=T.current;y({x:se+ee.clientX-oe,y:he+ee.clientY-le})},Z=()=>{T.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=Im[t.type]||t.type,F=["style","coordinates","visualization"],E=()=>{if(o==="visualization")return a.jsx(Rm,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Gm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Zm,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Eh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Jm,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Eh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ym,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(qm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(jm,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Xm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx($m,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{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(Aw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(ew,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Lh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Mh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Lh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Mh,{draft:c,setDraft:u,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},N=()=>{A(c),e()};return a.jsxs("div",{ref:v,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...m===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:m.y,left:m.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:C,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(Ko,{size:"18px",children:a.jsx(Pm,{})})})]})}),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(Ko,{size:"20px",children:a.jsx(Nm,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(M=>{const z=o===M;return a.jsxs("button",{type:"button",onClick:()=>l(M),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:z?s.text:s.mutedText,cursor:"pointer"},children:[M.charAt(0).toUpperCase()+M.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},M)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:E()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:N,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var Vo=function(i,e){return Vo=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])},Vo(i,e)};function BA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vo(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var zo=function(){return zo=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},zo.apply(this,arguments)};function Wt(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(u){try{c(A.next(u))}catch(m){s(m)}}function l(u){try{c(A.throw(u))}catch(m){s(m)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function kt(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 En(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 NA=(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})(),Ln=function(i,e){return NA.fromClientRect(i,e.getBoundingClientRect())},rw=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 NA(0,0,A,r)},Mn=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},Tt=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},Ih="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Hn=0;Hn<Ih.length;Hn++)nw[Ih.charCodeAt(Hn)]=Hn;for(var Dh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),In=0;In<Dh.length;In++)ur[Dh.charCodeAt(In)]=In;for(var sw=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=ur[i.charCodeAt(A)],s=ur[i.charCodeAt(A+1)],o=ur[i.charCodeAt(A+2)],l=ur[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},ow=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},aw=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},fi=5,Wo=11,Ro=2,lw=Wo-fi,_h=65536>>fi,cw=1<<fi,Go=cw-1,hw=1024>>fi,uw=_h+hw,dw=uw,pw=32,fw=dw+pw,gw=65536>>Wo,mw=1<<lw,ww=mw-1,Ph=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Bw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},yw=function(i,e){var t=sw(i),A=Array.isArray(t)?aw(t):new Uint32Array(t),r=Array.isArray(t)?ow(t):new Uint16Array(t),n=24,s=Ph(r,n/2,A[4]/2),o=A[5]===2?Ph(r,(n+A[4])/2):Bw(A,Math.ceil((n+A[4])/4));return new Cw(A[0],A[1],A[2],A[3],s,o)},Cw=(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>>fi],t=(t<<Ro)+(e&Go),this.data[t];if(e<=65535)return t=this.index[_h+(e-55296>>fi)],t=(t<<Ro)+(e&Go),this.data[t];if(e<this.highStart)return t=fw-gw+(e>>Wo),t=this.index[t],t+=e>>fi&ww,t=this.index[t],t=(t<<Ro)+(e&Go),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Nh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Dn=0;Dn<Nh.length;Dn++)vw[Nh.charCodeAt(Dn)]=Dn;var Tw="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==",kh=50,xw=1,Oh=2,Kh=3,bw=4,Qw=5,Vh=7,zh=8,Wh=9,GA=10,$o=11,Rh=12,Xo=13,Fw=14,dr=15,Zo=16,_n=17,pr=18,Uw=19,Gh=20,Jo=21,fr=22,Yo=23,Ei=24,nA=25,gr=26,mr=27,Li=28,Sw=29,gi=30,Ew=31,Pn=32,Nn=33,qo=34,jo=35,ea=36,wr=37,ta=38,kn=39,On=40,Aa=41,$h=42,Lw=43,Mw=[9001,65288],Xh="!",nt="×",Kn="÷",ia=yw(Tw),kA=[gi,ea],ra=[xw,Oh,Kh,Qw],Zh=[GA,zh],Jh=[mr,gr],Hw=ra.concat(Zh),Yh=[ta,kn,On,qo,jo],Iw=[dr,Xo],Dw=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ia.get(n);if(o>kh?(r.push(!0),o-=kh):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(Zo);if(o===bw||o===$o){if(s===0)return A.push(s),t.push(gi);var l=t[s-1];return Hw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(gi))}if(A.push(s),o===Ew)return t.push(e==="strict"?Jo:wr);if(o===$h||o===Sw)return t.push(gi);if(o===Lw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(wr):t.push(gi);t.push(o)}),[A,t,r]},na=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!==GA)break}if(r===GA)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!==GA)break}if(o!==GA)break}return!1},qh=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===GA)t--;else return A}return 0},_w=function(i,e,t,A,r){if(t[A]===0)return nt;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return nt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===Oh&&u===Kh)return nt;if(ra.indexOf(l)!==-1)return Xh;if(ra.indexOf(u)!==-1||Zh.indexOf(u)!==-1)return nt;if(qh(n,e)===zh)return Kn;if(ia.get(i[n])===$o||(l===Pn||l===Nn)&&ia.get(i[o])===$o||l===Vh||u===Vh||l===Wh||[GA,Xo,dr].indexOf(l)===-1&&u===Wh||[_n,pr,Uw,Ei,Li].indexOf(u)!==-1||qh(n,e)===fr||na(Yo,fr,n,e)||na([_n,pr],Jo,n,e)||na(Rh,Rh,n,e))return nt;if(l===GA)return Kn;if(l===Yo||u===Yo)return nt;if(u===Zo||l===Zo)return Kn;if([Xo,dr,Jo].indexOf(u)!==-1||l===Fw||c===ea&&Iw.indexOf(l)!==-1||l===Li&&u===ea||u===Gh||kA.indexOf(u)!==-1&&l===nA||kA.indexOf(l)!==-1&&u===nA||l===mr&&[wr,Pn,Nn].indexOf(u)!==-1||[wr,Pn,Nn].indexOf(l)!==-1&&u===gr||kA.indexOf(l)!==-1&&Jh.indexOf(u)!==-1||Jh.indexOf(l)!==-1&&kA.indexOf(u)!==-1||[mr,gr].indexOf(l)!==-1&&(u===nA||[fr,dr].indexOf(u)!==-1&&e[o+1]===nA)||[fr,dr].indexOf(l)!==-1&&u===nA||l===nA&&[nA,Li,Ei].indexOf(u)!==-1)return nt;if([nA,Li,Ei,_n,pr].indexOf(u)!==-1)for(var m=n;m>=0;){var y=e[m];if(y===nA)return nt;if([Li,Ei].indexOf(y)!==-1)m--;else break}if([mr,gr].indexOf(u)!==-1)for(var m=[_n,pr].indexOf(l)!==-1?s:n;m>=0;){var y=e[m];if(y===nA)return nt;if([Li,Ei].indexOf(y)!==-1)m--;else break}if(ta===l&&[ta,kn,qo,jo].indexOf(u)!==-1||[kn,qo].indexOf(l)!==-1&&[kn,On].indexOf(u)!==-1||[On,jo].indexOf(l)!==-1&&u===On||Yh.indexOf(l)!==-1&&[Gh,gr].indexOf(u)!==-1||Yh.indexOf(u)!==-1&&l===mr||kA.indexOf(l)!==-1&&kA.indexOf(u)!==-1||l===Ei&&kA.indexOf(u)!==-1||kA.concat(nA).indexOf(l)!==-1&&u===fr&&Mw.indexOf(i[o])===-1||kA.concat(nA).indexOf(u)!==-1&&l===pr)return nt;if(l===Aa&&u===Aa){for(var v=t[n],T=1;v>0&&(v--,e[v]===Aa);)T++;if(T%2!==0)return nt}return l===Pn&&u===Nn?nt:Kn},Pw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Dw(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[nA,gi,$h].indexOf(o)!==-1?wr: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]},Nw=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===Xh,this.start=A,this.end=r}return i.prototype.slice=function(){return Tt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),kw=function(i,e){var t=Mn(i),A=Pw(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=nt;c<o&&(u=_w(t,n,r,++c,s))===nt;);if(u!==nt||c===o){var m=new Nw(t,u,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},Ow=1,Kw=2,Br=4,jh=8,Vn=10,eu=47,yr=92,Vw=9,zw=32,zn=34,Cr=61,Ww=35,Rw=36,Gw=37,Wn=39,Rn=40,vr=41,$w=95,Yt=45,Xw=33,Zw=60,Jw=62,Yw=64,qw=91,jw=93,eB=61,tB=123,Gn=63,AB=125,tu=124,iB=126,rB=128,Au=65533,sa=42,mi=43,nB=44,sB=58,oB=59,Tr=46,aB=0,lB=8,cB=11,hB=14,uB=31,dB=127,UA=-1,iu=48,ru=97,nu=101,pB=102,fB=117,gB=122,su=65,ou=69,au=70,mB=85,wB=90,Ot=function(i){return i>=iu&&i<=57},BB=function(i){return i>=55296&&i<=57343},Mi=function(i){return Ot(i)||i>=su&&i<=au||i>=ru&&i<=pB},yB=function(i){return i>=ru&&i<=gB},CB=function(i){return i>=su&&i<=wB},vB=function(i){return yB(i)||CB(i)},TB=function(i){return i>=rB},$n=function(i){return i===Vn||i===Vw||i===zw},Xn=function(i){return vB(i)||TB(i)||i===$w},lu=function(i){return Xn(i)||Ot(i)||i===Yt},xB=function(i){return i>=aB&&i<=lB||i===cB||i>=hB&&i<=uB||i===dB},$A=function(i,e){return i!==yr?!1:e!==Vn},Zn=function(i,e,t){return i===Yt?Xn(e)||$A(e,t):Xn(i)?!0:!!(i===yr&&$A(i,e))},oa=function(i,e,t){return i===mi||i===Yt?Ot(e)?!0:e===Tr&&Ot(t):Ot(i===Tr?e:i)},bB=function(i){var e=0,t=1;(i[e]===mi||i[e]===Yt)&&(i[e]===Yt&&(t=-1),e++);for(var A=[];Ot(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Tt.apply(void 0,A),10):0;i[e]===Tr&&e++;for(var n=[];Ot(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Tt.apply(void 0,n),10):0;(i[e]===ou||i[e]===nu)&&e++;var l=1;(i[e]===mi||i[e]===Yt)&&(i[e]===Yt&&(l=-1),e++);for(var c=[];Ot(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Tt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},QB={type:2},FB={type:3},UB={type:4},SB={type:13},EB={type:8},LB={type:21},MB={type:9},HB={type:10},IB={type:11},DB={type:12},_B={type:14},Jn={type:23},PB={type:1},NB={type:25},kB={type:24},OB={type:26},KB={type:27},VB={type:28},zB={type:29},WB={type:31},aa={type:32},cu=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat(Mn(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==aa;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case zn:return this.consumeStringToken(zn);case Ww:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(lu(t)||$A(A,r)){var n=Zn(t,A,r)?Kw:Ow,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Rw:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),SB;break;case Wn:return this.consumeStringToken(Wn);case Rn:return QB;case vr:return FB;case sa:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),_B;break;case mi:if(oa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case nB:return UB;case Yt:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(oa(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Zn(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Yt&&c===Jw)return this.consumeCodePoint(),this.consumeCodePoint(),kB;break;case Tr:if(oa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case eu:if(this.peekCodePoint(0)===sa)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===sa&&(u=this.consumeCodePoint(),u===eu))return this.consumeToken();if(u===UA)return this.consumeToken()}break;case sB:return OB;case oB:return KB;case Zw:if(this.peekCodePoint(0)===Xw&&this.peekCodePoint(1)===Yt&&this.peekCodePoint(2)===Yt)return this.consumeCodePoint(),this.consumeCodePoint(),NB;break;case Yw:var m=this.peekCodePoint(0),y=this.peekCodePoint(1),v=this.peekCodePoint(2);if(Zn(m,y,v)){var s=this.consumeName();return{type:7,value:s}}break;case qw:return VB;case yr:if($A(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case jw:return zB;case eB:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),EB;break;case tB:return IB;case AB:return DB;case fB:case mB:var T=this.peekCodePoint(0),C=this.peekCodePoint(1);return T===mi&&(Mi(C)||C===Gn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case tu:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),MB;if(this.peekCodePoint(0)===tu)return this.consumeCodePoint(),LB;break;case iB:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),HB;break;case UA:return aa}return $n(e)?(this.consumeWhiteSpace(),WB):Ot(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Xn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Tt(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();Mi(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===Gn&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Tt.apply(void 0,e.map(function(l){return l===Gn?iu:l})),16),n=parseInt(Tt.apply(void 0,e.map(function(l){return l===Gn?au:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Tt.apply(void 0,e),16);if(this.peekCodePoint(0)===Yt&&Mi(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Mi(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Tt.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)===Rn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Rn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===UA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===Wn||t===zn){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===UA||this.peekCodePoint(0)===vr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),Jn)}for(;;){var r=this.consumeCodePoint();if(r===UA||r===vr)return{type:22,value:Tt.apply(void 0,e)};if($n(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===UA||this.peekCodePoint(0)===vr?(this.consumeCodePoint(),{type:22,value:Tt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Jn);if(r===zn||r===Wn||r===Rn||xB(r))return this.consumeBadUrlRemnants(),Jn;if(r===yr)if($A(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Jn;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;$n(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===vr||e===UA)return;$A(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+=Tt.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===UA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===Vn)return this._value.splice(0,A),PB;if(r===yr){var n=this._value[A+1];n!==UA&&n!==void 0&&(n===Vn?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):$A(r,n)&&(t+=this.consumeStringSlice(A),t+=Tt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Br,A=this.peekCodePoint(0);for((A===mi||A===Yt)&&e.push(this.consumeCodePoint());Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Tr&&Ot(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=jh;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===ou||A===nu)&&((r===mi||r===Yt)&&Ot(n)||Ot(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=jh;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[bB(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(Zn(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===Gw?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Mi(e)){for(var t=Tt(e);Mi(this.peekCodePoint(0))&&t.length<6;)t+=Tt(this.consumeCodePoint());$n(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||BB(A)||A>1114111?Au:A}return e===UA?Au:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(lu(t))e+=Tt(t);else if($A(t,this.peekCodePoint(0)))e+=Tt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),hu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new cu;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||GB(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"?aa:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),xr=function(i){return i.type===15},Hi=function(i){return i.type===17},ut=function(i){return i.type===20},RB=function(i){return i.type===0},la=function(i,e){return ut(i)&&i.value===e},uu=function(i){return i.type!==31},Ii=function(i){return i.type!==31&&i.type!==4},SA=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},GB=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},XA=function(i){return i.type===17||i.type===15},Ft=function(i){return i.type===16||XA(i)},du=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},It={type:17,number:0,flags:Br},ca={type:16,number:50,flags:Br},ZA={type:16,number:100,flags:Br},br=function(i,e,t){var A=i[0],r=i[1];return[ft(A,e),ft(typeof r<"u"?r:A,t)]},ft=function(i,e){if(i.type===16)return i.number/100*e;if(xr(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},pu="deg",fu="grad",gu="rad",mu="turn",Yn={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case pu:return Math.PI*e.number/180;case fu:return Math.PI/200*e.number;case gu:return e.number;case mu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},wu=function(i){return i.type===15&&(i.unit===pu||i.unit===fu||i.unit===gu||i.unit===mu)},Bu=function(i){var e=i.filter(ut).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[It,It];case"to top":case"bottom":return hA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[It,ZA];case"to right":case"left":return hA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ZA,ZA];case"to bottom":case"top":return hA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ZA,It];case"to left":case"right":return hA(270)}return 0},hA=function(i){return Math.PI*i/180},JA={name:"color",parse:function(i,e){if(e.type===18){var t=$B[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 qA(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 qA(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 qA(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 qA(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=OA[e.value.toUpperCase()];if(typeof o<"u")return o}return OA.TRANSPARENT}},YA=function(i){return(255&i)===0},Et=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+")"},qA=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},yu=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},Cu=function(i,e){var t=e.filter(Ii);if(t.length===3){var A=t.map(yu),r=A[0],n=A[1],s=A[2];return qA(r,n,s,1)}if(t.length===4){var o=t.map(yu),r=o[0],n=o[1],s=o[2],l=o[3];return qA(r,n,s,l)}return 0};function ha(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 vu=function(i,e){var t=e.filter(Ii),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?hA(A.number):Yn.parse(i,A))/(Math.PI*2),l=Ft(r)?r.number/100:0,c=Ft(n)?n.number/100:0,u=typeof s<"u"&&Ft(s)?ft(s,1):1;if(l===0)return qA(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,y=c*2-m,v=ha(y,m,o+1/3),T=ha(y,m,o),C=ha(y,m,o-1/3);return qA(v*255,T*255,C*255,u)},$B={hsl:vu,hsla:vu,rgb:Cu,rgba:Cu},Qr=function(i,e){return JA.parse(i,hu.create(e).parseComponentValue())},OA={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},XB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(ut(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ZB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},qn=function(i,e){var t=JA.parse(i,e[0]),A=e[1];return A&&Ft(A)?{color:t,stop:A}:{color:t,stop:null}},Tu=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=It),A.stop===null&&(A.stop=ZA);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=ft(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,y=r[c-1],v=(u-y)/(m+1),T=1;T<=m;T++)r[c+T-1]=v*T;c=null}}return i.map(function(C,U){var F=C.color;return{color:F,stop:Math.max(Math.min(1,r[U]/e),0)}})},JB=function(i,e,t){var A=e/2,r=t/2,n=ft(i[0],e)-A,s=r-ft(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},YB=function(i,e,t){var A=typeof i=="number"?i:JB(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]},yA=function(i,e){return Math.sqrt(i*i+e*e)},xu=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=yA(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},qB=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(yA(e,t),yA(e,t-r),yA(e-A,t),yA(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=xu(A,r,e,t,!0),c=l[0],u=l[1];n=yA(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(yA(e,t),yA(e,t-r),yA(e-A,t),yA(e-A,t-r));else if(i.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-A)),m=xu(A,r,e,t,!1),c=m[0],u=m[1];n=yA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=ft(i.size[0],A),s=i.size.length===2?ft(i.size[1],r):n),[n,s]},jB=function(i,e){var t=hA(180),A=[];return SA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Bu(r);return}else if(wu(s)){t=Yn.parse(i,s);return}}var o=qn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},jn=function(i,e){var t=hA(180),A=[];return SA(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=Bu(r);return}else if(wu(s)){t=(Yn.parse(i,s)+hA(270))%hA(360);return}}var o=qn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},e2=function(i,e){var t=hA(180),A=[],r=1,n=0,s=3,o=[];return SA(e).forEach(function(l,c){var u=l[0];if(c===0){if(ut(u)&&u.value==="linear"){r=1;return}else if(ut(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var m=JA.parse(i,u.values[0]);A.push({stop:It,color:m})}else if(u.name==="to"){var m=JA.parse(i,u.values[0]);A.push({stop:ZA,color:m})}else if(u.name==="color-stop"){var y=u.values.filter(Ii);if(y.length===2){var m=JA.parse(i,y[1]),v=y[0];Hi(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:m})}}}}),r===1?{angle:(t+hA(180))%hA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},bu="closest-side",Qu="farthest-side",Fu="closest-corner",Uu="farthest-corner",Su="circle",Eu="ellipse",Lu="cover",Mu="contain",t2=function(i,e){var t=0,A=3,r=[],n=[];return SA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,y){if(c)if(ut(y))switch(y.value){case"center":return n.push(ca),m;case"top":case"left":return n.push(It),m;case"right":case"bottom":return n.push(ZA),m}else(Ft(y)||XA(y))&&n.push(y);else if(ut(y))switch(y.value){case Su:return t=0,!1;case Eu:return t=1,!1;case"at":return c=!0,!1;case bu:return A=0,!1;case Lu:case Qu:return A=1,!1;case Mu:case Fu:return A=2,!1;case Uu:return A=3,!1}else if(XA(y)||Ft(y))return Array.isArray(A)||(A=[]),A.push(y),!1;return m},l)}if(l){var u=qn(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},es=function(i,e){var t=0,A=3,r=[],n=[];return SA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,m){if(ut(m))switch(m.value){case"center":return n.push(ca),!1;case"top":case"left":return n.push(It),!1;case"right":case"bottom":return n.push(ZA),!1}else if(Ft(m)||XA(m))return n.push(m),!1;return u},l):o===1&&(l=s.reduce(function(u,m){if(ut(m))switch(m.value){case Su:return t=0,!1;case Eu:return t=1,!1;case Mu:case bu:return A=0,!1;case Qu:return A=1,!1;case Fu:return A=2,!1;case Lu:case Uu:return A=3,!1}else if(XA(m)||Ft(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return u},l)),l){var c=qn(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},A2=function(i){return i.type===1},i2=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=Hu[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 r2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Hu[i.name])}var Hu={"linear-gradient":jB,"-moz-linear-gradient":jn,"-ms-linear-gradient":jn,"-o-linear-gradient":jn,"-webkit-linear-gradient":jn,"radial-gradient":t2,"-moz-radial-gradient":es,"-ms-radial-gradient":es,"-o-radial-gradient":es,"-webkit-radial-gradient":es,"-webkit-gradient":e2},n2={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 Ii(A)&&r2(A)}).map(function(A){return ua.parse(i,A)})}},s2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(ut(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},o2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return SA(e).map(function(t){return t.filter(Ft)}).map(du)}},a2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return SA(e).map(function(t){return t.filter(ut).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}},Di;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Di||(Di={}));var c2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return SA(e).map(function(t){return t.filter(h2)})}},h2=function(i){return ut(i)||Ft(i)},ts=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},u2=ts("top"),d2=ts("right"),p2=ts("bottom"),f2=ts("left"),As=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return du(t.filter(Ft))}}},g2=As("top-left"),m2=As("top-right"),w2=As("bottom-right"),B2=As("bottom-left"),is=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}}},y2=is("top"),C2=is("right"),v2=is("bottom"),T2=is("left"),rs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return xr(t)?t.number:0}}},x2=rs("top"),b2=rs("right"),Q2=rs("bottom"),F2=rs("left"),U2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},S2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},E2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).reduce(function(t,A){return t|L2(A.value)},0)}},L2=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},M2={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}},H2={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}},ns;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ns||(ns={}));var I2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ns.STRICT:ns.NORMAL}},D2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Iu=function(i,e){return ut(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Ft(i)?ft(i,e):e},_2={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)}},P2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},da={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}}},ss=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},N2=ss("top"),k2=ss("right"),O2=ss("bottom"),K2=ss("left"),V2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).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}})}},z2={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},os=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},W2=os("top"),R2=os("right"),G2=os("bottom"),$2=os("left"),X2={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}}},Z2={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}},J2={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&la(e[0],"none")?[]:SA(e).map(function(t){for(var A={color:OA.TRANSPARENT,offsetX:It,offsetY:It,blur:It},r=0,n=0;n<t.length;n++){var s=t[n];XA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=JA.parse(i,s)}return A})}},Y2={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}},q2={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}},j2=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},ey=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:j2,matrix3d:ey},Du={type:16,number:50,flags:Br},Ay=[Du,Du],iy={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Ft);return t.length!==2?Ay:[t[0],t[1]]}},ry={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}}},Fr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Fr||(Fr={}));for(var ny={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Fr.BREAK_ALL;case"keep-all":return Fr.KEEP_ALL;default:return Fr.NORMAL}}},sy={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Hi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},_u={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")}},oy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Hi(e)?e.number:1}},ay={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(ut).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})}},cy={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"},uy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Hi(e)?e.number:ut(e)&&e.value==="bold"?700:400}},dy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(ut).map(function(t){return t.value})}},py={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"}}},Ut=function(i,e){return(i&e)!==0},fy={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}},gy={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(uu),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Hi(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},my={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(uu),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(ut(n)&&n.value!=="none"){var o=s&&Hi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},wy={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(xr).map(function(t){return _u.parse(i,t)})}},By={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(RB);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}},Pu=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},yy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&la(e[0],"none")?[]:SA(e).map(function(t){for(var A={color:255,offsetX:It,offsetY:It,blur:It,spread:It,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];la(s,"inset")?A.inset=!0:XA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=JA.parse(i,s)}return A})}},Cy={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(ut).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"},Ty={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return xr(e)?e.number:0}},xy=(function(){function i(e,t){var A,r;this.animationDuration=Oe(e,wy,t.animationDuration),this.backgroundClip=Oe(e,XB,t.backgroundClip),this.backgroundColor=Oe(e,ZB,t.backgroundColor),this.backgroundImage=Oe(e,n2,t.backgroundImage),this.backgroundOrigin=Oe(e,s2,t.backgroundOrigin),this.backgroundPosition=Oe(e,o2,t.backgroundPosition),this.backgroundRepeat=Oe(e,a2,t.backgroundRepeat),this.backgroundSize=Oe(e,c2,t.backgroundSize),this.borderTopColor=Oe(e,u2,t.borderTopColor),this.borderRightColor=Oe(e,d2,t.borderRightColor),this.borderBottomColor=Oe(e,p2,t.borderBottomColor),this.borderLeftColor=Oe(e,f2,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,g2,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,m2,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,w2,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,B2,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,y2,t.borderTopStyle),this.borderRightStyle=Oe(e,C2,t.borderRightStyle),this.borderBottomStyle=Oe(e,v2,t.borderBottomStyle),this.borderLeftStyle=Oe(e,T2,t.borderLeftStyle),this.borderTopWidth=Oe(e,x2,t.borderTopWidth),this.borderRightWidth=Oe(e,b2,t.borderRightWidth),this.borderBottomWidth=Oe(e,Q2,t.borderBottomWidth),this.borderLeftWidth=Oe(e,F2,t.borderLeftWidth),this.boxShadow=Oe(e,yy,t.boxShadow),this.color=Oe(e,U2,t.color),this.direction=Oe(e,S2,t.direction),this.display=Oe(e,E2,t.display),this.float=Oe(e,M2,t.cssFloat),this.fontFamily=Oe(e,cy,t.fontFamily),this.fontSize=Oe(e,hy,t.fontSize),this.fontStyle=Oe(e,py,t.fontStyle),this.fontVariant=Oe(e,dy,t.fontVariant),this.fontWeight=Oe(e,uy,t.fontWeight),this.letterSpacing=Oe(e,H2,t.letterSpacing),this.lineBreak=Oe(e,I2,t.lineBreak),this.lineHeight=Oe(e,D2,t.lineHeight),this.listStyleImage=Oe(e,_2,t.listStyleImage),this.listStylePosition=Oe(e,P2,t.listStylePosition),this.listStyleType=Oe(e,da,t.listStyleType),this.marginTop=Oe(e,N2,t.marginTop),this.marginRight=Oe(e,k2,t.marginRight),this.marginBottom=Oe(e,O2,t.marginBottom),this.marginLeft=Oe(e,K2,t.marginLeft),this.opacity=Oe(e,oy,t.opacity);var n=Oe(e,V2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,z2,t.overflowWrap),this.paddingTop=Oe(e,W2,t.paddingTop),this.paddingRight=Oe(e,R2,t.paddingRight),this.paddingBottom=Oe(e,G2,t.paddingBottom),this.paddingLeft=Oe(e,$2,t.paddingLeft),this.paintOrder=Oe(e,Cy,t.paintOrder),this.position=Oe(e,Z2,t.position),this.textAlign=Oe(e,X2,t.textAlign),this.textDecorationColor=Oe(e,ay,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Oe(e,ly,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,J2,t.textShadow),this.textTransform=Oe(e,Y2,t.textTransform),this.transform=Oe(e,q2,t.transform),this.transformOrigin=Oe(e,iy,t.transformOrigin),this.visibility=Oe(e,ry,t.visibility),this.webkitTextStrokeColor=Oe(e,vy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,Ty,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,ny,t.wordBreak),this.zIndex=Oe(e,sy,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return YA(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 Ut(this.display,4)||Ut(this.display,33554432)||Ut(this.display,268435456)||Ut(this.display,536870912)||Ut(this.display,67108864)||Ut(this.display,134217728)},i})(),by=(function(){function i(e,t){this.content=Oe(e,fy,t.content),this.quotes=Oe(e,By,t.quotes)}return i})(),Nu=(function(){function i(e,t){this.counterIncrement=Oe(e,gy,t.counterIncrement),this.counterReset=Oe(e,my,t.counterReset)}return i})(),Oe=function(i,e,t){var A=new cu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new hu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,ut(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 Yn.parse(i,n.parseComponentValue());case"color":return JA.parse(i,n.parseComponentValue());case"image":return ua.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return XA(o)?o:It;case"length-percentage":var l=n.parseComponentValue();return Ft(l)?l:It;case"time":return _u.parse(i,n.parseComponentValue())}break}},Qy="data-html2canvas-debug",Fy=function(i){var e=i.getAttribute(Qy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},pa=function(i,e){var t=Fy(i);return t===1||e===t},EA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,pa(t,3))debugger;this.styles=new xy(e,window.getComputedStyle(t,null)),Ua(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Ln(this.context,t),pa(t,4)&&(this.flags|=16)}return i})(),Uy="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",ku="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),as=0;as<ku.length;as++)Ur[ku.charCodeAt(as)]=as;for(var Sy=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=Ur[i.charCodeAt(A)],s=Ur[i.charCodeAt(A+1)],o=Ur[i.charCodeAt(A+2)],l=Ur[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},Ey=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Ly=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},wi=5,fa=11,ga=2,My=fa-wi,Ou=65536>>wi,Hy=1<<wi,ma=Hy-1,Iy=1024>>wi,Dy=Ou+Iy,_y=Dy,Py=32,Ny=_y+Py,ky=65536>>fa,Oy=1<<My,Ky=Oy-1,Ku=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Vy=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},zy=function(i,e){var t=Sy(i),A=Array.isArray(t)?Ly(t):new Uint32Array(t),r=Array.isArray(t)?Ey(t):new Uint16Array(t),n=24,s=Ku(r,n/2,A[4]/2),o=A[5]===2?Ku(r,(n+A[4])/2):Vy(A,Math.ceil((n+A[4])/4));return new Wy(A[0],A[1],A[2],A[3],s,o)},Wy=(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>>wi],t=(t<<ga)+(e&ma),this.data[t];if(e<=65535)return t=this.index[Ou+(e-55296>>wi)],t=(t<<ga)+(e&ma),this.data[t];if(e<this.highStart)return t=Ny-ky+(e>>fa),t=this.index[t],t+=e>>wi&Ky,t=this.index[t],t=(t<<ga)+(e&ma),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Vu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ry=typeof Uint8Array>"u"?[]:new Uint8Array(256),ls=0;ls<Vu.length;ls++)Ry[Vu.charCodeAt(ls)]=ls;var Gy=1,wa=2,Ba=3,zu=4,Wu=5,$y=7,Ru=8,ya=9,Ca=10,Gu=11,$u=12,Xu=13,Zu=14,va=15,Xy=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},Zy=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},Jy=zy(Uy),uA="×",Ta="÷",Yy=function(i){return Jy.get(i)},qy=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===wa&&s===Ba)return uA;if(n===wa||n===Ba||n===zu||s===wa||s===Ba||s===zu)return Ta;if(n===Ru&&[Ru,ya,Gu,$u].indexOf(s)!==-1||(n===Gu||n===ya)&&(s===ya||s===Ca)||(n===$u||n===Ca)&&s===Ca||s===Xu||s===Wu||s===$y||n===Gy)return uA;if(n===Xu&&s===Zu){for(;r===Wu;)r=e[--A];if(r===Zu)return uA}if(n===va&&s===va){for(var o=0;r===va;)o++,r=e[--A];if(o%2===0)return uA}return Ta},jy=function(i){var e=Xy(i),t=e.length,A=0,r=0,n=e.map(Yy);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=uA;A<t&&(s=qy(e,n,++A))===uA;);if(s!==uA||A===t){var o=Zy.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},eC=function(i){for(var e=jy(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},AC=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=Mn(A.data).map(function(l){return Tt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var m=u.x>s.x||u.y>s.y;return s=u,c===0?!0:m});return i.body.removeChild(e),o},iC=function(){return typeof new Image().crossOrigin<"u"},rC=function(){return typeof new XMLHttpRequest().responseType=="string"},nC=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},Ju=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},sC=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=xa(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),Yu(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",Ju(l)?Yu(xa(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),Ju(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},xa=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},Yu=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))})},Dt={get SUPPORT_RANGE_BOUNDS(){var i=tC(document);return Object.defineProperty(Dt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Dt.SUPPORT_RANGE_BOUNDS&&AC(document);return Object.defineProperty(Dt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=nC(document);return Object.defineProperty(Dt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?sC(document):Promise.resolve(!1);return Object.defineProperty(Dt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=iC();return Object.defineProperty(Dt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=rC();return Object.defineProperty(Dt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Dt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Dt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Sr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),oC=function(i,e,t,A){var r=cC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Dt.SUPPORT_RANGE_BOUNDS){var l=qu(A,s,o.length).getClientRects();if(l.length>1){var c=ba(o),u=0;c.forEach(function(y){n.push(new Sr(y,NA.fromDOMRectList(i,qu(A,u+s,y.length).getClientRects()))),u+=y.length})}else n.push(new Sr(o,NA.fromDOMRectList(i,l)))}else{var m=A.splitText(o.length);n.push(new Sr(o,aC(i,A))),A=m}else Dt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},aC=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=Ln(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return NA.EMPTY},qu=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},ba=function(i){if(Dt.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 eC(i)},lC=function(i,e){if(Dt.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 uC(i,e)},cC=function(i,e){return e.letterSpacing!==0?ba(i):lC(i,e)},hC=[32,160,4961,65792,65793,4153,4241],uC=function(i,e){for(var t=kw(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=Mn(s),l="";o.forEach(function(c){hC.indexOf(c)===-1?l+=Tt(c):(l.length&&A.push(l),A.push(Tt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},dC=(function(){function i(e,t,A){this.text=pC(t.data,A.textTransform),this.textBounds=oC(e,this.text,A,t)}return i})(),pC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(fC,gC);case 2:return i.toUpperCase();default:return i}},fC=/(^|\s|:|-|\(|\))([a-z])/g,gC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},ju=(function(i){BA(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})(EA),ed=(function(i){BA(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})(EA),td=(function(i){BA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Ln(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})(EA),Ad=(function(i){BA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(EA),Qa=(function(i){BA(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})(EA),mC=[{type:15,flags:0,unit:"px",number:3}],wC=[{type:16,flags:0,number:50}],BC=function(i){return i.width>i.height?new NA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new NA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},yC=function(i){var e=i.type===CC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},cs="checkbox",hs="radio",CC="password",id=707406591,Fa=(function(i){BA(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=yC(A),(r.type===cs||r.type===hs)&&(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=BC(r.bounds)),r.type){case cs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=mC;break;case hs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=wC;break}return r}return e})(EA),rd=(function(i){BA(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})(EA),nd=(function(i){BA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(EA),sd=(function(i){BA(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=ad(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Qr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):OA.TRANSPARENT,s=A.contentWindow.document.body?Qr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):OA.TRANSPARENT;r.backgroundColor=YA(n)?YA(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(EA),vC=["OL","UL","MENU"],us=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,ld(r)&&r.data.trim().length>0)t.textNodes.push(new dC(i,r,t.styles));else if(_i(r))if(fd(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return us(i,o,t,A)});else{var s=od(i,r);s.styles.isVisible()&&(TC(r,s,A)?s.flags|=4:xC(s.styles)&&(s.flags|=2),vC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?us(i,r.shadowRoot,s,A):!ps(r)&&!cd(r)&&!fs(r)&&us(i,r,s,A))}},od=function(i,e){return Ea(e)?new ju(i,e):hd(e)?new ed(i,e):cd(e)?new td(i,e):bC(e)?new Ad(i,e):QC(e)?new Qa(i,e):FC(e)?new Fa(i,e):fs(e)?new rd(i,e):ps(e)?new nd(i,e):dd(e)?new sd(i,e):new EA(i,e)},ad=function(i,e){var t=od(i,e);return t.flags|=4,us(i,e,t,t),t},TC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Sa(i)&&t.styles.isTransparent()},xC=function(i){return i.isPositioned()||i.isFloating()},ld=function(i){return i.nodeType===Node.TEXT_NODE},_i=function(i){return i.nodeType===Node.ELEMENT_NODE},Ua=function(i){return _i(i)&&typeof i.style<"u"&&!ds(i)},ds=function(i){return typeof i.className=="object"},bC=function(i){return i.tagName==="LI"},QC=function(i){return i.tagName==="OL"},FC=function(i){return i.tagName==="INPUT"},UC=function(i){return i.tagName==="HTML"},cd=function(i){return i.tagName==="svg"},Sa=function(i){return i.tagName==="BODY"},hd=function(i){return i.tagName==="CANVAS"},ud=function(i){return i.tagName==="VIDEO"},Ea=function(i){return i.tagName==="IMG"},dd=function(i){return i.tagName==="IFRAME"},pd=function(i){return i.tagName==="STYLE"},SC=function(i){return i.tagName==="SCRIPT"},ps=function(i){return i.tagName==="TEXTAREA"},fs=function(i){return i.tagName==="SELECT"},fd=function(i){return i.tagName==="SLOT"},gd=function(i){return i.tagName.indexOf("-")>0},EC=(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})(),md={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"]},wd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},LC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},MC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Pi=function(i,e,t,A,r,n){return i<e||i>t?Lr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Bd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},xt=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Bd(Math.abs(i),n,A,function(s){return Tt(Math.floor(s%n)+e)})+r)},Bi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Bd(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},Ni=1,jA=2,ei=4,Er=8,KA=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Lr(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&&Ut(n,Ni)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Ut(n,jA)||c===1&&l===1&&Ut(n,ei)&&i>100||c===1&&l>1&&Ut(n,Er)?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},yd="十百千萬",Cd="拾佰仟萬",vd="マイナス",La="마이너스",Lr=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=xt(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Bi(i,"〇一二三四五六七八九",r);case 6:return Pi(i,1,3999,md,3,A).toLowerCase();case 7:return Pi(i,1,3999,md,3,A);case 8:return xt(i,945,969,!1,A);case 9:return xt(i,97,122,!1,A);case 10:return xt(i,65,90,!1,A);case 11:return xt(i,1632,1641,!0,A);case 12:case 49:return Pi(i,1,9999,wd,3,A);case 35:return Pi(i,1,9999,wd,3,A).toLowerCase();case 13:return xt(i,2534,2543,!0,A);case 14:case 30:return xt(i,6112,6121,!0,A);case 15:return Bi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Bi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return KA(i,"零一二三四五六七八九",yd,"負",r,jA|ei|Er);case 47:return KA(i,"零壹貳參肆伍陸柒捌玖",Cd,"負",r,Ni|jA|ei|Er);case 42:return KA(i,"零一二三四五六七八九",yd,"负",r,jA|ei|Er);case 41:return KA(i,"零壹贰叁肆伍陆柒捌玖",Cd,"负",r,Ni|jA|ei|Er);case 26:return KA(i,"〇一二三四五六七八九","十百千万",vd,r,0);case 25:return KA(i,"零壱弐参四伍六七八九","拾百千万",vd,r,Ni|jA|ei);case 31:return KA(i,"영일이삼사오육칠팔구","십백천만",La,n,Ni|jA|ei);case 33:return KA(i,"零一二三四五六七八九","十百千萬",La,n,0);case 32:return KA(i,"零壹貳參四五六七八九","拾百千",La,n,Ni|jA|ei);case 18:return xt(i,2406,2415,!0,A);case 20:return Pi(i,1,19999,MC,3,A);case 21:return xt(i,2790,2799,!0,A);case 22:return xt(i,2662,2671,!0,A);case 22:return Pi(i,1,10999,LC,3,A);case 23:return Bi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Bi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return xt(i,3302,3311,!0,A);case 28:return Bi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Bi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return xt(i,3792,3801,!0,A);case 37:return xt(i,6160,6169,!0,A);case 38:return xt(i,4160,4169,!0,A);case 39:return xt(i,2918,2927,!0,A);case 40:return xt(i,1776,1785,!0,A);case 43:return xt(i,3046,3055,!0,A);case 44:return xt(i,3174,3183,!0,A);case 45:return xt(i,3664,3673,!0,A);case 46:return xt(i,3872,3881,!0,A);default:return xt(i,48,57,!0,A)}},Td="data-html2canvas-ignore",xd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new EC,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=HC(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=_C(r).then(function(){return Wt(A,void 0,void 0,function(){var u,m;return kt(this,function(y){switch(y.label){case 0:return this.scrolledElements.forEach(OC),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,m=this.clonedReferenceElement,typeof m>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:y.sent(),y.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,DC(l)]:[3,4];case 3:y.sent(),y.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(NC(document.doctype)+"<html></html>"),kC(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(pa(e,2))debugger;if(hd(e))return this.createCanvasClone(e);if(ud(e))return this.createVideoClone(e);if(pd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ea(t)&&(Ea(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),gd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ma(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){(!_i(t)||!SC(t)&&!t.hasAttribute(Td)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!_i(t)||!pd(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(_i(n)&&fd(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(ld(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&_i(e)&&(Ua(e)||ds(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&&Ua(r)&&(this.clonedReferenceElement=r),Sa(r)&&zC(r);var l=this.counters.parse(new Nu(this.context,n)),c=this.resolvePseudoContent(e,r,s,Mr.BEFORE);gd(e)&&(t=!0),ud(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,o,Mr.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||ds(e))&&!dd(e)||t)&&Ma(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(ps(e)||fs(e))&&(ps(r)||fs(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 Nu(this.context,A));var l=new by(this.context,A),c=o.createElement("html2canvaspseudoelement");Ma(A,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var y=o.createElement("img");y.src=m.value,y.style.opacity="1",c.appendChild(y)}else if(m.type===18){if(m.name==="attr"){var v=m.values.filter(ut);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(m.name==="counter"){var T=m.values.filter(Ii),C=T[0],U=T[1];if(C&&ut(C)){var F=n.counters.getCounterValue(C.value),E=U&&ut(U)?da.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Lr(F,E,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Ii),C=N[0],R=N[1],U=N[2];if(C&&ut(C)){var M=n.counters.getCounterValues(C.value),z=U&&ut(U)?da.parse(n.context,U.value):3,Ae=R&&R.type===0?R.value:"",$=M.map(function(re){return Lr(re,z,!1)}).join(Ae);c.appendChild(o.createTextNode($))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(Pu(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Pu(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=Ha+" "+Ia;var u=r===Mr.BEFORE?" "+Ha:" "+Ia;return ds(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),Mr;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})(Mr||(Mr={}));var HC=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(Td,"true"),i.body.appendChild(t),t},IC=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},DC=function(i){return Promise.all([].slice.call(i.images,0).map(IC))},_C=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)}})},PC=["all","d","content"],Ma=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);PC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},NC=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},kC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},OC=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},KC=":before",VC=":after",Ha="___html2canvas___pseudoelement_before",Ia="___html2canvas___pseudoelement_after",bd=`{
7
7
  content: "" !important;
8
8
  display: none !important;
9
- }`,NC=function(i){OC(i,"."+Ea+PC+vd+`
10
- .`+La+kC+vd)},OC=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Td=(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})(),KC=(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)||(Ha(e)||RC(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 Wt(this,void 0,void 0,function(){var t,A,r,n,s=this;return Nt(this,function(o){switch(o.label){case 0:return t=Td.isSameOrigin(e),A=!Ma(e)&&this._options.useCORS===!0&&Ht.SUPPORT_CORS_IMAGES&&!t,r=!Ma(e)&&!t&&!Ha(e)&&typeof this._options.proxy=="string"&&Ht.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Ma(e)&&!Ha(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,(GC(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=Ht.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var m=new FileReader;m.addEventListener("load",function(){return n(m.result)},!1),m.addEventListener("error",function(y){return s(y)},!1),m.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),VC=/^data:image\/svg\+xml/i,zC=/^data:image\/.*;base64,/i,WC=/^data:image\/.*/i,RC=function(i){return Ht.SUPPORT_SVG_DRAWING||!$C(i)},Ma=function(i){return WC.test(i)},GC=function(i){return zC.test(i)},Ha=function(i){return i.substr(0,4)==="blob"},$C=function(i){return i.substr(-3).toLowerCase()==="svg"||VC.test(i)},De=(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})(),_i=function(i,e,t){return new De(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},ds=(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=_i(this.start,this.startControl,e),r=_i(this.startControl,this.endControl,e),n=_i(this.endControl,this.end,e),s=_i(A,r,e),o=_i(r,n,e),l=_i(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})(),cA=function(i){return i.type===1},XC=(function(){function i(e){var t=e.styles,A=e.bounds,r=Cr(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=Cr(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=Cr(t.borderBottomRightRadius,A.width,A.height),m=u[0],y=u[1],v=Cr(t.borderBottomLeftRadius,A.width,A.height),T=v[0],B=v[1],S=[];S.push((n+l)/A.width),S.push((T+m)/A.width),S.push((s+B)/A.height),S.push((c+y)/A.height);var F=Math.max.apply(Math,S);F>1&&(n/=F,s/=F,l/=F,c/=F,m/=F,y/=F,T/=F,B/=F);var U=A.width-l,k=A.height-y,R=A.width-m,L=A.height-B,z=t.borderTopWidth,te=t.borderRightWidth,$=t.borderBottomWidth,V=t.borderLeftWidth,Ae=dt(t.paddingTop,e.bounds.width),re=dt(t.paddingRight,e.bounds.width),le=dt(t.paddingBottom,e.bounds.width),X=dt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?ft(A.left+V/3,A.top+z/3,n-V/3,s-z/3,ot.TOP_LEFT):new De(A.left+V/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?ft(A.left+U,A.top+z/3,l-te/3,c-z/3,ot.TOP_RIGHT):new De(A.left+A.width-te/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||y>0?ft(A.left+R,A.top+k,m-te/3,y-$/3,ot.BOTTOM_RIGHT):new De(A.left+A.width-te/3,A.top+A.height-$/3),this.bottomLeftBorderDoubleOuterBox=T>0||B>0?ft(A.left+V/3,A.top+L,T-V/3,B-$/3,ot.BOTTOM_LEFT):new De(A.left+V/3,A.top+A.height-$/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?ft(A.left+V*2/3,A.top+z*2/3,n-V*2/3,s-z*2/3,ot.TOP_LEFT):new De(A.left+V*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?ft(A.left+U,A.top+z*2/3,l-te*2/3,c-z*2/3,ot.TOP_RIGHT):new De(A.left+A.width-te*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||y>0?ft(A.left+R,A.top+k,m-te*2/3,y-$*2/3,ot.BOTTOM_RIGHT):new De(A.left+A.width-te*2/3,A.top+A.height-$*2/3),this.bottomLeftBorderDoubleInnerBox=T>0||B>0?ft(A.left+V*2/3,A.top+L,T-V*2/3,B-$*2/3,ot.BOTTOM_LEFT):new De(A.left+V*2/3,A.top+A.height-$*2/3),this.topLeftBorderStroke=n>0||s>0?ft(A.left+V/2,A.top+z/2,n-V/2,s-z/2,ot.TOP_LEFT):new De(A.left+V/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?ft(A.left+U,A.top+z/2,l-te/2,c-z/2,ot.TOP_RIGHT):new De(A.left+A.width-te/2,A.top+z/2),this.bottomRightBorderStroke=m>0||y>0?ft(A.left+R,A.top+k,m-te/2,y-$/2,ot.BOTTOM_RIGHT):new De(A.left+A.width-te/2,A.top+A.height-$/2),this.bottomLeftBorderStroke=T>0||B>0?ft(A.left+V/2,A.top+L,T-V/2,B-$/2,ot.BOTTOM_LEFT):new De(A.left+V/2,A.top+A.height-$/2),this.topLeftBorderBox=n>0||s>0?ft(A.left,A.top,n,s,ot.TOP_LEFT):new De(A.left,A.top),this.topRightBorderBox=l>0||c>0?ft(A.left+U,A.top,l,c,ot.TOP_RIGHT):new De(A.left+A.width,A.top),this.bottomRightBorderBox=m>0||y>0?ft(A.left+R,A.top+k,m,y,ot.BOTTOM_RIGHT):new De(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=T>0||B>0?ft(A.left,A.top+L,T,B,ot.BOTTOM_LEFT):new De(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?ft(A.left+V,A.top+z,Math.max(0,n-V),Math.max(0,s-z),ot.TOP_LEFT):new De(A.left+V,A.top+z),this.topRightPaddingBox=l>0||c>0?ft(A.left+Math.min(U,A.width-te),A.top+z,U>A.width+te?0:Math.max(0,l-te),Math.max(0,c-z),ot.TOP_RIGHT):new De(A.left+A.width-te,A.top+z),this.bottomRightPaddingBox=m>0||y>0?ft(A.left+Math.min(R,A.width-V),A.top+Math.min(k,A.height-$),Math.max(0,m-te),Math.max(0,y-$),ot.BOTTOM_RIGHT):new De(A.left+A.width-te,A.top+A.height-$),this.bottomLeftPaddingBox=T>0||B>0?ft(A.left+V,A.top+Math.min(L,A.height-$),Math.max(0,T-V),Math.max(0,B-$),ot.BOTTOM_LEFT):new De(A.left+V,A.top+A.height-$),this.topLeftContentBox=n>0||s>0?ft(A.left+V+X,A.top+z+Ae,Math.max(0,n-(V+X)),Math.max(0,s-(z+Ae)),ot.TOP_LEFT):new De(A.left+V+X,A.top+z+Ae),this.topRightContentBox=l>0||c>0?ft(A.left+Math.min(U,A.width+V+X),A.top+z+Ae,U>A.width+V+X?0:l-V+X,c-(z+Ae),ot.TOP_RIGHT):new De(A.left+A.width-(te+re),A.top+z+Ae),this.bottomRightContentBox=m>0||y>0?ft(A.left+Math.min(R,A.width-(V+X)),A.top+Math.min(k,A.height+z+Ae),Math.max(0,m-(te+re)),y-($+le),ot.BOTTOM_RIGHT):new De(A.left+A.width-(te+re),A.top+A.height-($+le)),this.bottomLeftContentBox=T>0||B>0?ft(A.left+V+X,A.top+L,Math.max(0,T-(V+X)),B-($+le),ot.BOTTOM_LEFT):new De(A.left+V+X,A.top+A.height-($+le))}return i})(),ot;(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"})(ot||(ot={}));var ft=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 ot.TOP_LEFT:return new ds(new De(i,c),new De(i,c-o),new De(l-s,e),new De(l,e));case ot.TOP_RIGHT:return new ds(new De(i,e),new De(i+s,e),new De(l,c-o),new De(l,c));case ot.BOTTOM_RIGHT:return new ds(new De(l,e),new De(l,e+o),new De(i+s,c),new De(i,c));case ot.BOTTOM_LEFT:default:return new ds(new De(l,c),new De(l-s,c),new De(i,e+o),new De(i,e))}},ps=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},ZC=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},fs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},JC=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),gs=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),YC=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),qC=function(i){return i.type===0},xd=function(i){return i.type===1},jC=function(i){return i.type===2},bd=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},ev=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})},Qd=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Fd=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new XC(this.container),this.container.styles.opacity<1&&this.effects.push(new YC(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 JC(A,r,n))}if(this.container.styles.overflowX!==0){var s=ps(this.curves),o=fs(this.curves);bd(s,o)?this.effects.push(new gs(s,6)):(this.effects.push(new gs(s,2)),this.effects.push(new gs(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!xd(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=ps(A.curves),o=fs(A.curves);bd(s,o)||r.unshift(new gs(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return Qt(l.target,e)})},i})(),Ia=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Qt(r.flags,4),s=Qt(r.flags,2),o=new Fd(r,i);Qt(r.styles.display,2048)&&A.push(o);var l=Qt(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Qd(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var y=0;c.negativeZIndex.some(function(T,B){return m>T.element.container.styles.zIndex.order?(y=B,!1):y>0}),c.negativeZIndex.splice(y,0,u)}else if(m>0){var v=0;c.positiveZIndex.some(function(T,B){return m>=T.element.container.styles.zIndex.order?(v=B+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);Ia(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Ia(o,e,t,l);Qt(r.flags,8)&&Ud(r,l)})},Ud=function(i,e){for(var t=i instanceof Ta?i.start:1,A=i instanceof Ta?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof ju&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Fr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},tv=function(i){var e=new Fd(i,null),t=new Qd(e),A=[];return Ia(e,t,t,A),Ud(e.container,A),t},Sd=function(i,e){switch(e){case 0:return hA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return hA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return hA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return hA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},Av=function(i,e){switch(e){case 0:return hA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return hA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return hA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return hA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},iv=function(i,e){switch(e){case 0:return hA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return hA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return hA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return hA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},rv=function(i,e){switch(e){case 0:return ms(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return ms(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return ms(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return ms(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},ms=function(i,e){var t=[];return cA(i)?t.push(i.subdivide(.5,!1)):t.push(i),cA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},hA=function(i,e,t,A){var r=[];return cA(i)?r.push(i.subdivide(.5,!1)):r.push(i),cA(t)?r.push(t.subdivide(.5,!0)):r.push(t),cA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),cA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},Ed=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},ws=function(i){var e=i.styles,t=i.bounds,A=dt(e.paddingLeft,t.width),r=dt(e.paddingRight,t.width),n=dt(e.paddingTop,t.width),s=dt(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))},nv=function(i,e){return i===0?e.bounds:i===2?ws(e):Ed(e)},sv=function(i,e){return i===0?e.bounds:i===2?ws(e):Ed(e)},Da=function(i,e,t){var A=nv(ki(i.styles.backgroundOrigin,e),i),r=sv(ki(i.styles.backgroundClip,e),i),n=ov(ki(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=Cr(ki(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=av(ki(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),m=Math.round(A.top+l[1]);return[c,u,m,s,o]},Pi=function(i){return lt(i)&&i.value===Mi.AUTO},Bs=function(i){return typeof i=="number"},ov=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(bt(s)&&o&&bt(o))return[dt(s,t.width),dt(o,t.height)];var l=Bs(n);if(lt(s)&&(s.value===Mi.CONTAIN||s.value===Mi.COVER)){if(Bs(n)){var c=t.width/t.height;return c<n!=(s.value===Mi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=Bs(A),m=Bs(r),y=u||m;if(Pi(s)&&(!o||Pi(o))){if(u&&m)return[A,r];if(!l&&!y)return[t.width,t.height];if(y&&l){var v=u?A:r*n,T=m?r:A/n;return[v,T]}var B=u?A:t.width,S=m?r:t.height;return[B,S]}if(l){var F=0,U=0;return bt(s)?F=dt(s,t.width):bt(o)&&(U=dt(o,t.height)),Pi(s)?F=U*n:(!o||Pi(o))&&(U=F/n),[F,U]}var k=null,R=null;if(bt(s)?k=dt(s,t.width):o&&bt(o)&&(R=dt(o,t.height)),k!==null&&(!o||Pi(o))&&(R=u&&m?k/A*r:t.height),R!==null&&Pi(s)&&(k=u&&m?R/r*A:t.width),k!==null&&R!==null)return[k,R];throw new Error("Unable to calculate background-size for element")},ki=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},av=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 De(Math.round(A.left),Math.round(A.top+s)),new De(Math.round(A.left+A.width),Math.round(A.top+s)),new De(Math.round(A.left+A.width),Math.round(l+A.top+s)),new De(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new De(Math.round(A.left+n),Math.round(A.top)),new De(Math.round(A.left+n+o),Math.round(A.top)),new De(Math.round(A.left+n+o),Math.round(A.height+A.top)),new De(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new De(Math.round(A.left+n),Math.round(A.top+s)),new De(Math.round(A.left+n+o),Math.round(A.top+s)),new De(Math.round(A.left+n+o),Math.round(A.top+s+l)),new De(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new De(Math.round(r.left),Math.round(r.top)),new De(Math.round(r.left+r.width),Math.round(r.top)),new De(Math.round(r.left+r.width),Math.round(r.height+r.top)),new De(Math.round(r.left),Math.round(r.height+r.top))]}},lv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ld="Hidden Text",cv=(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=lv,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(Ld)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Ld)),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})(),Md=(function(){function i(e,t){this.context=e,this.options=t}return i})(),hv=1e4,uv=(function(i){gA(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 cv(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(),jC(t)&&(this.ctx.globalAlpha=t.opacity),qC(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)),xd(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 Wt(this,void 0,void 0,function(){var A;return Nt(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 Wt(this,void 0,void 0,function(){return Nt(this,function(A){switch(A.label){case 0:if(Qt(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=mv(t.fontFamily).join(", "),n=yr(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 Wt(this,void 0,void 0,function(){var r,n,s,o,l,c,u,m,y=this;return Nt(this,function(v){return r=this.createFontStyle(A),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,u=l.middle,m=A.paintOrder,t.textBounds.forEach(function(T){m.forEach(function(B){switch(B){case 0:y.ctx.fillStyle=Ut(A.color),y.renderTextWithLetterSpacing(T,A.letterSpacing,c);var S=A.textShadow;S.length&&T.text.trim().length&&(S.slice(0).reverse().forEach(function(F){y.ctx.shadowColor=Ut(F.color),y.ctx.shadowOffsetX=F.offsetX.number*y.options.scale,y.ctx.shadowOffsetY=F.offsetY.number*y.options.scale,y.ctx.shadowBlur=F.blur.number,y.renderTextWithLetterSpacing(T,A.letterSpacing,c)}),y.ctx.shadowColor="",y.ctx.shadowOffsetX=0,y.ctx.shadowOffsetY=0,y.ctx.shadowBlur=0),A.textDecorationLine.length&&(y.ctx.fillStyle=Ut(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top+c),T.bounds.width,1);break;case 2:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top),T.bounds.width,1);break;case 3:y.ctx.fillRect(T.bounds.left,Math.ceil(T.bounds.top+u),T.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&T.text.trim().length&&(y.ctx.strokeStyle=Ut(A.webkitTextStrokeColor),y.ctx.lineWidth=A.webkitTextStrokeWidth,y.ctx.lineJoin=window.chrome?"miter":"round",y.ctx.strokeText(T.text,T.bounds.left,T.bounds.top+c)),y.ctx.strokeStyle="",y.ctx.lineWidth=0,y.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=ws(t),s=fs(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 Wt(this,void 0,void 0,function(){var A,r,n,s,o,l,U,U,c,u,m,y,R,v,T,L,B,S,F,U,k,R,L;return Nt(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 Ju))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 U=z.sent(),this.renderReplacedElement(A,r,U),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Yu&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof qu))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 U=z.sent(),this.renderReplacedElement(A,r,U),[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 id&&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 xa&&(m=Math.min(A.bounds.width,A.bounds.height),A.type===os?A.checked&&(this.ctx.save(),this.path([new De(A.bounds.left+m*.39363,A.bounds.top+m*.79),new De(A.bounds.left+m*.16,A.bounds.top+m*.5549),new De(A.bounds.left+m*.27347,A.bounds.top+m*.44071),new De(A.bounds.left+m*.39694,A.bounds.top+m*.5649),new De(A.bounds.left+m*.72983,A.bounds.top+m*.23),new De(A.bounds.left+m*.84,A.bounds.top+m*.34085),new De(A.bounds.left+m*.39363,A.bounds.top+m*.79)]),this.ctx.fillStyle=Ut(ed),this.ctx.fill(),this.ctx.restore()):A.type===as&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+m/2,A.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ut(ed),this.ctx.fill(),this.ctx.restore())),dv(A)&&A.value.length){switch(y=this.createFontStyle(n),R=y[0],v=y[1],T=this.fontMetrics.getMetrics(R,v).baseline,this.ctx.font=R,this.ctx.fillStyle=Ut(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=fv(A.styles.textAlign),L=ws(A),B=0,A.styles.textAlign){case 1:B+=L.width/2;break;case 2:B+=L.width;break}S=L.add(B,0,0,-L.height/2+1),this.ctx.save(),this.path([new De(L.left,L.top),new De(L.left+L.width,L.top),new De(L.left+L.width,L.top+L.height),new De(L.left,L.top+L.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new br(A.value,S),n.letterSpacing,T),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Qt(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];U=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 U=z.sent(),this.ctx.drawImage(U,A.bounds.left-(U.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=Ut(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",L=new IA(A.bounds.left,A.bounds.top+dt(A.styles.paddingTop,A.bounds.width),A.bounds.width,Lu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new br(t.listValue,L),n.letterSpacing,Lu(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 Wt(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,m,y,F,v,T,F,B,S,F;return Nt(this,function(U){switch(U.label){case 0:if(Qt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:U.sent(),A=0,r=t.negativeZIndex,U.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:U.sent(),U.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:U.sent(),n=0,s=t.nonInlineLevel,U.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:U.sent(),U.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,U.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:U.sent(),U.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,U.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:U.sent(),U.label=17;case 17:return c++,[3,15];case 18:m=0,y=t.inlineLevel,U.label=19;case 19:return m<y.length?(F=y[m],[4,this.renderNode(F)]):[3,22];case 20:U.sent(),U.label=21;case 21:return m++,[3,19];case 22:v=0,T=t.zeroOrAutoZIndexOrTransformedOrOpacity,U.label=23;case 23:return v<T.length?(F=T[v],[4,this.renderStack(F)]):[3,26];case 24:U.sent(),U.label=25;case 25:return v++,[3,23];case 26:B=0,S=t.positiveZIndex,U.label=27;case 27:return B<S.length?(F=S[B],[4,this.renderStack(F)]):[3,30];case 28:U.sent(),U.label=29;case 29:return B++,[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=cA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),cA(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 Wt(this,void 0,void 0,function(){var A,r,n,s,o,l;return Nt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var m,y,v,Ae,ae,se,X,j,$,T,Ae,ae,se,X,j,B,S,F,U,k,R,L,z,te,$,V,Ae,re,le,X,j,oe,ae,se,ce,de,we,Qe,Se,Ce,Te,Ue;return Nt(this,function(Ee){switch(Ee.label){case 0:if(u.type!==0)return[3,5];m=void 0,y=u.url,Ee.label=1;case 1:return Ee.trys.push([1,3,,4]),[4,n.context.cache.match(y)];case 2:return m=Ee.sent(),[3,4];case 3:return Ee.sent(),n.context.logger.error("Error loading background-image "+y),[3,4];case 4:return m&&(v=Da(t,A,[m.width,m.height,m.width/m.height]),Ae=v[0],ae=v[1],se=v[2],X=v[3],j=v[4],$=n.ctx.createPattern(n.resizeImage(m,X,j),"repeat"),n.renderRepeat(Ae,$,ae,se)),[3,6];case 5:qB(u)?(T=Da(t,A,[null,null,null]),Ae=T[0],ae=T[1],se=T[2],X=T[3],j=T[4],B=$B(u.angle,X,j),S=B[0],F=B[1],U=B[2],k=B[3],R=B[4],L=document.createElement("canvas"),L.width=X,L.height=j,z=L.getContext("2d"),te=z.createLinearGradient(F,k,U,R),yu(u.stops,S).forEach(function(Ie){return te.addColorStop(Ie.stop,Ut(Ie.color))}),z.fillStyle=te,z.fillRect(0,0,X,j),X>0&&j>0&&($=n.ctx.createPattern(L,"repeat"),n.renderRepeat(Ae,$,ae,se))):jB(u)&&(V=Da(t,A,[null,null,null]),Ae=V[0],re=V[1],le=V[2],X=V[3],j=V[4],oe=u.position.length===0?[oa]:u.position,ae=dt(oe[0],X),se=dt(oe[oe.length-1],j),ce=XB(u,ae,se,X,j),de=ce[0],we=ce[1],de>0&&we>0&&(Qe=n.ctx.createRadialGradient(re+ae,le+se,0,re+ae,le+se,de),yu(u.stops,de*2).forEach(function(Ie){return Qe.addColorStop(Ie.stop,Ut(Ie.color))}),n.path(Ae),n.ctx.fillStyle=Qe,de!==we?(Se=t.bounds.left+.5*t.bounds.width,Ce=t.bounds.top+.5*t.bounds.height,Te=we/de,Ue=1/Te,n.ctx.save(),n.ctx.translate(Se,Ce),n.ctx.transform(1,0,0,Te,0,0),n.ctx.translate(-Se,-Ce),n.ctx.fillRect(re,Ue*(le-Ce)+Ce,X,j*Ue),n.ctx.restore()):n.ctx.fill())),Ee.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 Wt(this,void 0,void 0,function(){return Nt(this,function(n){return this.path(Sd(r,A)),this.ctx.fillStyle=Ut(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return Wt(this,void 0,void 0,function(){var s,o;return Nt(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=Av(n,r),this.path(s),this.ctx.fillStyle=Ut(t),this.ctx.fill(),o=iv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Wt(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,m=this;return Nt(this,function(y){switch(y.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!$A(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=pv(ki(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),$A(A.backgroundColor)||(this.ctx.fillStyle=Ut(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:y.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){m.ctx.save();var T=ps(t.curves),B=v.inset?0:hv,S=ev(T,-B+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(m.path(T),m.ctx.clip(),m.mask(S)):(m.mask(T),m.ctx.clip(),m.path(S)),m.ctx.shadowOffsetX=v.offsetX.number+B,m.ctx.shadowOffsetY=v.offsetY.number,m.ctx.shadowColor=Ut(v.color),m.ctx.shadowBlur=v.blur.number,m.ctx.fillStyle=v.inset?Ut(v.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),y.label=2;case 2:o=0,l=0,c=n,y.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!$A(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return y.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return y.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return y.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:y.sent(),y.label=11;case 11:o++,y.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return Wt(this,void 0,void 0,function(){var o,l,c,u,m,y,v,T,B,S,F,U,k,R,L,z,L,z;return Nt(this,function(te){return this.ctx.save(),o=rv(n,r),l=Sd(n,r),s===2&&(this.path(l),this.ctx.clip()),cA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),cA(l[1])?(m=l[1].end.x,y=l[1].end.y):(m=l[1].x,y=l[1].y),r===0||r===2?v=Math.abs(c-m):v=Math.abs(u-y),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),T=A<3?A*3:A*2,B=A<3?A*2:A,s===3&&(T=A,B=A),S=!0,v<=T*2?S=!1:v<=T*2+B?(F=v/(2*T+B),T*=F,B*=F):(U=Math.floor((v+B)/(T+B)),k=(v-U*T)/(U-1),R=(v-(U+1)*T)/U,B=R<=0||Math.abs(B-k)<Math.abs(B-R)?k:R),S&&(s===3?this.ctx.setLineDash([0,T+B]):this.ctx.setLineDash([T,B])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=Ut(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(cA(l[0])&&(L=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new De(L.end.x,L.end.y),new De(z.start.x,z.start.y)]),this.ctx.stroke()),cA(l[1])&&(L=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new De(L.end.x,L.end.y),new De(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Wt(this,void 0,void 0,function(){var A;return Nt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ut(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=tv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Md),dv=function(i){return i instanceof Ad||i instanceof td?!0:i instanceof xa&&i.type!==as&&i.type!==os},pv=function(i,e){switch(i){case 0:return ps(e);case 2:return ZC(e);default:return fs(e)}},fv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},gv=["-apple-system","system-ui"],mv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return gv.indexOf(e)===-1}):i},wv=(function(i){gA(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 Wt(this,void 0,void 0,function(){var A,r;return Nt(this,function(n){switch(n.label){case 0:return A=Ca(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Bv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ut(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})(Md),Bv=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))})},yv=(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,Fn([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,Fn([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,Fn([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,Fn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),Cv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new yv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new KC(this,e)}return i.instanceCount=1,i})(),vv=function(i,e){return e===void 0&&(e={}),Tv(i,e)};typeof window<"u"&&Td.setContext(window);var Tv=function(i,e){return Wt(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,m,y,v,T,B,S,F,U,k,R,L,te,z,te,$,V,Ae,re,le,X,j,oe,ae,se,ce,de,we,Qe,Se,Ce,Te;return Nt(this,function(Ue){switch(Ue.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:($=e.allowTaint)!==null&&$!==void 0?$:!1,imageTimeout:(V=e.imageTimeout)!==null&&V!==void 0?V:15e3,proxy:e.proxy,useCORS:(Ae=e.useCORS)!==null&&Ae!==void 0?Ae:!1},n=Oo({logging:(re=e.logging)!==null&&re!==void 0?re:!0,cache:e.cache},r),s={windowWidth:(le=e.windowWidth)!==null&&le!==void 0?le:A.innerWidth,windowHeight:(X=e.windowHeight)!==null&&X!==void 0?X:A.innerHeight,scrollX:(j=e.scrollX)!==null&&j!==void 0?j:A.pageXOffset,scrollY:(oe=e.scrollY)!==null&&oe!==void 0?oe:A.pageYOffset},o=new IA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new Cv(n,o),c=(ae=e.foreignObjectRendering)!==null&&ae!==void 0?ae:!1,u={allowTaint:(se=e.allowTaint)!==null&&se!==void 0?se:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),m=new Cd(l,i,u),y=m.clonedReferenceElement,y?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=Ue.sent(),T=Qa(y)||xC(y)?ew(y.ownerDocument):Un(l,y),B=T.width,S=T.height,F=T.left,U=T.top,k=xv(l,y,e.backgroundColor),R={canvas:e.canvas,backgroundColor:k,scale:(de=(ce=e.scale)!==null&&ce!==void 0?ce:A.devicePixelRatio)!==null&&de!==void 0?de:1,x:((we=e.x)!==null&&we!==void 0?we:0)+F,y:((Qe=e.y)!==null&&Qe!==void 0?Qe:0)+U,width:(Se=e.width)!==null&&Se!==void 0?Se:Math.ceil(B),height:(Ce=e.height)!==null&&Ce!==void 0?Ce:Math.ceil(S)},c?(l.logger.debug("Document cloned, using foreign object rendering"),te=new wv(l,R),[4,te.render(y)]):[3,3];case 2:return L=Ue.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+U+" with size "+B+"x"+S+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=nd(l,y),k===z.styles.backgroundColor&&(z.styles.backgroundColor=_A.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),te=new uv(l,R),[4,te.render(z)];case 4:L=Ue.sent(),Ue.label=5;case 5:return(!((Te=e.removeContainer)!==null&&Te!==void 0)||Te)&&(Cd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,L]}})})},xv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?vr(i,getComputedStyle(A.documentElement).backgroundColor):_A.TRANSPARENT,n=A.body?vr(i,getComputedStyle(A.body).backgroundColor):_A.TRANSPARENT,s=typeof t=="string"?vr(i,t):t===null?_A.TRANSPARENT:4294967295;return e===A.documentElement?$A(r)?$A(n)?s:n:r:s};const bv={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 m=u.priceToCoordinate(n.price);if(m==null)return;const y=Math.round(m*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),T=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),B=o.bitmapSize.width;if(T>=B)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(T,y),l.lineTo(B,y),l.stroke(),l.beginPath(),l.fillStyle=n.color;const S=3*o.verticalPixelRatio;l.arc(T,y,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 Hd{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!A.visible||!A.text||!A._series)return;const c=A._series.priceToCoordinate(A.price);if(c==null)return;const u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),y=Math.round(14*l),v=s.width;let T;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);T=F!=null?Math.round(F*o):m,n.textAlign="right"}else T=m,n.textAlign="left";else A.hAlign==="right"?(T=v-m,n.textAlign="right"):(T=v/2,n.textAlign="center");const B=Math.round(c*l);let S;A.vAlign==="top"?S=B-y:A.vAlign==="bottom"?S=B+y:S=B,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 Fv{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),B=u.priceToCoordinate(s.p1.price),S=u.priceToCoordinate(s.p2.price);if(v==null||T==null||B==null||S==null)return;const F=Math.round(v*m),U=Math.round(B*y),k=Math.round(T*m),R=Math.round(S*y),L=l.context;if(L.save(),L.beginPath(),L.strokeStyle=s.color,L.lineWidth=s.lineWidth*y,L.setLineDash([]),L.moveTo(F,U),L.lineTo(k,R),L.stroke(),L.beginPath(),L.fillStyle=s.color,L.arc(F,U,3*y,0,Math.PI*2),L.fill(),L.beginPath(),L.arc(k,R,3*y,0,Math.PI*2),L.fill(),!s.statsShowAlways&&!s.isActive){L.restore();return}const{priceDiff:z,pricePct:te,bars:$,days:V,angle:Ae}=s.info,re=z>=0?"+":"",le=[];if(s.statsPriceRange!==!1&&le.push(`${re}${z.toFixed(5)} (${re}${te.toFixed(2)}%)`),s.statsBarsRange!==!1&&le.push(`${$} bars`),s.statsDateRange!==!1&&le.push(`${V} days`),s.statsAngle!==!1&&le.push(`∠ ${Ae.toFixed(1)}°`),s.statsDistance&&le.push(`Δ ${Math.abs(z).toFixed(5)}`),le.length===0){L.restore();return}const X=Math.round(11*y);L.font=`${X}px sans-serif`;const j=X*1.6,oe=8*y,ae=Math.max(...le.map(Ze=>L.measureText(Ze).width))+oe*2,se=le.length*j+oe*2,ce=s.statsPosition??"right";let de,we;ce==="left"?(de=F,we=U):ce==="center"?(de=Math.round((F+k)/2),we=Math.round((U+R)/2)):(de=k,we=R);let Qe,Se;ce==="left"?(Qe=de-ae-10*m,Se=we-se-4*y):ce==="center"?(Qe=de-ae/2,Se=we-se-8*y):(Qe=de+10*m,Se=we-se-4*y);const Ce=l.bitmapSize.width,Te=l.bitmapSize.height,Ue=Math.min(Math.max(0,Qe),Ce-ae-4*m),Ee=Math.min(Math.max(4*y,Se),Te-se-4*y),Ie=4*y;L.beginPath(),L.moveTo(Ue+Ie,Ee),L.lineTo(Ue+ae-Ie,Ee),L.quadraticCurveTo(Ue+ae,Ee,Ue+ae,Ee+Ie),L.lineTo(Ue+ae,Ee+se-Ie),L.quadraticCurveTo(Ue+ae,Ee+se,Ue+ae-Ie,Ee+se),L.lineTo(Ue+Ie,Ee+se),L.quadraticCurveTo(Ue,Ee+se,Ue,Ee+se-Ie),L.lineTo(Ue,Ee+Ie),L.quadraticCurveTo(Ue,Ee,Ue+Ie,Ee),L.closePath(),L.fillStyle="rgba(30, 41, 59, 0.92)",L.fill(),L.strokeStyle=s.statsColor||s.color,L.lineWidth=1*y,L.stroke(),L.fillStyle="#e2e8f0",L.textAlign="left",le.forEach((Ze,ze)=>{L.fillText(Ze,Ue+oe,Ee+oe+X+ze*j)}),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 Id{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),B=u.priceToCoordinate(s.p1.price),S=u.priceToCoordinate(s.p2.price);if(v==null||T==null||B==null||S==null)return;const F=Math.round(v*m),U=Math.round(B*y),k=Math.round(T*m),R=Math.round(S*y),L=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,k),Math.min(U,R),Math.abs(k-F),Math.abs(R-U)),z.strokeStyle=L,z.lineWidth=1*y,z.setLineDash([]),z.strokeRect(Math.min(F,k),Math.min(U,R),Math.abs(k-F),Math.abs(R-U))),z.beginPath(),z.strokeStyle=L,z.lineWidth=2*y,z.moveTo(F,U),z.lineTo(k,R),z.stroke(),z.fillStyle=L,z.beginPath(),z.arc(F,U,3*y,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(k,R,3*y,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:te,pricePct:$,bars:V,days:Ae}=s.info,re=te>=0?"+":"",le=[];if(s.statsPriceRange&&le.push(re+te.toFixed(5)+" ("+re+$.toFixed(2)+"%)"),s.statsBarsRange&&le.push(V+" bars"),s.statsDateRange&&le.push(Ae+" days"),le.length===0){z.restore();return}const X=Math.round(11*y);z.font=X+"px sans-serif";const j=X*1.6,oe=8*y,ae=Math.max(...le.map(Ue=>z.measureText(Ue).width))+oe*2,se=le.length*j+oe*2,ce=l.bitmapSize.width,de=l.bitmapSize.height;let we,Qe;if(s.statsPosition==="left")we=F-ae-10*m,Qe=U-se-4*y;else if(s.statsPosition==="center"){const Ue=(F+k)/2,Ee=(U+R)/2;we=Ue-ae/2,Qe=Ee-se-4*y}else we=k+10*m,Qe=R-se-4*y;const Se=Math.min(Math.max(0,we),ce-ae-4*m),Ce=Math.min(Math.max(4*y,Qe),de-se-4*y),Te=4*y;z.beginPath(),z.moveTo(Se+Te,Ce),z.lineTo(Se+ae-Te,Ce),z.quadraticCurveTo(Se+ae,Ce,Se+ae,Ce+Te),z.lineTo(Se+ae,Ce+se-Te),z.quadraticCurveTo(Se+ae,Ce+se,Se+ae-Te,Ce+se),z.lineTo(Se+Te,Ce+se),z.quadraticCurveTo(Se,Ce+se,Se,Ce+se-Te),z.lineTo(Se,Ce+Te),z.quadraticCurveTo(Se,Ce,Se+Te,Ce),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||L,z.lineWidth=1*y,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",le.forEach((Ue,Ee)=>{z.fillText(Ue,Se+oe,Ce+oe+X+Ee*j)}),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 Uv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.fillColor=A.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const B=Math.min(m,y)*c,S=Math.max(m,y)*c,F=Math.min(v,T)*u,U=Math.max(v,T)*u,k=S-B,R=U-F;if(k<.5||R<.5)return;const L=s.context;L.save(),L.fillStyle=r.fillColor,L.fillRect(B,F,k,R),L.strokeStyle=r.strokeColor,L.lineWidth=r.lineWidth*u,L.setLineDash([]),L.strokeRect(B,F,k,R),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 Sv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const B=m*c,S=y*u,F=v*c,U=T*u,k=Math.hypot(F-B,U-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(B,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 Ev{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,c=n._series;if(!l||!c)return;const u=o.horizontalPixelRatio,m=o.verticalPixelRatio,y=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),T=l.timeScale().timeToCoordinate(n.p2.rawTime),B=c.priceToCoordinate(n.p2.price),S=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(y==null||v==null||T==null||B==null||S==null||F==null)return;const U=y*u,k=v*m,R=T*u,L=B*m,z=S*u,te=F*m,$=o.context;$.save(),$.beginPath(),$.moveTo(U,k),$.lineTo(R,L),$.lineTo(z,te),$.closePath(),$.fillStyle=n.fillColor,$.fill(),$.strokeStyle=n.strokeColor,$.lineWidth=n.lineWidth*m,$.setLineDash([]),$.stroke(),$.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Lv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.minorRatio=A.minorRatio??.45,this.previewAsLine=A.previewAsLine??!1,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const B=m*c,S=y*u,F=v*c,U=T*u,k=F-B,R=U-S,L=Math.hypot(k,R);if(L<.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(B,S),z.lineTo(F,U),z.stroke();else{const te=(B+F)/2,$=(S+U)/2,V=Math.atan2(R,k),Ae=L/2,re=Math.max(1,Ae*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(te,$,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 Dd{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#f59e0b",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight!==!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const B=Math.round(m*c),S=Math.round(v*u),F=Math.round(y*c),U=Math.round(T*u),k=F-B,R=U-S,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*u,L.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const le=S+z*(0-B);L.beginPath(),L.moveTo(0,le),L.lineTo(B,S),L.stroke()}if(r.rayRight){const re=s.bitmapSize.width,le=U+z*(re-F);L.beginPath(),L.moveTo(F,U),L.lineTo(re,le),L.stroke()}L.beginPath(),L.moveTo(B,S),L.lineTo(F,U),L.stroke();const te=Math.atan2(U-S,F-B),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(te-V),le=U-$*Math.sin(te-V),X=F-$*Math.cos(te+V),j=U-$*Math.sin(te+V);L.beginPath(),L.moveTo(F,U),L.lineTo(re,le),L.lineTo(X,j),L.closePath(),L.fill()}if(r.arrowLeft){const re=te+Math.PI,le=B-$*Math.cos(re-V),X=S-$*Math.sin(re-V),j=B-$*Math.cos(re+V),oe=S-$*Math.sin(re+V);L.beginPath(),L.moveTo(B,S),L.lineTo(le,X),L.lineTo(j,oe),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,le=r.p2.rawTime,X=r.p1.price,j=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(j-X),ce=X!==0?Math.abs((j-X)/X*100):0,de=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(de)+" ("+ce.toFixed(2)+"%)")}const ae=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ce=o.timeScale().timeToCoordinate(le);if(se!=null&&ce!=null){const de=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ce);de!=null&&we!=null&&ae.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(le-re),ce=Math.floor(se/86400),de=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ce>0?ce+" day"+(ce!==1?"s":""):"";de>0&&(Qe+=(Qe?" ":"")+de+" hour"+(de!==1?"s":"")),!ce&&!de&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ae.length>0?ae[ae.length-1]+=" ("+Qe+")":ae.push(Qe)}if(r.statsDistance){const se=k/c,ce=R/u;ae.push("distance: "+Math.sqrt(se*se+ce*ce).toFixed(2))}if(ae.length>0&&oe.push(ae.join(", ")),r.statsAngle){const se=k/c,ce=R/u,de=Math.atan2(ce,se)*180/Math.PI;oe.push("∠ "+de.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ce=11*se,de=ce*1.5,we=5*se;L.font=ce+"px sans-serif";const Se=oe.reduce((ye,pe)=>Math.max(ye,L.measureText(pe).width),0)+we*2,Ce=oe.length*de+we*2,[Te,Ue,Ee,Ie]=B<=F?[B,S,F,U]:[F,U,B,S];let Ze,ze;r.statsPosition==="left"?(Ze=Te,ze=Ue):r.statsPosition==="center"?(Ze=(Te+Ee)/2,ze=(Ue+Ie)/2):(Ze=Ee,ze=Ie);const ve=Ze-Se/2,Ne=ze-Ce-12*se;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(ve,Ne,Se,Ce),L.strokeStyle=r.statsColor,L.lineWidth=1*se,L.strokeRect(ve,Ne,Se,Ce),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",oe.forEach((ye,pe)=>{L.fillText(ye,ve+we,Ne+we+pe*de)})}}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 Mv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const B=Math.round(m*c),S=Math.round(v*u),F=Math.round(y*c),U=Math.round(T*u),k=F-B,R=U-S,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*u,L.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const le=S+z*(0-B);L.beginPath(),L.moveTo(0,le),L.lineTo(B,S),L.stroke()}if(r.rayRight){const re=s.bitmapSize.width,le=U+z*(re-F);L.beginPath(),L.moveTo(F,U),L.lineTo(re,le),L.stroke()}L.beginPath(),L.moveTo(B,S),L.lineTo(F,U),L.stroke();const te=Math.atan2(U-S,F-B),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(te-V),le=U-$*Math.sin(te-V),X=F-$*Math.cos(te+V),j=U-$*Math.sin(te+V);L.beginPath(),L.moveTo(F,U),L.lineTo(re,le),L.lineTo(X,j),L.closePath(),L.fill()}if(r.arrowLeft){const re=te+Math.PI,le=B-$*Math.cos(re-V),X=S-$*Math.sin(re-V),j=B-$*Math.cos(re+V),oe=S-$*Math.sin(re+V);L.beginPath(),L.moveTo(B,S),L.lineTo(le,X),L.lineTo(j,oe),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,le=r.p2.rawTime,X=r.p1.price,j=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(j-X),ce=X!==0?Math.abs((j-X)/X*100):0,de=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(de)+" ("+ce.toFixed(2)+"%)")}const ae=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ce=o.timeScale().timeToCoordinate(le);if(se!=null&&ce!=null){const de=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ce);de!=null&&we!=null&&ae.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(le-re),ce=Math.floor(se/86400),de=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ce>0?ce+" day"+(ce!==1?"s":""):"";de>0&&(Qe+=(Qe?" ":"")+de+" hour"+(de!==1?"s":"")),!ce&&!de&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ae.length>0?ae[ae.length-1]+=" ("+Qe+")":ae.push(Qe)}if(r.statsDistance){const se=k/c,ce=R/u;ae.push("distance: "+Math.sqrt(se*se+ce*ce).toFixed(2))}if(ae.length>0&&oe.push(ae.join(", ")),r.statsAngle){const se=k/c,ce=R/u,de=Math.atan2(ce,se)*180/Math.PI;oe.push("∠ "+de.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ce=11*se,de=ce*1.5,we=5*se;L.font=ce+"px sans-serif";const Se=oe.reduce((ye,pe)=>Math.max(ye,L.measureText(pe).width),0)+we*2,Ce=oe.length*de+we*2,[Te,Ue,Ee,Ie]=B<=F?[B,S,F,U]:[F,U,B,S];let Ze,ze;r.statsPosition==="left"?(Ze=Te,ze=Ue):r.statsPosition==="center"?(Ze=(Te+Ee)/2,ze=(Ue+Ie)/2):(Ze=Ee,ze=Ie);const ve=Ze-Se/2,Ne=ze-Ce-12*se;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(ve,Ne,Se,Ce),L.strokeStyle=r.statsColor,L.lineWidth=1*se,L.strokeRect(ve,Ne,Se,Ce),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",oe.forEach((ye,pe)=>{L.fillText(ye,ve+we,Ne+we+pe*de)})}}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 Hv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft!==!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const B=Math.round(m*c),S=Math.round(v*u),F=Math.round(y*c),U=Math.round(T*u),k=F-B,R=U-S,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*u,L.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const le=S+z*(0-B);L.beginPath(),L.moveTo(0,le),L.lineTo(B,S),L.stroke()}if(r.rayRight){const re=s.bitmapSize.width,le=U+z*(re-F);L.beginPath(),L.moveTo(F,U),L.lineTo(re,le),L.stroke()}L.beginPath(),L.moveTo(B,S),L.lineTo(F,U),L.stroke();const te=Math.atan2(U-S,F-B),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(te-V),le=U-$*Math.sin(te-V),X=F-$*Math.cos(te+V),j=U-$*Math.sin(te+V);L.beginPath(),L.moveTo(F,U),L.lineTo(re,le),L.lineTo(X,j),L.closePath(),L.fill()}if(r.arrowLeft){const re=te+Math.PI,le=B-$*Math.cos(re-V),X=S-$*Math.sin(re-V),j=B-$*Math.cos(re+V),oe=S-$*Math.sin(re+V);L.beginPath(),L.moveTo(B,S),L.lineTo(le,X),L.lineTo(j,oe),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,le=r.p2.rawTime,X=r.p1.price,j=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(j-X),ce=X!==0?Math.abs((j-X)/X*100):0,de=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(de)+" ("+ce.toFixed(2)+"%)")}const ae=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),ce=o.timeScale().timeToCoordinate(le);if(se!=null&&ce!=null){const de=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(ce);de!=null&&we!=null&&ae.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(le-re),ce=Math.floor(se/86400),de=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let Qe=ce>0?ce+" day"+(ce!==1?"s":""):"";de>0&&(Qe+=(Qe?" ":"")+de+" hour"+(de!==1?"s":"")),!ce&&!de&&(Qe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ae.length>0?ae[ae.length-1]+=" ("+Qe+")":ae.push(Qe)}if(r.statsDistance){const se=k/c,ce=R/u;ae.push("distance: "+Math.sqrt(se*se+ce*ce).toFixed(2))}if(ae.length>0&&oe.push(ae.join(", ")),r.statsAngle){const se=k/c,ce=R/u,de=Math.atan2(ce,se)*180/Math.PI;oe.push("∠ "+de.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),ce=11*se,de=ce*1.5,we=5*se;L.font=ce+"px sans-serif";const Se=oe.reduce((ye,pe)=>Math.max(ye,L.measureText(pe).width),0)+we*2,Ce=oe.length*de+we*2,[Te,Ue,Ee,Ie]=B<=F?[B,S,F,U]:[F,U,B,S];let Ze,ze;r.statsPosition==="left"?(Ze=Te,ze=Ue):r.statsPosition==="center"?(Ze=(Te+Ee)/2,ze=(Ue+Ie)/2):(Ze=Ee,ze=Ie);const ve=Ze-Se/2,Ne=ze-Ce-12*se;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(ve,Ne,Se,Ce),L.strokeStyle=r.statsColor,L.lineWidth=1*se,L.strokeRect(ve,Ne,Se,Ce),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",oe.forEach((ye,pe)=>{L.fillText(ye,ve+we,Ne+we+pe*de)})}}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 Iv{constructor(e,t,A="#22c55e",r=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const u=n._chart,m=n._series;if(!u||!m)return;const y=o.horizontalPixelRatio,v=o.verticalPixelRatio,T=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),B=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),S=m.priceToCoordinate(n.p1.price),F=m.priceToCoordinate(n.p2.price);if(T==null||B==null||S==null||F==null)return;const U=T*y,k=S*v,R=B*y,L=F*v,[z,te,$,V]=U<=R?[U,k,R,L]:[R,L,U,k];let Ae=$-z,re=V-te;Math.abs(Ae)<1e-4&&(Ae=1e-4);const le=re/Ae,X=o.context;if(X.save(),X.strokeStyle=n.color,X.fillStyle=n.color,X.lineWidth=n.lineWidth*v,X.setLineDash([]),n.rayLeft){const ce=te+le*(0-z);X.beginPath(),X.moveTo(0,ce),X.lineTo(z,te),X.stroke()}if(n.rayRight){const se=o.bitmapSize.width,ce=V+le*(se-$);X.beginPath(),X.moveTo($,V),X.lineTo(se,ce),X.stroke()}const j=Math.atan2(re,Ae),oe=(n.lineWidth*4+4)*v,ae=Math.PI/7;if(n.arrowRight){const se=$-oe*Math.cos(j-ae),ce=V-oe*Math.sin(j-ae),de=$-oe*Math.cos(j+ae),we=V-oe*Math.sin(j+ae);X.beginPath(),X.moveTo($,V),X.lineTo(se,ce),X.lineTo(de,we),X.closePath(),X.fill()}if(n.arrowLeft){const se=j+Math.PI,ce=z-oe*Math.cos(se-ae),de=te-oe*Math.sin(se-ae),we=z-oe*Math.cos(se+ae),Qe=te-oe*Math.sin(se+ae);X.beginPath(),X.moveTo(z,te),X.lineTo(ce,de),X.lineTo(we,Qe),X.closePath(),X.fill()}if(c){const se=n.p1.rawTime??n.p1.time,ce=n.p2.rawTime??n.p2.time,de=n.p1.price,we=n.p2.price,Qe=[];if(n.statsPriceRange){const Ce=Math.abs(we-de),Te=de!==0?Math.abs((we-de)/de*100):0,Ue=Ce<1e-4?6:Ce<.01?5:Ce<1?4:2;Qe.push("↕ "+Ce.toFixed(Ue)+" ("+Te.toFixed(2)+"%)")}const Se=[];if(n.statsBarsRange)try{const Ce=u.timeScale().timeToCoordinate(se),Te=u.timeScale().timeToCoordinate(ce);if(Ce!=null&&Te!=null){const Ue=u.timeScale().coordinateToLogical(Ce),Ee=u.timeScale().coordinateToLogical(Te);Ue!=null&&Ee!=null&&Se.push("↔ "+Math.abs(Math.round(Ee-Ue))+" bars")}}catch{}if(n.statsDateRange){const Ce=Math.abs(ce-se),Te=Math.floor(Ce/86400),Ue=Math.floor(Ce%86400/3600),Ee=Math.floor(Ce%3600/60);let Ie=Te>0?Te+" day"+(Te!==1?"s":""):"";Ue>0&&(Ie+=(Ie?" ":"")+Ue+" hour"+(Ue!==1?"s":"")),!Te&&!Ue&&(Ie=Ee+" min"+(Ee!==1?"s":"")),n.statsBarsRange&&Se.length>0?Se[Se.length-1]+=" ("+Ie+")":Se.push(Ie)}if(n.statsDistance){const Ce=(R-U)/y,Te=(L-k)/v;Se.push("distance: "+Math.sqrt(Ce*Ce+Te*Te).toFixed(2))}if(Se.length>0&&Qe.push(Se.join(", ")),n.statsAngle){const Ce=Ae/y,Te=re/v,Ue=Math.atan2(Te,Ce)*180/Math.PI;Qe.push("∠ "+Ue.toFixed(0)+"°")}if(Qe.length>0){const Ce=Math.min(y,v),Te=11*Ce,Ue=Te*1.5,Ee=5*Ce;X.font=Te+"px sans-serif";const Ze=Qe.reduce((Pe,Je)=>Math.max(Pe,X.measureText(Je).width),0)+Ee*2,ze=Qe.length*Ue+Ee*2;let ve,Ne;n.statsPosition==="left"?(ve=z,Ne=te):n.statsPosition==="center"?(ve=(z+$)/2,Ne=(te+V)/2):(ve=$,Ne=V);const ye=ve-Ze/2,pe=Ne-ze-12*Ce;X.fillStyle="rgba(20, 20, 30, 0.72)",X.fillRect(ye,pe,Ze,ze),X.strokeStyle=n.statsColor,X.lineWidth=1*Ce,X.strokeRect(ye,pe,Ze,ze),X.fillStyle=n.statsColor,X.textBaseline="top",X.textAlign="left",Qe.forEach((Pe,Je)=>{X.fillText(Pe,ye+Ee,pe+Ee+Je*Ue)})}}X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Dv{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=s.timeScale().timeToCoordinate(A.center.rawTime),m=o.priceToCoordinate(A.center.price);if(u==null||m==null)return;const y=Math.round(u*l),v=Math.round(m*c),T=n.bitmapSize.width,B=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(y,0),S.lineTo(y,B),S.stroke(),A.showPrice){const F=A.center.price.toFixed(5),U=Math.round(11*c);S.font=U+"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),L=Math.round(3*c),z=U+2*L,te=k+2*R,$=T-te-Math.round(2*l),V=v-z/2;S.fillStyle=A.color,S.fillRect($,V,te,z),S.fillStyle="#ffffff",S.fillText(F,$+R,v)}if(A.showTime){const F=A.center.rawTime,U=new Date(F*1e3),k=X=>String(X).padStart(2,"0"),R=k(U.getUTCDate())+"."+k(U.getUTCMonth()+1)+"."+U.getUTCFullYear()+" "+k(U.getUTCHours())+":"+k(U.getUTCMinutes())+":"+k(U.getUTCSeconds()),L=Math.round(11*c);S.font=L+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="center";const z=S.measureText(R).width,te=Math.round(6*l),$=Math.round(3*c),V=L+2*$,Ae=z+2*te,re=y-Ae/2,le=B-V-Math.round(4*c);S.fillStyle=A.color,S.fillRect(re,le,Ae,V),S.fillStyle="#ffffff",S.fillText(R,y,le+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 _v{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const B=m*c,S=v*u,F=y*c,U=T*u,k=B-F,R=S-U,L=F-B,z=U-S;if(Math.hypot(k,R)<1e-4)return;const $=Math.atan2(R,k),V=Math.round(Math.abs($*180/Math.PI)),Ae=s.context;Ae.save(),Ae.strokeStyle=r.color,Ae.fillStyle=r.color,Ae.lineWidth=r.lineWidth*u,Ae.setLineDash([]);const re=Math.abs(L)<1e-4?0:z/L;if(r.rayLeft){const we=S+re*(0-B);Ae.beginPath(),Ae.moveTo(0,we),Ae.lineTo(B,S),Ae.stroke()}if(r.rayRight){const de=s.bitmapSize.width,we=U+re*(de-F);Ae.beginPath(),Ae.moveTo(F,U),Ae.lineTo(de,we),Ae.stroke()}Ae.beginPath(),Ae.moveTo(B,S),Ae.lineTo(F,U),Ae.stroke();const le=Math.atan2(z,L),X=(r.lineWidth*4+4)*u,j=Math.PI/7;if(r.arrowRight){const de=F-X*Math.cos(le-j),we=U-X*Math.sin(le-j),Qe=F-X*Math.cos(le+j),Se=U-X*Math.sin(le+j);Ae.beginPath(),Ae.moveTo(F,U),Ae.lineTo(de,we),Ae.lineTo(Qe,Se),Ae.closePath(),Ae.fill()}if(r.arrowLeft){const de=le+Math.PI,we=B-X*Math.cos(de-j),Qe=S-X*Math.sin(de-j),Se=B-X*Math.cos(de+j),Ce=S-X*Math.sin(de+j);Ae.beginPath(),Ae.moveTo(B,S),Ae.lineTo(we,Qe),Ae.lineTo(Se,Ce),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,U),Ae.lineTo(F+oe,U),Ae.stroke(),Ae.beginPath(),Ae.strokeStyle="rgba(122,166,174,0.45)",Ae.arc(F,U,oe,0,$,$<0),Ae.stroke(),Ae.fillStyle="#4b7c86",Ae.font=`${Math.round(10*u)}px sans-serif`,Ae.textAlign="left",Ae.textBaseline="middle";const ae=F+(oe+10*u)*Math.cos($/2),se=U+(oe+10*u)*Math.sin($/2);if(Ae.fillText(`${V}°`,ae,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const de=r.p1.price,we=r.p2.price,Qe=[];if(r.statsPriceRange){const Ce=Math.abs(we-de),Te=de!==0?Math.abs((we-de)/de*100):0,Ue=Ce<1e-4?6:Ce<.01?5:Ce<1?4:2;Qe.push("↕ "+Ce.toFixed(Ue)+" ("+Te.toFixed(2)+"%)")}const Se=[];if(r.statsDistance){const Ce=L/c,Te=z/u;Se.push("distance: "+Math.sqrt(Ce*Ce+Te*Te).toFixed(2))}if(Se.length>0&&Qe.push(Se.join(", ")),Qe.length>0){const Ce=Math.min(c,u),Te=11*Ce,Ue=Te*1.5,Ee=5*Ce;Ae.font=Te+"px sans-serif";const Ze=Qe.reduce((Ge,ke)=>Math.max(Ge,Ae.measureText(ke).width),0)+Ee*2,ze=Qe.length*Ue+Ee*2,[ve,Ne,ye,pe]=B<=F?[B,S,F,U]:[F,U,B,S];let Pe,Je;r.statsPosition==="left"?(Pe=ve,Je=Ne):r.statsPosition==="center"?(Pe=(ve+ye)/2,Je=(Ne+pe)/2):(Pe=ye,Je=pe);const it=Pe-Ze/2,rt=Je-ze-12*Ce;Ae.fillStyle="rgba(20, 20, 30, 0.72)",Ae.fillRect(it,rt,Ze,ze),Ae.strokeStyle=r.statsColor,Ae.lineWidth=1*Ce,Ae.strokeRect(it,rt,Ze,ze),Ae.fillStyle=r.statsColor,Ae.textBaseline="top",Ae.textAlign="left",Qe.forEach((Ge,ke)=>{Ae.fillText(Ge,it+Ee,rt+Ee+ke*Ue)})}}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 Pv{constructor(e,t,A){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),B=l.priceToCoordinate(r.p2.price),S=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(y==null||v==null||T==null||B==null||S==null||F==null)return;const U=y*c,k=v*u,R=T*c,L=B*u,z=S*c,te=F*u,$=(R+z)/2,V=(L+te)/2;let Ae=$-U,re=V-k;Math.abs(Ae)<1e-4&&(Ae=1e-4);const le=re/Ae,X=s.bitmapSize.width,j=(R-z)/2,oe=(L-te)/2,ae=Ce=>({x:$+j*Ce,y:V+oe*Ce}),se=(Ce,Te)=>({x:X,y:Te+le*(X-Ce)}),ce=ae(1),de=ae(-1),we=se(ce.x,ce.y),Qe=se(de.x,de.y);m.save(),m.beginPath(),m.moveTo(ce.x,ce.y),m.lineTo(we.x,we.y),m.lineTo(Qe.x,Qe.y),m.lineTo(de.x,de.y),m.closePath(),m.fillStyle="rgba(148, 163, 184, 0.2)",m.fill(),m.beginPath(),m.strokeStyle="rgba(148, 163, 184, 0.9)",m.lineWidth=1*u,m.moveTo(R,L),m.lineTo(z,te),m.stroke(),r._levels.forEach(Ce=>{const Te=ae(Ce.k),Ue=se(Te.x,Te.y);m.beginPath(),m.strokeStyle=Ce.color,m.lineWidth=Ce.width*u,m.moveTo(Te.x,Te.y),m.lineTo(Ue.x,Ue.y),m.stroke()});const Se=se(U,k);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*u,m.moveTo(U,k),m.lineTo(Se.x,Se.y),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class kv{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,m=s.timeScale().timeToCoordinate(A.p1.rawTime),y=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),T=o.priceToCoordinate(A.p2.price);if(m==null||y==null||v==null||T==null)return;const B=m*l,S=y*c,F=v*l,U=T*c,k=n.bitmapSize.width,R=Math.abs(F-B)<1e-4?1:F-B,L=(U-S)/R,z=F>=B?1:-1,te=z>0?k:0,$=B+z*Math.min(220*l,Math.max(80*l,k*.35)),V=A._rays.map(re=>{const le=L*re.ratio;return{...re,yEnd:S+le*(te-B),yLabel:S+le*($-B)}});u.save();const Ae=(re,le,X)=>{!re||!le||(u.beginPath(),u.moveTo(B,S),u.lineTo(te,re.yEnd),u.lineTo(te,le.yEnd),u.closePath(),u.fillStyle=X,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(B,S),u.lineTo(te,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 le=$+(z>0?4*l:-4*l),X=re.yLabel;X<-20||X>n.bitmapSize.height+20||u.fillText(re.label,le,X)}),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 Nv{constructor(e,t,A=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,A),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),B=l.priceToCoordinate(r.p2.price);if(y==null||v==null||T==null||B==null)return;const S=y*c,F=v*u,U=T*c,k=B*u,R=U-S,L=k-F,z=Math.hypot(R,L);if(z<1e-4)return;const te=R/z,$=L/z,V=-$,Ae=te,re=U+V*z,le=k+Ae*z,X=S+V*z,j=F+Ae*z,oe=(se,ce)=>({x:S+te*z*se+V*z*ce,y:F+$*z*se+Ae*z*ce});m.save();const ae=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let se=0;se<r.divisions;se++){const ce=se/r.divisions,de=(se+1)/r.divisions,we=oe(0,ce),Qe=oe(1,ce),Se=oe(1,de),Ce=oe(0,de);m.beginPath(),m.moveTo(we.x,we.y),m.lineTo(Qe.x,Qe.y),m.lineTo(Se.x,Se.y),m.lineTo(Ce.x,Ce.y),m.closePath(),m.fillStyle=ae[se%ae.length],m.fill()}m.lineWidth=1*u,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const ce=se/r.divisions,de=oe(0,ce),we=oe(1,ce),Qe=oe(ce,0),Se=oe(ce,1);m.beginPath(),m.moveTo(de.x,de.y),m.lineTo(we.x,we.y),m.stroke(),m.beginPath(),m.moveTo(Qe.x,Qe.y),m.lineTo(Se.x,Se.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*u,m.beginPath(),m.moveTo(S,F),m.lineTo(re,le),m.stroke(),m.beginPath(),m.moveTo(U,k),m.lineTo(X,j),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*u,m.beginPath(),m.moveTo(S,F),m.lineTo(U,k),m.lineTo(re,le),m.lineTo(X,j),m.closePath(),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class _a{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:m=!0,pricesColor:y="#129f5c",rayLeft:v=!1,rayRight:T=!1,arrowLeft:B=!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=m,this.pricesColor=y,this.rayLeft=v,this.rayRight=T,this.arrowLeft=B,this.arrowRight=S,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(U){U.useBitmapCoordinateSpace(k=>{if(!F.visible)return;const R=F._chart,L=F._series;if(!R||!L)return;const z=k.horizontalPixelRatio,te=k.verticalPixelRatio,$=[F.p1,F.p3,F.p4,F.p2].map(ze=>{const ve=R.timeScale().timeToCoordinate(ze.rawTime),Ne=L.priceToCoordinate(ze.price);return ve==null||Ne==null?null:{x:ve*z,y:Ne*te}}).filter(Boolean);if($.length!==4)return;const[V,Ae,re,le]=$,X=k.context;X.save();const j=Ae.x-V.x,oe=Ae.y-V.y,ae=Math.sqrt(j*j+oe*oe)||1,se=j/ae,ce=oe/ae,de=re.x-le.x,we=re.y-le.y,Qe=Math.sqrt(de*de+we*we)||1,Se=de/Qe,Ce=we/Qe,Te=1e5,Ue=F.rayLeft?{x:V.x-se*Te,y:V.y-ce*Te}:V,Ee=F.rayRight?{x:Ae.x+se*Te,y:Ae.y+ce*Te}:Ae,Ie=F.rayLeft?{x:le.x-Se*Te,y:le.y-Ce*Te}:le,Ze=F.rayRight?{x:re.x+Se*Te,y:re.y+Ce*Te}:re;if(F.showBackground){const ze=F.fillColor||"#6aa84f",ve=parseInt(ze.slice(1,3),16),Ne=parseInt(ze.slice(3,5),16),ye=parseInt(ze.slice(5,7),16);X.beginPath(),X.moveTo(V.x,V.y),X.lineTo(Ae.x,Ae.y),X.lineTo(re.x,re.y),X.lineTo(le.x,le.y),X.closePath(),X.fillStyle=`rgba(${ve},${Ne},${ye},${F.fillOpacity??.1})`,X.fill()}if(X.strokeStyle=F.lineColor,X.lineWidth=F.lineWidth*te,X.setLineDash([]),X.beginPath(),X.moveTo(Ue.x,Ue.y),X.lineTo(Ee.x,Ee.y),X.moveTo(Ie.x,Ie.y),X.lineTo(Ze.x,Ze.y),X.moveTo(V.x,V.y),X.lineTo(le.x,le.y),X.moveTo(Ae.x,Ae.y),X.lineTo(re.x,re.y),X.stroke(),F.arrowLeft||F.arrowRight){const ze=8*te,ve=(Ne,ye,pe)=>{X.save(),X.translate(Ne,ye),X.rotate(pe),X.beginPath(),X.moveTo(0,0),X.lineTo(-ze,-ze/2),X.lineTo(-ze,ze/2),X.closePath(),X.fillStyle=F.lineColor,X.fill(),X.restore()};F.arrowLeft&&(ve(Ue.x,Ue.y,Math.atan2(-ce,-se)),ve(Ie.x,Ie.y,Math.atan2(-Ce,-Se))),F.arrowRight&&(ve(Ee.x,Ee.y,Math.atan2(ce,se)),ve(Ze.x,Ze.y,Math.atan2(Ce,Se)))}if(X.fillStyle="#ffffff",X.strokeStyle="#3b82f6",X.lineWidth=2*te,[V,Ae,re,le].forEach(ze=>{X.beginPath(),X.arc(ze.x,ze.y,6*te,0,Math.PI*2),X.fill(),X.stroke()}),F.showPrices){const ze=[F.p1,F.p3,F.p2,F.p4],ve=[V,Ae,le,re];X.fillStyle=F.pricesColor||F.lineColor,X.font=`${Math.round(10*te)}px sans-serif`,X.textAlign="left",X.textBaseline="middle",ve.forEach((Ne,ye)=>{const pe=ze[ye]?.price;typeof pe=="number"&&X.fillText(pe.toFixed(5),Ne.x+8*z,Ne.y)})}X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class _d extends _a{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class Pd{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const u=o._chart,m=o._series;if(!u||!m)return;const y=c.horizontalPixelRatio,v=c.verticalPixelRatio,T=c.context,B=R=>{const L=u.timeScale().timeToCoordinate(R.rawTime),z=m.priceToCoordinate(R.price);return L==null||z==null?null:{x:L*y,y:z*v}},S=B(o.p1),F=B(o.p2),U=B(o.b2),k=B(o.b1);!S||!F||!U||!k||(T.save(),T.beginPath(),T.moveTo(S.x,S.y),T.lineTo(F.x,F.y),T.lineTo(U.x,U.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(U.x,U.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 Pa{constructor(e,t,A,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=r,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(u=>{if(!l.visible)return;const m=l._chart,y=l._series;if(!m||!y)return;const v=u.horizontalPixelRatio,T=u.verticalPixelRatio,B=u.context,S=$=>{const V=m.timeScale().timeToCoordinate($.rawTime),Ae=y.priceToCoordinate($.price);return V==null||Ae==null?null:{x:V*v,y:Ae*T}},F=S(l.mid1),U=S(l.mid2),k=S(l.top1),R=S(l.top2),L=S(l.bot1),z=S(l.bot2);if(!F||!U||!k||!R||!L||!z)return;B.save(),B.beginPath(),B.moveTo(F.x,F.y),B.lineTo(U.x,U.y),B.lineTo(R.x,R.y),B.lineTo(k.x,k.y),B.closePath(),B.fillStyle=l.upperFillColor,B.fill(),B.beginPath(),B.moveTo(L.x,L.y),B.lineTo(z.x,z.y),B.lineTo(U.x,U.y),B.lineTo(F.x,F.y),B.closePath(),B.fillStyle=l.lowerFillColor,B.fill();const te=($,V,Ae)=>{B.beginPath(),B.strokeStyle=Ae,B.lineWidth=l.lineWidth*T,B.setLineDash([]),B.moveTo($.x,$.y),B.lineTo(V.x,V.y),B.stroke()};if(te(k,R,l.upperStrokeColor),te(F,U,l.centerStrokeColor),te(L,z,l.lowerStrokeColor),l.showDeviationLabel){const $=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite($)?$.toFixed(5):null;if(V){const Ae=Math.max(10,Math.round(10*T));B.fillStyle=l.labelColor,B.font=`${Ae}px sans-serif`,B.textAlign="left",B.textBaseline="top",B.fillText(V,L.x+2*v,L.y+10*T)}}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 kd extends Pa{}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,m=n.bitmapSize.width;n.bitmapSize.height;const y=A.p1.price,v=A.p2.price,T=y-v,B=$=>v+T*$,S=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),U=o.priceToCoordinate(y),k=o.priceToCoordinate(v),R=S!=null&&F!=null?Math.round(Math.min(S,F)*l):0,L=S!=null&&F!=null?Math.round(Math.max(S,F)*l):m,z=L-R;u.save(),A._zoneFills.forEach(({from:$,to:V,color:Ae})=>{const re=B($),le=B(V),X=o.priceToCoordinate(re),j=o.priceToCoordinate(le);if(X==null||j==null)return;const oe=Math.round(X*c),ae=Math.round(j*c);u.fillStyle=Ae,u.fillRect(R,Math.min(oe,ae),z,Math.abs(ae-oe))}),A._levels.forEach(({ratio:$,label:V})=>{const Ae=B($),re=o.priceToCoordinate(Ae);if(re==null)return;const le=Math.round(re*c),X=A._levelColors[$]||"#888888";u.beginPath(),u.strokeStyle=X,u.lineWidth=$===0||$===1?1.5*c:1*c,$!==0&&$!==1&&$<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(R,le),u.lineTo(L,le),u.stroke(),u.setLineDash([])});const te=Math.round(11*c);if(u.font=`${te}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:$,label:V})=>{const Ae=B($),re=o.priceToCoordinate(Ae);if(re==null)return;const le=Math.round(re*c),X=A._levelColors[$]||"#888888",j=`${V} (${Ae.toFixed(5)})`;u.fillStyle=X,u.textAlign="right",u.fillText(j,R-4*l,le-4*c)}),S!=null&&F!=null&&U!=null&&k!=null){const $=Math.round(S*l),V=Math.round(U*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($,V),u.lineTo(Ae,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc($,V,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(Ae,re,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke()}u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ov{constructor(e,t="#3b82f6",A=2,r=!0){this.time=e,this.color=t,this.lineWidth=A,this.showDate=r,this.showDot=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const u=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,y=o.context;y.save(),y.beginPath(),y.strokeStyle=n.color,y.lineWidth=n.lineWidth*o.horizontalPixelRatio,y.setLineDash([]),y.moveTo(u,0),y.lineTo(u,m),y.stroke();const v=Math.round(m/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){y.beginPath(),y.strokeStyle=n.color,y.lineWidth=1.5*o.horizontalPixelRatio;const T=5*o.horizontalPixelRatio;y.arc(u,v,T,0,Math.PI*2),y.stroke()}if(n.showDate!==!1){const T=n.time,B=new Date(typeof T=="number"?T*1e3:T),S=Ae=>String(Ae).padStart(2,"0"),F=`${S(B.getUTCDate())}.${S(B.getUTCMonth()+1)}.${B.getUTCFullYear()} ${S(B.getUTCHours())}:${S(B.getUTCMinutes())}:${S(B.getUTCSeconds())}`,U=Math.round(11*o.verticalPixelRatio);y.font=`${U}px ui-sans-serif, system-ui, sans-serif`,y.textBaseline="middle",y.textAlign="center";const k=y.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),L=Math.round(3*o.verticalPixelRatio),z=U+2*L,te=k+2*R,$=u-te/2,V=m-z-Math.round(4*o.verticalPixelRatio);y.fillStyle=n.color,y.fillRect($,V,te,z),y.fillStyle="#ffffff",y.fillText(F,u,V+z/2)}y.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Od(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 Kv(i,e,t){const A=`${i??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let u=c;for(;u.length>s;){let m=u.lastIndexOf(" ",s);m<=0&&(m=s),o.push(u.slice(0,m)),u=u.slice(m).trimStart()}o.push(u)};return A.split(`
11
- `).forEach(l),o.length===0&&o.push(""),o}function Kd(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=Kv(A.text??i?.text??"Text",r,n),o=s.reduce((T,B)=>Math.max(T,B.length),1),c=Math.max(20,o*r*.58)+16,u=r*1.2,m=s.length*u+10,y=e-c/2,v=t-m;return{left:y,right:y+c,top:v,bottom:v+m+12}}class Vv{constructor(e,t,A={}){this.rawTime=e,this.price=t,this.text=A.text??"Text",this.color=A.color??"#5f8f96",this.fontSize=A.fontSize??12,this.fontWeight=A.fontWeight??"normal",this.fontStyle=A.fontStyle??"normal",this.textAlign=A.textAlign??"center",this.textWrap=A.textWrap??!1,this.borderEnabled=A.borderEnabled??!1,this.borderColor=A.borderColor??"#5f8f96",this.borderOpacity=A.borderOpacity??.1,this.borderWidth=A.borderWidth??1,this.bgEnabled=A.bgEnabled??!1,this.bgColor=A.bgColor??"#5f8f96",this.bgOpacity=A.bgOpacity??.1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=o.timeScale().timeToCoordinate(r.rawTime),u=l.priceToCoordinate(r.price);if(c==null||u==null)return;const m=s.horizontalPixelRatio,y=s.verticalPixelRatio,v=Math.round(c*m),T=Math.round(u*y),B=s.context;B.save();const S=Math.round(r.fontSize*y);B.font=`${r.fontStyle} ${r.fontWeight} ${S}px sans-serif`;const F=`${r.text??""}`,U=220*m,k=[],R=ce=>{if(!r.textWrap||ce.length===0){k.push(ce);return}const de=ce.split(/\s+/);let we="";for(const Qe of de){const Se=we?`${we} ${Qe}`:Qe;B.measureText(Se).width<=U||!we?we=Se:(k.push(we),we=Qe)}k.push(we)};F.split(`
12
- `).forEach(R),k.length===0&&k.push("");const L=k.map(ce=>B.measureText(ce).width),z=Math.max(...L,20*m),te=8*m,$=5*y,V=z+te*2,Ae=S*1.2,re=Ae*k.length+$*2,le=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",X=v-V/2,j=T-re;r.bgEnabled&&(B.fillStyle=Od(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),B.beginPath(),B.rect(X,j,V,re),B.fill()),r.borderEnabled&&(B.strokeStyle=Od(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),B.lineWidth=Math.max(.5,(r.borderWidth??1)*y),B.beginPath(),B.rect(X,j,V,re),B.stroke()),B.fillStyle=r.color,B.textAlign=le,B.textBaseline="middle";const oe=le==="left"?X+te:le==="right"?X+V-te:X+V/2;for(let ce=0;ce<k.length;ce++)B.fillText(k[ce],oe,j+$+Ae*(ce+.5));const ae=5*y,se=T+10*y;B.beginPath(),B.strokeStyle="#3b82f6",B.lineWidth=1.5*y,B.arc(v,se,ae,0,Math.PI*2),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]}}const zv={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Vd(i){if(!i)return 7;const e=String(i).toUpperCase();return zv[e]??7}function Wv(i,e){const t=String(i||"").toUpperCase(),A=e||Vd(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 UA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:q(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 nt(i,e,t,A,r,n){const s=r-t,o=n-A,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/(l*l);c=Math.max(0,Math.min(1,c));const u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Rv(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/l;c<0&&(c=0);const u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Gv(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);const c=((i-t)*s+(e-A)*o)/l,u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function YA(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 zd(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??q(i.rawTime),r=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(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=q((A+r)/2),m=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:m}}}function Ni(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map($=>({time:q($.time),close:typeof $.close=="number"?$.close:parseFloat($.close)})).filter($=>$.time!=null&&Number.isFinite($.close)&&$.time>=s&&$.time<=o).sort(($,V)=>$.time-V.time);if(l.length<2)return null;const c=l.length;let u=0,m=0,y=0,v=0;for(let $=0;$<c;$++){const V=$,Ae=l[$].close;u+=V,m+=Ae,y+=V*Ae,v+=V*V}const T=c*v-u*u,B=Math.abs(T)<1e-12?0:(c*y-u*m)/T,S=(m-B*u)/c;let F=0;for(let $=0;$<c;$++){const V=S+B*$,Ae=l[$].close-V;F+=Ae*Ae}const U=Math.sqrt(F/c),k=Math.max(U*A,1e-8),R=l[0].time,L=l[c-1].time,z=S,te=S+B*(c-1);return{slope:B,intercept:S,stdDev:U,offset:k,barCount:c,p1:{rawTime:R,normalizedTime:R,price:z},p2:{rawTime:L,normalizedTime:L,price:te},top1:{rawTime:R,normalizedTime:R,price:z+k},top2:{rawTime:L,normalizedTime:L,price:te+k},bot1:{rawTime:R,normalizedTime:R,price:z-k},bot2:{rawTime:L,normalizedTime:L,price:te-k}}}function Sr(i,e,t,A=1){return Ni(i,e,t,A)}const $v={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}},Xv={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 Zv(i,e){if(!i||!i.type)return!1;const t=$v[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function Jv(i){return i?Xv[i]??"#22c55e":"#22c55e"}const Yv=300,Wd=24,qv=150,Rd=150;function ka(i,e,t=Yv){if(!Array.isArray(i)||i.length===0)return[];const A=tA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=q(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 jv(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=q(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function eT(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 ys(i,e,t,A){const r=q(e),n=q(t),s=tA(A)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(i)||i.length===0)return l;if(r==null||n==null)return 1;const c=y=>{const v=eT(i,y);if(v<=0)return 0;if(v>=i.length)return i.length-1;const T=i[v-1],B=i[v];return Math.abs(y-T)<=Math.abs(B-y)?v-1:v},u=c(r),m=c(n);return Math.max(1,Math.abs(m-u)+1)}function Gd(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=jv(e);if(r==null)return!1;const n=A.timeToCoordinate(r);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const u=A.getVisibleLogicalRange(),m=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,y=Number.isFinite(m)&&m>20?m:120,v=Math.min(Rd,y/2),T=Math.max(20,y-v),B={from:c-T,to:c+v};try{return A.setVisibleLogicalRange(B),!0}catch{}}}const s=tA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-qv*o,to:r+Rd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const tT=ie.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=ie.useRef(null),l=ie.useRef(null),c=ie.useRef(null),u=ie.useRef(null),m=ie.useRef(null),y=ie.useRef(null),v=ie.useRef([]),T=ie.useRef(!1),B=ie.useRef(null),S=ie.useRef(null),F=ie.useRef(null),U=ie.useRef(null),k=ie.useRef([]),[R,L]=ie.useState(null),[z,te]=ie.useState(null),[$,V]=ie.useState([]),[Ae,re]=ie.useState(null),[le,X]=ie.useState([]),j=ie.useRef(null),oe=ie.useRef(null),ae=ie.useRef(null),se=ie.useRef(!1),ce=ie.useRef(!1);ie.useEffect(()=>{ae.current=R;let p=!1;v.current.forEach(g=>{if(g.type==="trendline"&&g.decoration){const O=g===R;g.decoration.isSelected!==O&&(g.decoration.isSelected=O,p=!0)}}),p&&c.current?.applyOptions({})},[R]);const de=ie.useRef(new Map),we=ie.useRef(null),Qe=ie.useRef(null),Se=(p,g)=>`${p}_${g}`,Ce=()=>{const p=Se(ye,pe);return de.current.get(p)||null},Te=p=>{if(!p)return;const g=Se(ye,pe);de.current.set(g,p)},{activeTool:Ue,setActiveTool:Ee,showGrid:Ie,snapToGrid:Ze,chartObjects:ze,setChartObjects:ve,orders:Ne,selectedSymbol:ye,selectedTimeframe:pe,drawingsVisible:Pe,chartType:Je,chartLocked:it,theme:rt,baseUrl:Ge,endpoints:ke,endpointParams:me}=Lt(),ge=ie.useRef([]),[He,_e]=ie.useState(!1),[Fe,Ke]=ie.useState(null),[Ve,at]=ie.useState([]),[Bt,It]=ie.useState(!0),[Ir,vs]=ie.useState(null),[gi,Ts]=ie.useState(0),Dt=ie.useMemo(()=>{const p=Ve.map(g=>q(g?.time)).filter(g=>Number.isFinite(g));return p.sort((g,O)=>g-O),p},[Ve]),mt=ie.useRef(null),St=ie.useRef(new Map);ie.useRef(null);const jt=ie.useRef(0),qA=ie.useRef(null),Dr=ie.useRef(!1);ie.useEffect(()=>{const p=m.current;p&&p.setData(ka(Ve,pe))},[Ve,pe]),ie.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const O=g.to-g.from,be=(g.from+g.to)/2,H=O*.8;try{p.setVisibleRange({from:be-H/2,to:be+H/2}),Te(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const O=g.to-g.from,be=(g.from+g.to)/2,H=O*1.25;try{p.setVisibleRange({from:be-H/2,to:be+H/2}),Te(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const g=p.querySelectorAll("canvas"),O=rt==="light"?"#ffffff":"#12161d";let be=null,H=0;if(g.forEach(Z=>{if(Z.width>0&&Z.height>0){const Y=Z.width*Z.height;Y>H&&(H=Y,be=Z)}}),be)try{const Z=document.createElement("canvas");Z.width=be.width,Z.height=be.height;const Y=Z.getContext("2d");Y.fillStyle=O,Y.fillRect(0,0,Z.width,Z.height),Y.drawImage(be,0,0);const ne=document.createElement("a");ne.download=`chart-${ye}-${pe}-${Date.now()}.png`,ne.href=Z.toDataURL("image/png"),ne.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(Z){console.warn("Canvas export failed, trying html2canvas",Z)}vv(p,{useCORS:!0,allowTaint:!0,backgroundColor:O,scale:2,logging:!1}).then(Z=>{const Y=document.createElement("a");Y.download=`chart-${ye}-${pe}-${Date.now()}.png`,Y.href=Z.toDataURL("image/png"),Y.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(Z=>{console.error("Chart screenshot failed",Z),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,pe,rt]);const Ka=ie.useMemo(()=>Ve.length===0?[]:Je==="line"||Je==="area"?Ve.map(p=>({time:p.time,value:p.close})):Ve,[Ve,Je]),xT=p=>{r?r(p):(Ke("BUY"),_e(!0))},bT=p=>{n?n(p):(Ke("SELL"),_e(!0))},QT=()=>{_e(!1),Ke(null)},FT=p=>{const g=z;if(!g||!p)return;const O=(Z,Y)=>{if(typeof Z!="string")return Y;const ne=Z.trim(),he=ne.startsWith("#")?ne:`#${ne}`;return/^#[0-9A-Fa-f]{6}$/.test(he)?he.toLowerCase():Y},be=(Z,Y)=>{const ne=Number(Z);return Number.isFinite(ne)?Math.max(0,Math.min(1,ne)):Y};let H={...g,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:g.visibleTimeframes};if(g.type==="text"){const Z=Number.isFinite(Number(p.price))?Number(p.price):g.price,Y=g.primitive;Y&&(Y.text=typeof p.text=="string"?p.text:Y.text,Y.color=O(p.color,Y.color??"#5f8f96"),Y.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):Y.fontSize,Y.fontWeight=p.fontWeight==="bold"?"bold":"normal",Y.fontStyle=p.fontStyle==="italic"?"italic":"normal",Y.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:Y.textAlign,Y.textWrap=!!p.textWrap,Y.borderEnabled=!!p.borderEnabled,Y.borderColor=O(p.borderColor,Y.borderColor??"#5f8f96"),Y.borderOpacity=be(p.borderOpacity,Y.borderOpacity??.1),Y.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),Y.bgEnabled=!!p.bgEnabled,Y.bgColor=O(p.bgColor,Y.bgColor??"#5f8f96"),Y.bgOpacity=be(p.bgOpacity,Y.bgOpacity??.1),Y.price=Z),H={...H,price:Z,text:typeof p.text=="string"?p.text:g.text}}if(g.type==="trendline"){const Z=O(p.lineColor,"#22c55e"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(g.series)try{g.series.applyOptions({color:Z,lineWidth:Y})}catch{}const ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.point1?.price,he=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.point2?.price;if(g.series&&g.point1&&g.point2){const J=g.point1.time??g.point1.rawTime,C=g.point2.time??g.point2.rawTime;try{const h=UA([{time:J,value:ne},{time:C,value:he}]);h.length>0&&g.series.setData(h)}catch{}}const M={...g.point1,price:ne},N={...g.point2,price:he};g.decoration&&(g.decoration.color=Z,g.decoration.lineWidth=Y,g.decoration.arrowLeft=!!p.arrowLeft,g.decoration.arrowRight=!!p.arrowRight,g.decoration.rayLeft=!!p.rayLeft,g.decoration.rayRight=!!p.rayRight,g.decoration.statsColor=O(p.statsColor,"#5f8f96"),g.decoration.statsPosition=p.statsPosition??"right",g.decoration.statsShowAlways=!!p.statsShowAlways,g.decoration.statsPriceRange=!!p.statsPriceRange,g.decoration.statsBarsRange=!!p.statsBarsRange,g.decoration.statsDateRange=!!p.statsDateRange,g.decoration.statsAngle=!!p.statsAngle,g.decoration.statsDistance=!!p.statsDistance,g.decoration.p1=M,g.decoration.p2=N),H={...H,lineColor:Z,lineWidth:Y,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:M,point2:N,decoration:g.decoration}}if(g.type==="pricelevel"){const Z=O(p.lineColor,"#3b82f6"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,he=!!p.showText,M=typeof p.textContent=="string"?p.textContent:"",N=O(p.textColor,"#ffffff"),J=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",C=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price;if(g.priceLine)try{g.priceLine.applyOptions({price:h,color:Z,lineWidth:Y,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const b=u.current;if(he&&M&&b)if(g.textPrimitive)g.textPrimitive.text=M,g.textPrimitive.textColor=N,g.textPrimitive.hAlign=J,g.textPrimitive.vAlign=C,g.textPrimitive.price=h;else{const I=new Hd(h,{text:M,textColor:N,hAlign:J,vAlign:C});try{b.attachPrimitive(I)}catch{}g.textPrimitive=I}else if(g.textPrimitive&&b){try{b.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:Z,lineWidth:Y,showPrice:ne,showText:he,textContent:M,textColor:N,textHAlign:J,textVAlign:C,textPrimitive:g.textPrimitive}}if(g.type==="horizontalray"){const Z=O(p.lineColor,"#3b82f6"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,he=!!p.showText,M=typeof p.textContent=="string"?p.textContent:"",N=O(p.textColor,"#ffffff"),J=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",C=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price,b=g.primitive;if(b&&(b.price=h,b.color=Z,b.lineWidth=Y),g.priceLine)try{g.priceLine.applyOptions({price:h,color:Z,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(he&&M&&I)if(g.textPrimitive)g.textPrimitive.text=M,g.textPrimitive.textColor=N,g.textPrimitive.hAlign=J,g.textPrimitive.vAlign=C,g.textPrimitive.price=h,g.textPrimitive.originTime=g.rawOriginTime;else{const w=new Hd(h,{text:M,textColor:N,hAlign:J,vAlign:C,originTime:g.rawOriginTime});try{I.attachPrimitive(w)}catch{}g.textPrimitive=w}else if(g.textPrimitive&&I){try{I.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:Z,lineWidth:Y,showPrice:ne,showText:he,textContent:M,textColor:N,textHAlign:J,textVAlign:C,textPrimitive:g.textPrimitive}}if(g.type==="verticalline"){const Z=O(p.lineColor,"#3b82f6"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showDate!==!1,he=g.primitive;he&&(he.color=Z,he.lineWidth=Y,he.showDate=ne),H={...H,lineColor:Z,lineWidth:Y,showDate:ne}}if(g.type==="infoline"){const Z=O(p.lineColor,"#3b82f6"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.statsShowAlways!==!1,he=O(p.statsColor,"#5f8f96"),M=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,J=!!p.statsBarsRange,C=!!p.statsDateRange,h=!!p.statsAngle,b=!!p.statsDistance,I=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,d=g.p1.rawTime,_=g.p2.rawTime,Q=w-I,E=I!==0?Q/Math.abs(I)*100:0,x=g.p1.normalizedTime??0,f=g.p2.normalizedTime??0,D=tA(pe)||3600,P=Math.abs(f-x),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=c.current,ee=u.current,ue=G?G.timeScale().timeToCoordinate(d):null,Be=ee?ee.priceToCoordinate(I):null,xe=G?G.timeScale().timeToCoordinate(_):null,Me=ee?ee.priceToCoordinate(w):null,$e=ue!=null&&Be!=null&&xe!=null&&Me!=null?Math.atan2(-(Me-Be),xe-ue)*(180/Math.PI):g.primitive?.info?.angle??0,qe={priceDiff:Q,pricePct:E,bars:K,days:W,angle:$e},Re=g.primitive;Re&&(Re.color=Z,Re.lineWidth=Y,Re.statsShowAlways=ne,Re.statsColor=he,Re.statsPosition=M,Re.statsPriceRange=N,Re.statsBarsRange=J,Re.statsDateRange=C,Re.statsAngle=h,Re.statsDistance=b,Re.p1={...g.p1,price:I},Re.p2={...g.p2,price:w},Re.info=qe),H={...H,lineColor:Z,lineWidth:Y,statsShowAlways:ne,statsColor:he,statsPosition:M,statsPriceRange:N,statsBarsRange:J,statsDateRange:C,statsAngle:h,statsDistance:b,p1:{...g.p1,price:I},p2:{...g.p2,price:w}}}if(g.type==="rulerline"){const Z=O(p.lineColor,"#3b82f6"),Y=p.showArea!==!1,ne=!!p.statsShowAlways,he=O(p.statsColor,"#5f8f96"),M=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",N=!!p.statsPriceRange,J=!!p.statsBarsRange,C=!!p.statsDateRange,h=g.primitive;h&&(h.lineColor=Z,h.showArea=Y,h.statsShowAlways=ne,h.statsColor=he,h.statsPosition=M,h.statsPriceRange=N,h.statsBarsRange=J,h.statsDateRange=C),H={...H,lineColor:Z,showArea:Y,statsShowAlways:ne,statsColor:he,statsPosition:M,statsPriceRange:N,statsBarsRange:J,statsDateRange:C}}if(g.type==="arrowedline"){const Z=O(p.lineColor,"#f59e0b"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,he=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,M=g.primitive;M&&(M.color=Z,M.lineWidth=Y,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=O(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsBarsRange=!!p.statsBarsRange,M.statsDateRange=!!p.statsDateRange,M.statsAngle=!!p.statsAngle,M.statsDistance=!!p.statsDistance,M.p1={...g.p1,price:ne},M.p2={...g.p2,price:he}),H={...H,lineColor:Z,lineWidth:Y,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:{...g.p1,price:ne},p2:{...g.p2,price:he}}}if(g.type==="rayline"){const Z=O(p.lineColor,"#7aa6ae"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,he=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,M=g.primitive;M&&(M.color=Z,M.lineWidth=Y,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=O(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsBarsRange=!!p.statsBarsRange,M.statsDateRange=!!p.statsDateRange,M.statsAngle=!!p.statsAngle,M.statsDistance=!!p.statsDistance,M.p1={...g.p1,price:ne},M.p2={...g.p2,price:he}),H={...H,lineColor:Z,lineWidth:Y,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:{...g.p1,price:ne},p2:{...g.p2,price:he}}}if(g.type==="extendedline"){const Z=O(p.lineColor,"#7aa6ae"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,he=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,M=g.primitive;M&&(M.color=Z,M.lineWidth=Y,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=O(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsBarsRange=!!p.statsBarsRange,M.statsDateRange=!!p.statsDateRange,M.statsAngle=!!p.statsAngle,M.statsDistance=!!p.statsDistance,M.p1={...g.p1,price:ne},M.p2={...g.p2,price:he}),H={...H,lineColor:Z,lineWidth:Y,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:{...g.p1,price:ne},p2:{...g.p2,price:he}}}if(g.type==="crossline"){const Z=O(p.lineColor,"#06a0e3"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.price))?Number(p.price):g.p.price,he=g.primitive;he&&(he.color=Z,he.lineWidth=Y,he.showTime=!!p.showTime,he.showPrice=!!p.showPrice,he.center={...g.p,price:ne}),H={...H,lineColor:Z,lineWidth:Y,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...g.p,price:ne}}}if(g.type==="trendbyangle"){const Z=O(p.lineColor,"#7aa6ae"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,he=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,M=g.primitive;M&&(M.color=Z,M.lineWidth=Y,M.arrowLeft=!!p.arrowLeft,M.arrowRight=!!p.arrowRight,M.rayLeft=!!p.rayLeft,M.rayRight=!!p.rayRight,M.statsShowAlways=!!p.statsShowAlways,M.statsColor=O(p.statsColor,"#5f8f96"),M.statsPosition=p.statsPosition??"right",M.statsPriceRange=!!p.statsPriceRange,M.statsDistance=!!p.statsDistance,M.p1={...g.p1,price:ne},M.p2={...g.p2,price:he}),H={...H,lineColor:Z,lineWidth:Y,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:{...g.p1,price:ne},p2:{...g.p2,price:he}}}if(g.type==="disjointchannel"){const Z=O(p.lineColor,"#129f5c"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=O(p.fillColor,"#6aa84f"),he=be(p.fillOpacity,.1),M=O(p.pricesColor,"#129f5c"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,J=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,C=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=Z,h.lineWidth=Y,h.fillColor=ne,h.fillOpacity=he,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=M,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:N},h.p3={...g.p3,price:J},h.p2={...g.p2,price:C}),H={...H,lineColor:Z,lineWidth:Y,fillColor:ne,fillOpacity:he,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:M,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:N},p3:{...g.p3,price:J},p2:{...g.p2,price:C}}}if(g.type==="flattopbottom"){const Z=O(p.lineColor,"#3b82f6"),Y=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=O(p.fillColor,"#3b82f6"),he=be(p.fillOpacity,.12),M=O(p.pricesColor,"#3b82f6"),N=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,J=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,C=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=Z,h.lineWidth=Y,h.fillColor=ne,h.fillOpacity=he,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=M,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:N},h.p3={...g.p3,price:J},h.p2={...g.p2,price:C}),H={...H,lineColor:Z,lineWidth:Y,fillColor:ne,fillOpacity:he,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:M,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:N},p3:{...g.p3,price:J},p2:{...g.p2,price:C}}}ve(Z=>{const Y=Z.map(ne=>ne===g?H:ne);return v.current=Y,Y}),ae.current===g&&(ae.current=H),L(Z=>Z===g?H:Z),re(Z=>Z===g?H:Z),te(H);try{c.current?.applyOptions({})}catch{}};ie.useEffect(()=>{const p=o.current;if(!p)return;const g=p.getBoundingClientRect(),O=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},be=rt==="light",H=z0(p,{width:g.width||p.clientWidth,height:g.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:be?"#FFFFFF":"#0d1117",type:"solid"},textColor:be?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ie,color:Ie?be?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0},horzLines:{visible:Ie,color:Ie?be?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0}},rightPriceScale:{borderColor:be?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:be?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:be?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:Ue===1?1:0,vertLine:{width:1,color:be?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:be?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:be?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:be?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Ue===1,horzLineVisible:Ue===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Ue===null||Ue===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}}),Z=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),Y=Z.includes("JPY"),ne=Pr(Z),he=_r(Z);let M,N;Y?(M=.001,N=w=>Math.abs(Number(w)).toFixed(3)):ne?Z.startsWith("BTC")||Z.startsWith("ETH")?(M=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(M=1e-4,N=w=>Math.abs(Number(w)).toFixed(4)):he&&(Z.startsWith("XAU")||Z.startsWith("XAG"))?(M=.01,N=w=>Math.abs(Number(w)).toFixed(2)):(M=1e-4,N=w=>Math.abs(Number(w)).toFixed(5));const J=H.addCandlestickSeries({upColor:be?"#089981":"#26a69a",downColor:be?"#f23645":"#ef5350",wickUpColor:be?"#089981":"#26a69a",wickDownColor:be?"#f23645":"#ef5350",borderUpColor:be?"#089981":"#26a69a",borderDownColor:be?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:M,formatter:N}}),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=J,m.current=C,C.setData(ka(Ve,pe)),requestAnimationFrame(()=>{if(p&&H){const w=p.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),b=()=>{if(ce.current&&St.current.size>0){const w=h.getVisibleRange();w&&Te(w)}};h.subscribeVisibleTimeRangeChange(b);const I=new ResizeObserver(w=>{for(const d of w){const{width:_,height:Q}=d.contentRect;if(_>0&&Q>0&&H){const E=h.getVisibleRange();H.resize(_,Q),E&&setTimeout(()=>{try{h.setVisibleRange(E)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(b),I.disconnect(),H.remove(),c.current=null,u.current=null,m.current=null,y.current=null,v.current=[],qA.current&&clearTimeout(qA.current)}},[]),ie.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ie,color:Ie?"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0},horzLines:{visible:Ie,color:Ie?"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0}}})},[Ie]),ie.useEffect(()=>{const p=c.current;if(!p)return;const g=rt==="light";p.applyOptions({layout:{background:{color:g?"#FFFFFF":"#12161d"},textColor:g?"#020617":"#fff"},grid:{vertLines:{color:Ie?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ie?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:g?"#e5e7eb":"#1e293b"},timeScale:{borderColor:g?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1},horzLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1}}})},[rt,Ie]),ie.useEffect(()=>{if(!c.current)return;const g=!it&&!(Ue!==null&&Ue!==1&&Ue!==0),O=!it;c.current.applyOptions({crosshair:{mode:Ue===1?1:0,vertLine:{visible:Ue===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Ue===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:g,horzTouchDrag:g,vertTouchDrag:g},handleScale:{axisPressedMouseMove:{time:g,price:g},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:g,price:g},mouseWheel:O,pinch:O}})},[Ue,it]);const UT=()=>{const p=u.current;v.current.forEach(g=>{if(g.primitive){try{p&&p.detachPrimitive(g.primitive)}catch{}if(g.series&&g.series!==p)try{g.series.detachPrimitive(g.primitive)}catch{}}if(g.priceLine&&p)try{p.removePriceLine(g.priceLine)}catch{}if(g.textPrimitive&&p)try{p.detachPrimitive(g.textPrimitive)}catch{}}),v.current=[],ve([]),Ee(null)},jd=(p,g=!1)=>{p&&v.current.forEach(O=>{if(O.primitive){try{p.detachPrimitive(O.primitive)}catch{}try{p.attachPrimitive(O.primitive)}catch{}}if(g&&O.type==="pricelevel"&&O.priceLine)try{const be=O.showPrice!==!1,H=p.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:be,title:be&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}if(g&&O.type==="horizontalray"&&O.priceLine)try{const be=O.showPrice!==!1,H=p.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:be,title:be&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=H}catch{}})};ie.useEffect(()=>{(async()=>{if(!ye||!pe){at([]),ce.current=!1;return}try{if(It(!0),vs(null),at([]),ce.current=!1,Dr.current=!1,Qe.current!==null&&Qe.current!==ye&&UT(),Qe.current=ye,u.current)try{u.current.setData([])}catch{}const g=Vd(pe),O=Wv(pe,g),be=Ge||bv?.VITE_BASE_URL||"http://localhost:5002",H=ke?.candles||"/api/chart/candles",Z=me?.candles||{},Y={symbol:Z.symbol||"symbol",timeframe:Z.timeframe||"timeframe",limit:Z.limit||"limit",daysBack:Z.daysBack||"daysBack"},ne={};ne[Y.symbol]=ye,ne[Y.timeframe]=pe,ne[Y.limit]=O,Z.daysBack!==!1&&(ne[Y.daysBack]=g);const he=await ut.get(`${be}${H}`,{params:ne,timeout:1e4});let M=[];if(Array.isArray(he.data)?M=he.data:he.data&&he.data.data&&Array.isArray(he.data.data)?M=he.data.data:he.data&&Array.isArray(he.data)&&(M=he.data),M&&M.length>0){const{candles:N,stats:J}=Xa(M,ye,pe);N.length>0?(at(N),St.current=new Map,N.forEach(C=>{St.current.set(C.time,C)}),Dr.current=!0,mt.current?.connected&&ye&&pe&&mt.current.emit("subscribeCandles",{symbol:ye,timeframe:pe})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),at([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),at([])}catch(g){console.error(`❌ Error fetching ${ye}:`,g.message);const O=g.code==="ECONNABORTED"||g.message&&g.message.includes("timeout");vs(O?"Request timed out. No data available for this symbol.":g.message||"Failed to load candles."),at([]),It(!1)}})()},[ye,pe,gi]),ie.useEffect(()=>{mt.current=vn.getSocket();const p=mt.current,g=()=>{if(Dr.current&&ye&&pe&&p.connected){const ne={symbol:ye,timeframe:pe};p.emit("subscribeCandles",ne)}},O=()=>{setTimeout(()=>{ye&&pe&&g()},200)},be=ne=>{},H=ne=>{};p.on("connect",O),p.on("disconnect",be),p.on("connect_error",H),p.on("subscription:confirmed",ne=>{ne.type});const Z=ne=>{if(!Dr.current||!ne||!ne.candle||!ne.symbol)return;const he=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(he(ne.symbol)!==he(ye)||ne.timeframe&&ne.timeframe!==pe)return;const{candle:M}=ne,N=Za(M,ye,pe);if(!N)return;const J=Date.now();if(J-jt.current<200)return;jt.current=J;const C=c.current?.timeScale(),h=C?.getVisibleRange(),b=u.current,I=c.current;if(!(!b||!I||!ce.current&&!Dr.current||b?.seriesType?.()!==(Je==="line"?"Line":Je==="area"?"Area":Je==="bars"?"Bar":"Candlestick")))try{const _=St.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;St.current.set(N.time,E),Q&&m.current&&m.current.setData(ka(Array.from(St.current.values()),pe));try{Je==="line"||Je==="area"?b.update({time:E.time,value:E.close}):b.update(E),C&&h&&Te(h)}catch(x){throw x}}catch{}};p.on("candleUpdate",Z);const Y=()=>{p.connected&&ye&&pe&&g()};if(p.connected)Y();else{const ne=()=>{setTimeout(Y,200)};p.once("connect",ne),setTimeout(()=>{p.connected&&Y()},500)}return()=>{p.off("candleUpdate",Z),p.off("connect",O),p.off("disconnect",be),p.off("connect_error",H),p.off("subscription:confirmed"),ye&&pe&&p.connected&&p.emit("unsubscribeCandles",{symbol:ye,timeframe:pe})}},[ye,pe,Ge]),ie.useEffect(()=>{const p=u.current,g=c.current;if(!p||!g){It(!1);return}if(!(Ve.length===0&&ce.current)){if(Ve.length===0&&!ce.current){if(Bt)return;const O=g.timeScale();p.setData([]),O.fitContent(),qA.current&&clearTimeout(qA.current),qA.current=setTimeout(()=>requestAnimationFrame(()=>It(!1)),400);return}if(!ce.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),be=O.includes("JPY"),H=_r(O),Z=Pr(O);let Y,ne;be?(Y=.001,ne=h=>Math.abs(Number(h)).toFixed(3)):Z?O.startsWith("BTC")||O.startsWith("ETH")?(Y=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(Y=1e-4,ne=h=>Math.abs(Number(h)).toFixed(4)):H&&(O.startsWith("XAU")||O.startsWith("XAG"))?(Y=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(Y=1e-4,ne=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:Y,formatter:ne}})}catch{}const he=g.timeScale(),M=Se(ye,pe);we.current,we.current=M;const N=[...Ve].sort((h,b)=>h.time-b.time);if(Je==="line"||Je==="area"){const h=N?.map(b=>({time:b.time,value:b.close})).filter(b=>b.time!=null);h.length>0&&p.setData(h)}else N?.length>0&&p.setData(N);jd(p);const J=tA(pe)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,E=We(Q,J);h.primitive.originTime=E,h.originTime=E;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,E=We(Q,J);h.primitive.time=E,h.time=q(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,f=N.length>0?N[N.length-1].time:null,D=W=>{const G=We(W,J);return x==null||f==null?G:Math.min(Math.max(G,x),f)},P=D(Q),K=D(E);h.p1.rawTime=P,h.p1.normalizedTime=q(P),h.p2.rawTime=K,h.p2.normalizedTime=q(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,f=N.length>0?N[N.length-1].time:null,D=ue=>{const Be=We(ue,J);return x==null||f==null?Be:Math.min(Math.max(Be,x),f)},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 W=q(P),G=q(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:ys(Dt,P,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,E=h.p2.rawTime,x=We(Q,J),f=We(E,J);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,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=We(Q,J),f=We(E,J);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,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=We(Q,J),f=We(E,J);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,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=We(Q,J),f=We(E,J);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=E=>{const x=We(E.rawTime,J);E.rawTime=x,E.normalizedTime=q(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=We(E.rawTime,J);E.rawTime=x,E.normalizedTime=q(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=Ni(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=Sr(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=We(h.p1.rawTime,J),E=We(h.p2.rawTime,J),x=We(h.p3.rawTime,J);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=E,h.p2.normalizedTime=q(E),h.p3.rawTime=x,h.p3.normalizedTime=q(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=We(h.p1.rawTime,J),E=We(h.p2.rawTime,J);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=E,h.p2.normalizedTime=q(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=We(h.p1.rawTime,J),E=We(h.p2.rawTime,J);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=E,h.p2.normalizedTime=q(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=We(h.p1.rawTime,J),E=We(h.p2.rawTime,J),x=We(h.p3.rawTime,J);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=E,h.p2.normalizedTime=q(E),h.p3.rawTime=x,h.p3.normalizedTime=q(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=We(h.p1.rawTime,J),E=We(h.p2.rawTime,J);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=E,h.p2.normalizedTime=q(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 b=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=We(b,J),d=We(I,J);h.point1.time=w,h.point2.time=d;const _=UA([{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,b=tA(pe)||60,w=h-(pe==="M1"?150:pe==="M5"?120:100)*b;try{he.setVisibleRange({from:w,to:h+b*Wd})}catch{he.fitContent()}}else he.fitContent();try{g.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ce.current=!0;const C=he.getVisibleRange();Te(C),qA.current&&clearTimeout(qA.current),qA.current=setTimeout(()=>requestAnimationFrame(()=>It(!1)),400)}}},[Ve.length,Je,ye,pe]),ie.useEffect(()=>{const p=c.current;if(!p||!ce.current||Ve.length===0)return;const g=p.timeScale(),O=g.getVisibleRange()||Ce();if(u.current)try{p.removeSeries(u.current)}catch{}if(y.current)try{p.removeSeries(y.current),y.current=null}catch{}let be;const H=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),Z=H.includes("JPY"),Y=_r(H),ne=Pr(H);let he,M;Z?(he=.001,M=C=>Math.abs(Number(C)).toFixed(3)):ne?H.startsWith("BTC")||H.startsWith("ETH")?(he=.01,M=C=>Math.abs(Number(C)).toFixed(2)):(he=1e-4,M=C=>Math.abs(Number(C)).toFixed(4)):Y&&(H.startsWith("XAU")||H.startsWith("XAG"))?(he=.01,M=C=>Math.abs(Number(C)).toFixed(2)):(he=1e-4,M=C=>Math.abs(Number(C)).toFixed(5));const N={type:"custom",minMove:he,formatter:M};if(Je==="bars"){const C=rt==="light";be=p.addBarSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const h=[...Ve].sort((b,I)=>b.time-I.time);h?.length>0&&be.setData(h)}else if(Je==="line"){be=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:N,scaleMargins:{top:.1,bottom:.1}});const C=UA(Ka);C.length>0&&be.setData(C)}else if(Je==="area"){be=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 C=UA(Ka);C.length>0&&be.setData(C)}else if(Je==="volume ticks"||Je==="volume"){const C=rt==="light";be=p.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:N,priceScaleId:"right"});const h=[...Ve].sort((w,d)=>w.time-d.time);h?.length>0&&be.setData(h);const b=p.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),p.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const I=h?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));I.length>0&&b.setData(I),y.current=b}else{const C=rt==="light";be=p.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:N,scaleMargins:{top:.1,bottom:.1}});const h=[...Ve].sort((b,I)=>b.time-I.time);h?.length>0&&be.setData(h)}u.current=be,jd(be,!0);const J=tA(pe)||60;if(v.current.forEach(C=>{if(C.type==="horizontalray"&&C.primitive){const E=C.rawOriginTime??C.primitive.originTime,x=We(E,J);C.primitive.originTime=x,C.originTime=x;return}if(C.type==="verticalline"&&C.primitive){const E=C.rawTime??C.primitive.time,x=We(E,J);C.primitive.time=x,C.time=q(x);return}if(C.type==="infoline"&&C.primitive&&C.p1&&C.p2){const E=C.rawP1Time??C.p1.rawTime,x=C.rawP2Time??C.p2.rawTime,f=[...Ve].sort((ee,ue)=>ee.time-ue.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,K=ee=>{const ue=We(ee,J);return D==null||P==null?ue:Math.min(Math.max(ue,D),P)},W=K(E),G=K(x);C.p1.rawTime=W,C.p1.normalizedTime=q(W),C.p2.rawTime=G,C.p2.normalizedTime=q(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 E=C.rawP1Time??C.p1.rawTime,x=C.rawP2Time??C.p2.rawTime,f=[...Ve].sort((xe,Me)=>xe.time-Me.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,K=xe=>{const Me=We(xe,J);return D==null||P==null?Me:Math.min(Math.max(Me,D),P)},W=K(E),G=K(x);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=q(W),ue=q(G),Be=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:ys(Dt,W,G,pe),days:Math.max(1,Math.round(Be/86400))};return}if(C.type==="arrowedline"&&C.primitive&&C.p1&&C.p2){const E=C.p1.rawTime,x=C.p2.rawTime,f=We(E,J),D=We(x,J);C.p1.rawTime=f,C.p1.normalizedTime=q(f),C.p2.rawTime=D,C.p2.normalizedTime=q(D),C.primitive.p1={rawTime:f,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 E=C.p1.rawTime,x=C.p2.rawTime,f=We(E,J),D=We(x,J);C.p1.rawTime=f,C.p1.normalizedTime=q(f),C.p2.rawTime=D,C.p2.normalizedTime=q(D),C.primitive.p1={rawTime:f,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 E=C.p1.rawTime,x=C.p2.rawTime,f=We(E,J),D=We(x,J);C.p1.rawTime=f,C.p1.normalizedTime=q(f),C.p2.rawTime=D,C.p2.normalizedTime=q(D),C.primitive.p1={rawTime:f,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 E=C.p1.rawTime,x=C.p2.rawTime,f=We(E,J),D=We(x,J);C.p1.rawTime=f,C.p1.normalizedTime=q(f),C.p2.rawTime=D,C.p2.normalizedTime=q(D),C.primitive.p1={rawTime:f,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 E=x=>{const f=We(x.rawTime,J);x.rawTime=f,x.normalizedTime=q(f)};E(C.p1),E(C.p2),E(C.p3),E(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 E=x=>{const f=We(x.rawTime,J);x.rawTime=f,x.normalizedTime=q(f)};E(C.p1),E(C.p2),E(C.p3),E(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 E=[...Ve].sort((D,P)=>D.time-P.time),x=Ni(E,C.p1,C.p2,C.stdMultiplier??1);if(!x)return;const f=C.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},C.p1=x.p1,C.p2=x.p2,C.top1=x.top1,C.top2=x.top2,C.bot1=x.bot1,C.bot2=x.bot2,C.slope=x.slope,C.intercept=x.intercept,C.stdDev=x.stdDev,C.offset=x.offset,C.barCount=x.barCount;return}if(C.type==="stddevchannel"&&C.primitive&&C.p1&&C.p2){const E=[...Ve].sort((D,P)=>D.time-P.time),x=Sr(E,C.p1,C.p2,C.stdMultiplier??1);if(!x)return;const f=C.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},C.p1=x.p1,C.p2=x.p2,C.top1=x.top1,C.top2=x.top2,C.bot1=x.bot1,C.bot2=x.bot2,C.slope=x.slope,C.stdDev=x.stdDev,C.offset=x.offset,C.barCount=x.barCount;return}if(C.type==="andrewspitchfork"&&C.primitive&&C.p1&&C.p2&&C.p3){const E=We(C.p1.rawTime,J),x=We(C.p2.rawTime,J),f=We(C.p3.rawTime,J);C.p1.rawTime=E,C.p1.normalizedTime=q(E),C.p2.rawTime=x,C.p2.normalizedTime=q(x),C.p3.rawTime=f,C.p3.normalizedTime=q(f),C.primitive.p1={rawTime:E,price:C.p1.price},C.primitive.p2={rawTime:x,price:C.p2.price},C.primitive.p3={rawTime:f,price:C.p3.price};return}if((C.type==="gannfan"||C.type==="ganngrid")&&C.primitive&&C.p1&&C.p2){const E=We(C.p1.rawTime,J),x=We(C.p2.rawTime,J);C.p1.rawTime=E,C.p1.normalizedTime=q(E),C.p2.rawTime=x,C.p2.normalizedTime=q(x),C.primitive.p1={rawTime:E,price:C.p1.price},C.primitive.p2={rawTime:x,price:C.p2.price};return}if((C.type==="circle"||C.type==="ellipse")&&C.primitive&&C.p1&&C.p2){const E=We(C.p1.rawTime,J),x=We(C.p2.rawTime,J);C.p1.rawTime=E,C.p1.normalizedTime=q(E),C.p2.rawTime=x,C.p2.normalizedTime=q(x),C.primitive.p1={rawTime:E,price:C.p1.price},C.primitive.p2={rawTime:x,price:C.p2.price};return}if(C.type==="triangle"&&C.primitive&&C.p1&&C.p2&&C.p3){const E=We(C.p1.rawTime,J),x=We(C.p2.rawTime,J),f=We(C.p3.rawTime,J);C.p1.rawTime=E,C.p1.normalizedTime=q(E),C.p2.rawTime=x,C.p2.normalizedTime=q(x),C.p3.rawTime=f,C.p3.normalizedTime=q(f),C.primitive.p1={rawTime:E,price:C.p1.price},C.primitive.p2={rawTime:x,price:C.p2.price},C.primitive.p3={rawTime:f,price:C.p3.price};return}if((C.type==="fibonacci"||C.type==="rectangle")&&C.primitive&&C.p1&&C.p2){const E=We(C.p1.rawTime,J),x=We(C.p2.rawTime,J);C.p1.rawTime=E,C.p1.normalizedTime=q(E),C.p2.rawTime=x,C.p2.normalizedTime=q(x),C.primitive.p1={rawTime:E,price:C.p1.price},C.primitive.p2={rawTime:x,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{p.removeSeries(C.series)}catch{}const b=p.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,d=We(I,J),_=We(w,J);C.point1.time=d,C.point2.time=_;const Q=UA([{time:d,value:C.point1.price},{time:_,value:C.point2.price}]);try{Q.length>0&&b.setData(Q)}catch{}if(C.decoration)try{b.attachPrimitive(C.decoration)}catch{}C.series=b}),O&&ce.current)setTimeout(()=>{try{g.setVisibleRange(O),Te(O)}catch{if(Ve.length>0)try{const h=Ve[Ve.length-1].time,b=tA(pe)||60,I=h-100*b;g.setVisibleRange({from:I,to:h+b*Wd}),Te(g.getVisibleRange())}catch{g.fitContent(),Te(g.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!ce.current){g.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ce.current=!0,Te(g.getVisibleRange())}},[Je,Ve.length,Ka.length,ye]),ie.useEffect(()=>{const p=c.current,g=y.current;if(!p||!g||!ce.current||Ve.length===0||Je!=="volume"&&Je!=="volume ticks")return;const be=[...Ve].sort((H,Z)=>H.time-Z.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)"}));be.length>0&&g.setData(be)},[Ve,Je]),ie.useEffect(()=>{const p=c.current,g=u.current,O=o.current;if(!p||!g||!O)return;const H=Ue!==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"][Ue]:null,Z=(M,N)=>{const J=Math.min(M.time,N.time),C=Math.max(M.time,N.time),h=M.time<=N.time?M.rawTime:N.rawTime,b=M.time<=N.time?N.rawTime:M.rawTime,I=Math.max(M.price,N.price),w=Math.min(M.price,N.price),d=q(Math.round((J+C)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:J,price:w},p3:{rawTime:b,normalizedTime:C,price:w}}};if(!H){if(T.current=!1,B.current=null,S.current=null,U.current=null,F.current?.series)try{p.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const d={type:"pricelevel",priceLine:g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};ve(_=>[..._,d]),v.current.push(d),Ee(null)};return O.addEventListener("click",M),()=>{O.removeEventListener("click",M)}}if(H==="horizontalray"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Qv(I,b);g.attachPrimitive(w);const d=g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),_=q(b),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:_,rawOriginTime:b,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};ve(E=>[...E,Q]),v.current.push(Q),Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="verticalline"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=p.timeScale().coordinateToTime(C);if(h==null)return;const b=new Ov(h);g.attachPrimitive(b);const I=q(h),w={type:"verticalline",primitive:b,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};ve(d=>[...d,w]),v.current.push(w),Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="text"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Vv(b,I);g.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:b,price:I,text:"Text"};ve(_=>[..._,d]),v.current.push(d),Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="infoline"){let M=null,N=null;const J=h=>{if(!M)return;const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;N||(N=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=M.normalizedTime,E=q(d);if(Q==null||E==null||Q===E)return;const x=Q<=E?[{time:Q,value:M.price},{time:E,value:_}]:[{time:E,value:_},{time:Q,value:M.price}];try{N.setData(x)}catch{}},C=h=>{const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!M){M={rawTime:d,price:_,normalizedTime:q(d),x:I,y:w};return}if(N){try{p.removeSeries(N)}catch{}N=null}const Q=M.normalizedTime,E=q(d);if(Q==null||E==null)return;const x=_-M.price,f=x/Math.abs(M.price)*100,D=tA(pe)||3600,P=Math.abs(E-Q),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=M.x,ee=M.y,ue=I,xe=Math.atan2(-(w-ee),ue-G)*(180/Math.PI),Me={priceDiff:x,pricePct:f,bars:K,days:W,angle:xe},$e=new Fv({rawTime:M.rawTime,price:M.price},{rawTime:d,price:_},Me);g.attachPrimitive($e);const qe={type:"infoline",primitive:$e,rawP1Time:M.rawTime,rawP2Time:d,p1:{rawTime:M.rawTime,normalizedTime:Q,price:M.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};ve(Re=>[...Re,qe]),v.current.push(qe),M=null,Ee(null)};return O.addEventListener("mousemove",J),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",J),O.removeEventListener("click",C),N)try{p.removeSeries(N)}catch{}}}if(H==="rulerline"){let M=null,N=null;const J=(b,I,w,d)=>{const _=q(b),Q=q(w),E=d-I,x=E/Math.abs(I)*100,f=ys(Dt,b,w,pe),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:E,pricePct:x,bars:f,days:P}},C=b=>{if(!M)return;const I=O.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const E=q(_);if(E==null||E===M.normalizedTime)return;const x=J(M.rawTime,M.price,_,Q);if(!N)N=new Id({rawTime:M.rawTime,price:M.price},{rawTime:_,price:Q},x),g.attachPrimitive(N);else{N.p2={rawTime:_,price:Q},N.info=x;const f=Q>=M.price;N.color=f?"#3b82f6":"#ef5350",N.fillColor=f?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=b=>{const I=O.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;if(!M){M={rawTime:_,price:Q,normalizedTime:q(_)};return}if(N){try{g.detachPrimitive(N)}catch{}N=null}const E=M.normalizedTime,x=q(_);if(E==null||x==null)return;const f=J(M.rawTime,M.price,_,Q),D=new Id({rawTime:M.rawTime,price:M.price},{rawTime:_,price:Q},f);g.attachPrimitive(D);const P={type:"rulerline",primitive:D,rawP1Time:M.rawTime,rawP2Time:_,p1:{rawTime:M.rawTime,normalizedTime:E,price:M.price},p2:{rawTime:_,normalizedTime:x,price:Q},lineColor:Q>=M.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};ve(K=>[...K,P]),v.current.push(P),M=null,Ee(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",h),N)try{g.detachPrimitive(N)}catch{}}}if(H==="arrowedline"){let M=null,N=null;const J=h=>{if(!M)return;const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;const Q=q(d);if(!(Q==null||Q===M.normalizedTime))if(!N)N=new Dd({rawTime:M.rawTime,price:M.price},{rawTime:d,price:_}),g.attachPrimitive(N);else{N.p2={rawTime:d,price:_};try{c.current?.applyOptions({})}catch{}}},C=h=>{const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!M){M={rawTime:d,price:_,normalizedTime:q(d)};return}if(N){try{g.detachPrimitive(N)}catch{}N=null}const Q=M.normalizedTime,E=q(d);if(Q==null||E==null||Q===E)return;const x=new Dd({rawTime:M.rawTime,price:M.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"arrowedline",primitive:x,p1:{rawTime:M.rawTime,normalizedTime:Q,price:M.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};ve(D=>[...D,f]),v.current.push(f),M=null,Ee(null)};return O.addEventListener("mousemove",J),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",J),O.removeEventListener("click",C),N)try{g.detachPrimitive(N)}catch{}}}if(H==="rayline"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=C+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const E=new Mv({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(E);const x={type:"rayline",primitive:E,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};ve(f=>[...f,x]),v.current.push(x),Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="extendedline"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=C+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const E=new Hv({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(E);const x={type:"extendedline",primitive:E,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};ve(f=>[...f,x]),v.current.push(x),Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="crossline"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d=new Dv({rawTime:b,price:I});g.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:b,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};ve(Q=>[...Q,_]),v.current.push(_),Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="trendbyangle"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=C+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const E=new _v({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(E);const x={type:"trendbyangle",primitive:E,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};ve(f=>[...f,x]),v.current.push(x),Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="disjointchannel"){let M=null,N=null,J=null,C=null,h=0,b=null;const I=(_,Q,E,x)=>{if(!b)b=new _a(_,Q,E,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=E,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!M)return;const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:f},I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const f=p.timeScale().coordinateToTime(E),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P==null)return;const K=(M.price+N.price)/2;D>=K?(J={rawTime:f,normalizedTime:P,price:D},C={rawTime:f,normalizedTime:P,price:2*K-D}):(C={rawTime:f,normalizedTime:P,price:D},J={rawTime:f,normalizedTime:P,price:2*K-D}),I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:J.rawTime,price:J.price},{rawTime:C.rawTime,price:C.price})}},d=_=>{const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(E),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P!=null){if(h===0){M={rawTime:f,normalizedTime:P,price:D},N={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const K=g.coordinateToPrice(x);if(K==null||Math.abs(K-M.price)<1e-7)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:K},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const K=new _a(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:M,p2:N,p3:{rawTime:b.p3.rawTime,normalizedTime:q(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:q(b.p4.rawTime),price:b.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};ve(G=>[...G,W]),v.current.push(W),Ee(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",d),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="flattopbottom"){let M=null,N=null,J=null,C=null,h=0,b=null;const I=(_,Q,E,x)=>{if(!b)b=new _d(_,Q,E,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=E,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!M)return;const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:f},I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===2&&N){const f=p.timeScale().coordinateToTime(E),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P==null)return;J={rawTime:f,normalizedTime:P,price:D},C={rawTime:f,normalizedTime:P,price:N.price},I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:J.rawTime,price:J.price},{rawTime:C.rawTime,price:C.price})}},d=_=>{const Q=O.getBoundingClientRect(),E=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(E),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P!=null){if(h===0){M={rawTime:f,normalizedTime:P,price:D},N={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price},{rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.price});return}if(h===1){const K=g.coordinateToPrice(x);if(K==null||Math.abs(K-M.price)<1e-7)return;N={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:K},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const K=new _d(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:M,p2:N,p3:{rawTime:b.p3.rawTime,normalizedTime:q(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:q(b.p4.rawTime),price:b.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};ve(G=>[...G,W]),v.current.push(W),Ee(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",d),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="regressionchannel"){let M=null,N=null;const J=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},C=b=>{if(!M)return;const I=O.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const E=q(_);if(E==null)return;const f=Ni(Ve,M,{rawTime:_,normalizedTime:E},1);if(f)if(!N)N=new Pa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(N);else{J(N,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=O.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const E=q(_);if(E==null)return;if(!M){M={rawTime:_,normalizedTime:E,price:Q};return}const f=Ni(Ve,M,{rawTime:_,normalizedTime:E},1);if(!f)return;if(N){try{g.detachPrimitive(N)}catch{}N=null}const D=new Pa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,intercept:f.intercept,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};ve(K=>[...K,P]),v.current.push(P),M=null,Ee(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",h),N)try{g.detachPrimitive(N)}catch{}}}if(H==="stddevchannel"){let M=null,N=null;const J=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},C=b=>{if(!M)return;const I=O.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const E=q(_);if(E==null)return;const f=Sr(Ve,M,{rawTime:_,normalizedTime:E},1);if(f)if(!N)N=new kd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(N);else{J(N,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=O.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const E=q(_);if(E==null)return;if(!M){M={rawTime:_,normalizedTime:E,price:Q};return}const f=Sr(Ve,M,{rawTime:_,normalizedTime:E},1);if(!f)return;if(N){try{g.detachPrimitive(N)}catch{}N=null}const D=new kd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};ve(K=>[...K,P]),v.current.push(P),M=null,Ee(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",h),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",h),N)try{g.detachPrimitive(N)}catch{}}}if(H==="andrewspitchfork"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d=C+140,_=p.timeScale().coordinateToTime(d);if(_==null)return;const Q=q(_);if(Q==null)return;const E={rawTime:b,normalizedTime:w,price:I},x={rawTime:_,normalizedTime:Q,price:I},f={rawTime:b,normalizedTime:w,price:I},D=new Pv({rawTime:E.rawTime,price:E.price},{rawTime:x.rawTime,price:x.price},{rawTime:f.rawTime,price:f.price});g.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:E,p2:x,p3:f};ve(K=>[...K,P]),v.current.push(P),L(P),ae.current=P,Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="gannfan"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new kv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const E={type:"gannfan",primitive:Q,p1:d,p2:_};ve(x=>[...x,E]),v.current.push(E),L(E),ae.current=E,Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="ganngrid"){const M=N=>{const J=O.getBoundingClientRect(),C=N.clientX-J.left,h=N.clientY-J.top,b=p.timeScale().coordinateToTime(C),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new Nv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const E={type:"ganngrid",primitive:Q,p1:d,p2:_};ve(x=>[...x,E]),v.current.push(E),L(E),ae.current=E,Ee(null)};return O.addEventListener("click",M),()=>O.removeEventListener("click",M)}if(H==="trendline"||H==="gannline"){const M=H,N=M==="gannline"?"#7aa6ae":"#22c55e",J=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=g.coordinateToPrice(_);if(!(Q==null||E==null)&&(Q=q(Q),Q!=null))if(U.current===null){U.current={time:Q,price:E};const x=p.addLineSeries({color:N,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:M,series:x},x.setData([{time:Q,value:E}])}else{const x=U.current,f={time:Q,price:E},D=1,P=1e-5,K=Math.abs(f.time-x.time),W=Math.abs(f.price-x.price);if(K<D&&W<P){try{p.removeSeries(F.current.series)}catch{}U.current=null,F.current=null;return}const G={time:x.time,rawTime:x.time,price:x.price},ee={time:f.time,rawTime:f.time,price:f.price},ue=UA([{time:G.time,value:G.price},{time:ee.time,value:ee.price}]);if(ue.length>0){F.current.series.setData(ue);const Be=new Iv(G,ee,N,2);try{F.current.series.attachPrimitive(Be)}catch{}const xe={type:M,series:F.current.series,point1:G,point2:ee,decoration:Be};ve(Me=>[...Me,xe]),v.current.push(xe)}Ee(null),U.current=null,F.current=null}},C=I=>{if(U.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=g.coordinateToPrice(_);if(Q==null||E==null||(Q=q(Q),Q==null))return;const x=U.current,f=UA([{time:x.time,value:x.price},{time:Q,value:E}]);f.length>0&&F.current.series.setData(f)},h=I=>{I.stopPropagation()},b={capture:!0,passive:!1};return O.addEventListener("click",J,b),O.addEventListener("mousemove",C,b),O.addEventListener("mousemove",h,b),()=>{if(U.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",J,b),O.removeEventListener("mousemove",C,b),O.removeEventListener("mousemove",h,b)}}if(H==="parallellines"){let M=null,N=null,J=null,C=0,h=null;const b=(E,x,f,D)=>{E.p1={rawTime:x.rawTime,price:x.price},E.p2={rawTime:f.rawTime,price:f.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,f)=>{const D=zd(E,x,f);if(!D)return null;if(!h)h=new Pd({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}),g.attachPrimitive(h);else{b(h,E,x,D);try{p.applyOptions({})}catch{}}return D},w=E=>{E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const x=O.getBoundingClientRect(),f=E.clientX-x.left,D=E.clientY-x.top,P=p.timeScale().coordinateToTime(f),K=g.coordinateToPrice(D);if(P==null||K==null)return;const W=q(P);if(W!=null){if(C===0){M={rawTime:P,normalizedTime:W,price:K},C=1;return}if(C===1){if(N={rawTime:P,normalizedTime:W,price:K},Math.abs(N.normalizedTime-M.normalizedTime)<1)return;const G=q((M.normalizedTime+N.normalizedTime)/2);if(G==null)return;const ee=(M.price+N.price)/2;J={rawTime:G,normalizedTime:G,price:ee},I(M,N,J),C=2;return}if(C===2&&M&&N){J={rawTime:P,normalizedTime:W,price:K};const G=I(M,N,J);if(!G||!h)return;try{g.detachPrimitive(h)}catch{}const ee=new Pd({rawTime:M.rawTime,price:M.price},{rawTime:N.rawTime,price:N.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});g.attachPrimitive(ee);const ue={type:"equidistantchannel",primitive:ee,p1:M,p2:N,p3:G.bottomMid,b1:G.b1,b2:G.b2,bottomMid:G.bottomMid};ve(Be=>[...Be,ue]),v.current.push(ue),Ee(null),C=0,M=null,N=null,J=null,h=null}}},d=E=>{if(C===0||!M)return;const x=O.getBoundingClientRect(),f=E.clientX-x.left,D=E.clientY-x.top,P=p.timeScale().coordinateToTime(f),K=g.coordinateToPrice(D);if(P==null||K==null)return;const W=q(P);if(W!=null){if(C===1){const G={rawTime:P,normalizedTime:W,price:K},ee=q((M.normalizedTime+G.normalizedTime)/2);if(ee==null)return;const ue=(M.price+G.price)/2;I(M,G,{rawTime:ee,normalizedTime:ee,price:ue});return}C===2&&N&&I(M,N,{rawTime:P,normalizedTime:W,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(C=0,M=null,N=null,J=null,k.current=[],h)try{g.detachPrimitive(h)}catch{}h=null,O.removeEventListener("click",w,Q),O.removeEventListener("mousemove",d,Q),O.removeEventListener("mousemove",_,Q)}}if(H==="fibonacci"){let M=null,N=null;const J=h=>{if(!M)return;const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(!(d==null||_==null))if(!N)N=new Nd({rawTime:M.rawTime,price:M.price},{rawTime:d,price:_}),g.attachPrimitive(N);else{N.p2={rawTime:d,price:_};try{p.applyOptions({})}catch{}}},C=h=>{const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!M){M={rawTime:d,price:_,normalizedTime:q(d)};return}if(N){try{g.detachPrimitive(N)}catch{}N=null}const Q=M.normalizedTime,E=q(d);if(Q==null||E==null)return;if(Math.abs(_-M.price)<1e-5){M=null;return}const x=new Nd({rawTime:M.rawTime,price:M.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"fibonacci",primitive:x,p1:{rawTime:M.rawTime,normalizedTime:Q,price:M.price},p2:{rawTime:d,normalizedTime:E,price:_}};ve(D=>[...D,f]),v.current.push(f),M=null,Ee(null)};return O.addEventListener("mousemove",J),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",J),O.removeEventListener("click",C),N)try{g.detachPrimitive(N)}catch{}}}if(U.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}const Y=M=>{if(M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const N=O.getBoundingClientRect(),J=M.clientX-N.left,C=M.clientY-N.top;let h=p.timeScale().coordinateToTime(J);const b=g.coordinateToPrice(C);if(h==null||b==null)return;const I=h;if(h=q(h),h!=null){if(T.current=!0,B.current={time:h,normalizedTime:h,rawTime:I,price:b},S.current=null,H==="rectangle"){const w=new Uv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new Sv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1});g.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new Ev({rawTime:I,price:b},{rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new Lv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});g.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}}}},ne=M=>{if(!T.current||!B.current||!F.current)return;M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation();const N=O.getBoundingClientRect(),J=M.clientX-N.left,C=M.clientY-N.top;let h=p.timeScale().coordinateToTime(J);const b=g.coordinateToPrice(C);if(h==null||b==null)return;const I=h;if(h=q(h),h==null)return;S.current={time:h,normalizedTime:h,rawTime:I,price:b};const w=B.current;if(F.current.type==="rectangle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const d=F.current.primitive,_=Z(w,{time:h,rawTime:I,price:b});if(!_)return;d.p1={rawTime:_.p1.rawTime,price:_.p1.price},d.p2={rawTime:_.p2.rawTime,price:_.p2.price},d.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const d=F.current.firstLine;d.endTime-d.startTime;const _=d.endPrice-d.startPrice,Q=b,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:b}])},he=M=>{if(M&&(M.preventDefault(),M.stopPropagation()),!T.current||!F.current||!B.current)return;const N=B.current,J=S.current||N;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};ve(h=>[...h,C]),v.current.push(C),Ee(null),F.current=null,T.current=!1,B.current=null,S.current=null;return}else{F.current.firstLine={startTime:N.time,startPrice:N.price,endTime:J.time,endPrice:J.price},T.current=!1,B.current=null,S.current=null;return}if(F.current.type==="rectangle"){const C=B.current,h=S.current||C,b=Math.max(C.price,h.price),I=Math.min(C.price,h.price),w=q(Math.min(C.time,h.time)),d=q(Math.max(C.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(b-I)>=1e-5){const _=F.current.primitive,Q=C.time<=h.time?C.rawTime:h.rawTime,E=C.time<=h.time?h.rawTime:C.rawTime,x={rawTime:Q,normalizedTime:w,price:b},f={rawTime:E,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:f.rawTime,price:f.price};const D={type:"rectangle",primitive:_,p1:x,p2:f};ve(P=>[...P,D]),v.current.push(D),Ee(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const C=F.current.primitive,h={rawTime:N.rawTime,normalizedTime:N.time,price:N.price},b={rawTime:J.rawTime,normalizedTime:J.time,price:J.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=3){C.p1={rawTime:h.rawTime,price:h.price},C.p2={rawTime:b.rawTime,price:b.price};const E={type:"circle",primitive:C,p1:h,p2:b};ve(x=>[...x,E]),v.current.push(E),Ee(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const C=F.current.primitive,h=Z(N,J);if(h){const b=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(b>=1&&I>=1e-5){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};ve(d=>[...d,w]),v.current.push(w),Ee(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const C=F.current.primitive,h={rawTime:N.rawTime,normalizedTime:N.time,price:N.price},b={rawTime:J.rawTime,normalizedTime:J.time,price:J.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=4){C.p1={rawTime:h.rawTime,price:h.price},C.p2={rawTime:b.rawTime,price:b.price},C.previewAsLine=!1,C.minorRatio=.45;const E={type:"ellipse",primitive:C,p1:h,p2:b,minorRatio:.45};ve(x=>[...x,E]),v.current.push(E),Ee(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}T.current=!1,B.current=null,S.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const M={capture:!0,passive:!1},N=J=>{T.current||J.stopPropagation()};return O.addEventListener("mousedown",Y,M),O.addEventListener("mousemove",ne,M),O.addEventListener("mousemove",N,M),O.addEventListener("mouseup",he,M),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null,T.current=!1,B.current=null,S.current=null,O.removeEventListener("mousedown",Y,M),O.removeEventListener("mousemove",ne,M),O.removeEventListener("mousemove",N,M),O.removeEventListener("mouseup",he,M)}}},[Ue,Ve,ve,Ee]),ie.useEffect(()=>{const p=c.current,g=u.current,O=o.current,be=Ue===null||Ue===1;if(!be||!p||!g||!O){be||(L(null),V([]),re(null),X([]));return}const H=10,Z=8;function Y(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="gannline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="rectangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=Math.min(b,w),Q=Math.max(b,w),E=Math.min(I,d),x=Math.max(I,d),f=(_+Q)/2,D=(E+x)/2;return[{x:_,y:E},{x:f,y:E},{x:Q,y:E},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:f,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=(b+w)/2,Q=(I+d)/2,E=w-b,x=d-I,f=Math.hypot(E,x);if(f<.001)return[];const D=E/f,P=x/f,K=-P,W=D,G=f/2,ee=G*Math.max(.05,h.minorRatio??.45);return[{x:_-D*G,y:Q-P*G},{x:_+K*ee,y:Q+W*ee},{x:_+D*G,y:Q+P*G},{x:_-K*ee,y:Q-W*ee}]}if(h.type==="gannfan"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="rayline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="extendedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="crossline"&&h.p){const b=p.timeScale().timeToCoordinate(h.p.rawTime),I=g.priceToCoordinate(h.p.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const b=g.priceToCoordinate(h.price);return b==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:b}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const b=p.timeScale().timeToCoordinate(h.rawTime),I=g.priceToCoordinate(h.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=g.priceToCoordinate(h.b1.price),E=p.timeScale().timeToCoordinate(h.b2.rawTime),x=g.priceToCoordinate(h.b2.price);return b==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:(_+E)/2,y:(Q+x)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),E=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:b,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 b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),E=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||E==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:E,y:x}]}if(h.type==="infoline"&&h.p1&&h.p2){const b=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=p.timeScale().timeToCoordinate(b),d=g.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=g.priceToCoordinate(h.p2.price);return w==null||d==null||_==null||Q==null?[]:[{x:w,y:d},{x:_,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="horizontalray"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.originTime),w=g.priceToCoordinate(b.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.time);if(I==null)return[];const w=b.midYCss??200;return[{x:I,y:w}]}return[]}function ne(h,b){for(let I=ze.length-1;I>=0;I--){const w=ze[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),E=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-E);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(nt(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),E=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,f=(_+E)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-E),K=Math.hypot(h-x,b-f);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(nt(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.min(d,Q),f=Math.max(d,Q),D=Math.min(_,E),P=Math.max(_,E),K=(x+f)/2,W=(D+P)/2,G=[{x,y:D,mode:"handle1"},{x:K,y:D,mode:"handle2"},{x:f,y:D,mode:"handle3"},{x,y:W,mode:"handle4"},{x:f,y:W,mode:"handle5"},{x,y:P,mode:"handle6"},{x:K,y:P,mode:"handle7"},{x:f,y:P,mode:"handle8"}];for(const Me of G)if(Math.hypot(h-Me.x,b-Me.y)<H)return{object:w,mode:Me.mode};const ee=nt(h,b,x,D,f,D),ue=nt(h,b,x,P,f,P),Be=nt(h,b,x,D,x,P),xe=nt(h,b,f,D,f,P);if(ee<Z||ue<Z||Be<Z||xe<Z||YA(h,b,[{x,y:D},{x:f,y:D},{x:f,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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.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 f=Math.hypot(h-d,b-_),D=Math.hypot(h-Q,b-E);if(f<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(f-x)<Z||f<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||E==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-E),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=nt(h,b,d,_,Q,E),G=nt(h,b,Q,E,x,f),ee=nt(h,b,x,f,d,_);if(W<Z||G<Z||ee<Z||YA(h,b,[{x:d,y:_},{x:Q,y:E},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,f=(_+E)/2,D=Q-d,P=E-_,K=Math.hypot(D,P);if(K<2)continue;const W=D/K,G=P/K,ee=-G,ue=W,Be=K/2,xe=Be*Math.max(.05,w.minorRatio??.45);if(Be<2||xe<2)continue;const Me=x-W*Be,$e=f-G*Be,qe=x+ee*xe,Re=f+ue*xe,ct=x+W*Be,st=f+G*Be,ht=x-ee*xe,Tt=f-ue*xe,Kt=Math.hypot(h-Me,b-$e),Gt=Math.hypot(h-qe,b-Re),eA=Math.hypot(h-ct,b-st),LA=Math.hypot(h-ht,b-Tt);if(Kt<H)return{object:w,mode:"handle1"};if(Gt<H)return{object:w,mode:"handle2"};if(eA<H)return{object:w,mode:"handle3"};if(LA<H)return{object:w,mode:"handle4"};const mi=(h-x)*W+(b-f)*G,xs=(h-x)*ee+(b-f)*ue,Ap=mi/Be,ip=xs/xe,rp=Ap*Ap+ip*ip;if(Math.abs(rp-1)<.2||rp<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-Q,b-E),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(nt(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-Q,b-E),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(nt(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-E);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(nt(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-E);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(Rv(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-E);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(Gv(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),_=g.priceToCoordinate(w.p.price);if(d==null||_==null)continue;if(Math.hypot(h-d,b-_)<H)return{object:w,mode:"handle1"};const E=Math.abs(b-_),x=Math.abs(h-d);if(E<Z||x<Z)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),_=g.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=Kd(w,d,_);if(h>=Q.left&&h<=Q.right&&b>=Q.top&&b<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-E);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(nt(h,b,d,_,Q,E)<Z)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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),f=g.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=g.priceToCoordinate(w.b2.price),K=x!=null&&D!=null?(x+D)/2:null,W=f!=null&&P!=null?(f+P)/2:null;if(d==null||_==null||Q==null||E==null||K==null||W==null||x==null||f==null||D==null||P==null)continue;const G=Math.hypot(h-d,b-_),ee=Math.hypot(h-Q,b-E),ue=Math.hypot(h-K,b-W),Be=Math.hypot(d-K,_-W)<H*1.5;if(Be&&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(Be)continue;if(G<H)return{object:w,mode:"handle1"};const xe=nt(h,b,d,_,Q,E),Me=nt(h,b,x,f,D,P);if(xe<Z||Me<Z||YA(h,b,[{x:d,y:_},{x:Q,y:E},{x:D,y:P},{x,y:f}]))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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),ee=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||E==null||x==null||f==null||D==null||P==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-d,b-_),Be=Math.hypot(h-Q,b-E);if(ue<H)return{object:w,mode:"handle1"};if(Be<H)return{object:w,mode:"handle2"};const xe=nt(h,b,d,_,Q,E),Me=nt(h,b,x,f,D,P),$e=nt(h,b,K,W,G,ee);if(xe<Z||Me<Z||$e<Z||YA(h,b,[{x,y:f},{x:D,y:P},{x:G,y:ee},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),ee=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||E==null||x==null||f==null||D==null||P==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-d,b-_),Be=Math.hypot(h-Q,b-E);if(ue<H)return{object:w,mode:"handle1"};if(Be<H)return{object:w,mode:"handle2"};const xe=nt(h,b,d,_,Q,E),Me=nt(h,b,x,f,D,P),$e=nt(h,b,K,W,G,ee);if(xe<Z||Me<Z||$e<Z||YA(h,b,[{x,y:f},{x:D,y:P},{x:G,y:ee},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||E==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-E),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=(Q+x)/2,G=(E+f)/2;let ee=W-d,ue=G-_;Math.abs(ee)<1e-4&&(ee=1e-4);const Be=ue/ee,xe=O.clientWidth,Me=E+Be*(xe-Q),$e=f+Be*(xe-x),qe=nt(h,b,Q,E,xe,Me),Re=nt(h,b,x,f,xe,$e);if(qe<Z||Re<Z||YA(h,b,[{x:Q,y:E},{x:xe,y:Me},{x:xe,y:$e},{x,y:f}]))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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||E==null||x==null||f==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-E),G=Math.hypot(h-x,b-f),ee=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle4"};const ue=nt(h,b,d,_,x,f),Be=nt(h,b,Q,E,D,P),xe=nt(h,b,d,_,Q,E),Me=nt(h,b,x,f,D,P);if(ue<Z||Be<Z||xe<Z||Me<Z||YA(h,b,[{x:d,y:_},{x,y:f},{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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||E==null||x==null||f==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-E),G=Math.hypot(h-x,b-f),ee=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle4"};const ue=nt(h,b,d,_,x,f),Be=nt(h,b,Q,E,D,P),xe=nt(h,b,d,_,Q,E),Me=nt(h,b,x,f,D,P);if(ue<Z||Be<Z||xe<Z||Me<Z||YA(h,b,[{x:d,y:_},{x,y:f},{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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=(d+Q)/2,f=(_+E)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-E),K=Math.hypot(h-x,b-f);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(nt(h,b,d,_,Q,E)<Z)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=g.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),f=g.priceToCoordinate(w.p2.price);if(Q==null||E==null||x==null||f==null)continue;const D=Math.hypot(h-Q,b-E),P=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(nt(h,b,Q,E,x,f)<Z)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),E=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||E==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-E);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(nt(h,b,d,_,Q,E)<Z)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.originTime),Q=g.priceToCoordinate(d.price);if(Q==null)continue;if(_!=null&&Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};const E=_==null?0:Math.max(0,_);if(h>=E&&Math.abs(b-Q)<Z)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.time);if(_==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-_)<Z)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const d=g.priceToCoordinate(w.price);if(d==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,b-d)<H)return{object:w,mode:"line"};if(Math.abs(b-d)<Z)return{object:w,mode:"line"}}}return null}const he=h=>{const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=ne(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,te(d.object),j.current=null,oe.current=null;return}L(d.object),re(null),X([]),j.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 L(null),j.current=null,V([]),re(null),X([])},M=h=>{const b=O.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top;if(!j.current){const x=ne(I,w);if(x?.object&&!ae.current){const f=Y(x.object);re(D=>D===x.object?D:x.object),X(D=>D.length===f.length&&D.every((P,K)=>P.x===f[K].x&&P.y===f[K].y)?D:f)}else re(f=>f==null?f:null),X(f=>f.length===0?f:[]);return}const d=ae.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=g.coordinateToPrice(w);if(_==null||Q==null)return;let E=q(_);if(E!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=K=>{const W=K.rawTime??K.time,G=K.normalizedTime??q(W);return{rawTime:W,normalizedTime:G,price:K.price}},f=(K,W)=>{const G=K.normalizedTime??q(K.rawTime),ee=W.normalizedTime??q(W.rawTime);if(G==null||ee==null)return;const ue=W.price-K.price,Be=ue/Math.abs(K.price)*100,xe=tA(pe)||3600,Me=Math.abs(ee-G),$e=Math.max(1,Math.round(Me/xe)),qe=Math.max(1,Math.round(Me/86400)),Re=p.timeScale().timeToCoordinate(K.rawTime),ct=g.priceToCoordinate(K.price),st=p.timeScale().timeToCoordinate(W.rawTime),ht=g.priceToCoordinate(W.price),Tt=Re!=null&&ct!=null&&st!=null&&ht!=null?Math.atan2(-(ht-ct),st-Re)*(180/Math.PI):d.primitive?.info?.angle??0,Kt={priceDiff:ue,pricePct:Be,bars:$e,days:qe,angle:Tt},Gt=d.primitive;if(Gt){Gt.p1={rawTime:K.rawTime,price:K.price},Gt.p2={rawTime:W.rawTime,price:W.price},Gt.info=Kt;try{c.current?.applyOptions({})}catch{}}const eA={...d,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:G,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:ee,price:W.price}};ve(LA=>{const mi=LA.map(xs=>xs===d?eA:xs);return v.current=mi,mi}),L(eA),ae.current=eA,Re!=null&&ct!=null&&st!=null&&ht!=null&&V([{x:Re,y:ct},{x:st,y:ht}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(j.current==="handle1"){const K=p.timeScale().coordinateToTime(I)??_;f({rawTime:K,normalizedTime:E,price:Q},P)}else if(j.current==="handle2"){const K=p.timeScale().coordinateToTime(I)??_;f(D,{rawTime:K,normalizedTime:E,price:Q})}else if(j.current==="line"){const K=oe.current;if(!K)return;const W=x(K.p1),G=x(K.p2);if(W.rawTime==null||W.normalizedTime==null||G.rawTime==null||G.normalizedTime==null)return;const ee=p.timeScale().coordinateToTime(K.x)??W.rawTime,ue=g.coordinateToPrice(K.y);if(ee==null||ue==null)return;const Be=q(ee)??W.normalizedTime;if(Be==null)return;const xe=E-Be,Me=Q-ue,$e=q(W.normalizedTime+xe),qe=q(G.normalizedTime+xe);if($e==null||qe==null)return;const Re=_-ee;f({rawTime:W.rawTime+Re,normalizedTime:$e,price:W.price+Me},{rawTime:G.rawTime+Re,normalizedTime:qe,price:G.price+Me})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(f,D)=>{const P=f.normalizedTime??f.rawTime,K=D.normalizedTime??D.rawTime,W=D.price-f.price,G=W/Math.abs(f.price)*100,ee=ys(Dt,f.rawTime,D.rawTime,pe),ue=Math.abs(K-P),Be=Math.max(1,Math.round(ue/86400)),xe={priceDiff:W,pricePct:G,bars:ee,days:Be},Me=d.primitive;if(Me){Me.p1={rawTime:f.rawTime,price:f.price},Me.p2={rawTime:D.rawTime,price:D.price},Me.info=xe;const ht=D.price>=f.price;Me.color=ht?"#3b82f6":"#ef5350",Me.fillColor=ht?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const $e={...d,rawP1Time:f.rawTime,rawP2Time:D.rawTime,p1:f,p2:D};ve(ht=>{const Tt=ht.map(Kt=>Kt===d?$e:Kt);return v.current=Tt,Tt}),L($e),ae.current=$e;const qe=p.timeScale().timeToCoordinate(f.rawTime),Re=g.priceToCoordinate(f.price),ct=p.timeScale().timeToCoordinate(D.rawTime),st=g.priceToCoordinate(D.price);qe!=null&&Re!=null&&ct!=null&&st!=null&&V([{x:qe,y:Re},{x:(qe+ct)/2,y:(Re+st)/2},{x:ct,y:st}])};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q})}else if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(Be=>{const xe=Be.map(Me=>Me===d?K:Me);return v.current=xe,xe}),L(K),ae.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q})}else if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(Be=>{const xe=Be.map(Me=>Me===d?K:Me);return v.current=xe,xe}),L(K),ae.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;x(d.p1,{rawTime:f,normalizedTime:D,price:Q})}else if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(Be=>{const xe=Be.map(Me=>Me===d?K:Me);return v.current=xe,xe}),L(K),ae.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q})}else if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="crossline"&&d.p){const x=D=>{const P=d.primitive;if(P){P.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p:D};ve(ee=>{const ue=ee.map(Be=>Be===d?K:Be);return v.current=ue,ue}),L(K),ae.current=K;const W=p.timeScale().timeToCoordinate(D.rawTime),G=g.priceToCoordinate(D.price);W!=null&&G!=null&&V([{x:W,y:G}])},f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=g.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const f=c.current?c.current.paneSize().width:400,D=g.priceToCoordinate(x);D!=null&&V([{x:f/2,y:D}]);const P={...d,price:x};ve(K=>{const W=K.map(G=>G===d?P:G);return v.current=W,W}),L(P),ae.current=P;return}if(d.type==="text"){const x=p.timeScale().coordinateToTime(I);if(x==null)return;const f=d.primitive;if(f){f.rawTime=x,f.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),L(D),ae.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(Be=>{const xe=Be.map(Me=>Me===d?K:Me);return v.current=xe,xe}),L(K),ae.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"||j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const K=zd(f,D,P);if(!K)return;const W=d.primitive;if(W){W.p1={rawTime:f.rawTime,price:f.price},W.p2={rawTime:D.rawTime,price:D.price},W.b1={rawTime:K.b1.rawTime,price:K.b1.price},W.b2={rawTime:K.b2.rawTime,price:K.b2.price},W.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const G={...d,p1:f,p2:D,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};ve(ee=>{const ue=ee.map(Be=>Be===d?G:Be);return v.current=ue,ue}),L(G),ae.current=G};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2,d.p3);return}if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q},d.p3);return}if(j.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??q(d.p3.rawTime),price:Q});return}if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K),ue=q(f.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const Be=_-D;x({rawTime:f.p1.rawTime+Be,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+Be,normalizedTime:ee,price:f.p2.price+W},{rawTime:f.p3.rawTime+Be,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Ni(Ve,f,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,intercept:P.intercept,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};ve(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),L(W),ae.current=W};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E},d.p2);return}if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E});return}if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Sr(Ve,f,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};ve(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),L(W),ae.current=W};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E},d.p2);return}if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E});return}if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const K=d.primitive;if(K){K.p1={rawTime:f.rawTime,price:f.price},K.p2={rawTime:D.rawTime,price:D.price},K.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:f,p2:D,p3:P};ve(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),L(W),ae.current=W};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2,d.p3);return}if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q},d.p3);return}if(j.current==="handle3"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,d.p2,{rawTime:f,normalizedTime:E,price:Q});return}if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K),ue=q(f.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const Be=_-D;x({rawTime:f.p1.rawTime+Be,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+Be,normalizedTime:ee,price:f.p2.price+W},{rawTime:f.p3.rawTime+Be,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,ee,ue)=>{const Be=d.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:G.rawTime,price:G.price},Be.p3={rawTime:ee.rawTime,price:ee.price},Be.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:G,p3:ee,p4:ue};ve(Me=>{const $e=Me.map(qe=>qe===d?xe:qe);return v.current=$e,$e}),L(xe),ae.current=xe},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;const K=(W,G,ee,ue)=>{const Be=W.normalizedTime??q(W.rawTime);if(Be==null)return null;const xe=q(Be+ee);return xe==null?null:{rawTime:W.rawTime+G,normalizedTime:xe,price:W.price+ue}};if(j.current==="line"){const W=p.timeScale().coordinateToTime(f.x),G=g.coordinateToPrice(f.y);if(W==null||G==null)return;const ee=q(W);if(ee==null)return;const ue=D-W,Be=P-ee,xe=Q-G,Me=K(f.p1,ue,Be,xe),$e=K(f.p2,ue,Be,xe),qe=K(f.p3,ue,Be,xe),Re=K(f.p4,ue,Be,xe);if(!Me||!$e||!qe||!Re)return;x(Me,$e,qe,Re);return}if(j.current==="handle1"){const W=(f.p1.price+f.p2.price)/2,G={rawTime:D,normalizedTime:P,price:Q},ee={rawTime:D,normalizedTime:P,price:2*W-Q};x(G,ee,f.p3,f.p4);return}if(j.current==="handle3"){const W=(f.p3.price+f.p4.price)/2,G={rawTime:D,normalizedTime:P,price:Q},ee={rawTime:D,normalizedTime:P,price:2*W-Q};x(f.p1,f.p2,G,ee);return}if(j.current==="handle2"){const W=(f.p1.price+f.p2.price)/2,G={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:Q};if(G.normalizedTime==null)return;const ee={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:2*W-Q};if(ee.normalizedTime==null)return;x(ee,G,f.p3,f.p4);return}if(j.current==="handle4"){const W=Q-f.p4.price,G={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??q(f.p3.rawTime),price:f.p4.price+W};if(G.normalizedTime==null)return;const ee={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:f.p2.price+W};if(ee.normalizedTime==null)return;x(f.p1,ee,f.p3,G);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,ee,ue)=>{const Be=d.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:G.rawTime,price:G.price},Be.p3={rawTime:ee.rawTime,price:ee.price},Be.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:G,p3:ee,p4:ue};ve(Me=>{const $e=Me.map(qe=>qe===d?xe:qe);return v.current=$e,$e}),L(xe),ae.current=xe},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;const K=(W,G,ee,ue)=>{const Be=W.normalizedTime??q(W.rawTime);if(Be==null)return null;const xe=q(Be+ee);return xe==null?null:{rawTime:W.rawTime+G,normalizedTime:xe,price:W.price+ue}};if(j.current==="line"){const W=p.timeScale().coordinateToTime(f.x),G=g.coordinateToPrice(f.y);if(W==null||G==null)return;const ee=q(W);if(ee==null)return;const ue=D-W,Be=P-ee,xe=Q-G,Me=K(f.p1,ue,Be,xe),$e=K(f.p2,ue,Be,xe),qe=K(f.p3,ue,Be,xe),Re=K(f.p4,ue,Be,xe);if(!Me||!$e||!qe||!Re)return;x(Me,$e,qe,Re);return}if(j.current==="handle1"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:f.p2.price};x(W,G,f.p3,f.p4);return}if(j.current==="handle3"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:f.p4.price};x(f.p1,f.p2,W,G);return}if(j.current==="handle2"||j.current==="handle4"){const W=j.current==="handle2"?f.p2:f.p4,G=Q-W.price,ee={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:f.p2.price+G},ue={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??q(f.p3.rawTime),price:f.p4.price+G};if(ee.normalizedTime==null||ue.normalizedTime==null)return;x(f.p1,ee,f.p3,ue);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),L(K),ae.current=K};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q})}else if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(st,ht)=>{const Tt=d.primitive;if(Tt){Tt.p1={rawTime:st.rawTime,price:st.price},Tt.p2={rawTime:ht.rawTime,price:ht.price};try{c.current?.applyOptions({})}catch{}}const Kt={...d,p1:st,p2:ht};ve(Gt=>{const eA=Gt.map(LA=>LA===d?Kt:LA);return v.current=eA,eA}),L(Kt),ae.current=Kt},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;if(j.current==="line"){const st=p.timeScale().coordinateToTime(f.x),ht=g.coordinateToPrice(f.y);if(st==null||ht==null)return;const Tt=q(st);if(Tt==null)return;const Kt=P-Tt,Gt=Q-ht,eA=q(f.p1.normalizedTime+Kt),LA=q(f.p2.normalizedTime+Kt);if(eA==null||LA==null)return;const mi=_-st;x({rawTime:f.p1.rawTime+mi,normalizedTime:eA,price:f.p1.price+Gt},{rawTime:f.p2.rawTime+mi,normalizedTime:LA,price:f.p2.price+Gt});return}const K=Math.min(f.p1.normalizedTime,f.p2.normalizedTime),W=Math.max(f.p1.normalizedTime,f.p2.normalizedTime),G=Math.max(f.p1.price,f.p2.price),ee=Math.min(f.p1.price,f.p2.price),ue=f.p1.normalizedTime<=f.p2.normalizedTime?f.p1.rawTime:f.p2.rawTime,Be=f.p1.normalizedTime<=f.p2.normalizedTime?f.p2.rawTime:f.p1.rawTime;let xe=K,Me=W,$e=G,qe=ee,Re=ue,ct=Be;if((j.current==="handle1"||j.current==="handle4"||j.current==="handle6")&&(xe=P,Re=D),(j.current==="handle3"||j.current==="handle5"||j.current==="handle8")&&(Me=P,ct=D),(j.current==="handle1"||j.current==="handle2"||j.current==="handle3")&&($e=Q),(j.current==="handle6"||j.current==="handle7"||j.current==="handle8")&&(qe=Q),xe>Me){const st=xe,ht=Re;xe=Me,Re=ct,Me=st,ct=ht}if($e<qe){const st=$e;$e=qe,qe=st}x({rawTime:Re,normalizedTime:xe,price:$e},{rawTime:ct,normalizedTime:Me,price:qe});return}if(d.type==="circle"&&d.p1&&d.p2){const x=($e,qe)=>{const Re=d.primitive;if(Re){Re.p1={rawTime:$e.rawTime,price:$e.price},Re.p2={rawTime:qe.rawTime,price:qe.price};try{c.current?.applyOptions({})}catch{}}const ct={...d,p1:$e,p2:qe};ve(st=>{const ht=st.map(Tt=>Tt===d?ct:Tt);return v.current=ht,ht}),L(ct),ae.current=ct},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;if(j.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const ee=D-G,ue=Q-W,Be=q(P.p1.normalizedTime+ee),xe=q(P.p2.normalizedTime+ee);if(Be==null||xe==null)return;const Me=_-K;x({rawTime:P.p1.rawTime+Me,normalizedTime:Be,price:P.p1.price+ue},{rawTime:P.p2.rawTime+Me,normalizedTime:xe,price:P.p2.price+ue});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(Re,ct,st)=>{const ht=d.primitive;if(ht){ht.p1={rawTime:Re.rawTime,price:Re.price},ht.p2={rawTime:ct.rawTime,price:ct.price},ht.p3={rawTime:st.rawTime,price:st.price};try{c.current?.applyOptions({})}catch{}}const Tt={...d,p1:Re,p2:ct,p3:st};ve(Kt=>{const Gt=Kt.map(eA=>eA===d?Tt:eA);return v.current=Gt,Gt}),L(Tt),ae.current=Tt},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;if(j.current==="handle1"){x({rawTime:f,normalizedTime:D,price:Q},d.p2,d.p3);return}if(j.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q},d.p3);return}if(j.current==="handle3"){x(d.p1,d.p2,{rawTime:f,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const ee=D-G,ue=Q-W,Be=_-K,xe=Re=>{const ct=Re.normalizedTime??q(Re.rawTime);if(ct==null)return null;const st=q(ct+ee);return st==null?null:{rawTime:Re.rawTime+Be,normalizedTime:st,price:Re.price+ue}},Me=xe(P.p1),$e=xe(P.p2),qe=xe(P.p3);if(!Me||!$e||!qe)return;x(Me,$e,qe);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(K,W,G=d.minorRatio??.45)=>{const ee=d.primitive;if(ee){ee.p1={rawTime:K.rawTime,price:K.price},ee.p2={rawTime:W.rawTime,price:W.price},ee.minorRatio=Math.max(.05,G);try{c.current?.applyOptions({})}catch{}}const ue={...d,p1:K,p2:W,minorRatio:Math.max(.05,G)};ve(Be=>{const xe=Be.map(Me=>Me===d?ue:Me);return v.current=xe,xe}),L(ue),ae.current=ue},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;if(j.current==="line"){const K=p.timeScale().coordinateToTime(f.x),W=g.coordinateToPrice(f.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const ee=P-G,ue=Q-W,Be=q(f.p1.normalizedTime+ee),xe=q(f.p2.normalizedTime+ee);if(Be==null||xe==null)return;const Me=_-K;x({rawTime:f.p1.rawTime+Me,normalizedTime:Be,price:f.p1.price+ue},{rawTime:f.p2.rawTime+Me,normalizedTime:xe,price:f.p2.price+ue},f.minorRatio??d.minorRatio??.45);return}if(j.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(j.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(j.current==="handle2"||j.current==="handle4"){const K=p.timeScale().timeToCoordinate(d.p1.rawTime),W=g.priceToCoordinate(d.p1.price),G=p.timeScale().timeToCoordinate(d.p2.rawTime),ee=g.priceToCoordinate(d.p2.price);if(K==null||W==null||G==null||ee==null)return;const ue=(K+G)/2,Be=(W+ee)/2,xe=G-K,Me=ee-W,$e=Math.hypot(xe,Me);if($e<.001)return;const qe=-Me/$e,Re=xe/$e,ct=Math.abs((I-ue)*qe+(w-Be)*Re),st=Math.max(.05,ct*2/$e);x(d.p1,d.p2,st);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),L(K),ae.current=K};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q})}else if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),L(K),ae.current=K};if(j.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:E,price:Q},d.p2)}else if(j.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:E,price:Q})}else if(j.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=E-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),ee=q(f.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:ee,price:f.p2.price+W})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const f={...d,time:q(_),rawTime:_};ve(P=>{const K=P.map(W=>W===d?f:W);return v.current=K,K}),L(f),ae.current=f;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,f=oe.current;if(!f)return;if(j.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:_};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),L(D),ae.current=D,c.current?.applyOptions({})}else if(j.current==="line"){const D=g.coordinateToPrice(f.y);if(D==null)return;const P=Q-D;if(x.price=f.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};ve(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),L(K),ae.current=K,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(j.current==="handle1"){const x={time:E,price:Q},f=UA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),L(D),ae.current=D}else if(j.current==="handle2"){const x={time:E,price:Q},f=UA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),L(D),ae.current=D}else if(j.current==="line"){const x=oe.current;if(!x)return;const f=p.timeScale().coordinateToTime(x.x),D=g.coordinateToPrice(x.y);if(f==null||D==null)return;const P=E-f,K=Q-D,W={time:q(x.point1.time+P),price:x.point1.price+K},G={time:q(x.point2.time+P),price:x.point2.price+K},ee=UA([{time:W.time,value:W.price},{time:G.time,value:G.price}]);ee.length>0&&d.series.setData(ee),d.decoration&&(d.decoration.p1=W,d.decoration.p2=G);const ue={...d,point1:W,point2:G};ve(Be=>{const xe=Be.map(Me=>Me===d?ue:Me);return v.current=xe,xe}),L(ue),ae.current=ue}}}},N=()=>{j.current=null,oe.current=null},J=()=>{j.current||ae.current||(re(null),X([]))},C={capture:!0,passive:!1};return O.addEventListener("mousedown",he,C),O.addEventListener("mousemove",M,C),O.addEventListener("mouseup",N,C),O.addEventListener("mouseleave",J,C),()=>{O.removeEventListener("mousedown",he,C),O.removeEventListener("mousemove",M,C),O.removeEventListener("mouseup",N,C),O.removeEventListener("mouseleave",J,C)}},[Ue,Ve,ze,ve]),ie.useEffect(()=>{const p=c.current,g=u.current;if(!p||!g)return;const O=()=>{const H=R;if(!H){V([]);return}const Z=p.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const Y=H.p1.rawTime??H.p1.time,ne=H.p2.rawTime??H.p2.time,he=Z.timeToCoordinate(Y),M=g.priceToCoordinate(H.p1.price),N=Z.timeToCoordinate(ne),J=g.priceToCoordinate(H.p2.price);he!=null&&M!=null&&N!=null&&J!=null?V([{x:he,y:M},{x:N,y:J}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:(Y+he)/2,y:(ne+M)/2},{x:he,y:M}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="crossline"&&H.p){const Y=Z.timeToCoordinate(H.p.rawTime),ne=g.priceToCoordinate(H.p.price);Y!=null&&ne!=null?V([{x:Y,y:ne}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const Y=Z.timeToCoordinate(H.rawTime),ne=g.priceToCoordinate(H.price);Y!=null&&ne!=null?V([{x:Y,y:ne}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price),N=Z.timeToCoordinate(H.b1.rawTime),J=g.priceToCoordinate(H.b1.price),C=Z.timeToCoordinate(H.b2.rawTime),h=g.priceToCoordinate(H.b2.price);Y!=null&&ne!=null&&he!=null&&M!=null&&N!=null&&J!=null&&C!=null&&h!=null?V([{x:Y,y:ne},{x:he,y:M},{x:(N+C)/2,y:(J+h)/2}]):V([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price),N=Z.timeToCoordinate(H.p3.rawTime),J=g.priceToCoordinate(H.p3.price);Y!=null&&ne!=null&&he!=null&&M!=null&&N!=null&&J!=null?V([{x:Y,y:ne},{x:he,y:M},{x:N,y:J}]):V([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price),N=Z.timeToCoordinate(H.p3.rawTime),J=g.priceToCoordinate(H.p3.price),C=Z.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);Y!=null&&ne!=null&&he!=null&&M!=null&&N!=null&&J!=null&&C!=null&&h!=null?V([{x:Y,y:ne},{x:he,y:M},{x:N,y:J},{x:C,y:h}]):V([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price),N=Z.timeToCoordinate(H.p3.rawTime),J=g.priceToCoordinate(H.p3.price),C=Z.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);Y!=null&&ne!=null&&he!=null&&M!=null&&N!=null&&J!=null&&C!=null&&h!=null?V([{x:Y,y:ne},{x:he,y:M},{x:N,y:J},{x:C,y:h}]):V([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const Y=Z.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),he=Z.timeToCoordinate(H.point2.time),M=g.priceToCoordinate(H.point2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const Y=Z.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),he=Z.timeToCoordinate(H.point2.time),M=g.priceToCoordinate(H.point2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:(Y+he)/2,y:(ne+M)/2},{x:he,y:M}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);if(Y!=null&&ne!=null&&he!=null&&M!=null){const N=Math.min(Y,he),J=Math.max(Y,he),C=Math.min(ne,M),h=Math.max(ne,M),b=(N+J)/2,I=(C+h)/2;V([{x:N,y:C},{x:b,y:C},{x:J,y:C},{x:N,y:I},{x:J,y:I},{x:N,y:h},{x:b,y:h},{x:J,y:h}])}else V([]);return}if(H.type==="circle"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price),N=Z.timeToCoordinate(H.p3.rawTime),J=g.priceToCoordinate(H.p3.price);Y!=null&&ne!=null&&he!=null&&M!=null&&N!=null&&J!=null?V([{x:Y,y:ne},{x:he,y:M},{x:N,y:J}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);if(Y!=null&&ne!=null&&he!=null&&M!=null){const N=(Y+he)/2,J=(ne+M)/2,C=he-Y,h=M-ne,b=Math.hypot(C,h);if(b<.001){V([]);return}const I=C/b,w=h/b,d=-w,_=I,Q=b/2,E=Q*Math.max(.05,H.minorRatio??.45);V([{x:N-I*Q,y:J-w*Q},{x:N+d*E,y:J+_*E},{x:N+I*Q,y:J+w*Q},{x:N-d*E,y:J-_*E}])}else V([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const Y=Z.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),he=Z.timeToCoordinate(H.p2.rawTime),M=g.priceToCoordinate(H.p2.price);Y!=null&&ne!=null&&he!=null&&M!=null?V([{x:Y,y:ne},{x:he,y:M}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const Y=H.primitive,ne=Z.timeToCoordinate(Y.originTime),he=g.priceToCoordinate(Y.price);ne!=null&&he!=null?V([{x:ne,y:he}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const Y=H.primitive,ne=Z.timeToCoordinate(Y.time);if(ne!=null){const he=Y.midYCss??200;V([{x:ne,y:he}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const Y=u.current?.priceToCoordinate(H.price);if(Y!=null){const ne=c.current?c.current.paneSize().width:400;V([{x:ne/2,y:Y}])}else V([]);return}V([])};O();const be=p.timeScale();return be.subscribeVisibleTimeRangeChange(O),()=>{be.unsubscribeVisibleTimeRangeChange(O)}},[R]),ie.useEffect(()=>{let p=!1;v.current.forEach(g=>{if(g.type==="verticalline"&&g.primitive){const O=g===R||g===Ae;g.primitive.showDot!==O&&(g.primitive.showDot=O,p=!0)}}),p&&c.current?.applyOptions({})},[R,Ae]),ie.useEffect(()=>{let p=!1;v.current.forEach(g=>{if((g.type==="infoline"||g.type==="rulerline"||g.type==="arrowedline"||g.type==="rayline"||g.type==="extendedline"||g.type==="trendbyangle")&&g.primitive){const O=g===R||g===Ae;g.primitive.isActive!==O&&(g.primitive.isActive=O,p=!0)}}),p&&c.current?.applyOptions({})},[R,Ae]),ie.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:Pe}),p.priceLine){const g=Pe&&p.showPrice!==!1;p.priceLine.applyOptions(Pe?{color:p.lineColor??"#3b82f6",axisLabelVisible:g,title:g&&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,ze]),ie.useEffect(()=>{!Pe&&R&&(L(null),V([]))},[Pe,R]),ie.useEffect(()=>{if(v.current.length>ze.length){const p=v.current.filter((g,O)=>!ze.includes(g));R&&p.some(g=>g===R)&&(L(null),V([])),p.forEach(g=>{if(g.series&&c.current?.removeSeries(g.series),g.priceLine&&u.current?.removePriceLine(g.priceLine),g.textPrimitive)try{u.current?.detachPrimitive(g.textPrimitive)}catch{}if(g.type==="horizontalray"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="verticalline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="infoline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rulerline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="arrowedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rayline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="extendedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="crossline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="trendbyangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="equidistantchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="regressionchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="stddevchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="gannfan"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ganngrid"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="andrewspitchfork"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="disjointchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="flattopbottom"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="fibonacci"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rectangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="circle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="triangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ellipse"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="text"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="parallellines")try{g.baseLine&&c.current?.removeSeries(g.baseLine),g.parallelLine&&c.current?.removeSeries(g.parallelLine),g.firstLine&&c.current?.removeSeries(g.firstLine),g.secondLine&&c.current?.removeSeries(g.secondLine)}catch{}}),v.current=ze}},[ze,R]),ie.useEffect(()=>{const p=u.current;return p?(ge.current.forEach(O=>{try{p.removePriceLine(O)}catch{}}),ge.current=[],Ne.filter(O=>O.symbol===ye).forEach(O=>{const be=parseFloat(O.price);if(isNaN(be))return;const Z=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350",Y=p.createPriceLine({price:be,color:Z,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume} @ ${O.price}`,textColor:Z});ge.current.push(Y)}),()=>{ge.current.forEach(O=>{try{p.removePriceLine(O)}catch{}}),ge.current=[]}):void 0},[Ne,ye]),ie.useEffect(()=>{const p=o.current;if(!p)return;const g=O=>{if(se.current){se.current=!1;return}if(T.current||!c.current)return;const be=c.current,H=u.current;if(be&&H&&v.current.length>0){const Z=p.getBoundingClientRect(),Y=O.clientX-Z.left,ne=O.clientY-Z.top,he=15;for(let M=v.current.length-1;M>=0;M--){const N=v.current[M];let J=!1;if(N.type==="text"&&N.rawTime!=null&&N.price!=null){const C=be.timeScale().timeToCoordinate(N.rawTime),h=H.priceToCoordinate(N.price);if(C!=null&&h!=null){const b=Kd(N,C,h);Y>=b.left&&Y<=b.right&&ne>=b.top&&ne<=b.bottom&&(J=!0)}}else if(N.point1&&N.point2){const C=be.timeScale().timeToCoordinate(N.point1.time??N.point1.rawTime),h=H.priceToCoordinate(N.point1.price),b=be.timeScale().timeToCoordinate(N.point2.time??N.point2.rawTime),I=H.priceToCoordinate(N.point2.price);if(C!=null&&h!=null&&b!=null&&I!=null){const w=Math.hypot(Y-C,ne-h),d=Math.hypot(Y-b,ne-I),_=(C+b)/2,Q=(h+I)/2,E=Math.hypot(Y-_,ne-Q);(w<he||d<he||E<he)&&(J=!0)}}else if(N.p1&&N.p2){const C=be.timeScale().timeToCoordinate(N.p1.rawTime),h=H.priceToCoordinate(N.p1.price),b=be.timeScale().timeToCoordinate(N.p2.rawTime),I=H.priceToCoordinate(N.p2.price);if(C!=null&&h!=null&&b!=null&&I!=null){const w=Math.min(C,b),d=Math.max(C,b),_=Math.min(h,I),Q=Math.max(h,I);Y>=w-5&&Y<=d+5&&ne>=_-5&&ne<=Q+5&&(J=!0)}}else if(N.p){const C=be.timeScale().timeToCoordinate(N.p.rawTime),h=H.priceToCoordinate(N.p.price);C!=null&&h!=null&&Math.hypot(Y-C,ne-h)<he&&(J=!0)}else if(N.type==="pricelevel"&&N.price!=null){const C=H.priceToCoordinate(N.price);C!=null&&Math.abs(ne-C)<he&&(J=!0)}if(J){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),te(N);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;Gd(c.current,Ve,pe)||c.current.timeScale().fitContent();const Y=c.current.timeScale().getVisibleRange();Te(Y)},80)};return p.addEventListener("dblclick",g,!0),()=>{p.removeEventListener("dblclick",g,!0)}},[Ve,pe]);const ep=R??Ae,tp=R?$:le,ST=Pe&&Zv(ep,tp),ET=Jv(ep?.type);ie.useEffect(()=>{const p=o.current,g=l.current;if(!p||!g)return;const O=80,be=Z=>{const Y=p.getBoundingClientRect();g.style.opacity=Y.bottom-Z.clientY<=O?"1":"0"},H=()=>{g.style.opacity="0"};return p.addEventListener("mousemove",be),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",be),p.removeEventListener("mouseleave",H)}},[]);const LT=ie.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const O=g.to-g.from,be=(g.from+g.to)/2,H=O*.8;try{p.setVisibleRange({from:be-H/2,to:be+H/2}),Te(p.getVisibleRange())}catch{}},[Te]),MT=ie.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const O=g.to-g.from,be=(g.from+g.to)/2,H=O*1.25;try{p.setVisibleRange({from:be-H/2,to:be+H/2}),Te(p.getVisibleRange())}catch{}},[Te]),HT=ie.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const O=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from-O,to:g.to-O})}catch{}},[]),IT=ie.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const O=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from+O,to:g.to+O})}catch{}},[]),DT=ie.useCallback(()=>{if(!c.current)return;Gd(c.current,Ve,pe)||c.current.timeScale().fitContent();const g=c.current.timeScale().getVisibleRange();Te(g)},[Ve,pe,Te]);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:Ue===1||Ue!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Bt&&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,"..."]})]})}),!Bt&&Ir&&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:Ir})]})}),!Bt&&!Ir&&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:rt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),A&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(xh,{bidPrice:e,askPrice:t,onBuyClick:xT,onSellClick:bT})}),a.jsx(bh,{isOpen:He,onClose:QT,orderType:Fe,bidPrice:e,askPrice:t}),a.jsx(Eh,{isOpen:z!==null,onClose:()=>te(null),chartObject:z,onUpdate:FT}),Bt&&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"}})}),ST&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:tp.map((p,g)=>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:ET}},g))}),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:MT,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:LT,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:HT,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:IT,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:DT,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:g,icon:O})=>a.jsx("button",{title:p,onClick:g,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:be=>{be.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",be.currentTarget.style.color=rt==="light"?"#111827":"#e2e8f0"},onMouseLeave:be=>{be.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",be.currentTarget.style.color=rt==="light"?"#374151":"#94a3b8"},children:O},p))})]})})}),gt={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 $d({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Lt(),[s,o]=ie.useState(!1),[l,c]=ie.useState(""),[u,m]=ie.useState(-1),y=ie.useRef(null),v=ie.useRef(null);ie.useEffect(()=>{const U=k=>{y.current&&!y.current.contains(k.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]),ie.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const T=r.filter(U=>U.symbol.toLowerCase().includes(l.toLowerCase())),B=T.filter(U=>!U.symbol.endsWith("USDT")),S=T.filter(U=>U.symbol.endsWith("USDT")),F=U=>{A(U),o(!1),c("")};return r.find(U=>U.symbol===t),a.jsxs("div",{ref:y,style:{...gt.container,...i},className:e,children:[a.jsxs("button",{style:gt.button,onClick:()=>o(!s),onMouseEnter:U=>Object.assign(U.currentTarget.style,gt.buttonHover),onMouseLeave:U=>{U.currentTarget.style.borderColor="#334155",U.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...gt.arrow,...s?gt.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:gt.dropdown,children:[a.jsx("div",{style:gt.searchContainer,children:a.jsx("input",{ref:v,style:gt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:U=>c(U.target.value)})}),a.jsx("div",{style:gt.list,children:T.length===0?a.jsx("div",{style:gt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[B.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:gt.categoryLabel,children:"Forex & Metals"}),B.map(U=>a.jsxs("div",{style:{...gt.item,...U.symbol===t?gt.itemSelected:{}},onClick:()=>F(U.symbol),onMouseEnter:k=>{U.symbol!==t&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{U.symbol!==t&&(k.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:gt.symbolName,children:U.symbol}),U.bid&&a.jsx("span",{style:{...gt.symbolPrice,...parseFloat(U.change)>=0?gt.priceUp:gt.priceDown},children:parseFloat(U.bid).toFixed(5)})]},U.symbol))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:gt.categoryLabel,children:"Crypto"}),S.map(U=>a.jsxs("div",{style:{...gt.item,...U.symbol===t?gt.itemSelected:{}},onClick:()=>F(U.symbol),onMouseEnter:k=>{U.symbol!==t&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{U.symbol!==t&&(k.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:gt.symbolName,children:U.symbol}),U.bid&&a.jsx("span",{style:{...gt.symbolPrice,...parseFloat(U.change)>=0?gt.priceUp:gt.priceDown},children:parseFloat(U.bid).toFixed(2)})]},U.symbol))]})]})})]})]})}const SA={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"}},AT=[.01,.05,.1,.5,1];function Xd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=AT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[m,y]=ie.useState(.1),v=i!==void 0?i:m,T=ie.useCallback(U=>{const k=Math.max(t,Math.min(A,parseFloat(U)||t)),R=Math.round(k/r)*r,L=parseFloat(R.toFixed(8));i!==void 0||y(L),e?.(L)},[t,A,r,i,e]),B=()=>T(v+r),S=()=>T(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...SA.container,...c},className:u,children:[o&&a.jsx("span",{style:SA.label,children:l}),a.jsx("button",{style:SA.btn,onClick:S,onMouseEnter:U=>Object.assign(U.currentTarget.style,SA.btnHover),onMouseLeave:U=>{U.currentTarget.style.borderColor="#334155",U.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:SA.input,type:"text",value:F,onChange:U=>{const k=U.target.value;if(k===""||k==="."||k==="0.")return;const R=parseFloat(k);isNaN(R)||T(R)},onBlur:()=>T(v)}),a.jsx("button",{style:SA.btn,onClick:B,onMouseEnter:U=>Object.assign(U.currentTarget.style,SA.btnHover),onMouseLeave:U=>{U.currentTarget.style.borderColor="#334155",U.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:SA.presets,children:n.map(U=>a.jsx("button",{style:{...SA.preset,...Math.abs(v-U)<1e-4?SA.presetActive:{}},onClick:()=>T(U),onMouseEnter:k=>{Math.abs(v-U)>=1e-4&&Object.assign(k.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:k=>{Math.abs(v-U)>=1e-4&&(k.currentTarget.style.borderColor="#334155")},children:U},U))})]})}const Yt={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 Zd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:u,className:m}){const{currentSymbolData:y}=Lt(),[v,T]=ie.useState(""),[B,S]=ie.useState(!1),[F,U]=ie.useState("price"),k=i!==void 0?i:v,R=t!==void 0?t:B,L=r!==void 0?r:F,z=ie.useCallback(re=>{t!==void 0||S(re),A?.(re)},[t,A]),te=ie.useCallback(re=>{r!==void 0||U(re),n?.(re)},[r,n]),$=ie.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const le=re.target.value;if(le===""||le==="."||le==="0."){$(le);return}const X=parseFloat(le);isNaN(X)||$(le)},Ae=L==="price"?y?.bid?parseFloat(y.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...Yt.container,...u},className:m,children:[l&&a.jsx("span",{style:Yt.label,children:c}),s&&a.jsx("button",{style:{...Yt.toggle,...R?Yt.toggleOn:Yt.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...Yt.toggleKnob,...R?Yt.knobOn:Yt.knobOff}})}),(R||!s)&&a.jsxs("div",{style:Yt.inputGroup,children:[a.jsx("input",{style:Yt.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:{...Yt.modeBtn,...L==="price"?Yt.modeBtnActive:{}},onClick:()=>te("price"),children:"Price"}),a.jsx("button",{style:{...Yt.modeBtn,...L==="pips"?Yt.modeBtnActive:{}},onClick:()=>te("pips"),children:"Pips"})]})]})]})}const qt={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 Jd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:u,className:m}){const{currentSymbolData:y}=Lt(),[v,T]=ie.useState(""),[B,S]=ie.useState(!1),[F,U]=ie.useState("price"),k=i!==void 0?i:v,R=t!==void 0?t:B,L=r!==void 0?r:F,z=ie.useCallback(re=>{t!==void 0||S(re),A?.(re)},[t,A]),te=ie.useCallback(re=>{r!==void 0||U(re),n?.(re)},[r,n]),$=ie.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const le=re.target.value;if(le===""||le==="."||le==="0."){$(le);return}const X=parseFloat(le);isNaN(X)||$(le)},Ae=L==="price"?y?.ask?parseFloat(y.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...qt.container,...u},className:m,children:[l&&a.jsx("span",{style:qt.label,children:c}),s&&a.jsx("button",{style:{...qt.toggle,...R?qt.toggleOn:qt.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...qt.toggleKnob,...R?qt.knobOn:qt.knobOff}})}),(R||!s)&&a.jsxs("div",{style:qt.inputGroup,children:[a.jsx("input",{style:qt.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:{...qt.modeBtn,...L==="price"?qt.modeBtnActive:{}},onClick:()=>te("price"),children:"Price"}),a.jsx("button",{style:{...qt.modeBtn,...L==="pips"?qt.modeBtnActive:{}},onClick:()=>te("pips"),children:"Pips"})]})]})]})}const iT=[{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:"─"}],EA={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:m,setChartObjects:y}=Lt(),[v,T]=ie.useState(null),B=A||iT,S=k=>{l(o===k?null:k)},F=()=>{y([]),l(null)},U=()=>{u(!c)};return a.jsxs("div",{style:{...EA.container,...n},className:s,children:[i&&a.jsx("span",{style:EA.label,children:r}),B.map(k=>a.jsxs("button",{style:{...EA.btn,...o===k.id?EA.btnActive:{}},onClick:()=>S(k.id),onMouseEnter:R=>{T(k.id),o!==k.id&&Object.assign(R.currentTarget.style,EA.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:EA.tooltip,children:k.name})]},k.id)),(e||t)&&a.jsx("div",{style:EA.divider}),t&&a.jsx("button",{style:{...EA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:U,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:EA.deleteBtn,onClick:F,onMouseEnter:k=>Object.assign(k.currentTarget.style,EA.deleteBtnHover),onMouseLeave:k=>{k.currentTarget.style.borderColor="#334155",k.currentTarget.style.backgroundColor="#1e293b",k.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const qd={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 rT({showCoinSelector:i=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:u,onStopLossEnabledChange:m,takeProfit:y,onTakeProfitChange:v,takeProfitEnabled:T,onTakeProfitEnabledChange:B,coinSelectorProps:S={},volumeControlProps:F={},stopLossProps:U={},takeProfitProps:k={},drawingToolsProps:R={},style:L,className:z}){const te=[];i&&te.push(a.jsx($d,{...S},"coin")),e&&te.push(a.jsx(Xd,{value:s,onChange:o,...F},"volume")),t&&te.push(a.jsx(Zd,{value:l,onChange:c,enabled:u,onEnabledChange:m,...U},"sl")),A&&te.push(a.jsx(Jd,{value:y,onChange:v,enabled:T,onEnabledChange:B,...k},"tp")),r&&te.push(a.jsx(Yd,{...R},"draw"));const $=[];return te.forEach((V,Ae)=>{$.push(V),n&&Ae<te.length-1&&$.push(a.jsx("div",{style:qd.divider},`div-${Ae}`))}),a.jsx("div",{style:{...qd.toolbar,...L},className:z,children:$})}const nT=[{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"}],Na={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 sT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Lt();return a.jsx("div",{style:{...Na.container,...i},className:e,children:nT.map(r=>a.jsx("button",{style:{...Na.btn,...t===r.value?Na.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 oT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Oa={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 aT({style:i,className:e}){const{chartType:t,setChartType:A}=Lt();return a.jsx("div",{style:{...Oa.container,...i},className:e,children:oT.map(r=>a.jsxs("button",{style:{...Oa.btn,...t===r.value?Oa.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 Rt={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 lT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Lt(),[u,m]=ie.useState(null),y=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),T=v>0&&y>0?Math.abs(v-y):0,B=U=>!U||U===0?"-.-----":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5),S=U=>U===0?"-":U>=1?U.toFixed(1):U>=.01?U.toFixed(3):(U*1e4).toFixed(1)+"p",F=ie.useCallback(U=>{if(!s)return;const k=U==="BUY"?v:y;if(!k||k<=0){m({type:"error",message:"No price available"});return}const R={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:U,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 L=i*k*.01;c(z=>z-L),m({type:"success",message:`${U} executed`}),A?.(R),setTimeout(()=>m(null),3e3)},[s,v,y,i,e,t,l,c,A]);return a.jsxs("div",{style:{...Rt.container,...r},className:n,children:[a.jsx("button",{style:Rt.sellBtn,onClick:()=>F("SELL"),onMouseEnter:U=>{Object.assign(U.currentTarget.style,Rt.sellBtnHover)},onMouseLeave:U=>{U.currentTarget.style.backgroundColor="#7f1d1d",U.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:Rt.priceBox,children:[a.jsx("span",{style:Rt.priceLabel,children:"Bid"}),a.jsx("span",{style:{...Rt.priceValue,color:"#EF5350"},children:B(y)})]}),a.jsxs("div",{style:Rt.spread,children:[a.jsx("span",{style:Rt.spreadLabel,children:"Spread"}),a.jsx("span",{style:Rt.spreadValue,children:S(T)})]}),a.jsxs("div",{style:Rt.priceBox,children:[a.jsx("span",{style:Rt.priceLabel,children:"Ask"}),a.jsx("span",{style:{...Rt.priceValue,color:"#26A69A"},children:B(v)})]}),a.jsx("button",{style:Rt.buyBtn,onClick:()=>F("BUY"),onMouseEnter:U=>{Object.assign(U.currentTarget.style,Rt.buyBtnHover)},onMouseLeave:U=>{U.currentTarget.style.backgroundColor="#14532d",U.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...Rt.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 et={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 cT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Lt(),[l,c]=ie.useState(null),u=A.filter(B=>B.status==="OPEN"||!B.closeAt),m=ie.useCallback((B,S)=>{const F=n.find(U=>U.symbol===B);return F?S?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),y=ie.useCallback(B=>{if(l)return;c(B.id);const S=m(B.symbol,B.type),U=(B.type?.toUpperCase()==="BUY"?S-B.price:B.price-S)*B.volume,k=B.volume*B.price*.01;r(R=>R.filter(L=>L.id!==B.id)),o(R=>R+k+U),c(null)},[l,m,r,o]),v=B=>{const S=parseFloat(B);return!S||isNaN(S)?"-":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5)},T=B=>{const S=parseFloat(B);return isNaN(S)?"-":(S>=0?"+":"")+S.toFixed(2)};return a.jsxs("div",{style:{...et.container,...i},className:e,children:[a.jsxs("div",{style:et.header,children:[a.jsxs("span",{style:et.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:et.summary,children:[a.jsxs("div",{style:et.summaryItem,children:[a.jsx("span",{style:et.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...et.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:et.summaryItem,children:[a.jsx("span",{style:et.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...et.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:et.summaryItem,children:[a.jsx("span",{style:et.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...et.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...et.scrollArea,maxHeight:t},children:a.jsxs("table",{style:et.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:et.th,children:"Symbol"}),a.jsx("th",{style:et.th,children:"Type"}),a.jsx("th",{style:et.th,children:"Volume"}),a.jsx("th",{style:et.th,children:"Open Price"}),a.jsx("th",{style:et.th,children:"Current"}),a.jsx("th",{style:et.th,children:"SL"}),a.jsx("th",{style:et.th,children:"TP"}),a.jsx("th",{style:et.th,children:"Profit"}),a.jsx("th",{style:et.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:et.emptyRow,children:"No open positions"})}):u.map(B=>{const S=m(B.symbol,B.type),F=B.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...et.td,fontWeight:700,color:"#e2e8f0"},children:B.symbol}),a.jsx("td",{style:{...et.td,...B.type?.toUpperCase()==="BUY"?et.typeBuy:et.typeSell},children:B.type}),a.jsx("td",{style:et.td,children:B.volume}),a.jsx("td",{style:et.td,children:v(B.price)}),a.jsx("td",{style:et.td,children:v(S)}),a.jsx("td",{style:et.td,children:B.stopLoss?v(B.stopLoss):"-"}),a.jsx("td",{style:et.td,children:B.takeProfit?v(B.takeProfit):"-"}),a.jsx("td",{style:{...et.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:T(F)}),a.jsx("td",{style:et.td,children:a.jsx("button",{style:{...et.closeBtn,...l===B.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>y(B),disabled:l===B.id,onMouseEnter:U=>{l!==B.id&&(U.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:U=>{U.currentTarget.style.backgroundColor="#7f1d1d"},children:l===B.id?"...":"Close"})})]},B.id)})})]})})]})}function hT(i){return zt({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 uT(i){return zt({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 dT(i){return zt({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 pT(i){return zt({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 fT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:u,marketWatchOpen:m=!0,onToggleMarketWatch:y,buySellPanelOpen:v,onMove:T})=>{const{theme:B}=Lt(),S=B==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],U={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:U[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:U[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(hT,{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(uT,{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:()=>y?.(),title:m?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${m?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"})})})]})]})},Er=[{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"})]})}],Lr=[{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"})})}],Mr=[{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"})})}],Hr=[{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"})})}],Cs=({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})}),gT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:m,setDrawingsVisible:y,chartLocked:v,setChartLocked:T,theme:B,setTheme:S,setIsShow:F}=Lt(),[U,k]=ie.useState(!1),[R,L]=ie.useState(null),[z,te]=ie.useState(null),[$,V]=ie.useState(0),[Ae,re]=ie.useState(!1),[le,X]=ie.useState(0),[j,oe]=ie.useState(!1),[ae,se]=ie.useState(0),[ce,de]=ie.useState(!1),[we,Qe]=ie.useState(0),[Se,Ce]=ie.useState(!1),[Te,Ue]=ie.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Ee=ie.useRef(null),Ie=ie.useRef(null),Ze=ie.useRef(null),ze=ie.useRef(null),ve=ie.useRef(null),Ne=ie.useRef(null);ie.useEffect(()=>{const ke=me=>{const ge=Ee.current;U&&ge&&!ge.contains(me.target)&&(k(!1),L(null));const He=Ie.current;z==="line"&&He&&!He.contains(me.target)&&te(null);const _e=Ze.current;z==="channel"&&_e&&!_e.contains(me.target)&&te(null);const Fe=ze.current;z==="gann"&&Fe&&!Fe.contains(me.target)&&te(null);const Ke=ve.current;z==="shape"&&Ke&&!Ke.contains(me.target)&&te(null)};return window.addEventListener("mousedown",ke),()=>window.removeEventListener("mousedown",ke)},[U,z]),ie.useEffect(()=>{const ke=me=>{me.key==="Escape"&&(k(!1),L(null),te(null))};return window.addEventListener("keydown",ke),()=>window.removeEventListener("keydown",ke)},[]);const ye=ie.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"}],[]),pe=ke=>{const me=ye[ke].label;if(me==="Menu"){k(ge=>!ge),L(null);return}if(me==="Grid"){s(!n);return}if(me==="Magnet"){l(!o),r(o?null:ke);return}if(me==="Delete"){if(c.length>0){const ge=[...c];ge.pop(),u(ge)}return}if(me==="Eye"){y(!m);return}if(me==="Lock"){T(!v);return}if(me==="Light Theme"||me==="Dark Theme"){S(B==="light"?"dark":"light"),k(!1),L(null);return}if(me==="History"){F(!0);return}r(A===ke?null:ke)};ye.slice(0,12);const Pe=ye.slice(12),Je=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],it=[{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"})]})},{label:"Open Demo account",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",{fill:"#CDFDDA",fillRule:"evenodd",d:"M14.5 13.103c1.836 0 3.667.723 5.5 2.14V19l-10.5.5-.5-4.257c1.833-1.417 3.664-2.14 5.5-2.14Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M9.53 15.469 9.5 19l10-.477v-3.032c-1.703-1.27-3.365-1.888-5-1.888-1.626 0-3.277.611-4.97 1.866Zm-.836-.622c1.895-1.465 3.83-2.244 5.806-2.244 1.975 0 3.91.78 5.806 2.244l.194.15v4.48l-12.03.545V15.02l.224-.173Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"m7.736 13.701-.734 2.345L7.001 20H4.5a1 1 0 0 1-1-1v-4c1.412-.669 2.824-1.102 4.236-1.299Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"m7.913 13.678-.475 1.086c-.988.111-1.87.308-2.646.59l-.29.11v3.529H7L7.002 20H4.5a1 1 0 0 1-1-1v-4c1.471-.697 2.942-1.138 4.413-1.322Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#CDFDDA",d:"M14.5 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M14.5 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",d:"M11.471 11.979A4.992 4.992 0 0 1 9.5 8c0-.67.131-1.308.37-1.891a3.5 3.5 0 1 0 1.601 5.87Z"}),a.jsx("path",{fill:"#CDFDDA",d:"M9.586 7.07a2.5 2.5 0 1 0 1.153 4.226A4.981 4.981 0 0 1 9.5 8c0-.318.03-.63.086-.93Z"})]})})})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.jsx("path",{fillRule:"evenodd","clip-rule":"evenodd",d:"M20 6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6zm-2 3V6h-3v3h3zm-4-3h-4v2.999h4V6zM9 6H6v3l3-.001V6zm-3 4v4l3-.001v-4H6zm0 5v3h3v-3.001H6zm4 3h4v-3.001h-4V18zm5 0h3v-3h-3v3zm3-4v-4h-3v4h3zm-8-.001v-4h4v4h-4z",fill:"currentColor"})})})},{label:"Trade Orders",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Trade Position",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),a.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),a.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 19L8 14L12 19H4Z",fill:"#3183FF"}),a.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),a.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP Levels",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.688 17.773-.375.91c.43.277.911.415 1.445.415.614 0 1.104-.15 1.469-.45.367-.299.55-.68.55-1.144 0-.258-.044-.491-.132-.7a1.568 1.568 0 0 0-.387-.55c-.17-.159-.446-.332-.828-.52-.727-.354-1.09-.695-1.09-1.023 0-.198.064-.358.191-.48.13-.126.313-.188.547-.188.396 0 .772.128 1.129.383l.309-.875c-.31-.248-.796-.371-1.457-.371-.508 0-.925.146-1.25.437a1.421 1.421 0 0 0-.485 1.102c0 .237.04.453.121.648.084.195.2.365.352.508.154.14.45.322.887.543.44.219.73.417.87.594.141.177.212.363.212.558 0 .417-.299.625-.895.625-.388 0-.782-.14-1.184-.422ZM8.68 13.277V19h3.601v-.902H9.695v-4.82H8.68ZM20 20H4v1h16v-1Z",fill:"#EA4C4C"}),a.jsx("path",{d:"M10.5 10V7.895c.193.018.346.027.46.027 1.548 0 2.321-.656 2.321-1.969 0-.588-.21-1.02-.629-1.297-.416-.278-1.076-.418-1.98-.418-.115 0-.51.015-1.188.043V10H10.5Zm0-3.008V5.16c.099-.013.202-.02.309-.02.955 0 1.433.298 1.433.891 0 .35-.107.602-.32.758-.214.154-.552.23-1.016.23-.099 0-.234-.009-.406-.027Z",fill:"#3183FF",fillRule:"evenodd","clip-rule":"evenodd"}),a.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m6.926 14-.418-1.16H4.547L4.148 14H3.02L5.3 8.2h.446l2.3 5.8h-1.12ZM5.523 9.95l-.687 2.113H6.21l-.688-2.114Zm2.86 3.734.375-.91c.4.28.795.421 1.183.421.597 0 .895-.208.895-.625a.886.886 0 0 0-.211-.558c-.14-.177-.431-.375-.871-.594-.438-.221-.733-.402-.887-.543a1.506 1.506 0 0 1-.351-.508 1.682 1.682 0 0 1-.121-.648c0-.443.161-.81.484-1.102.325-.291.742-.437 1.25-.437.661 0 1.147.123 1.457.37l-.309.876a1.909 1.909 0 0 0-1.129-.383c-.234 0-.416.062-.546.187a.635.635 0 0 0-.192.48c0 .33.363.67 1.09 1.024.383.188.659.361.828.52.17.156.298.34.387.55.088.209.133.442.133.7 0 .463-.184.845-.551 1.144-.365.3-.854.45-1.469.45a2.617 2.617 0 0 1-1.445-.414Zm7.613.316-1.594-2.438-.636.872V14H12.75V8.277h1.016v2.739l1.945-2.739h1.156l-1.793 2.5L17.211 14h-1.215ZM3 15h18v1H3z",fill:"#C96057"})})})})},{label:"Chart Controls",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),a.jsx("path",{d:"M11.2574 18.9959C11.1719 18.9986 11.0861 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11C19 11.0599 18.9993 11.1196 18.998 11.1791L16.9574 10.2813C16.6023 7.3064 14.0705 5 11 5C7.68629 5 5 7.68629 5 11C5 14.191 7.49101 16.8002 10.6345 16.9891L11.2574 18.9959Z",fill:"currentColor"})]})})})},{label:"Trade Notification",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Crosshair cursor",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"oneclick",label:"One Click Trading",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20.9914 12.3966L18.9885 11.5954C18.7789 7.91769 15.7302 5 12 5C8.13401 5 5 8.13401 5 12C5 15.7302 7.91769 18.7789 11.5954 18.9885L12.3966 20.9914C12.2651 20.9971 12.1329 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 12.1329 20.9971 12.2651 20.9914 12.3966ZM11 11L21 15L19 17L22 20L20 22L17 19L15 21L11 11Z",fill:"currentColor"})})})})},{key:"theme",label:B==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.408 12.954-2.265-.756a.209.209 0 0 1 0-.396l2.265-.755a.209.209 0 0 1 .276.198v1.51c0 .143-.14.244-.276.198ZM5.959 7.306 4.89 5.17c-.09-.18.1-.37.28-.28l2.136 1.068a.209.209 0 0 1 .054.334L6.293 7.36c-.1.101-.27.074-.334-.054ZM11.802 21.857l-.755-2.265a.209.209 0 0 1 .198-.276h1.51c.143 0 .244.14.198.276l-.755 2.265a.21.21 0 0 1-.396 0ZM11.802 2.143l-.755 2.265a.209.209 0 0 0 .198.276h1.51c.143 0 .244-.14.198-.276l-.755-2.265a.209.209 0 0 0-.396 0ZM18.83 19.11l-2.137-1.068a.209.209 0 0 1-.054-.335l1.068-1.068c.1-.1.27-.073.334.055l1.069 2.136c.09.18-.101.37-.28.28ZM16.693 5.958 18.83 4.89c.18-.09.37.1.28.28l-1.068 2.136a.209.209 0 0 1-.334.054l-1.068-1.068a.209.209 0 0 1 .054-.334ZM4.89 18.83l1.069-2.136a.209.209 0 0 1 .334-.055l1.068 1.068c.101.101.074.271-.054.335L5.171 19.11c-.18.09-.37-.1-.28-.28ZM21.857 12.198l-2.265.755a.209.209 0 0 1-.276-.198v-1.51c0-.143.14-.244.276-.198l2.265.755a.21.21 0 0 1 0 .396Z",fill:"#FEBC5A"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fillRule:"evenodd",d:"M20.775 8.992C20.922 9.638 21 10.31 21 11a8.354 8.354 0 0 0-.787 0c-1.467.072-2.422.564-3.082 1.283l-1.18-1.65c.761-.718 1.697-1.205 2.81-1.452A7 7 0 1 0 12 18c.396-.001.565-.082.63-.12.07-.042.17-.124.295-.34.218-.375.36-.835.534-1.49l1.518 1.822C14.485 19.102 13.705 20 12 20a9 9 0 1 1 8.775-11.008Z","clip-rule":"evenodd",fill:"currentColor"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M13.892 14.693c-2.034.46-2.59-1.07-2.892-4.693 3.85.352 5.232 1.05 4.697 3.012L20 17.192s.038 1.023-.361 1.447c-.463.49-1.687.361-1.687.361l-4.06-4.307Z",fill:"currentColor"})]})})}),submenu:[{label:"Green & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#26a69a"})]})})})},{label:"Blue & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#578cf2"})]})})})},{label:"Black & White",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#76ac85"})]})})})}]},{key:"lang",label:"Language",rightText:"EN",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.9 17.39C17.64 16.59 16.89 16 16 16H15V13C15 12.4477 14.5523 12 14 12H8V10H10C10.5523 10 11 9.55228 11 9V7H13C14.1046 7 15 6.10457 15 5V4.59C17.93 5.77 20 8.64 20 12C20 14.08 19.2 15.97 17.9 17.39ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.78 4.21 10.21L9 15V16C9 17.1046 9.89543 18 11 18V19.93ZM12 2C6.47715 2 2 6.47715 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C6.8043 20.9464 9.34784 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z",fill:"currentColor"})})})}),submenu:[{label:"English",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Arabic",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Bulgarian",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 18H13V16H11V18ZM12 6C9.79 6 8 7.79 8 10H10C10 8.9 10.9 8 12 8C13.1 8 14 8.9 14 10C14 12 11 11.75 11 15H13C13 12.75 16 12.5 16 10C16 7.79 14.21 6 12 6Z",fill:"currentColor"})})})})},{key:"contact",label:"Contact us",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M5 4C3.89543 4 3 4.89543 3 6V15C3 16.1046 3.89543 17 5 17H5.98719L6 21L13 17H19C20.1046 17 21 16.1046 21 15V6C21 4.89543 20.1046 4 19 4H5ZM6 6H18C18.5128 6 18.9355 6.38604 18.9933 6.88338L19 7V14C19 14.5128 18.614 14.9355 18.1166 14.9933L18 15H12.5339C12.4234 15 12.314 15.0183 12.21 15.0539L12.108 15.0952L8 17.0289V16C8 15.4872 7.61396 15.0645 7.11662 15.0067L7 15H6C5.48716 15 5.06449 14.614 5.00673 14.1166L5 14V7C5 6.48716 5.38604 6.06449 5.88338 6.00673L6 6Z",fillRule:"evenodd","clip-rule":"evenodd",fill:"currentColor"})})})})},{key:"about",label:"About program",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],rt=({item:ke})=>{const me=!!ke.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Ne.current&&(clearTimeout(Ne.current),Ne.current=null),me&&L(ke.key)},onMouseLeave:()=>{me&&(Ne.current=setTimeout(()=>L(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{me?L(ge=>ge===ke.key?null:ke.key):(ke.key==="theme"&&S(ge=>ge==="light"?"dark":"light"),k(!1),L(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:ke.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:ke.label}),ke.rightText&&a.jsx("span",{className:`text-xs ${Ge?"text-slate-500":"text-slate-400"}`,children:ke.rightText}),me&&a.jsx("svg",{className:`w-4 h-4 ${Ge?"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"})})]}),me&&R===ke.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 ${Ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:ke.submenu.map((ge,He)=>{const _e=Te[ke.key]===ge.label||ge.selected&&Te[ke.key]==null;return a.jsxs("button",{type:"button",onClick:()=>{Ue(Fe=>({...Fe,[ke.key]:ge.label}))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:ge.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:ge.label}),_e&&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"})})})]},He)})})})]})},Ge=B==="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 ${Ge?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:Je.map((ke,me)=>{const ge=ke==="gann",He=ge?null:ye[ke],_e=ge?-1:ke;return a.jsxs(ie.Fragment,{children:[_e===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Fe=Er[$].toolId;r(A===Fe?null:Fe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
- ${A===Er[$].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Er[$].label,children:Er[$].icon}),a.jsx("span",{onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),onMouseDown:Fe=>{Fe.stopPropagation(),te(Ke=>Ke==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:Ae?10:7,height:Ae?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:Ge?"#64748b":"#94a3b8"})})})]}):_e===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Fe=Lr[le].toolId;r(A===Fe?null:Fe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
- ${A===Lr[le].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Lr[le].label,children:Lr[le].icon}),a.jsx("span",{onMouseEnter:()=>oe(!0),onMouseLeave:()=>oe(!1),onMouseDown:Fe=>{Fe.stopPropagation(),te(Ke=>Ke==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:j?10:7,height:j?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:Ge?"#64748b":"#94a3b8"})})})]}):ge?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Fe=Mr[ae].toolId;r(A===Fe?null:Fe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
- ${A===Mr[ae].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Mr[ae].label,children:Mr[ae].icon}),a.jsx("span",{onMouseEnter:()=>de(!0),onMouseLeave:()=>de(!1),onMouseDown:Fe=>{Fe.stopPropagation(),te(Ke=>Ke==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:ce?10:7,height:ce?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:Ge?"#64748b":"#94a3b8"})})})]}):_e===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Fe=Hr[we].toolId;r(A===Fe?null:Fe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
- ${A===Hr[we].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Hr[we].label,children:Hr[we].icon}),a.jsx("span",{onMouseEnter:()=>Ce(!0),onMouseLeave:()=>Ce(!1),onMouseDown:Fe=>{Fe.stopPropagation(),te(Ke=>Ke==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Se?10:7,height:Se?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:Ge?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>pe(_e),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
- ${He.label==="Grid"&&n||He.label==="Eye"&&!m||He.label==="Lock"&&v||A===_e?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${He.label}: ${He.description}`,children:He.icon}),!ge&&He.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${Ge?"border-slate-200":"border-slate-700"}`})]},ge?"gann-slot":`${He.label}-${ke}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:Pe.map((ke,me)=>{const ge=12+me;return a.jsx("button",{onClick:()=>pe(ge),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
- ${ke.label==="Grid"&&n||ke.label==="Eye"&&!m||ke.label==="Lock"&&v||A===ge?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${ke.label}: ${ke.description}`,children:ke.icon},ke.label)})})]}),z==="line"&&a.jsx(Cs,{top:84,panelRef:Ie,isLight:Ge,children:Er.map((ke,me)=>{const ge=$===me;return a.jsxs("button",{type:"button",onMouseDown:He=>{He.stopPropagation(),V(me),r(ke.toolId),te(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:ke.icon}),a.jsx("span",{className:"flex-1",children:ke.label}),ge&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ke.toolId)})}),z==="channel"&&a.jsx(Cs,{top:128,panelRef:Ze,isLight:Ge,children:Lr.map((ke,me)=>{const ge=le===me;return a.jsxs("button",{type:"button",onMouseDown:He=>{He.stopPropagation(),X(me),r(ke.toolId),te(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:ke.icon}),a.jsx("span",{className:"flex-1",children:ke.label}),ge&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ke.toolId)})}),z==="gann"&&a.jsx(Cs,{top:210,panelRef:ze,isLight:Ge,children:Mr.map((ke,me)=>{const ge=ae===me;return a.jsxs("button",{type:"button",onMouseDown:He=>{He.stopPropagation(),se(me),r(ke.toolId),te(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:ke.icon}),a.jsx("span",{className:"flex-1",children:ke.label}),ge&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ke.toolId)})}),z==="shape"&&a.jsx(Cs,{top:250,panelRef:ve,isLight:Ge,children:Hr.map((ke,me)=>{const ge=we===me;return a.jsxs("button",{type:"button",onMouseDown:He=>{He.stopPropagation(),Qe(me),r(ke.toolId),te(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:ke.icon}),a.jsx("span",{className:"flex-1",children:ke.label}),ge&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ke.toolId)})}),U&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{k(!1),L(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:Ee,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${Ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Ge?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${Ge?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),a.jsx("div",{className:`text-[12px] mt-0.5 ${Ge?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:it.map(ke=>a.jsx(rt,{item:ke},ke.key))})]})]})]})};function mT(i){return zt({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"},BT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},yT={binance:"CRYPTO"},CT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Lt(),o=s==="light",[l,c]=ie.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),m=ie.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 U=T.indexOf(S),k=T.indexOf(F);return U!==-1&&k!==-1?U-k:U!==-1?-1:k!==-1?1:S.localeCompare(F)}).map(S=>({category:S,symbols:v[S]}))},[u]),y=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(pT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(dT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(xm,{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
+ }`,zC=function(i){WC(i,"."+Ha+KC+bd+`
10
+ .`+Ia+VC+bd)},WC=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Qd=(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})(),RC=(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)||(_a(e)||ZC(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 Wt(this,void 0,void 0,function(){var t,A,r,n,s=this;return kt(this,function(o){switch(o.label){case 0:return t=Qd.isSameOrigin(e),A=!Da(e)&&this._options.useCORS===!0&&Dt.SUPPORT_CORS_IMAGES&&!t,r=!Da(e)&&!t&&!_a(e)&&typeof this._options.proxy=="string"&&Dt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Da(e)&&!_a(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,(JC(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=Dt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var m=new FileReader;m.addEventListener("load",function(){return n(m.result)},!1),m.addEventListener("error",function(y){return s(y)},!1),m.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),GC=/^data:image\/svg\+xml/i,$C=/^data:image\/.*;base64,/i,XC=/^data:image\/.*/i,ZC=function(i){return Dt.SUPPORT_SVG_DRAWING||!YC(i)},Da=function(i){return XC.test(i)},JC=function(i){return $C.test(i)},_a=function(i){return i.substr(0,4)==="blob"},YC=function(i){return i.substr(-3).toLowerCase()==="svg"||GC.test(i)},_e=(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})(),ki=function(i,e,t){return new _e(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},gs=(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=ki(this.start,this.startControl,e),r=ki(this.startControl,this.endControl,e),n=ki(this.endControl,this.end,e),s=ki(A,r,e),o=ki(r,n,e),l=ki(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})(),dA=function(i){return i.type===1},qC=(function(){function i(e){var t=e.styles,A=e.bounds,r=br(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=br(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=br(t.borderBottomRightRadius,A.width,A.height),m=u[0],y=u[1],v=br(t.borderBottomLeftRadius,A.width,A.height),T=v[0],C=v[1],U=[];U.push((n+l)/A.width),U.push((T+m)/A.width),U.push((s+C)/A.height),U.push((c+y)/A.height);var F=Math.max.apply(Math,U);F>1&&(n/=F,s/=F,l/=F,c/=F,m/=F,y/=F,T/=F,C/=F);var E=A.width-l,N=A.height-y,R=A.width-m,M=A.height-C,z=t.borderTopWidth,Ae=t.borderRightWidth,$=t.borderBottomWidth,V=t.borderLeftWidth,ie=ft(t.paddingTop,e.bounds.width),re=ft(t.paddingRight,e.bounds.width),ce=ft(t.paddingBottom,e.bounds.width),Z=ft(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?wt(A.left+V/3,A.top+z/3,n-V/3,s-z/3,ct.TOP_LEFT):new _e(A.left+V/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?wt(A.left+E,A.top+z/3,l-Ae/3,c-z/3,ct.TOP_RIGHT):new _e(A.left+A.width-Ae/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||y>0?wt(A.left+R,A.top+N,m-Ae/3,y-$/3,ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae/3,A.top+A.height-$/3),this.bottomLeftBorderDoubleOuterBox=T>0||C>0?wt(A.left+V/3,A.top+M,T-V/3,C-$/3,ct.BOTTOM_LEFT):new _e(A.left+V/3,A.top+A.height-$/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?wt(A.left+V*2/3,A.top+z*2/3,n-V*2/3,s-z*2/3,ct.TOP_LEFT):new _e(A.left+V*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?wt(A.left+E,A.top+z*2/3,l-Ae*2/3,c-z*2/3,ct.TOP_RIGHT):new _e(A.left+A.width-Ae*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||y>0?wt(A.left+R,A.top+N,m-Ae*2/3,y-$*2/3,ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae*2/3,A.top+A.height-$*2/3),this.bottomLeftBorderDoubleInnerBox=T>0||C>0?wt(A.left+V*2/3,A.top+M,T-V*2/3,C-$*2/3,ct.BOTTOM_LEFT):new _e(A.left+V*2/3,A.top+A.height-$*2/3),this.topLeftBorderStroke=n>0||s>0?wt(A.left+V/2,A.top+z/2,n-V/2,s-z/2,ct.TOP_LEFT):new _e(A.left+V/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?wt(A.left+E,A.top+z/2,l-Ae/2,c-z/2,ct.TOP_RIGHT):new _e(A.left+A.width-Ae/2,A.top+z/2),this.bottomRightBorderStroke=m>0||y>0?wt(A.left+R,A.top+N,m-Ae/2,y-$/2,ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae/2,A.top+A.height-$/2),this.bottomLeftBorderStroke=T>0||C>0?wt(A.left+V/2,A.top+M,T-V/2,C-$/2,ct.BOTTOM_LEFT):new _e(A.left+V/2,A.top+A.height-$/2),this.topLeftBorderBox=n>0||s>0?wt(A.left,A.top,n,s,ct.TOP_LEFT):new _e(A.left,A.top),this.topRightBorderBox=l>0||c>0?wt(A.left+E,A.top,l,c,ct.TOP_RIGHT):new _e(A.left+A.width,A.top),this.bottomRightBorderBox=m>0||y>0?wt(A.left+R,A.top+N,m,y,ct.BOTTOM_RIGHT):new _e(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=T>0||C>0?wt(A.left,A.top+M,T,C,ct.BOTTOM_LEFT):new _e(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?wt(A.left+V,A.top+z,Math.max(0,n-V),Math.max(0,s-z),ct.TOP_LEFT):new _e(A.left+V,A.top+z),this.topRightPaddingBox=l>0||c>0?wt(A.left+Math.min(E,A.width-Ae),A.top+z,E>A.width+Ae?0:Math.max(0,l-Ae),Math.max(0,c-z),ct.TOP_RIGHT):new _e(A.left+A.width-Ae,A.top+z),this.bottomRightPaddingBox=m>0||y>0?wt(A.left+Math.min(R,A.width-V),A.top+Math.min(N,A.height-$),Math.max(0,m-Ae),Math.max(0,y-$),ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae,A.top+A.height-$),this.bottomLeftPaddingBox=T>0||C>0?wt(A.left+V,A.top+Math.min(M,A.height-$),Math.max(0,T-V),Math.max(0,C-$),ct.BOTTOM_LEFT):new _e(A.left+V,A.top+A.height-$),this.topLeftContentBox=n>0||s>0?wt(A.left+V+Z,A.top+z+ie,Math.max(0,n-(V+Z)),Math.max(0,s-(z+ie)),ct.TOP_LEFT):new _e(A.left+V+Z,A.top+z+ie),this.topRightContentBox=l>0||c>0?wt(A.left+Math.min(E,A.width+V+Z),A.top+z+ie,E>A.width+V+Z?0:l-V+Z,c-(z+ie),ct.TOP_RIGHT):new _e(A.left+A.width-(Ae+re),A.top+z+ie),this.bottomRightContentBox=m>0||y>0?wt(A.left+Math.min(R,A.width-(V+Z)),A.top+Math.min(N,A.height+z+ie),Math.max(0,m-(Ae+re)),y-($+ce),ct.BOTTOM_RIGHT):new _e(A.left+A.width-(Ae+re),A.top+A.height-($+ce)),this.bottomLeftContentBox=T>0||C>0?wt(A.left+V+Z,A.top+M,Math.max(0,T-(V+Z)),C-($+ce),ct.BOTTOM_LEFT):new _e(A.left+V+Z,A.top+A.height-($+ce))}return i})(),ct;(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"})(ct||(ct={}));var wt=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 ct.TOP_LEFT:return new gs(new _e(i,c),new _e(i,c-o),new _e(l-s,e),new _e(l,e));case ct.TOP_RIGHT:return new gs(new _e(i,e),new _e(i+s,e),new _e(l,c-o),new _e(l,c));case ct.BOTTOM_RIGHT:return new gs(new _e(l,e),new _e(l,e+o),new _e(i+s,c),new _e(i,c));case ct.BOTTOM_LEFT:default:return new gs(new _e(l,c),new _e(l-s,c),new _e(i,e+o),new _e(i,e))}},ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},jC=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},ws=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},ev=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),Bs=(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})(),Av=function(i){return i.type===0},Fd=function(i){return i.type===1},iv=function(i){return i.type===2},Ud=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},rv=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})},Sd=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Ed=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new qC(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 ev(A,r,n))}if(this.container.styles.overflowX!==0){var s=ms(this.curves),o=ws(this.curves);Ud(s,o)?this.effects.push(new Bs(s,6)):(this.effects.push(new Bs(s,2)),this.effects.push(new Bs(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!Fd(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=ws(A.curves);Ud(s,o)||r.unshift(new Bs(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return Ut(l.target,e)})},i})(),Pa=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Ut(r.flags,4),s=Ut(r.flags,2),o=new Ed(r,i);Ut(r.styles.display,2048)&&A.push(o);var l=Ut(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Sd(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var y=0;c.negativeZIndex.some(function(T,C){return m>T.element.container.styles.zIndex.order?(y=C,!1):y>0}),c.negativeZIndex.splice(y,0,u)}else if(m>0){var v=0;c.positiveZIndex.some(function(T,C){return m>=T.element.container.styles.zIndex.order?(v=C+1,!1):v>0}),c.positiveZIndex.splice(v,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Pa(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Pa(o,e,t,l);Ut(r.flags,8)&&Ld(r,l)})},Ld=function(i,e){for(var t=i instanceof Qa?i.start:1,A=i instanceof Qa?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Ad&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Lr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},nv=function(i){var e=new Ed(i,null),t=new Sd(e),A=[];return Pa(e,t,t,A),Ld(e.container,A),t},Md=function(i,e){switch(e){case 0:return pA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return pA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return pA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return pA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},sv=function(i,e){switch(e){case 0:return pA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return pA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return pA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return pA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},ov=function(i,e){switch(e){case 0:return pA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return pA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return pA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return pA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},av=function(i,e){switch(e){case 0:return ys(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return ys(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return ys(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return ys(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},ys=function(i,e){var t=[];return dA(i)?t.push(i.subdivide(.5,!1)):t.push(i),dA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},pA=function(i,e,t,A){var r=[];return dA(i)?r.push(i.subdivide(.5,!1)):r.push(i),dA(t)?r.push(t.subdivide(.5,!0)):r.push(t),dA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),dA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},Hd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},Cs=function(i){var e=i.styles,t=i.bounds,A=ft(e.paddingLeft,t.width),r=ft(e.paddingRight,t.width),n=ft(e.paddingTop,t.width),s=ft(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?Cs(e):Hd(e)},cv=function(i,e){return i===0?e.bounds:i===2?Cs(e):Hd(e)},Na=function(i,e,t){var A=lv(Ki(i.styles.backgroundOrigin,e),i),r=cv(Ki(i.styles.backgroundClip,e),i),n=hv(Ki(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=br(Ki(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=uv(Ki(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),m=Math.round(A.top+l[1]);return[c,u,m,s,o]},Oi=function(i){return ut(i)&&i.value===Di.AUTO},vs=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(Ft(s)&&o&&Ft(o))return[ft(s,t.width),ft(o,t.height)];var l=vs(n);if(ut(s)&&(s.value===Di.CONTAIN||s.value===Di.COVER)){if(vs(n)){var c=t.width/t.height;return c<n!=(s.value===Di.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=vs(A),m=vs(r),y=u||m;if(Oi(s)&&(!o||Oi(o))){if(u&&m)return[A,r];if(!l&&!y)return[t.width,t.height];if(y&&l){var v=u?A:r*n,T=m?r:A/n;return[v,T]}var C=u?A:t.width,U=m?r:t.height;return[C,U]}if(l){var F=0,E=0;return Ft(s)?F=ft(s,t.width):Ft(o)&&(E=ft(o,t.height)),Oi(s)?F=E*n:(!o||Oi(o))&&(E=F/n),[F,E]}var N=null,R=null;if(Ft(s)?N=ft(s,t.width):o&&Ft(o)&&(R=ft(o,t.height)),N!==null&&(!o||Oi(o))&&(R=u&&m?N/A*r:t.height),R!==null&&Oi(s)&&(N=u&&m?R/r*A:t.width),N!==null&&R!==null)return[N,R];throw new Error("Unable to calculate background-size for element")},Ki=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},uv=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 _e(Math.round(A.left),Math.round(A.top+s)),new _e(Math.round(A.left+A.width),Math.round(A.top+s)),new _e(Math.round(A.left+A.width),Math.round(l+A.top+s)),new _e(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new _e(Math.round(A.left+n),Math.round(A.top)),new _e(Math.round(A.left+n+o),Math.round(A.top)),new _e(Math.round(A.left+n+o),Math.round(A.height+A.top)),new _e(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new _e(Math.round(A.left+n),Math.round(A.top+s)),new _e(Math.round(A.left+n+o),Math.round(A.top+s)),new _e(Math.round(A.left+n+o),Math.round(A.top+s+l)),new _e(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new _e(Math.round(r.left),Math.round(r.top)),new _e(Math.round(r.left+r.width),Math.round(r.top)),new _e(Math.round(r.left+r.width),Math.round(r.height+r.top)),new _e(Math.round(r.left),Math.round(r.height+r.top))]}},dv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Id="Hidden Text",pv=(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(Id)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Id)),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})(),Dd=(function(){function i(e,t){this.context=e,this.options=t}return i})(),fv=1e4,gv=(function(i){BA(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 pv(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(),iv(t)&&(this.ctx.globalAlpha=t.opacity),Av(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)),Fd(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 Wt(this,void 0,void 0,function(){var A;return kt(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 Wt(this,void 0,void 0,function(){return kt(this,function(A){switch(A.label){case 0:if(Ut(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=ba(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=Cv(t.fontFamily).join(", "),n=xr(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 Wt(this,void 0,void 0,function(){var r,n,s,o,l,c,u,m,y=this;return kt(this,function(v){return r=this.createFontStyle(A),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,u=l.middle,m=A.paintOrder,t.textBounds.forEach(function(T){m.forEach(function(C){switch(C){case 0:y.ctx.fillStyle=Et(A.color),y.renderTextWithLetterSpacing(T,A.letterSpacing,c);var U=A.textShadow;U.length&&T.text.trim().length&&(U.slice(0).reverse().forEach(function(F){y.ctx.shadowColor=Et(F.color),y.ctx.shadowOffsetX=F.offsetX.number*y.options.scale,y.ctx.shadowOffsetY=F.offsetY.number*y.options.scale,y.ctx.shadowBlur=F.blur.number,y.renderTextWithLetterSpacing(T,A.letterSpacing,c)}),y.ctx.shadowColor="",y.ctx.shadowOffsetX=0,y.ctx.shadowOffsetY=0,y.ctx.shadowBlur=0),A.textDecorationLine.length&&(y.ctx.fillStyle=Et(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top+c),T.bounds.width,1);break;case 2:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top),T.bounds.width,1);break;case 3:y.ctx.fillRect(T.bounds.left,Math.ceil(T.bounds.top+u),T.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&T.text.trim().length&&(y.ctx.strokeStyle=Et(A.webkitTextStrokeColor),y.ctx.lineWidth=A.webkitTextStrokeWidth,y.ctx.lineJoin=window.chrome?"miter":"round",y.ctx.strokeText(T.text,T.bounds.left,T.bounds.top+c)),y.ctx.strokeStyle="",y.ctx.lineWidth=0,y.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=Cs(t),s=ws(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 Wt(this,void 0,void 0,function(){var A,r,n,s,o,l,E,E,c,u,m,y,R,v,T,M,C,U,F,E,N,R,M;return kt(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 ju))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 ed&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof td))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 sd&&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 Fa&&(m=Math.min(A.bounds.width,A.bounds.height),A.type===cs?A.checked&&(this.ctx.save(),this.path([new _e(A.bounds.left+m*.39363,A.bounds.top+m*.79),new _e(A.bounds.left+m*.16,A.bounds.top+m*.5549),new _e(A.bounds.left+m*.27347,A.bounds.top+m*.44071),new _e(A.bounds.left+m*.39694,A.bounds.top+m*.5649),new _e(A.bounds.left+m*.72983,A.bounds.top+m*.23),new _e(A.bounds.left+m*.84,A.bounds.top+m*.34085),new _e(A.bounds.left+m*.39363,A.bounds.top+m*.79)]),this.ctx.fillStyle=Et(id),this.ctx.fill(),this.ctx.restore()):A.type===hs&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+m/2,A.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Et(id),this.ctx.fill(),this.ctx.restore())),mv(A)&&A.value.length){switch(y=this.createFontStyle(n),R=y[0],v=y[1],T=this.fontMetrics.getMetrics(R,v).baseline,this.ctx.font=R,this.ctx.fillStyle=Et(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Bv(A.styles.textAlign),M=Cs(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 _e(M.left,M.top),new _e(M.left+M.width,M.top),new _e(M.left+M.width,M.top+M.height),new _e(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Sr(A.value,U),n.letterSpacing,T),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ut(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(F=A.styles.listStyleImage,F.type!==0)return[3,18];E=void 0,N=F.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return E=z.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.bounds.top),[3,18];case 17:return z.sent(),this.context.logger.error("Error loading list-style-image "+N),[3,18];case 18:return[3,20];case 19:t.listValue&&A.styles.listStyleType!==-1&&(R=this.createFontStyle(n)[0],this.ctx.font=R,this.ctx.fillStyle=Et(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new NA(A.bounds.left,A.bounds.top+ft(A.styles.paddingTop,A.bounds.width),A.bounds.width,Iu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Sr(t.listValue,M),n.letterSpacing,Iu(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 Wt(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,m,y,F,v,T,F,C,U,F;return kt(this,function(E){switch(E.label){case 0:if(Ut(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:E.sent(),A=0,r=t.negativeZIndex,E.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:E.sent(),E.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:E.sent(),n=0,s=t.nonInlineLevel,E.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:E.sent(),E.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,E.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,E.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:m=0,y=t.inlineLevel,E.label=19;case 19:return m<y.length?(F=y[m],[4,this.renderNode(F)]):[3,22];case 20:E.sent(),E.label=21;case 21:return m++,[3,19];case 22:v=0,T=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return v<T.length?(F=T[v],[4,this.renderStack(F)]):[3,26];case 24:E.sent(),E.label=25;case 25:return v++,[3,23];case 26:C=0,U=t.positiveZIndex,E.label=27;case 27:return C<U.length?(F=U[C],[4,this.renderStack(F)]):[3,30];case 28:E.sent(),E.label=29;case 29:return C++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var A=this;t.forEach(function(r,n){var s=dA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),dA(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 Wt(this,void 0,void 0,function(){var A,r,n,s,o,l;return kt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var m,y,v,ie,le,se,Z,ee,$,T,ie,le,se,Z,ee,C,U,F,E,N,R,M,z,Ae,$,V,ie,re,ce,Z,ee,oe,le,se,he,pe,ge,be,Ee,ye,Ce,Fe;return kt(this,function(Ue){switch(Ue.label){case 0:if(u.type!==0)return[3,5];m=void 0,y=u.url,Ue.label=1;case 1:return Ue.trys.push([1,3,,4]),[4,n.context.cache.match(y)];case 2:return m=Ue.sent(),[3,4];case 3:return Ue.sent(),n.context.logger.error("Error loading background-image "+y),[3,4];case 4:return m&&(v=Na(t,A,[m.width,m.height,m.width/m.height]),ie=v[0],le=v[1],se=v[2],Z=v[3],ee=v[4],$=n.ctx.createPattern(n.resizeImage(m,Z,ee),"repeat"),n.renderRepeat(ie,$,le,se)),[3,6];case 5:A2(u)?(T=Na(t,A,[null,null,null]),ie=T[0],le=T[1],se=T[2],Z=T[3],ee=T[4],C=YB(u.angle,Z,ee),U=C[0],F=C[1],E=C[2],N=C[3],R=C[4],M=document.createElement("canvas"),M.width=Z,M.height=ee,z=M.getContext("2d"),Ae=z.createLinearGradient(F,N,E,R),Tu(u.stops,U).forEach(function(Ne){return Ae.addColorStop(Ne.stop,Et(Ne.color))}),z.fillStyle=Ae,z.fillRect(0,0,Z,ee),Z>0&&ee>0&&($=n.ctx.createPattern(M,"repeat"),n.renderRepeat(ie,$,le,se))):i2(u)&&(V=Na(t,A,[null,null,null]),ie=V[0],re=V[1],ce=V[2],Z=V[3],ee=V[4],oe=u.position.length===0?[ca]:u.position,le=ft(oe[0],Z),se=ft(oe[oe.length-1],ee),he=qB(u,le,se,Z,ee),pe=he[0],ge=he[1],pe>0&&ge>0&&(be=n.ctx.createRadialGradient(re+le,ce+se,0,re+le,ce+se,pe),Tu(u.stops,pe*2).forEach(function(Ne){return be.addColorStop(Ne.stop,Et(Ne.color))}),n.path(ie),n.ctx.fillStyle=be,pe!==ge?(Ee=t.bounds.left+.5*t.bounds.width,ye=t.bounds.top+.5*t.bounds.height,Ce=ge/pe,Fe=1/Ce,n.ctx.save(),n.ctx.translate(Ee,ye),n.ctx.transform(1,0,0,Ce,0,0),n.ctx.translate(-Ee,-ye),n.ctx.fillRect(re,Fe*(ce-ye)+ye,Z,ee*Fe),n.ctx.restore()):n.ctx.fill())),Ue.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 Wt(this,void 0,void 0,function(){return kt(this,function(n){return this.path(Md(r,A)),this.ctx.fillStyle=Et(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return Wt(this,void 0,void 0,function(){var s,o;return kt(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=sv(n,r),this.path(s),this.ctx.fillStyle=Et(t),this.ctx.fill(),o=ov(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Wt(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,m=this;return kt(this,function(y){switch(y.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!YA(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=wv(Ki(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),YA(A.backgroundColor)||(this.ctx.fillStyle=Et(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:y.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){m.ctx.save();var T=ms(t.curves),C=v.inset?0:fv,U=rv(T,-C+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(m.path(T),m.ctx.clip(),m.mask(U)):(m.mask(T),m.ctx.clip(),m.path(U)),m.ctx.shadowOffsetX=v.offsetX.number+C,m.ctx.shadowOffsetY=v.offsetY.number,m.ctx.shadowColor=Et(v.color),m.ctx.shadowBlur=v.blur.number,m.ctx.fillStyle=v.inset?Et(v.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),y.label=2;case 2:o=0,l=0,c=n,y.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!YA(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return y.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return y.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return y.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:y.sent(),y.label=11;case 11:o++,y.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return Wt(this,void 0,void 0,function(){var o,l,c,u,m,y,v,T,C,U,F,E,N,R,M,z,M,z;return kt(this,function(Ae){return this.ctx.save(),o=av(n,r),l=Md(n,r),s===2&&(this.path(l),this.ctx.clip()),dA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),dA(l[1])?(m=l[1].end.x,y=l[1].end.y):(m=l[1].x,y=l[1].y),r===0||r===2?v=Math.abs(c-m):v=Math.abs(u-y),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),T=A<3?A*3:A*2,C=A<3?A*2:A,s===3&&(T=A,C=A),U=!0,v<=T*2?U=!1:v<=T*2+C?(F=v/(2*T+C),T*=F,C*=F):(E=Math.floor((v+C)/(T+C)),N=(v-E*T)/(E-1),R=(v-(E+1)*T)/E,C=R<=0||Math.abs(C-N)<Math.abs(C-R)?N:R),U&&(s===3?this.ctx.setLineDash([0,T+C]):this.ctx.setLineDash([T,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=Et(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(dA(l[0])&&(M=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new _e(M.end.x,M.end.y),new _e(z.start.x,z.start.y)]),this.ctx.stroke()),dA(l[1])&&(M=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new _e(M.end.x,M.end.y),new _e(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Wt(this,void 0,void 0,function(){var A;return kt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Et(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=nv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Dd),mv=function(i){return i instanceof nd||i instanceof rd?!0:i instanceof Fa&&i.type!==hs&&i.type!==cs},wv=function(i,e){switch(i){case 0:return ms(e);case 2:return jC(e);default:return ws(e)}},Bv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},yv=["-apple-system","system-ui"],Cv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return yv.indexOf(e)===-1}):i},vv=(function(i){BA(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 Wt(this,void 0,void 0,function(){var A,r;return kt(this,function(n){switch(n.label){case 0:return A=xa(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Tv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Et(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})(Dd),Tv=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))})},xv=(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,En([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,En([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,En([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,En([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),bv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new xv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new RC(this,e)}return i.instanceCount=1,i})(),Qv=function(i,e){return e===void 0&&(e={}),Fv(i,e)};typeof window<"u"&&Qd.setContext(window);var Fv=function(i,e){return Wt(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,m,y,v,T,C,U,F,E,N,R,M,Ae,z,Ae,$,V,ie,re,ce,Z,ee,oe,le,se,he,pe,ge,be,Ee,ye,Ce;return kt(this,function(Fe){switch(Fe.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:($=e.allowTaint)!==null&&$!==void 0?$:!1,imageTimeout:(V=e.imageTimeout)!==null&&V!==void 0?V:15e3,proxy:e.proxy,useCORS:(ie=e.useCORS)!==null&&ie!==void 0?ie:!1},n=zo({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:(ee=e.scrollX)!==null&&ee!==void 0?ee:A.pageXOffset,scrollY:(oe=e.scrollY)!==null&&oe!==void 0?oe:A.pageYOffset},o=new NA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new bv(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),m=new xd(l,i,u),y=m.clonedReferenceElement,y?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=Fe.sent(),T=Sa(y)||UC(y)?rw(y.ownerDocument):Ln(l,y),C=T.width,U=T.height,F=T.left,E=T.top,N=Uv(l,y,e.backgroundColor),R={canvas:e.canvas,backgroundColor:N,scale:(pe=(he=e.scale)!==null&&he!==void 0?he:A.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((ge=e.x)!==null&&ge!==void 0?ge:0)+F,y:((be=e.y)!==null&&be!==void 0?be:0)+E,width:(Ee=e.width)!==null&&Ee!==void 0?Ee:Math.ceil(C),height:(ye=e.height)!==null&&ye!==void 0?ye:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),Ae=new vv(l,R),[4,Ae.render(y)]):[3,3];case 2:return M=Fe.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+E+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=ad(l,y),N===z.styles.backgroundColor&&(z.styles.backgroundColor=OA.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),Ae=new gv(l,R),[4,Ae.render(z)];case 4:M=Fe.sent(),Fe.label=5;case 5:return(!((Ce=e.removeContainer)!==null&&Ce!==void 0)||Ce)&&(xd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Uv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Qr(i,getComputedStyle(A.documentElement).backgroundColor):OA.TRANSPARENT,n=A.body?Qr(i,getComputedStyle(A.body).backgroundColor):OA.TRANSPARENT,s=typeof t=="string"?Qr(i,t):t===null?OA.TRANSPARENT:4294967295;return e===A.documentElement?YA(r)?YA(n)?s:n:r:s};const Sv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class Ev{constructor(e,t,A="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=r,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=o.context,c=n._chart,u=n._series;if(!c||!u)return;const m=u.priceToCoordinate(n.price);if(m==null)return;const y=Math.round(m*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),T=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(T>=C)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(T,y),l.lineTo(C,y),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(T,y,U,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class _d{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!A.visible||!A.text||!A._series)return;const c=A._series.priceToCoordinate(A.price);if(c==null)return;const u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),y=Math.round(14*l),v=s.width;let T;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);T=F!=null?Math.round(F*o):m,n.textAlign="right"}else T=m,n.textAlign="left";else A.hAlign==="right"?(T=v-m,n.textAlign="right"):(T=v/2,n.textAlign="center");const C=Math.round(c*l);let U;A.vAlign==="top"?U=C-y:A.vAlign==="bottom"?U=C+y:U=C,n.fillStyle=A.textColor,n.fillText(A.text,T,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Lv{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),N=Math.round(T*m),R=Math.round(U*y),M=l.context;if(M.save(),M.beginPath(),M.strokeStyle=s.color,M.lineWidth=s.lineWidth*y,M.setLineDash([]),M.moveTo(F,E),M.lineTo(N,R),M.stroke(),M.beginPath(),M.fillStyle=s.color,M.arc(F,E,3*y,0,Math.PI*2),M.fill(),M.beginPath(),M.arc(N,R,3*y,0,Math.PI*2),M.fill(),!s.statsShowAlways&&!s.isActive){M.restore();return}const{priceDiff:z,pricePct:Ae,bars:$,days:V,angle:ie}=s.info,re=z>=0?"+":"",ce=[];if(s.statsPriceRange!==!1&&ce.push(`${re}${z.toFixed(5)} (${re}${Ae.toFixed(2)}%)`),s.statsBarsRange!==!1&&ce.push(`${$} bars`),s.statsDateRange!==!1&&ce.push(`${V} days`),s.statsAngle!==!1&&ce.push(`∠ ${ie.toFixed(1)}°`),s.statsDistance&&ce.push(`Δ ${Math.abs(z).toFixed(5)}`),ce.length===0){M.restore();return}const Z=Math.round(11*y);M.font=`${Z}px sans-serif`;const ee=Z*1.6,oe=8*y,le=Math.max(...ce.map(Je=>M.measureText(Je).width))+oe*2,se=ce.length*ee+oe*2,he=s.statsPosition??"right";let pe,ge;he==="left"?(pe=F,ge=E):he==="center"?(pe=Math.round((F+N)/2),ge=Math.round((E+R)/2)):(pe=N,ge=R);let be,Ee;he==="left"?(be=pe-le-10*m,Ee=ge-se-4*y):he==="center"?(be=pe-le/2,Ee=ge-se-8*y):(be=pe+10*m,Ee=ge-se-4*y);const ye=l.bitmapSize.width,Ce=l.bitmapSize.height,Fe=Math.min(Math.max(0,be),ye-le-4*m),Ue=Math.min(Math.max(4*y,Ee),Ce-se-4*y),Ne=4*y;M.beginPath(),M.moveTo(Fe+Ne,Ue),M.lineTo(Fe+le-Ne,Ue),M.quadraticCurveTo(Fe+le,Ue,Fe+le,Ue+Ne),M.lineTo(Fe+le,Ue+se-Ne),M.quadraticCurveTo(Fe+le,Ue+se,Fe+le-Ne,Ue+se),M.lineTo(Fe+Ne,Ue+se),M.quadraticCurveTo(Fe,Ue+se,Fe,Ue+se-Ne),M.lineTo(Fe,Ue+Ne),M.quadraticCurveTo(Fe,Ue,Fe+Ne,Ue),M.closePath(),M.fillStyle="rgba(30, 41, 59, 0.92)",M.fill(),M.strokeStyle=s.statsColor||s.color,M.lineWidth=1*y,M.stroke(),M.fillStyle="#e2e8f0",M.textAlign="left",ce.forEach((Je,Ke)=>{M.fillText(Je,Fe+oe,Ue+oe+Z+Ke*ee)}),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 Pd{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),N=Math.round(T*m),R=Math.round(U*y),M=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,N),Math.min(E,R),Math.abs(N-F),Math.abs(R-E)),z.strokeStyle=M,z.lineWidth=1*y,z.setLineDash([]),z.strokeRect(Math.min(F,N),Math.min(E,R),Math.abs(N-F),Math.abs(R-E))),z.beginPath(),z.strokeStyle=M,z.lineWidth=2*y,z.moveTo(F,E),z.lineTo(N,R),z.stroke(),z.fillStyle=M,z.beginPath(),z.arc(F,E,3*y,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(N,R,3*y,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:Ae,pricePct:$,bars:V,days:ie}=s.info,re=Ae>=0?"+":"",ce=[];if(s.statsPriceRange&&ce.push(re+Ae.toFixed(5)+" ("+re+$.toFixed(2)+"%)"),s.statsBarsRange&&ce.push(V+" bars"),s.statsDateRange&&ce.push(ie+" days"),ce.length===0){z.restore();return}const Z=Math.round(11*y);z.font=Z+"px sans-serif";const ee=Z*1.6,oe=8*y,le=Math.max(...ce.map(Fe=>z.measureText(Fe).width))+oe*2,se=ce.length*ee+oe*2,he=l.bitmapSize.width,pe=l.bitmapSize.height;let ge,be;if(s.statsPosition==="left")ge=F-le-10*m,be=E-se-4*y;else if(s.statsPosition==="center"){const Fe=(F+N)/2,Ue=(E+R)/2;ge=Fe-le/2,be=Ue-se-4*y}else ge=N+10*m,be=R-se-4*y;const Ee=Math.min(Math.max(0,ge),he-le-4*m),ye=Math.min(Math.max(4*y,be),pe-se-4*y),Ce=4*y;z.beginPath(),z.moveTo(Ee+Ce,ye),z.lineTo(Ee+le-Ce,ye),z.quadraticCurveTo(Ee+le,ye,Ee+le,ye+Ce),z.lineTo(Ee+le,ye+se-Ce),z.quadraticCurveTo(Ee+le,ye+se,Ee+le-Ce,ye+se),z.lineTo(Ee+Ce,ye+se),z.quadraticCurveTo(Ee,ye+se,Ee,ye+se-Ce),z.lineTo(Ee,ye+Ce),z.quadraticCurveTo(Ee,ye,Ee+Ce,ye),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||M,z.lineWidth=1*y,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",ce.forEach((Fe,Ue)=>{z.fillText(Fe,Ee+oe,ye+oe+Z+Ue*ee)}),z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Mv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.fillColor=A.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.min(m,y)*c,U=Math.max(m,y)*c,F=Math.min(v,T)*u,E=Math.max(v,T)*u,N=U-C,R=E-F;if(N<.5||R<.5)return;const M=s.context;M.save(),M.fillStyle=r.fillColor,M.fillRect(C,F,N,R),M.strokeStyle=r.strokeColor,M.lineWidth=r.lineWidth*u,M.setLineDash([]),M.strokeRect(C,F,N,R),M.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Hv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,N=Math.hypot(F-C,E-U);if(N<.5)return;const R=s.context;R.save(),R.strokeStyle=r.strokeColor,R.lineWidth=r.lineWidth*u,R.setLineDash([]),R.beginPath(),R.arc(C,U,N,0,Math.PI*2),R.stroke(),R.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Iv{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,c=n._series;if(!l||!c)return;const u=o.horizontalPixelRatio,m=o.verticalPixelRatio,y=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),T=l.timeScale().timeToCoordinate(n.p2.rawTime),C=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*u,N=v*m,R=T*u,M=C*m,z=U*u,Ae=F*m,$=o.context;$.save(),$.beginPath(),$.moveTo(E,N),$.lineTo(R,M),$.lineTo(z,Ae),$.closePath(),$.fillStyle=n.fillColor,$.fill(),$.strokeStyle=n.strokeColor,$.lineWidth=n.lineWidth*m,$.setLineDash([]),$.stroke(),$.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Dv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.minorRatio=A.minorRatio??.45,this.previewAsLine=A.previewAsLine??!1,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,N=F-C,R=E-U,M=Math.hypot(N,R);if(M<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*u,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(C,U),z.lineTo(F,E),z.stroke();else{const Ae=(C+F)/2,$=(U+E)/2,V=Math.atan2(R,N),ie=M/2,re=Math.max(1,ie*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(Ae,$,ie,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 Nd{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#f59e0b",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight!==!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const Ae=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(Ae-V),ce=E-$*Math.sin(Ae-V),Z=F-$*Math.cos(Ae+V),ee=E-$*Math.sin(Ae+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.lineTo(Z,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=Ae+Math.PI,ce=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),ee=C-$*Math.cos(re+V),oe=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(ee,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,ee=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(ee-Z),he=Z!==0?Math.abs((ee-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),he=o.timeScale().timeToCoordinate(ce);if(se!=null&&he!=null){const pe=o.timeScale().coordinateToLogical(se),ge=o.timeScale().coordinateToLogical(he);pe!=null&&ge!=null&&le.push("↔ "+Math.abs(Math.round(ge-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),he=Math.floor(se/86400),pe=Math.floor(se%86400/3600),ge=Math.floor(se%3600/60);let be=he>0?he+" day"+(he!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!he&&!pe&&(be=ge+" min"+(ge!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+be+")":le.push(be)}if(r.statsDistance){const se=N/c,he=R/u;le.push("distance: "+Math.sqrt(se*se+he*he).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=N/c,he=R/u,pe=Math.atan2(he,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),he=11*se,pe=he*1.5,ge=5*se;M.font=he+"px sans-serif";const Ee=oe.reduce((Be,de)=>Math.max(Be,M.measureText(de).width),0)+ge*2,ye=oe.length*pe+ge*2,[Ce,Fe,Ue,Ne]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,Ke;r.statsPosition==="left"?(Je=Ce,Ke=Fe):r.statsPosition==="center"?(Je=(Ce+Ue)/2,Ke=(Fe+Ne)/2):(Je=Ue,Ke=Ne);const ve=Je-Ee/2,Pe=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(ve,Pe,Ee,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(ve,Pe,Ee,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((Be,de)=>{M.fillText(Be,ve+ge,Pe+ge+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 _v{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const Ae=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(Ae-V),ce=E-$*Math.sin(Ae-V),Z=F-$*Math.cos(Ae+V),ee=E-$*Math.sin(Ae+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.lineTo(Z,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=Ae+Math.PI,ce=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),ee=C-$*Math.cos(re+V),oe=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(ee,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,ee=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(ee-Z),he=Z!==0?Math.abs((ee-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),he=o.timeScale().timeToCoordinate(ce);if(se!=null&&he!=null){const pe=o.timeScale().coordinateToLogical(se),ge=o.timeScale().coordinateToLogical(he);pe!=null&&ge!=null&&le.push("↔ "+Math.abs(Math.round(ge-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),he=Math.floor(se/86400),pe=Math.floor(se%86400/3600),ge=Math.floor(se%3600/60);let be=he>0?he+" day"+(he!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!he&&!pe&&(be=ge+" min"+(ge!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+be+")":le.push(be)}if(r.statsDistance){const se=N/c,he=R/u;le.push("distance: "+Math.sqrt(se*se+he*he).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=N/c,he=R/u,pe=Math.atan2(he,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),he=11*se,pe=he*1.5,ge=5*se;M.font=he+"px sans-serif";const Ee=oe.reduce((Be,de)=>Math.max(Be,M.measureText(de).width),0)+ge*2,ye=oe.length*pe+ge*2,[Ce,Fe,Ue,Ne]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,Ke;r.statsPosition==="left"?(Je=Ce,Ke=Fe):r.statsPosition==="center"?(Je=(Ce+Ue)/2,Ke=(Fe+Ne)/2):(Je=Ue,Ke=Ne);const ve=Je-Ee/2,Pe=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(ve,Pe,Ee,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(ve,Pe,Ee,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((Be,de)=>{M.fillText(Be,ve+ge,Pe+ge+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 Pv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft!==!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const Ae=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(Ae-V),ce=E-$*Math.sin(Ae-V),Z=F-$*Math.cos(Ae+V),ee=E-$*Math.sin(Ae+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.lineTo(Z,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=Ae+Math.PI,ce=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),ee=C-$*Math.cos(re+V),oe=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(ee,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,ee=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(ee-Z),he=Z!==0?Math.abs((ee-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),he=o.timeScale().timeToCoordinate(ce);if(se!=null&&he!=null){const pe=o.timeScale().coordinateToLogical(se),ge=o.timeScale().coordinateToLogical(he);pe!=null&&ge!=null&&le.push("↔ "+Math.abs(Math.round(ge-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),he=Math.floor(se/86400),pe=Math.floor(se%86400/3600),ge=Math.floor(se%3600/60);let be=he>0?he+" day"+(he!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!he&&!pe&&(be=ge+" min"+(ge!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+be+")":le.push(be)}if(r.statsDistance){const se=N/c,he=R/u;le.push("distance: "+Math.sqrt(se*se+he*he).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=N/c,he=R/u,pe=Math.atan2(he,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),he=11*se,pe=he*1.5,ge=5*se;M.font=he+"px sans-serif";const Ee=oe.reduce((Be,de)=>Math.max(Be,M.measureText(de).width),0)+ge*2,ye=oe.length*pe+ge*2,[Ce,Fe,Ue,Ne]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,Ke;r.statsPosition==="left"?(Je=Ce,Ke=Fe):r.statsPosition==="center"?(Je=(Ce+Ue)/2,Ke=(Fe+Ne)/2):(Je=Ue,Ke=Ne);const ve=Je-Ee/2,Pe=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(ve,Pe,Ee,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(ve,Pe,Ee,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((Be,de)=>{M.fillText(Be,ve+ge,Pe+ge+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 Nv{constructor(e,t,A="#22c55e",r=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const u=n._chart,m=n._series;if(!u||!m)return;const y=o.horizontalPixelRatio,v=o.verticalPixelRatio,T=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),C=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=m.priceToCoordinate(n.p1.price),F=m.priceToCoordinate(n.p2.price);if(T==null||C==null||U==null||F==null)return;const E=T*y,N=U*v,R=C*y,M=F*v,[z,Ae,$,V]=E<=R?[E,N,R,M]:[R,M,E,N];let ie=$-z,re=V-Ae;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 he=Ae+ce*(0-z);Z.beginPath(),Z.moveTo(0,he),Z.lineTo(z,Ae),Z.stroke()}if(n.rayRight){const se=o.bitmapSize.width,he=V+ce*(se-$);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,he),Z.stroke()}const ee=Math.atan2(re,ie),oe=(n.lineWidth*4+4)*v,le=Math.PI/7;if(n.arrowRight){const se=$-oe*Math.cos(ee-le),he=V-oe*Math.sin(ee-le),pe=$-oe*Math.cos(ee+le),ge=V-oe*Math.sin(ee+le);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,he),Z.lineTo(pe,ge),Z.closePath(),Z.fill()}if(n.arrowLeft){const se=ee+Math.PI,he=z-oe*Math.cos(se-le),pe=Ae-oe*Math.sin(se-le),ge=z-oe*Math.cos(se+le),be=Ae-oe*Math.sin(se+le);Z.beginPath(),Z.moveTo(z,Ae),Z.lineTo(he,pe),Z.lineTo(ge,be),Z.closePath(),Z.fill()}if(c){const se=n.p1.rawTime??n.p1.time,he=n.p2.rawTime??n.p2.time,pe=n.p1.price,ge=n.p2.price,be=[];if(n.statsPriceRange){const ye=Math.abs(ge-pe),Ce=pe!==0?Math.abs((ge-pe)/pe*100):0,Fe=ye<1e-4?6:ye<.01?5:ye<1?4:2;be.push("↕ "+ye.toFixed(Fe)+" ("+Ce.toFixed(2)+"%)")}const Ee=[];if(n.statsBarsRange)try{const ye=u.timeScale().timeToCoordinate(se),Ce=u.timeScale().timeToCoordinate(he);if(ye!=null&&Ce!=null){const Fe=u.timeScale().coordinateToLogical(ye),Ue=u.timeScale().coordinateToLogical(Ce);Fe!=null&&Ue!=null&&Ee.push("↔ "+Math.abs(Math.round(Ue-Fe))+" bars")}}catch{}if(n.statsDateRange){const ye=Math.abs(he-se),Ce=Math.floor(ye/86400),Fe=Math.floor(ye%86400/3600),Ue=Math.floor(ye%3600/60);let Ne=Ce>0?Ce+" day"+(Ce!==1?"s":""):"";Fe>0&&(Ne+=(Ne?" ":"")+Fe+" hour"+(Fe!==1?"s":"")),!Ce&&!Fe&&(Ne=Ue+" min"+(Ue!==1?"s":"")),n.statsBarsRange&&Ee.length>0?Ee[Ee.length-1]+=" ("+Ne+")":Ee.push(Ne)}if(n.statsDistance){const ye=(R-E)/y,Ce=(M-N)/v;Ee.push("distance: "+Math.sqrt(ye*ye+Ce*Ce).toFixed(2))}if(Ee.length>0&&be.push(Ee.join(", ")),n.statsAngle){const ye=ie/y,Ce=re/v,Fe=Math.atan2(Ce,ye)*180/Math.PI;be.push("∠ "+Fe.toFixed(0)+"°")}if(be.length>0){const ye=Math.min(y,v),Ce=11*ye,Fe=Ce*1.5,Ue=5*ye;Z.font=Ce+"px sans-serif";const Je=be.reduce((ke,qe)=>Math.max(ke,Z.measureText(qe).width),0)+Ue*2,Ke=be.length*Fe+Ue*2;let ve,Pe;n.statsPosition==="left"?(ve=z,Pe=Ae):n.statsPosition==="center"?(ve=(z+$)/2,Pe=(Ae+V)/2):(ve=$,Pe=V);const Be=ve-Je/2,de=Pe-Ke-12*ye;Z.fillStyle="rgba(20, 20, 30, 0.72)",Z.fillRect(Be,de,Je,Ke),Z.strokeStyle=n.statsColor,Z.lineWidth=1*ye,Z.strokeRect(Be,de,Je,Ke),Z.fillStyle=n.statsColor,Z.textBaseline="top",Z.textAlign="left",be.forEach((ke,qe)=>{Z.fillText(ke,Be+Ue,de+Ue+qe*Fe)})}}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 kv{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=s.timeScale().timeToCoordinate(A.center.rawTime),m=o.priceToCoordinate(A.center.price);if(u==null||m==null)return;const y=Math.round(u*l),v=Math.round(m*c),T=n.bitmapSize.width,C=n.bitmapSize.height,U=n.context;if(U.save(),U.strokeStyle=A.color,U.lineWidth=A.lineWidth*c,U.setLineDash([]),U.beginPath(),U.moveTo(0,v),U.lineTo(T,v),U.stroke(),U.beginPath(),U.moveTo(y,0),U.lineTo(y,C),U.stroke(),A.showPrice){const F=A.center.price.toFixed(5),E=Math.round(11*c);U.font=E+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="left";const N=U.measureText(F).width,R=Math.round(6*l),M=Math.round(3*c),z=E+2*M,Ae=N+2*R,$=T-Ae-Math.round(2*l),V=v-z/2;U.fillStyle=A.color,U.fillRect($,V,Ae,z),U.fillStyle="#ffffff",U.fillText(F,$+R,v)}if(A.showTime){const F=A.center.rawTime,E=new Date(F*1e3),N=Z=>String(Z).padStart(2,"0"),R=N(E.getUTCDate())+"."+N(E.getUTCMonth()+1)+"."+E.getUTCFullYear()+" "+N(E.getUTCHours())+":"+N(E.getUTCMinutes())+":"+N(E.getUTCSeconds()),M=Math.round(11*c);U.font=M+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const z=U.measureText(R).width,Ae=Math.round(6*l),$=Math.round(3*c),V=M+2*$,ie=z+2*Ae,re=y-ie/2,ce=C-V-Math.round(4*c);U.fillStyle=A.color,U.fillRect(re,ce,ie,V),U.fillStyle="#ffffff",U.fillText(R,y,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 Ov{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=v*u,F=y*c,E=T*u,N=C-F,R=U-E,M=F-C,z=E-U;if(Math.hypot(N,R)<1e-4)return;const $=Math.atan2(R,N),V=Math.round(Math.abs($*180/Math.PI)),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:z/M;if(r.rayLeft){const ge=U+re*(0-C);ie.beginPath(),ie.moveTo(0,ge),ie.lineTo(C,U),ie.stroke()}if(r.rayRight){const pe=s.bitmapSize.width,ge=E+re*(pe-F);ie.beginPath(),ie.moveTo(F,E),ie.lineTo(pe,ge),ie.stroke()}ie.beginPath(),ie.moveTo(C,U),ie.lineTo(F,E),ie.stroke();const ce=Math.atan2(z,M),Z=(r.lineWidth*4+4)*u,ee=Math.PI/7;if(r.arrowRight){const pe=F-Z*Math.cos(ce-ee),ge=E-Z*Math.sin(ce-ee),be=F-Z*Math.cos(ce+ee),Ee=E-Z*Math.sin(ce+ee);ie.beginPath(),ie.moveTo(F,E),ie.lineTo(pe,ge),ie.lineTo(be,Ee),ie.closePath(),ie.fill()}if(r.arrowLeft){const pe=ce+Math.PI,ge=C-Z*Math.cos(pe-ee),be=U-Z*Math.sin(pe-ee),Ee=C-Z*Math.cos(pe+ee),ye=U-Z*Math.sin(pe+ee);ie.beginPath(),ie.moveTo(C,U),ie.lineTo(ge,be),ie.lineTo(Ee,ye),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,E),ie.lineTo(F+oe,E),ie.stroke(),ie.beginPath(),ie.strokeStyle="rgba(122,166,174,0.45)",ie.arc(F,E,oe,0,$,$<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($/2),se=E+(oe+10*u)*Math.sin($/2);if(ie.fillText(`${V}°`,le,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const pe=r.p1.price,ge=r.p2.price,be=[];if(r.statsPriceRange){const ye=Math.abs(ge-pe),Ce=pe!==0?Math.abs((ge-pe)/pe*100):0,Fe=ye<1e-4?6:ye<.01?5:ye<1?4:2;be.push("↕ "+ye.toFixed(Fe)+" ("+Ce.toFixed(2)+"%)")}const Ee=[];if(r.statsDistance){const ye=M/c,Ce=z/u;Ee.push("distance: "+Math.sqrt(ye*ye+Ce*Ce).toFixed(2))}if(Ee.length>0&&be.push(Ee.join(", ")),be.length>0){const ye=Math.min(c,u),Ce=11*ye,Fe=Ce*1.5,Ue=5*ye;ie.font=Ce+"px sans-serif";const Je=be.reduce((Ge,De)=>Math.max(Ge,ie.measureText(De).width),0)+Ue*2,Ke=be.length*Fe+Ue*2,[ve,Pe,Be,de]=C<=F?[C,U,F,E]:[F,E,C,U];let ke,qe;r.statsPosition==="left"?(ke=ve,qe=Pe):r.statsPosition==="center"?(ke=(ve+Be)/2,qe=(Pe+de)/2):(ke=Be,qe=de);const At=ke-Je/2,rt=qe-Ke-12*ye;ie.fillStyle="rgba(20, 20, 30, 0.72)",ie.fillRect(At,rt,Je,Ke),ie.strokeStyle=r.statsColor,ie.lineWidth=1*ye,ie.strokeRect(At,rt,Je,Ke),ie.fillStyle=r.statsColor,ie.textBaseline="top",ie.textAlign="left",be.forEach((Ge,De)=>{ie.fillText(Ge,At+Ue,rt+Ue+De*Fe)})}}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 Kv{constructor(e,t,A){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*c,N=v*u,R=T*c,M=C*u,z=U*c,Ae=F*u,$=(R+z)/2,V=(M+Ae)/2;let ie=$-E,re=V-N;Math.abs(ie)<1e-4&&(ie=1e-4);const ce=re/ie,Z=s.bitmapSize.width,ee=(R-z)/2,oe=(M-Ae)/2,le=ye=>({x:$+ee*ye,y:V+oe*ye}),se=(ye,Ce)=>({x:Z,y:Ce+ce*(Z-ye)}),he=le(1),pe=le(-1),ge=se(he.x,he.y),be=se(pe.x,pe.y);m.save(),m.beginPath(),m.moveTo(he.x,he.y),m.lineTo(ge.x,ge.y),m.lineTo(be.x,be.y),m.lineTo(pe.x,pe.y),m.closePath(),m.fillStyle="rgba(148, 163, 184, 0.2)",m.fill(),m.beginPath(),m.strokeStyle="rgba(148, 163, 184, 0.9)",m.lineWidth=1*u,m.moveTo(R,M),m.lineTo(z,Ae),m.stroke(),r._levels.forEach(ye=>{const Ce=le(ye.k),Fe=se(Ce.x,Ce.y);m.beginPath(),m.strokeStyle=ye.color,m.lineWidth=ye.width*u,m.moveTo(Ce.x,Ce.y),m.lineTo(Fe.x,Fe.y),m.stroke()});const Ee=se(E,N);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*u,m.moveTo(E,N),m.lineTo(Ee.x,Ee.y),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Vv{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,m=s.timeScale().timeToCoordinate(A.p1.rawTime),y=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),T=o.priceToCoordinate(A.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*l,U=y*c,F=v*l,E=T*c,N=n.bitmapSize.width,R=Math.abs(F-C)<1e-4?1:F-C,M=(E-U)/R,z=F>=C?1:-1,Ae=z>0?N:0,$=C+z*Math.min(220*l,Math.max(80*l,N*.35)),V=A._rays.map(re=>{const ce=M*re.ratio;return{...re,yEnd:U+ce*(Ae-C),yLabel:U+ce*($-C)}});u.save();const ie=(re,ce,Z)=>{!re||!ce||(u.beginPath(),u.moveTo(C,U),u.lineTo(Ae,re.yEnd),u.lineTo(Ae,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(Ae,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 ce=$+(z>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 zv{constructor(e,t,A=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,A),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price);if(y==null||v==null||T==null||C==null)return;const U=y*c,F=v*u,E=T*c,N=C*u,R=E-U,M=N-F,z=Math.hypot(R,M);if(z<1e-4)return;const Ae=R/z,$=M/z,V=-$,ie=Ae,re=E+V*z,ce=N+ie*z,Z=U+V*z,ee=F+ie*z,oe=(se,he)=>({x:U+Ae*z*se+V*z*he,y:F+$*z*se+ie*z*he});m.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 he=se/r.divisions,pe=(se+1)/r.divisions,ge=oe(0,he),be=oe(1,he),Ee=oe(1,pe),ye=oe(0,pe);m.beginPath(),m.moveTo(ge.x,ge.y),m.lineTo(be.x,be.y),m.lineTo(Ee.x,Ee.y),m.lineTo(ye.x,ye.y),m.closePath(),m.fillStyle=le[se%le.length],m.fill()}m.lineWidth=1*u,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const he=se/r.divisions,pe=oe(0,he),ge=oe(1,he),be=oe(he,0),Ee=oe(he,1);m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(ge.x,ge.y),m.stroke(),m.beginPath(),m.moveTo(be.x,be.y),m.lineTo(Ee.x,Ee.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*u,m.beginPath(),m.moveTo(U,F),m.lineTo(re,ce),m.stroke(),m.beginPath(),m.moveTo(E,N),m.lineTo(Z,ee),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*u,m.beginPath(),m.moveTo(U,F),m.lineTo(E,N),m.lineTo(re,ce),m.lineTo(Z,ee),m.closePath(),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ka{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:m=!0,pricesColor:y="#129f5c",rayLeft:v=!1,rayRight:T=!1,arrowLeft:C=!1,arrowRight:U=!1}=n;this.p1=e,this.p2=t,this.p3=A,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=u,this.showPrices=m,this.pricesColor=y,this.rayLeft=v,this.rayRight=T,this.arrowLeft=C,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(E){E.useBitmapCoordinateSpace(N=>{if(!F.visible)return;const R=F._chart,M=F._series;if(!R||!M)return;const z=N.horizontalPixelRatio,Ae=N.verticalPixelRatio,$=[F.p1,F.p3,F.p4,F.p2].map(Ke=>{const ve=R.timeScale().timeToCoordinate(Ke.rawTime),Pe=M.priceToCoordinate(Ke.price);return ve==null||Pe==null?null:{x:ve*z,y:Pe*Ae}}).filter(Boolean);if($.length!==4)return;const[V,ie,re,ce]=$,Z=N.context;Z.save();const ee=ie.x-V.x,oe=ie.y-V.y,le=Math.sqrt(ee*ee+oe*oe)||1,se=ee/le,he=oe/le,pe=re.x-ce.x,ge=re.y-ce.y,be=Math.sqrt(pe*pe+ge*ge)||1,Ee=pe/be,ye=ge/be,Ce=1e5,Fe=F.rayLeft?{x:V.x-se*Ce,y:V.y-he*Ce}:V,Ue=F.rayRight?{x:ie.x+se*Ce,y:ie.y+he*Ce}:ie,Ne=F.rayLeft?{x:ce.x-Ee*Ce,y:ce.y-ye*Ce}:ce,Je=F.rayRight?{x:re.x+Ee*Ce,y:re.y+ye*Ce}:re;if(F.showBackground){const Ke=F.fillColor||"#6aa84f",ve=parseInt(Ke.slice(1,3),16),Pe=parseInt(Ke.slice(3,5),16),Be=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(${ve},${Pe},${Be},${F.fillOpacity??.1})`,Z.fill()}if(Z.strokeStyle=F.lineColor,Z.lineWidth=F.lineWidth*Ae,Z.setLineDash([]),Z.beginPath(),Z.moveTo(Fe.x,Fe.y),Z.lineTo(Ue.x,Ue.y),Z.moveTo(Ne.x,Ne.y),Z.lineTo(Je.x,Je.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*Ae,ve=(Pe,Be,de)=>{Z.save(),Z.translate(Pe,Be),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&&(ve(Fe.x,Fe.y,Math.atan2(-he,-se)),ve(Ne.x,Ne.y,Math.atan2(-ye,-Ee))),F.arrowRight&&(ve(Ue.x,Ue.y,Math.atan2(he,se)),ve(Je.x,Je.y,Math.atan2(ye,Ee)))}if(Z.fillStyle="#ffffff",Z.strokeStyle="#3b82f6",Z.lineWidth=2*Ae,[V,ie,re,ce].forEach(Ke=>{Z.beginPath(),Z.arc(Ke.x,Ke.y,6*Ae,0,Math.PI*2),Z.fill(),Z.stroke()}),F.showPrices){const Ke=[F.p1,F.p3,F.p2,F.p4],ve=[V,ie,ce,re];Z.fillStyle=F.pricesColor||F.lineColor,Z.font=`${Math.round(10*Ae)}px sans-serif`,Z.textAlign="left",Z.textBaseline="middle",ve.forEach((Pe,Be)=>{const de=Ke[Be]?.price;typeof de=="number"&&Z.fillText(de.toFixed(5),Pe.x+8*z,Pe.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 kd extends ka{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class Od{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const u=o._chart,m=o._series;if(!u||!m)return;const y=c.horizontalPixelRatio,v=c.verticalPixelRatio,T=c.context,C=R=>{const M=u.timeScale().timeToCoordinate(R.rawTime),z=m.priceToCoordinate(R.price);return M==null||z==null?null:{x:M*y,y:z*v}},U=C(o.p1),F=C(o.p2),E=C(o.b2),N=C(o.b1);!U||!F||!E||!N||(T.save(),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.lineTo(E.x,E.y),T.lineTo(N.x,N.y),T.closePath(),T.fillStyle=o.fillColor,T.fill(),T.strokeStyle=o.strokeColor,T.lineWidth=o.lineWidth*v,T.setLineDash([]),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.stroke(),T.beginPath(),T.moveTo(N.x,N.y),T.lineTo(E.x,E.y),T.stroke(),T.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Oa{constructor(e,t,A,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=r,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(u=>{if(!l.visible)return;const m=l._chart,y=l._series;if(!m||!y)return;const v=u.horizontalPixelRatio,T=u.verticalPixelRatio,C=u.context,U=$=>{const V=m.timeScale().timeToCoordinate($.rawTime),ie=y.priceToCoordinate($.price);return V==null||ie==null?null:{x:V*v,y:ie*T}},F=U(l.mid1),E=U(l.mid2),N=U(l.top1),R=U(l.top2),M=U(l.bot1),z=U(l.bot2);if(!F||!E||!N||!R||!M||!z)return;C.save(),C.beginPath(),C.moveTo(F.x,F.y),C.lineTo(E.x,E.y),C.lineTo(R.x,R.y),C.lineTo(N.x,N.y),C.closePath(),C.fillStyle=l.upperFillColor,C.fill(),C.beginPath(),C.moveTo(M.x,M.y),C.lineTo(z.x,z.y),C.lineTo(E.x,E.y),C.lineTo(F.x,F.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const Ae=($,V,ie)=>{C.beginPath(),C.strokeStyle=ie,C.lineWidth=l.lineWidth*T,C.setLineDash([]),C.moveTo($.x,$.y),C.lineTo(V.x,V.y),C.stroke()};if(Ae(N,R,l.upperStrokeColor),Ae(F,E,l.centerStrokeColor),Ae(M,z,l.lowerStrokeColor),l.showDeviationLabel){const $=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite($)?$.toFixed(5):null;if(V){const ie=Math.max(10,Math.round(10*T));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*T)}}C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Kd extends Oa{}class Vd{constructor(e,t){this.p1=e,this.p2=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,u=n.context,m=n.bitmapSize.width;n.bitmapSize.height;const y=A.p1.price,v=A.p2.price,T=y-v,C=$=>v+T*$,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(y),N=o.priceToCoordinate(v),R=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,M=U!=null&&F!=null?Math.round(Math.max(U,F)*l):m,z=M-R;u.save(),A._zoneFills.forEach(({from:$,to:V,color:ie})=>{const re=C($),ce=C(V),Z=o.priceToCoordinate(re),ee=o.priceToCoordinate(ce);if(Z==null||ee==null)return;const oe=Math.round(Z*c),le=Math.round(ee*c);u.fillStyle=ie,u.fillRect(R,Math.min(oe,le),z,Math.abs(le-oe))}),A._levels.forEach(({ratio:$,label:V})=>{const ie=C($),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[$]||"#888888";u.beginPath(),u.strokeStyle=Z,u.lineWidth=$===0||$===1?1.5*c:1*c,$!==0&&$!==1&&$<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(R,ce),u.lineTo(M,ce),u.stroke(),u.setLineDash([])});const Ae=Math.round(11*c);if(u.font=`${Ae}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:$,label:V})=>{const ie=C($),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[$]||"#888888",ee=`${V} (${ie.toFixed(5)})`;u.fillStyle=Z,u.textAlign="right",u.fillText(ee,R-4*l,ce-4*c)}),U!=null&&F!=null&&E!=null&&N!=null){const $=Math.round(U*l),V=Math.round(E*c),ie=Math.round(F*l),re=Math.round(N*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo($,V),u.lineTo(ie,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc($,V,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(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 Wv{constructor(e,t="#3b82f6",A=2,r=!0){this.time=e,this.color=t,this.lineWidth=A,this.showDate=r,this.showDot=!1,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const u=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,y=o.context;y.save(),y.beginPath(),y.strokeStyle=n.color,y.lineWidth=n.lineWidth*o.horizontalPixelRatio,y.setLineDash([]),y.moveTo(u,0),y.lineTo(u,m),y.stroke();const v=Math.round(m/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){y.beginPath(),y.strokeStyle=n.color,y.lineWidth=1.5*o.horizontalPixelRatio;const T=5*o.horizontalPixelRatio;y.arc(u,v,T,0,Math.PI*2),y.stroke()}if(n.showDate!==!1){const T=n.time,C=new Date(typeof T=="number"?T*1e3:T),U=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())}`,E=Math.round(11*o.verticalPixelRatio);y.font=`${E}px ui-sans-serif, system-ui, sans-serif`,y.textBaseline="middle",y.textAlign="center";const N=y.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),z=E+2*M,Ae=N+2*R,$=u-Ae/2,V=m-z-Math.round(4*o.verticalPixelRatio);y.fillStyle=n.color,y.fillRect($,V,Ae,z),y.fillStyle="#ffffff",y.fillText(F,u,V+z/2)}y.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function zd(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 Rv(i,e,t){const A=`${i??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let u=c;for(;u.length>s;){let m=u.lastIndexOf(" ",s);m<=0&&(m=s),o.push(u.slice(0,m)),u=u.slice(m).trimStart()}o.push(u)};return A.split(`
11
+ `).forEach(l),o.length===0&&o.push(""),o}function Wd(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=Rv(A.text??i?.text??"Text",r,n),o=s.reduce((T,C)=>Math.max(T,C.length),1),c=Math.max(20,o*r*.58)+16,u=r*1.2,m=s.length*u+10,y=e-c/2,v=t-m;return{left:y,right:y+c,top:v,bottom:v+m+12}}class Gv{constructor(e,t,A={}){this.rawTime=e,this.price=t,this.text=A.text??"Text",this.color=A.color??"#5f8f96",this.fontSize=A.fontSize??12,this.fontWeight=A.fontWeight??"normal",this.fontStyle=A.fontStyle??"normal",this.textAlign=A.textAlign??"center",this.textWrap=A.textWrap??!1,this.borderEnabled=A.borderEnabled??!1,this.borderColor=A.borderColor??"#5f8f96",this.borderOpacity=A.borderOpacity??.1,this.borderWidth=A.borderWidth??1,this.bgEnabled=A.bgEnabled??!1,this.bgColor=A.bgColor??"#5f8f96",this.bgOpacity=A.bgOpacity??.1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=o.timeScale().timeToCoordinate(r.rawTime),u=l.priceToCoordinate(r.price);if(c==null||u==null)return;const m=s.horizontalPixelRatio,y=s.verticalPixelRatio,v=Math.round(c*m),T=Math.round(u*y),C=s.context;C.save();const U=Math.round(r.fontSize*y);C.font=`${r.fontStyle} ${r.fontWeight} ${U}px sans-serif`;const F=`${r.text??""}`,E=220*m,N=[],R=he=>{if(!r.textWrap||he.length===0){N.push(he);return}const pe=he.split(/\s+/);let ge="";for(const be of pe){const Ee=ge?`${ge} ${be}`:be;C.measureText(Ee).width<=E||!ge?ge=Ee:(N.push(ge),ge=be)}N.push(ge)};F.split(`
12
+ `).forEach(R),N.length===0&&N.push("");const M=N.map(he=>C.measureText(he).width),z=Math.max(...M,20*m),Ae=8*m,$=5*y,V=z+Ae*2,ie=U*1.2,re=ie*N.length+$*2,ce=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Z=v-V/2,ee=T-re;r.bgEnabled&&(C.fillStyle=zd(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(Z,ee,V,re),C.fill()),r.borderEnabled&&(C.strokeStyle=zd(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),C.lineWidth=Math.max(.5,(r.borderWidth??1)*y),C.beginPath(),C.rect(Z,ee,V,re),C.stroke()),C.fillStyle=r.color,C.textAlign=ce,C.textBaseline="middle";const oe=ce==="left"?Z+Ae:ce==="right"?Z+V-Ae:Z+V/2;for(let he=0;he<N.length;he++)C.fillText(N[he],oe,ee+$+ie*(he+.5));const le=5*y,se=T+10*y;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*y,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 $v={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Rd(i){if(!i)return 7;const e=String(i).toUpperCase();return $v[e]??7}function Xv(i,e){const t=String(i||"").toUpperCase(),A=e||Rd(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 LA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:q(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 ot(i,e,t,A,r,n){const s=r-t,o=n-A,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/(l*l);c=Math.max(0,Math.min(1,c));const u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Zv(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/l;c<0&&(c=0);const u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Jv(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);const c=((i-t)*s+(e-A)*o)/l,u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function ti(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 Gd(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??q(i.rawTime),r=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(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=q((A+r)/2),m=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:m}}}function Vi(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map($=>({time:q($.time),close:typeof $.close=="number"?$.close:parseFloat($.close)})).filter($=>$.time!=null&&Number.isFinite($.close)&&$.time>=s&&$.time<=o).sort(($,V)=>$.time-V.time);if(l.length<2)return null;const c=l.length;let u=0,m=0,y=0,v=0;for(let $=0;$<c;$++){const V=$,ie=l[$].close;u+=V,m+=ie,y+=V*ie,v+=V*V}const T=c*v-u*u,C=Math.abs(T)<1e-12?0:(c*y-u*m)/T,U=(m-C*u)/c;let F=0;for(let $=0;$<c;$++){const V=U+C*$,ie=l[$].close-V;F+=ie*ie}const E=Math.sqrt(F/c),N=Math.max(E*A,1e-8),R=l[0].time,M=l[c-1].time,z=U,Ae=U+C*(c-1);return{slope:C,intercept:U,stdDev:E,offset:N,barCount:c,p1:{rawTime:R,normalizedTime:R,price:z},p2:{rawTime:M,normalizedTime:M,price:Ae},top1:{rawTime:R,normalizedTime:R,price:z+N},top2:{rawTime:M,normalizedTime:M,price:Ae+N},bot1:{rawTime:R,normalizedTime:R,price:z-N},bot2:{rawTime:M,normalizedTime:M,price:Ae-N}}}function Hr(i,e,t,A=1){return Vi(i,e,t,A)}const Yv={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}},qv={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 jv(i,e){if(!i||!i.type)return!1;const t=Yv[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function eT(i){return i?qv[i]??"#22c55e":"#22c55e"}const tT=300,$d=24,AT=150,Xd=150;function Ka(i,e,t=tT){if(!Array.isArray(i)||i.length===0)return[];const A=iA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=q(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 iT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=q(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function rT(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 Ts(i,e,t,A){const r=q(e),n=q(t),s=iA(A)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(i)||i.length===0)return l;if(r==null||n==null)return 1;const c=y=>{const v=rT(i,y);if(v<=0)return 0;if(v>=i.length)return i.length-1;const T=i[v-1],C=i[v];return Math.abs(y-T)<=Math.abs(C-y)?v-1:v},u=c(r),m=c(n);return Math.max(1,Math.abs(m-u)+1)}function Zd(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=iT(e);if(r==null)return!1;const n=A.timeToCoordinate(r);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const u=A.getVisibleLogicalRange(),m=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,y=Number.isFinite(m)&&m>20?m:120,v=Math.min(Xd,y/2),T=Math.max(20,y-v),C={from:c-T,to:c+v};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=iA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-AT*o,to:r+Xd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const nT=j.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=j.useRef(null),l=j.useRef(null),c=j.useRef(null),u=j.useRef(null),m=j.useRef(null),y=j.useRef(null),v=j.useRef([]),T=j.useRef(!1),C=j.useRef(null),U=j.useRef(null),F=j.useRef(null),E=j.useRef(null),N=j.useRef([]),[R,M]=j.useState(null),[z,Ae]=j.useState(null),[$,V]=j.useState([]),[ie,re]=j.useState(null),[ce,Z]=j.useState([]),ee=j.useRef(null),oe=j.useRef(null),le=j.useRef(null),se=j.useRef(!1),he=j.useRef(!1);j.useEffect(()=>{le.current=R;let p=!1;v.current.forEach(g=>{if(g.type==="trendline"&&g.decoration){const k=g===R;g.decoration.isSelected!==k&&(g.decoration.isSelected=k,p=!0)}}),p&&c.current?.applyOptions({})},[R]);const pe=j.useRef(new Map),ge=j.useRef(null),be=j.useRef(null),Ee=(p,g)=>`${p}_${g}`,ye=()=>{const p=Ee(Be,de);return pe.current.get(p)||null},Ce=p=>{if(!p)return;const g=Ee(Be,de);pe.current.set(g,p)},{activeTool:Fe,setActiveTool:Ue,showGrid:Ne,snapToGrid:Je,chartObjects:Ke,setChartObjects:ve,orders:Pe,selectedSymbol:Be,selectedTimeframe:de,drawingsVisible:ke,chartType:qe,chartLocked:At,theme:rt,baseUrl:Ge,endpoints:De,endpointParams:Ie,indicators:Qe,indicatorSettings:Te}=Ht(),He=j.useRef({}),[Se,Re]=j.useState({}),ze=j.useRef(0),Ye=j.useRef([]),[lt,gt]=j.useState(!1),[sA,eA]=j.useState(null),[Ze,IA]=j.useState([]),[Lt,yt]=j.useState(!0),[Gt,tA]=j.useState(null),[UT,cx]=j.useState(0),bs=j.useMemo(()=>{const p=Ze.map(g=>q(g?.time)).filter(g=>Number.isFinite(g));return p.sort((g,k)=>g-k),p},[Ze]),Qs=j.useRef(null),zi=j.useRef(new Map);j.useRef(null);const Ap=j.useRef(0),Ai=j.useRef(null),Nr=j.useRef(!1);j.useEffect(()=>{const p=m.current;p&&p.setData(Ka(Ze,de))},[Ze,de]),j.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*.8;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*1.25;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const g=p.querySelectorAll("canvas"),k=rt==="light"?"#ffffff":"#12161d";let we=null,H=0;if(g.forEach(X=>{if(X.width>0&&X.height>0){const J=X.width*X.height;J>H&&(H=J,we=X)}}),we)try{const X=document.createElement("canvas");X.width=we.width,X.height=we.height;const J=X.getContext("2d");J.fillStyle=k,J.fillRect(0,0,X.width,X.height),J.drawImage(we,0,0);const ne=document.createElement("a");ne.download=`chart-${Be}-${de}-${Date.now()}.png`,ne.href=X.toDataURL("image/png"),ne.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(X){console.warn("Canvas export failed, trying html2canvas",X)}Qv(p,{useCORS:!0,allowTaint:!0,backgroundColor:k,scale:2,logging:!1}).then(X=>{const J=document.createElement("a");J.download=`chart-${Be}-${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")})}}),[Be,de,rt]);const Wa=j.useMemo(()=>Ze.length===0?[]:qe==="line"||qe==="area"?Ze.map(p=>({time:p.time,value:p.close})):Ze,[Ze,qe]),ST=p=>{r?r(p):(eA("BUY"),gt(!0))},ET=p=>{n?n(p):(eA("SELL"),gt(!0))},LT=()=>{gt(!1),eA(null)},MT=p=>{const g=z;if(!g||!p)return;const k=(X,J)=>{if(typeof X!="string")return J;const ne=X.trim(),ae=ne.startsWith("#")?ne:`#${ne}`;return/^#[0-9A-Fa-f]{6}$/.test(ae)?ae.toLowerCase():J},we=(X,J)=>{const ne=Number(X);return Number.isFinite(ne)?Math.max(0,Math.min(1,ne)):J};let H={...g,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:g.visibleTimeframes};if(g.type==="text"){const X=Number.isFinite(Number(p.price))?Number(p.price):g.price,J=g.primitive;J&&(J.text=typeof p.text=="string"?p.text:J.text,J.color=k(p.color,J.color??"#5f8f96"),J.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):J.fontSize,J.fontWeight=p.fontWeight==="bold"?"bold":"normal",J.fontStyle=p.fontStyle==="italic"?"italic":"normal",J.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:J.textAlign,J.textWrap=!!p.textWrap,J.borderEnabled=!!p.borderEnabled,J.borderColor=k(p.borderColor,J.borderColor??"#5f8f96"),J.borderOpacity=we(p.borderOpacity,J.borderOpacity??.1),J.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),J.bgEnabled=!!p.bgEnabled,J.bgColor=k(p.bgColor,J.bgColor??"#5f8f96"),J.bgOpacity=we(p.bgOpacity,J.bgOpacity??.1),J.price=X),H={...H,price:X,text:typeof p.text=="string"?p.text:g.text}}if(g.type==="trendline"){const X=k(p.lineColor,"#22c55e"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(g.series)try{g.series.applyOptions({color:X,lineWidth:J})}catch{}const ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.point1?.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.point2?.price;if(g.series&&g.point1&&g.point2){const Y=g.point1.time??g.point1.rawTime,B=g.point2.time??g.point2.rawTime;try{const h=LA([{time:Y,value:ne},{time:B,value:ae}]);h.length>0&&g.series.setData(h)}catch{}}const S={...g.point1,price:ne},O={...g.point2,price:ae};g.decoration&&(g.decoration.color=X,g.decoration.lineWidth=J,g.decoration.arrowLeft=!!p.arrowLeft,g.decoration.arrowRight=!!p.arrowRight,g.decoration.rayLeft=!!p.rayLeft,g.decoration.rayRight=!!p.rayRight,g.decoration.statsColor=k(p.statsColor,"#5f8f96"),g.decoration.statsPosition=p.statsPosition??"right",g.decoration.statsShowAlways=!!p.statsShowAlways,g.decoration.statsPriceRange=!!p.statsPriceRange,g.decoration.statsBarsRange=!!p.statsBarsRange,g.decoration.statsDateRange=!!p.statsDateRange,g.decoration.statsAngle=!!p.statsAngle,g.decoration.statsDistance=!!p.statsDistance,g.decoration.p1=S,g.decoration.p2=O),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsShowAlways:!!p.statsShowAlways,statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,point1:S,point2:O,decoration:g.decoration}}if(g.type==="pricelevel"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,ae=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=k(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price;if(g.priceLine)try{g.priceLine.applyOptions({price:h,color:X,lineWidth:J,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const b=u.current;if(ae&&S&&b)if(g.textPrimitive)g.textPrimitive.text=S,g.textPrimitive.textColor=O,g.textPrimitive.hAlign=Y,g.textPrimitive.vAlign=B,g.textPrimitive.price=h;else{const I=new _d(h,{text:S,textColor:O,hAlign:Y,vAlign:B});try{b.attachPrimitive(I)}catch{}g.textPrimitive=I}else if(g.textPrimitive&&b){try{b.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ne,showText:ae,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:g.textPrimitive}}if(g.type==="horizontalray"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,ae=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=k(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price,b=g.primitive;if(b&&(b.price=h,b.color=X,b.lineWidth=J),g.priceLine)try{g.priceLine.applyOptions({price:h,color:X,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(ae&&S&&I)if(g.textPrimitive)g.textPrimitive.text=S,g.textPrimitive.textColor=O,g.textPrimitive.hAlign=Y,g.textPrimitive.vAlign=B,g.textPrimitive.price=h,g.textPrimitive.originTime=g.rawOriginTime;else{const w=new _d(h,{text:S,textColor:O,hAlign:Y,vAlign:B,originTime:g.rawOriginTime});try{I.attachPrimitive(w)}catch{}g.textPrimitive=w}else if(g.textPrimitive&&I){try{I.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ne,showText:ae,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:g.textPrimitive}}if(g.type==="verticalline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showDate!==!1,ae=g.primitive;ae&&(ae.color=X,ae.lineWidth=J,ae.showDate=ne),H={...H,lineColor:X,lineWidth:J,showDate:ne}}if(g.type==="infoline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.statsShowAlways!==!1,ae=k(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=!!p.statsAngle,b=!!p.statsDistance,I=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,d=g.p1.rawTime,_=g.p2.rawTime,Q=w-I,L=I!==0?Q/Math.abs(I)*100:0,x=g.p1.normalizedTime??0,f=g.p2.normalizedTime??0,D=iA(de)||3600,P=Math.abs(f-x),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=c.current,te=u.current,ue=G?G.timeScale().timeToCoordinate(d):null,me=te?te.priceToCoordinate(I):null,xe=G?G.timeScale().timeToCoordinate(_):null,Me=te?te.priceToCoordinate(w):null,$e=ue!=null&&me!=null&&xe!=null&&Me!=null?Math.atan2(-(Me-me),xe-ue)*(180/Math.PI):g.primitive?.info?.angle??0,et={priceDiff:Q,pricePct:L,bars:K,days:W,angle:$e},We=g.primitive;We&&(We.color=X,We.lineWidth=J,We.statsShowAlways=ne,We.statsColor=ae,We.statsPosition=S,We.statsPriceRange=O,We.statsBarsRange=Y,We.statsDateRange=B,We.statsAngle=h,We.statsDistance=b,We.p1={...g.p1,price:I},We.p2={...g.p2,price:w},We.info=et),H={...H,lineColor:X,lineWidth:J,statsShowAlways:ne,statsColor:ae,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B,statsAngle:h,statsDistance:b,p1:{...g.p1,price:I},p2:{...g.p2,price:w}}}if(g.type==="rulerline"){const X=k(p.lineColor,"#3b82f6"),J=p.showArea!==!1,ne=!!p.statsShowAlways,ae=k(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=g.primitive;h&&(h.lineColor=X,h.showArea=J,h.statsShowAlways=ne,h.statsColor=ae,h.statsPosition=S,h.statsPriceRange=O,h.statsBarsRange=Y,h.statsDateRange=B),H={...H,lineColor:X,showArea:J,statsShowAlways:ne,statsColor:ae,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B}}if(g.type==="arrowedline"){const X=k(p.lineColor,"#f59e0b"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="rayline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="extendedline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="crossline"){const X=k(p.lineColor,"#06a0e3"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.price))?Number(p.price):g.p.price,ae=g.primitive;ae&&(ae.color=X,ae.lineWidth=J,ae.showTime=!!p.showTime,ae.showPrice=!!p.showPrice,ae.center={...g.p,price:ne}),H={...H,lineColor:X,lineWidth:J,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...g.p,price:ne}}}if(g.type==="trendbyangle"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="disjointchannel"){const X=k(p.lineColor,"#129f5c"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=k(p.fillColor,"#6aa84f"),ae=we(p.fillOpacity,.1),S=k(p.pricesColor,"#129f5c"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ne,h.fillOpacity=ae,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:O},h.p3={...g.p3,price:Y},h.p2={...g.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ne,fillOpacity:ae,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:O},p3:{...g.p3,price:Y},p2:{...g.p2,price:B}}}if(g.type==="flattopbottom"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=k(p.fillColor,"#3b82f6"),ae=we(p.fillOpacity,.12),S=k(p.pricesColor,"#3b82f6"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ne,h.fillOpacity=ae,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:O},h.p3={...g.p3,price:Y},h.p2={...g.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ne,fillOpacity:ae,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:O},p3:{...g.p3,price:Y},p2:{...g.p2,price:B}}}ve(X=>{const J=X.map(ne=>ne===g?H:ne);return v.current=J,J}),le.current===g&&(le.current=H),M(X=>X===g?H:X),re(X=>X===g?H:X),Ae(H);try{c.current?.applyOptions({})}catch{}};j.useEffect(()=>{const p=o.current;if(!p)return;const g=p.getBoundingClientRect(),k=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},we=rt==="light",H=$0(p,{width:g.width||p.clientWidth,height:g.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:k},layout:{background:{color:we?"#FFFFFF":"#0d1117",type:"solid"},textColor:we?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ne,color:Ne?we?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0},horzLines:{visible:Ne,color:Ne?we?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0}},rightPriceScale:{borderColor:we?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:we?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:we?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:Fe===1?1:0,vertLine:{width:1,color:we?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:we?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:we?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:we?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Fe===1,horzLineVisible:Fe===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Fe===null||Fe===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 Be=="string"?Be:Be?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),J=X.includes("JPY"),ne=Or(X),ae=kr(X);let S,O;J?(S=.001,O=w=>Math.abs(Number(w)).toFixed(3)):ne?X.startsWith("BTC")||X.startsWith("ETH")?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(4)):ae&&(X.startsWith("XAU")||X.startsWith("XAG"))?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(5));const Y=H.addCandlestickSeries({upColor:we?"#089981":"#26a69a",downColor:we?"#f23645":"#ef5350",wickUpColor:we?"#089981":"#26a69a",wickDownColor:we?"#f23645":"#ef5350",borderUpColor:we?"#089981":"#26a69a",borderDownColor:we?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:S,formatter:O}}),B=H.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=H,u.current=Y,m.current=B,B.setData(Ka(Ze,de)),requestAnimationFrame(()=>{if(p&&H){const w=p.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),b=()=>{if(he.current&&zi.current.size>0){const w=h.getVisibleRange();w&&Ce(w)}};h.subscribeVisibleTimeRangeChange(b);const I=new ResizeObserver(w=>{for(const d of w){const{width:_,height:Q}=d.contentRect;if(_>0&&Q>0&&H){const L=h.getVisibleRange();H.resize(_,Q),L&&setTimeout(()=>{try{h.setVisibleRange(L)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(b),I.disconnect(),H.remove(),c.current=null,u.current=null,m.current=null,y.current=null,v.current=[],Ai.current&&clearTimeout(Ai.current)}},[]),j.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ne,color:Ne?"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0},horzLines:{visible:Ne,color:Ne?"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0}}})},[Ne]),j.useEffect(()=>{const p=c.current;if(!p)return;const g=rt==="light";p.applyOptions({layout:{background:{color:g?"#FFFFFF":"#12161d"},textColor:g?"#020617":"#fff"},grid:{vertLines:{color:Ne?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ne?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:g?"#e5e7eb":"#1e293b"},timeScale:{borderColor:g?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1},horzLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1}}})},[rt,Ne]),j.useEffect(()=>{if(!c.current)return;const g=!At&&!(Fe!==null&&Fe!==1&&Fe!==0),k=!At;c.current.applyOptions({crosshair:{mode:Fe===1?1:0,vertLine:{visible:Fe===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Fe===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:k,pressedMouseMove:g,horzTouchDrag:g,vertTouchDrag:g},handleScale:{axisPressedMouseMove:{time:g,price:g},axisDoubleClickReset:{time:!1,price:k},axisTouch:{time:g,price:g},mouseWheel:k,pinch:k}})},[Fe,At]);const HT=()=>{const p=u.current;v.current.forEach(g=>{if(g.primitive){try{p&&p.detachPrimitive(g.primitive)}catch{}if(g.series&&g.series!==p)try{g.series.detachPrimitive(g.primitive)}catch{}}if(g.priceLine&&p)try{p.removePriceLine(g.priceLine)}catch{}if(g.textPrimitive&&p)try{p.detachPrimitive(g.textPrimitive)}catch{}}),v.current=[],ve([]),Ue(null)},ip=(p,g=!1)=>{p&&v.current.forEach(k=>{if(k.primitive){try{p.detachPrimitive(k.primitive)}catch{}try{p.attachPrimitive(k.primitive)}catch{}}if(g&&k.type==="pricelevel"&&k.priceLine)try{const we=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,axisLabelVisible:we,title:we&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}if(g&&k.type==="horizontalray"&&k.priceLine)try{const we=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:we,title:we&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}})};j.useEffect(()=>{(async()=>{if(!Be||!de){IA([]),he.current=!1;return}try{if(yt(!0),tA(null),IA([]),he.current=!1,Nr.current=!1,be.current!==null&&be.current!==Be&&HT(),be.current=Be,u.current)try{u.current.setData([])}catch{}const g=Rd(de),k=Xv(de,g),we=Ge||Sv?.VITE_BASE_URL||"http://localhost:5002",H=De?.candles||"/api/chart/candles",X=Ie?.candles||{},J={symbol:X.symbol||"symbol",timeframe:X.timeframe||"timeframe",limit:X.limit||"limit",daysBack:X.daysBack||"daysBack"},ne={};ne[J.symbol]=Be,ne[J.timeframe]=de,ne[J.limit]=k,X.daysBack!==!1&&(ne[J.daysBack]=g);const ae=await ht.get(`${we}${H}`,{params:ne,timeout:1e4});let S=[];if(Array.isArray(ae.data)?S=ae.data:ae.data&&ae.data.data&&Array.isArray(ae.data.data)?S=ae.data.data:ae.data&&Array.isArray(ae.data)&&(S=ae.data),S&&S.length>0){const{candles:O,stats:Y}=Ya(S,Be,de);O.length>0?(IA(O),zi.current=new Map,O.forEach(B=>{zi.current.set(B.time,B)}),Nr.current=!0,Qs.current?.connected&&Be&&de&&Qs.current.emit("subscribeCandles",{symbol:Be,timeframe:de})):(console.warn(`⚠️ No valid candles after processing for ${Be}`),IA([]))}else console.warn(`⚠️ No candle data returned for ${Be}`),IA([])}catch(g){console.error(`❌ Error fetching ${Be}:`,g.message);const k=g.code==="ECONNABORTED"||g.message&&g.message.includes("timeout");tA(k?"Request timed out. No data available for this symbol.":g.message||"Failed to load candles."),IA([]),yt(!1)}})()},[Be,de,UT]),j.useEffect(()=>{Qs.current=bn.getSocket();const p=Qs.current,g=()=>{if(Nr.current&&Be&&de&&p.connected){const ne={symbol:Be,timeframe:de};p.emit("subscribeCandles",ne)}},k=()=>{setTimeout(()=>{Be&&de&&g()},200)},we=ne=>{},H=ne=>{};p.on("connect",k),p.on("disconnect",we),p.on("connect_error",H),p.on("subscription:confirmed",ne=>{ne.type});const X=ne=>{if(!Nr.current||!ne||!ne.candle||!ne.symbol)return;const ae=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(ae(ne.symbol)!==ae(Be)||ne.timeframe&&ne.timeframe!==de)return;const{candle:S}=ne,O=qa(S,Be,de);if(!O)return;const Y=Date.now();if(Y-Ap.current<200)return;Ap.current=Y;const B=c.current?.timeScale(),h=B?.getVisibleRange(),b=u.current,I=c.current;if(!(!b||!I||!he.current&&!Nr.current||b?.seriesType?.()!==(qe==="line"?"Line":qe==="area"?"Area":qe==="bars"?"Bar":"Candlestick")))try{const _=zi.current.get(O.time),Q=!_,L=_?{time:O.time,open:_.open,high:Math.max(_.high,O.high),low:Math.min(_.low,O.low),close:O.close}:O;zi.current.set(O.time,L),Q&&m.current&&m.current.setData(Ka(Array.from(zi.current.values()),de));try{qe==="line"||qe==="area"?b.update({time:L.time,value:L.close}):b.update(L),B&&h&&Ce(h)}catch(x){throw x}}catch{}};p.on("candleUpdate",X);const J=()=>{p.connected&&Be&&de&&g()};if(p.connected)J();else{const ne=()=>{setTimeout(J,200)};p.once("connect",ne),setTimeout(()=>{p.connected&&J()},500)}return()=>{p.off("candleUpdate",X),p.off("connect",k),p.off("disconnect",we),p.off("connect_error",H),p.off("subscription:confirmed"),Be&&de&&p.connected&&p.emit("unsubscribeCandles",{symbol:Be,timeframe:de})}},[Be,de,Ge]),j.useEffect(()=>{const p=u.current,g=c.current;if(!(!p||!g)&&!(Ze.length===0&&he.current)){if(Ze.length===0&&!he.current){if(Lt)return;const k=g.timeScale();p.setData([]),k.fitContent(),Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(()=>requestAnimationFrame(()=>yt(!1)),400);return}if(!he.current){const k=(typeof Be=="string"?Be:Be?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),we=k.includes("JPY"),H=kr(k),X=Or(k);let J,ne;we?(J=.001,ne=h=>Math.abs(Number(h)).toFixed(3)):X?k.startsWith("BTC")||k.startsWith("ETH")?(J=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ne=h=>Math.abs(Number(h)).toFixed(4)):H&&(k.startsWith("XAU")||k.startsWith("XAG"))?(J=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ne=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:J,formatter:ne}})}catch{}const ae=g.timeScale(),S=Ee(Be,de);ge.current,ge.current=S;const O=[...Ze].sort((h,b)=>h.time-b.time);if(qe==="line"||qe==="area"){const h=O?.map(b=>({time:b.time,value:b.close})).filter(b=>b.time!=null);h.length>0&&p.setData(h)}else O?.length>0&&p.setData(O);ip(p);const Y=iA(de)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,L=Ve(Q,Y);h.primitive.originTime=L,h.originTime=L;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,L=Ve(Q,Y);h.primitive.time=L,h.time=q(L);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,f=O.length>0?O[O.length-1].time:null,D=W=>{const G=Ve(W,Y);return x==null||f==null?G:Math.min(Math.max(G,x),f)},P=D(Q),K=D(L);h.p1.rawTime=P,h.p1.normalizedTime=q(P),h.p2.rawTime=K,h.p2.normalizedTime=q(K),h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,f=O.length>0?O[O.length-1].time:null,D=ue=>{const me=Ve(ue,Y);return x==null||f==null?me:Math.min(Math.max(me,x),f)},P=D(Q),K=D(L);h.p1.rawTime=P,h.p2.rawTime=K,h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};const W=q(P),G=q(K),te=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:Ts(bs,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,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="rayline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="extendedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="trendbyangle"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=Ve(L.rawTime,Y);L.rawTime=x,L.normalizedTime=q(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="flattopbottom"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=Ve(L.rawTime,Y);L.rawTime=x,L.normalizedTime=q(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=Vi(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.intercept=Q.intercept,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="stddevchannel"&&h.primitive&&h.p1&&h.p2){const Q=Hr(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="andrewspitchfork"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y),x=Ve(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.p3.rawTime=x,h.p3.normalizedTime=q(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="gannfan"||h.type==="ganngrid")&&h.primitive&&h.p1&&h.p2){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(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=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(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=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y),x=Ve(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.p3.rawTime=x,h.p3.normalizedTime=q(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="fibonacci"||h.type==="rectangle")&&h.primitive&&h.p1&&h.p2){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type!=="trendline"&&h.type!=="gannline"||!h.series||!h.point1||!h.point2)return;const b=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=Ve(b,Y),d=Ve(I,Y);h.point1.time=w,h.point2.time=d;const _=LA([{time:w,value:h.point1.price},{time:d,value:h.point2.price}]);try{_.length>0&&h.series.setData(_)}catch{}}),O?.length>0){const h=O[O?.length-1].time,b=iA(de)||60,w=h-(de==="M1"?150:de==="M5"?120:100)*b;try{ae.setVisibleRange({from:w,to:h+b*$d})}catch{ae.fitContent()}}else ae.fitContent();try{g.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}he.current=!0;const B=ae.getVisibleRange();Ce(B),Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(()=>requestAnimationFrame(()=>yt(!1)),400)}}},[Ze.length,qe,Be,de]),j.useEffect(()=>{const p=c.current;if(!p||!he.current||Ze.length===0)return;const g=p.timeScale(),k=g.getVisibleRange()||ye();if(u.current)try{p.removeSeries(u.current)}catch{}if(y.current)try{p.removeSeries(y.current),y.current=null}catch{}let we;const H=(typeof Be=="string"?Be:Be?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=H.includes("JPY"),J=kr(H),ne=Or(H);let ae,S;X?(ae=.001,S=B=>Math.abs(Number(B)).toFixed(3)):ne?H.startsWith("BTC")||H.startsWith("ETH")?(ae=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(ae=1e-4,S=B=>Math.abs(Number(B)).toFixed(4)):J&&(H.startsWith("XAU")||H.startsWith("XAG"))?(ae=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(ae=1e-4,S=B=>Math.abs(Number(B)).toFixed(5));const O={type:"custom",minMove:ae,formatter:S};if(qe==="bars"){const B=rt==="light";we=p.addBarSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...Ze].sort((b,I)=>b.time-I.time);h?.length>0&&we.setData(h)}else if(qe==="line"){we=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=LA(Wa);B.length>0&&we.setData(B)}else if(qe==="area"){we=p.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=LA(Wa);B.length>0&&we.setData(B)}else if(qe==="volume ticks"||qe==="volume"){const B=rt==="light";we=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,priceScaleId:"right"});const h=[...Ze].sort((w,d)=>w.time-d.time);h?.length>0&&we.setData(h);const b=p.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),p.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const I=h?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));I.length>0&&b.setData(I),y.current=b}else{const B=rt==="light";we=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...Ze].sort((b,I)=>b.time-I.time);h?.length>0&&we.setData(h)}u.current=we,ip(we,!0);const Y=iA(de)||60;if(v.current.forEach(B=>{if(B.type==="horizontalray"&&B.primitive){const L=B.rawOriginTime??B.primitive.originTime,x=Ve(L,Y);B.primitive.originTime=x,B.originTime=x;return}if(B.type==="verticalline"&&B.primitive){const L=B.rawTime??B.primitive.time,x=Ve(L,Y);B.primitive.time=x,B.time=q(x);return}if(B.type==="infoline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,f=[...Ze].sort((te,ue)=>te.time-ue.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,K=te=>{const ue=Ve(te,Y);return D==null||P==null?ue:Math.min(Math.max(ue,D),P)},W=K(L),G=K(x);B.p1.rawTime=W,B.p1.normalizedTime=q(W),B.p2.rawTime=G,B.p2.normalizedTime=q(G),B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:G,price:B.p2.price};return}if(B.type==="rulerline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,f=[...Ze].sort((xe,Me)=>xe.time-Me.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,K=xe=>{const Me=Ve(xe,Y);return D==null||P==null?Me:Math.min(Math.max(Me,D),P)},W=K(L),G=K(x);B.p1.rawTime=W,B.p2.rawTime=G,B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:G,price:B.p2.price};const te=q(W),ue=q(G),me=Math.abs((ue??0)-(te??0));B.primitive.info={priceDiff:B.p2.price-B.p1.price,pricePct:(B.p2.price-B.p1.price)/Math.abs(B.p1.price||1)*100,bars:Ts(bs,W,G,de),days:Math.max(1,Math.round(me/86400))};return}if(B.type==="arrowedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="rayline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="extendedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="trendbyangle"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="disjointchannel"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const f=Ve(x.rawTime,Y);x.rawTime=f,x.normalizedTime=q(f)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="flattopbottom"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const f=Ve(x.rawTime,Y);x.rawTime=f,x.normalizedTime=q(f)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="regressionchannel"&&B.primitive&&B.p1&&B.p2){const L=[...Ze].sort((D,P)=>D.time-P.time),x=Vi(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const f=B.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.intercept=x.intercept,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="stddevchannel"&&B.primitive&&B.p1&&B.p2){const L=[...Ze].sort((D,P)=>D.time-P.time),x=Hr(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const f=B.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="andrewspitchfork"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y),f=Ve(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.p3.rawTime=f,B.p3.normalizedTime=q(f),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:f,price:B.p3.price};return}if((B.type==="gannfan"||B.type==="ganngrid")&&B.primitive&&B.p1&&B.p2){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if((B.type==="circle"||B.type==="ellipse")&&B.primitive&&B.p1&&B.p2){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type==="triangle"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y),f=Ve(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.p3.rawTime=f,B.p3.normalizedTime=q(f),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:f,price:B.p3.price};return}if((B.type==="fibonacci"||B.type==="rectangle")&&B.primitive&&B.p1&&B.p2){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type!=="trendline"&&B.type!=="gannline"||!B.series||!B.point1||!B.point2)return;const h=B.type==="gannline"?"#7aa6ae":"#22c55e";try{p.removeSeries(B.series)}catch{}const b=p.addLineSeries({color:B.lineColor??h,lineWidth:B.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),I=B.point1.rawTime??B.point1.time,w=B.point2.rawTime??B.point2.time,d=Ve(I,Y),_=Ve(w,Y);B.point1.time=d,B.point2.time=_;const Q=LA([{time:d,value:B.point1.price},{time:_,value:B.point2.price}]);try{Q.length>0&&b.setData(Q)}catch{}if(B.decoration)try{b.attachPrimitive(B.decoration)}catch{}B.series=b}),k&&he.current)setTimeout(()=>{try{g.setVisibleRange(k),Ce(k)}catch{if(Ze.length>0)try{const h=Ze[Ze.length-1].time,b=iA(de)||60,I=h-100*b;g.setVisibleRange({from:I,to:h+b*$d}),Ce(g.getVisibleRange())}catch{g.fitContent(),Ce(g.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!he.current){g.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}he.current=!0,Ce(g.getVisibleRange())}},[qe,Ze.length,Wa.length,Be]),j.useEffect(()=>{const p=c.current,g=y.current;if(!p||!g||!he.current||Ze.length===0||qe!=="volume"&&qe!=="volume ticks")return;const we=[...Ze].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)"}));we.length>0&&g.setData(we)},[Ze,qe]),j.useEffect(()=>{if(!Be||!de||!Qe)return;const g=Object.entries(Qe).filter(([J,ne])=>ne).map(([J])=>J).filter(J=>J.startsWith("sma")||J.startsWith("ema")||J==="rsi"||J==="macd");if(g.length===0){Re({});return}const k=g.map(J=>J==="sma20"?`sma:${Te?.smaPeriod||20}`:J==="sma50"?"sma:50":J==="ema12"?`ema:${Te?.emaPeriod||12}`:J==="rsi"?`rsi:${Te?.rsiPeriod||14}`:J==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!k)return;const we=++ze.current,H=Ge||"http://localhost:5002",X=De?.indicators||"/api/market-data/indicators";ht.get(`${H}${X}`,{params:{symbol:Be,timeframe:de,indicators:k}}).then(J=>{we===ze.current&&Re(J.data?.data||{})}).catch(J=>{console.error("[ChartArea] Indicator fetch error:",J?.message),we===ze.current&&Re({})})},[Be,de,Qe,Te,Ge,De]),j.useEffect(()=>{const p=c.current;if(!p||!he.current)return;const g=He.current,k=(ae,S)=>(g[ae]||(g[ae]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...S})),g[ae]),we=ae=>{if(g[ae]){try{p.removeSeries(g[ae])}catch{}delete g[ae]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(we)},X=Qe||{};if(X.sma20&&Se.sma20?.data?.length?k("sma20",{color:"#2196F3",lineWidth:1.5}).setData(Se.sma20.data.map(S=>({time:S.time,value:S.value}))):we("sma20"),X.sma50&&Se.sma50?.data?.length?k("sma50",{color:"#FF9800",lineWidth:1.5}).setData(Se.sma50.data.map(S=>({time:S.time,value:S.value}))):we("sma50"),X.ema12&&Se.ema12?.data?.length?k("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(Se.ema12.data.map(S=>({time:S.time,value:S.value}))):we("ema12"),X.rsi&&Se.rsi?.data?.length){const ae=k("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:B=>B.toFixed(1)}});p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),ae.setData(Se.rsi.data.map(B=>({time:B.time,value:B.value}))),g.rsi70||(g.rsi70=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),g.rsi30||(g.rsi30=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const S=Se.rsi.data,O=S[0]?.time,Y=S[S.length-1]?.time;O&&Y&&(g.rsi70.setData([{time:O,value:70},{time:Y,value:70}]),g.rsi30.setData([{time:O,value:30},{time:Y,value:30}]))}else we("rsi"),we("rsi70"),we("rsi30");if(X.macd&&Se.macd?.data?.length){const ae=k("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}),S=k("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});g.macdHist||(g.macdHist=p.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}));const O=X.rsi?.65:.8;p.priceScale("macd").applyOptions({scaleMargins:{top:O,bottom:0},borderVisible:!1,autoScale:!0}),X.rsi&&p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const Y=Se.macd.data;ae.setData(Y.map(B=>({time:B.time,value:B.value}))),S.setData(Y.map(B=>({time:B.time,value:B.signal}))),g.macdHist.setData(Y.map(B=>({time:B.time,value:B.histogram,color:B.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else H();const J=X.rsi&&Se.rsi?.data?.length||X.macd&&Se.macd?.data?.length,ne=X.rsi&&Se.rsi?.data?.length&&X.macd&&Se.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:ne?.4:J?.25:.05}})}catch{}},[Se,Qe,Ze.length]),j.useEffect(()=>()=>{const p=c.current;if(!p)return;const g=He.current;Object.keys(g).forEach(k=>{try{p.removeSeries(g[k])}catch{}}),He.current={}},[Be,de]),j.useEffect(()=>{const p=c.current,g=u.current,k=o.current;if(!p||!g||!k)return;const H=Fe!==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"][Fe]:null,X=(S,O)=>{const Y=Math.min(S.time,O.time),B=Math.max(S.time,O.time),h=S.time<=O.time?S.rawTime:O.rawTime,b=S.time<=O.time?O.rawTime:S.rawTime,I=Math.max(S.price,O.price),w=Math.min(S.price,O.price),d=q(Math.round((Y+B)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:Y,price:w},p3:{rawTime:b,normalizedTime:B,price:w}}};if(!H){if(T.current=!1,C.current=null,U.current=null,E.current=null,F.current?.series)try{p.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const d={type:"pricelevel",priceLine:g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};ve(_=>[..._,d]),v.current.push(d),Ue(null)};return k.addEventListener("click",S),()=>{k.removeEventListener("click",S)}}if(H==="horizontalray"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Ev(I,b);g.attachPrimitive(w);const d=g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),_=q(b),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:_,rawOriginTime:b,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};ve(L=>[...L,Q]),v.current.push(Q),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="verticalline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=p.timeScale().coordinateToTime(B);if(h==null)return;const b=new Wv(h);g.attachPrimitive(b);const I=q(h),w={type:"verticalline",primitive:b,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};ve(d=>[...d,w]),v.current.push(w),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="text"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Gv(b,I);g.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:b,price:I,text:"Text"};ve(_=>[..._,d]),v.current.push(d),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="infoline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;O||(O=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=S.normalizedTime,L=q(d);if(Q==null||L==null||Q===L)return;const x=Q<=L?[{time:Q,value:S.price},{time:L,value:_}]:[{time:L,value:_},{time:Q,value:S.price}];try{O.setData(x)}catch{}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:q(d),x:I,y:w};return}if(O){try{p.removeSeries(O)}catch{}O=null}const Q=S.normalizedTime,L=q(d);if(Q==null||L==null)return;const x=_-S.price,f=x/Math.abs(S.price)*100,D=iA(de)||3600,P=Math.abs(L-Q),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=S.x,te=S.y,ue=I,xe=Math.atan2(-(w-te),ue-G)*(180/Math.PI),Me={priceDiff:x,pricePct:f,bars:K,days:W,angle:xe},$e=new Lv({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_},Me);g.attachPrimitive($e);const et={type:"infoline",primitive:$e,rawP1Time:S.rawTime,rawP2Time:d,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};ve(We=>[...We,et]),v.current.push(et),S=null,Ue(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{p.removeSeries(O)}catch{}}}if(H==="rulerline"){let S=null,O=null;const Y=(b,I,w,d)=>{const _=q(b),Q=q(w),L=d-I,x=L/Math.abs(I)*100,f=Ts(bs,b,w,de),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:L,pricePct:x,bars:f,days:P}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null||L===S.normalizedTime)return;const x=Y(S.rawTime,S.price,_,Q);if(!O)O=new Pd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},x),g.attachPrimitive(O);else{O.p2={rawTime:_,price:Q},O.info=x;const f=Q>=S.price;O.color=f?"#3b82f6":"#ef5350",O.fillColor=f?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;if(!S){S={rawTime:_,price:Q,normalizedTime:q(_)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const L=S.normalizedTime,x=q(_);if(L==null||x==null)return;const f=Y(S.rawTime,S.price,_,Q),D=new Pd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},f);g.attachPrimitive(D);const P={type:"rulerline",primitive:D,rawP1Time:S.rawTime,rawP2Time:_,p1:{rawTime:S.rawTime,normalizedTime:L,price:S.price},p2:{rawTime:_,normalizedTime:x,price:Q},lineColor:Q>=S.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};ve(K=>[...K,P]),v.current.push(P),S=null,Ue(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="arrowedline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;const Q=q(d);if(!(Q==null||Q===S.normalizedTime))if(!O)O=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),g.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{c.current?.applyOptions({})}catch{}}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:q(d)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=q(d);if(Q==null||L==null||Q===L)return;const x=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"arrowedline",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};ve(D=>[...D,f]),v.current.push(f),S=null,Ue(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{g.detachPrimitive(O)}catch{}}}if(H==="rayline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const L=new _v({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"rayline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};ve(f=>[...f,x]),v.current.push(x),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="extendedline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const L=new Pv({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"extendedline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};ve(f=>[...f,x]),v.current.push(x),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="crossline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d=new kv({rawTime:b,price:I});g.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:b,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};ve(Q=>[...Q,_]),v.current.push(_),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="trendbyangle"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const L=new Ov({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"trendbyangle",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};ve(f=>[...f,x]),v.current.push(x),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="disjointchannel"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new ka(_,Q,L,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:f},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P==null)return;const K=(S.price+O.price)/2;D>=K?(Y={rawTime:f,normalizedTime:P,price:D},B={rawTime:f,normalizedTime:P,price:2*K-D}):(B={rawTime:f,normalizedTime:P,price:D},Y={rawTime:f,normalizedTime:P,price:2*K-D}),I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P!=null){if(h===0){S={rawTime:f,normalizedTime:P,price:D},O={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const K=g.coordinateToPrice(x);if(K==null||Math.abs(K-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:K},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const K=new ka(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:q(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:q(b.p4.rawTime),price:b.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};ve(G=>[...G,W]),v.current.push(W),Ue(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="flattopbottom"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new kd(_,Q,L,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:f},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P==null)return;Y={rawTime:f,normalizedTime:P,price:D},B={rawTime:f,normalizedTime:P,price:O.price},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P!=null){if(h===0){S={rawTime:f,normalizedTime:P,price:D},O={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const K=g.coordinateToPrice(x);if(K==null||Math.abs(K-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:K},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const K=new kd(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:q(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:q(b.p4.rawTime),price:b.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};ve(G=>[...G,W]),v.current.push(W),Ue(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="regressionchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;const f=Vi(Ze,S,{rawTime:_,normalizedTime:L},1);if(f)if(!O)O=new Oa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(O);else{Y(O,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const f=Vi(Ze,S,{rawTime:_,normalizedTime:L},1);if(!f)return;if(O){try{g.detachPrimitive(O)}catch{}O=null}const D=new Oa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,intercept:f.intercept,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};ve(K=>[...K,P]),v.current.push(P),S=null,Ue(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="stddevchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;const f=Hr(Ze,S,{rawTime:_,normalizedTime:L},1);if(f)if(!O)O=new Kd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(O);else{Y(O,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const f=Hr(Ze,S,{rawTime:_,normalizedTime:L},1);if(!f)return;if(O){try{g.detachPrimitive(O)}catch{}O=null}const D=new Kd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};ve(K=>[...K,P]),v.current.push(P),S=null,Ue(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="andrewspitchfork"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d=B+140,_=p.timeScale().coordinateToTime(d);if(_==null)return;const Q=q(_);if(Q==null)return;const L={rawTime:b,normalizedTime:w,price:I},x={rawTime:_,normalizedTime:Q,price:I},f={rawTime:b,normalizedTime:w,price:I},D=new Kv({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:f.rawTime,price:f.price});g.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:L,p2:x,p3:f};ve(K=>[...K,P]),v.current.push(P),M(P),le.current=P,Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="gannfan"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new Vv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const L={type:"gannfan",primitive:Q,p1:d,p2:_};ve(x=>[...x,L]),v.current.push(L),M(L),le.current=L,Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="ganngrid"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new zv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const L={type:"ganngrid",primitive:Q,p1:d,p2:_};ve(x=>[...x,L]),v.current.push(L),M(L),le.current=L,Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="trendline"||H==="gannline"){const S=H,O=S==="gannline"?"#7aa6ae":"#22c55e",Y=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=g.coordinateToPrice(_);if(!(Q==null||L==null)&&(Q=q(Q),Q!=null))if(E.current===null){E.current={time:Q,price:L};const x=p.addLineSeries({color:O,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:S,series:x},x.setData([{time:Q,value:L}])}else{const x=E.current,f={time:Q,price:L},D=1,P=1e-5,K=Math.abs(f.time-x.time),W=Math.abs(f.price-x.price);if(K<D&&W<P){try{p.removeSeries(F.current.series)}catch{}E.current=null,F.current=null;return}const G={time:x.time,rawTime:x.time,price:x.price},te={time:f.time,rawTime:f.time,price:f.price},ue=LA([{time:G.time,value:G.price},{time:te.time,value:te.price}]);if(ue.length>0){F.current.series.setData(ue);const me=new Nv(G,te,O,2);try{F.current.series.attachPrimitive(me)}catch{}const xe={type:S,series:F.current.series,point1:G,point2:te,decoration:me};ve(Me=>[...Me,xe]),v.current.push(xe)}Ue(null),E.current=null,F.current=null}},B=I=>{if(E.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=g.coordinateToPrice(_);if(Q==null||L==null||(Q=q(Q),Q==null))return;const x=E.current,f=LA([{time:x.time,value:x.price},{time:Q,value:L}]);f.length>0&&F.current.series.setData(f)},h=I=>{I.stopPropagation()},b={capture:!0,passive:!1};return k.addEventListener("click",Y,b),k.addEventListener("mousemove",B,b),k.addEventListener("mousemove",h,b),()=>{if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}k.removeEventListener("click",Y,b),k.removeEventListener("mousemove",B,b),k.removeEventListener("mousemove",h,b)}}if(H==="parallellines"){let S=null,O=null,Y=null,B=0,h=null;const b=(L,x,f,D)=>{L.p1={rawTime:x.rawTime,price:x.price},L.p2={rawTime:f.rawTime,price:f.price},L.b1={rawTime:D.b1.rawTime,price:D.b1.price},L.b2={rawTime:D.b2.rawTime,price:D.b2.price},L.p3={rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}},I=(L,x,f)=>{const D=Gd(L,x,f);if(!D)return null;if(!h)h=new Od({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:D.b1.rawTime,price:D.b1.price},{rawTime:D.b2.rawTime,price:D.b2.price},{rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}),g.attachPrimitive(h);else{b(h,L,x,D);try{p.applyOptions({})}catch{}}return D},w=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const x=k.getBoundingClientRect(),f=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(f),K=g.coordinateToPrice(D);if(P==null||K==null)return;const W=q(P);if(W!=null){if(B===0){S={rawTime:P,normalizedTime:W,price:K},B=1;return}if(B===1){if(O={rawTime:P,normalizedTime:W,price:K},Math.abs(O.normalizedTime-S.normalizedTime)<1)return;const G=q((S.normalizedTime+O.normalizedTime)/2);if(G==null)return;const te=(S.price+O.price)/2;Y={rawTime:G,normalizedTime:G,price:te},I(S,O,Y),B=2;return}if(B===2&&S&&O){Y={rawTime:P,normalizedTime:W,price:K};const G=I(S,O,Y);if(!G||!h)return;try{g.detachPrimitive(h)}catch{}const te=new Od({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:G.b1.rawTime,price:G.b1.price},{rawTime:G.b2.rawTime,price:G.b2.price},{rawTime:G.bottomMid.rawTime,price:G.bottomMid.price});g.attachPrimitive(te);const ue={type:"equidistantchannel",primitive:te,p1:S,p2:O,p3:G.bottomMid,b1:G.b1,b2:G.b2,bottomMid:G.bottomMid};ve(me=>[...me,ue]),v.current.push(ue),Ue(null),B=0,S=null,O=null,Y=null,h=null}}},d=L=>{if(B===0||!S)return;const x=k.getBoundingClientRect(),f=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(f),K=g.coordinateToPrice(D);if(P==null||K==null)return;const W=q(P);if(W!=null){if(B===1){const G={rawTime:P,normalizedTime:W,price:K},te=q((S.normalizedTime+G.normalizedTime)/2);if(te==null)return;const ue=(S.price+G.price)/2;I(S,G,{rawTime:te,normalizedTime:te,price:ue});return}B===2&&O&&I(S,O,{rawTime:P,normalizedTime:W,price:K})}},_=L=>{L.stopPropagation()},Q={capture:!0,passive:!1};return k.addEventListener("click",w,Q),k.addEventListener("mousemove",d,Q),k.addEventListener("mousemove",_,Q),()=>{if(B=0,S=null,O=null,Y=null,N.current=[],h)try{g.detachPrimitive(h)}catch{}h=null,k.removeEventListener("click",w,Q),k.removeEventListener("mousemove",d,Q),k.removeEventListener("mousemove",_,Q)}}if(H==="fibonacci"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(!(d==null||_==null))if(!O)O=new Vd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),g.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{p.applyOptions({})}catch{}}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:q(d)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=q(d);if(Q==null||L==null)return;if(Math.abs(_-S.price)<1e-5){S=null;return}const x=new Vd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"fibonacci",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_}};ve(D=>[...D,f]),v.current.push(f),S=null,Ue(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{g.detachPrimitive(O)}catch{}}}if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}const J=S=>{if(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const O=k.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=g.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=q(h),h!=null){if(T.current=!0,C.current={time:h,normalizedTime:h,rawTime:I,price:b},U.current=null,H==="rectangle"){const w=new Mv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new Hv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1});g.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new Iv({rawTime:I,price:b},{rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new Dv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});g.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}}}},ne=S=>{if(!T.current||!C.current||!F.current)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();const O=k.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=g.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=q(h),h==null)return;U.current={time:h,normalizedTime:h,rawTime:I,price:b};const w=C.current;if(F.current.type==="rectangle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const d=F.current.primitive,_=X(w,{time:h,rawTime:I,price:b});if(!_)return;d.p1={rawTime:_.p1.rawTime,price:_.p1.price},d.p2={rawTime:_.p2.rawTime,price:_.p2.price},d.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const d=F.current.firstLine;d.endTime-d.startTime;const _=d.endPrice-d.startPrice,Q=b,L=Q+_;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:L}]);else{const x=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});x.setData([{time:w.time,value:Q},{time:h,value:L}]),F.current.secondLine=x}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:b}])},ae=S=>{if(S&&(S.preventDefault(),S.stopPropagation()),!T.current||!F.current||!C.current)return;const O=C.current,Y=U.current||O;if(F.current.type==="parallellines")if(F.current.firstLine){const B={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};ve(h=>[...h,B]),v.current.push(B),Ue(null),F.current=null,T.current=!1,C.current=null,U.current=null;return}else{F.current.firstLine={startTime:O.time,startPrice:O.price,endTime:Y.time,endPrice:Y.price},T.current=!1,C.current=null,U.current=null;return}if(F.current.type==="rectangle"){const B=C.current,h=U.current||B,b=Math.max(B.price,h.price),I=Math.min(B.price,h.price),w=q(Math.min(B.time,h.time)),d=q(Math.max(B.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(b-I)>=1e-5){const _=F.current.primitive,Q=B.time<=h.time?B.rawTime:h.rawTime,L=B.time<=h.time?h.rawTime:B.rawTime,x={rawTime:Q,normalizedTime:w,price:b},f={rawTime:L,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:f.rawTime,price:f.price};const D={type:"rectangle",primitive:_,p1:x,p2:f};ve(P=>[...P,D]),v.current.push(D),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=3){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price};const L={type:"circle",primitive:B,p1:h,p2:b};ve(x=>[...x,L]),v.current.push(L),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const B=F.current.primitive,h=X(O,Y);if(h){const b=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(b>=1&&I>=1e-5){B.p1={rawTime:h.p1.rawTime,price:h.p1.price},B.p2={rawTime:h.p2.rawTime,price:h.p2.price},B.p3={rawTime:h.p3.rawTime,price:h.p3.price};const w={type:"triangle",primitive:B,p1:h.p1,p2:h.p2,p3:h.p3};ve(d=>[...d,w]),v.current.push(w),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=4){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price},B.previewAsLine=!1,B.minorRatio=.45;const L={type:"ellipse",primitive:B,p1:h,p2:b,minorRatio:.45};ve(x=>[...x,L]),v.current.push(L),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}T.current=!1,C.current=null,U.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const S={capture:!0,passive:!1},O=Y=>{T.current||Y.stopPropagation()};return k.addEventListener("mousedown",J,S),k.addEventListener("mousemove",ne,S),k.addEventListener("mousemove",O,S),k.addEventListener("mouseup",ae,S),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null,T.current=!1,C.current=null,U.current=null,k.removeEventListener("mousedown",J,S),k.removeEventListener("mousemove",ne,S),k.removeEventListener("mousemove",O,S),k.removeEventListener("mouseup",ae,S)}}},[Fe,Ze,ve,Ue]),j.useEffect(()=>{const p=c.current,g=u.current,k=o.current,we=Fe===null||Fe===1;if(!we||!p||!g||!k){we||(M(null),V([]),re(null),Z([]));return}const H=10,X=8;function J(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="gannline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="rectangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=Math.min(b,w),Q=Math.max(b,w),L=Math.min(I,d),x=Math.max(I,d),f=(_+Q)/2,D=(L+x)/2;return[{x:_,y:L},{x:f,y:L},{x:Q,y:L},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:f,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=(b+w)/2,Q=(I+d)/2,L=w-b,x=d-I,f=Math.hypot(L,x);if(f<.001)return[];const D=L/f,P=x/f,K=-P,W=D,G=f/2,te=G*Math.max(.05,h.minorRatio??.45);return[{x:_-D*G,y:Q-P*G},{x:_+K*te,y:Q+W*te},{x:_+D*G,y:Q+P*G},{x:_-K*te,y:Q-W*te}]}if(h.type==="gannfan"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="rayline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="extendedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="crossline"&&h.p){const b=p.timeScale().timeToCoordinate(h.p.rawTime),I=g.priceToCoordinate(h.p.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const b=g.priceToCoordinate(h.price);return b==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:b}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const b=p.timeScale().timeToCoordinate(h.rawTime),I=g.priceToCoordinate(h.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=g.priceToCoordinate(h.b1.price),L=p.timeScale().timeToCoordinate(h.b2.rawTime),x=g.priceToCoordinate(h.b2.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:(_+L)/2,y:(Q+x)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="flattopbottom"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="infoline"&&h.p1&&h.p2){const b=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=p.timeScale().timeToCoordinate(b),d=g.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=g.priceToCoordinate(h.p2.price);return w==null||d==null||_==null||Q==null?[]:[{x:w,y:d},{x:_,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="horizontalray"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.originTime),w=g.priceToCoordinate(b.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.time);if(I==null)return[];const w=b.midYCss??200;return[{x:I,y:w}]}return[]}function ne(h,b){for(let I=Ke.length-1;I>=0;I--){const w=Ke[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);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(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.min(d,Q),f=Math.max(d,Q),D=Math.min(_,L),P=Math.max(_,L),K=(x+f)/2,W=(D+P)/2,G=[{x,y:D,mode:"handle1"},{x:K,y:D,mode:"handle2"},{x:f,y:D,mode:"handle3"},{x,y:W,mode:"handle4"},{x:f,y:W,mode:"handle5"},{x,y:P,mode:"handle6"},{x:K,y:P,mode:"handle7"},{x:f,y:P,mode:"handle8"}];for(const Me of G)if(Math.hypot(h-Me.x,b-Me.y)<H)return{object:w,mode:Me.mode};const te=ot(h,b,x,D,f,D),ue=ot(h,b,x,P,f,P),me=ot(h,b,x,D,x,P),xe=ot(h,b,f,D,f,P);if(te<X||ue<X||me<X||xe<X||ti(h,b,[{x,y:D},{x:f,y:D},{x:f,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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(Q-d,L-_);if(x<2)continue;const f=Math.hypot(h-d,b-_),D=Math.hypot(h-Q,b-L);if(f<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(f-x)<X||f<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=ot(h,b,d,_,Q,L),G=ot(h,b,Q,L,x,f),te=ot(h,b,x,f,d,_);if(W<X||G<X||te<X||ti(h,b,[{x:d,y:_},{x:Q,y:L},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Q-d,P=L-_,K=Math.hypot(D,P);if(K<2)continue;const W=D/K,G=P/K,te=-G,ue=W,me=K/2,xe=me*Math.max(.05,w.minorRatio??.45);if(me<2||xe<2)continue;const Me=x-W*me,$e=f-G*me,et=x+te*xe,We=f+ue*xe,dt=x+W*me,at=f+G*me,pt=x-te*xe,bt=f-ue*xe,Kt=Math.hypot(h-Me,b-$e),$t=Math.hypot(h-et,b-We),AA=Math.hypot(h-dt,b-at),DA=Math.hypot(h-pt,b-bt);if(Kt<H)return{object:w,mode:"handle1"};if($t<H)return{object:w,mode:"handle2"};if(AA<H)return{object:w,mode:"handle3"};if(DA<H)return{object:w,mode:"handle4"};const yi=(h-x)*W+(b-f)*G,Fs=(h-x)*te+(b-f)*ue,sp=yi/me,op=Fs/xe,ap=sp*sp+op*op;if(Math.abs(ap-1)<.2||ap<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(Zv(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(Jv(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),_=g.priceToCoordinate(w.p.price);if(d==null||_==null)continue;if(Math.hypot(h-d,b-_)<H)return{object:w,mode:"handle1"};const L=Math.abs(b-_),x=Math.abs(h-d);if(L<X||x<X)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),_=g.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=Wd(w,d,_);if(h>=Q.left&&h<=Q.right&&b>=Q.top&&b<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),f=g.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=g.priceToCoordinate(w.b2.price),K=x!=null&&D!=null?(x+D)/2:null,W=f!=null&&P!=null?(f+P)/2:null;if(d==null||_==null||Q==null||L==null||K==null||W==null||x==null||f==null||D==null||P==null)continue;const G=Math.hypot(h-d,b-_),te=Math.hypot(h-Q,b-L),ue=Math.hypot(h-K,b-W),me=Math.hypot(d-K,_-W)<H*1.5;if(me&&Math.min(G,ue)<H*1.5)return{object:w,mode:"handle3"};if(ue<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle2"};if(me)continue;if(G<H)return{object:w,mode:"handle1"};const xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P);if(xe<X||Me<X||ti(h,b,[{x:d,y:_},{x:Q,y:L},{x:D,y:P},{x,y:f}]))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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null||K==null||W==null||G==null||te==null)continue;const ue=Math.hypot(h-d,b-_),me=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P),$e=ot(h,b,K,W,G,te);if(xe<X||Me<X||$e<X||ti(h,b,[{x,y:f},{x:D,y:P},{x:G,y:te},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null||K==null||W==null||G==null||te==null)continue;const ue=Math.hypot(h-d,b-_),me=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P),$e=ot(h,b,K,W,G,te);if(xe<X||Me<X||$e<X||ti(h,b,[{x,y:f},{x:D,y:P},{x:G,y:te},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=(Q+x)/2,G=(L+f)/2;let te=W-d,ue=G-_;Math.abs(te)<1e-4&&(te=1e-4);const me=ue/te,xe=k.clientWidth,Me=L+me*(xe-Q),$e=f+me*(xe-x),et=ot(h,b,Q,L,xe,Me),We=ot(h,b,x,f,xe,$e);if(et<X||We<X||ti(h,b,[{x:Q,y:L},{x:xe,y:Me},{x:xe,y:$e},{x,y:f}]))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),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),G=Math.hypot(h-x,b-f),te=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const ue=ot(h,b,d,_,x,f),me=ot(h,b,Q,L,D,P),xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P);if(ue<X||me<X||xe<X||Me<X||ti(h,b,[{x:d,y:_},{x,y:f},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),G=Math.hypot(h-x,b-f),te=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const ue=ot(h,b,d,_,x,f),me=ot(h,b,Q,L,D,P),xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P);if(ue<X||me<X||xe<X||Me<X||ti(h,b,[{x:d,y:_},{x,y:f},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);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(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const d=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,Q=p.timeScale().timeToCoordinate(d),L=g.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),f=g.priceToCoordinate(w.p2.price);if(Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-Q,b-L),P=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ot(h,b,Q,L,x,f)<X)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.originTime),Q=g.priceToCoordinate(d.price);if(Q==null)continue;if(_!=null&&Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};const L=_==null?0:Math.max(0,_);if(h>=L&&Math.abs(b-Q)<X)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.time);if(_==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-_)<X)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const d=g.priceToCoordinate(w.price);if(d==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,b-d)<H)return{object:w,mode:"line"};if(Math.abs(b-d)<X)return{object:w,mode:"line"}}}return null}const ae=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=ne(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,Ae(d.object),ee.current=null,oe.current=null;return}M(d.object),re(null),Z([]),ee.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),ee.current=null,V([]),re(null),Z([])},S=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top;if(!ee.current){const x=ne(I,w);if(x?.object&&!le.current){const f=J(x.object);re(D=>D===x.object?D:x.object),Z(D=>D.length===f.length&&D.every((P,K)=>P.x===f[K].x&&P.y===f[K].y)?D:f)}else re(f=>f==null?f:null),Z(f=>f.length===0?f:[]);return}const d=le.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=g.coordinateToPrice(w);if(_==null||Q==null)return;let L=q(_);if(L!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=K=>{const W=K.rawTime??K.time,G=K.normalizedTime??q(W);return{rawTime:W,normalizedTime:G,price:K.price}},f=(K,W)=>{const G=K.normalizedTime??q(K.rawTime),te=W.normalizedTime??q(W.rawTime);if(G==null||te==null)return;const ue=W.price-K.price,me=ue/Math.abs(K.price)*100,xe=iA(de)||3600,Me=Math.abs(te-G),$e=Math.max(1,Math.round(Me/xe)),et=Math.max(1,Math.round(Me/86400)),We=p.timeScale().timeToCoordinate(K.rawTime),dt=g.priceToCoordinate(K.price),at=p.timeScale().timeToCoordinate(W.rawTime),pt=g.priceToCoordinate(W.price),bt=We!=null&&dt!=null&&at!=null&&pt!=null?Math.atan2(-(pt-dt),at-We)*(180/Math.PI):d.primitive?.info?.angle??0,Kt={priceDiff:ue,pricePct:me,bars:$e,days:et,angle:bt},$t=d.primitive;if($t){$t.p1={rawTime:K.rawTime,price:K.price},$t.p2={rawTime:W.rawTime,price:W.price},$t.info=Kt;try{c.current?.applyOptions({})}catch{}}const AA={...d,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:G,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:te,price:W.price}};ve(DA=>{const yi=DA.map(Fs=>Fs===d?AA:Fs);return v.current=yi,yi}),M(AA),le.current=AA,We!=null&&dt!=null&&at!=null&&pt!=null&&V([{x:We,y:dt},{x:at,y:pt}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(ee.current==="handle1"){const K=p.timeScale().coordinateToTime(I)??_;f({rawTime:K,normalizedTime:L,price:Q},P)}else if(ee.current==="handle2"){const K=p.timeScale().coordinateToTime(I)??_;f(D,{rawTime:K,normalizedTime:L,price:Q})}else if(ee.current==="line"){const K=oe.current;if(!K)return;const W=x(K.p1),G=x(K.p2);if(W.rawTime==null||W.normalizedTime==null||G.rawTime==null||G.normalizedTime==null)return;const te=p.timeScale().coordinateToTime(K.x)??W.rawTime,ue=g.coordinateToPrice(K.y);if(te==null||ue==null)return;const me=q(te)??W.normalizedTime;if(me==null)return;const xe=L-me,Me=Q-ue,$e=q(W.normalizedTime+xe),et=q(G.normalizedTime+xe);if($e==null||et==null)return;const We=_-te;f({rawTime:W.rawTime+We,normalizedTime:$e,price:W.price+Me},{rawTime:G.rawTime+We,normalizedTime:et,price:G.price+Me})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(f,D)=>{const P=f.normalizedTime??f.rawTime,K=D.normalizedTime??D.rawTime,W=D.price-f.price,G=W/Math.abs(f.price)*100,te=Ts(bs,f.rawTime,D.rawTime,de),ue=Math.abs(K-P),me=Math.max(1,Math.round(ue/86400)),xe={priceDiff:W,pricePct:G,bars:te,days:me},Me=d.primitive;if(Me){Me.p1={rawTime:f.rawTime,price:f.price},Me.p2={rawTime:D.rawTime,price:D.price},Me.info=xe;const pt=D.price>=f.price;Me.color=pt?"#3b82f6":"#ef5350",Me.fillColor=pt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const $e={...d,rawP1Time:f.rawTime,rawP2Time:D.rawTime,p1:f,p2:D};ve(pt=>{const bt=pt.map(Kt=>Kt===d?$e:Kt);return v.current=bt,bt}),M($e),le.current=$e;const et=p.timeScale().timeToCoordinate(f.rawTime),We=g.priceToCoordinate(f.price),dt=p.timeScale().timeToCoordinate(D.rawTime),at=g.priceToCoordinate(D.price);et!=null&&We!=null&&dt!=null&&at!=null&&V([{x:et,y:We},{x:(et+dt)/2,y:(We+at)/2},{x:dt,y:at}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;x(d.p1,{rawTime:f,normalizedTime:D,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="crossline"&&d.p){const x=D=>{const P=d.primitive;if(P){P.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p:D};ve(te=>{const ue=te.map(me=>me===d?K:me);return v.current=ue,ue}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(D.rawTime),G=g.priceToCoordinate(D.price);W!=null&&G!=null&&V([{x:W,y:G}])},f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=g.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const f=c.current?c.current.paneSize().width:400,D=g.priceToCoordinate(x);D!=null&&V([{x:f/2,y:D}]);const P={...d,price:x};ve(K=>{const W=K.map(G=>G===d?P:G);return v.current=W,W}),M(P),le.current=P;return}if(d.type==="text"){const x=p.timeScale().coordinateToTime(I);if(x==null)return;const f=d.primitive;if(f){f.rawTime=x,f.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"||ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const K=Gd(f,D,P);if(!K)return;const W=d.primitive;if(W){W.p1={rawTime:f.rawTime,price:f.price},W.p2={rawTime:D.rawTime,price:D.price},W.b1={rawTime:K.b1.rawTime,price:K.b1.price},W.b2={rawTime:K.b2.rawTime,price:K.b2.price},W.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const G={...d,p1:f,p2:D,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};ve(te=>{const ue=te.map(me=>me===d?G:me);return v.current=ue,ue}),M(G),le.current=G};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??q(d.p3.rawTime),price:Q});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K),ue=q(f.p3.normalizedTime+K);if(G==null||te==null||ue==null)return;const me=_-D;x({rawTime:f.p1.rawTime+me,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+me,normalizedTime:te,price:f.p2.price+W},{rawTime:f.p3.rawTime+me,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Vi(Ze,f,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,intercept:P.intercept,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};ve(G=>{const te=G.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),le.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L},d.p2);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Hr(Ze,f,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};ve(G=>{const te=G.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),le.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L},d.p2);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const K=d.primitive;if(K){K.p1={rawTime:f.rawTime,price:f.price},K.p2={rawTime:D.rawTime,price:D.price},K.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:f,p2:D,p3:P};ve(G=>{const te=G.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),le.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q},d.p3);return}if(ee.current==="handle3"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,d.p2,{rawTime:f,normalizedTime:L,price:Q});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K),ue=q(f.p3.normalizedTime+K);if(G==null||te==null||ue==null)return;const me=_-D;x({rawTime:f.p1.rawTime+me,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+me,normalizedTime:te,price:f.p2.price+W},{rawTime:f.p3.rawTime+me,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,te,ue)=>{const me=d.primitive;if(me){me.p1={rawTime:W.rawTime,price:W.price},me.p2={rawTime:G.rawTime,price:G.price},me.p3={rawTime:te.rawTime,price:te.price},me.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:G,p3:te,p4:ue};ve(Me=>{const $e=Me.map(et=>et===d?xe:et);return v.current=$e,$e}),M(xe),le.current=xe},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;const K=(W,G,te,ue)=>{const me=W.normalizedTime??q(W.rawTime);if(me==null)return null;const xe=q(me+te);return xe==null?null:{rawTime:W.rawTime+G,normalizedTime:xe,price:W.price+ue}};if(ee.current==="line"){const W=p.timeScale().coordinateToTime(f.x),G=g.coordinateToPrice(f.y);if(W==null||G==null)return;const te=q(W);if(te==null)return;const ue=D-W,me=P-te,xe=Q-G,Me=K(f.p1,ue,me,xe),$e=K(f.p2,ue,me,xe),et=K(f.p3,ue,me,xe),We=K(f.p4,ue,me,xe);if(!Me||!$e||!et||!We)return;x(Me,$e,et,We);return}if(ee.current==="handle1"){const W=(f.p1.price+f.p2.price)/2,G={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*W-Q};x(G,te,f.p3,f.p4);return}if(ee.current==="handle3"){const W=(f.p3.price+f.p4.price)/2,G={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*W-Q};x(f.p1,f.p2,G,te);return}if(ee.current==="handle2"){const W=(f.p1.price+f.p2.price)/2,G={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:Q};if(G.normalizedTime==null)return;const te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:2*W-Q};if(te.normalizedTime==null)return;x(te,G,f.p3,f.p4);return}if(ee.current==="handle4"){const W=Q-f.p4.price,G={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??q(f.p3.rawTime),price:f.p4.price+W};if(G.normalizedTime==null)return;const te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:f.p2.price+W};if(te.normalizedTime==null)return;x(f.p1,te,f.p3,G);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,te,ue)=>{const me=d.primitive;if(me){me.p1={rawTime:W.rawTime,price:W.price},me.p2={rawTime:G.rawTime,price:G.price},me.p3={rawTime:te.rawTime,price:te.price},me.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:G,p3:te,p4:ue};ve(Me=>{const $e=Me.map(et=>et===d?xe:et);return v.current=$e,$e}),M(xe),le.current=xe},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;const K=(W,G,te,ue)=>{const me=W.normalizedTime??q(W.rawTime);if(me==null)return null;const xe=q(me+te);return xe==null?null:{rawTime:W.rawTime+G,normalizedTime:xe,price:W.price+ue}};if(ee.current==="line"){const W=p.timeScale().coordinateToTime(f.x),G=g.coordinateToPrice(f.y);if(W==null||G==null)return;const te=q(W);if(te==null)return;const ue=D-W,me=P-te,xe=Q-G,Me=K(f.p1,ue,me,xe),$e=K(f.p2,ue,me,xe),et=K(f.p3,ue,me,xe),We=K(f.p4,ue,me,xe);if(!Me||!$e||!et||!We)return;x(Me,$e,et,We);return}if(ee.current==="handle1"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:f.p2.price};x(W,G,f.p3,f.p4);return}if(ee.current==="handle3"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:f.p4.price};x(f.p1,f.p2,W,G);return}if(ee.current==="handle2"||ee.current==="handle4"){const W=ee.current==="handle2"?f.p2:f.p4,G=Q-W.price,te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:f.p2.price+G},ue={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??q(f.p3.rawTime),price:f.p4.price+G};if(te.normalizedTime==null||ue.normalizedTime==null)return;x(f.p1,te,f.p3,ue);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(at,pt)=>{const bt=d.primitive;if(bt){bt.p1={rawTime:at.rawTime,price:at.price},bt.p2={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const Kt={...d,p1:at,p2:pt};ve($t=>{const AA=$t.map(DA=>DA===d?Kt:DA);return v.current=AA,AA}),M(Kt),le.current=Kt},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;if(ee.current==="line"){const at=p.timeScale().coordinateToTime(f.x),pt=g.coordinateToPrice(f.y);if(at==null||pt==null)return;const bt=q(at);if(bt==null)return;const Kt=P-bt,$t=Q-pt,AA=q(f.p1.normalizedTime+Kt),DA=q(f.p2.normalizedTime+Kt);if(AA==null||DA==null)return;const yi=_-at;x({rawTime:f.p1.rawTime+yi,normalizedTime:AA,price:f.p1.price+$t},{rawTime:f.p2.rawTime+yi,normalizedTime:DA,price:f.p2.price+$t});return}const K=Math.min(f.p1.normalizedTime,f.p2.normalizedTime),W=Math.max(f.p1.normalizedTime,f.p2.normalizedTime),G=Math.max(f.p1.price,f.p2.price),te=Math.min(f.p1.price,f.p2.price),ue=f.p1.normalizedTime<=f.p2.normalizedTime?f.p1.rawTime:f.p2.rawTime,me=f.p1.normalizedTime<=f.p2.normalizedTime?f.p2.rawTime:f.p1.rawTime;let xe=K,Me=W,$e=G,et=te,We=ue,dt=me;if((ee.current==="handle1"||ee.current==="handle4"||ee.current==="handle6")&&(xe=P,We=D),(ee.current==="handle3"||ee.current==="handle5"||ee.current==="handle8")&&(Me=P,dt=D),(ee.current==="handle1"||ee.current==="handle2"||ee.current==="handle3")&&($e=Q),(ee.current==="handle6"||ee.current==="handle7"||ee.current==="handle8")&&(et=Q),xe>Me){const at=xe,pt=We;xe=Me,We=dt,Me=at,dt=pt}if($e<et){const at=$e;$e=et,et=at}x({rawTime:We,normalizedTime:xe,price:$e},{rawTime:dt,normalizedTime:Me,price:et});return}if(d.type==="circle"&&d.p1&&d.p2){const x=($e,et)=>{const We=d.primitive;if(We){We.p1={rawTime:$e.rawTime,price:$e.price},We.p2={rawTime:et.rawTime,price:et.price};try{c.current?.applyOptions({})}catch{}}const dt={...d,p1:$e,p2:et};ve(at=>{const pt=at.map(bt=>bt===d?dt:bt);return v.current=pt,pt}),M(dt),le.current=dt},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;if(ee.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const te=D-G,ue=Q-W,me=q(P.p1.normalizedTime+te),xe=q(P.p2.normalizedTime+te);if(me==null||xe==null)return;const Me=_-K;x({rawTime:P.p1.rawTime+Me,normalizedTime:me,price:P.p1.price+ue},{rawTime:P.p2.rawTime+Me,normalizedTime:xe,price:P.p2.price+ue});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(We,dt,at)=>{const pt=d.primitive;if(pt){pt.p1={rawTime:We.rawTime,price:We.price},pt.p2={rawTime:dt.rawTime,price:dt.price},pt.p3={rawTime:at.rawTime,price:at.price};try{c.current?.applyOptions({})}catch{}}const bt={...d,p1:We,p2:dt,p3:at};ve(Kt=>{const $t=Kt.map(AA=>AA===d?bt:AA);return v.current=$t,$t}),M(bt),le.current=bt},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;if(ee.current==="handle1"){x({rawTime:f,normalizedTime:D,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:f,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const te=D-G,ue=Q-W,me=_-K,xe=We=>{const dt=We.normalizedTime??q(We.rawTime);if(dt==null)return null;const at=q(dt+te);return at==null?null:{rawTime:We.rawTime+me,normalizedTime:at,price:We.price+ue}},Me=xe(P.p1),$e=xe(P.p2),et=xe(P.p3);if(!Me||!$e||!et)return;x(Me,$e,et);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(K,W,G=d.minorRatio??.45)=>{const te=d.primitive;if(te){te.p1={rawTime:K.rawTime,price:K.price},te.p2={rawTime:W.rawTime,price:W.price},te.minorRatio=Math.max(.05,G);try{c.current?.applyOptions({})}catch{}}const ue={...d,p1:K,p2:W,minorRatio:Math.max(.05,G)};ve(me=>{const xe=me.map(Me=>Me===d?ue:Me);return v.current=xe,xe}),M(ue),le.current=ue},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;if(ee.current==="line"){const K=p.timeScale().coordinateToTime(f.x),W=g.coordinateToPrice(f.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const te=P-G,ue=Q-W,me=q(f.p1.normalizedTime+te),xe=q(f.p2.normalizedTime+te);if(me==null||xe==null)return;const Me=_-K;x({rawTime:f.p1.rawTime+Me,normalizedTime:me,price:f.p1.price+ue},{rawTime:f.p2.rawTime+Me,normalizedTime:xe,price:f.p2.price+ue},f.minorRatio??d.minorRatio??.45);return}if(ee.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(ee.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(ee.current==="handle2"||ee.current==="handle4"){const K=p.timeScale().timeToCoordinate(d.p1.rawTime),W=g.priceToCoordinate(d.p1.price),G=p.timeScale().timeToCoordinate(d.p2.rawTime),te=g.priceToCoordinate(d.p2.price);if(K==null||W==null||G==null||te==null)return;const ue=(K+G)/2,me=(W+te)/2,xe=G-K,Me=te-W,$e=Math.hypot(xe,Me);if($e<.001)return;const et=-Me/$e,We=xe/$e,dt=Math.abs((I-ue)*et+(w-me)*We),at=Math.max(.05,dt*2/$e);x(d.p1,d.p2,at);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const f={...d,time:q(_),rawTime:_};ve(P=>{const K=P.map(W=>W===d?f:W);return v.current=K,K}),M(f),le.current=f;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,f=oe.current;if(!f)return;if(ee.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:_};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D,c.current?.applyOptions({})}else if(ee.current==="line"){const D=g.coordinateToPrice(f.y);if(D==null)return;const P=Q-D;if(x.price=f.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};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(ee.current==="handle1"){const x={time:L,price:Q},f=LA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D}else if(ee.current==="handle2"){const x={time:L,price:Q},f=LA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D}else if(ee.current==="line"){const x=oe.current;if(!x)return;const f=p.timeScale().coordinateToTime(x.x),D=g.coordinateToPrice(x.y);if(f==null||D==null)return;const P=L-f,K=Q-D,W={time:q(x.point1.time+P),price:x.point1.price+K},G={time:q(x.point2.time+P),price:x.point2.price+K},te=LA([{time:W.time,value:W.price},{time:G.time,value:G.price}]);te.length>0&&d.series.setData(te),d.decoration&&(d.decoration.p1=W,d.decoration.p2=G);const ue={...d,point1:W,point2:G};ve(me=>{const xe=me.map(Me=>Me===d?ue:Me);return v.current=xe,xe}),M(ue),le.current=ue}}}},O=()=>{ee.current=null,oe.current=null},Y=()=>{ee.current||le.current||(re(null),Z([]))},B={capture:!0,passive:!1};return k.addEventListener("mousedown",ae,B),k.addEventListener("mousemove",S,B),k.addEventListener("mouseup",O,B),k.addEventListener("mouseleave",Y,B),()=>{k.removeEventListener("mousedown",ae,B),k.removeEventListener("mousemove",S,B),k.removeEventListener("mouseup",O,B),k.removeEventListener("mouseleave",Y,B)}},[Fe,Ze,Ke,ve]),j.useEffect(()=>{const p=c.current,g=u.current;if(!p||!g)return;const k=()=>{const H=R;if(!H){V([]);return}const X=p.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const J=H.p1.rawTime??H.p1.time,ne=H.p2.rawTime??H.p2.time,ae=X.timeToCoordinate(J),S=g.priceToCoordinate(H.p1.price),O=X.timeToCoordinate(ne),Y=g.priceToCoordinate(H.p2.price);ae!=null&&S!=null&&O!=null&&Y!=null?V([{x:ae,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:(J+ae)/2,y:(ne+S)/2},{x:ae,y:S}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="crossline"&&H.p){const J=X.timeToCoordinate(H.p.rawTime),ne=g.priceToCoordinate(H.p.price);J!=null&&ne!=null?V([{x:J,y:ne}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const J=X.timeToCoordinate(H.rawTime),ne=g.priceToCoordinate(H.price);J!=null&&ne!=null?V([{x:J,y:ne}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.b1.rawTime),Y=g.priceToCoordinate(H.b1.price),B=X.timeToCoordinate(H.b2.rawTime),h=g.priceToCoordinate(H.b2.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ne},{x:ae,y:S},{x:(O+B)/2,y:(Y+h)/2}]):V([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y},{x:B,y:h}]):V([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y},{x:B,y:h}]):V([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),ae=X.timeToCoordinate(H.point2.time),S=g.priceToCoordinate(H.point2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),ae=X.timeToCoordinate(H.point2.time),S=g.priceToCoordinate(H.point2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:(J+ae)/2,y:(ne+S)/2},{x:ae,y:S}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);if(J!=null&&ne!=null&&ae!=null&&S!=null){const O=Math.min(J,ae),Y=Math.max(J,ae),B=Math.min(ne,S),h=Math.max(ne,S),b=(O+Y)/2,I=(B+h)/2;V([{x:O,y:B},{x:b,y:B},{x:Y,y:B},{x:O,y:I},{x:Y,y:I},{x:O,y:h},{x:b,y:h},{x:Y,y:h}])}else V([]);return}if(H.type==="circle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);if(J!=null&&ne!=null&&ae!=null&&S!=null){const O=(J+ae)/2,Y=(ne+S)/2,B=ae-J,h=S-ne,b=Math.hypot(B,h);if(b<.001){V([]);return}const I=B/b,w=h/b,d=-w,_=I,Q=b/2,L=Q*Math.max(.05,H.minorRatio??.45);V([{x:O-I*Q,y:Y-w*Q},{x:O+d*L,y:Y+_*L},{x:O+I*Q,y:Y+w*Q},{x:O-d*L,y:Y-_*L}])}else V([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const J=H.primitive,ne=X.timeToCoordinate(J.originTime),ae=g.priceToCoordinate(J.price);ne!=null&&ae!=null?V([{x:ne,y:ae}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const J=H.primitive,ne=X.timeToCoordinate(J.time);if(ne!=null){const ae=J.midYCss??200;V([{x:ne,y:ae}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const J=u.current?.priceToCoordinate(H.price);if(J!=null){const ne=c.current?c.current.paneSize().width:400;V([{x:ne/2,y:J}])}else V([]);return}V([])};k();const we=p.timeScale();return we.subscribeVisibleTimeRangeChange(k),()=>{we.unsubscribeVisibleTimeRangeChange(k)}},[R]),j.useEffect(()=>{let p=!1;v.current.forEach(g=>{if(g.type==="verticalline"&&g.primitive){const k=g===R||g===ie;g.primitive.showDot!==k&&(g.primitive.showDot=k,p=!0)}}),p&&c.current?.applyOptions({})},[R,ie]),j.useEffect(()=>{let p=!1;v.current.forEach(g=>{if((g.type==="infoline"||g.type==="rulerline"||g.type==="arrowedline"||g.type==="rayline"||g.type==="extendedline"||g.type==="trendbyangle")&&g.primitive){const k=g===R||g===ie;g.primitive.isActive!==k&&(g.primitive.isActive=k,p=!0)}}),p&&c.current?.applyOptions({})},[R,ie]),j.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:ke}),p.priceLine){const g=ke&&p.showPrice!==!1;p.priceLine.applyOptions(ke?{color:p.lineColor??"#3b82f6",axisLabelVisible:g,title:g&&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=ke;try{c.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=ke;try{c.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:ke}),p.parallelLine&&p.parallelLine.applyOptions({visible:ke}),p.firstLine&&p.firstLine.applyOptions({visible:ke}),p.secondLine&&p.secondLine.applyOptions({visible:ke})),(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=ke;try{c.current?.applyOptions({})}catch{}}})},[ke,Ke]),j.useEffect(()=>{!ke&&R&&(M(null),V([]))},[ke,R]),j.useEffect(()=>{if(v.current.length>Ke.length){const p=v.current.filter((g,k)=>!Ke.includes(g));R&&p.some(g=>g===R)&&(M(null),V([])),p.forEach(g=>{if(g.series&&c.current?.removeSeries(g.series),g.priceLine&&u.current?.removePriceLine(g.priceLine),g.textPrimitive)try{u.current?.detachPrimitive(g.textPrimitive)}catch{}if(g.type==="horizontalray"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="verticalline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="infoline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rulerline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="arrowedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rayline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="extendedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="crossline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="trendbyangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="equidistantchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="regressionchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="stddevchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="gannfan"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ganngrid"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="andrewspitchfork"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="disjointchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="flattopbottom"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="fibonacci"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rectangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="circle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="triangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ellipse"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="text"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="parallellines")try{g.baseLine&&c.current?.removeSeries(g.baseLine),g.parallelLine&&c.current?.removeSeries(g.parallelLine),g.firstLine&&c.current?.removeSeries(g.firstLine),g.secondLine&&c.current?.removeSeries(g.secondLine)}catch{}}),v.current=Ke}},[Ke,R]),j.useEffect(()=>{const p=u.current;return p?(Ye.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Ye.current=[],Pe.filter(k=>k.symbol===Be).forEach(k=>{const we=parseFloat(k.price);if(isNaN(we))return;const X=k.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350",J=p.createPriceLine({price:we,color:X,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${k.type} ${k.volume} @ ${k.price}`,textColor:X});Ye.current.push(J)}),()=>{Ye.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Ye.current=[]}):void 0},[Pe,Be]),j.useEffect(()=>{const p=o.current;if(!p)return;const g=k=>{if(se.current){se.current=!1;return}if(T.current||!c.current)return;const we=c.current,H=u.current;if(we&&H&&v.current.length>0){const X=p.getBoundingClientRect(),J=k.clientX-X.left,ne=k.clientY-X.top,ae=15;for(let S=v.current.length-1;S>=0;S--){const O=v.current[S];let Y=!1;if(O.type==="text"&&O.rawTime!=null&&O.price!=null){const B=we.timeScale().timeToCoordinate(O.rawTime),h=H.priceToCoordinate(O.price);if(B!=null&&h!=null){const b=Wd(O,B,h);J>=b.left&&J<=b.right&&ne>=b.top&&ne<=b.bottom&&(Y=!0)}}else if(O.point1&&O.point2){const B=we.timeScale().timeToCoordinate(O.point1.time??O.point1.rawTime),h=H.priceToCoordinate(O.point1.price),b=we.timeScale().timeToCoordinate(O.point2.time??O.point2.rawTime),I=H.priceToCoordinate(O.point2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.hypot(J-B,ne-h),d=Math.hypot(J-b,ne-I),_=(B+b)/2,Q=(h+I)/2,L=Math.hypot(J-_,ne-Q);(w<ae||d<ae||L<ae)&&(Y=!0)}}else if(O.p1&&O.p2){const B=we.timeScale().timeToCoordinate(O.p1.rawTime),h=H.priceToCoordinate(O.p1.price),b=we.timeScale().timeToCoordinate(O.p2.rawTime),I=H.priceToCoordinate(O.p2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.min(B,b),d=Math.max(B,b),_=Math.min(h,I),Q=Math.max(h,I);J>=w-5&&J<=d+5&&ne>=_-5&&ne<=Q+5&&(Y=!0)}}else if(O.p){const B=we.timeScale().timeToCoordinate(O.p.rawTime),h=H.priceToCoordinate(O.p.price);B!=null&&h!=null&&Math.hypot(J-B,ne-h)<ae&&(Y=!0)}else if(O.type==="pricelevel"&&O.price!=null){const B=H.priceToCoordinate(O.price);B!=null&&Math.abs(ne-B)<ae&&(Y=!0)}if(Y){k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),Ae(O);return}}}k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;Zd(c.current,Ze,de)||c.current.timeScale().fitContent();const J=c.current.timeScale().getVisibleRange();Ce(J)},80)};return p.addEventListener("dblclick",g,!0),()=>{p.removeEventListener("dblclick",g,!0)}},[Ze,de]);const rp=R??ie,np=R?$:ce,IT=ke&&jv(rp,np),DT=eT(rp?.type);j.useEffect(()=>{const p=o.current,g=l.current;if(!p||!g)return;const k=80,we=X=>{const J=p.getBoundingClientRect();g.style.opacity=J.bottom-X.clientY<=k?"1":"0"},H=()=>{g.style.opacity="0"};return p.addEventListener("mousemove",we),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",we),p.removeEventListener("mouseleave",H)}},[]);const _T=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*.8;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},[Ce]),PT=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*1.25;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},[Ce]),NT=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const k=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from-k,to:g.to-k})}catch{}},[]),kT=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const k=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from+k,to:g.to+k})}catch{}},[]),OT=j.useCallback(()=>{if(!c.current)return;Zd(c.current,Ze,de)||c.current.timeScale().fitContent();const g=c.current.timeScale().getVisibleRange();Ce(g)},[Ze,de,Ce]);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:Fe===1||Fe!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Lt&&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 Be=="object"?Be?.symbol:Be,"..."]})]})}),!Lt&&Gt&&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:Gt})]})}),!Lt&&!Gt&&Ze.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 Be=="object"?Be?.symbol:Be]})})}),A&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Fh,{bidPrice:e,askPrice:t,onBuyClick:ST,onSellClick:ET})}),a.jsx(Uh,{isOpen:lt,onClose:LT,orderType:sA,bidPrice:e,askPrice:t}),a.jsx(Hh,{isOpen:z!==null,onClose:()=>Ae(null),chartObject:z,onUpdate:MT}),Lt&&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"}})}),IT&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:np.map((p,g)=>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:DT}},g))}),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:PT,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:_T,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:NT,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:kT,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:OT,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:g,icon:k})=>a.jsx("button",{title:p,onClick:g,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:we=>{we.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",we.currentTarget.style.color=rt==="light"?"#111827":"#e2e8f0"},onMouseLeave:we=>{we.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",we.currentTarget.style.color=rt==="light"?"#374151":"#94a3b8"},children:k},p))})]})})}),Bt={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 Jd({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Ht(),[s,o]=j.useState(!1),[l,c]=j.useState(""),[u,m]=j.useState(-1),y=j.useRef(null),v=j.useRef(null);j.useEffect(()=>{const E=N=>{y.current&&!y.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),j.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const T=r.filter(E=>E.symbol.toLowerCase().includes(l.toLowerCase())),C=T.filter(E=>!E.symbol.endsWith("USDT")),U=T.filter(E=>E.symbol.endsWith("USDT")),F=E=>{A(E),o(!1),c("")};return r.find(E=>E.symbol===t),a.jsxs("div",{ref:y,style:{...Bt.container,...i},className:e,children:[a.jsxs("button",{style:Bt.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,Bt.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:{...Bt.arrow,...s?Bt.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Bt.dropdown,children:[a.jsx("div",{style:Bt.searchContainer,children:a.jsx("input",{ref:v,style:Bt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:E=>c(E.target.value)})}),a.jsx("div",{style:Bt.list,children:T.length===0?a.jsx("div",{style:Bt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Bt.categoryLabel,children:"Forex & Metals"}),C.map(E=>a.jsxs("div",{style:{...Bt.item,...E.symbol===t?Bt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Bt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Bt.symbolPrice,...parseFloat(E.change)>=0?Bt.priceUp:Bt.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Bt.categoryLabel,children:"Crypto"}),U.map(E=>a.jsxs("div",{style:{...Bt.item,...E.symbol===t?Bt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Bt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Bt.symbolPrice,...parseFloat(E.change)>=0?Bt.priceUp:Bt.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const MA={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"}},sT=[.01,.05,.1,.5,1];function Yd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=sT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[m,y]=j.useState(.1),v=i!==void 0?i:m,T=j.useCallback(E=>{const N=Math.max(t,Math.min(A,parseFloat(E)||t)),R=Math.round(N/r)*r,M=parseFloat(R.toFixed(8));i!==void 0||y(M),e?.(M)},[t,A,r,i,e]),C=()=>T(v+r),U=()=>T(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...MA.container,...c},className:u,children:[o&&a.jsx("span",{style:MA.label,children:l}),a.jsx("button",{style:MA.btn,onClick:U,onMouseEnter:E=>Object.assign(E.currentTarget.style,MA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:MA.input,type:"text",value:F,onChange:E=>{const N=E.target.value;if(N===""||N==="."||N==="0.")return;const R=parseFloat(N);isNaN(R)||T(R)},onBlur:()=>T(v)}),a.jsx("button",{style:MA.btn,onClick:C,onMouseEnter:E=>Object.assign(E.currentTarget.style,MA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:MA.presets,children:n.map(E=>a.jsx("button",{style:{...MA.preset,...Math.abs(v-E)<1e-4?MA.presetActive:{}},onClick:()=>T(E),onMouseEnter:N=>{Math.abs(v-E)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(v-E)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:E},E))})]})}const qt={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 qd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:u,className:m}){const{currentSymbolData:y}=Ht(),[v,T]=j.useState(""),[C,U]=j.useState(!1),[F,E]=j.useState("price"),N=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=j.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),Ae=j.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=j.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){$(ce);return}const Z=parseFloat(ce);isNaN(Z)||$(ce)},ie=M==="price"?y?.bid?parseFloat(y.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...qt.container,...u},className:m,children:[l&&a.jsx("span",{style:qt.label,children:c}),s&&a.jsx("button",{style:{...qt.toggle,...R?qt.toggleOn:qt.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...qt.toggleKnob,...R?qt.knobOn:qt.knobOff}})}),(R||!s)&&a.jsxs("div",{style:qt.inputGroup,children:[a.jsx("input",{style:qt.input,type:"text",value:N,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:{...qt.modeBtn,...M==="price"?qt.modeBtnActive:{}},onClick:()=>Ae("price"),children:"Price"}),a.jsx("button",{style:{...qt.modeBtn,...M==="pips"?qt.modeBtnActive:{}},onClick:()=>Ae("pips"),children:"Pips"})]})]})]})}const jt={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 jd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:u,className:m}){const{currentSymbolData:y}=Ht(),[v,T]=j.useState(""),[C,U]=j.useState(!1),[F,E]=j.useState("price"),N=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=j.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),Ae=j.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=j.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){$(ce);return}const Z=parseFloat(ce);isNaN(Z)||$(ce)},ie=M==="price"?y?.ask?parseFloat(y.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...jt.container,...u},className:m,children:[l&&a.jsx("span",{style:jt.label,children:c}),s&&a.jsx("button",{style:{...jt.toggle,...R?jt.toggleOn:jt.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...jt.toggleKnob,...R?jt.knobOn:jt.knobOff}})}),(R||!s)&&a.jsxs("div",{style:jt.inputGroup,children:[a.jsx("input",{style:jt.input,type:"text",value:N,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:{...jt.modeBtn,...M==="price"?jt.modeBtnActive:{}},onClick:()=>Ae("price"),children:"Price"}),a.jsx("button",{style:{...jt.modeBtn,...M==="pips"?jt.modeBtnActive:{}},onClick:()=>Ae("pips"),children:"Pips"})]})]})]})}const oT=[{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:"─"}],HA={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 ep({showLabel:i=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:u,chartObjects:m,setChartObjects:y}=Ht(),[v,T]=j.useState(null),C=A||oT,U=N=>{l(o===N?null:N)},F=()=>{y([]),l(null)},E=()=>{u(!c)};return a.jsxs("div",{style:{...HA.container,...n},className:s,children:[i&&a.jsx("span",{style:HA.label,children:r}),C.map(N=>a.jsxs("button",{style:{...HA.btn,...o===N.id?HA.btnActive:{}},onClick:()=>U(N.id),onMouseEnter:R=>{T(N.id),o!==N.id&&Object.assign(R.currentTarget.style,HA.btnHover)},onMouseLeave:R=>{T(null),o!==N.id&&(R.currentTarget.style.borderColor="#334155",R.currentTarget.style.backgroundColor="#1e293b",R.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,v===N.id&&a.jsx("div",{style:HA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:HA.divider}),t&&a.jsx("button",{style:{...HA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:E,onMouseEnter:N=>{N.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:HA.deleteBtn,onClick:F,onMouseEnter:N=>Object.assign(N.currentTarget.style,HA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.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 aT({showCoinSelector:i=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:u,onStopLossEnabledChange:m,takeProfit:y,onTakeProfitChange:v,takeProfitEnabled:T,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:E={},takeProfitProps:N={},drawingToolsProps:R={},style:M,className:z}){const Ae=[];i&&Ae.push(a.jsx(Jd,{...U},"coin")),e&&Ae.push(a.jsx(Yd,{value:s,onChange:o,...F},"volume")),t&&Ae.push(a.jsx(qd,{value:l,onChange:c,enabled:u,onEnabledChange:m,...E},"sl")),A&&Ae.push(a.jsx(jd,{value:y,onChange:v,enabled:T,onEnabledChange:C,...N},"tp")),r&&Ae.push(a.jsx(ep,{...R},"draw"));const $=[];return Ae.forEach((V,ie)=>{$.push(V),n&&ie<Ae.length-1&&$.push(a.jsx("div",{style:tp.divider},`div-${ie}`))}),a.jsx("div",{style:{...tp.toolbar,...M},className:z,children:$})}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"}],Va={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 cT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Ht();return a.jsx("div",{style:{...Va.container,...i},className:e,children:lT.map(r=>a.jsx("button",{style:{...Va.btn,...t===r.value?Va.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:"▥"}],za={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 uT({style:i,className:e}){const{chartType:t,setChartType:A}=Ht();return a.jsx("div",{style:{...za.container,...i},className:e,children:hT.map(r=>a.jsxs("button",{style:{...za.btn,...t===r.value?za.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 Rt={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}=Ht(),[u,m]=j.useState(null),y=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),T=v>0&&y>0?Math.abs(v-y):0,C=E=>!E||E===0?"-.-----":E>=1e3?E.toFixed(2):E>=1?E.toFixed(4):E.toFixed(5),U=E=>E===0?"-":E>=1?E.toFixed(1):E>=.01?E.toFixed(3):(E*1e4).toFixed(1)+"p",F=j.useCallback(E=>{if(!s)return;const N=E==="BUY"?v:y;if(!N||N<=0){m({type:"error",message:"No price available"});return}const R={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:E,volume:i,price:N,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(z=>[...z,R]);const M=i*N*.01;c(z=>z-M),m({type:"success",message:`${E} executed`}),A?.(R),setTimeout(()=>m(null),3e3)},[s,v,y,i,e,t,l,c,A]);return a.jsxs("div",{style:{...Rt.container,...r},className:n,children:[a.jsx("button",{style:Rt.sellBtn,onClick:()=>F("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Rt.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:Rt.priceBox,children:[a.jsx("span",{style:Rt.priceLabel,children:"Bid"}),a.jsx("span",{style:{...Rt.priceValue,color:"#EF5350"},children:C(y)})]}),a.jsxs("div",{style:Rt.spread,children:[a.jsx("span",{style:Rt.spreadLabel,children:"Spread"}),a.jsx("span",{style:Rt.spreadValue,children:U(T)})]}),a.jsxs("div",{style:Rt.priceBox,children:[a.jsx("span",{style:Rt.priceLabel,children:"Ask"}),a.jsx("span",{style:{...Rt.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:Rt.buyBtn,onClick:()=>F("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Rt.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...Rt.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 it={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 pT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Ht(),[l,c]=j.useState(null),u=A.filter(C=>C.status==="OPEN"||!C.closeAt),m=j.useCallback((C,U)=>{const F=n.find(E=>E.symbol===C);return F?U?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),y=j.useCallback(C=>{if(l)return;c(C.id);const U=m(C.symbol,C.type),E=(C.type?.toUpperCase()==="BUY"?U-C.price:C.price-U)*C.volume,N=C.volume*C.price*.01;r(R=>R.filter(M=>M.id!==C.id)),o(R=>R+N+E),c(null)},[l,m,r,o]),v=C=>{const U=parseFloat(C);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},T=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...it.container,...i},className:e,children:[a.jsxs("div",{style:it.header,children:[a.jsxs("span",{style:it.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:it.summary,children:[a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...it.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...it.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...it.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...it.scrollArea,maxHeight:t},children:a.jsxs("table",{style:it.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:it.th,children:"Symbol"}),a.jsx("th",{style:it.th,children:"Type"}),a.jsx("th",{style:it.th,children:"Volume"}),a.jsx("th",{style:it.th,children:"Open Price"}),a.jsx("th",{style:it.th,children:"Current"}),a.jsx("th",{style:it.th,children:"SL"}),a.jsx("th",{style:it.th,children:"TP"}),a.jsx("th",{style:it.th,children:"Profit"}),a.jsx("th",{style:it.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:it.emptyRow,children:"No open positions"})}):u.map(C=>{const U=m(C.symbol,C.type),F=C.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...it.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...it.td,...C.type?.toUpperCase()==="BUY"?it.typeBuy:it.typeSell},children:C.type}),a.jsx("td",{style:it.td,children:C.volume}),a.jsx("td",{style:it.td,children:v(C.price)}),a.jsx("td",{style:it.td,children:v(U)}),a.jsx("td",{style:it.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:it.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...it.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:T(F)}),a.jsx("td",{style:it.td,children:a.jsx("button",{style:{...it.closeBtn,...l===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>y(C),disabled:l===C.id,onMouseEnter:E=>{l!==C.id&&(E.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d"},children:l===C.id?"...":"Close"})})]},C.id)})})]})})]})}function fT(i){return zt({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 gT(i){return zt({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 mT(i){return zt({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 wT(i){return zt({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 BT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:u,marketWatchOpen:m=!0,onToggleMarketWatch:y,buySellPanelOpen:v,onMove:T})=>{const{theme:C}=Ht(),U=C==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],E={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return a.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b min-w-max ${U?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${U?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
+ ${A===N?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
+ `,title:N,children:E[N]},N))}),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(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
15
+ ${A===N?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
16
+ `,title:N,children:E[N]},N))}),a.jsxs("div",{className:"flex items-center gap-2",children:[F.map(N=>a.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:N},N)),a.jsx("div",{className:`border-r h-6 mx-1 ${U?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:v?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${v?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 5v4H9c-1.054 0-1.918.816-1.995 1.85L7 11v2c0 1.105.895 2 2 2h2.5v4H4c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h7.5z"}),a.jsx("path",{fill:"#3687ED",d:"M20 5c1.105 0 2 .895 2 2v10c0 1.105-.895 2-2 2h-7.5v-4H15c1.054 0 1.918-.816 1.995-1.85L17 13v-2c0-1.105-.895-2-2-2h-2.5V5H20z"}),a.jsx("path",{fill:"#B0BEC5",d:"M10 10h4c1.105 0 2 .895 2 2s-.895 2-2 2h-4c-1.105 0-2-.895-2-2s.895-2 2-2z"})]})})}),a.jsxs("button",{onClick:n,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.jsx("path",{fill:"#DA5244",d:"M11.5 4v2.02C8.42 6.276 6 8.856 6 12c0 3.145 2.42 5.725 5.5 5.98V20H10c-4.418 0-8-3.582-8-8s3.582-8 8-8h1.5z"}),a.jsx("path",{fill:"#3687ED",d:"M14 4c4.418 0 8 3.582 8 8s-3.582 8-8 8h-1.5v-2.02c3.08-.256 5.5-2.836 5.5-5.98 0-3.145-2.42-5.725-5.5-5.98V4H14z"}),a.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),a.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:s,className:`p-1 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(fT,{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(gT,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:T,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>y?.(),title:m?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${m?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[a.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14Zm-1 2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h12Z"})]})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${U?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:a.jsx("path",{d:"M22 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0-4a1 1 0 0 1-1-1V4h-1a1 1 0 1 1 0-2h1a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Zm1 7v8a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-8l3.764-1s.45-.428.789-1.105l.171-.342a.998.998 0 0 1 .894-.553h4.764a1 1 0 0 1 .894.552l.171.342c.339.678.789 1.106.789 1.106L23 13Zm-8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm0 4.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3ZM16 4h-2a1 1 0 1 1 0-2h2a1 1 0 1 1 0 2Zm-6 0H8a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2ZM4 22H3a2 2 0 0 1-2-2v-1a1 1 0 1 1 2 0v1h1a1 1 0 1 1 0 2ZM4 4H3v1a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2h1a1 1 0 0 1 0 2ZM2 8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Zm0 5a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1Z"})})}),a.jsx("button",{type:"button",onClick:()=>u?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${U?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})})]})]})},Ir=[{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"})]})}],Dr=[{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"})})}],_r=[{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"})})}],Pr=[{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"})})}],xs=({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})}),yT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:m,setDrawingsVisible:y,chartLocked:v,setChartLocked:T,theme:C,setTheme:U,setIsShow:F}=Ht(),[E,N]=j.useState(!1),[R,M]=j.useState(null),[z,Ae]=j.useState(null),[$,V]=j.useState(0),[ie,re]=j.useState(!1),[ce,Z]=j.useState(0),[ee,oe]=j.useState(!1),[le,se]=j.useState(0),[he,pe]=j.useState(!1),[ge,be]=j.useState(0),[Ee,ye]=j.useState(!1),[Ce,Fe]=j.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Ue=j.useRef(null),Ne=j.useRef(null),Je=j.useRef(null),Ke=j.useRef(null),ve=j.useRef(null),Pe=j.useRef(null);j.useEffect(()=>{const De=Ie=>{const Qe=Ue.current;E&&Qe&&!Qe.contains(Ie.target)&&(N(!1),M(null));const Te=Ne.current;z==="line"&&Te&&!Te.contains(Ie.target)&&Ae(null);const He=Je.current;z==="channel"&&He&&!He.contains(Ie.target)&&Ae(null);const Se=Ke.current;z==="gann"&&Se&&!Se.contains(Ie.target)&&Ae(null);const Re=ve.current;z==="shape"&&Re&&!Re.contains(Ie.target)&&Ae(null)};return window.addEventListener("mousedown",De),()=>window.removeEventListener("mousedown",De)},[E,z]),j.useEffect(()=>{const De=Ie=>{Ie.key==="Escape"&&(N(!1),M(null),Ae(null))};return window.addEventListener("keydown",De),()=>window.removeEventListener("keydown",De)},[]);const Be=j.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"}],[]),de=De=>{const Ie=Be[De].label;if(Ie==="Menu"){N(Qe=>!Qe),M(null);return}if(Ie==="Grid"){s(!n);return}if(Ie==="Magnet"){l(!o),r(o?null:De);return}if(Ie==="Delete"){if(c.length>0){const Qe=[...c];Qe.pop(),u(Qe)}return}if(Ie==="Eye"){y(!m);return}if(Ie==="Lock"){T(!v);return}if(Ie==="Light Theme"||Ie==="Dark Theme"){U(C==="light"?"dark":"light"),N(!1),M(null);return}if(Ie==="History"){F(!0);return}r(A===De?null:De)};Be.slice(0,12);const ke=Be.slice(12),qe=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],At=[{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"})]})},{label:"Open Demo account",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",{fill:"#CDFDDA",fillRule:"evenodd",d:"M14.5 13.103c1.836 0 3.667.723 5.5 2.14V19l-10.5.5-.5-4.257c1.833-1.417 3.664-2.14 5.5-2.14Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M9.53 15.469 9.5 19l10-.477v-3.032c-1.703-1.27-3.365-1.888-5-1.888-1.626 0-3.277.611-4.97 1.866Zm-.836-.622c1.895-1.465 3.83-2.244 5.806-2.244 1.975 0 3.91.78 5.806 2.244l.194.15v4.48l-12.03.545V15.02l.224-.173Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"m7.736 13.701-.734 2.345L7.001 20H4.5a1 1 0 0 1-1-1v-4c1.412-.669 2.824-1.102 4.236-1.299Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"m7.913 13.678-.475 1.086c-.988.111-1.87.308-2.646.59l-.29.11v3.529H7L7.002 20H4.5a1 1 0 0 1-1-1v-4c1.471-.697 2.942-1.138 4.413-1.322Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#CDFDDA",d:"M14.5 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M14.5 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",d:"M11.471 11.979A4.992 4.992 0 0 1 9.5 8c0-.67.131-1.308.37-1.891a3.5 3.5 0 1 0 1.601 5.87Z"}),a.jsx("path",{fill:"#CDFDDA",d:"M9.586 7.07a2.5 2.5 0 1 0 1.153 4.226A4.981 4.981 0 0 1 9.5 8c0-.318.03-.63.086-.93Z"})]})})})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.jsx("path",{fillRule:"evenodd","clip-rule":"evenodd",d:"M20 6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6zm-2 3V6h-3v3h3zm-4-3h-4v2.999h4V6zM9 6H6v3l3-.001V6zm-3 4v4l3-.001v-4H6zm0 5v3h3v-3.001H6zm4 3h4v-3.001h-4V18zm5 0h3v-3h-3v3zm3-4v-4h-3v4h3zm-8-.001v-4h4v4h-4z",fill:"currentColor"})})})},{label:"Trade Orders",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Trade Position",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),a.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),a.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 19L8 14L12 19H4Z",fill:"#3183FF"}),a.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),a.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP Levels",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.688 17.773-.375.91c.43.277.911.415 1.445.415.614 0 1.104-.15 1.469-.45.367-.299.55-.68.55-1.144 0-.258-.044-.491-.132-.7a1.568 1.568 0 0 0-.387-.55c-.17-.159-.446-.332-.828-.52-.727-.354-1.09-.695-1.09-1.023 0-.198.064-.358.191-.48.13-.126.313-.188.547-.188.396 0 .772.128 1.129.383l.309-.875c-.31-.248-.796-.371-1.457-.371-.508 0-.925.146-1.25.437a1.421 1.421 0 0 0-.485 1.102c0 .237.04.453.121.648.084.195.2.365.352.508.154.14.45.322.887.543.44.219.73.417.87.594.141.177.212.363.212.558 0 .417-.299.625-.895.625-.388 0-.782-.14-1.184-.422ZM8.68 13.277V19h3.601v-.902H9.695v-4.82H8.68ZM20 20H4v1h16v-1Z",fill:"#EA4C4C"}),a.jsx("path",{d:"M10.5 10V7.895c.193.018.346.027.46.027 1.548 0 2.321-.656 2.321-1.969 0-.588-.21-1.02-.629-1.297-.416-.278-1.076-.418-1.98-.418-.115 0-.51.015-1.188.043V10H10.5Zm0-3.008V5.16c.099-.013.202-.02.309-.02.955 0 1.433.298 1.433.891 0 .35-.107.602-.32.758-.214.154-.552.23-1.016.23-.099 0-.234-.009-.406-.027Z",fill:"#3183FF",fillRule:"evenodd","clip-rule":"evenodd"}),a.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"m6.926 14-.418-1.16H4.547L4.148 14H3.02L5.3 8.2h.446l2.3 5.8h-1.12ZM5.523 9.95l-.687 2.113H6.21l-.688-2.114Zm2.86 3.734.375-.91c.4.28.795.421 1.183.421.597 0 .895-.208.895-.625a.886.886 0 0 0-.211-.558c-.14-.177-.431-.375-.871-.594-.438-.221-.733-.402-.887-.543a1.506 1.506 0 0 1-.351-.508 1.682 1.682 0 0 1-.121-.648c0-.443.161-.81.484-1.102.325-.291.742-.437 1.25-.437.661 0 1.147.123 1.457.37l-.309.876a1.909 1.909 0 0 0-1.129-.383c-.234 0-.416.062-.546.187a.635.635 0 0 0-.192.48c0 .33.363.67 1.09 1.024.383.188.659.361.828.52.17.156.298.34.387.55.088.209.133.442.133.7 0 .463-.184.845-.551 1.144-.365.3-.854.45-1.469.45a2.617 2.617 0 0 1-1.445-.414Zm7.613.316-1.594-2.438-.636.872V14H12.75V8.277h1.016v2.739l1.945-2.739h1.156l-1.793 2.5L17.211 14h-1.215ZM3 15h18v1H3z",fill:"#C96057"})})})})},{label:"Chart Controls",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),a.jsx("path",{d:"M11.2574 18.9959C11.1719 18.9986 11.0861 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11C19 11.0599 18.9993 11.1196 18.998 11.1791L16.9574 10.2813C16.6023 7.3064 14.0705 5 11 5C7.68629 5 5 7.68629 5 11C5 14.191 7.49101 16.8002 10.6345 16.9891L11.2574 18.9959Z",fill:"currentColor"})]})})})},{label:"Trade Notification",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Crosshair cursor",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"oneclick",label:"One Click Trading",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20.9914 12.3966L18.9885 11.5954C18.7789 7.91769 15.7302 5 12 5C8.13401 5 5 8.13401 5 12C5 15.7302 7.91769 18.7789 11.5954 18.9885L12.3966 20.9914C12.2651 20.9971 12.1329 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 12.1329 20.9971 12.2651 20.9914 12.3966ZM11 11L21 15L19 17L22 20L20 22L17 19L15 21L11 11Z",fill:"currentColor"})})})})},{key:"theme",label:C==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"m4.408 12.954-2.265-.756a.209.209 0 0 1 0-.396l2.265-.755a.209.209 0 0 1 .276.198v1.51c0 .143-.14.244-.276.198ZM5.959 7.306 4.89 5.17c-.09-.18.1-.37.28-.28l2.136 1.068a.209.209 0 0 1 .054.334L6.293 7.36c-.1.101-.27.074-.334-.054ZM11.802 21.857l-.755-2.265a.209.209 0 0 1 .198-.276h1.51c.143 0 .244.14.198.276l-.755 2.265a.21.21 0 0 1-.396 0ZM11.802 2.143l-.755 2.265a.209.209 0 0 0 .198.276h1.51c.143 0 .244-.14.198-.276l-.755-2.265a.209.209 0 0 0-.396 0ZM18.83 19.11l-2.137-1.068a.209.209 0 0 1-.054-.335l1.068-1.068c.1-.1.27-.073.334.055l1.069 2.136c.09.18-.101.37-.28.28ZM16.693 5.958 18.83 4.89c.18-.09.37.1.28.28l-1.068 2.136a.209.209 0 0 1-.334.054l-1.068-1.068a.209.209 0 0 1 .054-.334ZM4.89 18.83l1.069-2.136a.209.209 0 0 1 .334-.055l1.068 1.068c.101.101.074.271-.054.335L5.171 19.11c-.18.09-.37-.1-.28-.28ZM21.857 12.198l-2.265.755a.209.209 0 0 1-.276-.198v-1.51c0-.143.14-.244.276-.198l2.265.755a.21.21 0 0 1 0 .396Z",fill:"#FEBC5A"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fillRule:"evenodd",d:"M20.775 8.992C20.922 9.638 21 10.31 21 11a8.354 8.354 0 0 0-.787 0c-1.467.072-2.422.564-3.082 1.283l-1.18-1.65c.761-.718 1.697-1.205 2.81-1.452A7 7 0 1 0 12 18c.396-.001.565-.082.63-.12.07-.042.17-.124.295-.34.218-.375.36-.835.534-1.49l1.518 1.822C14.485 19.102 13.705 20 12 20a9 9 0 1 1 8.775-11.008Z","clip-rule":"evenodd",fill:"currentColor"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M13.892 14.693c-2.034.46-2.59-1.07-2.892-4.693 3.85.352 5.232 1.05 4.697 3.012L20 17.192s.038 1.023-.361 1.447c-.463.49-1.687.361-1.687.361l-4.06-4.307Z",fill:"currentColor"})]})})}),submenu:[{label:"Green & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#26a69a"})]})})})},{label:"Blue & Red",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#578cf2"})]})})})},{label:"Black & White",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#76ac85"})]})})})}]},{key:"lang",label:"Language",rightText:"EN",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.9 17.39C17.64 16.59 16.89 16 16 16H15V13C15 12.4477 14.5523 12 14 12H8V10H10C10.5523 10 11 9.55228 11 9V7H13C14.1046 7 15 6.10457 15 5V4.59C17.93 5.77 20 8.64 20 12C20 14.08 19.2 15.97 17.9 17.39ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.78 4.21 10.21L9 15V16C9 17.1046 9.89543 18 11 18V19.93ZM12 2C6.47715 2 2 6.47715 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C6.8043 20.9464 9.34784 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z",fill:"currentColor"})})})}),submenu:[{label:"English",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Arabic",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Bulgarian",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 18H13V16H11V18ZM12 6C9.79 6 8 7.79 8 10H10C10 8.9 10.9 8 12 8C13.1 8 14 8.9 14 10C14 12 11 11.75 11 15H13C13 12.75 16 12.5 16 10C16 7.79 14.21 6 12 6Z",fill:"currentColor"})})})})},{key:"contact",label:"Contact us",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M5 4C3.89543 4 3 4.89543 3 6V15C3 16.1046 3.89543 17 5 17H5.98719L6 21L13 17H19C20.1046 17 21 16.1046 21 15V6C21 4.89543 20.1046 4 19 4H5ZM6 6H18C18.5128 6 18.9355 6.38604 18.9933 6.88338L19 7V14C19 14.5128 18.614 14.9355 18.1166 14.9933L18 15H12.5339C12.4234 15 12.314 15.0183 12.21 15.0539L12.108 15.0952L8 17.0289V16C8 15.4872 7.61396 15.0645 7.11662 15.0067L7 15H6C5.48716 15 5.06449 14.614 5.00673 14.1166L5 14V7C5 6.48716 5.38604 6.06449 5.88338 6.00673L6 6Z",fillRule:"evenodd","clip-rule":"evenodd",fill:"currentColor"})})})})},{key:"about",label:"About program",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],rt=({item:De})=>{const Ie=!!De.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Pe.current&&(clearTimeout(Pe.current),Pe.current=null),Ie&&M(De.key)},onMouseLeave:()=>{Ie&&(Pe.current=setTimeout(()=>M(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{Ie?M(Qe=>Qe===De.key?null:De.key):(De.key==="theme"&&U(Qe=>Qe==="light"?"dark":"light"),N(!1),M(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:De.label}),De.rightText&&a.jsx("span",{className:`text-xs ${Ge?"text-slate-500":"text-slate-400"}`,children:De.rightText}),Ie&&a.jsx("svg",{className:`w-4 h-4 ${Ge?"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"})})]}),Ie&&R===De.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 ${Ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:De.submenu.map((Qe,Te)=>{const He=Ce[De.key]===Qe.label||Qe.selected&&Ce[De.key]==null;return a.jsxs("button",{type:"button",onClick:()=>{Fe(Se=>({...Se,[De.key]:Qe.label}))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:Qe.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Qe.label}),He&&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"})})})]},Te)})})})]})},Ge=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 ${Ge?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:qe.map((De,Ie)=>{const Qe=De==="gann",Te=Qe?null:Be[De],He=Qe?-1:De;return a.jsxs(j.Fragment,{children:[He===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=Ir[$].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
+ ${A===Ir[$].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Ir[$].label,children:Ir[$].icon}),a.jsx("span",{onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:ie?10:7,height:ie?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:Ge?"#64748b":"#94a3b8"})})})]}):He===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=Dr[ce].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
+ ${A===Dr[ce].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Dr[ce].label,children:Dr[ce].icon}),a.jsx("span",{onMouseEnter:()=>oe(!0),onMouseLeave:()=>oe(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:ee?10:7,height:ee?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:Ge?"#64748b":"#94a3b8"})})})]}):Qe?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=_r[le].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
+ ${A===_r[le].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:_r[le].label,children:_r[le].icon}),a.jsx("span",{onMouseEnter:()=>pe(!0),onMouseLeave:()=>pe(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:he?10:7,height:he?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More 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:Ge?"#64748b":"#94a3b8"})})})]}):He===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=Pr[ge].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
+ ${A===Pr[ge].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Pr[ge].label,children:Pr[ge].icon}),a.jsx("span",{onMouseEnter:()=>ye(!0),onMouseLeave:()=>ye(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Ee?10:7,height:Ee?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:Ge?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>de(He),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
+ ${Te.label==="Grid"&&n||Te.label==="Eye"&&!m||Te.label==="Lock"&&v||A===He?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Te.label}: ${Te.description}`,children:Te.icon}),!Qe&&Te.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${Ge?"border-slate-200":"border-slate-700"}`})]},Qe?"gann-slot":`${Te.label}-${De}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:ke.map((De,Ie)=>{const Qe=12+Ie;return a.jsx("button",{onClick:()=>de(Qe),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
+ ${De.label==="Grid"&&n||De.label==="Eye"&&!m||De.label==="Lock"&&v||A===Qe?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${De.label}: ${De.description}`,children:De.icon},De.label)})})]}),z==="line"&&a.jsx(xs,{top:84,panelRef:Ne,isLight:Ge,children:Ir.map((De,Ie)=>{const Qe=$===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),V(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},De.toolId)})}),z==="channel"&&a.jsx(xs,{top:128,panelRef:Je,isLight:Ge,children:Dr.map((De,Ie)=>{const Qe=ce===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),Z(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},De.toolId)})}),z==="gann"&&a.jsx(xs,{top:210,panelRef:Ke,isLight:Ge,children:_r.map((De,Ie)=>{const Qe=le===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),se(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},De.toolId)})}),z==="shape"&&a.jsx(xs,{top:250,panelRef:ve,isLight:Ge,children:Pr.map((De,Ie)=>{const Qe=ge===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),be(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"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 ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},De.toolId)})}),E&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{N(!1),M(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:Ue,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${Ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Ge?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${Ge?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),a.jsx("div",{className:`text-[12px] mt-0.5 ${Ge?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:At.map(De=>a.jsx(rt,{item:De},De.key))})]})]})]})};function CT(i){return zt({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"},TT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},xT={binance:"CRYPTO"},bT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Ht(),o=s==="light",[l,c]=j.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),m=j.useMemo(()=>{const v={};for(const U of u){const F=(U.category||"other").toLowerCase();v[F]||(v[F]=[]),v[F].push(U)}const T=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(v).sort((U,F)=>{const E=T.indexOf(U),N=T.indexOf(F);return E!==-1&&N!==-1?E-N:E!==-1?-1:N!==-1?1:U.localeCompare(F)}).map(U=>({category:U,symbols:v[U]}))},[u]),y=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(wT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(mT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Um,{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(mT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):u.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:m.map(({category:v,symbols:T})=>a.jsxs(ie.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?BT[v]||"text-slate-600":wT[v]||"text-slate-400"}`,children:yT[v]||v.toUpperCase()})}),T.map(y)]},v))})]})})]})]})},vT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:m}=Lt(),y=i||n,v=e||s,T=u||[],B=o==="light",S=l?"history":"trade";ie.useEffect(()=>{l&&m&&m()},[l,m]);const F="#26A69A",U="#EF5350",k=B?"#f8fafc":"#12161D",R=B?"#e2e8f0":"#1e293b",L=B?"#f1f5f9":"#12161D",z=B?"#F0F5F9":"#2B3543",te=B?"#f8fafc":"#131c2e",$=B?"#12161D":"#fff",V=B?"#64748b":"#fff",Ae=(v||[]).filter(pe=>pe.status==="OPEN"||!pe.closeAt),re=y?.balance||0,le=y?.equity??re,X=y?.margin||0,j=y?.freeMargin??le-X,oe=X>0?le/X*100:0,ae=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"},ce=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)},Qe=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)}`},Se=ie.useCallback((pe,Pe)=>{pe.stopPropagation(),t&&t(Pe.id,Pe)},[t]),Ce=ie.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:$},Ue={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:z,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ee={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},Ie={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Ze={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},ze={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:L},ve=pe=>({padding:"5px 14px",fontSize:"11px",fontWeight:pe?700:500,color:pe?B?"#0ea5e9":"#38bdf8":V,borderBottom:pe?`2px solid ${B?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),Ne={padding:"4px 8px",textAlign:"left",color:V,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",backgroundColor:L,position:"sticky",top:0,zIndex:1},ye={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:$};return a.jsxs("div",{style:Te,children:[a.jsxs("div",{style:Ue,children:[a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Balance:"}),a.jsxs("span",{style:{...Ze,color:$},children:["$",se(re)]})]}),a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Equity:"}),a.jsxs("span",{style:{...Ze,color:le>=re?F:U},children:["$",se(le)]})]}),a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Margin:"}),a.jsxs("span",{style:{...Ze,color:$},children:["$",se(X)]})]}),a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Free Margin:"}),a.jsxs("span",{style:{...Ze,color:j>=0?$:U},children:["$",se(j)]})]}),a.jsxs("div",{style:{...Ee,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Ie,children:"Margin Level:"}),a.jsx("span",{style:{...Ze,color:oe>=100?F:U},children:X>0?oe.toFixed(2)+"%":"—"})]}),Ae.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Ie,children:"Float P/L:"}),a.jsxs("span",{style:{...Ze,color:ae>=0?F:U,fontWeight:700},children:[ae>=0?"+":"",se(ae)]})]})]}),a.jsxs("div",{style:ze,children:[a.jsx("button",{style:ve(S==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:ve(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:Ne,children:"Symbol"}),a.jsx("th",{style:Ne,children:"Ticket"}),a.jsx("th",{style:Ne,children:"Time"}),a.jsx("th",{style:Ne,children:"Type"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...Ne,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...Ne,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,Je=Pe>=0?F:U;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=te,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:$,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:Qe(pe.openAt||pe.time)}),a.jsx("td",{style:{...ye,fontWeight:700,color:pe.type?.toUpperCase()==="BUY"?F:U},children:pe.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(pe.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ce(pe.price??pe.openPrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.stopLoss?U:V},children:pe.stopLoss?ce(pe.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.takeProfit?F:V},children:pe.takeProfit?ce(pe.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:V},children:pe.currentPrice?ce(pe.currentPrice):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:Je},children:de(Pe)}),a.jsx("td",{style:{...ye,textAlign:"center"},children:a.jsx("button",{onClick:it=>Ce(it,pe),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:Je},children:a.jsx("button",{onClick:it=>Se(it,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:it=>it.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:it=>it.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:Ne,children:"Symbol"}),a.jsx("th",{style:Ne,children:"Ticket"}),a.jsx("th",{style:Ne,children:"Open Time"}),a.jsx("th",{style:Ne,children:"Type"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:Ne,children:"Close Time"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Ne,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,Je=Pe>=0?F:U;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=te,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:$,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:Qe(pe.openAt)}),a.jsx("td",{style:{...ye,fontWeight:700,color:pe.type?.toUpperCase()==="BUY"?F:U},children:pe.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(pe.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ce(pe.openPrice)}),a.jsx("td",{style:{...ye,color:V},children:Qe(pe.closeAt)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:ce(pe.closePrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.stopLoss?U:V},children:pe.stopLoss?ce(pe.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:pe.takeProfit?F:V},children:pe.takeProfit?ce(pe.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:Je},children:de(Pe)})]},pe.id)})})]})})]})},TT="2.3.2";je.AccountPanel=vT,je.BuySellPanel=xh,je.Chart=tT,je.ChartTypeSelector=aT,je.CoinSelector=$d,je.DrawingTools=Yd,je.LeftSidebar=gT,je.MarketExecutionModal=bh,je.MarketWatch=CT,je.PositionsPanel=cT,je.SYMBOL_CONFIG=Va,je.StopLoss=Zd,je.TakeProfit=Jd,je.TimeframeSelector=sT,je.ToolCustomizationModal=Eh,je.TopBar=fT,je.TradePanel=lT,je.TradingProvider=hm,je.TradingToolbar=rT,je.VolumeControl=Xd,je.alignToTimeframe=We,je.detectGaps=ap,je.getSymbolConfig=Oi,je.is24x7Symbol=op,je.isCryptoSymbol=Pr,je.isForexSymbol=_r,je.isWithinTradingSession=lp,je.normalizeCandleTimes=Wa,je.normalizeTime=q,je.processCandles=Xa,je.processSingleCandle=Za,je.setSocketBaseUrl=mh,je.timeframeToSeconds=tA,je.useTrading=Lt,je.validateTimeOrdering=cp,je.version=TT,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"})}));
49
+ `}),a.jsxs("div",{style:{width:`${i}px`,minWidth:"220px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[a.jsx(CT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):u.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:m.map(({category:v,symbols:T})=>a.jsxs(j.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?TT[v]||"text-slate-600":vT[v]||"text-slate-400"}`,children:xT[v]||v.toUpperCase()})}),T.map(y)]},v))})]})})]})]})},QT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:m}=Ht(),y=i||n,v=e||s,T=u||[],C=o==="light",U=l?"history":"trade";j.useEffect(()=>{l&&m&&m()},[l,m]);const F="#26A69A",E="#EF5350",N=C?"#f8fafc":"#12161D",R=C?"#e2e8f0":"#1e293b",M=C?"#f1f5f9":"#12161D",z=C?"#F0F5F9":"#2B3543",Ae=C?"#f8fafc":"#131c2e",$=C?"#12161D":"#fff",V=C?"#64748b":"#fff",ie=(v||[]).filter(de=>de.status==="OPEN"||!de.closeAt),re=y?.balance||0,ce=y?.equity??re,Z=y?.margin||0,ee=y?.freeMargin??ce-Z,oe=Z>0?ce/Z*100:0,le=ie.reduce((de,ke)=>de+(ke.livePnL??ke.profit??0),0),se=de=>{const ke=parseFloat(de);return Number.isFinite(ke)?ke.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},he=de=>{const ke=parseFloat(de);return!ke||isNaN(ke)?"—":ke>=1e4?ke.toFixed(2):ke>=10?ke.toFixed(4):ke.toFixed(5)},pe=de=>{const ke=parseFloat(de);return isNaN(ke)?"—":(ke>=0?"+":"")+ke.toFixed(2)},ge=de=>{const ke=parseFloat(de);return isNaN(ke)?"—":ke.toFixed(2)},be=de=>{if(!de)return"—";const ke=new Date(de);return isNaN(ke.getTime())?String(de):`${ke.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${ke.toTimeString().slice(0,8)}`},Ee=j.useCallback((de,ke)=>{de.stopPropagation(),t&&t(ke.id,ke)},[t]),ye=j.useCallback((de,ke)=>{de.stopPropagation(),A&&A(ke)},[A]),Ce={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:N,borderTop:`1px solid ${R}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:$},Fe={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:z,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ue={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},Ne={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Je={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ke={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:M},ve=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"}),Pe={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},Be={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:$};return a.jsxs("div",{style:Ce,children:[a.jsxs("div",{style:Fe,children:[a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Balance:"}),a.jsxs("span",{style:{...Je,color:$},children:["$",se(re)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Equity:"}),a.jsxs("span",{style:{...Je,color:ce>=re?F:E},children:["$",se(ce)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Margin:"}),a.jsxs("span",{style:{...Je,color:$},children:["$",se(Z)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Free Margin:"}),a.jsxs("span",{style:{...Je,color:ee>=0?$:E},children:["$",se(ee)]})]}),a.jsxs("div",{style:{...Ue,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Ne,children:"Margin Level:"}),a.jsx("span",{style:{...Je,color:oe>=100?F:E},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:Ne,children:"Float P/L:"}),a.jsxs("span",{style:{...Je,color:le>=0?F:E,fontWeight:700},children:[le>=0?"+":"",se(le)]})]})]}),a.jsxs("div",{style:Ke,children:[a.jsx("button",{style:ve(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:ve(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:Pe,children:"Symbol"}),a.jsx("th",{style:Pe,children:"Ticket"}),a.jsx("th",{style:Pe,children:"Time"}),a.jsx("th",{style:Pe,children:"Type"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...Pe,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...Pe,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:ie.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Be,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):ie.map(de=>{const ke=de.livePnL??de.profit??0,qe=ke>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:At=>At.currentTarget.style.backgroundColor=Ae,onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Be,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Be,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Be,color:V},children:be(de.openAt||de.time)}),a.jsx("td",{style:{...Be,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Be,textAlign:"right"},children:ge(de.volume)}),a.jsx("td",{style:{...Be,textAlign:"right"},children:he(de.price??de.openPrice)}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?he(de.stopLoss):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?he(de.takeProfit):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",color:V},children:de.currentPrice?he(de.currentPrice):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",fontWeight:700,color:qe},children:pe(ke)}),a.jsx("td",{style:{...Be,textAlign:"center"},children:a.jsx("button",{onClick:At=>ye(At,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:V,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:At=>At.currentTarget.style.color="#f59e0b",onMouseLeave:At=>At.currentTarget.style.color=V,children:"✎"})}),a.jsx("td",{style:{...Be,textAlign:"right",fontWeight:700,color:qe},children:a.jsx("button",{onClick:At=>Ee(At,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:At=>At.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:At=>At.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:Pe,children:"Symbol"}),a.jsx("th",{style:Pe,children:"Ticket"}),a.jsx("th",{style:Pe,children:"Open Time"}),a.jsx("th",{style:Pe,children:"Type"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:Pe,children:"Close Time"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:T.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Be,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):T.map(de=>{const ke=de.profit??0,qe=ke>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:At=>At.currentTarget.style.backgroundColor=Ae,onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Be,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Be,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Be,color:V},children:be(de.openAt)}),a.jsx("td",{style:{...Be,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Be,textAlign:"right"},children:ge(de.volume)}),a.jsx("td",{style:{...Be,textAlign:"right"},children:he(de.openPrice)}),a.jsx("td",{style:{...Be,color:V},children:be(de.closeAt)}),a.jsx("td",{style:{...Be,textAlign:"right"},children:he(de.closePrice)}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?he(de.stopLoss):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?he(de.takeProfit):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",fontWeight:700,color:qe},children:pe(ke)})]},de.id)})})]})})]})},FT="2.3.2";tt.AccountPanel=QT,tt.BuySellPanel=Fh,tt.Chart=nT,tt.ChartTypeSelector=uT,tt.CoinSelector=Jd,tt.DrawingTools=ep,tt.LeftSidebar=yT,tt.MarketExecutionModal=Uh,tt.MarketWatch=bT,tt.PositionsPanel=pT,tt.SYMBOL_CONFIG=Ra,tt.StopLoss=qd,tt.TakeProfit=jd,tt.TimeframeSelector=cT,tt.ToolCustomizationModal=Hh,tt.TopBar=BT,tt.TradePanel=dT,tt.TradingProvider=fm,tt.TradingToolbar=aT,tt.VolumeControl=Yd,tt.alignToTimeframe=Ve,tt.detectGaps=up,tt.getSymbolConfig=Wi,tt.is24x7Symbol=hp,tt.isCryptoSymbol=Or,tt.isForexSymbol=kr,tt.isWithinTradingSession=dp,tt.normalizeCandleTimes=$a,tt.normalizeTime=q,tt.processCandles=Ya,tt.processSingleCandle=qa,tt.setSocketBaseUrl=yh,tt.timeframeToSeconds=iA,tt.useTrading=Ht,tt.validateTimeOrdering=pp,tt.version=FT,Object.defineProperty(tt,Symbol.toStringTag,{value:"Module"})}));