@nabeeltahirdeveloper/chart-sdk 2.3.10 → 2.4.0

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,Ae){"use strict";var vs=typeof document<"u"?document.currentScript:null;const _t="17:00-17:00",Pt="America/New_York",wA="24x7",BA="UTC",Na={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"}},Oa={type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"};function Oi(i){return i&&Na[i.toUpperCase()]||Oa}function rp(i){return Oi(i).type==="forex"}function np(i){return Oi(i).type==="crypto"}function sp(i){return Oi(i).session==="24x7"}function Y(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 op(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 ap(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 Ka(i){return Array.isArray(i)?i.map(e=>({...e,time:Y(e.time)})).filter(e=>e.time!=null):[]}function lp(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 Va(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(Y(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 Wa(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=Y(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 cp(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],h=c-l;r=l-1.5*h,n=c+1.5*h}else{const s=t.reduce((c,h)=>c+h,0)/t.length,o=t.reduce((c,h)=>c+Math.pow(h-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 hp(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,h=c-l;if(h>A&&((h/3600).toFixed(1),(A/3600).toFixed(1)),h>e&&h<=A){const g=i[o];let C=l+e,x=0;for(C=We(C,e);C<c&&x<r;){const b=We(C,e);t.some(U=>U.time===b)||(t.push({time:b,open:g.close,high:g.close,low:g.close,close:g.close,volume:0}),x++),C+=e}if(C<c&&x>=r){const b=We(c-e,e);t.some(U=>U.time===b)||t.push({time:b,open:g.close,high:g.close,low:g.close,close:g.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function 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 Ra(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=Ka(i).map(U=>({...U,time:We(U.time,r)})).filter(U=>Va(U)).map(U=>za(U)),l=Wa(o);l.sort((U,F)=>U.time-F.time);const c=l.filter((U,F)=>F===0?!0:U.time>l[F-1].time),h=c.length>10?cp(c,"percentile"):c,g=Wa(h);g.sort((U,F)=>U.time-F.time);const C=hp(g,r),x=[];for(let U=1;U<C.length;U++){const F=C[U].time-C[U-1].time;F>r*2&&x.push({from:C[U-1].time,to:C[U].time,gapSeconds:F,gapMinutes:Math.round(F/60),fromDate:new Date(C[U-1].time*1e3).toISOString(),toDate:new Date(C[U].time*1e3).toISOString()})}const b=h.filter((U,F)=>F===0?!1:U.close===h[F-1].close&&U.open===h[F-1].close).length,v={original:i.length,processed:C.length,duplicates:i.length-l.length,outliers:b,gaps:x,filledGaps:C.length-g.length,symbolConfig:A};return{candles:C,stats:v}}function Ga(i,e,t="1m"){if(!i||!e||!Va(i))return null;const A=Y(i.time);if(A==null)return null;const r=tA(t),n=We(A,r);return za({...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 up=(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 dp(i){return new up(i)}var pp=(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}gp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=$a(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=dp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=$a(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?mp(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 fp(i,e){return new pp(i,e.transform,e.options)}function $a(i){return i.ownerDocument.defaultView}function gp(){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 mp(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 wp=(function(){function i(e,t,A){if(t.width===0||t.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,A.width===0||A.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=A,this._context=e}return i.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},i.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(i.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),i})();function 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 wp(r,t,A)}const Bp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},yp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Cp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},vp={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},Tp={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},xp={color:"#26a69a",base:0},Xa={color:"#2196f3"},Za={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,Ya;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 qa(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"})(Ya||(Ya={}));const ja={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 el(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const bp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Qp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Fp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Up=/^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 ja&&(i=ja[i]);{const e=Up.exec(i)||Fp.exec(i);if(e)return[rA(parseInt(e[1],10)),rA(parseInt(e[2],10)),rA(parseInt(e[3],10)),el(e.length<5?1:parseFloat(e[4]))]}{const e=Qp.exec(i);if(e)return[rA(parseInt(e[1],16)),rA(parseInt(e[2],16)),rA(parseInt(e[3],16)),1]}{const e=bp.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 tl(i){return .199*i[0]+.687*i[1]+.114*i[2]}function Dr(i){const e=Ki(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:tl(e)>160?"black":"white"}}class Bt{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 _r(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 Sp(i){return i!==null}function Wi(i){return i===null?void 0:i}const Ts="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Bi(i,e,t){return e===void 0&&(e=Ts),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Ep{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 xs{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 Lp 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 h=n.it[c],g=Math.round(h.nt*t)+s,C=h.st*A,x=l*A+s;e.moveTo(g,C),e.arc(g,C,x,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function Mp(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Hp={from:0,to:1};class Ip{constructor(e,t){this.ut=new xs,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(Mp),this.ct=this.dt.map((A=>{const r=new Lp;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 h=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,h.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=A,l.it[0].nt=r.It(A),l.tt=Hp}))}}let Dp=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,h,g,C){c.beginPath();const x=c.lineWidth%2?.5:0;c.moveTo(h+x,g),c.lineTo(h+x,C),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),qa(e,l,0,t.width))}};class _p{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 Dp(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 Pp(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 Pr(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 il(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 h;Al(i,e+c,t+c,A-s,r-s,(h=-c,o.map((g=>g===0?g:g+h)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function rl(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 nl{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 h=this.Gt(l,t,A,r),g=h.Jt;return h.Qt?il(c,g.ti,g.ii,g.ni,g.si,s,g.ei,[g.ht,0,0,g.ht],s):il(c,g.ri,g.ii,g.ni,g.si,s,g.ei,[0,g.ht,g.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(g.ri,g.li,g.ai-g.ri,g.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(h.Qt?g.ui-g.ei:0,g.ii,g.ei,g.ci-g.ii)),h}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:h}=e,g=this.zt.hi||!this.zt.mi?t.T:0,C=this.zt.bi?t.C:0,x=t.L+this.Xt.wi,b=t.B+this.Xt.gi,v=t.A,U=t.I,F=this.zt.Kt,M=t.P,N=A.Mi(s,F),R=Math.ceil(A.xi(s,F)),L=M+x+b,z=t.C+v+U+R+g,q=Math.max(1,Math.floor(h));let $=Math.round(L*h);$%2!=q%2&&($+=1);const V=C>0?Math.max(1,Math.floor(C*c)):0,j=Math.round(z*c),te=Math.round(g*c),ce=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,X=Math.round(ce*h)-Math.floor(.5*h),ee=Math.floor(X+q/2-$/2),se=ee+$,le=r==="right",ne=le?l.width-C:C,he=le?o.width-V:V;let de,we,xe;return le?(de=he-j,we=he-te,xe=ne-g-v-C):(de=he+j,we=he+te,xe=ne+g+v),{Qt:le,Jt:{ii:ee,li:X,ci:se,ni:j,si:$,ht:2*c,ei:V,ti:de,ri:he,ai:we,oi:q,ui:o.width},di:{ii:ee/h,ci:se/h,fi:xe,pi:N}}}}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||nl)(this.Ci,this.yi),this.Ri=new(e||nl)(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 kp 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=Dr(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 Np=/[1-9]/g;class sl{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const A=e.useMediaCoordinateSpace((({context:C})=>(C.font=t.R,Math.round(t.Wi.xi(C,Le(this.zt).Kt,Np)))));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 h=c+n,g=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:C,horizontalPixelRatio:x,verticalPixelRatio:b})=>{const v=Le(this.zt);C.fillStyle=v.t;const U=Math.round(c*x),F=Math.round(0*b),M=Math.round(h*x),N=Math.round(g*b),R=Math.round(2*x);if(C.beginPath(),C.moveTo(U,F),C.lineTo(U,N-R),C.arcTo(U,N,U+R,N,R),C.lineTo(M-R,N),C.arcTo(M,N,M,N-R,R),C.lineTo(M,F),C.fill(),v.hi){const L=Math.round(v.ki*x),z=F,q=Math.round((z+t.T)*b);C.fillStyle=v.V;const $=Math.max(1,Math.floor(x)),V=Math.floor(.5*x);C.fillRect(L-V,z,$,q-z)}})),e.useMediaCoordinateSpace((({context:C})=>{const x=Le(this.zt),b=0+t.C+t.T+t.L+t.P/2;C.font=t.R,C.textAlign="left",C.textBaseline="middle",C.fillStyle=x.V;const v=t.Wi.Mi(C,"Apr0");C.translate(c+r,b+v),C.fillText(x.Kt,0,0)}))}}class Op{constructor(e,t,A){this.ft=!0,this.Wt=new sl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Le(n)),e.yt=!0;const s=Dr(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class bs{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 ol;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(ol||(ol={}));class Kp extends bs{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 Ip(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 Op(this,e,A),this.wn=new _p(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 h=c!==null?c.Ct():null;return c!==null&&h!==null?(this.nn=t,this.an=c.Rt(t,h)):(this.nn=NaN,this.an=NaN),r!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter(Sp),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 kp(this,t,A),e.set(t,r)),r}}function Nr(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 al=".";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 Or{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=al+HA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=al+HA(0,n));return A.toFixed(0)+r}}class ll extends Or{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class Vp{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 cl(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,h=e[A.from];let g=n(i,h),C=h;if(A.to-A.from<2){const x=r/2;o.beginPath();const b={nt:h.nt-x,st:h.st},v={nt:h.nt+x,st:h.st};o.moveTo(b.nt*l,b.st*c),o.lineTo(v.nt*l,v.st*c),s(i,g,b,v)}else{const x=(v,U)=>{s(i,g,C,U),o.beginPath(),g=v,C=U};let b=C;o.beginPath(),o.moveTo(h.nt*l,h.st*c);for(let v=A.from+1;v<A.to;++v){b=e[v];const U=n(i,b);switch(t){case 0:o.lineTo(b.nt*l,b.st*c);break;case 1:o.lineTo(b.nt*l,e[v-1].st*c),U!==g&&(x(U,b),o.lineTo(b.nt*l,e[v-1].st*c)),o.lineTo(b.nt*l,b.st*c);break;case 2:{const[F,M]=zp(e,v-1,v);o.bezierCurveTo(F.nt*l,F.st*c,M.nt*l,M.st*c,b.nt*l,b.st*c);break}}t!==1&&U!==g&&(x(U,b),o.moveTo(b.nt*l,b.st*c))}(C!==b||C===b&&t===1)&&s(i,g,C,b)}}const hl=6;function Qs(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function ul(i,e){return{nt:i.nt/e,st:i.st/e}}function zp(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=ul(Qs(i[t],i[A]),hl),{nt:n.nt+s.nt,st:n.st+s.st}),Qs(i[t],ul(Qs(i[r],i[e]),hl))]}function Wp(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 dl 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 h=e.context;h.lineCap="butt",h.lineJoin="round",h.lineWidth=s,ti(h,o),h.lineWidth=1,cl(e,A,l,r,n,this.bs.bind(this),Wp.bind(null,c))}}function Fs(i,e,t){return Math.min(Math.max(i,e),t)}function Kr(i,e,t){return e-i<=t}function pl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Us{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 h=e.context.createLinearGradient(0,0,0,l);if(h.addColorStop(0,r),c!=null){const g=Fs(c*e.verticalPixelRatio/l,0,1);h.addColorStop(g,n),h.addColorStop(g,s)}h.addColorStop(1,o),this.Cs=h,this.gs=t}return this.Cs}}class Rp extends dl{constructor(){super(...arguments),this.Ts=new Us}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function Gp(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class fl 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 h=this.Vs.bind(this);n!==void 0&&cl(e,t,n,A,r,h,Gp),l&&(function(g,C,x,b,v){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:M}=g;let N=null;const R=Math.max(1,Math.floor(U))%2/2,L=x*F+R;for(let z=b.to-1;z>=b.from;--z){const q=C[z];if(q){const $=v(g,q);$!==N&&(M.beginPath(),N!==null&&M.fill(),M.fillStyle=$,N=$);const V=Math.round(q.nt*U)+R,j=q.st*F;M.moveTo(V,j),M.arc(V,j,L,0,2*Math.PI)}}M.fill()})(e,t,l,A,h)}}class gl extends fl{Vs(e,t){return t.lt}}function ml(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=ml.bind(null,!0),wl=ml.bind(null,!1);function $p(i,e){return i.ot<e}function Xp(i,e){return e<i.ot}function Bl(i,e,t){const A=e.Os(),r=e.ui(),n=Ri(i,A,$p),s=wl(i,r,Xp);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 Ss{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 Vr extends Ss{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 Zp extends Vr{constructor(e,t){super(e,t),this.js=new xs,this.re=new Rp,this.he=new gl,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 Jp 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),h=c-l,g=this.oe,C=h+g-1,x=Math.min(o.de,o.fe),b=Math.max(o.de,o.fe),v=Math.round(x*A)-l,U=Math.round(b*A)+l,F=Math.max(U-v,this.oe);e.fillRect(h,v,g,F);const M=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-M;let q=Math.max(v,Math.round(o.pe*A)-l),$=q+g-1;$>v+F-1&&($=v+F-1,q=$-g+1),e.fillRect(z,q,h-z,$-q+1)}const N=c+M;let R=Math.max(v,Math.round(o.me*A)-l),L=R+g-1;L>v+F-1&&(L=v+F-1,R=L-g+1),e.fillRect(C+1,R,N-C,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 yl extends Ss{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 Yp extends yl{constructor(){super(...arguments),this.js=new Jp}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 qp extends dl{constructor(){super(...arguments),this.Ts=new Us}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 jp extends fl{constructor(){super(...arguments),this.Pe=new Us}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 ef extends Vr{constructor(e,t){super(e,t),this.js=new xs,this.Ve=new qp,this.Oe=new jp,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 tf 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),h=Math.min(l,c);return Math.max(Math.floor(s),h)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const 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 h=null;for(let g=A.from;g<A.to;g++){const C=t[g];C.Ee!==o&&(r.fillStyle=C.Ee,o=C.Ee);const x=Math.round(Math.min(C.pe,C.me)*s),b=Math.round(Math.max(C.pe,C.me)*s),v=Math.round(C.de*s),U=Math.round(C.fe*s);let F=Math.round(n*C.nt)-c;const M=F+l-1;h!==null&&(F=Math.max(h+1,F),F=Math.min(F,M));const N=M-F+1;r.fillRect(F,v,N,x-v),r.fillRect(F,b+1,N,U-b),h=M}}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 h=A.from;h<A.to;h++){const g=t[h];g.Ne!==o&&(r.fillStyle=g.Ne,o=g.Ne);let C=Math.round(g.nt*n)-Math.floor(.5*this.ae);const x=C+this.ae-1,b=Math.round(Math.min(g.pe,g.me)*s),v=Math.round(Math.max(g.pe,g.me)*s);if(c!==null&&(C=Math.max(c+1,C),C=Math.min(C,x)),this.zt.le*n>2*l)Pp(r,C,b,x-C+1,v-b+1,l);else{const U=x-C+1;r.fillRect(C,b,U,v-b+1)}c=x}}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 h=t[c];let g=Math.round(Math.min(h.pe,h.me)*s),C=Math.round(Math.max(h.pe,h.me)*s),x=Math.round(h.nt*n)-Math.floor(.5*this.ae),b=x+this.ae-1;if(h.ce!==o){const v=h.ce;r.fillStyle=v,o=v}this.zt._i&&(x+=l,g+=l,b-=l,C-=l),g>C||r.fillRect(x,g,b-x+1,C-g+1)}}}class Af extends yl{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(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class rf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Es extends Ss{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new rf(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(nf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function nf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class sf 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],h=Math.round(l.st*A);let g,C;e.fillStyle=l.ce,h<=n?(g=h,C=s):(g=n,C=h-Math.floor(r/2)+r),e.fillRect(c.Os,g,c.ui-c.Os+1,C-g)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,c;if(A%2){const h=(A-1)/2;l=o-h,c=o+h}else{const h=A/2;l=o-h,c=o+h-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class of extends Vr{constructor(){super(...arguments),this.js=new sf}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 af extends Vr{constructor(){super(...arguments),this.js=new gl}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 lf=/[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||lf,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 cf{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 Cl{constructor(e,t,A){this.ur=e,this.ar=new Gi(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new cf(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 hf 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),qa(e,n,0,t.width))}}class Ls{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new hf,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 uf extends Ls{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 df 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 pf=[{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 vl(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 Tl(i,e){const t=i%2600/2600;let A;for(const l of pf)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:vl(e,r,A.Ir,A.zr),Dr:vl(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class ff{constructor(e){this.Wt=new df,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=Tl(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=Tl(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 pl(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 xl(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})($i(i,1))}function bl(i){return Math.max($i(i,.1),3)}function Ql(i,e,t){return e?i:t?Math.ceil(i/2):0}function Fl(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 Ul(i,e,t,A){const r=(Xi("arrowUp",A)-1)/2*t.Jr,n=(pl(A/2)-1)/2*t.Jr;e.beginPath(),i?(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st-r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+r),e.lineTo(t.nt-n,t.st+r),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st+r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-r),e.lineTo(t.nt-n,t.st-r),e.lineTo(t.nt-n,t.st)),e.fill()}function gf(i,e,t,A,r,n){return Fl(e,t,A,r,n)}class mf 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(Bf(r,e,t))return{Mr:r.th,gr:r.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A},r,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),wf(o,e,t,A)}}}}function wf(i,e,t,A){e.fillStyle=i.V,i.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,i.Kt.ih,i.Kt.nt,i.Kt.st,t,A),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void Ul(!1,n,s,r.Ks);case"arrowUp":return void Ul(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const h=(Xi("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,h*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const h=Xi("square",c),g=(h-1)*l.Jr/2,C=l.nt-g,x=l.st-g;o.fillRect(C,x,h*l.Jr,h*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 Bf(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 gf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,h){const g=2+Xi("circle",l)/2,C=s-c,x=o-h;return Math.sqrt(C*C+x*x)<=g})(A.nt,A.st,A.Ks,r,n);case"square":return Fl(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function yf(i,e,t,A,r,n,s,o,l){const c=yA(t)?t:t.Se,h=yA(t)?t:t.Me,g=yA(t)?t:t.xe,C=yA(e.size)?Math.max(e.size,0):1,x=xl(o.le())*C,b=x/2;switch(i.Ks=x,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r));case"aboveBar":return i.st=s.Rt(h,l)-b-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-b-.6*r,A.sh+=1.2*r),void(A.sh+=x+n);case"belowBar":return i.st=s.Rt(g,l)+b+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r,A.eh+=1.2*r),void(A.eh+=x+n)}e.position}class Cf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new mf,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=bl(e),A=1.5*xl(e)+2*t,r=this.fh();this.ah={above:Ql(A,r.aboveBar,r.inBar),below:Ql(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((h=>({ot:h.time,nt:0,st:0,Ks:0,nh:h.shape,V:h.color,th:h.th,gr:h.id,Kt:void 0}))),this.rh=!1);const r=this.$i.W().layout;this.zt.tt=null;const n=t.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=bl(t.le()),c={sh:l,eh:l};this.zt.tt=Bl(this.zt.it,n,!0);for(let h=this.zt.tt.from;h<this.zt.tt.to;h++){const g=A[h];g.time!==o&&(c.sh=l,c.eh=l,o=g.time);const C=this.zt.it[h];C.nt=t.It(g.time),g.text!==void 0&&g.text.length>0&&(C.Kt={ih:g.text,nt:0,st:0,Hi:0,At:0});const x=this.jr.ph(g.time);x!==null&&yf(C,g,x,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class vf extends Ls{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 Tf 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 h=r.mh(c.V),g=Dr(h);A.t=g.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=h,e.V=g.i,t.V=g.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function Sl(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(Sl(Math.min,this.Ph(),e.Ph(),-1/0),Sl(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 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($t.Ah(e.priceRange),e.margins)}}class xf extends Ls{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 bf 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=Dr(r.axisLabelColor||r.color);A.t=c.t;const h=r.axisLabelTextColor||c.i;e.V=h,t.V=h,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Qf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new xf(e,this),this.ur=new bf(e,this),this.Hh=new Cl(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 Ff extends bs{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Uf={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,h=e.borderDownColor,g=e.wickUpColor,C=e.wickDownColor,x=Le(i(t,A)),b=wi(x.Vt[0])<=wi(x.Vt[3]);return{ce:(r=x.V)!==null&&r!==void 0?r:b?o:l,Ne:(n=x.Ot)!==null&&n!==void 0?n:b?c:h,Ee:(s=x.Xh)!==null&&s!==void 0?s:b?g:C}},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 h=Le(i(t,A));return{ce:h.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=h.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=h.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=h.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=h.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=h.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=h.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(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 Sf{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Uf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var El;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(El||(El={}));const NA=30;class Ef{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=Wr(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 wl(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,h=Math.max(c,Math.floor(l/NA)*NA);{const C=this.fl(o),x=this.vl(Math.min(l,c,t));r=Wr(r,this.pl(C,x,A))}let g=this.il.get(A);g===void 0&&(g=new Map,this.il.set(A,g));for(let C=Math.max(c+1,o);C<h;C+=NA){const x=Math.floor(C/NA);let b=g.get(x);if(b===void 0){const v=this.fl(x*NA),U=this.vl((x+1)*NA-1);b=this.pl(v,U,A),g.set(x,b)}r=Wr(r,b)}{const C=this.fl(h),x=this.vl(l);r=Wr(r,this.pl(C,x,A))}return r}}function Wr(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class Lf{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 Ms{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 Lf(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 Ll(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 Mf{constructor(e,t){this.Wt=new sl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Ll(this.kl))),this.Wt}}class Hf extends kr{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Ll(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 If{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 Ms(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 Mf(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 Hf(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 Ms(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 Ms(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 Hs(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function Is(i){return i.Pn()}function Df(i){return i.Bl()}function _f(i){return i.Al()}class Ds extends Ff{constructor(e,t,A,r,n){super(e),this.zt=new Ef,this.jh=new vf(this),this.zl=[],this.Ll=new uf(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 Tf(this);this.rn=[s],this.Hh=new Cl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new ff(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},A=this.Dt();if(this.$t().St().Ni()||A.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const g=this.zt.sl();if(g===null)return t;s=g,o=g.ee}else{const g=this.zt.ll(r.ui(),-1);if(g===null||(s=this.zt.Gh(g.ee),s===null))return t;o=g.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),h=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:h,ee:o}}Us(){return this.Nl!==null||(this.Nl=new Sf(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 Qf(this,e);return this.zl.push(t),this.$t().Gl(this),t}ra(e){const t=this.zl.indexOf(e);t!==-1&&this.zl.splice(t,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const e=this.ha();return e===null?null:{Vt:e.Vt[3],la:e.ot}}ha(){const e=this.$t().St().Xs();if(e===null)return null;const t=e.Os();return this.zt.ll(t,1)}In(){return this.zt}ph(e){const t=this.zt.Gh(e);return t===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3]}:t.Vt[3]}aa(e){const t=[];Hs(this.Hl,Is,"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),Hs(this.Hl,Is,"normal",e),e}ua(){return this.ca(Is,"bottom")}da(e){return this.ca(Df,e)}fa(e){return this.ca(_f,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 If(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Es)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Es)return e=>this.wn.je(e)}_a(){return!Nr(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 x=new $t(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(x):x}var c,h,g,C;l?.margins&&(c=s,h=l.margins,s={above:Math.max((g=c?.above)!==null&&g!==void 0?g:0,h.above),below:Math.max((C=c?.below)!==null&&C!==void 0?C:0,h.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 Vp(this.cn.priceFormat.precision);break;case"percent":this.wa=new ll(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new Or(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 Cf(this,this.$t()),this.$l){case"Bar":this.wn=new Yp(this,this.$t());break;case"Candlestick":this.wn=new Af(this,this.$t());break;case"Line":this.wn=new af(this,this.$t());break;case"Custom":this.wn=new Es(this,this.$t(),Vt(e));break;case"Area":this.wn=new Zp(this,this.$t());break;case"Baseline":this.wn=new ef(this,this.$t());break;case"Histogram":this.wn=new of(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return Hs(this.Hl,e,t,A),A}}class Pf{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((h=>h instanceof Ds)).reduce(((h,g)=>{if(A.vr(g)||!g.yt())return h;const C=g.Dt(),x=g.In();if(C.Ni()||!x.Kr(t))return h;const b=x.Gh(t);if(b===null)return h;const v=wi(g.Ct());return h.concat([C.Rt(b.Vt[3],v.Vt)])}),[]);if(l.length===0)return r;l.sort(((h,g)=>Math.abs(h-o)-Math.abs(g-o)));const c=l[0];return r=n.pn(c,s),r}}class kf 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 Nf{constructor(e){this.Wt=new kf,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 Of{constructor(e){this.wn=new Nf(e)}qh(){return this.wn}}const _s={$a:4,Ua:1e-4};function yi(i,e){const t=100*(i-e)/e;return e<0?-t:t}function Kf(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 Vf(i,e){const t=Zi(i.Ph(),e),A=Zi(i.Rh(),e);return new $t(t,A)}function Rr(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=Rr(i.Ph(),e),A=Rr(i.Rh(),e);return new $t(t,A)}function Gr(i,e){if(i===null)return null;const t=Ji(i.Ph(),e),A=Ji(i.Rh(),e);return new $t(t,A)}function Ps(i){if(i===null)return _s;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return _s;const t=Math.ceil(Math.abs(Math.log10(e))),A=_s.$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 g=Kr(n,r,1e-14)&&n>r+1e-14,C=Kr(n,A*o,1e-14),x=Kr(n,1,1e-14);if(!(g&&C&&x))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,h=1e-14,Math.abs(l-c)<h))for(s=0,o=this.Za[0];Kr(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,h;return n}}class Ml{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 h=c[0];for(let g=1;g<c.length;++g)c[g]<h&&(h=c[g]);return h})(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),h=Math.min(r,n);if(c===h)return void(this.Ka=[]);let g=this.Xa(c,h),C=c%g;C+=C<0?g:0;const x=c>=h?1:-1;let b=null,v=0;for(let U=c-C;U>h;U-=g){const F=this.Ja(U,t,!0);b!==null&&Math.abs(F-b)<this.Qa()||F<o||F>l||(v<this.Ka.length?(this.Ka[v].Ea=F,this.Ka[v].so=e.eo(U)):this.Ka.push({Ea:F,so:e.eo(U)}),v++,b=F,e.ro()&&(g=this.Xa(U*x,h)))}this.Ka.length=v}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Hl(i){return i.slice().sort(((e,t)=>Le(e.Xi())-Le(t.Xi())))}var Il;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(Il||(Il={}));const Dl=new ll,_l=new Or(100,1);class zf{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 Bt,this.vo=new Bt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=_l,this.xo=Ps(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Ml(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=Gr(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(),h=l/(o-s),g=A===void 0?0:A.from,C=A===void 0?e.length:A.to,x=this.Ho();for(let b=g;b<C;b++){const v=e[b],U=v._t;if(isNaN(U))continue;let F=U;x!==null&&(F=x(v._t,t));const M=r+h*(F-s),N=c?M:this.ho-1-M;v.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(),h=l/(o-s),g=A===void 0?0:A.from,C=A===void 0?e.length:A.to,x=this.Ho();for(let b=g;b<C;b++){const v=e[b];let U=v.ge,F=v.Me,M=v.xe,N=v.Se;x!==null&&(U=x(v.ge,t),F=x(v.Me,t),M=x(v.xe,t),N=x(v.Se,t));let R=r+h*(U-s),L=c?R:this.ho-1-R;v.pe=L,R=r+h*(F-s),L=c?R:this.ho-1-R,v.de=L,R=r+h*(M-s),L=c?R:this.ho-1-R,v.fe=L,R=r+h*(N-s),L=c?R:this.ho-1-R,v.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=Hl(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,Dl)}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=_l,this.Mh()?(this.wa=Dl,t=100):this.Oo()?(this.wa=new Or(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Ml(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?Rr(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 h=l.Il(e.Os(),e.ui());let g=h&&h.Lh();if(g!==null){switch(this.cn.mode){case 1:g=Yi(g,this.xo);break;case 2:g=Kf(g,c.Vt);break;case 3:g=Vf(g,c.Vt)}if(t=t===null?g:t.ts(Le(g)),h!==null){const C=h.Eh();C!==null&&(r=Math.max(r,C.above),n=Math.max(n,C.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=Gr(t,this.xo)),t=new $t(t.Ph()-c,t.Rh()+c),this.ro()&&(t=Yi(t,this.xo))}if(this.ro()){const l=Gr(t,this.xo),c=Ps(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const h=this.ao!==null?Gr(this.ao,this.xo):null;this.xo=c,t=Yi(l,c),h!==null&&(this.ao=Yi(h,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new $t(-.5,.5)),this.xo=Ps(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?yi:this.Oo()?Zi:this.ro()?e=>Rr(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 Wf{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Bt,this.yl=e,this.$i=t,this.d_=new Of(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=Hl(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),!Nr(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 zf(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class Rf{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 Pl(i,e){return i===null||e===null?i===e:i.Ch(e)}class Gf{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,h=-1/0;for(let g=0;g<l;g++){const C=o[g],x=C.index;for(;s<n;){const b=r[s],v=b.index;if(!(v<x)){c=v;break}s++,t.push(b),h=v,c=1/0}if(c-x>=e&&x-h>=e)t.push(C),h=x;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 $f(i,e){return i.weight>e.weight?i:e}class Xf{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Gf,this.du=new Map,this.fu=Ci.ou(),this.vu=!0,this.pu=new Bt,this.mu=new Bt,this.bu=new Bt,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,h=this.$u(),g=this.cn.fixLeftEdge||h,C=this.cn.fixRightEdge||h;let x=0;for(const b of o){if(!(n<=b.index&&b.index<=s))continue;let v;x<this.Mu.length?(v=this.Mu[x],v.coord=this.It(b.index),v.label=this.Uu(b),v.weight=b.weight):(v={needAlignCoordinate:!1,coord:this.It(b.index),label:this.Uu(b),weight:b.weight},this.Mu.push(v)),this.Su>t/2&&!h?v.needAlignCoordinate=!1:v.needAlignCoordinate=g&&b.index<=l||C&&b.index>=c,x++}return this.Mu.length=x,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const 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=Fs(this.__-e,0,this.__),A=Fs(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 Rf((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,Pl(t.lu(),this.fu.lu())||this.pu.m(),Pl(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 Zf{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 Jf extends Zf{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 Yf{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Jf(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 qf extends bs{constructor(e,t){super(),this.cn=t,this.wn=new Yf(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var kl,Nl,Ol,Kl,Vl;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(kl||(kl={}));class jf{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Bt,this.Rc=new Bt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Ep(this),this.yl=new Xf(this,t.timeScale,this.cn.localization,A),this.vt=new Kp(this,t.crosshair),this.Bc=new Pf(t.crosshair),this.Ac=new qf(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 Wf(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(),h=c.Ct();h!==null&&(s=c.pn(t,h)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},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),h=e!==null&&e>s&&!c,g=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,C=l&&(A!==void 0||g)&&this.yl.W().shiftVisibleRangeOnNewBar;if(h&&!C){const x=e-s;this.yl.Jn(this.yl.Hu()-x)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((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,h,g]=Ki(n),[C,x,b,v]=Ki(s),U=[rA(l+o*(C-l)),rA(c+o*(x-c)),rA(h+o*(b-h)),el(g+o*(v-g))];return`rgba(${U[0]}, ${U[1]}, ${U[2]}, ${U[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new 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 Ds(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),Nr(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 Ns(i){return!yA(i)&&!zi(i)}function zl(i){return yA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(Nl||(Nl={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(Ol||(Ol={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(Kl||(Kl={})),(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"})(Vl||(Vl={}));const Wl=i=>i.getUTCFullYear();function e0(i,e,t){return e.replace(/yyyy/g,(A=>HA(Wl(A),4))(i)).replace(/yy/g,(A=>HA(Wl(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 Rl{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return e0(e,this.gd,this.Md)}}class t0{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 A0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class i0{constructor(e={}){const t=Object.assign(Object.assign({},A0),e);this.Td=new Rl(t.Sd,t.Cd),this.Pd=new t0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function $r(i){return 60*i*60*1e3}function Os(i){return 60*i*1e3}const Xr=[{Dd:(Gl=1,1e3*Gl),Vd:10},{Dd:Os(1),Vd:20},{Dd:Os(5),Vd:21},{Dd:Os(30),Vd:22},{Dd:$r(1),Vd:30},{Dd:$r(3),Vd:31},{Dd:$r(6),Vd:32},{Dd:$r(12),Vd:33}];var Gl;function $l(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=Xr.length-1;t>=0;--t)if(Math.floor(e.getTime()/Xr[t].Dd)!==Math.floor(i.getTime()/Xr[t].Dd))return Xr[t].Vd;return 0}function Ks(i){let e=i;if(zi(i)&&(e=Vs(i)),!Ns(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 Xl(i){if(!zl(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function Vs(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 Zl(i){zi(i.time)&&(i.time=Vs(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(Zl)})(e):Zl(e)}createConverterToInternalObj(e){return Le((function(t){return t.length===0?null:Ns(t[0].time)||zi(t[0].time)?Ks:Xl})(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)?Xl(t):Ns(t)?Ks(t):Ks(Vs(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new i0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Rl(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($f,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],h=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=$l(h,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=h}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=$l(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 Yl(){return!!vi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function zs(){return!!vi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Ws(i){return i+i%2}function Rs(i,e){return i.zd-e.zd}function Gs(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class r0{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=Gs(this.Ld,this.Ed,this.Ud),n=Rs(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=Gs(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const h=Rs(this.Ed,this.Nd);if(s.push(c),o.push(h),A+=h,this.Fd!==null){const g=Gs(this.Nd,this.Fd,this.Ud);if(Math.sign(g)===Math.sign(r)){const C=Rs(this.Nd,this.Fd);s.push(g),o.push(C),A+=C}}}}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,h){const g=Math.log(h);return Math.log(1*g/-c)/g})(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 n0{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 tl(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=fp(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 $s(i,e,t,A){i.gl&&i.gl(e,t,A)}function Zr(i,e,t,A){i.X(e,t,A)}function Xs(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function s0(i){vi&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Zs{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(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),Yl()&&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;Yl()&&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})}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}),s0(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=ql(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=ql(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=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 ql(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 Yr(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function o0(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 Ys(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 jl(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],h=i[l-1],g=h.At(A,!1),C=c.Vi(),x=h.Vi();if(e===1?C>x-g:C<x+g){const b=x-g*e;c.Oi(b);const v=b-e*g/2;if((e===1?v<0:v>t)&&o>0){const U=e===1?-1-v:v-t,F=Math.min(U,o);for(let M=r;M<i.length;M++)i[M].Oi(i[M].Vi()+e*F);o-=F}}else r=l,o=e===1?x-g-C:C-(x+g)}}class ec{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=Ys("normal",r),this.Zv=Ys("top",r),this.Xv=Ys("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 Zs(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 h=this.Fv.xi(A,n[c].Kt());h>e&&(e=h)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),h=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,h))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,h))-.11111111111111,s)))}var o;A.restore();const l=e||34;return Ws(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?Pr(e,0,0,A,r,s):rl(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)),h=Math.floor(.5*l),g=Math.round(r.T*o);s.beginPath();for(const C of t)s.rect(Math.floor(n*o),Math.round(C.Ea*l)-h,g,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-r.A):Math.round(n+r.T+r.A),c=t.map((h=>this.Fv.Mi(s,h.so)));for(let h=t.length;h--;){const g=t[h];s.fillText(g.so,l,g.Ea+c[h])}}))}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)}jl(r,1,this.Ev.height,t),jl(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 a0(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 qr(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 l0(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 c0(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 qs{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 Bt,this.Op=new Bt,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 Zs(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(qs.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 n0(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,h,g){var C,x;let b,v;for(const M of c){const N=(x=(C=M.va)===null||C===void 0?void 0:C.call(M,h,g))!==null&&x!==void 0?x:[];for(const R of N)U=R.zOrder,(!(F=b?.zOrder)||U==="top"&&F!=="top"||U==="normal"&&F==="bottom")&&(b=R,v=M)}var U,F;return b&&v?{zv:b,Hc:v}:null})(o,n,s);if(l?.zv.zOrder==="top")return Yr(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Yr(l);const h=o0(c.Pn(r),n,s);if(h!==null)return{Hc:c,Bv:h.Bv,Iv:h.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Yr(l)}return l?.zv?Yr(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,a0),this.vm(A),this.pm(A),this.fm(A,qr),this.fm(A,l0)))}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,c0))}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?Pr(e,0,0,A,r,o):rl(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,qr,$s,t),this.Mm(e,qr,Zr,t)}bm(e){this.Mm(e,qr,Zr,this.$i().Zc())}fm(e,t){const A=Le(this.Np).Uo();for(const r of A)this.Mm(e,t,$s,r);for(const r of A)this.Mm(e,t,Zr,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;Xs(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 ec(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new ec(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 r0(.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 tc{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}){Pr(e,0,0,t.width,t.height,this.Pm())}}function js(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 h0=js("normal"),u0=js("top"),d0=js("bottom");class p0{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 Bt,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 Zs(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,d0)})),this.wp(A),this.$m(A,h0)),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,u0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)Xs(t,(n=>$s(n,e,!1,void 0)),r,void 0);for(const r of A)Xs(t,(n=>Zr(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){Pr(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 h=Math.max(1,Math.floor(l)),g=Math.floor(.5*l);o.beginPath();const C=Math.round(n.T*c);for(let x=A.length;x--;){const b=Math.round(A[x].coord*l);o.rect(b-g,0,h,C)}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 h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}}))}Ym(e,t,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 tc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new tc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const f0=!!vi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!vi&&(!((eo=navigator?.userAgentData)===null||eo===void 0)&&eo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var eo;class g0{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 Bt,this.Op=new Bt,this.Rc=new Bt,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),to(this.cn)&&this.hb(!0),this.$i=new jf(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new p0(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=to(this.cn);this.$i.$h(e);const A=to(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 h=0;h<this.Xm.length;h++){const g=this.Xm[h],C=Le(o==="left"?g.wm():g.gm()),x=C.xp();e!==null&&C.Sp(e,l,c),c+=x.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 b of this.Xm)this.xb()&&(t=Math.max(t,Le(b.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Le(b.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=b.M_();t=Ws(t),A=Ws(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 h=0+l,g=n<h?0:n-h,C=g/e;let x=0;for(let b=0;b<this.Xm.length;++b){const v=this.Xm[b];v.qp(this.$i.qc()[b]);let U=0,F=0;F=b===this.Xm.length-1?g-x:Math.round(v.M_()*C),U=Math.max(F,2),x+=U,v.cp(pt({width:s,height:U})),this.xb()&&v._m(t,"left"),this.Sb()&&v._m(A,"right"),v.fp()&&this.$i.Kc(v.fp(),U)}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 f0?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 qs(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((h=>{const g=h.In().ll(e);g!==null&&n.set(h,g)}));let s;if(e!==null){const h=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;h!==void 0&&(s=h)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof Ds?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 to(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function m0(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 ic(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.color!==void 0&&(n.V=t.color),n}function w0(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.lineColor!==void 0&&(n.lt=t.lineColor),t.topColor!==void 0&&(n.Ps=t.topColor),t.bottomColor!==void 0&&(n.Rs=t.bottomColor),n}function B0(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 y0(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 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),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function v0(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],h=t,{time:g,color:C}=h;return{ee:e,ot:i,Vt:c,zb:A,$e:Ac(h,["time","color"]),V:C}}function jr(i){return i.Vt!==void 0}function rc(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)?rc({ot:e,ee:t,zb:r},A):rc(i(e,t,A,r,n),A)}function nc(i){return{Candlestick:ri(C0),Bar:ri(y0),Area:ri(w0),Baseline:ri(B0),Histogram:ri(ic),Line:ri(ic),Custom:ri(v0)}[i]}function sc(i){return{ee:0,Hb:new Map,la:i}}function oc(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 ac(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),Vt(e)}class T0{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((x=>x.time)),c=this.q_.createConverterToInternalObj(t),h=nc(e.Qh()),g=e.Ca(),C=e.Ta();s=t.map(((x,b)=>{const v=c(x.time),U=this.q_.key(v);let F=this.qb.get(U);F===void 0&&(F=sc(v),this.qb.set(U,F),r=!0);const M=h(v,F.ee,x,l[b],g,C);return F.Hb.set(e,M),M}))}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:ac(c.Hb)})})),l.sort(((c,h)=>this.q_.key(c.time)-this.q_.key(h.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,h){const g=oc(l,h),C=oc(c,h);if(g!==void 0&&C!==void 0)return{ta:g.Ub>=C.Ub&&g.$b>=C.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(v){v.zb===void 0&&(v.zb=v.time)})(A),this.q_.preprocessData(t);const r=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(r)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${r}`);let s=this.qb.get(this.q_.key(r));const o=s===void 0;s===void 0&&(s=sc(r),this.qb.set(this.q_.key(r),s));const l=nc(e.Qh()),c=e.Ca(),h=e.Ta(),g=l(r,s.ee,t,A.zb,c,h);s.Hb.set(e,g),this.nw(e,g);const C={ta:jr(g)};if(!o)return this.tw(e,-1,C);const x={timeWeight:0,time:s.la,pointData:s,originalTime:ac(s.Hb)},b=Ri(this.Xb,this.q_.key(x.time),((v,U)=>this.q_.key(v.time)<U));this.Xb.splice(b,0,x);for(let v=b;v<this.Xb.length;++v)Ao(this.Xb[v].pointData,v);return this.q_.fillWeightsForPoints(this.Xb,b),this.tw(e,b,C)}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)?jr(t)&&A.push(t):jr(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(jr)),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 io(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function lc(i){const e=io(i);return i.V!==void 0&&(e.color=i.V),e}function x0(i){const e=io(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 b0(i){const e=io(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 cc(i){const e={open:i.Vt[0],high:i.Vt[1],low:i.Vt[2],close:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function Q0(i){const e=cc(i);return i.V!==void 0&&(e.color=i.V),e}function F0(i){const e=cc(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 ro(i){return{Area:x0,Line:lc,Baseline:b0,Histogram:lc,Bar:Q0,Candlestick:F0,Custom:U0}[i]}function U0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const S0={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},E0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},L0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Ts,attributionLogo:!0},no={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},M0={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},H0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Ts,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function hc(){return{width:0,height:0,autoSize:!1,layout:L0,crosshair:S0,grid:E0,overlayPriceScales:Object.assign({},no),leftPriceScale:Object.assign(Object.assign({},no),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},no),{visible:!0}),timeScale:M0,watermark:H0,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 I0{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 Nr(this.ow)?this.aw.Mb(this.ow):0}Li(){return Le(this.aw.$t().Uc(this.ow)).Dt}}function uc(i,e,t){const A=Ac(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const D0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class _0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class P0{constructor(e,t,A,r,n){this.uw=new Bt,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:ro(this.seriesType())(A)}data(){const e=ro(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=>uc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>uc(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(D0),e),A=this.Es.ea(t);return new _0(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 k0{constructor(e,t,A){this.ww=new Bt,this.mu=new Bt,this.Om=new Bt,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 N0(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 dc(i){return(function(e){if(_r(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;_r(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),_r(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;_r(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class O0{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Bt,this.Cw=new Bt,this.Tw=new Bt,this.Pw=new T0(t);const r=A===void 0?MA(hc()):uA(MA(hc()),dc(A));this.q_=t,this.aw=new g0(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 k0(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({},Xa),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",vp,e)}addBaselineSeries(e){return this.Vw("Baseline",Tp,e)}addBarSeries(e){return this.Vw("Bar",yp,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",Bp,e)}addHistogramSeries(e){return this.Vw("Histogram",xp,e)}addLineSeries(e){return this.Vw("Line",Cp,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 I0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(dc(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){N0(A.priceFormat);const n=uA(MA(Za),MA(t),A),s=this.aw.$t().dd(e,n,r),o=new P0(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=ro(s)(r);if(s!=="Custom")kA(m0(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 K0(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 O0(A,e,t);return e.setOptions(r.options()),r}function V0(i,e){return K0(i,new Jl,Jl.Id(e))}Object.assign(Object.assign({},Za),Xa);function pc(i,e){return function(){return i.apply(e,arguments)}}const{toString:z0}=Object.prototype,{getPrototypeOf:so}=Object,{iterator:en,toStringTag:fc}=Symbol,tn=(i=>e=>{const t=z0.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),pA=i=>(i=i.toLowerCase(),e=>tn(e)===i),An=i=>e=>typeof e===i,{isArray:xi}=Array,bi=An("undefined");function ji(i){return i!==null&&!bi(i)&&i.constructor!==null&&!bi(i.constructor)&&Xt(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const gc=pA("ArrayBuffer");function W0(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&gc(i.buffer),e}const R0=An("string"),Xt=An("function"),mc=An("number"),er=i=>i!==null&&typeof i=="object",G0=i=>i===!0||i===!1,rn=i=>{if(tn(i)!=="object")return!1;const e=so(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(fc in i)&&!(en in i)},$0=i=>{if(!er(i)||ji(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},X0=pA("Date"),Z0=pA("File"),J0=pA("Blob"),Y0=pA("FileList"),q0=i=>er(i)&&Xt(i.pipe),j0=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Xt(i.append)&&((e=tn(i))==="formdata"||e==="object"&&Xt(i.toString)&&i.toString()==="[object FormData]"))},e1=pA("URLSearchParams"),[t1,A1,i1,r1]=["ReadableStream","Request","Response","Headers"].map(pA),n1=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 wc(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,Bc=i=>!bi(i)&&i!==ni;function oo(){const{caseless:i,skipUndefined:e}=Bc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&wc(t,n)||n;rn(t[s])&&rn(r)?t[s]=oo(t[s],r):rn(r)?t[s]=oo({},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 s1=(i,e,t,{allOwnKeys:A}={})=>(tr(e,(r,n)=>{t&&Xt(r)?Object.defineProperty(i,n,{value:pc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),o1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),a1=(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)},l1=(i,e,t,A)=>{let r,n,s;const o={};if(e=e||{},i==null)return e;do{for(r=Object.getOwnPropertyNames(i),n=r.length;n-- >0;)s=r[n],(!A||A(s,i,e))&&!o[s]&&(e[s]=i[s],o[s]=!0);i=t!==!1&&so(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},c1=(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},h1=i=>{if(!i)return null;if(xi(i))return i;let e=i.length;if(!mc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},u1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&so(Uint8Array)),d1=(i,e)=>{const A=(i&&i[en]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},p1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},f1=pA("HTMLFormElement"),g1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),yc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),m1=pA("RegExp"),Cc=(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)},w1=i=>{Cc(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+"'")})}})},B1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return xi(i)?A(i):A(String(i).split(e)),t},y1=()=>{},C1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function v1(i){return!!(i&&Xt(i.append)&&i[fc]==="FormData"&&i[en])}const T1=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)},x1=pA("AsyncFunction"),b1=i=>i&&(er(i)||Xt(i))&&Xt(i.then)&&Xt(i.catch),vc=((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)),Q1=typeof queueMicrotask<"u"?queueMicrotask.bind(ni):typeof process<"u"&&process.nextTick||vc,pe={isArray:xi,isArrayBuffer:gc,isBuffer:ji,isFormData:j0,isArrayBufferView:W0,isString:R0,isNumber:mc,isBoolean:G0,isObject:er,isPlainObject:rn,isEmptyObject:$0,isReadableStream:t1,isRequest:A1,isResponse:i1,isHeaders:r1,isUndefined:bi,isDate:X0,isFile:Z0,isBlob:J0,isRegExp:m1,isFunction:Xt,isStream:q0,isURLSearchParams:e1,isTypedArray:u1,isFileList:Y0,forEach:tr,merge:oo,extend:s1,trim:n1,stripBOM:o1,inherits:a1,toFlatObject:l1,kindOf:tn,kindOfTest:pA,endsWith:c1,toArray:h1,forEachEntry:d1,matchAll:p1,isHTMLForm:f1,hasOwnProperty:yc,hasOwnProp:yc,reduceDescriptors:Cc,freezeMethods:w1,toObjectSet:B1,toCamelCase:g1,noop:y1,toFiniteNumber:C1,findKey:wc,global:ni,isContextDefined:Bc,isSpecCompliantForm:v1,toJSONObject:T1,isAsyncFn:x1,isThenable:b1,setImmediate:vc,asap:Q1,isIterable:i=>i!=null&&Xt(i[en])};let Xe=class Ap extends Error{static from(e,t,A,r,n,s){const o=new Ap(e.message,t||e.code,A,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),r&&(this.request=r),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:pe.toJSONObject(this.config),code:this.code,status:this.status}}};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 F1=null;function ao(i){return pe.isPlainObject(i)||pe.isArray(i)}function Tc(i){return pe.endsWith(i,"[]")?i.slice(0,-2):i}function xc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Tc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function U1(i){return pe.isArray(i)&&!i.some(ao)}const S1=pe.toFlatObject(pe,{},null,function(e){return/^is[A-Z]/.test(e)});function nn(i,e,t){if(!pe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=pe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,U){return!pe.isUndefined(U[v])});const A=t.metaTokens,r=t.visitor||h,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&pe.isSpecCompliantForm(e);if(!pe.isFunction(r))throw new TypeError("visitor must be a function");function c(b){if(b===null)return"";if(pe.isDate(b))return b.toISOString();if(pe.isBoolean(b))return b.toString();if(!l&&pe.isBlob(b))throw new Xe("Blob is not supported. Use a Buffer instead.");return pe.isArrayBuffer(b)||pe.isTypedArray(b)?l&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function h(b,v,U){let F=b;if(b&&!U&&typeof b=="object"){if(pe.endsWith(v,"{}"))v=A?v:v.slice(0,-2),b=JSON.stringify(b);else if(pe.isArray(b)&&U1(b)||(pe.isFileList(b)||pe.endsWith(v,"[]"))&&(F=pe.toArray(b)))return v=Tc(v),F.forEach(function(N,R){!(pe.isUndefined(N)||N===null)&&e.append(s===!0?xc([v],R,n):s===null?v:v+"[]",c(N))}),!1}return ao(b)?!0:(e.append(xc(U,v,n),c(b)),!1)}const g=[],C=Object.assign(S1,{defaultVisitor:h,convertValue:c,isVisitable:ao});function x(b,v){if(!pe.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+v.join("."));g.push(b),pe.forEach(b,function(F,M){(!(pe.isUndefined(F)||F===null)&&r.call(e,F,pe.isString(M)?M.trim():M,v,C))===!0&&x(F,v?v.concat(M):[M])}),g.pop()}}if(!pe.isObject(i))throw new TypeError("data must be an object");return x(i),e}function bc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function lo(i,e){this._pairs=[],i&&nn(i,this,e)}const Qc=lo.prototype;Qc.append=function(e,t){this._pairs.push([e,t])},Qc.toString=function(e){const t=e?function(A){return e.call(this,A,bc)}:bc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function E1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Fc(i,e,t){if(!e)return i;const A=t&&t.encode||E1,r=pe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=pe.isURLSearchParams(e)?e.toString():new lo(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Uc{constructor(){this.handlers=[]}use(e,t,A){return this.handlers.push({fulfilled:e,rejected:t,synchronous:A?A.synchronous:!1,runWhen:A?A.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){pe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const co={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},L1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:lo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ho=typeof window<"u"&&typeof document<"u",uo=typeof navigator=="object"&&navigator||void 0,M1=ho&&(!uo||["ReactNative","NativeScript","NS"].indexOf(uo.product)<0),H1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",I1=ho&&window.location.href||"http://localhost",kt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ho,hasStandardBrowserEnv:M1,hasStandardBrowserWebWorkerEnv:H1,navigator:uo,origin:I1},Symbol.toStringTag,{value:"Module"})),...L1};function D1(i,e){return nn(i,new kt.classes.URLSearchParams,{visitor:function(t,A,r,n){return kt.isNode&&pe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function _1(i){return pe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function P1(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 Sc(i){function e(t,A,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&pe.isArray(r)?r.length:s,l?(pe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!pe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&pe.isArray(r[s])&&(r[s]=P1(r[s])),!o)}if(pe.isFormData(i)&&pe.isFunction(i.entries)){const t={};return pe.forEachEntry(i,(A,r)=>{e(_1(A),r,t,0)}),t}return null}function k1(i,e,t){if(pe.isString(i))try{return(e||JSON.parse)(i),pe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const Ar={transitional:co,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=pe.isObject(e);if(n&&pe.isHTMLForm(e)&&(e=new FormData(e)),pe.isFormData(e))return r?JSON.stringify(Sc(e)):e;if(pe.isArrayBuffer(e)||pe.isBuffer(e)||pe.isStream(e)||pe.isFile(e)||pe.isBlob(e)||pe.isReadableStream(e))return e;if(pe.isArrayBufferView(e))return e.buffer;if(pe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(A.indexOf("application/x-www-form-urlencoded")>-1)return D1(e,this.formSerializer).toString();if((o=pe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return nn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),k1(e)):e}],transformResponse:[function(e){const t=this.transitional||Ar.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(pe.isResponse(e)||pe.isReadableStream(e))return e;if(e&&pe.isString(e)&&(A&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?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}}};pe.forEach(["delete","get","head","post","put","patch"],i=>{Ar.headers[i]={}});const N1=pe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),O1=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]&&N1[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},Ec=Symbol("internals");function ir(i){return i&&String(i).trim().toLowerCase()}function sn(i){return i===!1||i==null?i:pe.isArray(i)?i.map(sn):String(i)}function K1(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 V1=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function po(i,e,t,A,r){if(pe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!pe.isString(e)){if(pe.isString(A))return e.indexOf(A)!==-1;if(pe.isRegExp(A))return A.test(e)}}function z1(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function W1(i,e){const t=pe.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(i,A+t,{value:function(r,n,s){return this[A].call(this,e,r,n,s)},configurable:!0})})}let Zt=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const h=ir(l);if(!h)throw new Error("header name must be a non-empty string");const g=pe.findKey(r,h);(!g||r[g]===void 0||c===!0||c===void 0&&r[g]!==!1)&&(r[g||l]=sn(o))}const s=(o,l)=>pe.forEach(o,(c,h)=>n(c,h,l));if(pe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(pe.isString(e)&&(e=e.trim())&&!V1(e))s(O1(e),t);else if(pe.isObject(e)&&pe.isIterable(e)){let o={},l,c;for(const h of e){if(!pe.isArray(h))throw TypeError("Object iterator must return a key-value pair");o[c=h[0]]=(l=o[c])?pe.isArray(l)?[...l,h[1]]:[l,h[1]]:h[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=ir(e),e){const A=pe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return K1(r);if(pe.isFunction(t))return t.call(this,r,A);if(pe.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ir(e),e){const A=pe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||po(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=ir(s),s){const o=pe.findKey(A,s);o&&(!t||po(A,A[o],o,t))&&(delete A[o],r=!0)}}return pe.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let A=t.length,r=!1;for(;A--;){const n=t[A];(!e||po(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,A={};return pe.forEach(this,(r,n)=>{const s=pe.findKey(A,n);if(s){t[s]=sn(r),delete t[n];return}const o=e?z1(n):String(n).trim();o!==n&&delete t[n],t[o]=sn(r),A[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return pe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&pe.isArray(A)?A.join(", "):A)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[Ec]=this[Ec]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=ir(s);A[o]||(W1(r,s),A[o]=!0)}return pe.isArray(e)?e.forEach(n):n(e),this}};Zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),pe.reduceDescriptors(Zt.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),pe.freezeMethods(Zt);function fo(i,e){const t=this||Ar,A=e||t,r=Zt.from(A.headers);let n=A.data;return pe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function Lc(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 Mc(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 R1(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function G1(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(),h=A[n];s||(s=c),t[r]=l,A[r]=c;let g=n,C=0;for(;g!==r;)C+=t[g++],g=g%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const x=h&&c-h;return x?Math.round(C*1e3/x):void 0}}function $1(i,e){let t=0,A=1e3/e,r,n;const s=(c,h=Date.now())=>{t=h,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const h=Date.now(),g=h-t;g>=A?s(c,h):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-g)))},()=>r&&s(r)]}const on=(i,e,t=3)=>{let A=0;const r=G1(50,250);return $1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),h=s<=o;A=s;const g={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(g)},t)},Hc=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},Ic=i=>(...e)=>pe.asap(()=>i(...e)),X1=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,Z1=kt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];pe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),pe.isString(A)&&o.push(`path=${A}`),pe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),pe.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function J1(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function Y1(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function Dc(i,e,t){let A=!J1(e);return i&&(A||t==!1)?Y1(i,e):e}const _c=i=>i instanceof Zt?{...i}:i;function si(i,e){e=e||{};const t={};function A(c,h,g,C){return pe.isPlainObject(c)&&pe.isPlainObject(h)?pe.merge.call({caseless:C},c,h):pe.isPlainObject(h)?pe.merge({},h):pe.isArray(h)?h.slice():h}function r(c,h,g,C){if(pe.isUndefined(h)){if(!pe.isUndefined(c))return A(void 0,c,g,C)}else return A(c,h,g,C)}function n(c,h){if(!pe.isUndefined(h))return A(void 0,h)}function s(c,h){if(pe.isUndefined(h)){if(!pe.isUndefined(c))return A(void 0,c)}else return A(void 0,h)}function o(c,h,g){if(g in e)return A(c,h);if(g in i)return A(void 0,c)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,h,g)=>r(_c(c),_c(h),g,!0)};return pe.forEach(Object.keys({...i,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const g=pe.hasOwnProp(l,h)?l[h]:r,C=g(i[h],e[h],h);pe.isUndefined(C)&&g!==o||(t[h]=C)}),t}const Pc=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=Fc(Dc(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),pe.isFormData(t)){if(kt.hasStandardBrowserEnv||kt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(pe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([h,g])=>{c.includes(h.toLowerCase())&&s.set(h,g)})}}if(kt.hasStandardBrowserEnv&&(A&&pe.isFunction(A)&&(A=A(e)),A||A!==!1&&X1(e.url))){const l=r&&n&&Z1.read(n);l&&s.set(r,l)}return e},q1=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=Pc(i);let n=r.data;const s=Zt.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,h,g,C,x,b;function v(){x&&x(),b&&b(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function F(){if(!U)return;const N=Zt.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),L={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:N,config:i,request:U};Mc(function(q){t(q),v()},function(q){A(q),v()},L),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 L=R&&R.message?R.message:"Network Error",z=new Xe(L,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 L=r.transitional||co;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Xe(R,L.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&pe.forEach(s.toJSON(),function(R,L){U.setRequestHeader(L,R)}),pe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([C,b]=on(c,!0),U.addEventListener("progress",C)),l&&U.upload&&([g,x]=on(l),U.upload.addEventListener("progress",g),U.upload.addEventListener("loadend",x)),(r.cancelToken||r.signal)&&(h=N=>{U&&(A(!N||N.type?new rr(null,i,U):N),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const M=R1(r.url);if(M&&kt.protocols.indexOf(M)===-1){A(new Xe("Unsupported protocol "+M+":",Xe.ERR_BAD_REQUEST,i));return}U.send(n||null)})},j1=(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 h=c instanceof Error?c:this.reason;A.abort(h instanceof Xe?h:new rr(h instanceof Error?h.message:h))}};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=()=>pe.asap(o),l}},eg=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},tg=async function*(i,e){for await(const t of Ag(i))yield*eg(t,e)},Ag=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=tg(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:h}=await r.next();if(c){o(),l.close();return}let g=h.byteLength;if(t){let C=n+=g;t(C)}l.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},Nc=64*1024,{isFunction:an}=pe,ig=(({Request:i,Response:e})=>({Request:i,Response:e}))(pe.global),{ReadableStream:Oc,TextEncoder:Kc}=pe.global,Vc=(i,...e)=>{try{return!!i(...e)}catch{return!1}},rg=i=>{i=pe.merge.call({skipUndefined:!0},ig,i);const{fetch:e,Request:t,Response:A}=i,r=e?an(e):typeof fetch=="function",n=an(t),s=an(A);if(!r)return!1;const o=r&&an(Oc),l=r&&(typeof Kc=="function"?(b=>v=>b.encode(v))(new Kc):async b=>new Uint8Array(await new t(b).arrayBuffer())),c=n&&o&&Vc(()=>{let b=!1;const v=new t(kt.origin,{body:new Oc,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!v}),h=s&&o&&Vc(()=>pe.isReadableStream(new A("").body)),g={stream:h&&(b=>b.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(v,U)=>{let F=v&&v[b];if(F)return F.call(v);throw new Xe(`Response type '${b}' is not supported`,Xe.ERR_NOT_SUPPORT,U)})});const C=async b=>{if(b==null)return 0;if(pe.isBlob(b))return b.size;if(pe.isSpecCompliantForm(b))return(await new t(kt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(pe.isArrayBufferView(b)||pe.isArrayBuffer(b))return b.byteLength;if(pe.isURLSearchParams(b)&&(b=b+""),pe.isString(b))return(await l(b)).byteLength},x=async(b,v)=>{const U=pe.toFiniteNumber(b.getContentLength());return U??C(v)};return async b=>{let{url:v,method:U,data:F,signal:M,cancelToken:N,timeout:R,onDownloadProgress:L,onUploadProgress:z,responseType:q,headers:$,withCredentials:V="same-origin",fetchOptions:j}=Pc(b),te=e||fetch;q=q?(q+"").toLowerCase():"text";let ce=j1([M,N&&N.toAbortSignal()],R),X=null;const ee=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let se;try{if(z&&c&&U!=="get"&&U!=="head"&&(se=await x($,F))!==0){let xe=new t(v,{method:"POST",body:F,duplex:"half"}),Ue;if(pe.isFormData(F)&&(Ue=xe.headers.get("content-type"))&&$.setContentType(Ue),xe.body){const[ye,ve]=Hc(se,on(Ic(z)));F=kc(xe.body,Nc,ye,ve)}}pe.isString(V)||(V=V?"include":"omit");const le=n&&"credentials"in t.prototype,ne={...j,signal:ce,method:U.toUpperCase(),headers:$.normalize().toJSON(),body:F,duplex:"half",credentials:le?V:void 0};X=n&&new t(v,ne);let he=await(n?te(X,j):te(v,ne));const de=h&&(q==="stream"||q==="response");if(h&&(L||de&&ee)){const xe={};["status","statusText","headers"].forEach(be=>{xe[be]=he[be]});const Ue=pe.toFiniteNumber(he.headers.get("content-length")),[ye,ve]=L&&Hc(Ue,on(Ic(L),!0))||[];he=new A(kc(he.body,Nc,ye,()=>{ve&&ve(),ee&&ee()}),xe)}q=q||"text";let we=await g[pe.findKey(g,q)||"text"](he,b);return!de&&ee&&ee(),await new Promise((xe,Ue)=>{Mc(xe,Ue,{data:we,headers:Zt.from(he.headers),status:he.status,statusText:he.statusText,config:b,request:X})})}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,b,X,le&&le.response),{cause:le.cause||le}):Xe.from(le,le&&le.code,b,X,le&&le.response)}}},ng=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,h=ng;for(;o--;)l=n[o],c=h.get(l),c===void 0&&h.set(l,c=o?new Map:rg(e)),h=c;return c};zc();const go={http:F1,xhr:q1,fetch:{get:zc}};pe.forEach(go,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const Wc=i=>`- ${i}`,sg=i=>pe.isFunction(i)||i===null||i===!1;function og(i,e){i=pe.isArray(i)?i:[i];const{length:t}=i;let A,r;const n={};for(let s=0;s<t;s++){A=i[s];let o;if(r=A,!sg(A)&&(r=go[(o=String(A)).toLowerCase()],r===void 0))throw new Xe(`Unknown adapter '${o}'`);if(r&&(pe.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
4
- `+s.map(Wc).join(`
5
- `):" "+Wc(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 Rc={getAdapter:og,adapters:go};function mo(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new rr(null,i)}function Gc(i){return mo(i),i.headers=Zt.from(i.headers),i.data=fo.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),Rc.getAdapter(i.adapter||Ar.adapter,i)(i).then(function(A){return mo(i),A.data=fo.call(i,i.transformResponse,A),A.headers=Zt.from(A.headers),A},function(A){return Lc(A)||(mo(i),A&&A.response&&(A.response.data=fo.call(i,i.transformResponse,A.response),A.response.headers=Zt.from(A.response.headers))),Promise.reject(A)})}const $c="1.13.5",ln={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{ln[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const Xc={};ln.transitional=function(e,t,A){function r(n,s){return"[Axios v"+$c+"] 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&&!Xc[s]&&(Xc[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}},ln.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function ag(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 cn={assertOptions:ag,validators:ln},nA=cn.validators;let oi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Uc,response:new Uc}}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&&cn.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&&(pe.isFunction(r)?t.paramsSerializer={serialize:r}:cn.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),cn.assertOptions(t,{baseUrl:nA.spelling("baseURL"),withXsrfToken:nA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&pe.merge(n.common,n[t.method]);n&&pe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete n[b]}),t.headers=Zt.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(v){if(typeof v.runWhen=="function"&&v.runWhen(t)===!1)return;l=l&&v.synchronous;const U=t.transitional||co;U&&U.legacyInterceptorReqResOrdering?o.unshift(v.fulfilled,v.rejected):o.push(v.fulfilled,v.rejected)});const c=[];this.interceptors.response.forEach(function(v){c.push(v.fulfilled,v.rejected)});let h,g=0,C;if(!l){const b=[Gc.bind(this),void 0];for(b.unshift(...o),b.push(...c),C=b.length,h=Promise.resolve(t);g<C;)h=h.then(b[g++],b[g++]);return h}C=o.length;let x=t;for(;g<C;){const b=o[g++],v=o[g++];try{x=b(x)}catch(U){v.call(this,U);break}}try{h=Gc.call(this,x)}catch(b){return Promise.reject(b)}for(g=0,C=c.length;g<C;)h=h.then(c[g++],c[g++]);return h}getUri(e){e=si(this.defaults,e);const t=Dc(e.baseURL,e.url,e.allowAbsoluteUrls);return Fc(t,e.params,e.paramsSerializer)}};pe.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}))}}),pe.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 lg=class ip{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 ip(function(r){e=r}),cancel:e}}};function cg(i){return function(t){return i.apply(null,t)}}function hg(i){return pe.isObject(i)&&i.isAxiosError===!0}const wo={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(wo).forEach(([i,e])=>{wo[e]=i});function Zc(i){const e=new oi(i),t=pc(oi.prototype.request,e);return pe.extend(t,oi.prototype,e,{allOwnKeys:!0}),pe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Zc(si(i,r))},t}const ht=Zc(Ar);ht.Axios=oi,ht.CanceledError=rr,ht.CancelToken=lg,ht.isCancel=Lc,ht.VERSION=$c,ht.toFormData=nn,ht.AxiosError=Xe,ht.Cancel=ht.CanceledError,ht.all=function(e){return Promise.all(e)},ht.spread=cg,ht.isAxiosError=hg,ht.mergeConfig=si,ht.AxiosHeaders=Zt,ht.formToJSON=i=>Sc(pe.isHTMLForm(i)?new FormData(i):i),ht.getAdapter=Rc.getAdapter,ht.HttpStatusCode=wo,ht.default=ht;const{Axios:kT,AxiosError:NT,CanceledError:OT,isCancel:KT,CancelToken:VT,VERSION:zT,all:WT,Cancel:RT,isAxiosError:GT,spread:$T,toFormData:XT,AxiosHeaders:ZT,HttpStatusCode:JT,formToJSON:YT,getAdapter:qT,mergeConfig:jT}=ht,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 hn=Object.create(null);Object.keys(vA).forEach(i=>{hn[vA[i]]=i});const Bo={type:"error",data:"parser error"},Jc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Yc=typeof ArrayBuffer=="function",qc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,yo=({type:i,data:e},t,A)=>Jc&&e instanceof Blob?t?A(e):jc(e,A):Yc&&(e instanceof ArrayBuffer||qc(e))?t?A(e):jc(new Blob([e]),A):A(vA[i]+(e||"")),jc=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function eh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Co;function ug(i,e){if(Jc&&i.data instanceof Blob)return i.data.arrayBuffer().then(eh).then(e);if(Yc&&(i.data instanceof ArrayBuffer||qc(i.data)))return e(eh(i.data));yo(i,!1,t=>{Co||(Co=new TextEncoder),e(Co.encode(t))})}const th="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<th.length;i++)nr[th.charCodeAt(i)]=i;const dg=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),h=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)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},pg=typeof ArrayBuffer=="function",vo=(i,e)=>{if(typeof i!="string")return{type:"message",data:Ah(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:fg(i.substring(1),e)}:hn[t]?i.length>1?{type:hn[t],data:i.substring(1)}:{type:hn[t]}:Bo},fg=(i,e)=>{if(pg){const t=dg(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,ih="",gg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{yo(n,!1,o=>{A[s]=o,++r===t&&e(A.join(ih))})})},mg=(i,e)=>{const t=i.split(ih),A=[];for(let r=0;r<t.length;r++){const n=vo(t[r],e);if(A.push(n),n.type==="error")break}return A};function wg(){return new TransformStream({transform(i,e){ug(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 To;function un(i){return i.reduce((e,t)=>e+t.length,0)}function dn(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 Bg(i,e){To||(To=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(un(t)<1)break;const l=dn(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(un(t)<2)break;const l=dn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(un(t)<8)break;const l=dn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(Bo);break}r=h*Math.pow(2,32)+c.getUint32(4),A=3}else{if(un(t)<r)break;const l=dn(t,r);o.enqueue(vo(n?l:To.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(Bo);break}}}})}const rh=4;function xt(i){if(i)return yg(i)}function yg(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 pn=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")(),Cg="arraybuffer";function ex(){}function nh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const vg=sA.setTimeout,Tg=sA.clearTimeout;function fn(i,e){e.useNativeTimers?(i.setTimeoutFn=vg.bind(sA),i.clearTimeoutFn=Tg.bind(sA)):(i.setTimeoutFn=sA.setTimeout.bind(sA),i.clearTimeoutFn=sA.clearTimeout.bind(sA))}const xg=1.33;function bg(i){return typeof i=="string"?Qg(i):Math.ceil((i.byteLength||i.size)*xg)}function Qg(i){let e=0,t=0;for(let A=0,r=i.length;A<r;A++)e=i.charCodeAt(A),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(A++,t+=4);return t}function sh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Fg(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Ug(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 Sg extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class xo extends xt{constructor(e){super(),this.writable=!1,fn(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 Sg(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=vo(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=Fg(e);return t.length?"?"+t:""}}class Eg extends xo{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)};mg(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,gg(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=sh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let oh=!1;try{oh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Lg=oh;function Mg(){}class Hg extends Eg{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,fn(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=nh(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=Mg,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",ah);else if(typeof addEventListener=="function"){const i="onpagehide"in sA?"pagehide":"unload";addEventListener(i,ah,!1)}}function ah(){for(let i in TA.requests)TA.requests.hasOwnProperty(i)&&TA.requests[i].abort()}const Ig=(function(){const i=lh({xdomain:!1});return i&&i.responseType!==null})();class Dg extends Hg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Ig&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new TA(lh,this.uri(),e)}}function lh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Lg))return new XMLHttpRequest}catch{}if(!e)try{return new sA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const ch=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class _g extends xo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=ch?{}:nh(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;yo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&pn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=sh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const bo=sA.WebSocket||sA.MozWebSocket;class Pg extends _g{createSocket(e,t,A){return ch?new bo(e,t,A):t?new bo(e,t):new bo(e)}doWrite(e,t){this.ws.send(t)}}class kg extends xo{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=Bg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=wg();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&&pn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Ng={websocket:Pg,webtransport:kg,polling:Dg},Og=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Kg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Qo(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=Og.exec(i||""),n={},s=14;for(;s--;)n[Kg[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=Vg(n,n.path),n.queryKey=zg(n,n.query),n}function Vg(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 zg(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Fo=typeof addEventListener=="function"&&typeof removeEventListener=="function",gn=[];Fo&&addEventListener("offline",()=>{gn.forEach(i=>i())},!1);class OA extends xt{constructor(e,t){if(super(),this.binaryType=Cg,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=Qo(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=Qo(t.host).host);fn(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=Ug(this.opts.query)),Fo&&(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"})},gn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=rh,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+=bg(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,pn(()=>{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(),Fo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=gn.indexOf(this._offlineEventListener);A!==-1&&gn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}OA.protocol=rh;class Wg 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",g=>{if(!A)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;OA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){A||(A=!0,h(),t.close(),t=null)}const s=g=>{const C=new Error("probe error: "+g);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function o(){s("transport closed")}function l(){s("socket closed")}function c(g){t&&g.name!==t.name&&n()}const h=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{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 Rg=class extends Wg{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=>Ng[r]).filter(r=>!!r)),super(e,A)}};function Gg(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=Qo(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 $g=typeof ArrayBuffer=="function",Xg=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,hh=Object.prototype.toString,Zg=typeof Blob=="function"||typeof Blob<"u"&&hh.call(Blob)==="[object BlobConstructor]",Jg=typeof File=="function"||typeof File<"u"&&hh.call(File)==="[object FileConstructor]";function Uo(i){return $g&&(i instanceof ArrayBuffer||Xg(i))||Zg&&i instanceof Blob||Jg&&i instanceof File}function mn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(mn(i[t]))return!0;return!1}if(Uo(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return mn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&mn(i[t]))return!0;return!1}function Yg(i){const e=[],t=i.data,A=i;return A.data=So(t,e),A.attachments=e.length,{packet:A,buffers:e}}function So(i,e){if(!i)return i;if(Uo(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]=So(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]=So(i[A],e));return t}return i}function qg(i,e){return i.data=Eo(i.data,e),delete i.attachments,i}function Eo(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]=Eo(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Eo(i[t],e));return i}const jg=["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 em{constructor(e){this.replacer=e}encode(e){return(e.type===At.EVENT||e.type===At.ACK)&&mn(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=Yg(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class Lo 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 tm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Uo(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(Lo.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 uh(t);case At.DISCONNECT:return t===void 0;case At.CONNECT_ERROR:return typeof t=="string"||uh(t);case At.EVENT:case At.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&jg.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 tm{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=qg(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function uh(i){return Object.prototype.toString.call(i)==="[object Object]"}const Am=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Lo,Encoder:em,get PacketType(){return At}},Symbol.toStringTag,{value:"Module"}));function fA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const im=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class dh 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(im.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 h=this.ids++,g=t.pop();this._registerAckCallback(h,g),s.id=h}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 Mo 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,fn(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||Am;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 Rg(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){pn(()=>{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 dh(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 wn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=Gg(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 Mo(A,e):(sr[r]||(sr[r]=new Mo(A,e)),l=sr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(wn,{Manager:Mo,Socket:dh,io:wn,connect:wn});function Ho(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=Ho("http://localhost:8000");function ph(i){const e=Ho(i);e&&e!==AA&&(AA=e,mt&&(mt.disconnect(),mt.removeAllListeners(),mt=null))}let mt=null;function rm(){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=wn(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 Io(){const i=Ho(mt?.io?.uri||null);return!mt||mt.io&&i&&AA&&i!==AA?(mt&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:AA,wasConnected:mt.connected,reason:"baseUrl changed"}),mt.disconnect(),mt.removeAllListeners(),mt=null),mt=rm()):mt.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:mt.id,connected:mt.connected,baseUrl:AA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:mt.id,baseUrl:AA}),mt}function nm(i,e){const t=Io();return t.on(i,e),()=>t.off(i,e)}function sm(i,e){mt&&mt.off(i,e)}function om(i,e){Io().emit(i,e)}function am(){return mt?mt.connected?"connected":"connecting":"disconnected"}const Bn={getSocket:Io,on:nm,off:sm,emit:om,getStatus:am,setBaseUrl:ph},lm={},fh=Ae.createContext(),Lt=()=>{const i=Ae.useContext(fh);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},cm=({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:vs&&vs.tagName.toUpperCase()==="SCRIPT"&&vs.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&lm?.VITE_BASE_URL)??"http://localhost:5002",l={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account"},...t},c=t?.params||{},[h,g]=Ae.useState(r||"BTC/USD"),[C,x]=Ae.useState(n||"M1"),[b,v]=Ae.useState([]),[U,F]=Ae.useState(!0),[M,N]=Ae.useState([]),[R,L]=Ae.useState(!1),[z,q]=Ae.useState(1e5),[$,V]=Ae.useState(null),[j,te]=Ae.useState([]),[ce,X]=Ae.useState(!0),[ee,se]=Ae.useState(!1),[le,ne]=Ae.useState(!0),[he,de]=Ae.useState("candles"),[we,xe]=Ae.useState(!1),[Ue,ye]=Ae.useState("dark"),[ve,be]=Ae.useState(!1),[Ee,Ie]=Ae.useState([]),Ze=Ae.useRef(null);Ae.useEffect(()=>{Bn.setBaseUrl(s)},[s]);const ze=Ae.useRef(new Map),Ce=Ae.useRef(null),Ne=1e3,Se=Ae.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token");if(!me)return;L(!0);const ge=await ht.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let Me=[];Array.isArray(ge.data)?Me=ge.data:ge.data?.data&&Array.isArray(ge.data.data)&&(Me=ge.data.data);const _e=Me.filter(Qe=>Qe.closePrice===null||Qe.closePrice===void 0).map(Qe=>({id:Qe.id,ticket:23,symbol:Qe.symbol,type:Qe.type,volume:Qe.volume,openPrice:Qe.openPrice??Qe.price,stopLoss:Qe.stopLoss,takeProfit:Qe.takeProfit,comment:Qe.comment||"",status:"OPEN",swap:0,profit:Qe.profit||0,profitCurrency:"USD",time:new Date(Qe.openedAt||Qe.openAt||Date.now()).toLocaleTimeString(),openAt:Qe.openedAt||Qe.openAt,closeAt:Qe.closedAt||Qe.closeAt}));N(_e)}catch(me){console.error("❌ Error fetching orders:",me.response?.data||me.message),N([])}finally{L(!1)}},[s,A]),fe=Ae.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=Ae.useCallback(async()=>{try{const me=localStorage.getItem("token");if(!me)return;const ge=await ht.get(`${s}${l.account}`,{headers:{Authorization:`Bearer ${me}`}});if(ge.data&&ge.data.data){const Me=parseFloat(ge.data.data.balance);isNaN(Me)||q(Me)}}catch(me){console.error("❌ Error fetching user balance:",me.response?.data||me.message)}},[s]),Je=Ae.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token");if(!me)return;const ge=await ht.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let Me=[];Array.isArray(ge.data)?Me=ge.data:ge.data?.data&&Array.isArray(ge.data.data)&&(Me=ge.data.data);const _e=Me.filter(Qe=>Qe.closePrice!==null&&Qe.closePrice!==void 0).map(Qe=>({id:Qe.id,ticket:23,symbol:Qe.symbol,type:Qe.type,volume:Qe.volume,openPrice:Qe.openPrice??Qe.price,closePrice:Qe.closePrice,stopLoss:Qe.stopLoss,takeProfit:Qe.takeProfit,profit:Qe.profit||0,profitCurrency:"USD",openAt:Qe.openedAt||Qe.openAt,closeAt:Qe.closedAt||Qe.closeAt,closeReason:Qe.closeReason||"",status:"CLOSED"}));Ie(_e)}catch(me){console.error("❌ Error fetching history orders:",me.response?.data||me.message),Ie([])}},[s,A]),it=Ae.useMemo(()=>{const me=z,ge=M.reduce((Ve,dt)=>Ve+dt.volume*dt.price*.01,0),Me=M.reduce((Ve,dt)=>{const wt=b.find(It=>It.symbol===dt.symbol);if(wt){const It=dt.type==="BUY"?parseFloat(wt.bid||0):parseFloat(wt.ask||0);if(It&&It>0&&!isNaN(It))return Ve+fe(dt,It)}return Ve+(dt.profit||0)},0),_e=me+Me,Qe=_e-ge,Ke=ge>0?_e/ge*100:0;return{balance:me,equity:_e,margin:ge,freeMargin:Qe,level:Ke.toFixed(2)}},[M,b,z,fe]);Ae.useEffect(()=>{localStorage.getItem("token")&&A&&(Se(),Pe(),Je())},[Se,Pe,Je,A]),Ae.useEffect(()=>{(async()=>{try{F(!0);const ge=l.symbols.includes("?")?`${s}${l.symbols}`:`${s}${l.symbols}`,Me=await ht.get(ge);let _e=[];Array.isArray(Me.data)?_e=Me.data:Me.data&&Me.data.data&&Array.isArray(Me.data.data)?_e=Me.data.data:Me.data&&Me.data.prices&&Array.isArray(Me.data.prices)?_e=Me.data.prices:Me.data&&Array.isArray(Me.data)&&(_e=Me.data);const Qe=_e.map(Ke=>Ke.symbol&&(Ke.bid!==void 0||Ke.price!==void 0)?{symbol:Ke.symbol,bid:Ke.bid??Ke.price??0,ask:Ke.ask??Ke.price??0,change:Ke.change??0}:Ke);Qe.length>0?(v(Qe),Qe.find(Ve=>Ve.symbol===h)||g(Qe[0].symbol)):v([])}catch(ge){console.error("❌ Error fetching symbols:",ge.response?.data||ge.message),v([])}finally{F(!1)}})()},[s,l.symbols]);const rt=Ae.useCallback(()=>{const me=ze.current;if(me.size===0)return;const ge=new Map(me);me.clear(),v(Me=>Me.map(_e=>{const Qe=ge.get(_e.symbol);return Qe?{..._e,...Qe}:_e})),N(Me=>{let _e=!1;const Qe=Me.map(Ke=>{const Ve=ge.get(Ke.symbol);if(console.log("UASDSAD",Ve),!Ve)return Ke;const dt=Ke.type?.toUpperCase()==="BUY"?parseFloat(Ve.bid||0):parseFloat(Ve.ask||0);if(!dt||isNaN(dt)||dt<=0)return Ke;const wt=fe(Ke,dt);return wt===Ke.profit?Ke:(_e=!0,{...Ke,profit:wt})});return _e?Qe:Me})},[fe]);Ae.useEffect(()=>{Ze.current||(Ze.current=Bn.getSocket());const me=Ze.current,ge=()=>console.log("✅ TradingContext: Connected"),Me=()=>console.log("⚠️ TradingContext: Disconnected"),_e=Ke=>{Ke?.symbol&&(ze.current.set(Ke.symbol,Ke),Ce.current||(Ce.current=setTimeout(()=>{Ce.current=null,rt()},Ne)))},Qe=async Ke=>{if(Ke){if(Ke.newBalance!==void 0){const Ve=parseFloat(Ke.newBalance);isNaN(Ve)||q(Ve)}if(window.notify){const Ve=Ke.profitLoss||Ke.profit||0,dt=Ve>=0?`+${Ve.toFixed(2)}`:Ve.toFixed(2),wt=Ke.symbol||"Trade",It=Ke.reason||"Closed";window.notify(`Trade Closed: ${It} | ${wt} | P/L: ${dt} USD`,Ve>=0?"success":"error")}Ke.tradeId&&N(Ve=>Ve.filter(dt=>dt.id!==Ke.tradeId)),await Se(),await Pe()}};return me.on("connect",ge),me.on("disconnect",Me),me.on("priceUpdate",_e),me.on("tradeClosed",Qe),()=>{me.off("connect",ge),me.off("disconnect",Me),me.off("priceUpdate",_e),me.off("tradeClosed",Qe),Ce.current&&(clearTimeout(Ce.current),Ce.current=null),ze.current.clear()}},[rt,Se,Pe]),Ae.useEffect(()=>{try{const me=document.documentElement;if(!me)return;me.dataset.theme=Ue}catch{}},[Ue]);const Ge=Ae.useMemo(()=>b.find(me=>me.symbol===h)||{bid:"0.00000",ask:"0.00000",change:0},[b,h]),ke=Ae.useMemo(()=>({selectedSymbol:h,setSelectedSymbol:g,selectedTimeframe:C,setSelectedTimeframe:x,symbols:b,setSymbols:v,symbolsLoading:U,orders:M,setOrders:N,ordersLoading:R,fetchOrders:Se,fetchUserBalance:Pe,userBalance:z,setUserBalance:q,accountSummary:it,currentSymbolData:Ge,activeTool:$,setActiveTool:V,chartObjects:j,setChartObjects:te,showGrid:ce,setShowGrid:X,snapToGrid:ee,setSnapToGrid:se,drawingsVisible:le,setDrawingsVisible:ne,chartType:he,setChartType:de,chartLocked:we,setChartLocked:xe,theme:Ue,setTheme:ye,baseUrl:s,endpoints:l,endpointParams:c,accountId:A,isShow:ve,setIsShow:be,historyOrders:Ee,setHistoryOrders:Ie,fetchHistoryOrders:Je}),[h,C,b,U,M,R,Se,Pe,z,it,Ge,$,j,ce,ee,le,he,we,Ue,s,l,c,ve,Ee,Je]);return a.jsx(fh.Provider,{value:ke,children:i})};var gh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},mh=Ae.createContext&&Ae.createContext(gh),hm=["attr","size","title"];function um(i,e){if(i==null)return{};var t=dm(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 dm(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 yn(){return yn=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},yn.apply(this,arguments)}function wh(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 Cn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wh(Object(t),!0).forEach(function(A){pm(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):wh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function pm(i,e,t){return e=fm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fm(i){var e=gm(i,"string");return typeof e=="symbol"?e:e+""}function gm(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)=>Ae.createElement(e.tag,Cn({key:t},e.attr),Bh(e.child)))}function zt(i){return e=>Ae.createElement(mm,yn({attr:Cn({},i.attr)},e),Bh(i.child))}function mm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=um(i,hm),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),Ae.createElement("svg",yn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Cn(Cn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Ae.createElement("title",null,n),i.children)};return mh!==void 0?Ae.createElement(mh.Consumer,null,t=>e(t)):e(gh)}function wm(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 Bm(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 ym(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 Cm(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 yh(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 vm(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 Tm(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 xm(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 bm(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 Qm(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 Fm={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Ch=({bidPrice:i,askPrice:e,userAccountId:t})=>{const{theme:A,selectedSymbol:r,fetchOrders:n,baseUrl:s,endpoints:o}=Lt(),l=A==="light",[c,h]=Ae.useState("0.01"),[g,C]=Ae.useState(""),[x,b]=Ae.useState(!1),v=l?"bg-slate-100":"bg-[#12161d]",U=l?"text-slate-700":"text-white",F=l?"hover:bg-slate-200":"hover:bg-[#1e2635]",M=R=>{const L=parseFloat(c)||.01,z=Math.max(.01,L+R);h(z.toFixed(2))},N=async R=>{C("");const L=R,z=parseFloat(L==="BUY"?e:i),q=parseFloat(c);if(!q||q<=0||isNaN(q)){C("Please enter a valid volume (minimum 0.01)");return}if(q<.01){C("Volume must be at least 0.01");return}if(!z||z<=0||isNaN(z)){C("Invalid price. Please refresh and try again.");return}const $=localStorage.getItem("token");if(!$){C("Please login to place trades");return}b(!0);const V=typeof r=="object"?r?.symbol:r,j={accountId:t,symbol:V,type:L,volume:q,openPrice:z,takeProfit:null,stopLoss:null};try{const te=s||Fm?.VITE_BASE_URL||"http://localhost:8000",ce=o?.trades||"/api/trades",X=await ht.post(`${te}${ce}`,j,{headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"}});if(X.status<200||X.status>=300){C(X.data?.message||`Failed to place trade (${X.status})`);return}n&&n()}catch(te){const ce=te?.response?.data?.message||te?.message||"Network error. Please try again.";C(ce)}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:()=>N("SELL"),disabled:x,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 ${v}`,children:[a.jsx("button",{type:"button",onClick:()=>M(-.01),className:`w-5 flex items-center justify-center ${U} ${F} transition-colors`,children:a.jsx(yh,{size:8})}),a.jsx("input",{type:"number",value:c,onChange:R=>{const L=R.target.value;(L===""||/^\d*\.?\d{0,2}$/.test(L))&&h(L)},onBlur:()=>{const R=parseFloat(c);h(isNaN(R)||R<.01?"0.01":R.toFixed(2))},className:`w-14 text-center focus:outline-none ${v} ${U}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>M(.01),className:`w-5 flex items-center justify-center ${U} ${F} transition-colors`,children:a.jsx(vm,{size:8})})]}),a.jsxs("button",{onClick:()=>N("BUY"),disabled:x,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):"—"})]})]}),g&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:g})]})},Um={},vh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:g,selectedTimeframe:C,setOrders:x,symbols:b,fetchOrders:v,theme:U,baseUrl:F,endpoints:M}=Lt(),N=U==="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 Me=R.getContractSpec(me);return(parseFloat(ge)||0)*(Me.contractSize||1)}},L=h||R,[z,q]=Ae.useState("0.01"),[$,V]=Ae.useState(""),[j,te]=Ae.useState(""),[ce,X]=Ae.useState(""),[ee,se]=Ae.useState(!1),[le,ne]=Ae.useState(null),[he,de]=Ae.useState(""),[we,xe]=Ae.useState(t||"BUY"),[Ue,ye]=Ae.useState(parseFloat(A)||0),[ve,be]=Ae.useState(parseFloat(r)||0),[Ee,Ie]=Ae.useState("text-white"),[Ze,ze]=Ae.useState("text-white"),Ce=Ae.useRef(parseFloat(A)||0),Ne=Ae.useRef(parseFloat(r)||0);Ae.useEffect(()=>{if(!i)return;const me=Bn.getSocket(),ge=_e=>{if(!(!_e||!_e.symbol)&&_e.symbol.toUpperCase()===g?.toUpperCase()){const Qe=parseFloat(_e.bid)||0,Ke=parseFloat(_e.ask)||0;Qe>0&&(Qe>Ce.current?(Ie("text-green-400"),setTimeout(()=>Ie("text-white"),500)):Qe<Ce.current&&Ce.current>0&&(Ie("text-red-400"),setTimeout(()=>Ie("text-white"),500)),ye(Qe),Ce.current=Qe),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)),be(Ke),Ne.current=Ke)}};me.on("priceUpdate",ge);const Me=b.find(_e=>_e.symbol===g);if(Me){const _e=parseFloat(Me.bid)||0,Qe=parseFloat(Me.ask)||0;_e>0&&(ye(_e),Ce.current=_e),Qe>0&&(be(Qe),Ne.current=Qe)}return()=>{me.off("priceUpdate",ge)}},[i,g,b]),Ae.useEffect(()=>{if(i){q(o?String(o):"0.01"),V(""),te(""),X(""),de(""),xe(t||"BUY");const me=parseFloat(A)||0,ge=parseFloat(r)||0;me>0&&(ye(me),Ce.current=me),ge>0&&(be(ge),Ne.current=ge)}},[i,t,A,r,o]);const Se=Ue||0,fe=ve||0,Pe=me=>{const ge=parseFloat(z)||.01,Me=Math.max(.01,ge+me);q(Me.toFixed(2))},Je=me=>{const ge=parseFloat($)||0,Me=parseFloat(we==="BUY"?ve:Ue)||0;if(!Me){de("Current price not available. Please wait...");return}let _e=ge+me;we==="BUY"?_e=Math.max(1e-5,Math.min(_e,Me-1e-5)):_e=Math.max(Me+1e-5,_e),V(_e>0?_e.toFixed(5):""),de("")},it=me=>{const ge=parseFloat(j)||0,Me=parseFloat(we==="BUY"?ve:Ue)||0;if(!Me){de("Current price not available. Please wait...");return}let _e=ge+me;we==="BUY"?_e=Math.max(Me+1e-5,_e):_e=Math.max(1e-5,Math.min(_e,Me-1e-5)),te(_e>0?_e.toFixed(5):""),de("")},rt=async me=>{de("");const ge=me||we,Me=parseFloat(ge==="BUY"?ve:Ue),_e=parseFloat(z),Qe=$?parseFloat($):null,Ke=j?parseFloat(j):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(!Me||Me<=0||isNaN(Me)){de("Invalid price. Please refresh and try again.");return}if(Qe!==null&&Qe!==""){if(isNaN(Qe)||Qe<=0){de("Stop Loss must be a valid positive number");return}if(ge==="BUY"&&Qe>=Me){de("Stop Loss must be below the current price for BUY orders");return}if(ge==="SELL"&&Qe<=Me){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<=Me){de(`Take Profit must be above the entry price (${Me.toFixed(5)}) for BUY orders`);return}}else if(ge==="SELL"&&Ke>=Me){de(`Take Profit must be below the entry price (${Me.toFixed(5)}) for SELL orders`);return}}xe(ge),ne(ge),se(!0);const Ve=new Date,dt=Ve.toLocaleTimeString(),wt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,It=localStorage.getItem("token");if(!It){de("Please login to place trades"),se(!1),ne(null);return}const Ir={accountId:s,symbol:g,type:ge,volume:_e,price:Me,takeProfit:Ke,stopLoss:Qe,comment:ce.trim()||null},Bs={ticket:wt.substring(0,8),symbol:g,type:ge,volume:parseFloat(_e),price:parseFloat(Me),time:dt,stopLoss:Qe?parseFloat(Qe):null,takeProfit:Ke?parseFloat(Ke):null,swap:0,profit:0,profitCurrency:"USD",comment:ce.trim()||"",id:wt,status:"OPEN",openAt:Ve.toISOString()};if(!l&&x&&x(gi=>[...gi,Bs]),c&&!n){de("Execution handler is required in forceParentExecution mode"),se(!1),ne(null);return}if(n){se(!1),ne(null),e();const gi={symbol:g,type:ge,lotSize:_e,entryPrice:Me,stopLoss:Qe,takeProfit:Ke,comment:ce.trim()||null};Promise.resolve(n(gi)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),v&&v()}).catch(ys=>{console.error("❌ Trade execution failed:",ys),!l&&x&&x(Dt=>Dt.filter(vt=>vt.id!==wt))})}else{if(c){de("Fallback API path disabled in forceParentExecution mode"),se(!1),ne(null);return}se(!1),ne(null),e();const gi=F||Um?.VITE_BASE_URL||"http://localhost:8000",ys=M?.trades||"/api/trades";ht.post(`${gi}${ys}`,Ir,{headers:{Authorization:`Bearer ${It}`,"Content-Type":"application/json"}}).then(Dt=>{if(Dt.data&&Dt.data.data){const vt=Dt.data.data.trade;!l&&x&&x(St=>St.map(jt=>jt.id===wt?{...jt,id:vt.id,ticket:vt.id.substring(0,8),time:dt,openAt:vt.openAt}:jt)),console.log("✅ Trade saved successfully:",vt),window.notify&&window.notify(`Trade placed successfully: ${vt.symbol} ${vt.type}`,"success")}else{!l&&x&&x(St=>St.filter(jt=>jt.id!==wt));const vt=Dt.data?.message||"Failed to place trade";window.notify&&window.notify(vt,"error")}}).catch(Dt=>{console.error("Error placing trade:",Dt),!l&&x&&x(St=>St.filter(jt=>jt.id!==wt));let vt="Failed to place trade";if(Dt.response){const St=Dt.response.status,jt=Dt.response.data;St===400?vt=jt?.message||"Invalid trade data. Please check your inputs.":St===401?vt="Authentication failed. Please login again.":St===404?vt=jt?.message||"Symbol not found. Please select a valid symbol.":St===500?vt="Server error. Please try again later.":vt=jt?.message||`Error: ${St}`}else Dt.request&&(vt="Network error. Please check your internet connection.");window.notify&&window.notify(vt,"error")})}},ke=(L?.calculateVolumeUnits?.({symbol:g,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return i?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${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:[ke," ",g]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>Pe(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${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:me=>{const ge=me.target.value;(ge===""||/^\d*\.?\d{0,2}$/.test(ge))&&(q(ge),de(""))},onBlur:()=>{const me=parseFloat(z);q(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 ${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:()=>Pe(.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:()=>Je(-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: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 ${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:()=>Je(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:()=>it(-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:j,onChange:me=>{const ge=me.target.value;(ge===""||/^\d*\.?\d*$/.test(ge))&&(te(ge),de(""))},onBlur:me=>{const ge=parseFloat(me.target.value);!isNaN(ge)&&ge>0?te(ge.toFixed(5)):me.target.value===""&&te("")},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:()=>it(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: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 ${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:`${Ee} font-medium transition-colors duration-400`,children:Se>0?Se.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:`${Ze} font-medium transition-colors duration-400`,children:fe>0?fe.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},Sm={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"},Em=[10,11,12,14,16,20,24,28,30,40],vn=[{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"},Th={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Lm(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 Mm=()=>a.jsx(bm,{style:KA}),Hm=()=>a.jsx(Qm,{style:KA}),Im=()=>a.jsx(Cm,{style:KA}),Dm=()=>a.jsx(xm,{style:KA}),_m=()=>a.jsx(Bm,{style:KA}),Pm=()=>a.jsx(wm,{style:KA}),km=()=>a.jsx(ym,{style:KA}),Nm=()=>a.jsx(yh,{style:KA}),Do=({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(Do,{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:Th}),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:h=>e(h.target.value),disabled:A,style:{...Th,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const g=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(g?`#${g}`:"")},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(Nm,{})})]})}function Om({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===vn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:vn.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:vn.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 Km({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:Em.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(Im,{})}),a.jsx(or,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Dm,{})})]}),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(_m,{})}),a.jsx(or,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Pm,{})}),a.jsx(or,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(km,{})})]})]}),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 Tn({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 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: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 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.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 Wm({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 xh({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 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:"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 Gm({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 $m({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 Xm({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 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.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 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||"#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 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: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 bh({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 Qh({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 qm(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||vn.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 Fh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Lt(),s=Lm(r==="light"),[o,l]=Ae.useState("style"),[c,h]=Ae.useState({}),[g,C]=Ae.useState(null),x=Ae.useRef(null),b=Ae.useRef(null);Ae.useEffect(()=>{t&&(h(qm(t)),l("style"))},[t]),Ae.useEffect(()=>{i||C(null)},[i]);const v=L=>{if(L.button!==0)return;L.preventDefault();const z=x.current;if(!z)return;const q=z.offsetParent,$=q?q.getBoundingClientRect():{left:0,top:0},V=z.getBoundingClientRect(),j=V.left-$.left,te=V.top-$.top;b.current={startMX:L.clientX,startMY:L.clientY,startX:j,startY:te},C({x:j,y:te});const ce=ee=>{const{startMX:se,startMY:le,startX:ne,startY:he}=b.current;C({x:ne+ee.clientX-se,y:he+ee.clientY-le})},X=()=>{b.current=null,document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",X)};document.addEventListener("mousemove",ce),document.addEventListener("mouseup",X)};if(!i||!t)return null;const U=Sm[t.type]||t.type,F=["style","coordinates","visualization"],M=()=>{if(o==="visualization")return a.jsx(Om,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Km,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Wm,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Tn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:h,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(xh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Rm,{draft:c,setDraft:h,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(xh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Gm,{draft:c,setDraft:h,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx($m,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Xm,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(zm,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:h,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(Vm,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:h,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Tn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:h,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Tn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:h,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Tn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:h,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(Jm,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ym,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(Zm,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ci,{draft:c,setDraft:h,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(bh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Qh,{draft:c,setDraft:h,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(bh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Qh,{draft:c,setDraft:h,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:x,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...g===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:g.y,left:g.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:v,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(Do,{size:"18px",children:a.jsx(Mm,{})})})]})}),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(Do,{size:"20px",children:a.jsx(Hm,{})})})]}),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:M()}),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 _o=function(i,e){return _o=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])},_o(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");_o(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Po=function(){return Po=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},Po.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(h){try{c(A.next(h))}catch(g){s(g)}}function l(h){try{c(A.throw(h))}catch(g){s(g)}}function c(h){h.done?n(h.value):r(h.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(h){return l([c,h])}}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(h){c=[6,h],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function xn(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})(),bn=function(i,e){return IA.fromClientRect(i,e.getBoundingClientRect())},jm=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)},Qn=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},yt=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},Uh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ew=typeof Uint8Array>"u"?[]:new Uint8Array(256),Fn=0;Fn<Uh.length;Fn++)ew[Uh.charCodeAt(Fn)]=Fn;for(var Sh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ar=typeof Uint8Array>"u"?[]:new Uint8Array(256),Un=0;Un<Sh.length;Un++)ar[Sh.charCodeAt(Un)]=Un;for(var tw=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),h=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)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},Aw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},iw=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,No=2,rw=ko-hi,Eh=65536>>hi,nw=1<<hi,Oo=nw-1,sw=1024>>hi,ow=Eh+sw,aw=ow,lw=32,cw=aw+lw,hw=65536>>ko,uw=1<<rw,dw=uw-1,Lh=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},pw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},fw=function(i,e){var t=tw(i),A=Array.isArray(t)?iw(t):new Uint32Array(t),r=Array.isArray(t)?Aw(t):new Uint16Array(t),n=24,s=Lh(r,n/2,A[4]/2),o=A[5]===2?Lh(r,(n+A[4])/2):pw(A,Math.ceil((n+A[4])/4));return new gw(A[0],A[1],A[2],A[3],s,o)},gw=(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<<No)+(e&Oo),this.data[t];if(e<=65535)return t=this.index[Eh+(e-55296>>hi)],t=(t<<No)+(e&Oo),this.data[t];if(e<this.highStart)return t=cw-hw+(e>>ko),t=this.index[t],t+=e>>hi&dw,t=this.index[t],t=(t<<No)+(e&Oo),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Sn=0;Sn<Mh.length;Sn++)mw[Mh.charCodeAt(Sn)]=Sn;var ww="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Hh=50,Bw=1,Ih=2,Dh=3,yw=4,Cw=5,_h=7,Ph=8,kh=9,VA=10,Ko=11,Nh=12,Vo=13,vw=14,lr=15,zo=16,En=17,cr=18,Tw=19,Oh=20,Wo=21,hr=22,Ro=23,Fi=24,iA=25,ur=26,dr=27,Ui=28,xw=29,ui=30,bw=31,Ln=32,Mn=33,Go=34,$o=35,Xo=36,pr=37,Zo=38,Hn=39,In=40,Jo=41,Kh=42,Qw=43,Fw=[9001,65288],Vh="!",tt="×",Dn="÷",Yo=fw(ww),DA=[ui,Xo],qo=[Bw,Ih,Dh,Cw],zh=[VA,Ph],Wh=[dr,ur],Uw=qo.concat(zh),Rh=[Zo,Hn,In,Go,$o],Sw=[lr,Vo],Ew=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=Yo.get(n);if(o>Hh?(r.push(!0),o-=Hh):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===yw||o===Ko){if(s===0)return A.push(s),t.push(ui);var l=t[s-1];return Uw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(ui))}if(A.push(s),o===bw)return t.push(e==="strict"?Wo:pr);if(o===Kh||o===xw)return t.push(ui);if(o===Qw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(pr):t.push(ui);t.push(o)}),[A,t,r]},jo=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},Gh=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===VA)t--;else return A}return 0},Lw=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,h=e[o];if(l===Ih&&h===Dh)return tt;if(qo.indexOf(l)!==-1)return Vh;if(qo.indexOf(h)!==-1||zh.indexOf(h)!==-1)return tt;if(Gh(n,e)===Ph)return Dn;if(Yo.get(i[n])===Ko||(l===Ln||l===Mn)&&Yo.get(i[o])===Ko||l===_h||h===_h||l===kh||[VA,Vo,lr].indexOf(l)===-1&&h===kh||[En,cr,Tw,Fi,Ui].indexOf(h)!==-1||Gh(n,e)===hr||jo(Ro,hr,n,e)||jo([En,cr],Wo,n,e)||jo(Nh,Nh,n,e))return tt;if(l===VA)return Dn;if(l===Ro||h===Ro)return tt;if(h===zo||l===zo)return Dn;if([Vo,lr,Wo].indexOf(h)!==-1||l===vw||c===Xo&&Sw.indexOf(l)!==-1||l===Ui&&h===Xo||h===Oh||DA.indexOf(h)!==-1&&l===iA||DA.indexOf(l)!==-1&&h===iA||l===dr&&[pr,Ln,Mn].indexOf(h)!==-1||[pr,Ln,Mn].indexOf(l)!==-1&&h===ur||DA.indexOf(l)!==-1&&Wh.indexOf(h)!==-1||Wh.indexOf(l)!==-1&&DA.indexOf(h)!==-1||[dr,ur].indexOf(l)!==-1&&(h===iA||[hr,lr].indexOf(h)!==-1&&e[o+1]===iA)||[hr,lr].indexOf(l)!==-1&&h===iA||l===iA&&[iA,Ui,Fi].indexOf(h)!==-1)return tt;if([iA,Ui,Fi,En,cr].indexOf(h)!==-1)for(var g=n;g>=0;){var C=e[g];if(C===iA)return tt;if([Ui,Fi].indexOf(C)!==-1)g--;else break}if([dr,ur].indexOf(h)!==-1)for(var g=[En,cr].indexOf(l)!==-1?s:n;g>=0;){var C=e[g];if(C===iA)return tt;if([Ui,Fi].indexOf(C)!==-1)g--;else break}if(Zo===l&&[Zo,Hn,Go,$o].indexOf(h)!==-1||[Hn,Go].indexOf(l)!==-1&&[Hn,In].indexOf(h)!==-1||[In,$o].indexOf(l)!==-1&&h===In||Rh.indexOf(l)!==-1&&[Oh,ur].indexOf(h)!==-1||Rh.indexOf(h)!==-1&&l===dr||DA.indexOf(l)!==-1&&DA.indexOf(h)!==-1||l===Fi&&DA.indexOf(h)!==-1||DA.concat(iA).indexOf(l)!==-1&&h===hr&&Fw.indexOf(i[o])===-1||DA.concat(iA).indexOf(h)!==-1&&l===cr)return tt;if(l===Jo&&h===Jo){for(var x=t[n],b=1;x>0&&(x--,e[x]===Jo);)b++;if(b%2!==0)return tt}return l===Ln&&h===Mn?tt:Dn},Mw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Ew(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,Kh].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]},Hw=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===Vh,this.start=A,this.end=r}return i.prototype.slice=function(){return yt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),Iw=function(i,e){var t=Qn(i),A=Mw(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 h=tt;c<o&&(h=Lw(t,n,r,++c,s))===tt;);if(h!==tt||c===o){var g=new Hw(t,h,l,c);return l=c,{value:g,done:!1}}return{done:!0,value:null}}}},Dw=1,_w=2,fr=4,$h=8,_n=10,Xh=47,gr=92,Pw=9,kw=32,Pn=34,mr=61,Nw=35,Ow=36,Kw=37,kn=39,Nn=40,wr=41,Vw=95,Jt=45,zw=33,Ww=60,Rw=62,Gw=64,$w=91,Xw=93,Zw=61,Jw=123,On=63,Yw=125,Zh=124,qw=126,jw=128,Jh=65533,ea=42,di=43,eB=44,tB=58,AB=59,Br=46,iB=0,rB=8,nB=11,sB=14,oB=31,aB=127,bA=-1,Yh=48,qh=97,jh=101,lB=102,cB=117,hB=122,eu=65,tu=69,Au=70,uB=85,dB=90,Ot=function(i){return i>=Yh&&i<=57},pB=function(i){return i>=55296&&i<=57343},Si=function(i){return Ot(i)||i>=eu&&i<=Au||i>=qh&&i<=lB},fB=function(i){return i>=qh&&i<=hB},gB=function(i){return i>=eu&&i<=dB},mB=function(i){return fB(i)||gB(i)},wB=function(i){return i>=jw},Kn=function(i){return i===_n||i===Pw||i===kw},Vn=function(i){return mB(i)||wB(i)||i===Vw},iu=function(i){return Vn(i)||Ot(i)||i===Jt},BB=function(i){return i>=iB&&i<=rB||i===nB||i>=sB&&i<=oB||i===aB},zA=function(i,e){return i!==gr?!1:e!==_n},zn=function(i,e,t){return i===Jt?Vn(e)||zA(e,t):Vn(i)?!0:!!(i===gr&&zA(i,e))},ta=function(i,e,t){return i===di||i===Jt?Ot(e)?!0:e===Br&&Ot(t):Ot(i===Br?e:i)},yB=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(yt.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(yt.apply(void 0,n),10):0;(i[e]===tu||i[e]===jh)&&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 h=c.length?parseInt(yt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*h)},CB={type:2},vB={type:3},TB={type:4},xB={type:13},bB={type:8},QB={type:21},FB={type:9},UB={type:10},SB={type:11},EB={type:12},LB={type:14},Wn={type:23},MB={type:1},HB={type:25},IB={type:24},DB={type:26},_B={type:27},PB={type:28},kB={type:29},NB={type:31},Aa={type:32},ru=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat(Qn(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 Pn:return this.consumeStringToken(Pn);case Nw:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(iu(t)||zA(A,r)){var n=zn(t,A,r)?_w:Dw,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Ow:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),xB;break;case kn:return this.consumeStringToken(kn);case Nn:return CB;case wr:return vB;case ea:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),LB;break;case di:if(ta(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case eB:return TB;case Jt:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(ta(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(zn(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Jt&&c===Rw)return this.consumeCodePoint(),this.consumeCodePoint(),IB;break;case Br:if(ta(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Xh:if(this.peekCodePoint(0)===ea)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===ea&&(h=this.consumeCodePoint(),h===Xh))return this.consumeToken();if(h===bA)return this.consumeToken()}break;case tB:return DB;case AB:return _B;case Ww:if(this.peekCodePoint(0)===zw&&this.peekCodePoint(1)===Jt&&this.peekCodePoint(2)===Jt)return this.consumeCodePoint(),this.consumeCodePoint(),HB;break;case Gw:var g=this.peekCodePoint(0),C=this.peekCodePoint(1),x=this.peekCodePoint(2);if(zn(g,C,x)){var s=this.consumeName();return{type:7,value:s}}break;case $w:return PB;case gr:if(zA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Xw:return kB;case Zw:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),bB;break;case Jw:return SB;case Yw:return EB;case cB:case uB:var b=this.peekCodePoint(0),v=this.peekCodePoint(1);return b===di&&(Si(v)||v===On)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Zh:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),FB;if(this.peekCodePoint(0)===Zh)return this.consumeCodePoint(),QB;break;case qw:if(this.peekCodePoint(0)===mr)return this.consumeCodePoint(),UB;break;case bA:return Aa}return Kn(e)?(this.consumeWhiteSpace(),NB):Ot(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Vn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:yt(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===On&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(yt.apply(void 0,e.map(function(l){return l===On?Yh:l})),16),n=parseInt(yt.apply(void 0,e.map(function(l){return l===On?Au:l})),16);return{type:30,start:r,end:n}}var s=parseInt(yt.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(yt.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)===Nn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Nn?(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===Pn){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(),Wn)}for(;;){var r=this.consumeCodePoint();if(r===bA||r===wr)return{type:22,value:yt.apply(void 0,e)};if(Kn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===bA||this.peekCodePoint(0)===wr?(this.consumeCodePoint(),{type:22,value:yt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Wn);if(r===Pn||r===kn||r===Nn||BB(r))return this.consumeBadUrlRemnants(),Wn;if(r===gr)if(zA(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Wn;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;Kn(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+=yt.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===_n)return this._value.splice(0,A),MB;if(r===gr){var n=this._value[A+1];n!==bA&&n!==void 0&&(n===_n?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):zA(r,n)&&(t+=this.consumeStringSlice(A),t+=yt(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=$h;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===tu||A===jh)&&((r===di||r===Jt)&&Ot(n)||Ot(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=$h;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[yB(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===Kw?(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=yt(e);Si(this.peekCodePoint(0))&&t.length<6;)t+=yt(this.consumeCodePoint());Kn(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||pB(A)||A>1114111?Jh:A}return e===bA?Jh:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(iu(t))e+=yt(t);else if(zA(t,this.peekCodePoint(0)))e+=yt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),nu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new ru;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||KB(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})(),yr=function(i){return i.type===15},Ei=function(i){return i.type===17},at=function(i){return i.type===20},OB=function(i){return i.type===0},ia=function(i,e){return at(i)&&i.value===e},su=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},KB=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)},ou=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},Mt={type:17,number:0,flags:fr},ra={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[ut(A,e),ut(typeof r<"u"?r:A,t)]},ut=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},au="deg",lu="grad",cu="rad",hu="turn",Rn={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case au:return Math.PI*e.number/180;case lu:return Math.PI/200*e.number;case cu:return e.number;case hu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},uu=function(i){return i.type===15&&(i.unit===au||i.unit===lu||i.unit===cu||i.unit===hu)},du=function(i){var e=i.filter(at).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=VB[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},pu=function(i,e){if(i.type===17)return i.number;if(i.type===16){var t=e===3?1:255;return e===3?i.number/100*t:Math.round(i.number/100*t)}return 0},fu=function(i,e){var t=e.filter(Li);if(t.length===3){var A=t.map(pu),r=A[0],n=A[1],s=A[2];return XA(r,n,s,1)}if(t.length===4){var o=t.map(pu),r=o[0],n=o[1],s=o[2],l=o[3];return XA(r,n,s,l)}return 0};function na(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 gu=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):Rn.parse(i,A))/(Math.PI*2),l=bt(r)?r.number/100:0,c=bt(n)?n.number/100:0,h=typeof s<"u"&&bt(s)?ut(s,1):1;if(l===0)return XA(c*255,c*255,c*255,1);var g=c<=.5?c*(l+1):c+l-c*l,C=c*2-g,x=na(C,g,o+1/3),b=na(C,g,o),v=na(C,g,o-1/3);return XA(x*255,b*255,v*255,h)},VB={hsl:gu,hsla:gu,rgb:fu,rgba:fu},vr=function(i,e){return GA.parse(i,nu.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},zB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(at(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},WB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Gn=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}},mu=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=ut(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var h=r[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var g=s-c,C=r[c-1],x=(h-C)/(g+1),b=1;b<=g;b++)r[c+b-1]=x*b;c=null}}return i.map(function(v,U){var F=v.color;return{color:F,stop:Math.max(Math.min(1,r[U]/e),0)}})},RB=function(i,e,t){var A=e/2,r=t/2,n=ut(i[0],e)-A,s=r-ut(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},GB=function(i,e,t){var A=typeof i=="number"?i:RB(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)},wu=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],h=mA(t-l,A-c);return(r?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},$B=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=wu(A,r,e,t,!0),c=l[0],h=l[1];n=mA(c-e,(h-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)),g=wu(A,r,e,t,!1),c=g[0],h=g[1];n=mA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=ut(i.size[0],A),s=i.size.length===2?ut(i.size[1],r):n),[n,s]},XB=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=du(r);return}else if(uu(s)){t=Rn.parse(i,s);return}}var o=Gn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},$n=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=du(r);return}else if(uu(s)){t=(Rn.parse(i,s)+aA(270))%aA(360);return}}var o=Gn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},ZB=function(i,e){var t=aA(180),A=[],r=1,n=0,s=3,o=[];return QA(e).forEach(function(l,c){var h=l[0];if(c===0){if(at(h)&&h.value==="linear"){r=1;return}else if(at(h)&&h.value==="radial"){r=2;return}}if(h.type===18){if(h.name==="from"){var g=GA.parse(i,h.values[0]);A.push({stop:Mt,color:g})}else if(h.name==="to"){var g=GA.parse(i,h.values[0]);A.push({stop:RA,color:g})}else if(h.name==="color-stop"){var C=h.values.filter(Li);if(C.length===2){var g=GA.parse(i,C[1]),x=C[0];Ei(x)&&A.push({stop:{type:16,number:x.number*100,flags:x.flags},color:g})}}}}),r===1?{angle:(t+aA(180))%aA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},Bu="closest-side",yu="farthest-side",Cu="closest-corner",vu="farthest-corner",Tu="circle",xu="ellipse",bu="cover",Qu="contain",JB=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(g,C){if(c)if(at(C))switch(C.value){case"center":return n.push(ra),g;case"top":case"left":return n.push(Mt),g;case"right":case"bottom":return n.push(RA),g}else(bt(C)||WA(C))&&n.push(C);else if(at(C))switch(C.value){case Tu:return t=0,!1;case xu:return t=1,!1;case"at":return c=!0,!1;case Bu:return A=0,!1;case bu:case yu:return A=1,!1;case Qu:case Cu:return A=2,!1;case vu:return A=3,!1}else if(WA(C)||bt(C))return Array.isArray(A)||(A=[]),A.push(C),!1;return g},l)}if(l){var h=Gn(i,s);r.push(h)}}),{size:A,shape:t,stops:r,position:n,type:2}},Xn=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(h,g){if(at(g))switch(g.value){case"center":return n.push(ra),!1;case"top":case"left":return n.push(Mt),!1;case"right":case"bottom":return n.push(RA),!1}else if(bt(g)||WA(g))return n.push(g),!1;return h},l):o===1&&(l=s.reduce(function(h,g){if(at(g))switch(g.value){case Tu:return t=0,!1;case xu:return t=1,!1;case Qu:case Bu:return A=0,!1;case yu:return A=1,!1;case Cu:return A=2,!1;case bu:case vu:return A=3,!1}else if(WA(g)||bt(g))return Array.isArray(A)||(A=[]),A.push(g),!1;return h},l)),l){var c=Gn(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},YB=function(i){return i.type===1},qB=function(i){return i.type===2},sa={name:"image",parse:function(i,e){if(e.type===22){var t={url:e.value,type:0};return i.cache.addImage(e.value),t}if(e.type===18){var A=Fu[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 jB(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Fu[i.name])}var Fu={"linear-gradient":XB,"-moz-linear-gradient":$n,"-ms-linear-gradient":$n,"-o-linear-gradient":$n,"-webkit-linear-gradient":$n,"radial-gradient":JB,"-moz-radial-gradient":Xn,"-ms-radial-gradient":Xn,"-o-radial-gradient":Xn,"-webkit-radial-gradient":Xn,"-webkit-gradient":ZB},e2={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)&&jB(A)}).map(function(A){return sa.parse(i,A)})}},t2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(at(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},A2={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(ou)}},i2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return QA(e).map(function(t){return t.filter(at).map(function(A){return A.value}).join(" ")}).map(r2)}},r2=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 n2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return QA(e).map(function(t){return t.filter(s2)})}},s2=function(i){return at(i)||bt(i)},Zn=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},o2=Zn("top"),a2=Zn("right"),l2=Zn("bottom"),c2=Zn("left"),Jn=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return ou(t.filter(bt))}}},h2=Jn("top-left"),u2=Jn("top-right"),d2=Jn("bottom-right"),p2=Jn("bottom-left"),Yn=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}}},f2=Yn("top"),g2=Yn("right"),m2=Yn("bottom"),w2=Yn("left"),qn=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return yr(t)?t.number:0}}},B2=qn("top"),y2=qn("right"),C2=qn("bottom"),v2=qn("left"),T2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},x2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},b2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(at).reduce(function(t,A){return t|Q2(A.value)},0)}},Q2=function(i){switch(i){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},F2={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}},U2={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}},jn;(function(i){i.NORMAL="normal",i.STRICT="strict"})(jn||(jn={}));var S2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?jn.STRICT:jn.NORMAL}},E2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Uu=function(i,e){return at(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:bt(i)?ut(i,e):e},L2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:sa.parse(i,e)}},M2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},oa={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}}},es=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},H2=es("top"),I2=es("right"),D2=es("bottom"),_2=es("left"),P2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(at).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}})}},k2={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},ts=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},N2=ts("top"),O2=ts("right"),K2=ts("bottom"),V2=ts("left"),z2={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}}},W2={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}},R2={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&ia(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})}},G2={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}},$2={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=J2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},X2=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Z2=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},J2={matrix:X2,matrix3d:Z2},Su={type:16,number:50,flags:fr},Y2=[Su,Su],q2={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(bt);return t.length!==2?Y2:[t[0],t[1]]}},j2={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 ey={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}}},ty={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")}},Eu={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")}},Ay={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Ei(e)?e.number:1}},iy={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ry={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(at).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})}},ny={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+"'"})}},sy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},oy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Ei(e)?e.number:at(e)&&e.value==="bold"?700:400}},ay={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(at).map(function(t){return t.value})}},ly={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},cy={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}},hy={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var A=[],r=e.filter(su),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Ei(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},uy={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(su),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(at(n)&&n.value!=="none"){var o=s&&Ei(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},dy={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(yr).map(function(t){return Eu.parse(i,t)})}},py={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(OB);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}},Lu=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},fy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&ia(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];ia(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})}},gy={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(at).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}},my={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},wy={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return yr(e)?e.number:0}},By=(function(){function i(e,t){var A,r;this.animationDuration=Oe(e,dy,t.animationDuration),this.backgroundClip=Oe(e,zB,t.backgroundClip),this.backgroundColor=Oe(e,WB,t.backgroundColor),this.backgroundImage=Oe(e,e2,t.backgroundImage),this.backgroundOrigin=Oe(e,t2,t.backgroundOrigin),this.backgroundPosition=Oe(e,A2,t.backgroundPosition),this.backgroundRepeat=Oe(e,i2,t.backgroundRepeat),this.backgroundSize=Oe(e,n2,t.backgroundSize),this.borderTopColor=Oe(e,o2,t.borderTopColor),this.borderRightColor=Oe(e,a2,t.borderRightColor),this.borderBottomColor=Oe(e,l2,t.borderBottomColor),this.borderLeftColor=Oe(e,c2,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,h2,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,u2,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,d2,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,p2,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,f2,t.borderTopStyle),this.borderRightStyle=Oe(e,g2,t.borderRightStyle),this.borderBottomStyle=Oe(e,m2,t.borderBottomStyle),this.borderLeftStyle=Oe(e,w2,t.borderLeftStyle),this.borderTopWidth=Oe(e,B2,t.borderTopWidth),this.borderRightWidth=Oe(e,y2,t.borderRightWidth),this.borderBottomWidth=Oe(e,C2,t.borderBottomWidth),this.borderLeftWidth=Oe(e,v2,t.borderLeftWidth),this.boxShadow=Oe(e,fy,t.boxShadow),this.color=Oe(e,T2,t.color),this.direction=Oe(e,x2,t.direction),this.display=Oe(e,b2,t.display),this.float=Oe(e,F2,t.cssFloat),this.fontFamily=Oe(e,ny,t.fontFamily),this.fontSize=Oe(e,sy,t.fontSize),this.fontStyle=Oe(e,ly,t.fontStyle),this.fontVariant=Oe(e,ay,t.fontVariant),this.fontWeight=Oe(e,oy,t.fontWeight),this.letterSpacing=Oe(e,U2,t.letterSpacing),this.lineBreak=Oe(e,S2,t.lineBreak),this.lineHeight=Oe(e,E2,t.lineHeight),this.listStyleImage=Oe(e,L2,t.listStyleImage),this.listStylePosition=Oe(e,M2,t.listStylePosition),this.listStyleType=Oe(e,oa,t.listStyleType),this.marginTop=Oe(e,H2,t.marginTop),this.marginRight=Oe(e,I2,t.marginRight),this.marginBottom=Oe(e,D2,t.marginBottom),this.marginLeft=Oe(e,_2,t.marginLeft),this.opacity=Oe(e,Ay,t.opacity);var n=Oe(e,P2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,k2,t.overflowWrap),this.paddingTop=Oe(e,N2,t.paddingTop),this.paddingRight=Oe(e,O2,t.paddingRight),this.paddingBottom=Oe(e,K2,t.paddingBottom),this.paddingLeft=Oe(e,V2,t.paddingLeft),this.paintOrder=Oe(e,gy,t.paintOrder),this.position=Oe(e,W2,t.position),this.textAlign=Oe(e,z2,t.textAlign),this.textDecorationColor=Oe(e,iy,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Oe(e,ry,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,R2,t.textShadow),this.textTransform=Oe(e,G2,t.textTransform),this.transform=Oe(e,$2,t.transform),this.transformOrigin=Oe(e,q2,t.transformOrigin),this.visibility=Oe(e,j2,t.visibility),this.webkitTextStrokeColor=Oe(e,my,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,wy,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,ey,t.wordBreak),this.zIndex=Oe(e,ty,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})(),yy=(function(){function i(e,t){this.content=Oe(e,cy,t.content),this.quotes=Oe(e,py,t.quotes)}return i})(),Mu=(function(){function i(e,t){this.counterIncrement=Oe(e,hy,t.counterIncrement),this.counterReset=Oe(e,uy,t.counterReset)}return i})(),Oe=function(i,e,t){var A=new ru,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new nu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,at(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 Rn.parse(i,n.parseComponentValue());case"color":return GA.parse(i,n.parseComponentValue());case"image":return sa.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 Eu.parse(i,n.parseComponentValue())}break}},Cy="data-html2canvas-debug",vy=function(i){var e=i.getAttribute(Cy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},aa=function(i,e){var t=vy(i);return t===1||e===t},FA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,aa(t,3))debugger;this.styles=new By(e,window.getComputedStyle(t,null)),va(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=bn(this.context,t),aa(t,4)&&(this.flags|=16)}return i})(),Ty="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Hu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256),As=0;As<Hu.length;As++)xr[Hu.charCodeAt(As)]=As;for(var xy=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),h=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)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},by=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Qy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},pi=5,la=11,ca=2,Fy=la-pi,Iu=65536>>pi,Uy=1<<pi,ha=Uy-1,Sy=1024>>pi,Ey=Iu+Sy,Ly=Ey,My=32,Hy=Ly+My,Iy=65536>>la,Dy=1<<Fy,_y=Dy-1,Du=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Py=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},ky=function(i,e){var t=xy(i),A=Array.isArray(t)?Qy(t):new Uint32Array(t),r=Array.isArray(t)?by(t):new Uint16Array(t),n=24,s=Du(r,n/2,A[4]/2),o=A[5]===2?Du(r,(n+A[4])/2):Py(A,Math.ceil((n+A[4])/4));return new Ny(A[0],A[1],A[2],A[3],s,o)},Ny=(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<<ca)+(e&ha),this.data[t];if(e<=65535)return t=this.index[Iu+(e-55296>>pi)],t=(t<<ca)+(e&ha),this.data[t];if(e<this.highStart)return t=Hy-Iy+(e>>la),t=this.index[t],t+=e>>pi&_y,t=this.index[t],t=(t<<ca)+(e&ha),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),_u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oy=typeof Uint8Array>"u"?[]:new Uint8Array(256),is=0;is<_u.length;is++)Oy[_u.charCodeAt(is)]=is;var Ky=1,ua=2,da=3,Pu=4,ku=5,Vy=7,Nu=8,pa=9,fa=10,Ou=11,Ku=12,Vu=13,zu=14,ga=15,zy=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},Wy=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},Ry=ky(Ty),lA="×",ma="÷",Gy=function(i){return Ry.get(i)},$y=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===ua&&s===da)return lA;if(n===ua||n===da||n===Pu||s===ua||s===da||s===Pu)return ma;if(n===Nu&&[Nu,pa,Ou,Ku].indexOf(s)!==-1||(n===Ou||n===pa)&&(s===pa||s===fa)||(n===Ku||n===fa)&&s===fa||s===Vu||s===ku||s===Vy||n===Ky)return lA;if(n===Vu&&s===zu){for(;r===ku;)r=e[--A];if(r===zu)return lA}if(n===ga&&s===ga){for(var o=0;r===ga;)o++,r=e[--A];if(o%2===0)return lA}return ma},Xy=function(i){var e=zy(i),t=e.length,A=0,r=0,n=e.map(Gy);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=lA;A<t&&(s=$y(e,n,++A))===lA;);if(s!==lA||A===t){var o=Wy.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},Zy=function(i){for(var e=Xy(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},Jy=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},Yy=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=Qn(A.data).map(function(l){return yt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var h=t.getBoundingClientRect();n+=l.length;var g=h.x>s.x||h.y>s.y;return s=h,c===0?!0:g});return i.body.removeChild(e),o},qy=function(){return typeof new Image().crossOrigin<"u"},jy=function(){return typeof new XMLHttpRequest().responseType=="string"},eC=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},Wu=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},tC=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=wa(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),Ru(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",Wu(l)?Ru(wa(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),Wu(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},wa=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},Ru=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=Jy(document);return Object.defineProperty(Ht,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Ht.SUPPORT_RANGE_BOUNDS&&Yy(document);return Object.defineProperty(Ht,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=eC(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"?tC(document):Promise.resolve(!1);return Object.defineProperty(Ht,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=qy();return Object.defineProperty(Ht,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=jy();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})(),AC=function(i,e,t,A){var r=nC(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=Gu(A,s,o.length).getClientRects();if(l.length>1){var c=Ba(o),h=0;c.forEach(function(C){n.push(new br(C,IA.fromDOMRectList(i,Gu(A,h+s,C.length).getClientRects()))),h+=C.length})}else n.push(new br(o,IA.fromDOMRectList(i,l)))}else{var g=A.splitText(o.length);n.push(new br(o,iC(i,A))),A=g}else Ht.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},iC=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=bn(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return IA.EMPTY},Gu=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(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 Zy(i)},rC=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 oC(i,e)},nC=function(i,e){return e.letterSpacing!==0?Ba(i):rC(i,e)},sC=[32,160,4961,65792,65793,4153,4241],oC=function(i,e){for(var t=Iw(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=Qn(s),l="";o.forEach(function(c){sC.indexOf(c)===-1?l+=yt(c):(l.length&&A.push(l),A.push(yt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},aC=(function(){function i(e,t,A){this.text=lC(t.data,A.textTransform),this.textBounds=AC(e,this.text,A,t)}return i})(),lC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(cC,hC);case 2:return i.toUpperCase();default:return i}},cC=/(^|\s|:|-|\(|\))([a-z])/g,hC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},$u=(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),Xu=(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),Zu=(function(i){gA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=bn(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),ya=(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),uC=[{type:15,flags:0,unit:"px",number:3}],dC=[{type:16,flags:0,number:50}],pC=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},fC=function(i){var e=i.type===gC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},rs="checkbox",ns="radio",gC="password",Yu=707406591,Ca=(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=fC(A),(r.type===rs||r.type===ns)&&(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=pC(r.bounds)),r.type){case rs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=uC;break;case ns:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=dC;break}return r}return e})(FA),qu=(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),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),ed=(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=Ad(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),mC=["OL","UL","MENU"],ss=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,id(r)&&r.data.trim().length>0)t.textNodes.push(new aC(i,r,t.styles));else if(Hi(r))if(ld(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return ss(i,o,t,A)});else{var s=td(i,r);s.styles.isVisible()&&(wC(r,s,A)?s.flags|=4:BC(s.styles)&&(s.flags|=2),mC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?ss(i,r.shadowRoot,s,A):!as(r)&&!rd(r)&&!ls(r)&&ss(i,r,s,A))}},td=function(i,e){return xa(e)?new $u(i,e):nd(e)?new Xu(i,e):rd(e)?new Zu(i,e):yC(e)?new Ju(i,e):CC(e)?new ya(i,e):vC(e)?new Ca(i,e):ls(e)?new qu(i,e):as(e)?new ju(i,e):od(e)?new ed(i,e):new FA(i,e)},Ad=function(i,e){var t=td(i,e);return t.flags|=4,ss(i,e,t,t),t},wC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ta(i)&&t.styles.isTransparent()},BC=function(i){return i.isPositioned()||i.isFloating()},id=function(i){return i.nodeType===Node.TEXT_NODE},Hi=function(i){return i.nodeType===Node.ELEMENT_NODE},va=function(i){return Hi(i)&&typeof i.style<"u"&&!os(i)},os=function(i){return typeof i.className=="object"},yC=function(i){return i.tagName==="LI"},CC=function(i){return i.tagName==="OL"},vC=function(i){return i.tagName==="INPUT"},TC=function(i){return i.tagName==="HTML"},rd=function(i){return i.tagName==="svg"},Ta=function(i){return i.tagName==="BODY"},nd=function(i){return i.tagName==="CANVAS"},sd=function(i){return i.tagName==="VIDEO"},xa=function(i){return i.tagName==="IMG"},od=function(i){return i.tagName==="IFRAME"},ad=function(i){return i.tagName==="STYLE"},xC=function(i){return i.tagName==="SCRIPT"},as=function(i){return i.tagName==="TEXTAREA"},ls=function(i){return i.tagName==="SELECT"},ld=function(i){return i.tagName==="SLOT"},cd=function(i){return i.tagName.indexOf("-")>0},bC=(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})(),hd={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"]},ud={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},QC={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},FC={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},dd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},Ct=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(dd(Math.abs(i),n,A,function(s){return yt(Math.floor(s%n)+e)})+r)},fi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return dd(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},pd="十百千萬",fd="拾佰仟萬",gd="マイナス",ba="마이너스",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=Ct(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,hd,3,A).toLowerCase();case 7:return Ii(i,1,3999,hd,3,A);case 8:return Ct(i,945,969,!1,A);case 9:return Ct(i,97,122,!1,A);case 10:return Ct(i,65,90,!1,A);case 11:return Ct(i,1632,1641,!0,A);case 12:case 49:return Ii(i,1,9999,ud,3,A);case 35:return Ii(i,1,9999,ud,3,A).toLowerCase();case 13:return Ct(i,2534,2543,!0,A);case 14:case 30:return Ct(i,6112,6121,!0,A);case 15:return fi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return fi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return PA(i,"零一二三四五六七八九",pd,"負",r,ZA|JA|Qr);case 47:return PA(i,"零壹貳參肆伍陸柒捌玖",fd,"負",r,Di|ZA|JA|Qr);case 42:return PA(i,"零一二三四五六七八九",pd,"负",r,ZA|JA|Qr);case 41:return PA(i,"零壹贰叁肆伍陆柒捌玖",fd,"负",r,Di|ZA|JA|Qr);case 26:return PA(i,"〇一二三四五六七八九","十百千万",gd,r,0);case 25:return PA(i,"零壱弐参四伍六七八九","拾百千万",gd,r,Di|ZA|JA);case 31:return PA(i,"영일이삼사오육칠팔구","십백천만",ba,n,Di|ZA|JA);case 33:return PA(i,"零一二三四五六七八九","十百千萬",ba,n,0);case 32:return PA(i,"零壹貳參四五六七八九","拾百千",ba,n,Di|ZA|JA);case 18:return Ct(i,2406,2415,!0,A);case 20:return Ii(i,1,19999,FC,3,A);case 21:return Ct(i,2790,2799,!0,A);case 22:return Ct(i,2662,2671,!0,A);case 22:return Ii(i,1,10999,QC,3,A);case 23:return fi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return fi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ct(i,3302,3311,!0,A);case 28:return fi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return fi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Ct(i,3792,3801,!0,A);case 37:return Ct(i,6160,6169,!0,A);case 38:return Ct(i,4160,4169,!0,A);case 39:return Ct(i,2918,2927,!0,A);case 40:return Ct(i,1776,1785,!0,A);case 43:return Ct(i,3046,3055,!0,A);case 44:return Ct(i,3174,3183,!0,A);case 45:return Ct(i,3664,3673,!0,A);case 46:return Ct(i,3872,3881,!0,A);default:return Ct(i,48,57,!0,A)}},md="data-html2canvas-ignore",wd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new bC,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=UC(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=LC(r).then(function(){return Wt(A,void 0,void 0,function(){var h,g;return Nt(this,function(C){switch(C.label){case 0:return this.scrolledElements.forEach(DC),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,g=this.clonedReferenceElement,typeof g>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:C.sent(),C.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,EC(l)]:[3,4];case 3:C.sent(),C.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(l,g)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(HC(document.doctype)+"<html></html>"),IC(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(aa(e,2))debugger;if(nd(e))return this.createCanvasClone(e);if(sd(e))return this.createVideoClone(e);if(ad(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return xa(t)&&(xa(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),cd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Qa(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)||!xC(t)&&!t.hasAttribute(md)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Hi(t)||!ad(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)&&ld(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(id(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Hi(e)&&(va(e)||os(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&&va(r)&&(this.clonedReferenceElement=r),Ta(r)&&kC(r);var l=this.counters.parse(new Mu(this.context,n)),c=this.resolvePseudoContent(e,r,s,Ur.BEFORE);cd(e)&&(t=!0),sd(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var h=this.resolvePseudoContent(e,r,o,Ur.AFTER);return h&&r.appendChild(h),this.counters.pop(l),(n&&(this.options.copyStyles||os(e))&&!od(e)||t)&&Qa(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(as(e)||ls(e))&&(as(r)||ls(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 Mu(this.context,A));var l=new yy(this.context,A),c=o.createElement("html2canvaspseudoelement");Qa(A,c),l.content.forEach(function(g){if(g.type===0)c.appendChild(o.createTextNode(g.value));else if(g.type===22){var C=o.createElement("img");C.src=g.value,C.style.opacity="1",c.appendChild(C)}else if(g.type===18){if(g.name==="attr"){var x=g.values.filter(at);x.length&&c.appendChild(o.createTextNode(e.getAttribute(x[0].value)||""))}else if(g.name==="counter"){var b=g.values.filter(Li),v=b[0],U=b[1];if(v&&at(v)){var F=n.counters.getCounterValue(v.value),M=U&&at(U)?oa.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Fr(F,M,!1)))}}else if(g.name==="counters"){var N=g.values.filter(Li),v=N[0],R=N[1],U=N[2];if(v&&at(v)){var L=n.counters.getCounterValues(v.value),z=U&&at(U)?oa.parse(n.context,U.value):3,q=R&&R.type===0?R.value:"",$=L.map(function(te){return Fr(te,z,!1)}).join(q);c.appendChild(o.createTextNode($))}}}else if(g.type===20)switch(g.value){case"open-quote":c.appendChild(o.createTextNode(Lu(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Lu(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(g.value))}}),c.className=Fa+" "+Ua;var h=r===Ur.BEFORE?" "+Fa:" "+Ua;return os(t)?t.className.baseValue+=h:t.className+=h,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 UC=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(md,"true"),i.body.appendChild(t),t},SC=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},EC=function(i){return Promise.all([].slice.call(i.images,0).map(SC))},LC=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)}})},MC=["all","d","content"],Qa=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);MC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},HC=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},IC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},DC=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},_C=":before",PC=":after",Fa="___html2canvas___pseudoelement_before",Ua="___html2canvas___pseudoelement_after",Bd=`{
1
+ (function(et,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(et=typeof globalThis<"u"?globalThis:et||self,a(et.ChartSDK={},et.jsxRuntime,et.React))})(this,(function(et,a,j){"use strict";var Qs=typeof document<"u"?document.currentScript:null;const _t="17:00-17:00",kt="America/New_York",yA="24x7",CA="UTC",Xa={EURUSD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},ETHUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},BNBUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},SOLUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},ADAUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},XRPUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},DOTUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},MATICUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"},LINKUSDT:{type:"crypto",session:yA,sessionTZ:CA,priceMode:"last"}},Za={type:"forex",sessionTZ:kt,session:_t,priceMode:"mid"};function zi(i){return i&&Xa[i.toUpperCase()]||Za}function Bp(i){return zi(i).type==="forex"}function yp(i){return zi(i).type==="crypto"}function Cp(i){return zi(i).session==="24x7"}function ie(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 vp(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 xp(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 Ja(i){return Array.isArray(i)?i.map(e=>({...e,time:ie(e.time)})).filter(e=>e.time!=null):[]}function Tp(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 ze(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function Ya(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(ie(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 qa(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=ie(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 bp(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],h=c-l;r=l-1.5*h,n=c+1.5*h}else{const s=t.reduce((c,h)=>c+h,0)/t.length,o=t.reduce((c,h)=>c+Math.pow(h-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 Qp(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,h=c-l;if(h>A&&((h/3600).toFixed(1),(A/3600).toFixed(1)),h>e&&h<=A){const d=i[o];let y=l+e,Q=0;for(y=ze(y,e);y<c&&Q<r;){const b=ze(y,e);t.some(U=>U.time===b)||(t.push({time:b,open:d.close,high:d.close,low:d.close,close:d.close,volume:0}),Q++),y+=e}if(y<c&&Q>=r){const b=ze(c-e,e);t.some(U=>U.time===b)||t.push({time:b,open:d.close,high:d.close,low:d.close,close:d.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 el(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=zi(e),r=iA(t),o=Ja(i).map(U=>({...U,time:ze(U.time,r)})).filter(U=>Ya(U)).map(U=>qa(U)),l=ja(o);l.sort((U,M)=>U.time-M.time);const c=l.filter((U,M)=>M===0?!0:U.time>l[M-1].time),h=c.length>10?bp(c,"percentile"):c,d=ja(h);d.sort((U,M)=>U.time-M.time);const y=Qp(d,r),Q=[];for(let U=1;U<y.length;U++){const M=y[U].time-y[U-1].time;M>r*2&&Q.push({from:y[U-1].time,to:y[U].time,gapSeconds:M,gapMinutes:Math.round(M/60),fromDate:new Date(y[U-1].time*1e3).toISOString(),toDate:new Date(y[U].time*1e3).toISOString()})}const b=h.filter((U,M)=>M===0?!1:U.close===h[M-1].close&&U.open===h[M-1].close).length,C={original:i.length,processed:y.length,duplicates:i.length-l.length,outliers:b,gaps:Q,filledGaps:y.length-d.length,symbolConfig:A};return{candles:y,stats:C}}function tl(i,e,t="1m"){if(!i||!e||!Ya(i))return null;const A=ie(i.time);if(A==null)return null;const r=iA(t),n=ze(A,r);return qa({...i,time:n})}function wt(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 Ai(i,e){return i.width===e.width&&i.height===e.height}var Fp=(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 Up(i){return new Fp(i)}var Sp=(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=wt({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 wt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=wt(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;Ai(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=wt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=Ai(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&Ai(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}Lp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=Al(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Up(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=Al(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?Mp(n[0],r):wt({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=wt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function Ep(i,e){return new Sp(i,e.transform,e.options)}function Al(i){return i.ownerDocument.defaultView}function Lp(){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 Mp(i,e){return wt({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 Hp=(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 ii(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 Hp(r,t,A)}const Ip={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Pp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Dp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},_p={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},kp={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Np={color:"#26a69a",base:0},il={color:"#2196f3"},rl={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 nl,sl;function ri(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 ol(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 OA(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function zt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Ue(i){if(i===null)throw new Error("Value is null");return i}function yi(i){return Ue(zt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(nl||(nl={})),(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"})(sl||(sl={}));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 sA(i){return i<0?0:i>255?255:Math.round(i)||0}function ll(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const Op=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Kp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Vp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,zp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function Wi(i){(i=i.toLowerCase())in al&&(i=al[i]);{const e=zp.exec(i)||Vp.exec(i);if(e)return[sA(parseInt(e[1],10)),sA(parseInt(e[2],10)),sA(parseInt(e[3],10)),ll(e.length<5?1:parseFloat(e[4]))]}{const e=Kp.exec(i);if(e)return[sA(parseInt(e[1],16)),sA(parseInt(e[2],16)),sA(parseInt(e[3],16)),1]}{const e=Op.exec(i);if(e)return[sA(17*parseInt(e[1],16)),sA(17*parseInt(e[2],16)),sA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function cl(i){return .199*i[0]+.687*i[1]+.114*i[2]}function kr(i){const e=Wi(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:cl(e)>160?"black":"white"}}class xt{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 pA(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]:pA(i[A],t[A]));return i}function vA(i){return typeof i=="number"&&isFinite(i)}function Ri(i){return typeof i=="number"&&i%1==0}function Gi(i){return typeof i=="string"}function Nr(i){return typeof i=="boolean"}function IA(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"?IA(r):r);return t}function Wp(i){return i!==null}function $i(i){return i===null?void 0:i}const Fs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Ci(i,e,t){return e===void 0&&(e=Fs),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Rp{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=Ci(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 Us{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class fA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class Gp extends fA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const h=n.it[c],d=Math.round(h.nt*t)+s,y=h.st*A,Q=l*A+s;e.moveTo(d,y),e.arc(d,y,Q,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 $p(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Xp={from:0,to:1};class Zp{constructor(e,t){this.ut=new Us,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($p),this.ct=this.dt.map((A=>{const r=new Gp;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 h=Ue(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,h.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=A,l.it[0].nt=r.It(A),l.tt=Xp}))}}let Jp=class extends fA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*A),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*A),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,ri(e,this.zt.Lt.Nt),(function(c,h,d,y){c.beginPath();const Q=c.lineWidth%2?.5:0;c.moveTo(h+Q,d),c.lineTo(h+Q,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,ri(e,this.zt.Et.Nt),ol(e,l,0,t.width))}};class Yp{constructor(e){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,V:"",yt:!1},Et:{et:1,Nt:0,V:"",yt:!1},nt:0,st:0},this.Wt=new Jp(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),t=Ue(this.jt.Ht()),A=t.$t().W().crosshair,r=this.Ft;if(A.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=A.horzLine.width,r.Et.Nt=A.horzLine.style,r.Et.V=A.horzLine.color,r.Lt.et=A.vertLine.width,r.Lt.Nt=A.vertLine.style,r.Lt.V=A.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function qp(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 hl(i,e,t,A,r,n){i.beginPath(),i.roundRect?i.roundRect(e,t,A,r,n):(i.lineTo(e+A-n[1],t),n[1]!==0&&i.arcTo(e+A,t,e+A,t+n[1],n[1]),i.lineTo(e+A,t+r-n[2]),n[2]!==0&&i.arcTo(e+A,t+r,e+A-n[2],t+r,n[2]),i.lineTo(e+n[3],t+r),n[3]!==0&&i.arcTo(e,t+r,e,t+r-n[3],n[3]),i.lineTo(e,t+n[0]),n[0]!==0&&i.arcTo(e,t,e+n[0],t,n[0]))}function ul(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return hl(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var h;hl(i,e+c,t+c,A-s,r-s,(h=-c,o.map((d=>d===0?d:d+h)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function dl(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 pl{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 h=this.Gt(l,t,A,r),d=h.Jt;return h.Qt?ul(c,d.ti,d.ii,d.ni,d.si,s,d.ei,[d.ht,0,0,d.ht],s):ul(c,d.ri,d.ii,d.ni,d.si,s,d.ei,[0,d.ht,d.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(d.ri,d.li,d.ai-d.ri,d.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(h.Qt?d.ui-d.ei:0,d.ii,d.ei,d.ci-d.ii)),h}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:h}=e,d=this.zt.hi||!this.zt.mi?t.T:0,y=this.zt.bi?t.C:0,Q=t.L+this.Xt.wi,b=t.B+this.Xt.gi,C=t.A,U=t.I,M=this.zt.Kt,E=t.P,I=A.Mi(s,M),R=Math.ceil(A.xi(s,M)),L=E+Q+b,O=t.C+C+U+R+d,Y=Math.max(1,Math.floor(h));let X=Math.round(L*h);X%2!=Y%2&&(X+=1);const Ae=y>0?Math.max(1,Math.floor(y*c)):0,oe=Math.round(O*c),W=Math.round(d*c),ce=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,$=Math.round(ce*h)-Math.floor(.5*h),Be=Math.floor($+Y/2-X/2),Ce=Be+X,ee=r==="right",Z=ee?l.width-y:y,re=ee?o.width-Ae:Ae;let fe,we,ve;return ee?(fe=re-oe,we=re-W,ve=Z-d-C-y):(fe=re+oe,we=re+W,ve=Z+d+C),{Qt:ee,Jt:{ii:Be,li:$,ci:Ce,ni:oe,si:X,ht:2*c,ei:Ae,ti:fe,ri:re,ai:we,oi:Y,ui:o.width},di:{ii:Be/h,ci:Ce/h,fi:ve,pi:I}}}}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||pl)(this.Ci,this.yi),this.Ri=new(e||pl)(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 jp 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 ef=/[1-9]/g;class fl{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,Ue(this.zt).Kt,ef)))));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 h=c+n,d=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:y,horizontalPixelRatio:Q,verticalPixelRatio:b})=>{const C=Ue(this.zt);y.fillStyle=C.t;const U=Math.round(c*Q),M=Math.round(0*b),E=Math.round(h*Q),I=Math.round(d*b),R=Math.round(2*Q);if(y.beginPath(),y.moveTo(U,M),y.lineTo(U,I-R),y.arcTo(U,I,U+R,I,R),y.lineTo(E-R,I),y.arcTo(E,I,E,I-R,R),y.lineTo(E,M),y.fill(),C.hi){const L=Math.round(C.ki*Q),O=M,Y=Math.round((O+t.T)*b);y.fillStyle=C.V;const X=Math.max(1,Math.floor(Q)),Ae=Math.floor(.5*Q);y.fillRect(L-Ae,O,X,Y-O)}})),e.useMediaCoordinateSpace((({context:y})=>{const Q=Ue(this.zt),b=0+t.C+t.T+t.L+t.P/2;y.font=t.R,y.textAlign="left",y.textBaseline="middle",y.fillStyle=Q.V;const C=t.Wi.Mi(y,"Apr0");y.translate(c+r,b+C),y.fillText(Q.Kt,0,0)}))}}class tf{constructor(e,t,A){this.ft=!0,this.Wt=new fl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Ue(n)),e.yt=!0;const s=kr(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Ss{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 gl;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(gl||(gl={}));class Af extends Ss{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 Zp(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Ue(this.tn).vn())return{_t:l,ki:o};{const c=Ue(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new tf(this,e,A),this.wn=new Yp(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 h=c!==null?c.Ct():null;return c!==null&&h!==null?(this.nn=t,this.an=c.Rt(t,h)):(this.nn=NaN,this.an=NaN),r!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter(Wp),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 jp(this,t,A),e.set(t,r)),r}}function Vr(i){return i==="left"||i==="right"}class It{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 It(2)}static es(){return new It(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 ml=".";function PA(i,e){if(!vA(i))return"n/a";if(!Ri(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),vA(e)&&Ri(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=ml+PA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=ml+PA(0,n));return A.toFixed(0)+r}}class wl extends zr{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class rf{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 Bl(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,h=e[A.from];let d=n(i,h),y=h;if(A.to-A.from<2){const Q=r/2;o.beginPath();const b={nt:h.nt-Q,st:h.st},C={nt:h.nt+Q,st:h.st};o.moveTo(b.nt*l,b.st*c),o.lineTo(C.nt*l,C.st*c),s(i,d,b,C)}else{const Q=(C,U)=>{s(i,d,y,U),o.beginPath(),d=C,y=U};let b=y;o.beginPath(),o.moveTo(h.nt*l,h.st*c);for(let C=A.from+1;C<A.to;++C){b=e[C];const U=n(i,b);switch(t){case 0:o.lineTo(b.nt*l,b.st*c);break;case 1:o.lineTo(b.nt*l,e[C-1].st*c),U!==d&&(Q(U,b),o.lineTo(b.nt*l,e[C-1].st*c)),o.lineTo(b.nt*l,b.st*c);break;case 2:{const[M,E]=nf(e,C-1,C);o.bezierCurveTo(M.nt*l,M.st*c,E.nt*l,E.st*c,b.nt*l,b.st*c);break}}t!==1&&U!==d&&(Q(U,b),o.moveTo(b.nt*l,b.st*c))}(y!==b||y===b&&t===1)&&s(i,d,y,b)}}const yl=6;function Es(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Cl(i,e){return{nt:i.nt/e,st:i.st/e}}function nf(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=Cl(Es(i[t],i[A]),yl),{nt:n.nt+s.nt,st:n.st+s.st}),Es(i[t],Cl(Es(i[r],i[e]),yl))]}function sf(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 vl extends fA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:A,tt:r,ds:n,et:s,Nt:o,fs:l}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(r===null)return;const h=e.context;h.lineCap="butt",h.lineJoin="round",h.lineWidth=s,ri(h,o),h.lineWidth=1,Bl(e,A,l,r,n,this.bs.bind(this),sf.bind(null,c))}}function Ls(i,e,t){return Math.min(Math.max(i,e),t)}function Wr(i,e,t){return e-i<=t}function xl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Ms{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 h=e.context.createLinearGradient(0,0,0,l);if(h.addColorStop(0,r),c!=null){const d=Ls(c*e.verticalPixelRatio/l,0,1);h.addColorStop(d,n),h.addColorStop(d,s)}h.addColorStop(1,o),this.Cs=h,this.gs=t}return this.Cs}}class of extends vl{constructor(){super(...arguments),this.Ts=new Ms}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function af(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class Tl extends fA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,ri(c,o),c.lineJoin="round";const h=this.Vs.bind(this);n!==void 0&&Bl(e,t,n,A,r,h,af),l&&(function(d,y,Q,b,C){const{horizontalPixelRatio:U,verticalPixelRatio:M,context:E}=d;let I=null;const R=Math.max(1,Math.floor(U))%2/2,L=Q*M+R;for(let O=b.to-1;O>=b.from;--O){const Y=y[O];if(Y){const X=C(d,Y);X!==I&&(E.beginPath(),I!==null&&E.fill(),E.fillStyle=X,I=X);const Ae=Math.round(Y.nt*U)+R,oe=Y.st*M;E.moveTo(Ae,oe),E.arc(Ae,oe,L,0,2*Math.PI)}}E.fill()})(e,t,l,A,h)}}class bl extends Tl{Vs(e,t){return t.lt}}function Ql(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 Xi=Ql.bind(null,!0),Fl=Ql.bind(null,!1);function lf(i,e){return i.ot<e}function cf(i,e){return e<i.ot}function Ul(i,e,t){const A=e.Os(),r=e.ui(),n=Xi(i,A,lf),s=Fl(i,r,cf);if(!t)return{from:n,to:s};let o=n,l=s;return n>0&&n<i.length&&i[n].ot>=A&&(o=n-1),s>0&&s<i.length&&i[s-1].ot<=r&&(l=s+1),{from:o,to:l}}class Hs{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=Ul(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class Rr extends Hs{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,$i(this.Ls)),e.te(this.zs,A,$i(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 hf extends Rr{constructor(e,t){super(e,t),this.js=new Us,this.re=new of,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 uf extends fA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),h=c-l,d=this.oe,y=h+d-1,Q=Math.min(o.de,o.fe),b=Math.max(o.de,o.fe),C=Math.round(Q*A)-l,U=Math.round(b*A)+l,M=Math.max(U-C,this.oe);e.fillRect(h,C,d,M);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const O=c-E;let Y=Math.max(C,Math.round(o.pe*A)-l),X=Y+d-1;X>C+M-1&&(X=C+M-1,Y=X-d+1),e.fillRect(O,Y,h-O,X-Y+1)}const I=c+E;let R=Math.max(C,Math.round(o.me*A)-l),L=R+d-1;L>C+M-1&&(L=C+M-1,R=L-d+1),e.fillRect(y+1,R,I-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)})(Ue(this.zt).le,e)))}}class Sl extends Hs{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,$i(this.Ls)),e.be(this.zs,A,$i(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 df extends Sl{constructor(){super(...arguments),this.js=new uf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class pf extends vl{constructor(){super(...arguments),this.Ts=new Ms}bs(e,t){const A=this.G;return this.Ts.ws(e,{Ms:t.ke,xs:t.ye,Ss:t.Ce,ks:t.Te,ys:e.bitmapSize.height,vs:A.vs})}}class ff extends Tl{constructor(){super(...arguments),this.Pe=new Ms}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 gf extends Rr{constructor(e,t){super(e,t),this.js=new Us,this.Ve=new pf,this.Oe=new ff,this.js.Z([this.Ve,this.Oe])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const t=this.Es.W(),A=this.Es.Dt().Rt(t.baseValue.price,e.Vt),r=this.Ns.St().le();this.Ve.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineType,vs:A,ps:!1,tt:this.Ls,ds:r}),this.Oe.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,vs:A,tt:this.Ls,ds:r})}}class mf extends fA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),l=Math.floor(n*o*s),c=Math.floor(n*s),h=Math.min(l,c);return Math.max(Math.floor(s),h)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const 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 h=null;for(let d=A.from;d<A.to;d++){const y=t[d];y.Ee!==o&&(r.fillStyle=y.Ee,o=y.Ee);const Q=Math.round(Math.min(y.pe,y.me)*s),b=Math.round(Math.max(y.pe,y.me)*s),C=Math.round(y.de*s),U=Math.round(y.fe*s);let M=Math.round(n*y.nt)-c;const E=M+l-1;h!==null&&(M=Math.max(h+1,M),M=Math.min(M,E));const I=E-M+1;r.fillRect(M,C,I,Q-C),r.fillRect(M,b+1,I,U-b),h=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 h=A.from;h<A.to;h++){const d=t[h];d.Ne!==o&&(r.fillStyle=d.Ne,o=d.Ne);let y=Math.round(d.nt*n)-Math.floor(.5*this.ae);const Q=y+this.ae-1,b=Math.round(Math.min(d.pe,d.me)*s),C=Math.round(Math.max(d.pe,d.me)*s);if(c!==null&&(y=Math.max(c+1,y),y=Math.min(y,Q)),this.zt.le*n>2*l)qp(r,y,b,Q-y+1,C-b+1,l);else{const U=Q-y+1;r.fillRect(y,b,U,C-b+1)}c=Q}}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 h=t[c];let d=Math.round(Math.min(h.pe,h.me)*s),y=Math.round(Math.max(h.pe,h.me)*s),Q=Math.round(h.nt*n)-Math.floor(.5*this.ae),b=Q+this.ae-1;if(h.ce!==o){const C=h.ce;r.fillStyle=C,o=C}this.zt._i&&(Q+=l,d+=l,b-=l,y-=l),d>y||r.fillRect(Q,d,b-Q+1,y-d+1)}}}class wf extends Sl{constructor(){super(...arguments),this.js=new mf}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 Bf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Is extends Hs{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new Bf(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,$i(this.Ls))}Js(){this.wn.update({bars:this.zs.map(yf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function yf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class Cf extends fA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],h=Math.round(l.st*A);let d,y;e.fillStyle=l.ce,h<=n?(d=h,y=s):(d=n,y=h-Math.floor(r/2)+r),e.fillRect(c.Os,d,c.ui-c.Os+1,y-d)}}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 h=(A-1)/2;l=o-h,c=o+h}else{const h=A/2;l=o-h,c=o+h-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;r=Math.min(o,r)}if(t>0&&r<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class vf extends Rr{constructor(){super(...arguments),this.js=new Cf}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,Ue(this.Es.Ct()).Vt)};this.js.J(e)}}class xf 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 Tf=/[2-9]/g;class Zi{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||Tf,n=String(t).replace(r,"0");if(this.tr.has(n))return zt(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 bf{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 El{constructor(e,t,A){this.ur=e,this.ar=new Zi(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new bf(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 Qf extends fA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var A;if(!(!((A=this.zt)===null||A===void 0)&&A.yt))return null;const{st:r,et:n,gr:s}=this.zt;return t>=r-n-7&&t<=r+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*r);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),ri(e,this.zt.Nt),ol(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 Qf,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 Ff 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 Uf extends fA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){const r=this.zt;if(r===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(r.Xe.x*t)+s,l=r.Xe.y*A;e.fillStyle=r.Tr,e.beginPath();const c=Math.max(2,1.5*r.Pr)*t;e.arc(o,l,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=r.Rr,e.beginPath(),e.arc(o,l,r.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=r.Dr,e.beginPath(),e.arc(o,l,r.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const Sf=[{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 Ll(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=Wi(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Ml(i,e){const t=i%2600/2600;let A;for(const l of Sf)if(t>=l.Vr&&t<=l.Or){A=l;break}OA(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:Ll(e,r,A.Ir,A.zr),Dr:Ll(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class Ef{constructor(e){this.Wt=new Uf,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=Ml(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=Ml(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 Ji(i,e){return xl(Math.min(Math.max(i,12),30)*e)}function Yi(i,e){switch(i){case"arrowDown":case"arrowUp":return Ji(e,1);case"circle":return Ji(e,.8);case"square":return Ji(e,.7)}}function Hl(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(Ji(i,1))}function Il(i){return Math.max(Ji(i,.1),3)}function Pl(i,e,t){return e?i:t?Math.ceil(i/2):0}function Dl(i,e,t,A,r){const n=Yi("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function _l(i,e,t,A){const r=(Yi("arrowUp",A)-1)/2*t.Jr,n=(xl(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 Lf(i,e,t,A,r,n){return Dl(e,t,A,r,n)}class Mf extends fA{constructor(){super(...arguments),this.zt=null,this.ar=new Zi,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=Ci(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(If(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),Hf(o,e,t,A)}}}}function Hf(i,e,t,A){e.fillStyle=i.V,i.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,i.Kt.ih,i.Kt.nt,i.Kt.st,t,A),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void _l(!1,n,s,r.Ks);case"arrowUp":return void _l(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const h=(Yi("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,h*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const h=Yi("square",c),d=(h-1)*l.Jr/2,y=l.nt-d,Q=l.st-d;o.fillRect(y,Q,h*l.Jr,h*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 If(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 Lf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,h){const d=2+Yi("circle",l)/2,y=s-c,Q=o-h;return Math.sqrt(y*y+Q*Q)<=d})(A.nt,A.st,A.Ks,r,n);case"square":return Dl(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function Pf(i,e,t,A,r,n,s,o,l){const c=vA(t)?t:t.Se,h=vA(t)?t:t.Me,d=vA(t)?t:t.xe,y=vA(e.size)?Math.max(e.size,0):1,Q=Hl(o.le())*y,b=Q/2;switch(i.Ks=Q,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r));case"aboveBar":return i.st=s.Rt(h,l)-b-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-b-.6*r,A.sh+=1.2*r),void(A.sh+=Q+n);case"belowBar":return i.st=s.Rt(d,l)+b+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+b+n+.6*r,A.eh+=1.2*r),void(A.eh+=Q+n)}e.position}class Df{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Mf,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=Il(e),A=1.5*Hl(e)+2*t,r=this.fh();this.ah={above:Pl(A,r.aboveBar,r.inBar),below:Pl(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((h=>({ot:h.time,nt:0,st:0,Ks:0,nh:h.shape,V:h.color,th:h.th,gr:h.id,Kt:void 0}))),this.rh=!1);const r=this.$i.W().layout;this.zt.tt=null;const n=t.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=Il(t.le()),c={sh:l,eh:l};this.zt.tt=Ul(this.zt.it,n,!0);for(let h=this.zt.tt.from;h<this.zt.tt.to;h++){const d=A[h];d.time!==o&&(c.sh=l,c.eh=l,o=d.time);const y=this.zt.it[h];y.nt=t.It(d.time),d.text!==void 0&&d.text.length>0&&(y.Kt={ih:d.text,nt:0,st:0,Hi:0,At:0});const Q=this.jr.ph(d.time);Q!==null&&Pf(y,d,Q,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class _f 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 kf 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 h=r.mh(c.V),d=kr(h);A.t=d.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=h,e.V=d.i,t.V=d.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 kl(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 Zt{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 Zt(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 Zt(kl(Math.min,this.Ph(),e.Ph(),-1/0),kl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!vA(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){vA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new Zt(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(Zt.Ah(e.priceRange),e.margins)}}class Nf 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 Of 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 h=r.axisLabelTextColor||c.i;e.V=h,t.V=h,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Kf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Nf(e,this),this.ur=new Of(e,this),this.Hh=new El(this.ur,e,e.$t())}$h(e){pA(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 Vf extends Ss{constructor(e){super(),this.$i=e}$t(){return this.$i}}const zf={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Ue(i(t,A)),l=yi(o.Vt[0])<=yi(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,h=e.borderDownColor,d=e.wickUpColor,y=e.wickDownColor,Q=Ue(i(t,A)),b=yi(Q.Vt[0])<=yi(Q.Vt[3]);return{ce:(r=Q.V)!==null&&r!==void 0?r:b?o:l,Ne:(n=Q.Ot)!==null&&n!==void 0?n:b?c:h,Ee:(s=Q.Xh)!==null&&s!==void 0?s:b?d:y}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Ue(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Ue(i(t,A));return{ce:(r=l.lt)!==null&&r!==void 0?r:e.lineColor,lt:(n=l.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=l.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=l.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(i,e,t,A)=>{var r,n,s,o,l,c;const h=Ue(i(t,A));return{ce:h.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=h.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=h.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=h.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=h.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=h.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=h.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Ue(i(t,A));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(i,e,t,A)=>{var r;return{ce:(r=Ue(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class Wf{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=zf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var Nl;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(Nl||(Nl={}));const KA=30;class Rf{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 Xi(this.tl,e,((t,A)=>t.ee<A))}vl(e){return Fl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,A){if(this.Ni())return null;let r=null;const n=Ue(this.el()),s=Ue(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/KA)*KA,h=Math.max(c,Math.floor(l/KA)*KA);{const y=this.fl(o),Q=this.vl(Math.min(l,c,t));r=$r(r,this.pl(y,Q,A))}let d=this.il.get(A);d===void 0&&(d=new Map,this.il.set(A,d));for(let y=Math.max(c+1,o);y<h;y+=KA){const Q=Math.floor(y/KA);let b=d.get(Q);if(b===void 0){const C=this.fl(Q*KA),U=this.vl((Q+1)*KA-1);b=this.pl(C,U,A),d.set(Q,b)}r=$r(r,b)}{const y=this.fl(h),Q=this.vl(l);r=$r(r,this.pl(y,Q,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 Gf{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 Gf(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 Ol(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 $f{constructor(e,t){this.Wt=new fl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Ol(this.kl))),this.Wt}}class Xf extends Kr{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Ol(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 Zf{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 $f(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 Xf(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 ks(i){return i.Pn()}function Jf(i){return i.Bl()}function Yf(i){return i.Al()}class Ns extends Vf{constructor(e,t,A,r,n){super(e),this.zt=new Rf,this.jh=new _f(this),this.zl=[],this.Ll=new Ff(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=t,this.$l=A;const s=new kf(this);this.rn=[s],this.Hh=new El(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new Ef(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 d=this.zt.sl();if(d===null)return t;s=d,o=d.ee}else{const d=this.zt.ll(r.ui(),-1);if(d===null||(s=this.zt.Gh(d.ee),s===null))return t;o=d.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),h=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:h,ee:o}}Us(){return this.Nl!==null||(this.Nl=new Wf(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),pA(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 Kf(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,ks,"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,ks,"normal",e),e}ua(){return this.ca(ks,"bottom")}da(e){return this.ca(Jf,e)}fa(e){return this.ca(Yf,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 Ue(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new Zf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Is)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Is)return e=>this.wn.je(e)}_a(){return!Vr(this.Dt().Pa())}pa(e,t){if(!Ri(e)||!Ri(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 Zt(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new Zt(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 Q=new Zt(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(Q):Q}var c,h,d,y;l?.margins&&(c=s,h=l.margins,s={above:Math.max((d=c?.above)!==null&&d!==void 0?d:0,h.above),below:Math.max((y=c?.below)!==null&&y!==void 0?y:0,h.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 rf(this.cn.priceFormat.precision);break;case"percent":this.wa=new wl(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=Ue(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Ue(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Ue(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:r,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new Df(this,this.$t()),this.$l){case"Bar":this.wn=new df(this,this.$t());break;case"Candlestick":this.wn=new wf(this,this.$t());break;case"Line":this.wn=new xf(this,this.$t());break;case"Custom":this.wn=new Is(this,this.$t(),zt(e));break;case"Area":this.wn=new hf(this,this.$t());break;case"Baseline":this.wn=new gf(this,this.$t());break;case"Histogram":this.wn=new vf(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 qf{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((h=>h instanceof Ns)).reduce(((h,d)=>{if(A.vr(d)||!d.yt())return h;const y=d.Dt(),Q=d.In();if(y.Ni()||!Q.Kr(t))return h;const b=Q.Gh(t);if(b===null)return h;const C=yi(d.Ct());return h.concat([y.Rt(b.Vt[3],C.Vt)])}),[]);if(l.length===0)return r;l.sort(((h,d)=>Math.abs(h-o)-Math.abs(d-o)));const c=l[0];return r=n.pn(c,s),r}}class jf extends fA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(A));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Ue(this.zt);if(s.Aa){e.strokeStyle=s.Ia,ri(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,ri(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 e0{constructor(e){this.Wt=new jf,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 t0{constructor(e){this.wn=new e0(e)}qh(){return this.wn}}const Os={$a:4,Ua:1e-4};function vi(i,e){const t=100*(i-e)/e;return e<0?-t:t}function A0(i,e){const t=vi(i.Ph(),e),A=vi(i.Rh(),e);return new Zt(t,A)}function qi(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function i0(i,e){const t=qi(i.Ph(),e),A=qi(i.Rh(),e);return new Zt(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 er(i,e){if(i===null)return null;const t=Xr(i.Ph(),e),A=Xr(i.Rh(),e);return new Zt(t,A)}function Zr(i,e){if(i===null)return null;const t=ji(i.Ph(),e),A=ji(i.Rh(),e);return new Zt(t,A)}function Ks(i){if(i===null)return Os;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return Os;const t=Math.ceil(Math.abs(Math.log10(e))),A=Os.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class Vs{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 d=Wr(n,r,1e-14)&&n>r+1e-14,y=Wr(n,A*o,1e-14),Q=Wr(n,1,1e-14);if(!(d&&y&&Q))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,h=1e-14,Math.abs(l-c)<h))for(s=0,o=this.Za[0];Wr(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,h;return n}}class Kl{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 Vs(this.qa,[2,2.5,2]),s=new Vs(this.qa,[2,2,2.5]),o=new Vs(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let h=c[0];for(let d=1;d<c.length;++d)c[d]<h&&(h=c[d]);return h})(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),h=Math.min(r,n);if(c===h)return void(this.Ka=[]);let d=this.Xa(c,h),y=c%d;y+=y<0?d:0;const Q=c>=h?1:-1;let b=null,C=0;for(let U=c-y;U>h;U-=d){const M=this.Ja(U,t,!0);b!==null&&Math.abs(M-b)<this.Qa()||M<o||M>l||(C<this.Ka.length?(this.Ka[C].Ea=M,this.Ka[C].so=e.eo(U)):this.Ka.push({Ea:M,so:e.eo(U)}),C++,b=M,e.ro()&&(d=this.Xa(U*Q,h)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Vl(i){return i.slice().sort(((e,t)=>Ue(e.Xi())-Ue(t.Xi())))}var zl;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(zl||(zl={}));const Wl=new wl,Rl=new zr(100,1);class r0{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 xt,this.vo=new xt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=Rl,this.xo=Ks(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Kl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(pA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=zt(e.scaleMargins.top),A=zt(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=er(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=vi(e,t):this.Oo()&&(e=qi(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Ue(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),d=A===void 0?0:A.from,y=A===void 0?e.length:A.to,Q=this.Ho();for(let b=d;b<y;b++){const C=e[b],U=C._t;if(isNaN(U))continue;let M=U;Q!==null&&(M=Q(C._t,t));const E=r+h*(M-s),I=c?E:this.ho-1-E;C.st=I}}be(e,t,A){this.Wo();const r=this.Fo(),n=Ue(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),d=A===void 0?0:A.from,y=A===void 0?e.length:A.to,Q=this.Ho();for(let b=d;b<y;b++){const C=e[b];let U=C.ge,M=C.Me,E=C.xe,I=C.Se;Q!==null&&(U=Q(C.ge,t),M=Q(C.Me,t),E=Q(C.xe,t),I=Q(C.Se,t));let R=r+h*(U-s),L=c?R:this.ho-1-R;C.pe=L,R=r+h*(M-s),L=c?R:this.ho-1-R,C.de=L,R=r+h*(E-s),L=c?R:this.ho-1-R,C.fe=L,R=r+h*(I-s),L=c?R:this.ho-1-R,C.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=Vl(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const A=t.Ct();A!==null&&(e===null||A.la<e.la)&&(e=A)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=Ue(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const A=Ue(this.ao).Th();t=Math.max(t,.1),A.Vh(t),this.Ao(A)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=Ue(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Ue(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Ue(this.ao).Th();n.Oh(r),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(vi(e,t));case 3:return this.ba().format(qi(e,t));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,Ue(this.e_()).ba())}Zl(e,t){return e=vi(e,t),this.s_(e,Wl)}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=Rl,this.Mh()?(this.wa=Wl,t=100):this.Oo()?(this.wa=new zr(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Kl(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=Ue(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),r=Ue(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?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 h=l.Il(e.Os(),e.ui());let d=h&&h.Lh();if(d!==null){switch(this.cn.mode){case 1:d=er(d,this.xo);break;case 2:d=A0(d,c.Vt);break;case 3:d=i0(d,c.Vt)}if(t=t===null?d:t.ts(Ue(d)),h!==null){const y=h.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 Zt(t.Ph()-c,t.Rh()+c),this.ro()&&(t=er(t,this.xo))}if(this.ro()){const l=Zr(t,this.xo),c=Ks(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const h=this.ao!==null?Zr(this.ao,this.xo):null;this.xo=c,t=er(l,c),h!==null&&(this.ao=er(h,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new Zt(-.5,.5)),this.xo=Ks(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?vi:this.Oo()?qi: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 n0{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new xt,this.yl=e,this.$i=t,this.d_=new t0(this);const A=t.W();this.f_=this.v_("left",A.leftPriceScale),this.p_=this.v_("right",A.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(A)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const t=Array.from(this.o_.values());for(const A of t){const r=Ue(A[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?zt(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);OA(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Ue(e.Dt()).Pa();if(this.o_.has(A)){const n=zt(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=Vl(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},IA(t)),r=new r0(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class s0{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(zt(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 tr{constructor(e,t){OA(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 Gl(i,e){return i===null||e===null?i===e:i.Ch(e)}class o0{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(Xi(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=zt(this.J_.get(A)),l=o.length;let c=1/0,h=-1/0;for(let d=0;d<l;d++){const y=o[d],Q=y.index;for(;s<n;){const b=r[s],C=b.index;if(!(C<Q)){c=C;break}s++,t.push(b),h=C,c=1/0}if(c-Q>=e&&Q-h>=e)t.push(y),h=Q;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 tr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new xi(null)}}function a0(i,e){return i.weight>e.weight?i:e}class l0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new o0,this.du=new Map,this.fu=xi.ou(),this.vu=!0,this.pu=new xt,this.mu=new xt,this.bu=new xt,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){pA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;pA(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=Xi(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[A].time)?t?A:null:A}Ni(){return this.__===0||this.uu.length===0||this._u===null}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const e=this.Xs();if(e===null)return null;const t={from:e.Os(),to:e.ui()};return this.Ou(t)}Ou(e){const t=Math.round(e.from),A=Math.round(e.to),r=Ue(this.Bu()),n=Ue(this.Au());return{from:Ue(this.Ui(Math.max(r,t))),to:Ue(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Ue(this.Va(e.from,!0)),to:Ue(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),A=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&A!==0){const r=this.Su*e/A;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=A-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!Ri(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=A+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(this.gu!==null)return this.gu;const e=this.Su,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),A=Math.round(t/e),r=Ue(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,h=this.$u(),d=this.cn.fixLeftEdge||h,y=this.cn.fixRightEdge||h;let Q=0;for(const b of o){if(!(n<=b.index&&b.index<=s))continue;let C;Q<this.Mu.length?(C=this.Mu[Q],C.coord=this.It(b.index),C.label=this.Uu(b),C.weight=b.weight):(C={needAlignCoordinate:!1,coord:this.It(b.index),label:this.Uu(b),weight:b.weight},this.Mu.push(C)),this.Su>t/2&&!h?C.needAlignCoordinate=!1:C.needAlignCoordinate=d&&b.index<=l||y&&b.index>=c,Q++}return this.Mu.length=Q,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=Ls(this.__-e,0,this.__),A=Ls(this.__-Ue(this.wo),0,this.__);t!==0&&A!==0&&this.Gn(this.wu.le*t/A)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const t=(this.Mo-e)/this.le();this.xu=Ue(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const A=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:A+(e-A)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new tr(e,t+this.cn.rightOffset))}lc(e){const t=new tr(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 tr(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 s0((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,Gl(t.lu(),this.fu.lu())||this.pu.m(),Gl(t.au(),this.fu.au())||this.mu.m(),this.oc()}oc(){this.gu=null}Cu(){this.oc(),this.du.clear()}ku(){this.q_.updateFormatter(this.yo)}Tu(){if(!this.cn.fixLeftEdge)return;const e=this.Bu();if(e===null)return;const t=this.Xs();if(t===null)return;const A=t.Os()-e;if(A<0){const r=this.xu-A-1;this.Jn(r)}this.zu()}Pu(){this.Lu(),this.zu()}}class c0{X(e,t,A){e.useMediaCoordinateSpace((r=>this.K(r,t,A)))}gl(e,t,A){e.useMediaCoordinateSpace((r=>this.vc(r,t,A)))}vc(e,t,A){}}class h0 extends c0{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:t,mediaSize:A}=e;let r=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;t.font=s.R;const o=this.wc(t,s.Kt);o>A.width?s.Zu=A.width/o:s.Zu=1,r+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((A.height-r)/2,0);break;case"bottom":n=Math.max(A.height-r,0)}t.fillStyle=this.zt.V;for(const s of this.zt.bc){t.save();let o=0;switch(this.zt.xc){case"left":t.textAlign="left",o=s.gc/2;break;case"center":t.textAlign="center",o=A.width/2;break;case"right":t.textAlign="right",o=A.width-1-s.gc/2}t.translate(o,n),t.textBaseline="top",t.font=s.R,t.scale(s.Zu,s.Zu),t.fillText(s.Kt,0,s.Sc),t.restore(),n+=s.gc*s.Zu}}wc(e,t){const A=this.kc(e.font);let r=A.get(t);return r===void 0&&(r=e.measureText(t).width,A.set(t,r)),r}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class u0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new h0(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:Ci(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class d0 extends Ss{constructor(e,t){super(),this.cn=t,this.wn=new u0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var $l,Xl,Zl,Jl,Yl;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})($l||($l={}));class p0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new xt,this.Rc=new xt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Rp(this),this.yl=new l0(this,t.timeScale,this.cn.localization,A),this.vt=new Af(this,t.crosshair),this.Bc=new qf(t.crosshair),this.Ac=new d0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(It.es())}Uh(){this.Nc(It.ss())}oa(){this.Nc(new It(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){pA(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 n0(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=It.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(),h=c.Ct();h!==null&&(s=c.pn(t,h)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const r=A.vn(),n=r.Ct(),s=r.Rt(e,Ue(n)),o=this.yl.Va(t,!0),l=this.yl.It(Ue(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),h=e!==null&&e>s&&!c,d=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,y=l&&(A!==void 0||d)&&this.yl.W().shiftVisibleRangeOnNewBar;if(h&&!y){const Q=e-s;this.yl.Jn(this.yl.Hu()-Q)}}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);OA(A!==-1,"Series not found"),this.Cc.splice(A,1),Ue(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Ue(this.dr(e));A.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();A.qo(e,t,n)}else{const n=r.Ht===A?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=It.ss();e.$n(),this.Nc(e)}pd(e){const t=It.ss();t.Yn(e),this.Nc(t)}Kn(){const e=It.ss();e.Kn(),this.Nc(e)}Gn(e){const t=It.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=It.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=It.ss();t.Zn(e),this.Nc(t)}Un(){const e=It.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,h,d]=Wi(n),[y,Q,b,C]=Wi(s),U=[sA(l+o*(y-l)),sA(c+o*(Q-c)),sA(h+o*(b-h)),ll(d+o*(C-d))];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 It(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 Ns(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 zs(i){return!vA(i)&&!Gi(i)}function ql(i){return vA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(Xl||(Xl={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(Zl||(Zl={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(Jl||(Jl={})),(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"})(Yl||(Yl={}));const jl=i=>i.getUTCFullYear();function f0(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 ec{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return f0(e,this.gd,this.Md)}}class g0{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 m0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class w0{constructor(e={}){const t=Object.assign(Object.assign({},m0),e);this.Td=new ec(t.Sd,t.Cd),this.Pd=new g0(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 Ws(i){return 60*i*1e3}const Yr=[{Dd:(tc=1,1e3*tc),Vd:10},{Dd:Ws(1),Vd:20},{Dd:Ws(5),Vd:21},{Dd:Ws(30),Vd:22},{Dd:Jr(1),Vd:30},{Dd:Jr(3),Vd:31},{Dd:Jr(6),Vd:32},{Dd:Jr(12),Vd:33}];var tc;function Ac(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 Rs(i){let e=i;if(Gi(i)&&(e=Gs(i)),!zs(e))throw new Error("time must be of type BusinessDay");const t=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(t.getTime()/1e3),Bd:e}}function ic(i){if(!ql(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function Gs(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 rc(i){Gi(i.time)&&(i.time=Gs(i.time))}class nc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(rc)})(e):rc(e)}createConverterToInternalObj(e){return Ue((function(t){return t.length===0?null:zs(t[0].time)||Gi(t[0].time)?Rs:ic})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const t=e;return t.Bd===void 0?new Date(1e3*t.Od).getTime():new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day)).getTime()}convertHorzItemToInternal(e){return ql(t=e)?ic(t):zs(t)?Rs(t):Rs(Gs(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new w0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new ec(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(a0,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],h=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=Ac(h,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=h}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=Ac(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return pA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const Ti=typeof window<"u";function sc(){return!!Ti&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function $s(){return!!Ti&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Xs(i){return i+i%2}function Zs(i,e){return i.zd-e.zd}function Js(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class B0{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=Js(this.Ld,this.Ed,this.Ud),n=Zs(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=Js(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const h=Zs(this.Ed,this.Nd);if(s.push(c),o.push(h),A+=h,this.Fd!==null){const d=Js(this.Nd,this.Fd,this.Ud);if(Math.sign(d)===Math.sign(r)){const y=Zs(this.Nd,this.Fd);s.push(d),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,h){const d=Math.log(h);return Math.log(1*d/-c)/d})(Math.abs(l),this.qd))}tc(e){const t=Ue(this.Wd),A=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,A)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Ue(this.Wd).ot;return Math.min(t,this.jd)}}class y0{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 cl(Wi(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 ni(i,e){const t=Ue(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=Ep(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 si(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function Ys(i,e,t,A){i.gl&&i.gl(e,t,A)}function qr(i,e,t,A){i.X(e,t,A)}function qs(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function C0(i){Ti&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class js{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=!$s(),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=eo(e.changedTouches,Ue(this.Of));if(t===null||(this.Vf=jr(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(xA(t),Ue(this.pf)),{nv:r,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),bi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(xA(e),Ue(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:A,sv:r,Nf:A+r}}ov(e){let t=eo(e.changedTouches,Ue(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(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&&bi(e));this._f===0&&bi(e),e.touches.length===0&&this.ff&&(this.ff=!1,bi(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),sc()&&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=jr(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;sc()&&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})}$s()&&(this.xf=()=>{this.Zf.removeEventListener("dblclick",this.zf)},this.Zf.addEventListener("dblclick",this.zf)),this.Zf.addEventListener("mouseleave",this.gv.bind(this)),this.Zf.addEventListener("touchstart",this.fv.bind(this),{passive:!0}),C0(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",(()=>{}),{passive:!1})}Mv(){this.Hf.xv===void 0&&this.Hf.Sv===void 0&&this.Hf.kv===void 0||(this.Zf.addEventListener("touchstart",(e=>this.yv(e.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(e=>{if(e.touches.length===2&&this.Cf!==null&&this.Hf.Sv!==void 0){const t=oc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),bi(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=oc(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=!$s()}vv(e){const t=eo(e.touches,Ue(this.Of));if(t===null)return;const A=this.Ef(e,t);this.Wf(A,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents: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"&&bi(e)}}}}function oc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function bi(i){i.cancelable&&i.preventDefault()}function xA(i){return{nt:i.pageX,st:i.pageY}}function jr(i){return i.timeStamp||performance.now()}function eo(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 v0(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 to(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],h=i[l-1],d=h.At(A,!1),y=c.Vi(),Q=h.Vi();if(e===1?y>Q-d:y<Q+d){const b=Q-d*e;c.Oi(b);const C=b-e*d/2;if((e===1?C<0:C>t)&&o>0){const U=e===1?-1-C:C-t,M=Math.min(U,o);for(let E=r;E<i.length;E++)i[E].Oi(i[E].Vi()+e*M);o-=M}}else r=l,o=e===1?Q-d-y:y-(Q+d)}}class lc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Zi(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=to("normal",r),this.Zv=to("top",r),this.Xv=to("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=ni(this.Kv,wt({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=ni(this.Kv,wt({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 js(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),si(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),si(this.Gv.canvasElement),this.Gv.dispose(),this.Li!==null&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const t=this.ap(),A=Ue(this.Gv.canvasElement.getContext("2d"));A.save();const r=this.Li.Ha();A.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(A,r[0].so),this.Fv.xi(A,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const h=this.Fv.xi(A,n[c].Kt());h>e&&(e=h)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),h=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,h))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,h))-.11111111111111,s)))}var o;A.restore();const l=e||34;return Xs(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&Ai(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return Ue(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,Ue(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=ii(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=ii(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):dl(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)),h=Math.floor(.5*l),d=Math.round(r.T*o);s.beginPath();for(const y of t)s.rect(Math.floor(n*o),Math.round(y.Ea*l)-h,d,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((h=>this.Fv.Mi(s,h.so)));for(let h=t.length;h--;){const d=t[h];s.fillText(d.so,l,d.Ea+c[h])}}))}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(Ue(this.Li)).X(e,A,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((l=>{l.forEach((c=>{c.gt(Ue(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return Ci(this.ko.fontSize,this.ko.fontFamily)}}function x0(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 T0(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 b0(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 Ao{constructor(e,t){this.Ev=wt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new xt,this.Op=new xt,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=ni(A,wt({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=ni(A,wt({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 js(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),si(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),si(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Ue(this.Np)}qp(e){var t,A;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(Ao.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 y0(this.Wp,this.Qd),this.Pp.bt()):((A=this.Pp)===null||A===void 0||A.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const e=this.Np.R_();this.Cp.Gi(Ue(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Ue(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const t=e.localX,A=e.localY;this.Gp(t,A,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const A=e.localX,r=e.localY;this.Gp(A,r,e);const n=this.wr(A,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const t={x:e.localX,y:e.localY};this.rm(t,t,e)}}Pv(e){this.Np!==null&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(e,t){if(!this.Qd.W().handleScale.pinch)return;const A=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,A)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,A=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Ue(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,h,d){var y,Q;let b,C;for(const E of c){const I=(Q=(y=E.va)===null||y===void 0?void 0:y.call(E,h,d))!==null&&Q!==void 0?Q:[];for(const R of I)U=R.zOrder,(!(M=b?.zOrder)||U==="top"&&M!=="top"||U==="normal"&&M==="bottom")&&(b=R,C=E)}var U,M;return b&&C?{zv:b,Hc:C}: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 h=v0(c.Pn(r),n,s);if(h!==null)return{Hc:c,Bv:h.Bv,Iv:h.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return en(l)}return l?.zv?en(l):null})(A,e,t)}_m(e,t){Ue(t==="left"?this.Cp:this.Tp).cp(wt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){Ai(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Wp.style.width=e.width+"px",this.Wp.style.height=e.height+"px")}dm(){const e=Ue(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const A=t.Dt();A!==null&&e.P_(A),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const A=ii(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,x0),this.vm(A),this.pm(A),this.fm(A,tn),this.fm(A,T0)))}this.Jv.applySuggestedBitmapSize();const t=ii(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,b0))}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):dl(e,0,0,A,r,s,o)}vm(e){const t=Ue(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,tn,Ys,t),this.Mm(e,tn,qr,t)}bm(e){this.Mm(e,tn,qr,this.$i().Zc())}fm(e,t){const A=Ue(this.Np).Uo();for(const r of A)this.Mm(e,t,Ys,r);for(const r of A)this.Mm(e,t,qr,r)}Mm(e,t,A,r){const n=Ue(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;qs(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 lc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new lc(this,e.W(),r,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,Ue(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,A){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,A);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),A=this.fp();if(t.z_(A,A.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Ue(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const t=this.$i(),A=t.St();if(A.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),l=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:l,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new B0(.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 cc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=wt({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=ni(this.Kv,wt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),si(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){Ai(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=ii(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 io(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 Q0=io("normal"),F0=io("top"),U0=io("bottom");class S0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=wt({width:0,height:0}),this.Om=new xt,this.Fv=new Zi(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=ni(this.Im,wt({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=ni(this.Im,wt({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 js(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),si(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),si(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){Ai(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(wt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(wt({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=ii(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,U0)})),this.wp(A),this.$m(A,Q0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=ii(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,F0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)qs(t,(n=>Ys(n,e,!1,void 0)),r,void 0);for(const r of A)qs(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 h=Math.max(1,Math.floor(l)),d=Math.floor(.5*l);o.beginPath();const y=Math.round(n.T*c);for(let Q=A.length;Q--;){const b=Math.round(A[Q].coord*l);o.rect(b-d,0,h,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 h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}}))}Ym(e,t,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 Ci(this.j(),this.cn.fontFamily)}Zm(){return Ci(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 Zi,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 cc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new cc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const E0=!!Ti&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!Ti&&(!((ro=navigator?.userAgentData)===null||ro===void 0)&&ro.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var ro;class L0{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 xt,this.Op=new xt,this.Rc=new xt,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),no(this.cn)&&this.hb(!0),this.$i=new p0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new S0(this,this.q_),this.sb.appendChild(this.ab.lp());const n=t.autoSize&&this.ob();let s=this.cn.width,o=this.cn.height;if(n||s===0||o===0){const l=e.getBoundingClientRect();s=s||l.width,o=o||l.height}this._b(s,o),this.ub(),e.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),this.Km!==0&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],Ue(this.ab).S(),this.Xd.parentElement!==null&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(e,t,A=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return wt({width:l-l%2,height:c-c%2})})(wt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Ue(this.Xd).style.height=n,Ue(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(It.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=It.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=no(this.cn);this.$i.$h(e);const A=no(this.cn);A!==t&&this.hb(A),this.cb(),this.bb(e)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){this.Qm!==null&&(this.mb(this.Qm,performance.now()),this.Qm=null);const e=this.gb(null),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const A=Ue(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Ue(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return zt(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 h=0;h<this.Xm.length;h++){const d=this.Xm[h],y=Ue(o==="left"?d.wm():d.gm()),Q=y.xp();e!==null&&y.Sp(e,l,c),c+=Q.height}};this.xb()&&(n("left",0),t+=Ue(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,A),A+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Ue(r.gm()).xp().width);const s=(o,l,c)=>{Ue(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Ue(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,A),l=Ue(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return wt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const b of this.Xm)this.xb()&&(t=Math.max(t,Ue(b.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Ue(b.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=b.M_();t=Xs(t),A=Xs(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 h=0+l,d=n<h?0:n-h,y=d/e;let Q=0;for(let b=0;b<this.Xm.length;++b){const C=this.Xm[b];C.qp(this.$i.qc()[b]);let U=0,M=0;M=b===this.Xm.length-1?d-Q:Math.round(C.M_()*y),U=Math.max(M,2),Q+=U,C.cp(wt({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(wt({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 E0?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=zt(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 Ao(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((h=>{const d=h.In().ll(e);d!==null&&n.set(h,d)}));let s;if(e!==null){const h=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;h!==void 0&&(s=h)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof Ns?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 no(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function M0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function hc(i,e){var t={};for(var A in i)Object.prototype.hasOwnProperty.call(i,A)&&e.indexOf(A)<0&&(t[A]=i[A]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(A=Object.getOwnPropertySymbols(i);r<A.length;r++)e.indexOf(A[r])<0&&Object.prototype.propertyIsEnumerable.call(i,A[r])&&(t[A[r]]=i[A[r]])}return t}function uc(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.color!==void 0&&(n.V=t.color),n}function H0(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 I0(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 P0(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 D0(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function _0(i,e,t,A,r){const n=zt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],h=t,{time:d,color:y}=h;return{ee:e,ot:i,Vt:c,zb:A,$e:hc(h,["time","color"]),V:y}}function An(i){return i.Vt!==void 0}function dc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function oi(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)?dc({ot:e,ee:t,zb:r},A):dc(i(e,t,A,r,n),A)}function pc(i){return{Candlestick:oi(D0),Bar:oi(P0),Area:oi(H0),Baseline:oi(I0),Histogram:oi(uc),Line:oi(uc),Custom:oi(_0)}[i]}function fc(i){return{ee:0,Hb:new Map,la:i}}function gc(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 mc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),zt(e)}class k0{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,t){let A=this.qb.size!==0,r=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)A=!1,r=!0,this.qb.clear();else for(const l of this.Xb)l.pointData.Hb.delete(e)&&(r=!0);let s=[];if(t.length!==0){const l=t.map((Q=>Q.time)),c=this.q_.createConverterToInternalObj(t),h=pc(e.Qh()),d=e.Ca(),y=e.Ta();s=t.map(((Q,b)=>{const C=c(Q.time),U=this.q_.key(C);let M=this.qb.get(U);M===void 0&&(M=fc(C),this.qb.set(U,M),r=!0);const E=h(C,M.ee,Q,l[b],d,y);return M.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:mc(c.Hb)})})),l.sort(((c,h)=>this.q_.key(c.time)-this.q_.key(h.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,h){const d=gc(l,h),y=gc(c,h);if(d!==void 0&&y!==void 0)return{ta:d.Ub>=y.Ub&&d.$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=fc(r),this.qb.set(this.q_.key(r),s));const l=pc(e.Qh()),c=e.Ca(),h=e.Ta(),d=l(r,s.ee,t,A.zb,c,h);s.Hb.set(e,d),this.nw(e,d);const y={ta:An(d)};if(!o)return this.tw(e,-1,y);const Q={timeWeight:0,time:s.la,pointData:s,originalTime:mc(s.Hb)},b=Xi(this.Xb,this.q_.key(Q.time),((C,U)=>this.q_.key(C.time)<U));this.Xb.splice(b,0,Q);for(let C=b;C<this.Xb.length;++C)so(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,b),this.tw(e,b,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,so(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)so(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 so(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function oo(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function wc(i){const e=oo(i);return i.V!==void 0&&(e.color=i.V),e}function N0(i){const e=oo(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 O0(i){const e=oo(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 Bc(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 K0(i){const e=Bc(i);return i.V!==void 0&&(e.color=i.V),e}function V0(i){const e=Bc(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 ao(i){return{Area:N0,Line:wc,Baseline:O0,Histogram:wc,Bar:K0,Candlestick:V0,Custom:z0}[i]}function z0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const W0={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},R0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},G0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Fs,attributionLogo:!0},lo={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},$0={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},X0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Fs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function yc(){return{width:0,height:0,autoSize:!1,layout:G0,crosshair:W0,grid:R0,overlayPriceScales:Object.assign({},lo),leftPriceScale:Object.assign(Object.assign({},lo),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},lo),{visible:!0}),timeScale:$0,watermark:X0,localization:{locale:Ti?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 Z0{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 Ue(this.aw.$t().Uc(this.ow)).Dt}}function Cc(i,e,t){const A=hc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const J0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class Y0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class q0{constructor(e,t,A,r,n){this.uw=new xt,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 tr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const r=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=Ue(A.el()),o=Ue(A.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.zb,l.to=n.zb),l}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:ao(this.seriesType())(A)}data(){const e=ao(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=>Cc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Cc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return IA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=pA(IA(J0),e),A=this.Es.ea(t);return new Y0(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 j0{constructor(e,t,A){this.ww=new xt,this.mu=new xt,this.Om=new xt,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){OA(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({},IA(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 e1(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 vc(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 t1{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new xt,this.Cw=new xt,this.Tw=new xt,this.Pw=new k0(t);const r=A===void 0?IA(yc()):pA(IA(yc()),vc(A));this.q_=t,this.aw=new L0(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 j0(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=yi(e),r=Object.assign(Object.assign({},il),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",_p,e)}addBaselineSeries(e){return this.Vw("Baseline",kp,e)}addBarSeries(e){return this.Vw("Bar",Pp,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",Ip,e)}addHistogramSeries(e){return this.Vw("Histogram",Np,e)}addLineSeries(e){return this.Vw("Line",Dp,e)}removeSeries(e){const t=zt(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 Z0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(vc(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){e1(A.priceFormat);const n=pA(IA(rl),IA(t),A),s=this.aw.$t().dd(e,n,r),o=new q0(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 zt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=ao(s)(r);if(s!=="Custom")OA(M0(o));else{const l=n.Ta();OA(!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 A1(i,e,t){let A;if(Gi(i)){const n=document.getElementById(i);OA(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new t1(A,e,t);return e.setOptions(r.options()),r}function i1(i,e){return A1(i,new nc,nc.Id(e))}Object.assign(Object.assign({},rl),il);function xc(i,e){return function(){return i.apply(e,arguments)}}const{toString:r1}=Object.prototype,{getPrototypeOf:co}=Object,{iterator:rn,toStringTag:Tc}=Symbol,nn=(i=>e=>{const t=r1.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),gA=i=>(i=i.toLowerCase(),e=>nn(e)===i),sn=i=>e=>typeof e===i,{isArray:Qi}=Array,Fi=sn("undefined");function Ar(i){return i!==null&&!Fi(i)&&i.constructor!==null&&!Fi(i.constructor)&&Jt(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const bc=gA("ArrayBuffer");function n1(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&bc(i.buffer),e}const s1=sn("string"),Jt=sn("function"),Qc=sn("number"),ir=i=>i!==null&&typeof i=="object",o1=i=>i===!0||i===!1,on=i=>{if(nn(i)!=="object")return!1;const e=co(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Tc in i)&&!(rn in i)},a1=i=>{if(!ir(i)||Ar(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},l1=gA("Date"),c1=gA("File"),h1=gA("Blob"),u1=gA("FileList"),d1=i=>ir(i)&&Jt(i.pipe),p1=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Jt(i.append)&&((e=nn(i))==="formdata"||e==="object"&&Jt(i.toString)&&i.toString()==="[object FormData]"))},f1=gA("URLSearchParams"),[g1,m1,w1,B1]=["ReadableStream","Request","Response","Headers"].map(gA),y1=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function rr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Qi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(Ar(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 Fc(i,e){if(Ar(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 ai=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Uc=i=>!Fi(i)&&i!==ai;function ho(){const{caseless:i,skipUndefined:e}=Uc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&Fc(t,n)||n;on(t[s])&&on(r)?t[s]=ho(t[s],r):on(r)?t[s]=ho({},r):Qi(r)?t[s]=r.slice():(!e||!Fi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&rr(arguments[r],A);return t}const C1=(i,e,t,{allOwnKeys:A}={})=>(rr(e,(r,n)=>{t&&Jt(r)?Object.defineProperty(i,n,{value:xc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),v1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),x1=(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)},T1=(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&&co(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},b1=(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},Q1=i=>{if(!i)return null;if(Qi(i))return i;let e=i.length;if(!Qc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},F1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&co(Uint8Array)),U1=(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])}},S1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},E1=gA("HTMLFormElement"),L1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Sc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),M1=gA("RegExp"),Ec=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};rr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},H1=i=>{Ec(i,(e,t)=>{if(Jt(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(Jt(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+"'")})}})},I1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Qi(i)?A(i):A(String(i).split(e)),t},P1=()=>{},D1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function _1(i){return!!(i&&Jt(i.append)&&i[Tc]==="FormData"&&i[rn])}const k1=i=>{const e=new Array(10),t=(A,r)=>{if(ir(A)){if(e.indexOf(A)>=0)return;if(Ar(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Qi(A)?[]:{};return rr(A,(s,o)=>{const l=t(s,r+1);!Fi(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},N1=gA("AsyncFunction"),O1=i=>i&&(ir(i)||Jt(i))&&Jt(i.then)&&Jt(i.catch),Lc=((i,e)=>i?setImmediate:e?((t,A)=>(ai.addEventListener("message",({source:r,data:n})=>{r===ai&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),ai.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Jt(ai.postMessage)),K1=typeof queueMicrotask<"u"?queueMicrotask.bind(ai):typeof process<"u"&&process.nextTick||Lc,pe={isArray:Qi,isArrayBuffer:bc,isBuffer:Ar,isFormData:p1,isArrayBufferView:n1,isString:s1,isNumber:Qc,isBoolean:o1,isObject:ir,isPlainObject:on,isEmptyObject:a1,isReadableStream:g1,isRequest:m1,isResponse:w1,isHeaders:B1,isUndefined:Fi,isDate:l1,isFile:c1,isBlob:h1,isRegExp:M1,isFunction:Jt,isStream:d1,isURLSearchParams:f1,isTypedArray:F1,isFileList:u1,forEach:rr,merge:ho,extend:C1,trim:y1,stripBOM:v1,inherits:x1,toFlatObject:T1,kindOf:nn,kindOfTest:gA,endsWith:b1,toArray:Q1,forEachEntry:U1,matchAll:S1,isHTMLForm:E1,hasOwnProperty:Sc,hasOwnProp:Sc,reduceDescriptors:Ec,freezeMethods:H1,toObjectSet:I1,toCamelCase:L1,noop:P1,toFiniteNumber:D1,findKey:Fc,global:ai,isContextDefined:Uc,isSpecCompliantForm:_1,toJSONObject:k1,isAsyncFn:N1,isThenable:O1,setImmediate:Lc,asap:K1,isIterable:i=>i!=null&&Jt(i[rn])};let je=class mp extends Error{static from(e,t,A,r,n,s){const o=new mp(e.message,t||e.code,A,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),r&&(this.request=r),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:pe.toJSONObject(this.config),code:this.code,status:this.status}}};je.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",je.ERR_BAD_OPTION="ERR_BAD_OPTION",je.ECONNABORTED="ECONNABORTED",je.ETIMEDOUT="ETIMEDOUT",je.ERR_NETWORK="ERR_NETWORK",je.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",je.ERR_DEPRECATED="ERR_DEPRECATED",je.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",je.ERR_BAD_REQUEST="ERR_BAD_REQUEST",je.ERR_CANCELED="ERR_CANCELED",je.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",je.ERR_INVALID_URL="ERR_INVALID_URL";const V1=null;function uo(i){return pe.isPlainObject(i)||pe.isArray(i)}function Mc(i){return pe.endsWith(i,"[]")?i.slice(0,-2):i}function Hc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Mc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function z1(i){return pe.isArray(i)&&!i.some(uo)}const W1=pe.toFlatObject(pe,{},null,function(e){return/^is[A-Z]/.test(e)});function an(i,e,t){if(!pe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=pe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!pe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||h,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&pe.isSpecCompliantForm(e);if(!pe.isFunction(r))throw new TypeError("visitor must be a function");function c(b){if(b===null)return"";if(pe.isDate(b))return b.toISOString();if(pe.isBoolean(b))return b.toString();if(!l&&pe.isBlob(b))throw new je("Blob is not supported. Use a Buffer instead.");return pe.isArrayBuffer(b)||pe.isTypedArray(b)?l&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function h(b,C,U){let M=b;if(b&&!U&&typeof b=="object"){if(pe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),b=JSON.stringify(b);else if(pe.isArray(b)&&z1(b)||(pe.isFileList(b)||pe.endsWith(C,"[]"))&&(M=pe.toArray(b)))return C=Mc(C),M.forEach(function(I,R){!(pe.isUndefined(I)||I===null)&&e.append(s===!0?Hc([C],R,n):s===null?C:C+"[]",c(I))}),!1}return uo(b)?!0:(e.append(Hc(U,C,n),c(b)),!1)}const d=[],y=Object.assign(W1,{defaultVisitor:h,convertValue:c,isVisitable:uo});function Q(b,C){if(!pe.isUndefined(b)){if(d.indexOf(b)!==-1)throw Error("Circular reference detected in "+C.join("."));d.push(b),pe.forEach(b,function(M,E){(!(pe.isUndefined(M)||M===null)&&r.call(e,M,pe.isString(E)?E.trim():E,C,y))===!0&&Q(M,C?C.concat(E):[E])}),d.pop()}}if(!pe.isObject(i))throw new TypeError("data must be an object");return Q(i),e}function Ic(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function po(i,e){this._pairs=[],i&&an(i,this,e)}const Pc=po.prototype;Pc.append=function(e,t){this._pairs.push([e,t])},Pc.toString=function(e){const t=e?function(A){return e.call(this,A,Ic)}:Ic;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function R1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Dc(i,e,t){if(!e)return i;const A=t&&t.encode||R1,r=pe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=pe.isURLSearchParams(e)?e.toString():new po(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class _c{constructor(){this.handlers=[]}use(e,t,A){return this.handlers.push({fulfilled:e,rejected:t,synchronous:A?A.synchronous:!1,runWhen:A?A.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){pe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const fo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},G1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:po,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},go=typeof window<"u"&&typeof document<"u",mo=typeof navigator=="object"&&navigator||void 0,$1=go&&(!mo||["ReactNative","NativeScript","NS"].indexOf(mo.product)<0),X1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Z1=go&&window.location.href||"http://localhost",Nt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:go,hasStandardBrowserEnv:$1,hasStandardBrowserWebWorkerEnv:X1,navigator:mo,origin:Z1},Symbol.toStringTag,{value:"Module"})),...G1};function J1(i,e){return an(i,new Nt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Nt.isNode&&pe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function Y1(i){return pe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function q1(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 kc(i){function e(t,A,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&pe.isArray(r)?r.length:s,l?(pe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!pe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&pe.isArray(r[s])&&(r[s]=q1(r[s])),!o)}if(pe.isFormData(i)&&pe.isFunction(i.entries)){const t={};return pe.forEachEntry(i,(A,r)=>{e(Y1(A),r,t,0)}),t}return null}function j1(i,e,t){if(pe.isString(i))try{return(e||JSON.parse)(i),pe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const nr={transitional:fo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=pe.isObject(e);if(n&&pe.isHTMLForm(e)&&(e=new FormData(e)),pe.isFormData(e))return r?JSON.stringify(kc(e)):e;if(pe.isArrayBuffer(e)||pe.isBuffer(e)||pe.isStream(e)||pe.isFile(e)||pe.isBlob(e)||pe.isReadableStream(e))return e;if(pe.isArrayBufferView(e))return e.buffer;if(pe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(A.indexOf("application/x-www-form-urlencoded")>-1)return J1(e,this.formSerializer).toString();if((o=pe.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),j1(e)):e}],transformResponse:[function(e){const t=this.transitional||nr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(pe.isResponse(e)||pe.isReadableStream(e))return e;if(e&&pe.isString(e)&&(A&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?je.from(o,je.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}}};pe.forEach(["delete","get","head","post","put","patch"],i=>{nr.headers[i]={}});const eg=pe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tg=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]&&eg[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},Nc=Symbol("internals");function sr(i){return i&&String(i).trim().toLowerCase()}function ln(i){return i===!1||i==null?i:pe.isArray(i)?i.map(ln):String(i)}function Ag(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 ig=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function wo(i,e,t,A,r){if(pe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!pe.isString(e)){if(pe.isString(A))return e.indexOf(A)!==-1;if(pe.isRegExp(A))return A.test(e)}}function rg(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function ng(i,e){const t=pe.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(i,A+t,{value:function(r,n,s){return this[A].call(this,e,r,n,s)},configurable:!0})})}let Yt=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const h=sr(l);if(!h)throw new Error("header name must be a non-empty string");const d=pe.findKey(r,h);(!d||r[d]===void 0||c===!0||c===void 0&&r[d]!==!1)&&(r[d||l]=ln(o))}const s=(o,l)=>pe.forEach(o,(c,h)=>n(c,h,l));if(pe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(pe.isString(e)&&(e=e.trim())&&!ig(e))s(tg(e),t);else if(pe.isObject(e)&&pe.isIterable(e)){let o={},l,c;for(const h of e){if(!pe.isArray(h))throw TypeError("Object iterator must return a key-value pair");o[c=h[0]]=(l=o[c])?pe.isArray(l)?[...l,h[1]]:[l,h[1]]:h[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=sr(e),e){const A=pe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return Ag(r);if(pe.isFunction(t))return t.call(this,r,A);if(pe.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=sr(e),e){const A=pe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||wo(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=sr(s),s){const o=pe.findKey(A,s);o&&(!t||wo(A,A[o],o,t))&&(delete A[o],r=!0)}}return pe.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let A=t.length,r=!1;for(;A--;){const n=t[A];(!e||wo(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,A={};return pe.forEach(this,(r,n)=>{const s=pe.findKey(A,n);if(s){t[s]=ln(r),delete t[n];return}const o=e?rg(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 pe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&pe.isArray(A)?A.join(", "):A)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[Nc]=this[Nc]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=sr(s);A[o]||(ng(r,s),A[o]=!0)}return pe.isArray(e)?e.forEach(n):n(e),this}};Yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),pe.reduceDescriptors(Yt.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),pe.freezeMethods(Yt);function Bo(i,e){const t=this||nr,A=e||t,r=Yt.from(A.headers);let n=A.data;return pe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function Oc(i){return!!(i&&i.__CANCEL__)}let or=class extends je{constructor(e,t,A){super(e??"canceled",je.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function Kc(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new je("Request failed with status code "+t.status,[je.ERR_BAD_REQUEST,je.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function sg(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function og(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(),h=A[n];s||(s=c),t[r]=l,A[r]=c;let d=n,y=0;for(;d!==r;)y+=t[d++],d=d%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const Q=h&&c-h;return Q?Math.round(y*1e3/Q):void 0}}function ag(i,e){let t=0,A=1e3/e,r,n;const s=(c,h=Date.now())=>{t=h,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const h=Date.now(),d=h-t;d>=A?s(c,h):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-d)))},()=>r&&s(r)]}const cn=(i,e,t=3)=>{let A=0;const r=og(50,250);return ag(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),h=s<=o;A=s;const d={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(d)},t)},Vc=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},zc=i=>(...e)=>pe.asap(()=>i(...e)),lg=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,cg=Nt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];pe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),pe.isString(A)&&o.push(`path=${A}`),pe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),pe.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function hg(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function ug(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function Wc(i,e,t){let A=!hg(e);return i&&(A||t==!1)?ug(i,e):e}const Rc=i=>i instanceof Yt?{...i}:i;function li(i,e){e=e||{};const t={};function A(c,h,d,y){return pe.isPlainObject(c)&&pe.isPlainObject(h)?pe.merge.call({caseless:y},c,h):pe.isPlainObject(h)?pe.merge({},h):pe.isArray(h)?h.slice():h}function r(c,h,d,y){if(pe.isUndefined(h)){if(!pe.isUndefined(c))return A(void 0,c,d,y)}else return A(c,h,d,y)}function n(c,h){if(!pe.isUndefined(h))return A(void 0,h)}function s(c,h){if(pe.isUndefined(h)){if(!pe.isUndefined(c))return A(void 0,c)}else return A(void 0,h)}function o(c,h,d){if(d in e)return A(c,h);if(d 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,h,d)=>r(Rc(c),Rc(h),d,!0)};return pe.forEach(Object.keys({...i,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const d=pe.hasOwnProp(l,h)?l[h]:r,y=d(i[h],e[h],h);pe.isUndefined(y)&&d!==o||(t[h]=y)}),t}const Gc=i=>{const e=li({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=Yt.from(s),e.url=Dc(Wc(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),pe.isFormData(t)){if(Nt.hasStandardBrowserEnv||Nt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(pe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([h,d])=>{c.includes(h.toLowerCase())&&s.set(h,d)})}}if(Nt.hasStandardBrowserEnv&&(A&&pe.isFunction(A)&&(A=A(e)),A||A!==!1&&lg(e.url))){const l=r&&n&&cg.read(n);l&&s.set(r,l)}return e},dg=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=Gc(i);let n=r.data;const s=Yt.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,h,d,y,Q,b;function C(){Q&&Q(),b&&b(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function M(){if(!U)return;const I=Yt.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),L={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:I,config:i,request:U};Kc(function(Y){t(Y),C()},function(Y){A(Y),C()},L),U=null}"onloadend"in U?U.onloadend=M:U.onreadystatechange=function(){!U||U.readyState!==4||U.status===0&&!(U.responseURL&&U.responseURL.indexOf("file:")===0)||setTimeout(M)},U.onabort=function(){U&&(A(new je("Request aborted",je.ECONNABORTED,i,U)),U=null)},U.onerror=function(R){const L=R&&R.message?R.message:"Network Error",O=new je(L,je.ERR_NETWORK,i,U);O.event=R||null,A(O),U=null},U.ontimeout=function(){let R=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const L=r.transitional||fo;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new je(R,L.clarifyTimeoutError?je.ETIMEDOUT:je.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&pe.forEach(s.toJSON(),function(R,L){U.setRequestHeader(L,R)}),pe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([y,b]=cn(c,!0),U.addEventListener("progress",y)),l&&U.upload&&([d,Q]=cn(l),U.upload.addEventListener("progress",d),U.upload.addEventListener("loadend",Q)),(r.cancelToken||r.signal)&&(h=I=>{U&&(A(!I||I.type?new or(null,i,U):I),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const E=sg(r.url);if(E&&Nt.protocols.indexOf(E)===-1){A(new je("Unsupported protocol "+E+":",je.ERR_BAD_REQUEST,i));return}U.send(n||null)})},pg=(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 h=c instanceof Error?c:this.reason;A.abort(h instanceof je?h:new or(h instanceof Error?h.message:h))}};let s=e&&setTimeout(()=>{s=null,n(new je(`timeout of ${e}ms exceeded`,je.ETIMEDOUT))},e);const o=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),i=null)};i.forEach(c=>c.addEventListener("abort",n));const{signal:l}=A;return l.unsubscribe=()=>pe.asap(o),l}},fg=function*(i,e){let t=i.byteLength;if(t<e){yield i;return}let A=0,r;for(;A<t;)r=A+e,yield i.slice(A,r),A=r},gg=async function*(i,e){for await(const t of mg(i))yield*fg(t,e)},mg=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()}},$c=(i,e,t,A)=>{const r=gg(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:h}=await r.next();if(c){o(),l.close();return}let d=h.byteLength;if(t){let y=n+=d;t(y)}l.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},Xc=64*1024,{isFunction:hn}=pe,wg=(({Request:i,Response:e})=>({Request:i,Response:e}))(pe.global),{ReadableStream:Zc,TextEncoder:Jc}=pe.global,Yc=(i,...e)=>{try{return!!i(...e)}catch{return!1}},Bg=i=>{i=pe.merge.call({skipUndefined:!0},wg,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 Jc=="function"?(b=>C=>b.encode(C))(new Jc):async b=>new Uint8Array(await new t(b).arrayBuffer())),c=n&&o&&Yc(()=>{let b=!1;const C=new t(Nt.origin,{body:new Zc,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!C}),h=s&&o&&Yc(()=>pe.isReadableStream(new A("").body)),d={stream:h&&(b=>b.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!d[b]&&(d[b]=(C,U)=>{let M=C&&C[b];if(M)return M.call(C);throw new je(`Response type '${b}' is not supported`,je.ERR_NOT_SUPPORT,U)})});const y=async b=>{if(b==null)return 0;if(pe.isBlob(b))return b.size;if(pe.isSpecCompliantForm(b))return(await new t(Nt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(pe.isArrayBufferView(b)||pe.isArrayBuffer(b))return b.byteLength;if(pe.isURLSearchParams(b)&&(b=b+""),pe.isString(b))return(await l(b)).byteLength},Q=async(b,C)=>{const U=pe.toFiniteNumber(b.getContentLength());return U??y(C)};return async b=>{let{url:C,method:U,data:M,signal:E,cancelToken:I,timeout:R,onDownloadProgress:L,onUploadProgress:O,responseType:Y,headers:X,withCredentials:Ae="same-origin",fetchOptions:oe}=Gc(b),W=e||fetch;Y=Y?(Y+"").toLowerCase():"text";let ce=pg([E,I&&I.toAbortSignal()],R),$=null;const Be=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let Ce;try{if(O&&c&&U!=="get"&&U!=="head"&&(Ce=await Q(X,M))!==0){let ve=new t(C,{method:"POST",body:M,duplex:"half"}),xe;if(pe.isFormData(M)&&(xe=ve.headers.get("content-type"))&&X.setContentType(xe),ve.body){const[me,Se]=Vc(Ce,cn(zc(O)));M=$c(ve.body,Xc,me,Se)}}pe.isString(Ae)||(Ae=Ae?"include":"omit");const ee=n&&"credentials"in t.prototype,Z={...oe,signal:ce,method:U.toUpperCase(),headers:X.normalize().toJSON(),body:M,duplex:"half",credentials:ee?Ae:void 0};$=n&&new t(C,Z);let re=await(n?W($,oe):W(C,Z));const fe=h&&(Y==="stream"||Y==="response");if(h&&(L||fe&&Be)){const ve={};["status","statusText","headers"].forEach(He=>{ve[He]=re[He]});const xe=pe.toFiniteNumber(re.headers.get("content-length")),[me,Se]=L&&Vc(xe,cn(zc(L),!0))||[];re=new A($c(re.body,Xc,me,()=>{Se&&Se(),Be&&Be()}),ve)}Y=Y||"text";let we=await d[pe.findKey(d,Y)||"text"](re,b);return!fe&&Be&&Be(),await new Promise((ve,xe)=>{Kc(ve,xe,{data:we,headers:Yt.from(re.headers),status:re.status,statusText:re.statusText,config:b,request:$})})}catch(ee){throw Be&&Be(),ee&&ee.name==="TypeError"&&/Load failed|fetch/i.test(ee.message)?Object.assign(new je("Network Error",je.ERR_NETWORK,b,$,ee&&ee.response),{cause:ee.cause||ee}):je.from(ee,ee&&ee.code,b,$,ee&&ee.response)}}},yg=new Map,qc=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,h=yg;for(;o--;)l=n[o],c=h.get(l),c===void 0&&h.set(l,c=o?new Map:Bg(e)),h=c;return c};qc();const yo={http:V1,xhr:dg,fetch:{get:qc}};pe.forEach(yo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const jc=i=>`- ${i}`,Cg=i=>pe.isFunction(i)||i===null||i===!1;function vg(i,e){i=pe.isArray(i)?i:[i];const{length:t}=i;let A,r;const n={};for(let s=0;s<t;s++){A=i[s];let o;if(r=A,!Cg(A)&&(r=yo[(o=String(A)).toLowerCase()],r===void 0))throw new je(`Unknown adapter '${o}'`);if(r&&(pe.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
4
+ `+s.map(jc).join(`
5
+ `):" "+jc(s[0]):"as no adapter specified";throw new je("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const eh={getAdapter:vg,adapters:yo};function Co(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new or(null,i)}function th(i){return Co(i),i.headers=Yt.from(i.headers),i.data=Bo.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),eh.getAdapter(i.adapter||nr.adapter,i)(i).then(function(A){return Co(i),A.data=Bo.call(i,i.transformResponse,A),A.headers=Yt.from(A.headers),A},function(A){return Oc(A)||(Co(i),A&&A.response&&(A.response.data=Bo.call(i,i.transformResponse,A.response),A.response.headers=Yt.from(A.response.headers))),Promise.reject(A)})}const Ah="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 ih={};un.transitional=function(e,t,A){function r(n,s){return"[Axios v"+Ah+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new je(r(s," has been removed"+(t?" in "+t:"")),je.ERR_DEPRECATED);return t&&!ih[s]&&(ih[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(n,s,o):!0}},un.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function xg(i,e,t){if(typeof i!="object")throw new je("options must be an object",je.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 je("option "+n+" must be "+l,je.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new je("Unknown option "+n,je.ERR_BAD_OPTION)}}const dn={assertOptions:xg,validators:un},oA=dn.validators;let ci=class{constructor(e){this.defaults=e||{},this.interceptors={request:new _c,response:new _c}}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=li(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&dn.assertOptions(A,{silentJSONParsing:oA.transitional(oA.boolean),forcedJSONParsing:oA.transitional(oA.boolean),clarifyTimeoutError:oA.transitional(oA.boolean),legacyInterceptorReqResOrdering:oA.transitional(oA.boolean)},!1),r!=null&&(pe.isFunction(r)?t.paramsSerializer={serialize:r}:dn.assertOptions(r,{encode:oA.function,serialize:oA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),dn.assertOptions(t,{baseUrl:oA.spelling("baseURL"),withXsrfToken:oA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&pe.merge(n.common,n[t.method]);n&&pe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete n[b]}),t.headers=Yt.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||fo;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 h,d=0,y;if(!l){const b=[th.bind(this),void 0];for(b.unshift(...o),b.push(...c),y=b.length,h=Promise.resolve(t);d<y;)h=h.then(b[d++],b[d++]);return h}y=o.length;let Q=t;for(;d<y;){const b=o[d++],C=o[d++];try{Q=b(Q)}catch(U){C.call(this,U);break}}try{h=th.call(this,Q)}catch(b){return Promise.reject(b)}for(d=0,y=c.length;d<y;)h=h.then(c[d++],c[d++]);return h}getUri(e){e=li(this.defaults,e);const t=Wc(e.baseURL,e.url,e.allowAbsoluteUrls);return Dc(t,e.params,e.paramsSerializer)}};pe.forEach(["delete","get","head","options"],function(e){ci.prototype[e]=function(t,A){return this.request(li(A||{},{method:e,url:t,data:(A||{}).data}))}}),pe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(li(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}ci.prototype[e]=t(),ci.prototype[e+"Form"]=t(!0)});let Tg=class wp{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 or(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 wp(function(r){e=r}),cancel:e}}};function bg(i){return function(t){return i.apply(null,t)}}function Qg(i){return pe.isObject(i)&&i.isAxiosError===!0}const vo={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(vo).forEach(([i,e])=>{vo[e]=i});function rh(i){const e=new ci(i),t=xc(ci.prototype.request,e);return pe.extend(t,ci.prototype,e,{allOwnKeys:!0}),pe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return rh(li(i,r))},t}const ut=rh(nr);ut.Axios=ci,ut.CanceledError=or,ut.CancelToken=Tg,ut.isCancel=Oc,ut.VERSION=Ah,ut.toFormData=an,ut.AxiosError=je,ut.Cancel=ut.CanceledError,ut.all=function(e){return Promise.all(e)},ut.spread=bg,ut.isAxiosError=Qg,ut.mergeConfig=li,ut.AxiosHeaders=Yt,ut.formToJSON=i=>kc(pe.isHTMLForm(i)?new FormData(i):i),ut.getAdapter=eh.getAdapter,ut.HttpStatusCode=vo,ut.default=ut;const{Axios:AT,AxiosError:iT,CanceledError:rT,isCancel:nT,CancelToken:sT,VERSION:oT,all:aT,Cancel:lT,isAxiosError:cT,spread:hT,toFormData:uT,AxiosHeaders:dT,HttpStatusCode:pT,formToJSON:fT,getAdapter:gT,mergeConfig:mT}=ut,TA=Object.create(null);TA.open="0",TA.close="1",TA.ping="2",TA.pong="3",TA.message="4",TA.upgrade="5",TA.noop="6";const pn=Object.create(null);Object.keys(TA).forEach(i=>{pn[TA[i]]=i});const xo={type:"error",data:"parser error"},nh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",sh=typeof ArrayBuffer=="function",oh=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,To=({type:i,data:e},t,A)=>nh&&e instanceof Blob?t?A(e):ah(e,A):sh&&(e instanceof ArrayBuffer||oh(e))?t?A(e):ah(new Blob([e]),A):A(TA[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 lh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let bo;function Fg(i,e){if(nh&&i.data instanceof Blob)return i.data.arrayBuffer().then(lh).then(e);if(sh&&(i.data instanceof ArrayBuffer||oh(i.data)))return e(lh(i.data));To(i,!1,t=>{bo||(bo=new TextEncoder),e(bo.encode(t))})}const ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ar=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<ch.length;i++)ar[ch.charCodeAt(i)]=i;const Ug=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),h=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)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},Sg=typeof ArrayBuffer=="function",Qo=(i,e)=>{if(typeof i!="string")return{type:"message",data:hh(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:Eg(i.substring(1),e)}:pn[t]?i.length>1?{type:pn[t],data:i.substring(1)}:{type:pn[t]}:xo},Eg=(i,e)=>{if(Sg){const t=Ug(i);return hh(t,e)}else return{base64:!0,data:i}},hh=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,uh="",Lg=(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(uh))})})},Mg=(i,e)=>{const t=i.split(uh),A=[];for(let r=0;r<t.length;r++){const n=Qo(t[r],e);if(A.push(n),n.type==="error")break}return A};function Hg(){return new TransformStream({transform(i,e){Fg(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 Fo;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 Ig(i,e){Fo||(Fo=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),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(xo);break}r=h*Math.pow(2,32)+c.getUint32(4),A=3}else{if(fn(t)<r)break;const l=gn(t,r);o.enqueue(Qo(n?l:Fo.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(xo);break}}}})}const dh=4;function Ut(i){if(i)return Pg(i)}function Pg(i){for(var e in Ut.prototype)i[e]=Ut.prototype[e];return i}Ut.prototype.on=Ut.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},Ut.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},Ut.prototype.off=Ut.prototype.removeListener=Ut.prototype.removeAllListeners=Ut.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},Ut.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},Ut.prototype.emitReserved=Ut.prototype.emit,Ut.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},Ut.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),aA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Dg="arraybuffer";function wT(){}function ph(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const _g=aA.setTimeout,kg=aA.clearTimeout;function wn(i,e){e.useNativeTimers?(i.setTimeoutFn=_g.bind(aA),i.clearTimeoutFn=kg.bind(aA)):(i.setTimeoutFn=aA.setTimeout.bind(aA),i.clearTimeoutFn=aA.clearTimeout.bind(aA))}const Ng=1.33;function Og(i){return typeof i=="string"?Kg(i):Math.ceil((i.byteLength||i.size)*Ng)}function Kg(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 fh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Vg(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function zg(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 Wg extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class Uo extends Ut{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 Wg(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=Qo(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Vg(e);return t.length?"?"+t:""}}class Rg extends Uo{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)};Mg(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,Lg(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]=fh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let gh=!1;try{gh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Gg=gh;function $g(){}class Xg extends Rg{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 bA extends Ut{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=ph(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=bA.requestsCount++,bA.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=$g,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete bA.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(bA.requestsCount=0,bA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mh);else if(typeof addEventListener=="function"){const i="onpagehide"in aA?"pagehide":"unload";addEventListener(i,mh,!1)}}function mh(){for(let i in bA.requests)bA.requests.hasOwnProperty(i)&&bA.requests[i].abort()}const Zg=(function(){const i=wh({xdomain:!1});return i&&i.responseType!==null})();class Jg extends Xg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Zg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new bA(wh,this.uri(),e)}}function wh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Gg))return new XMLHttpRequest}catch{}if(!e)try{return new aA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Bh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Yg extends Uo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=Bh?{}:ph(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]=fh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const So=aA.WebSocket||aA.MozWebSocket;class qg extends Yg{createSocket(e,t,A){return Bh?new So(e,t,A):t?new So(e,t):new So(e)}doWrite(e,t){this.ws.send(t)}}class jg extends Uo{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=Ig(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=Hg();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 em={websocket:qg,webtransport:jg,polling:Jg},tm=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Am=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Eo(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=tm.exec(i||""),n={},s=14;for(;s--;)n[Am[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=im(n,n.path),n.queryKey=rm(n,n.query),n}function im(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 rm(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Lo=typeof addEventListener=="function"&&typeof removeEventListener=="function",Bn=[];Lo&&addEventListener("offline",()=>{Bn.forEach(i=>i())},!1);class VA extends Ut{constructor(e,t){if(super(),this.binaryType=Dg,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=Eo(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=Eo(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=zg(this.opts.query)),Lo&&(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=dh,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&&VA.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",VA.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+=Og(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(VA.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(),Lo&&(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}}}VA.protocol=dh;class nm extends VA{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;VA.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",d=>{if(!A)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;VA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(h(),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,h(),t.close(),t=null)}const s=d=>{const y=new Error("probe error: "+d);y.transport=t.name,n(),this.emitReserved("upgradeError",y)};function o(){s("transport closed")}function l(){s("socket closed")}function c(d){t&&d.name!==t.name&&n()}const h=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{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 sm=class extends nm{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=>em[r]).filter(r=>!!r)),super(e,A)}};function om(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=Eo(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 am=typeof ArrayBuffer=="function",lm=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,yh=Object.prototype.toString,cm=typeof Blob=="function"||typeof Blob<"u"&&yh.call(Blob)==="[object BlobConstructor]",hm=typeof File=="function"||typeof File<"u"&&yh.call(File)==="[object FileConstructor]";function Mo(i){return am&&(i instanceof ArrayBuffer||lm(i))||cm&&i instanceof Blob||hm&&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(Mo(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 um(i){const e=[],t=i.data,A=i;return A.data=Ho(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Ho(i,e){if(!i)return i;if(Mo(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]=Ho(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]=Ho(i[A],e));return t}return i}function dm(i,e){return i.data=Io(i.data,e),delete i.attachments,i}function Io(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]=Io(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Io(i[t],e));return i}const pm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ot;(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"})(ot||(ot={}));class fm{constructor(e){this.replacer=e}encode(e){return(e.type===ot.EVENT||e.type===ot.ACK)&&yn(e)?this.encodeAsBinary({type:e.type===ot.EVENT?ot.BINARY_EVENT:ot.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ot.BINARY_EVENT||e.type===ot.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=um(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class Po extends Ut{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===ot.BINARY_EVENT;A||t.type===ot.BINARY_ACK?(t.type=A?ot.EVENT:ot.ACK,this.reconstructor=new gm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Mo(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(ot[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===ot.BINARY_EVENT||A.type===ot.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 ot.CONNECT:return Ch(t);case ot.DISCONNECT:return t===void 0;case ot.CONNECT_ERROR:return typeof t=="string"||Ch(t);case ot.EVENT:case ot.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&pm.indexOf(t[0])===-1);case ot.ACK:case ot.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class gm{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=dm(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Ch(i){return Object.prototype.toString.call(i)==="[object Object]"}const mm=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Po,Encoder:fm,get PacketType(){return ot}},Symbol.toStringTag,{value:"Module"}));function mA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const wm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class vh extends Ut{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=[mA(e,"open",this.onopen.bind(this)),mA(e,"packet",this.onpacket.bind(this)),mA(e,"error",this.onerror.bind(this)),mA(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(wm.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:ot.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,d=t.pop();this._registerAckCallback(h,d),s.id=h}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:ot.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 ot.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 ot.EVENT:case ot.BINARY_EVENT:this.onevent(e);break;case ot.ACK:case ot.BINARY_ACK:this.onack(e);break;case ot.DISCONNECT:this.ondisconnect();break;case ot.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:ot.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:ot.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 Ui(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}Ui.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},Ui.prototype.reset=function(){this.attempts=0},Ui.prototype.setMin=function(i){this.ms=i},Ui.prototype.setMax=function(i){this.max=i},Ui.prototype.setJitter=function(i){this.jitter=i};class Do extends Ut{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 Ui({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||mm;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 sm(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=mA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=mA(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(mA(e,"ping",this.onping.bind(this)),mA(e,"data",this.ondata.bind(this)),mA(e,"error",this.onerror.bind(this)),mA(e,"close",this.onclose.bind(this)),mA(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 vh(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 lr={};function Cn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=om(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=lr[r]&&n in lr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new Do(A,e):(lr[r]||(lr[r]=new Do(A,e)),l=lr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Cn,{Manager:Do,Socket:vh,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 rA=_o("http://localhost:8000");function xh(i){const e=_o(i);e&&e!==rA&&(rA=e,Ct&&(Ct.disconnect(),Ct.removeAllListeners(),Ct=null))}let Ct=null;function Bm(){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=Cn(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 ko(){const i=_o(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=Bm()):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 ym(i,e){const t=ko();return t.on(i,e),()=>t.off(i,e)}function Cm(i,e){Ct&&Ct.off(i,e)}function vm(i,e){ko().emit(i,e)}function xm(){return Ct?Ct.connected?"connected":"connecting":"disconnected"}const vn={getSocket:ko,on:ym,off:Cm,emit:vm,getStatus:xm,setBaseUrl:xh},Tm={},bm=j.createContext(),Lt=()=>{const i=j.useContext(bm);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},Qm=({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:Qs&&Qs.tagName.toUpperCase()==="SCRIPT"&&Qs.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&Tm?.VITE_BASE_URL)??"http://localhost:5002",l={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account"},...t};t?.params;const[c,h]=j.useState(r||"BTC/USD"),[d,y]=j.useState(n||"M1"),[Q,b]=j.useState([]),[C,U]=j.useState(!0),[M,E]=j.useState([]),[I,R]=j.useState(!1),[L,O]=j.useState(1e5),[Y,X]=j.useState(!1),[Ae,oe]=j.useState(null),[W,ce]=j.useState(null),[$,Be]=j.useState([]),[Ce,ee]=j.useState(!0),[Z,re]=j.useState(!1),[fe,we]=j.useState(!0),[ve,xe]=j.useState("candles"),[me,Se]=j.useState(!1),[He,Ee]=j.useState("dark"),[_e,Qe]=j.useState(!1),[Ie,Ze]=j.useState([]);j.useRef(null),j.useEffect(()=>{vn.setBaseUrl(s)},[s]);const We=j.useRef(new Map);j.useRef(null);const Te=j.useCallback(async()=>{if(A)try{const De=localStorage.getItem("token");if(!De)return;R(!0);const Pe=await ut.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${De}`}});let ue=[];Array.isArray(Pe.data)?ue=Pe.data:Pe.data?.data&&Array.isArray(Pe.data.data)&&(ue=Pe.data.data);const ae=ue.filter(he=>he.closePrice===null||he.closePrice===void 0).map(he=>({id:he.id,ticket:23,symbol:he.symbol,type:he.type,volume:he.volume,openPrice:he.openPrice??he.price,stopLoss:he.stopLoss,takeProfit:he.takeProfit,comment:he.comment||"",status:"OPEN",swap:0,profit:he.profit||0,profitCurrency:"USD",time:new Date(he.openedAt||he.openAt||Date.now()).toLocaleTimeString(),openAt:he.openedAt||he.openAt,closeAt:he.closedAt||he.closeAt}));E(ae)}catch(De){console.error("❌ Error fetching orders:",De.response?.data||De.message),E([])}finally{R(!1)}},[s,A]),it=j.useCallback((De,Pe)=>!Pe||!De.price||isNaN(Pe)||isNaN(De.price)?De.profit||0:(De?.type?.toUpperCase()==="BUY"?Pe-De.price:De.price-Pe)*De.volume,[]),Ge=j.useCallback(async()=>{try{const De=localStorage.getItem("token");if(!De)return;const Pe=await ut.get(`${s}${l.account}`,{headers:{Authorization:`Bearer ${De}`}});if(Pe.data&&Pe.data.data){const ue=parseFloat(Pe.data.data.balance);isNaN(ue)||O(ue)}}catch(De){console.error("❌ Error fetching user balance:",De.response?.data||De.message)}},[s]),Ve=j.useCallback(async()=>{if(A)try{const De=localStorage.getItem("token");if(!De)return;const Pe=await ut.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${De}`}});let ue=[];Array.isArray(Pe.data)?ue=Pe.data:Pe.data?.data&&Array.isArray(Pe.data.data)&&(ue=Pe.data.data);const ae=ue.filter(he=>he.closePrice!==null&&he.closePrice!==void 0).map(he=>({id:he.id,ticket:23,symbol:he.symbol,type:he.type,volume:he.volume,openPrice:he.openPrice??he.price,closePrice:he.closePrice,stopLoss:he.stopLoss,takeProfit:he.takeProfit,profit:he.profit||0,profitCurrency:"USD",openAt:he.openedAt||he.openAt,closeAt:he.closedAt||he.closeAt,closeReason:he.closeReason||"",status:"CLOSED"}));Ze(ae)}catch(De){console.error("❌ Error fetching history orders:",De.response?.data||De.message),Ze([])}},[s,A]);j.useEffect(()=>{localStorage.getItem("token")&&A&&(Te(),Ge(),Ve())},[Te,Ge,Ve,A]),j.useEffect(()=>{(async()=>{try{U(!0);const Pe=l.symbols.includes("?")?`${s}${l.symbols}`:`${s}${l.symbols}`,ue=await ut.get(Pe);let ae=[];Array.isArray(ue.data)?ae=ue.data:ue.data&&ue.data.data&&Array.isArray(ue.data.data)?ae=ue.data.data:ue.data&&ue.data.prices&&Array.isArray(ue.data.prices)?ae=ue.data.prices:ue.data&&Array.isArray(ue.data)&&(ae=ue.data);const he=ae.map(Fe=>Fe.symbol&&(Fe.bid!==void 0||Fe.price!==void 0)?{symbol:Fe.symbol,bid:Fe.bid??Fe.price??0,ask:Fe.ask??Fe.price??0,change:Fe.change??0}:Fe);he.length>0?(b(he),he.find(Le=>Le.symbol===c)||h(he[0].symbol)):b([])}catch(Pe){console.error("❌ Error fetching symbols:",Pe.response?.data||Pe.message),b([])}finally{U(!1)}})()},[s,l.symbols]),j.useCallback(()=>{const De=We.current;if(De.size===0)return;const Pe=new Map(De);De.clear(),b(ue=>ue.map(ae=>{const he=Pe.get(ae.symbol);return he?{...ae,...he}:ae})),E(ue=>{let ae=!1;const he=ue.map(Fe=>{const Le=Pe.get(Fe.symbol);if(console.log("UASDSAD",Le),!Le)return Fe;const Ye=Fe.type?.toUpperCase()==="BUY"?parseFloat(Le.bid||0):parseFloat(Le.ask||0);if(!Ye||isNaN(Ye)||Ye<=0)return Fe;const qe=it(Fe,Ye);return qe===Fe.profit?Fe:(ae=!0,{...Fe,profit:qe})});return ae?he:ue})},[it])};var Th={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},bh=j.createContext&&j.createContext(Th),Fm=["attr","size","title"];function Um(i,e){if(i==null)return{};var t=Sm(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 Sm(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 xn(){return xn=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},xn.apply(this,arguments)}function Qh(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 Tn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qh(Object(t),!0).forEach(function(A){Em(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Qh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function Em(i,e,t){return e=Lm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Lm(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 Fh(i){return i&&i.map((e,t)=>j.createElement(e.tag,Tn({key:t},e.attr),Fh(e.child)))}function Wt(i){return e=>j.createElement(Hm,xn({attr:Tn({},i.attr)},e),Fh(i.child))}function Hm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=Um(i,Fm),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),j.createElement("svg",xn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Tn(Tn({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 bh!==void 0?j.createElement(bh.Consumer,null,t=>e(t)):e(Th)}function Im(i){return Wt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(i)}function Pm(i){return Wt({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 Dm(i){return Wt({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 _m(i){return Wt({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 Uh(i){return Wt({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 km(i){return Wt({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 Nm(i){return Wt({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 Om(i){return Wt({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 Km(i){return Wt({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 Vm(i){return Wt({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 zm={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Sh=({bidPrice:i,askPrice:e,userAccountId:t})=>{const{theme:A,selectedSymbol:r,fetchOrders:n,baseUrl:s,endpoints:o}=Lt(),l=A==="light",[c,h]=j.useState("0.01"),[d,y]=j.useState(""),[Q,b]=j.useState(!1),C=l?"bg-slate-100":"bg-[#12161d]",U=l?"text-slate-700":"text-white",M=l?"hover:bg-slate-200":"hover:bg-[#1e2635]",E=R=>{const L=parseFloat(c)||.01,O=Math.max(.01,L+R);h(O.toFixed(2))},I=async R=>{y("");const L=R,O=parseFloat(L==="BUY"?e:i),Y=parseFloat(c);if(!Y||Y<=0||isNaN(Y)){y("Please enter a valid volume (minimum 0.01)");return}if(Y<.01){y("Volume must be at least 0.01");return}if(!O||O<=0||isNaN(O)){y("Invalid price. Please refresh and try again.");return}const X=localStorage.getItem("token");if(!X){y("Please login to place trades");return}b(!0);const Ae=typeof r=="object"?r?.symbol:r,oe={accountId:t,symbol:Ae,type:L,volume:Y,openPrice:O,takeProfit:null,stopLoss:null};try{const W=s||zm?.VITE_BASE_URL||"http://localhost:8000",ce=o?.trades||"/api/trades",$=await ut.post(`${W}${ce}`,oe,{headers:{Authorization:`Bearer ${X}`,"Content-Type":"application/json"}});if($.status<200||$.status>=300){y($.data?.message||`Failed to place trade (${$.status})`);return}n&&n()}catch(W){const ce=W?.response?.data?.message||W?.message||"Network error. Please try again.";y(ce)}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:()=>I("SELL"),disabled:Q,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 ${C}`,children:[a.jsx("button",{type:"button",onClick:()=>E(-.01),className:`w-5 flex items-center justify-center ${U} ${M} transition-colors`,children:a.jsx(Uh,{size:8})}),a.jsx("input",{type:"number",value:c,onChange:R=>{const L=R.target.value;(L===""||/^\d*\.?\d{0,2}$/.test(L))&&h(L)},onBlur:()=>{const R=parseFloat(c);h(isNaN(R)||R<.01?"0.01":R.toFixed(2))},className:`w-14 text-center focus:outline-none ${C} ${U}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>E(.01),className:`w-5 flex items-center justify-center ${U} ${M} transition-colors`,children:a.jsx(km,{size:8})})]}),a.jsxs("button",{onClick:()=>I("BUY"),disabled:Q,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):"—"})]})]}),d&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:d})]})},Wm={},Eh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:d,setOrders:y,symbols:Q,fetchOrders:b,theme:C,baseUrl:U,endpoints:M}=Lt(),E=C==="light",I={getContractSpec:ae=>{const he=String(ae||"").toUpperCase();return he.includes("BTC")||he.includes("ETH")||he.includes("SOL")||he.includes("XRP")||he.includes("ADA")||he.includes("DOGE")||he.includes("BNB")||he.includes("AVAX")||he.includes("DOT")||he.includes("LINK")||he.endsWith("USDT")?{contractSize:1}:he.includes("XAU")||he.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:ae,volume:he})=>{const Fe=I.getContractSpec(ae);return(parseFloat(he)||0)*(Fe.contractSize||1)}},R=h||I,[L,O]=j.useState("0.01"),[Y,X]=j.useState(""),[Ae,oe]=j.useState(""),[W,ce]=j.useState(""),[$,Be]=j.useState(!1),[Ce,ee]=j.useState(null),[Z,re]=j.useState(""),[fe,we]=j.useState(t||"BUY"),[ve,xe]=j.useState(parseFloat(A)||0),[me,Se]=j.useState(parseFloat(r)||0),[He,Ee]=j.useState("text-white"),[_e,Qe]=j.useState("text-white"),Ie=j.useRef(parseFloat(A)||0),Ze=j.useRef(parseFloat(r)||0);j.useEffect(()=>{if(!i)return;const ae=vn.getSocket(),he=Le=>{if(!(!Le||!Le.symbol)&&Le.symbol.toUpperCase()===d?.toUpperCase()){const Ye=parseFloat(Le.bid)||0,qe=parseFloat(Le.ask)||0;Ye>0&&(Ye>Ie.current?(Ee("text-green-400"),setTimeout(()=>Ee("text-white"),500)):Ye<Ie.current&&Ie.current>0&&(Ee("text-red-400"),setTimeout(()=>Ee("text-white"),500)),xe(Ye),Ie.current=Ye),qe>0&&(qe>Ze.current?(Qe("text-green-400"),setTimeout(()=>Qe("text-white"),500)):qe<Ze.current&&Ze.current>0&&(Qe("text-red-400"),setTimeout(()=>Qe("text-white"),500)),Se(qe),Ze.current=qe)}};ae.on("priceUpdate",he);const Fe=Q.find(Le=>Le.symbol===d);if(Fe){const Le=parseFloat(Fe.bid)||0,Ye=parseFloat(Fe.ask)||0;Le>0&&(xe(Le),Ie.current=Le),Ye>0&&(Se(Ye),Ze.current=Ye)}return()=>{ae.off("priceUpdate",he)}},[i,d,Q]),j.useEffect(()=>{if(i){O(o?String(o):"0.01"),X(""),oe(""),ce(""),re(""),we(t||"BUY");const ae=parseFloat(A)||0,he=parseFloat(r)||0;ae>0&&(xe(ae),Ie.current=ae),he>0&&(Se(he),Ze.current=he)}},[i,t,o]);const We=ve||0,Te=me||0,it=ae=>{const he=parseFloat(L)||.01,Fe=Math.max(.01,he+ae);O(Fe.toFixed(2))},Ge=ae=>{const he=parseFloat(Y)||0,Fe=parseFloat(fe==="BUY"?me:ve)||0;if(!Fe){re("Current price not available. Please wait...");return}let Le=he+ae;fe==="BUY"?Le=Math.max(1e-5,Math.min(Le,Fe-1e-5)):Le=Math.max(Fe+1e-5,Le),X(Le>0?Le.toFixed(5):""),re("")},Ve=ae=>{const he=parseFloat(Ae)||0,Fe=parseFloat(fe==="BUY"?me:ve)||0;if(!Fe){re("Current price not available. Please wait...");return}let Le=he+ae;fe==="BUY"?Le=Math.max(Fe+1e-5,Le):Le=Math.max(1e-5,Math.min(Le,Fe-1e-5)),oe(Le>0?Le.toFixed(5):""),re("")},De=async ae=>{re("");const he=ae||fe,Fe=parseFloat(he==="BUY"?me:ve),Le=parseFloat(L),Ye=Y?parseFloat(Y):null,qe=Ae?parseFloat(Ae):null;if(!Le||Le<=0||isNaN(Le)){re("Please enter a valid volume (minimum 0.01)");return}if(Le<.01){re("Volume must be at least 0.01");return}if(!Fe||Fe<=0||isNaN(Fe)){re("Invalid price. Please refresh and try again.");return}if(Ye!==null&&Ye!==""){if(isNaN(Ye)||Ye<=0){re("Stop Loss must be a valid positive number");return}if(he==="BUY"&&Ye>=Fe){re("Stop Loss must be below the current price for BUY orders");return}if(he==="SELL"&&Ye<=Fe){re("Stop Loss must be above the current price for SELL orders");return}}if(qe!==null&&qe!==""){if(isNaN(qe)||qe<=0){re("Take Profit must be a valid positive number");return}if(he==="BUY"){if(qe<=Fe){re(`Take Profit must be above the entry price (${Fe.toFixed(5)}) for BUY orders`);return}}else if(he==="SELL"&&qe>=Fe){re(`Take Profit must be below the entry price (${Fe.toFixed(5)}) for SELL orders`);return}}we(he),ee(he),Be(!0);const Qt=new Date,tA=Qt.toLocaleTimeString(),$t=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,ei=localStorage.getItem("token");if(!ei){re("Please login to place trades"),Be(!1),ee(null);return}const Je={accountId:s,symbol:d,type:he,volume:Le,price:Fe,takeProfit:qe,stopLoss:Ye,comment:W.trim()||null},Re={ticket:$t.substring(0,8),symbol:d,type:he,volume:parseFloat(Le),price:parseFloat(Fe),time:tA,stopLoss:Ye?parseFloat(Ye):null,takeProfit:qe?parseFloat(qe):null,swap:0,profit:0,profitCurrency:"USD",comment:W.trim()||"",id:$t,status:"OPEN",openAt:Qt.toISOString()};if(!l&&y&&y(Ne=>[...Ne,Re]),c&&!n){re("Execution handler is required in forceParentExecution mode"),Be(!1),ee(null);return}if(n){Be(!1),ee(null),e();const Ne={symbol:d,type:he,lotSize:Le,entryPrice:Fe,stopLoss:Ye,takeProfit:qe,comment:W.trim()||null};Promise.resolve(n(Ne)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),b&&b()}).catch(ct=>{console.error("❌ Trade execution failed:",ct),!l&&y&&y(rt=>rt.filter(ke=>ke.id!==$t))})}else{if(c){re("Fallback API path disabled in forceParentExecution mode"),Be(!1),ee(null);return}Be(!1),ee(null),e();const Ne=U||Wm?.VITE_BASE_URL||"http://localhost:8000",ct=M?.trades||"/api/trades";ut.post(`${Ne}${ct}`,Je,{headers:{Authorization:`Bearer ${ei}`,"Content-Type":"application/json"}}).then(rt=>{if(rt.data&&rt.data.data){const ke=rt.data.data.trade;!l&&y&&y(mt=>mt.map(vt=>vt.id===$t?{...vt,id:ke.id,ticket:ke.id.substring(0,8),time:tA,openAt:ke.openAt}:vt)),console.log("✅ Trade saved successfully:",ke),window.notify&&window.notify(`Trade placed successfully: ${ke.symbol} ${ke.type}`,"success")}else{!l&&y&&y(mt=>mt.filter(vt=>vt.id!==$t));const ke=rt.data?.message||"Failed to place trade";window.notify&&window.notify(ke,"error")}}).catch(rt=>{console.error("Error placing trade:",rt),!l&&y&&y(mt=>mt.filter(vt=>vt.id!==$t));let ke="Failed to place trade";if(rt.response){const mt=rt.response.status,vt=rt.response.data;mt===400?ke=vt?.message||"Invalid trade data. Please check your inputs.":mt===401?ke="Authentication failed. Please login again.":mt===404?ke=vt?.message||"Symbol not found. Please select a valid symbol.":mt===500?ke="Server error. Please try again later.":ke=vt?.message||`Error: ${mt}`}else rt.request&&(ke="Network error. Please check your internet connection.");window.notify&&window.notify(ke,"error")})}},ue=(R?.calculateVolumeUnits?.({symbol:d,volume:parseFloat(L)||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 ${E?"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 ${E?"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 ${E?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${E?"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 ${E?"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:[Z&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:Z}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${E?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${E?"text-slate-700":"text-white"}`,children:[ue," ",d]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>it(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${E?"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:L,onChange:ae=>{const he=ae.target.value;(he===""||/^\d*\.?\d{0,2}$/.test(he))&&(O(he),re(""))},onBlur:()=>{const ae=parseFloat(L);O(isNaN(ae)||ae<.01?"0.01":ae.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${E?"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:()=>it(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${E?"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 ${E?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>Ge(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${E?"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:Y,onChange:ae=>{const he=ae.target.value;(he===""||/^\d*\.?\d*$/.test(he))&&(X(he),re(""))},onBlur:ae=>{const he=parseFloat(ae.target.value);!isNaN(he)&&he>0?X(he.toFixed(5)):ae.target.value===""&&X("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${E?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>Ge(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${E?"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 ${E?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>Ve(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${E?"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:ae=>{const he=ae.target.value;(he===""||/^\d*\.?\d*$/.test(he))&&(oe(he),re(""))},onBlur:ae=>{const he=parseFloat(ae.target.value);!isNaN(he)&&he>0?oe(he.toFixed(5)):ae.target.value===""&&oe("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${E?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>Ve(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${E?"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 ${E?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:W,onChange:ae=>ce(ae.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 ${E?"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 ${E?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:E?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${He} font-medium transition-colors duration-400`,children:We>0?We.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:E?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${_e} font-medium transition-colors duration-400`,children:Te>0?Te.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>De("SELL"),disabled:$,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:$&&Ce==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),a.jsx("button",{onClick:()=>De("BUY"),disabled:$,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:$&&Ce==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null},Rm={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"},Gm=[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"}],zA={width:"78%",height:"78%",display:"block"},Lh={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 QA(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 Xm=()=>a.jsx(Km,{style:zA}),Zm=()=>a.jsx(Vm,{style:zA}),Jm=()=>a.jsx(_m,{style:zA}),Ym=()=>a.jsx(Om,{style:zA}),qm=()=>a.jsx(Pm,{style:zA}),jm=()=>a.jsx(Im,{style:zA}),ew=()=>a.jsx(Dm,{style:zA}),tw=()=>a.jsx(Uh,{style:zA}),No=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function cr({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(No,{size:"18px",children:r})})}function tt({checked:i,onChange:e,label:t,tokens:A,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:i,onChange:n=>e(n.target.checked),disabled:r,style:Lh}),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 Mt({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=QA(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:h=>e(h.target.value),disabled:A,style:{...Lh,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const d=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(d?`#${d}`:"")},onBlur:t,disabled:A,style:c})]})}function lA({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 hi({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(tw,{})})]})}function Aw({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(tt,{checked:A,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:bn.map(s=>a.jsx(tt,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function iw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,QA(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(Mt,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(hi,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Gm.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(cr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(Jm,{})}),a.jsx(cr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Ym,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(cr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(qm,{})}),a.jsx(cr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(jm,{})}),a.jsx(cr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(ew,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(tt,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(tt,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(Mt,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(lA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.borderEnabled,value:i.borderOpacity??.1,onChange:n=>A("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!i.borderEnabled,value:i.borderWidth??1,onChange:n=>A("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:i.borderWidth??1})]}),a.jsx(tt,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Mt,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(lA,{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,QA(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(Mt,{value:i.lineColor||"#22c55e",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(tt,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(tt,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(tt,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(tt,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(hi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(tt,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(tt,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(tt,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(tt,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function rw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,QA(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(Mt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(tt,{checked:i.showArea!==!1,onChange:n=>A("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(hi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(tt,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(tt,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function nw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,QA(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(Mt,{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(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(hi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(tt,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(tt,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(tt,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(tt,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function sw({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(lA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function ui(i){if(!i)return"";const e=new Date(i*1e3),t=A=>String(A).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function di({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:ui(i.point1Time),style:n}),a.jsx(lA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:ui(i.point2Time),style:n}),a.jsx(lA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Mh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,QA(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(Mt,{value:i.lineColor||"#3b82f6",onChange:s=>A("lineColor",s),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:s=>A("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(tt,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(tt,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(Mt,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(hi,{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(hi,{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 ow({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(lA,{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 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:ui(i.originTime),style:r}),a.jsx(lA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function lw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,QA(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(Mt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(tt,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function cw({draft:i,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:ui(i.rawTime),style:t})]})})}function hw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,QA(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(Mt,{value:i.lineColor||"#7aa6ae",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(tt,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(tt,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(tt,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(tt,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(hi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(tt,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(tt,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(tt,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function uw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,QA(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(Mt,{value:i.lineColor||"#06a0e3",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(tt,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(tt,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function dw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:ui(i.rawTime),style:r}),a.jsx(lA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Hh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,QA(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(Mt,{value:i.lineColor||"#129f5c",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(tt,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Mt,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(lA,{tokens:t,value:i.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&A("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(tt,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Mt,{value:i.pricesColor||"#129f5c",onChange:n=>A("pricesColor",n),onBlur:()=>r("pricesColor",i.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(tt,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(tt,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(tt,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(tt,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Ih({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:ui(i.point1Time),style:n}),a.jsx(lA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:ui(i.point2Time),style:n}),a.jsx(lA,{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(lA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function pw(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 Ph=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Lt(),s=$m(r==="light"),[o,l]=j.useState("style"),[c,h]=j.useState({}),[d,y]=j.useState(null),Q=j.useRef(null),b=j.useRef(null);j.useEffect(()=>{t&&(h(pw(t)),l("style"))},[t]),j.useEffect(()=>{i||y(null)},[i]);const C=L=>{if(L.button!==0)return;L.preventDefault();const O=Q.current;if(!O)return;const Y=O.offsetParent,X=Y?Y.getBoundingClientRect():{left:0,top:0},Ae=O.getBoundingClientRect(),oe=Ae.left-X.left,W=Ae.top-X.top;b.current={startMX:L.clientX,startMY:L.clientY,startX:oe,startY:W},y({x:oe,y:W});const ce=Be=>{const{startMX:Ce,startMY:ee,startX:Z,startY:re}=b.current;y({x:Z+Be.clientX-Ce,y:re+Be.clientY-ee})},$=()=>{b.current=null,document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",$)};document.addEventListener("mousemove",ce),document.addEventListener("mouseup",$)};if(!i||!t)return null;const U=Rm[t.type]||t.type,M=["style","coordinates","visualization"],E=()=>{if(o==="visualization")return a.jsx(Aw,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(iw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(sw,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(di,{draft:c,setDraft:h,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Mh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ow,{draft:c,setDraft:h,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Mh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(aw,{draft:c,setDraft:h,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(lw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(cw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(nw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(di,{draft:c,setDraft:h,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(rw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(di,{draft:c,setDraft:h,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(di,{draft:c,setDraft:h,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(di,{draft:c,setDraft:h,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Qn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(di,{draft:c,setDraft:h,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(uw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(dw,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(hw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(di,{draft:c,setDraft:h,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Hh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ih,{draft:c,setDraft:h,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Hh,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ih,{draft:c,setDraft:h,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},I=()=>{A(c),e()};return a.jsxs("div",{ref:Q,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...d===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:d.y,left:d.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(No,{size:"18px",children:a.jsx(Xm,{})})})]})}),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(No,{size:"20px",children:a.jsx(Zm,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:M.map(L=>{const O=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:O?s.text:s.mutedText,cursor:"pointer"},children:[L.charAt(0).toUpperCase()+L.slice(1),O&&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: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:I,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 Oo=function(i,e){return Oo=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])},Oo(i,e)};function wA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Oo(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ko=function(){return Ko=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},Ko.apply(this,arguments)};function Rt(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(h){try{c(A.next(h))}catch(d){s(d)}}function l(h){try{c(A.throw(h))}catch(d){s(d)}}function c(h){h.done?n(h.value):r(h.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Ot(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(h){return l([c,h])}}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(h){c=[6,h],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 DA=(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 DA.fromClientRect(i,e.getBoundingClientRect())},fw=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 DA(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},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},Dh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gw=typeof Uint8Array>"u"?[]:new Uint8Array(256),En=0;En<Dh.length;En++)gw[Dh.charCodeAt(En)]=En;for(var _h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ln=0;Ln<_h.length;Ln++)hr[_h.charCodeAt(Ln)]=Ln;for(var mw=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),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=hr[i.charCodeAt(A)],s=hr[i.charCodeAt(A+1)],o=hr[i.charCodeAt(A+2)],l=hr[i.charCodeAt(A+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},ww=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Bw=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,Vo=11,zo=2,yw=Vo-pi,kh=65536>>pi,Cw=1<<pi,Wo=Cw-1,vw=1024>>pi,xw=kh+vw,Tw=xw,bw=32,Qw=Tw+bw,Fw=65536>>Vo,Uw=1<<yw,Sw=Uw-1,Nh=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Ew=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Lw=function(i,e){var t=mw(i),A=Array.isArray(t)?Bw(t):new Uint32Array(t),r=Array.isArray(t)?ww(t):new Uint16Array(t),n=24,s=Nh(r,n/2,A[4]/2),o=A[5]===2?Nh(r,(n+A[4])/2):Ew(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>>pi],t=(t<<zo)+(e&Wo),this.data[t];if(e<=65535)return t=this.index[kh+(e-55296>>pi)],t=(t<<zo)+(e&Wo),this.data[t];if(e<this.highStart)return t=Qw-Fw+(e>>Vo),t=this.index[t],t+=e>>pi&Sw,t=this.index[t],t=(t<<zo)+(e&Wo),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Oh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Mn=0;Mn<Oh.length;Mn++)Hw[Oh.charCodeAt(Mn)]=Mn;var Iw="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,Pw=1,Vh=2,zh=3,Dw=4,_w=5,Wh=7,Rh=8,Gh=9,WA=10,Ro=11,$h=12,Go=13,kw=14,ur=15,$o=16,Hn=17,dr=18,Nw=19,Xh=20,Xo=21,pr=22,Zo=23,Si=24,nA=25,fr=26,gr=27,Ei=28,Ow=29,fi=30,Kw=31,In=32,Pn=33,Jo=34,Yo=35,qo=36,mr=37,jo=38,Dn=39,_n=40,ea=41,Zh=42,Vw=43,zw=[9001,65288],Jh="!",st="×",kn="÷",ta=Lw(Iw),_A=[fi,qo],Aa=[Pw,Vh,zh,_w],Yh=[WA,Rh],qh=[gr,fr],Ww=Aa.concat(Yh),jh=[jo,Dn,_n,Jo,Yo],Rw=[ur,Go],Gw=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ta.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($o);if(o===Dw||o===Ro){if(s===0)return A.push(s),t.push(fi);var l=t[s-1];return Ww.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(fi))}if(A.push(s),o===Kw)return t.push(e==="strict"?Xo:mr);if(o===Zh||o===Ow)return t.push(fi);if(o===Vw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(mr):t.push(fi);t.push(o)}),[A,t,r]},ia=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!==WA)break}if(r===WA)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!==WA)break}if(o!==WA)break}return!1},eu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===WA)t--;else return A}return 0},$w=function(i,e,t,A,r){if(t[A]===0)return st;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return st;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,h=e[o];if(l===Vh&&h===zh)return st;if(Aa.indexOf(l)!==-1)return Jh;if(Aa.indexOf(h)!==-1||Yh.indexOf(h)!==-1)return st;if(eu(n,e)===Rh)return kn;if(ta.get(i[n])===Ro||(l===In||l===Pn)&&ta.get(i[o])===Ro||l===Wh||h===Wh||l===Gh||[WA,Go,ur].indexOf(l)===-1&&h===Gh||[Hn,dr,Nw,Si,Ei].indexOf(h)!==-1||eu(n,e)===pr||ia(Zo,pr,n,e)||ia([Hn,dr],Xo,n,e)||ia($h,$h,n,e))return st;if(l===WA)return kn;if(l===Zo||h===Zo)return st;if(h===$o||l===$o)return kn;if([Go,ur,Xo].indexOf(h)!==-1||l===kw||c===qo&&Rw.indexOf(l)!==-1||l===Ei&&h===qo||h===Xh||_A.indexOf(h)!==-1&&l===nA||_A.indexOf(l)!==-1&&h===nA||l===gr&&[mr,In,Pn].indexOf(h)!==-1||[mr,In,Pn].indexOf(l)!==-1&&h===fr||_A.indexOf(l)!==-1&&qh.indexOf(h)!==-1||qh.indexOf(l)!==-1&&_A.indexOf(h)!==-1||[gr,fr].indexOf(l)!==-1&&(h===nA||[pr,ur].indexOf(h)!==-1&&e[o+1]===nA)||[pr,ur].indexOf(l)!==-1&&h===nA||l===nA&&[nA,Ei,Si].indexOf(h)!==-1)return st;if([nA,Ei,Si,Hn,dr].indexOf(h)!==-1)for(var d=n;d>=0;){var y=e[d];if(y===nA)return st;if([Ei,Si].indexOf(y)!==-1)d--;else break}if([gr,fr].indexOf(h)!==-1)for(var d=[Hn,dr].indexOf(l)!==-1?s:n;d>=0;){var y=e[d];if(y===nA)return st;if([Ei,Si].indexOf(y)!==-1)d--;else break}if(jo===l&&[jo,Dn,Jo,Yo].indexOf(h)!==-1||[Dn,Jo].indexOf(l)!==-1&&[Dn,_n].indexOf(h)!==-1||[_n,Yo].indexOf(l)!==-1&&h===_n||jh.indexOf(l)!==-1&&[Xh,fr].indexOf(h)!==-1||jh.indexOf(h)!==-1&&l===gr||_A.indexOf(l)!==-1&&_A.indexOf(h)!==-1||l===Si&&_A.indexOf(h)!==-1||_A.concat(nA).indexOf(l)!==-1&&h===pr&&zw.indexOf(i[o])===-1||_A.concat(nA).indexOf(h)!==-1&&l===dr)return st;if(l===ea&&h===ea){for(var Q=t[n],b=1;Q>0&&(Q--,e[Q]===ea);)b++;if(b%2!==0)return st}return l===In&&h===Pn?st:kn},Xw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Gw(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,fi,Zh].indexOf(o)!==-1?mr: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]},Zw=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===Jh,this.start=A,this.end=r}return i.prototype.slice=function(){return Tt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),Jw=function(i,e){var t=Sn(i),A=Xw(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 h=st;c<o&&(h=$w(t,n,r,++c,s))===st;);if(h!==st||c===o){var d=new Zw(t,h,l,c);return l=c,{value:d,done:!1}}return{done:!0,value:null}}}},Yw=1,qw=2,wr=4,tu=8,Nn=10,Au=47,Br=92,jw=9,eB=32,On=34,yr=61,tB=35,AB=36,iB=37,Kn=39,Vn=40,Cr=41,rB=95,qt=45,nB=33,sB=60,oB=62,aB=64,lB=91,cB=93,hB=61,uB=123,zn=63,dB=125,iu=124,pB=126,fB=128,ru=65533,ra=42,gi=43,gB=44,mB=58,wB=59,vr=46,BB=0,yB=8,CB=11,vB=14,xB=31,TB=127,FA=-1,nu=48,su=97,ou=101,bB=102,QB=117,FB=122,au=65,lu=69,cu=70,UB=85,SB=90,Kt=function(i){return i>=nu&&i<=57},EB=function(i){return i>=55296&&i<=57343},Li=function(i){return Kt(i)||i>=au&&i<=cu||i>=su&&i<=bB},LB=function(i){return i>=su&&i<=FB},MB=function(i){return i>=au&&i<=SB},HB=function(i){return LB(i)||MB(i)},IB=function(i){return i>=fB},Wn=function(i){return i===Nn||i===jw||i===eB},Rn=function(i){return HB(i)||IB(i)||i===rB},hu=function(i){return Rn(i)||Kt(i)||i===qt},PB=function(i){return i>=BB&&i<=yB||i===CB||i>=vB&&i<=xB||i===TB},RA=function(i,e){return i!==Br?!1:e!==Nn},Gn=function(i,e,t){return i===qt?Rn(e)||RA(e,t):Rn(i)?!0:!!(i===Br&&RA(i,e))},na=function(i,e,t){return i===gi||i===qt?Kt(e)?!0:e===vr&&Kt(t):Kt(i===vr?e:i)},DB=function(i){var e=0,t=1;(i[e]===gi||i[e]===qt)&&(i[e]===qt&&(t=-1),e++);for(var A=[];Kt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Tt.apply(void 0,A),10):0;i[e]===vr&&e++;for(var n=[];Kt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Tt.apply(void 0,n),10):0;(i[e]===lu||i[e]===ou)&&e++;var l=1;(i[e]===gi||i[e]===qt)&&(i[e]===qt&&(l=-1),e++);for(var c=[];Kt(i[e]);)c.push(i[e++]);var h=c.length?parseInt(Tt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*h)},_B={type:2},kB={type:3},NB={type:4},OB={type:13},KB={type:8},VB={type:21},zB={type:9},WB={type:10},RB={type:11},GB={type:12},$B={type:14},$n={type:23},XB={type:1},ZB={type:25},JB={type:24},YB={type:26},qB={type:27},jB={type:28},e2={type:29},t2={type:31},sa={type:32},uu=(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!==sa;)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 tB:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(hu(t)||RA(A,r)){var n=Gn(t,A,r)?qw:Yw,s=this.consumeName();return{type:5,value:s,flags:n}}break;case AB:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),OB;break;case Kn:return this.consumeStringToken(Kn);case Vn:return _B;case Cr:return kB;case ra:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),$B;break;case gi:if(na(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case gB:return NB;case qt:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(na(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Gn(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===qt&&c===oB)return this.consumeCodePoint(),this.consumeCodePoint(),JB;break;case vr:if(na(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Au:if(this.peekCodePoint(0)===ra)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===ra&&(h=this.consumeCodePoint(),h===Au))return this.consumeToken();if(h===FA)return this.consumeToken()}break;case mB:return YB;case wB:return qB;case sB:if(this.peekCodePoint(0)===nB&&this.peekCodePoint(1)===qt&&this.peekCodePoint(2)===qt)return this.consumeCodePoint(),this.consumeCodePoint(),ZB;break;case aB:var d=this.peekCodePoint(0),y=this.peekCodePoint(1),Q=this.peekCodePoint(2);if(Gn(d,y,Q)){var s=this.consumeName();return{type:7,value:s}}break;case lB:return jB;case Br:if(RA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case cB:return e2;case hB:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),KB;break;case uB:return RB;case dB:return GB;case QB:case UB:var b=this.peekCodePoint(0),C=this.peekCodePoint(1);return b===gi&&(Li(C)||C===zn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case iu:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),zB;if(this.peekCodePoint(0)===iu)return this.consumeCodePoint(),VB;break;case pB:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),WB;break;case FA:return sa}return Wn(e)?(this.consumeWhiteSpace(),t2):Kt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Rn(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();Li(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(Tt.apply(void 0,e.map(function(l){return l===zn?nu:l})),16),n=parseInt(Tt.apply(void 0,e.map(function(l){return l===zn?cu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Tt.apply(void 0,e),16);if(this.peekCodePoint(0)===qt&&Li(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Li(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)===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)===FA)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)===FA||this.peekCodePoint(0)===Cr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),$n)}for(;;){var r=this.consumeCodePoint();if(r===FA||r===Cr)return{type:22,value:Tt.apply(void 0,e)};if(Wn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===FA||this.peekCodePoint(0)===Cr?(this.consumeCodePoint(),{type:22,value:Tt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),$n);if(r===On||r===Kn||r===Vn||PB(r))return this.consumeBadUrlRemnants(),$n;if(r===Br)if(RA(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===Cr||e===FA)return;RA(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===FA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===Nn)return this._value.splice(0,A),XB;if(r===Br){var n=this._value[A+1];n!==FA&&n!==void 0&&(n===Nn?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):RA(r,n)&&(t+=this.consumeStringSlice(A),t+=Tt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=wr,A=this.peekCodePoint(0);for((A===gi||A===qt)&&e.push(this.consumeCodePoint());Kt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===vr&&Kt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=tu;Kt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===lu||A===ou)&&((r===gi||r===qt)&&Kt(n)||Kt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=tu;Kt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[DB(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===iB?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Li(e)){for(var t=Tt(e);Li(this.peekCodePoint(0))&&t.length<6;)t+=Tt(this.consumeCodePoint());Wn(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||EB(A)||A>1114111?ru:A}return e===FA?ru:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(hu(t))e+=Tt(t);else if(RA(t,this.peekCodePoint(0)))e+=Tt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),du=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new uu;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||i2(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"?sa:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),xr=function(i){return i.type===15},Mi=function(i){return i.type===17},dt=function(i){return i.type===20},A2=function(i){return i.type===0},oa=function(i,e){return dt(i)&&i.value===e},pu=function(i){return i.type!==31},Hi=function(i){return i.type!==31&&i.type!==4},UA=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},i2=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},GA=function(i){return i.type===17||i.type===15},St=function(i){return i.type===16||GA(i)},fu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},Pt={type:17,number:0,flags:wr},aa={type:16,number:50,flags:wr},$A={type:16,number:100,flags:wr},Tr=function(i,e,t){var A=i[0],r=i[1];return[gt(A,e),gt(typeof r<"u"?r:A,t)]},gt=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},gu="deg",mu="grad",wu="rad",Bu="turn",Xn={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case gu:return Math.PI*e.number/180;case mu:return Math.PI/200*e.number;case wu:return e.number;case Bu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},yu=function(i){return i.type===15&&(i.unit===gu||i.unit===mu||i.unit===wu||i.unit===Bu)},Cu=function(i){var e=i.filter(dt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Pt,Pt];case"to top":case"bottom":return cA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Pt,$A];case"to right":case"left":return cA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[$A,$A];case"to bottom":case"top":return cA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[$A,Pt];case"to left":case"right":return cA(270)}return 0},cA=function(i){return Math.PI*i/180},XA={name:"color",parse:function(i,e){if(e.type===18){var t=r2[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 JA(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 JA(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 JA(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 JA(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=kA[e.value.toUpperCase()];if(typeof o<"u")return o}return kA.TRANSPARENT}},ZA=function(i){return(255&i)===0},Ht=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+")"},JA=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},vu=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},xu=function(i,e){var t=e.filter(Hi);if(t.length===3){var A=t.map(vu),r=A[0],n=A[1],s=A[2];return JA(r,n,s,1)}if(t.length===4){var o=t.map(vu),r=o[0],n=o[1],s=o[2],l=o[3];return JA(r,n,s,l)}return 0};function la(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 Tu=function(i,e){var t=e.filter(Hi),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?cA(A.number):Xn.parse(i,A))/(Math.PI*2),l=St(r)?r.number/100:0,c=St(n)?n.number/100:0,h=typeof s<"u"&&St(s)?gt(s,1):1;if(l===0)return JA(c*255,c*255,c*255,1);var d=c<=.5?c*(l+1):c+l-c*l,y=c*2-d,Q=la(y,d,o+1/3),b=la(y,d,o),C=la(y,d,o-1/3);return JA(Q*255,b*255,C*255,h)},r2={hsl:Tu,hsla:Tu,rgb:xu,rgba:xu},br=function(i,e){return XA.parse(i,du.create(e).parseComponentValue())},kA={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},n2={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(dt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},s2={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Zn=function(i,e){var t=XA.parse(i,e[0]),A=e[1];return A&&St(A)?{color:t,stop:A}:{color:t,stop:null}},bu=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=Pt),A.stop===null&&(A.stop=$A);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=gt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var h=r[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var d=s-c,y=r[c-1],Q=(h-y)/(d+1),b=1;b<=d;b++)r[c+b-1]=Q*b;c=null}}return i.map(function(C,U){var M=C.color;return{color:M,stop:Math.max(Math.min(1,r[U]/e),0)}})},o2=function(i,e,t){var A=e/2,r=t/2,n=gt(i[0],e)-A,s=r-gt(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},a2=function(i,e,t){var A=typeof i=="number"?i:o2(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]},BA=function(i,e){return Math.sqrt(i*i+e*e)},Qu=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],h=BA(t-l,A-c);return(r?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},l2=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(BA(e,t),BA(e,t-r),BA(e-A,t),BA(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=Qu(A,r,e,t,!0),c=l[0],h=l[1];n=BA(c-e,(h-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(BA(e,t),BA(e,t-r),BA(e-A,t),BA(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)),d=Qu(A,r,e,t,!1),c=d[0],h=d[1];n=BA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=gt(i.size[0],A),s=i.size.length===2?gt(i.size[1],r):n),[n,s]},c2=function(i,e){var t=cA(180),A=[];return UA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Cu(r);return}else if(yu(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=cA(180),A=[];return UA(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=Cu(r);return}else if(yu(s)){t=(Xn.parse(i,s)+cA(270))%cA(360);return}}var o=Zn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},h2=function(i,e){var t=cA(180),A=[],r=1,n=0,s=3,o=[];return UA(e).forEach(function(l,c){var h=l[0];if(c===0){if(dt(h)&&h.value==="linear"){r=1;return}else if(dt(h)&&h.value==="radial"){r=2;return}}if(h.type===18){if(h.name==="from"){var d=XA.parse(i,h.values[0]);A.push({stop:Pt,color:d})}else if(h.name==="to"){var d=XA.parse(i,h.values[0]);A.push({stop:$A,color:d})}else if(h.name==="color-stop"){var y=h.values.filter(Hi);if(y.length===2){var d=XA.parse(i,y[1]),Q=y[0];Mi(Q)&&A.push({stop:{type:16,number:Q.number*100,flags:Q.flags},color:d})}}}}),r===1?{angle:(t+cA(180))%cA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},Fu="closest-side",Uu="farthest-side",Su="closest-corner",Eu="farthest-corner",Lu="circle",Mu="ellipse",Hu="cover",Iu="contain",u2=function(i,e){var t=0,A=3,r=[],n=[];return UA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(d,y){if(c)if(dt(y))switch(y.value){case"center":return n.push(aa),d;case"top":case"left":return n.push(Pt),d;case"right":case"bottom":return n.push($A),d}else(St(y)||GA(y))&&n.push(y);else if(dt(y))switch(y.value){case Lu:return t=0,!1;case Mu:return t=1,!1;case"at":return c=!0,!1;case Fu:return A=0,!1;case Hu:case Uu:return A=1,!1;case Iu:case Su:return A=2,!1;case Eu:return A=3,!1}else if(GA(y)||St(y))return Array.isArray(A)||(A=[]),A.push(y),!1;return d},l)}if(l){var h=Zn(i,s);r.push(h)}}),{size:A,shape:t,stops:r,position:n,type:2}},Yn=function(i,e){var t=0,A=3,r=[],n=[];return UA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(h,d){if(dt(d))switch(d.value){case"center":return n.push(aa),!1;case"top":case"left":return n.push(Pt),!1;case"right":case"bottom":return n.push($A),!1}else if(St(d)||GA(d))return n.push(d),!1;return h},l):o===1&&(l=s.reduce(function(h,d){if(dt(d))switch(d.value){case Lu:return t=0,!1;case Mu:return t=1,!1;case Iu:case Fu:return A=0,!1;case Uu:return A=1,!1;case Su:return A=2,!1;case Hu:case Eu:return A=3,!1}else if(GA(d)||St(d))return Array.isArray(A)||(A=[]),A.push(d),!1;return h},l)),l){var c=Zn(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},d2=function(i){return i.type===1},p2=function(i){return i.type===2},ca={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=Pu[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 f2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Pu[i.name])}var Pu={"linear-gradient":c2,"-moz-linear-gradient":Jn,"-ms-linear-gradient":Jn,"-o-linear-gradient":Jn,"-webkit-linear-gradient":Jn,"radial-gradient":u2,"-moz-radial-gradient":Yn,"-ms-radial-gradient":Yn,"-o-radial-gradient":Yn,"-webkit-radial-gradient":Yn,"-webkit-gradient":h2},g2={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 Hi(A)&&f2(A)}).map(function(A){return ca.parse(i,A)})}},m2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(dt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},w2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return UA(e).map(function(t){return t.filter(St)}).map(fu)}},B2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return UA(e).map(function(t){return t.filter(dt).map(function(A){return A.value}).join(" ")}).map(y2)}},y2=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}},Ii;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Ii||(Ii={}));var C2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return UA(e).map(function(t){return t.filter(v2)})}},v2=function(i){return dt(i)||St(i)},qn=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},x2=qn("top"),T2=qn("right"),b2=qn("bottom"),Q2=qn("left"),jn=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return fu(t.filter(St))}}},F2=jn("top-left"),U2=jn("top-right"),S2=jn("bottom-right"),E2=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}}},L2=es("top"),M2=es("right"),H2=es("bottom"),I2=es("left"),ts=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return xr(t)?t.number:0}}},P2=ts("top"),D2=ts("right"),_2=ts("bottom"),k2=ts("left"),N2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},O2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},K2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(dt).reduce(function(t,A){return t|V2(A.value)},0)}},V2=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},z2={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}},W2={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 R2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?As.STRICT:As.NORMAL}},G2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Du=function(i,e){return dt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:St(i)?gt(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:ca.parse(i,e)}},X2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},ha={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}},Z2=is("top"),J2=is("right"),Y2=is("bottom"),q2=is("left"),j2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(dt).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}})}},ey={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"}},ty=rs("top"),Ay=rs("right"),iy=rs("bottom"),ry=rs("left"),ny={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}}},sy={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}},oy={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&oa(e[0],"none")?[]:UA(e).map(function(t){for(var A={color:kA.TRANSPARENT,offsetX:Pt,offsetY:Pt,blur:Pt},r=0,n=0;n<t.length;n++){var s=t[n];GA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=XA.parse(i,s)}return A})}},ay={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}},ly={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=uy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},cy=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},hy=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},uy={matrix:cy,matrix3d:hy},_u={type:16,number:50,flags:wr},dy=[_u,_u],py={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(St);return t.length!==2?dy:[t[0],t[1]]}},fy={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}}},Qr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Qr||(Qr={}));for(var gy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Qr.BREAK_ALL;case"keep-all":return Qr.KEEP_ALL;default:return Qr.NORMAL}}},my={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Mi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},ku={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")}},wy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Mi(e)?e.number:1}},By={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},yy={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(dt).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+"'"})}},vy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},xy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Mi(e)?e.number:dt(e)&&e.value==="bold"?700:400}},Ty={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(dt).map(function(t){return t.value})}},by={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"}}},Et=function(i,e){return(i&e)!==0},Qy={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}},Fy={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(pu),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Mi(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},Uy={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(pu),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(dt(n)&&n.value!=="none"){var o=s&&Mi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},Sy={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(xr).map(function(t){return ku.parse(i,t)})}},Ey={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(A2);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}},Nu=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},Ly={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&oa(e[0],"none")?[]:UA(e).map(function(t){for(var A={color:255,offsetX:Pt,offsetY:Pt,blur:Pt,spread:Pt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];oa(s,"inset")?A.inset=!0:GA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=XA.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(dt).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}},Hy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Iy={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return xr(e)?e.number:0}},Py=(function(){function i(e,t){var A,r;this.animationDuration=Ke(e,Sy,t.animationDuration),this.backgroundClip=Ke(e,n2,t.backgroundClip),this.backgroundColor=Ke(e,s2,t.backgroundColor),this.backgroundImage=Ke(e,g2,t.backgroundImage),this.backgroundOrigin=Ke(e,m2,t.backgroundOrigin),this.backgroundPosition=Ke(e,w2,t.backgroundPosition),this.backgroundRepeat=Ke(e,B2,t.backgroundRepeat),this.backgroundSize=Ke(e,C2,t.backgroundSize),this.borderTopColor=Ke(e,x2,t.borderTopColor),this.borderRightColor=Ke(e,T2,t.borderRightColor),this.borderBottomColor=Ke(e,b2,t.borderBottomColor),this.borderLeftColor=Ke(e,Q2,t.borderLeftColor),this.borderTopLeftRadius=Ke(e,F2,t.borderTopLeftRadius),this.borderTopRightRadius=Ke(e,U2,t.borderTopRightRadius),this.borderBottomRightRadius=Ke(e,S2,t.borderBottomRightRadius),this.borderBottomLeftRadius=Ke(e,E2,t.borderBottomLeftRadius),this.borderTopStyle=Ke(e,L2,t.borderTopStyle),this.borderRightStyle=Ke(e,M2,t.borderRightStyle),this.borderBottomStyle=Ke(e,H2,t.borderBottomStyle),this.borderLeftStyle=Ke(e,I2,t.borderLeftStyle),this.borderTopWidth=Ke(e,P2,t.borderTopWidth),this.borderRightWidth=Ke(e,D2,t.borderRightWidth),this.borderBottomWidth=Ke(e,_2,t.borderBottomWidth),this.borderLeftWidth=Ke(e,k2,t.borderLeftWidth),this.boxShadow=Ke(e,Ly,t.boxShadow),this.color=Ke(e,N2,t.color),this.direction=Ke(e,O2,t.direction),this.display=Ke(e,K2,t.display),this.float=Ke(e,z2,t.cssFloat),this.fontFamily=Ke(e,Cy,t.fontFamily),this.fontSize=Ke(e,vy,t.fontSize),this.fontStyle=Ke(e,by,t.fontStyle),this.fontVariant=Ke(e,Ty,t.fontVariant),this.fontWeight=Ke(e,xy,t.fontWeight),this.letterSpacing=Ke(e,W2,t.letterSpacing),this.lineBreak=Ke(e,R2,t.lineBreak),this.lineHeight=Ke(e,G2,t.lineHeight),this.listStyleImage=Ke(e,$2,t.listStyleImage),this.listStylePosition=Ke(e,X2,t.listStylePosition),this.listStyleType=Ke(e,ha,t.listStyleType),this.marginTop=Ke(e,Z2,t.marginTop),this.marginRight=Ke(e,J2,t.marginRight),this.marginBottom=Ke(e,Y2,t.marginBottom),this.marginLeft=Ke(e,q2,t.marginLeft),this.opacity=Ke(e,wy,t.opacity);var n=Ke(e,j2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Ke(e,ey,t.overflowWrap),this.paddingTop=Ke(e,ty,t.paddingTop),this.paddingRight=Ke(e,Ay,t.paddingRight),this.paddingBottom=Ke(e,iy,t.paddingBottom),this.paddingLeft=Ke(e,ry,t.paddingLeft),this.paintOrder=Ke(e,My,t.paintOrder),this.position=Ke(e,sy,t.position),this.textAlign=Ke(e,ny,t.textAlign),this.textDecorationColor=Ke(e,By,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Ke(e,yy,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Ke(e,oy,t.textShadow),this.textTransform=Ke(e,ay,t.textTransform),this.transform=Ke(e,ly,t.transform),this.transformOrigin=Ke(e,py,t.transformOrigin),this.visibility=Ke(e,fy,t.visibility),this.webkitTextStrokeColor=Ke(e,Hy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Ke(e,Iy,t.webkitTextStrokeWidth),this.wordBreak=Ke(e,gy,t.wordBreak),this.zIndex=Ke(e,my,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return ZA(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 Et(this.display,4)||Et(this.display,33554432)||Et(this.display,268435456)||Et(this.display,536870912)||Et(this.display,67108864)||Et(this.display,134217728)},i})(),Dy=(function(){function i(e,t){this.content=Ke(e,Qy,t.content),this.quotes=Ke(e,Ey,t.quotes)}return i})(),Ou=(function(){function i(e,t){this.counterIncrement=Ke(e,Fy,t.counterIncrement),this.counterReset=Ke(e,Uy,t.counterReset)}return i})(),Ke=function(i,e,t){var A=new uu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new du(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,dt(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 XA.parse(i,n.parseComponentValue());case"image":return ca.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return GA(o)?o:Pt;case"length-percentage":var l=n.parseComponentValue();return St(l)?l:Pt;case"time":return ku.parse(i,n.parseComponentValue())}break}},_y="data-html2canvas-debug",ky=function(i){var e=i.getAttribute(_y);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},ua=function(i,e){var t=ky(i);return t===1||e===t},SA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,ua(t,3))debugger;this.styles=new Py(e,window.getComputedStyle(t,null)),Qa(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),ua(t,4)&&(this.flags|=16)}return i})(),Ny="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Ku="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ns=0;ns<Ku.length;ns++)Fr[Ku.charCodeAt(ns)]=ns;for(var Oy=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),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Fr[i.charCodeAt(A)],s=Fr[i.charCodeAt(A+1)],o=Fr[i.charCodeAt(A+2)],l=Fr[i.charCodeAt(A+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},Ky=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Vy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},mi=5,da=11,pa=2,zy=da-mi,Vu=65536>>mi,Wy=1<<mi,fa=Wy-1,Ry=1024>>mi,Gy=Vu+Ry,$y=Gy,Xy=32,Zy=$y+Xy,Jy=65536>>da,Yy=1<<zy,qy=Yy-1,zu=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},jy=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},eC=function(i,e){var t=Oy(i),A=Array.isArray(t)?Vy(t):new Uint32Array(t),r=Array.isArray(t)?Ky(t):new Uint16Array(t),n=24,s=zu(r,n/2,A[4]/2),o=A[5]===2?zu(r,(n+A[4])/2):jy(A,Math.ceil((n+A[4])/4));return new tC(A[0],A[1],A[2],A[3],s,o)},tC=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>mi],t=(t<<pa)+(e&fa),this.data[t];if(e<=65535)return t=this.index[Vu+(e-55296>>mi)],t=(t<<pa)+(e&fa),this.data[t];if(e<this.highStart)return t=Zy-Jy+(e>>da),t=this.index[t],t+=e>>mi&qy,t=this.index[t],t=(t<<pa)+(e&fa),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",AC=typeof Uint8Array>"u"?[]:new Uint8Array(256),ss=0;ss<Wu.length;ss++)AC[Wu.charCodeAt(ss)]=ss;var iC=1,ga=2,ma=3,Ru=4,Gu=5,rC=7,$u=8,wa=9,Ba=10,Xu=11,Zu=12,Ju=13,Yu=14,ya=15,nC=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},sC=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},oC=eC(Ny),hA="×",Ca="÷",aC=function(i){return oC.get(i)},lC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===ga&&s===ma)return hA;if(n===ga||n===ma||n===Ru||s===ga||s===ma||s===Ru)return Ca;if(n===$u&&[$u,wa,Xu,Zu].indexOf(s)!==-1||(n===Xu||n===wa)&&(s===wa||s===Ba)||(n===Zu||n===Ba)&&s===Ba||s===Ju||s===Gu||s===rC||n===iC)return hA;if(n===Ju&&s===Yu){for(;r===Gu;)r=e[--A];if(r===Yu)return hA}if(n===ya&&s===ya){for(var o=0;r===ya;)o++,r=e[--A];if(o%2===0)return hA}return Ca},cC=function(i){var e=nC(i),t=e.length,A=0,r=0,n=e.map(aC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=hA;A<t&&(s=lC(e,n,++A))===hA;);if(s!==hA||A===t){var o=sC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},hC=function(i){for(var e=cC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},uC=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},dC=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 Tt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var h=t.getBoundingClientRect();n+=l.length;var d=h.x>s.x||h.y>s.y;return s=h,c===0?!0:d});return i.body.removeChild(e),o},pC=function(){return typeof new Image().crossOrigin<"u"},fC=function(){return typeof new XMLHttpRequest().responseType=="string"},gC=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},qu=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},mC=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=va(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),ju(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",qu(l)?ju(va(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),qu(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},va=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},ju=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=uC(document);return Object.defineProperty(Dt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Dt.SUPPORT_RANGE_BOUNDS&&dC(document);return Object.defineProperty(Dt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=gC(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"?mC(document):Promise.resolve(!1);return Object.defineProperty(Dt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=pC();return Object.defineProperty(Dt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=fC();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}},Ur=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),wC=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=ed(A,s,o.length).getClientRects();if(l.length>1){var c=xa(o),h=0;c.forEach(function(y){n.push(new Ur(y,DA.fromDOMRectList(i,ed(A,h+s,y.length).getClientRects()))),h+=y.length})}else n.push(new Ur(o,DA.fromDOMRectList(i,l)))}else{var d=A.splitText(o.length);n.push(new Ur(o,BC(i,A))),A=d}else Dt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},BC=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 DA.EMPTY},ed=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},xa=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 hC(i)},yC=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 xC(i,e)},CC=function(i,e){return e.letterSpacing!==0?xa(i):yC(i,e)},vC=[32,160,4961,65792,65793,4153,4241],xC=function(i,e){for(var t=Jw(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){vC.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},TC=(function(){function i(e,t,A){this.text=bC(t.data,A.textTransform),this.textBounds=wC(e,this.text,A,t)}return i})(),bC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(QC,FC);case 2:return i.toUpperCase();default:return i}},QC=/(^|\s|:|-|\(|\))([a-z])/g,FC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},td=(function(i){wA(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})(SA),Ad=(function(i){wA(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})(SA),id=(function(i){wA(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})(SA),rd=(function(i){wA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(SA),Ta=(function(i){wA(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})(SA),UC=[{type:15,flags:0,unit:"px",number:3}],SC=[{type:16,flags:0,number:50}],EC=function(i){return i.width>i.height?new DA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new DA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},LC=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",nd=707406591,ba=(function(i){wA(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=LC(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=EC(r.bounds)),r.type){case os:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=UC;break;case as:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=SC;break}return r}return e})(SA),sd=(function(i){wA(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})(SA),od=(function(i){wA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(SA),ad=(function(i){wA(e,i);function e(t,A){var r=i.call(this,t,A)||this;r.src=A.src,r.width=parseInt(A.width,10)||0,r.height=parseInt(A.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(A.contentWindow&&A.contentWindow.document&&A.contentWindow.document.documentElement){r.tree=cd(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?br(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):kA.TRANSPARENT,s=A.contentWindow.document.body?br(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):kA.TRANSPARENT;r.backgroundColor=ZA(n)?ZA(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(SA),HC=["OL","UL","MENU"],ls=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,hd(r)&&r.data.trim().length>0)t.textNodes.push(new TC(i,r,t.styles));else if(Pi(r))if(md(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return ls(i,o,t,A)});else{var s=ld(i,r);s.styles.isVisible()&&(IC(r,s,A)?s.flags|=4:PC(s.styles)&&(s.flags|=2),HC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?ls(i,r.shadowRoot,s,A):!hs(r)&&!ud(r)&&!us(r)&&ls(i,r,s,A))}},ld=function(i,e){return Ua(e)?new td(i,e):dd(e)?new Ad(i,e):ud(e)?new id(i,e):DC(e)?new rd(i,e):_C(e)?new Ta(i,e):kC(e)?new ba(i,e):us(e)?new sd(i,e):hs(e)?new od(i,e):fd(e)?new ad(i,e):new SA(i,e)},cd=function(i,e){var t=ld(i,e);return t.flags|=4,ls(i,e,t,t),t},IC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Fa(i)&&t.styles.isTransparent()},PC=function(i){return i.isPositioned()||i.isFloating()},hd=function(i){return i.nodeType===Node.TEXT_NODE},Pi=function(i){return i.nodeType===Node.ELEMENT_NODE},Qa=function(i){return Pi(i)&&typeof i.style<"u"&&!cs(i)},cs=function(i){return typeof i.className=="object"},DC=function(i){return i.tagName==="LI"},_C=function(i){return i.tagName==="OL"},kC=function(i){return i.tagName==="INPUT"},NC=function(i){return i.tagName==="HTML"},ud=function(i){return i.tagName==="svg"},Fa=function(i){return i.tagName==="BODY"},dd=function(i){return i.tagName==="CANVAS"},pd=function(i){return i.tagName==="VIDEO"},Ua=function(i){return i.tagName==="IMG"},fd=function(i){return i.tagName==="IFRAME"},gd=function(i){return i.tagName==="STYLE"},OC=function(i){return i.tagName==="SCRIPT"},hs=function(i){return i.tagName==="TEXTAREA"},us=function(i){return i.tagName==="SELECT"},md=function(i){return i.tagName==="SLOT"},wd=function(i){return i.tagName.indexOf("-")>0},KC=(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})(),Bd={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"]},yd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},VC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},zC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Di=function(i,e,t,A,r,n){return i<e||i>t?Er(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Cd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},bt=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Cd(Math.abs(i),n,A,function(s){return Tt(Math.floor(s%n)+e)})+r)},wi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Cd(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},_i=1,YA=2,qA=4,Sr=8,NA=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Er(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&&Et(n,_i)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Et(n,YA)||c===1&&l===1&&Et(n,qA)&&i>100||c===1&&l>1&&Et(n,Sr)?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},vd="十百千萬",xd="拾佰仟萬",Td="マイナス",Sa="마이너스",Er=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=bt(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return wi(i,"〇一二三四五六七八九",r);case 6:return Di(i,1,3999,Bd,3,A).toLowerCase();case 7:return Di(i,1,3999,Bd,3,A);case 8:return bt(i,945,969,!1,A);case 9:return bt(i,97,122,!1,A);case 10:return bt(i,65,90,!1,A);case 11:return bt(i,1632,1641,!0,A);case 12:case 49:return Di(i,1,9999,yd,3,A);case 35:return Di(i,1,9999,yd,3,A).toLowerCase();case 13:return bt(i,2534,2543,!0,A);case 14:case 30:return bt(i,6112,6121,!0,A);case 15:return wi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return wi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return NA(i,"零一二三四五六七八九",vd,"負",r,YA|qA|Sr);case 47:return NA(i,"零壹貳參肆伍陸柒捌玖",xd,"負",r,_i|YA|qA|Sr);case 42:return NA(i,"零一二三四五六七八九",vd,"负",r,YA|qA|Sr);case 41:return NA(i,"零壹贰叁肆伍陆柒捌玖",xd,"负",r,_i|YA|qA|Sr);case 26:return NA(i,"〇一二三四五六七八九","十百千万",Td,r,0);case 25:return NA(i,"零壱弐参四伍六七八九","拾百千万",Td,r,_i|YA|qA);case 31:return NA(i,"영일이삼사오육칠팔구","십백천만",Sa,n,_i|YA|qA);case 33:return NA(i,"零一二三四五六七八九","十百千萬",Sa,n,0);case 32:return NA(i,"零壹貳參四五六七八九","拾百千",Sa,n,_i|YA|qA);case 18:return bt(i,2406,2415,!0,A);case 20:return Di(i,1,19999,zC,3,A);case 21:return bt(i,2790,2799,!0,A);case 22:return bt(i,2662,2671,!0,A);case 22:return Di(i,1,10999,VC,3,A);case 23:return wi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return wi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return bt(i,3302,3311,!0,A);case 28:return wi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return wi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return bt(i,3792,3801,!0,A);case 37:return bt(i,6160,6169,!0,A);case 38:return bt(i,4160,4169,!0,A);case 39:return bt(i,2918,2927,!0,A);case 40:return bt(i,1776,1785,!0,A);case 43:return bt(i,3046,3055,!0,A);case 44:return bt(i,3174,3183,!0,A);case 45:return bt(i,3664,3673,!0,A);case 46:return bt(i,3872,3881,!0,A);default:return bt(i,48,57,!0,A)}},bd="data-html2canvas-ignore",Qd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new KC,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=WC(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 Rt(A,void 0,void 0,function(){var h,d;return Ot(this,function(y){switch(y.label){case 0:return this.scrolledElements.forEach(YC),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,d=this.clonedReferenceElement,typeof d>"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,GC(l)]:[3,4];case 3:y.sent(),y.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(l,d)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(ZC(document.doctype)+"<html></html>"),JC(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(ua(e,2))debugger;if(dd(e))return this.createCanvasClone(e);if(pd(e))return this.createVideoClone(e);if(gd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ua(t)&&(Ua(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),wd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ea(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){(!Pi(t)||!OC(t)&&!t.hasAttribute(bd)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Pi(t)||!gd(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(Pi(n)&&md(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(hd(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Pi(e)&&(Qa(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&&Qa(r)&&(this.clonedReferenceElement=r),Fa(r)&&ev(r);var l=this.counters.parse(new Ou(this.context,n)),c=this.resolvePseudoContent(e,r,s,Lr.BEFORE);wd(e)&&(t=!0),pd(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var h=this.resolvePseudoContent(e,r,o,Lr.AFTER);return h&&r.appendChild(h),this.counters.pop(l),(n&&(this.options.copyStyles||cs(e))&&!fd(e)||t)&&Ea(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 Ou(this.context,A));var l=new Dy(this.context,A),c=o.createElement("html2canvaspseudoelement");Ea(A,c),l.content.forEach(function(d){if(d.type===0)c.appendChild(o.createTextNode(d.value));else if(d.type===22){var y=o.createElement("img");y.src=d.value,y.style.opacity="1",c.appendChild(y)}else if(d.type===18){if(d.name==="attr"){var Q=d.values.filter(dt);Q.length&&c.appendChild(o.createTextNode(e.getAttribute(Q[0].value)||""))}else if(d.name==="counter"){var b=d.values.filter(Hi),C=b[0],U=b[1];if(C&&dt(C)){var M=n.counters.getCounterValue(C.value),E=U&&dt(U)?ha.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Er(M,E,!1)))}}else if(d.name==="counters"){var I=d.values.filter(Hi),C=I[0],R=I[1],U=I[2];if(C&&dt(C)){var L=n.counters.getCounterValues(C.value),O=U&&dt(U)?ha.parse(n.context,U.value):3,Y=R&&R.type===0?R.value:"",X=L.map(function(W){return Er(W,O,!1)}).join(Y);c.appendChild(o.createTextNode(X))}}}else if(d.type===20)switch(d.value){case"open-quote":c.appendChild(o.createTextNode(Nu(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Nu(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(d.value))}}),c.className=La+" "+Ma;var h=r===Lr.BEFORE?" "+La:" "+Ma;return cs(t)?t.className.baseValue+=h:t.className+=h,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),Lr;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})(Lr||(Lr={}));var WC=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(bd,"true"),i.body.appendChild(t),t},RC=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},GC=function(i){return Promise.all([].slice.call(i.images,0).map(RC))},$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)}})},XC=["all","d","content"],Ea=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);XC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},ZC=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},JC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},YC=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},qC=":before",jC=":after",La="___html2canvas___pseudoelement_before",Ma="___html2canvas___pseudoelement_after",Fd=`{
7
7
  content: "" !important;
8
8
  display: none !important;
9
- }`,kC=function(i){NC(i,"."+Fa+_C+Bd+`
10
- .`+Ua+PC+Bd)},NC=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},yd=(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})(),OC=(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)||(Ea(e)||WC(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=yd.isSameOrigin(e),A=!Sa(e)&&this._options.useCORS===!0&&Ht.SUPPORT_CORS_IMAGES&&!t,r=!Sa(e)&&!t&&!Ea(e)&&typeof this._options.proxy=="string"&&Ht.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Sa(e)&&!Ea(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 h=new Image;h.onload=function(){return l(h)},h.onerror=c,(RC(n)||A)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return l(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},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 g=new FileReader;g.addEventListener("load",function(){return n(g.result)},!1),g.addEventListener("error",function(C){return s(C)},!1),g.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var h=t._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+r)}}l.send()})},i})(),KC=/^data:image\/svg\+xml/i,VC=/^data:image\/.*;base64,/i,zC=/^data:image\/.*/i,WC=function(i){return Ht.SUPPORT_SVG_DRAWING||!GC(i)},Sa=function(i){return zC.test(i)},RC=function(i){return VC.test(i)},Ea=function(i){return i.substr(0,4)==="blob"},GC=function(i){return i.substr(-3).toLowerCase()==="svg"||KC.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)},cs=(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},$C=(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],h=Cr(t.borderBottomRightRadius,A.width,A.height),g=h[0],C=h[1],x=Cr(t.borderBottomLeftRadius,A.width,A.height),b=x[0],v=x[1],U=[];U.push((n+l)/A.width),U.push((b+g)/A.width),U.push((s+v)/A.height),U.push((c+C)/A.height);var F=Math.max.apply(Math,U);F>1&&(n/=F,s/=F,l/=F,c/=F,g/=F,C/=F,b/=F,v/=F);var M=A.width-l,N=A.height-C,R=A.width-g,L=A.height-v,z=t.borderTopWidth,q=t.borderRightWidth,$=t.borderBottomWidth,V=t.borderLeftWidth,j=ut(t.paddingTop,e.bounds.width),te=ut(t.paddingRight,e.bounds.width),ce=ut(t.paddingBottom,e.bounds.width),X=ut(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+M,A.top+z/3,l-q/3,c-z/3,ot.TOP_RIGHT):new De(A.left+A.width-q/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=g>0||C>0?ft(A.left+R,A.top+N,g-q/3,C-$/3,ot.BOTTOM_RIGHT):new De(A.left+A.width-q/3,A.top+A.height-$/3),this.bottomLeftBorderDoubleOuterBox=b>0||v>0?ft(A.left+V/3,A.top+L,b-V/3,v-$/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+M,A.top+z*2/3,l-q*2/3,c-z*2/3,ot.TOP_RIGHT):new De(A.left+A.width-q*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=g>0||C>0?ft(A.left+R,A.top+N,g-q*2/3,C-$*2/3,ot.BOTTOM_RIGHT):new De(A.left+A.width-q*2/3,A.top+A.height-$*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||v>0?ft(A.left+V*2/3,A.top+L,b-V*2/3,v-$*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+M,A.top+z/2,l-q/2,c-z/2,ot.TOP_RIGHT):new De(A.left+A.width-q/2,A.top+z/2),this.bottomRightBorderStroke=g>0||C>0?ft(A.left+R,A.top+N,g-q/2,C-$/2,ot.BOTTOM_RIGHT):new De(A.left+A.width-q/2,A.top+A.height-$/2),this.bottomLeftBorderStroke=b>0||v>0?ft(A.left+V/2,A.top+L,b-V/2,v-$/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+M,A.top,l,c,ot.TOP_RIGHT):new De(A.left+A.width,A.top),this.bottomRightBorderBox=g>0||C>0?ft(A.left+R,A.top+N,g,C,ot.BOTTOM_RIGHT):new De(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=b>0||v>0?ft(A.left,A.top+L,b,v,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(M,A.width-q),A.top+z,M>A.width+q?0:Math.max(0,l-q),Math.max(0,c-z),ot.TOP_RIGHT):new De(A.left+A.width-q,A.top+z),this.bottomRightPaddingBox=g>0||C>0?ft(A.left+Math.min(R,A.width-V),A.top+Math.min(N,A.height-$),Math.max(0,g-q),Math.max(0,C-$),ot.BOTTOM_RIGHT):new De(A.left+A.width-q,A.top+A.height-$),this.bottomLeftPaddingBox=b>0||v>0?ft(A.left+V,A.top+Math.min(L,A.height-$),Math.max(0,b-V),Math.max(0,v-$),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+j,Math.max(0,n-(V+X)),Math.max(0,s-(z+j)),ot.TOP_LEFT):new De(A.left+V+X,A.top+z+j),this.topRightContentBox=l>0||c>0?ft(A.left+Math.min(M,A.width+V+X),A.top+z+j,M>A.width+V+X?0:l-V+X,c-(z+j),ot.TOP_RIGHT):new De(A.left+A.width-(q+te),A.top+z+j),this.bottomRightContentBox=g>0||C>0?ft(A.left+Math.min(R,A.width-(V+X)),A.top+Math.min(N,A.height+z+j),Math.max(0,g-(q+te)),C-($+ce),ot.BOTTOM_RIGHT):new De(A.left+A.width-(q+te),A.top+A.height-($+ce)),this.bottomLeftContentBox=b>0||v>0?ft(A.left+V+X,A.top+L,Math.max(0,b-(V+X)),v-($+ce),ot.BOTTOM_LEFT):new De(A.left+V+X,A.top+A.height-($+ce))}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 cs(new De(i,c),new De(i,c-o),new De(l-s,e),new De(l,e));case ot.TOP_RIGHT:return new cs(new De(i,e),new De(i+s,e),new De(l,c-o),new De(l,c));case ot.BOTTOM_RIGHT:return new cs(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 cs(new De(l,c),new De(l-s,c),new De(i,e+o),new De(i,e))}},hs=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},XC=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},us=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},ZC=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),ds=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),JC=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),YC=function(i){return i.type===0},Cd=function(i){return i.type===1},qC=function(i){return i.type===2},vd=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},jC=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})},Td=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),xd=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new $C(this.container),this.container.styles.opacity<1&&this.effects.push(new JC(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 ZC(A,r,n))}if(this.container.styles.overflowX!==0){var s=hs(this.curves),o=us(this.curves);vd(s,o)?this.effects.push(new ds(s,6)):(this.effects.push(new ds(s,2)),this.effects.push(new ds(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!Cd(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=hs(A.curves),o=us(A.curves);vd(s,o)||r.unshift(new ds(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return Qt(l.target,e)})},i})(),La=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Qt(r.flags,4),s=Qt(r.flags,2),o=new xd(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,h=new Td(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var g=r.styles.zIndex.order;if(g<0){var C=0;c.negativeZIndex.some(function(b,v){return g>b.element.container.styles.zIndex.order?(C=v,!1):C>0}),c.negativeZIndex.splice(C,0,h)}else if(g>0){var x=0;c.positiveZIndex.some(function(b,v){return g>=b.element.container.styles.zIndex.order?(x=v+1,!1):x>0}),c.positiveZIndex.splice(x,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);La(o,h,n?h:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),La(o,e,t,l);Qt(r.flags,8)&&bd(r,l)})},bd=function(i,e){for(var t=i instanceof ya?i.start:1,A=i instanceof ya?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}},ev=function(i){var e=new xd(i,null),t=new Td(e),A=[];return La(e,t,t,A),bd(e.container,A),t},Qd=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)}},tv=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)}},Av=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)}},iv=function(i,e){switch(e){case 0:return ps(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return ps(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return ps(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return ps(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},ps=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},Fd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},fs=function(i){var e=i.styles,t=i.bounds,A=ut(e.paddingLeft,t.width),r=ut(e.paddingRight,t.width),n=ut(e.paddingTop,t.width),s=ut(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))},rv=function(i,e){return i===0?e.bounds:i===2?fs(e):Fd(e)},nv=function(i,e){return i===0?e.bounds:i===2?fs(e):Fd(e)},Ma=function(i,e,t){var A=rv(ki(i.styles.backgroundOrigin,e),i),r=nv(ki(i.styles.backgroundClip,e),i),n=sv(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=ov(ki(i.styles.backgroundRepeat,e),l,n,A,r),h=Math.round(A.left+l[0]),g=Math.round(A.top+l[1]);return[c,h,g,s,o]},Pi=function(i){return at(i)&&i.value===Mi.AUTO},gs=function(i){return typeof i=="number"},sv=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[ut(s,t.width),ut(o,t.height)];var l=gs(n);if(at(s)&&(s.value===Mi.CONTAIN||s.value===Mi.COVER)){if(gs(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 h=gs(A),g=gs(r),C=h||g;if(Pi(s)&&(!o||Pi(o))){if(h&&g)return[A,r];if(!l&&!C)return[t.width,t.height];if(C&&l){var x=h?A:r*n,b=g?r:A/n;return[x,b]}var v=h?A:t.width,U=g?r:t.height;return[v,U]}if(l){var F=0,M=0;return bt(s)?F=ut(s,t.width):bt(o)&&(M=ut(o,t.height)),Pi(s)?F=M*n:(!o||Pi(o))&&(M=F/n),[F,M]}var N=null,R=null;if(bt(s)?N=ut(s,t.width):o&&bt(o)&&(R=ut(o,t.height)),N!==null&&(!o||Pi(o))&&(R=h&&g?N/A*r:t.height),R!==null&&Pi(s)&&(N=h&&g?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},ov=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))]}},av="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ud="Hidden Text",lv=(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=av,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(Ud)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Ud)),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})(),Sd=(function(){function i(e,t){this.context=e,this.options=t}return i})(),cv=1e4,hv=(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 lv(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(),qC(t)&&(this.ctx.globalAlpha=t.opacity),YC(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)),Cd(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=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=gv(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,h,g,C=this;return Nt(this,function(x){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,h=l.middle,g=A.paintOrder,t.textBounds.forEach(function(b){g.forEach(function(v){switch(v){case 0:C.ctx.fillStyle=Ut(A.color),C.renderTextWithLetterSpacing(b,A.letterSpacing,c);var U=A.textShadow;U.length&&b.text.trim().length&&(U.slice(0).reverse().forEach(function(F){C.ctx.shadowColor=Ut(F.color),C.ctx.shadowOffsetX=F.offsetX.number*C.options.scale,C.ctx.shadowOffsetY=F.offsetY.number*C.options.scale,C.ctx.shadowBlur=F.blur.number,C.renderTextWithLetterSpacing(b,A.letterSpacing,c)}),C.ctx.shadowColor="",C.ctx.shadowOffsetX=0,C.ctx.shadowOffsetY=0,C.ctx.shadowBlur=0),A.textDecorationLine.length&&(C.ctx.fillStyle=Ut(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:C.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+c),b.bounds.width,1);break;case 2:C.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:C.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+h),b.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&b.text.trim().length&&(C.ctx.strokeStyle=Ut(A.webkitTextStrokeColor),C.ctx.lineWidth=A.webkitTextStrokeWidth,C.ctx.lineJoin=window.chrome?"miter":"round",C.ctx.strokeText(b.text,b.bounds.left,b.bounds.top+c)),C.ctx.strokeStyle="",C.ctx.lineWidth=0,C.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=fs(t),s=us(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,M,M,c,h,g,C,R,x,b,L,v,U,F,M,N,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 $u))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 M=z.sent(),this.renderReplacedElement(A,r,M),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Xu&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof Zu))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 M=z.sent(),this.renderReplacedElement(A,r,M),[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 ed&&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:h=z.sent(),A.width&&A.height&&this.ctx.drawImage(h,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 Ca&&(g=Math.min(A.bounds.width,A.bounds.height),A.type===rs?A.checked&&(this.ctx.save(),this.path([new De(A.bounds.left+g*.39363,A.bounds.top+g*.79),new De(A.bounds.left+g*.16,A.bounds.top+g*.5549),new De(A.bounds.left+g*.27347,A.bounds.top+g*.44071),new De(A.bounds.left+g*.39694,A.bounds.top+g*.5649),new De(A.bounds.left+g*.72983,A.bounds.top+g*.23),new De(A.bounds.left+g*.84,A.bounds.top+g*.34085),new De(A.bounds.left+g*.39363,A.bounds.top+g*.79)]),this.ctx.fillStyle=Ut(Yu),this.ctx.fill(),this.ctx.restore()):A.type===ns&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+g/2,A.bounds.top+g/2,g/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ut(Yu),this.ctx.fill(),this.ctx.restore())),uv(A)&&A.value.length){switch(C=this.createFontStyle(n),R=C[0],x=C[1],b=this.fontMetrics.getMetrics(R,x).baseline,this.ctx.font=R,this.ctx.fillStyle=Ut(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=pv(A.styles.textAlign),L=fs(A),v=0,A.styles.textAlign){case 1:v+=L.width/2;break;case 2:v+=L.width;break}U=L.add(v,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,U),n.letterSpacing,b),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];M=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 M=z.sent(),this.ctx.drawImage(M,A.bounds.left-(M.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=Ut(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",L=new IA(A.bounds.left,A.bounds.top+ut(A.styles.paddingTop,A.bounds.width),A.bounds.width,Uu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new br(t.listValue,L),n.letterSpacing,Uu(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,h,F,g,C,F,x,b,F,v,U,F;return Nt(this,function(M){switch(M.label){case 0:if(Qt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:M.sent(),A=0,r=t.negativeZIndex,M.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:M.sent(),M.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:M.sent(),n=0,s=t.nonInlineLevel,M.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:M.sent(),M.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,M.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:M.sent(),M.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,M.label=15;case 15:return c<h.length?(F=h[c],[4,this.renderStack(F)]):[3,18];case 16:M.sent(),M.label=17;case 17:return c++,[3,15];case 18:g=0,C=t.inlineLevel,M.label=19;case 19:return g<C.length?(F=C[g],[4,this.renderNode(F)]):[3,22];case 20:M.sent(),M.label=21;case 21:return g++,[3,19];case 22:x=0,b=t.zeroOrAutoZIndexOrTransformedOrOpacity,M.label=23;case 23:return x<b.length?(F=b[x],[4,this.renderStack(F)]):[3,26];case 24:M.sent(),M.label=25;case 25:return x++,[3,23];case 26:v=0,U=t.positiveZIndex,M.label=27;case 27:return v<U.length?(F=U[v],[4,this.renderStack(F)]):[3,30];case 28:M.sent(),M.label=29;case 29:return v++,[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(h){var g,C,x,j,le,ne,X,ee,$,b,j,le,ne,X,ee,v,U,F,M,N,R,L,z,q,$,V,j,te,ce,X,ee,se,le,ne,he,de,we,xe,Ue,ye,ve,be;return Nt(this,function(Ee){switch(Ee.label){case 0:if(h.type!==0)return[3,5];g=void 0,C=h.url,Ee.label=1;case 1:return Ee.trys.push([1,3,,4]),[4,n.context.cache.match(C)];case 2:return g=Ee.sent(),[3,4];case 3:return Ee.sent(),n.context.logger.error("Error loading background-image "+C),[3,4];case 4:return g&&(x=Ma(t,A,[g.width,g.height,g.width/g.height]),j=x[0],le=x[1],ne=x[2],X=x[3],ee=x[4],$=n.ctx.createPattern(n.resizeImage(g,X,ee),"repeat"),n.renderRepeat(j,$,le,ne)),[3,6];case 5:YB(h)?(b=Ma(t,A,[null,null,null]),j=b[0],le=b[1],ne=b[2],X=b[3],ee=b[4],v=GB(h.angle,X,ee),U=v[0],F=v[1],M=v[2],N=v[3],R=v[4],L=document.createElement("canvas"),L.width=X,L.height=ee,z=L.getContext("2d"),q=z.createLinearGradient(F,N,M,R),mu(h.stops,U).forEach(function(Ie){return q.addColorStop(Ie.stop,Ut(Ie.color))}),z.fillStyle=q,z.fillRect(0,0,X,ee),X>0&&ee>0&&($=n.ctx.createPattern(L,"repeat"),n.renderRepeat(j,$,le,ne))):qB(h)&&(V=Ma(t,A,[null,null,null]),j=V[0],te=V[1],ce=V[2],X=V[3],ee=V[4],se=h.position.length===0?[ra]:h.position,le=ut(se[0],X),ne=ut(se[se.length-1],ee),he=$B(h,le,ne,X,ee),de=he[0],we=he[1],de>0&&we>0&&(xe=n.ctx.createRadialGradient(te+le,ce+ne,0,te+le,ce+ne,de),mu(h.stops,de*2).forEach(function(Ie){return xe.addColorStop(Ie.stop,Ut(Ie.color))}),n.path(j),n.ctx.fillStyle=xe,de!==we?(Ue=t.bounds.left+.5*t.bounds.width,ye=t.bounds.top+.5*t.bounds.height,ve=we/de,be=1/ve,n.ctx.save(),n.ctx.translate(Ue,ye),n.ctx.transform(1,0,0,ve,0,0),n.ctx.translate(-Ue,-ye),n.ctx.fillRect(te,be*(ce-ye)+ye,X,ee*be),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(Qd(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=tv(n,r),this.path(s),this.ctx.fillStyle=Ut(t),this.ctx.fill(),o=Av(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,h,g=this;return Nt(this,function(C){switch(C.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=dv(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:C.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(x){g.ctx.save();var b=hs(t.curves),v=x.inset?0:cv,U=jC(b,-v+(x.inset?1:-1)*x.spread.number,(x.inset?1:-1)*x.spread.number,x.spread.number*(x.inset?-2:2),x.spread.number*(x.inset?-2:2));x.inset?(g.path(b),g.ctx.clip(),g.mask(U)):(g.mask(b),g.ctx.clip(),g.path(U)),g.ctx.shadowOffsetX=x.offsetX.number+v,g.ctx.shadowOffsetY=x.offsetY.number,g.ctx.shadowColor=Ut(x.color),g.ctx.shadowBlur=x.blur.number,g.ctx.fillStyle=x.inset?Ut(x.color):"rgba(0,0,0,1)",g.ctx.fill(),g.ctx.restore()}),C.label=2;case 2:o=0,l=0,c=n,C.label=3;case 3:return l<c.length?(h=c[l],h.style!==0&&!$A(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return C.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return C.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return C.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,t.curves)];case 10:C.sent(),C.label=11;case 11:o++,C.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,h,g,C,x,b,v,U,F,M,N,R,L,z,L,z;return Nt(this,function(q){return this.ctx.save(),o=iv(n,r),l=Qd(n,r),s===2&&(this.path(l),this.ctx.clip()),cA(l[0])?(c=l[0].start.x,h=l[0].start.y):(c=l[0].x,h=l[0].y),cA(l[1])?(g=l[1].end.x,C=l[1].end.y):(g=l[1].x,C=l[1].y),r===0||r===2?x=Math.abs(c-g):x=Math.abs(h-C),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),b=A<3?A*3:A*2,v=A<3?A*2:A,s===3&&(b=A,v=A),U=!0,x<=b*2?U=!1:x<=b*2+v?(F=x/(2*b+v),b*=F,v*=F):(M=Math.floor((x+v)/(b+v)),N=(x-M*b)/(M-1),R=(x-(M+1)*b)/M,v=R<=0||Math.abs(v-N)<Math.abs(v-R)?N:R),U&&(s===3?this.ctx.setLineDash([0,b+v]):this.ctx.setLineDash([b,v])),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=ev(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Sd),uv=function(i){return i instanceof ju||i instanceof qu?!0:i instanceof Ca&&i.type!==ns&&i.type!==rs},dv=function(i,e){switch(i){case 0:return hs(e);case 2:return XC(e);default:return us(e)}},pv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},fv=["-apple-system","system-ui"],gv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return fv.indexOf(e)===-1}):i},mv=(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=wa(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,wv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=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})(Sd),wv=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Bv=(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,xn([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,xn([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,xn([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,xn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),yv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Bv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new OC(this,e)}return i.instanceCount=1,i})(),Cv=function(i,e){return e===void 0&&(e={}),vv(i,e)};typeof window<"u"&&yd.setContext(window);var vv=function(i,e){return Wt(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,h,g,C,x,b,v,U,F,M,N,R,L,q,z,q,$,V,j,te,ce,X,ee,se,le,ne,he,de,we,xe,Ue,ye,ve;return Nt(this,function(be){switch(be.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:(j=e.useCORS)!==null&&j!==void 0?j:!1},n=Po({logging:(te=e.logging)!==null&&te!==void 0?te:!0,cache:e.cache},r),s={windowWidth:(ce=e.windowWidth)!==null&&ce!==void 0?ce:A.innerWidth,windowHeight:(X=e.windowHeight)!==null&&X!==void 0?X:A.innerHeight,scrollX:(ee=e.scrollX)!==null&&ee!==void 0?ee:A.pageXOffset,scrollY:(se=e.scrollY)!==null&&se!==void 0?se:A.pageYOffset},o=new IA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new yv(n,o),c=(le=e.foreignObjectRendering)!==null&&le!==void 0?le:!1,h={allowTaint:(ne=e.allowTaint)!==null&&ne!==void 0?ne:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),g=new wd(l,i,h),C=g.clonedReferenceElement,C?[4,g.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return x=be.sent(),b=Ta(C)||TC(C)?jm(C.ownerDocument):bn(l,C),v=b.width,U=b.height,F=b.left,M=b.top,N=Tv(l,C,e.backgroundColor),R={canvas:e.canvas,backgroundColor:N,scale:(de=(he=e.scale)!==null&&he!==void 0?he:A.devicePixelRatio)!==null&&de!==void 0?de:1,x:((we=e.x)!==null&&we!==void 0?we:0)+F,y:((xe=e.y)!==null&&xe!==void 0?xe:0)+M,width:(Ue=e.width)!==null&&Ue!==void 0?Ue:Math.ceil(v),height:(ye=e.height)!==null&&ye!==void 0?ye:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),q=new mv(l,R),[4,q.render(C)]):[3,3];case 2:return L=be.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+M+" with size "+v+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=Ad(l,C),N===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),q=new hv(l,R),[4,q.render(z)];case 4:L=be.sent(),be.label=5;case 5:return(!((ve=e.removeContainer)!==null&&ve!==void 0)||ve)&&(wd.destroy(x)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,L]}})})},Tv=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 xv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class bv{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,h=n._series;if(!c||!h)return;const g=h.priceToCoordinate(n.price);if(g==null)return;const C=Math.round(g*o.verticalPixelRatio),x=c.timeScale().timeToCoordinate(n.originTime),b=x==null?0:Math.max(0,Math.round(x*o.horizontalPixelRatio)),v=o.bitmapSize.width;if(b>=v)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(b,C),l.lineTo(v,C),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(b,C,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 Ed{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 h=Math.round(A.fontSize*l);n.font=`${h}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const g=Math.round(8*o),C=Math.round(14*l),x=s.width;let b;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);b=F!=null?Math.round(F*o):g,n.textAlign="right"}else b=g,n.textAlign="left";else A.hAlign==="right"?(b=x-g,n.textAlign="right"):(b=x/2,n.textAlign="center");const v=Math.round(c*l);let U;A.vAlign==="top"?U=v-C:A.vAlign==="bottom"?U=v+C:U=v,n.fillStyle=A.textColor,n.fillText(A.text,b,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Qv{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,h=s._series;if(!c||!h)return;const g=l.horizontalPixelRatio,C=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),v=h.priceToCoordinate(s.p1.price),U=h.priceToCoordinate(s.p2.price);if(x==null||b==null||v==null||U==null)return;const F=Math.round(x*g),M=Math.round(v*C),N=Math.round(b*g),R=Math.round(U*C),L=l.context;if(L.save(),L.beginPath(),L.strokeStyle=s.color,L.lineWidth=s.lineWidth*C,L.setLineDash([]),L.moveTo(F,M),L.lineTo(N,R),L.stroke(),L.beginPath(),L.fillStyle=s.color,L.arc(F,M,3*C,0,Math.PI*2),L.fill(),L.beginPath(),L.arc(N,R,3*C,0,Math.PI*2),L.fill(),!s.statsShowAlways&&!s.isActive){L.restore();return}const{priceDiff:z,pricePct:q,bars:$,days:V,angle:j}=s.info,te=z>=0?"+":"",ce=[];if(s.statsPriceRange!==!1&&ce.push(`${te}${z.toFixed(5)} (${te}${q.toFixed(2)}%)`),s.statsBarsRange!==!1&&ce.push(`${$} bars`),s.statsDateRange!==!1&&ce.push(`${V} days`),s.statsAngle!==!1&&ce.push(`∠ ${j.toFixed(1)}°`),s.statsDistance&&ce.push(`Δ ${Math.abs(z).toFixed(5)}`),ce.length===0){L.restore();return}const X=Math.round(11*C);L.font=`${X}px sans-serif`;const ee=X*1.6,se=8*C,le=Math.max(...ce.map(Ze=>L.measureText(Ze).width))+se*2,ne=ce.length*ee+se*2,he=s.statsPosition??"right";let de,we;he==="left"?(de=F,we=M):he==="center"?(de=Math.round((F+N)/2),we=Math.round((M+R)/2)):(de=N,we=R);let xe,Ue;he==="left"?(xe=de-le-10*g,Ue=we-ne-4*C):he==="center"?(xe=de-le/2,Ue=we-ne-8*C):(xe=de+10*g,Ue=we-ne-4*C);const ye=l.bitmapSize.width,ve=l.bitmapSize.height,be=Math.min(Math.max(0,xe),ye-le-4*g),Ee=Math.min(Math.max(4*C,Ue),ve-ne-4*C),Ie=4*C;L.beginPath(),L.moveTo(be+Ie,Ee),L.lineTo(be+le-Ie,Ee),L.quadraticCurveTo(be+le,Ee,be+le,Ee+Ie),L.lineTo(be+le,Ee+ne-Ie),L.quadraticCurveTo(be+le,Ee+ne,be+le-Ie,Ee+ne),L.lineTo(be+Ie,Ee+ne),L.quadraticCurveTo(be,Ee+ne,be,Ee+ne-Ie),L.lineTo(be,Ee+Ie),L.quadraticCurveTo(be,Ee,be+Ie,Ee),L.closePath(),L.fillStyle="rgba(30, 41, 59, 0.92)",L.fill(),L.strokeStyle=s.statsColor||s.color,L.lineWidth=1*C,L.stroke(),L.fillStyle="#e2e8f0",L.textAlign="left",ce.forEach((Ze,ze)=>{L.fillText(Ze,be+se,Ee+se+X+ze*ee)}),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 Ld{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,h=s._series;if(!c||!h)return;const g=l.horizontalPixelRatio,C=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),v=h.priceToCoordinate(s.p1.price),U=h.priceToCoordinate(s.p2.price);if(x==null||b==null||v==null||U==null)return;const F=Math.round(x*g),M=Math.round(v*C),N=Math.round(b*g),R=Math.round(U*C),L=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,N),Math.min(M,R),Math.abs(N-F),Math.abs(R-M)),z.strokeStyle=L,z.lineWidth=1*C,z.setLineDash([]),z.strokeRect(Math.min(F,N),Math.min(M,R),Math.abs(N-F),Math.abs(R-M))),z.beginPath(),z.strokeStyle=L,z.lineWidth=2*C,z.moveTo(F,M),z.lineTo(N,R),z.stroke(),z.fillStyle=L,z.beginPath(),z.arc(F,M,3*C,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(N,R,3*C,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:q,pricePct:$,bars:V,days:j}=s.info,te=q>=0?"+":"",ce=[];if(s.statsPriceRange&&ce.push(te+q.toFixed(5)+" ("+te+$.toFixed(2)+"%)"),s.statsBarsRange&&ce.push(V+" bars"),s.statsDateRange&&ce.push(j+" days"),ce.length===0){z.restore();return}const X=Math.round(11*C);z.font=X+"px sans-serif";const ee=X*1.6,se=8*C,le=Math.max(...ce.map(be=>z.measureText(be).width))+se*2,ne=ce.length*ee+se*2,he=l.bitmapSize.width,de=l.bitmapSize.height;let we,xe;if(s.statsPosition==="left")we=F-le-10*g,xe=M-ne-4*C;else if(s.statsPosition==="center"){const be=(F+N)/2,Ee=(M+R)/2;we=be-le/2,xe=Ee-ne-4*C}else we=N+10*g,xe=R-ne-4*C;const Ue=Math.min(Math.max(0,we),he-le-4*g),ye=Math.min(Math.max(4*C,xe),de-ne-4*C),ve=4*C;z.beginPath(),z.moveTo(Ue+ve,ye),z.lineTo(Ue+le-ve,ye),z.quadraticCurveTo(Ue+le,ye,Ue+le,ye+ve),z.lineTo(Ue+le,ye+ne-ve),z.quadraticCurveTo(Ue+le,ye+ne,Ue+le-ve,ye+ne),z.lineTo(Ue+ve,ye+ne),z.quadraticCurveTo(Ue,ye+ne,Ue,ye+ne-ve),z.lineTo(Ue,ye+ve),z.quadraticCurveTo(Ue,ye,Ue+ve,ye),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||L,z.lineWidth=1*C,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",ce.forEach((be,Ee)=>{z.fillText(be,Ue+se,ye+se+X+Ee*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 Fv{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,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),C=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||C==null||x==null||b==null)return;const v=Math.min(g,C)*c,U=Math.max(g,C)*c,F=Math.min(x,b)*h,M=Math.max(x,b)*h,N=U-v,R=M-F;if(N<.5||R<.5)return;const L=s.context;L.save(),L.fillStyle=r.fillColor,L.fillRect(v,F,N,R),L.strokeStyle=r.strokeColor,L.lineWidth=r.lineWidth*h,L.setLineDash([]),L.strokeRect(v,F,N,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 Uv{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,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),C=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(g==null||C==null||x==null||b==null)return;const v=g*c,U=C*h,F=x*c,M=b*h,N=Math.hypot(F-v,M-U);if(N<.5)return;const R=s.context;R.save(),R.strokeStyle=r.strokeColor,R.lineWidth=r.lineWidth*h,R.setLineDash([]),R.beginPath(),R.arc(v,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 Sv{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 h=o.horizontalPixelRatio,g=o.verticalPixelRatio,C=l.timeScale().timeToCoordinate(n.p1.rawTime),x=c.priceToCoordinate(n.p1.price),b=l.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(C==null||x==null||b==null||v==null||U==null||F==null)return;const M=C*h,N=x*g,R=b*h,L=v*g,z=U*h,q=F*g,$=o.context;$.save(),$.beginPath(),$.moveTo(M,N),$.lineTo(R,L),$.lineTo(z,q),$.closePath(),$.fillStyle=n.fillColor,$.fill(),$.strokeStyle=n.strokeColor,$.lineWidth=n.lineWidth*g,$.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 Ev{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,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),C=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(g==null||C==null||x==null||b==null)return;const v=g*c,U=C*h,F=x*c,M=b*h,N=F-v,R=M-U,L=Math.hypot(N,R);if(L<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*h,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(v,U),z.lineTo(F,M),z.stroke();else{const q=(v+F)/2,$=(U+M)/2,V=Math.atan2(R,N),j=L/2,te=Math.max(1,j*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(q,$,j,te,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 Md{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,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),C=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||C==null||x==null||b==null)return;const v=Math.round(g*c),U=Math.round(x*h),F=Math.round(C*c),M=Math.round(b*h),N=F-v,R=M-U,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*h,L.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-v);L.beginPath(),L.moveTo(0,ce),L.lineTo(v,U),L.stroke()}if(r.rayRight){const te=s.bitmapSize.width,ce=M+z*(te-F);L.beginPath(),L.moveTo(F,M),L.lineTo(te,ce),L.stroke()}L.beginPath(),L.moveTo(v,U),L.lineTo(F,M),L.stroke();const q=Math.atan2(M-U,F-v),$=(r.lineWidth*4+4)*h,V=Math.PI/7;if(r.arrowRight){const te=F-$*Math.cos(q-V),ce=M-$*Math.sin(q-V),X=F-$*Math.cos(q+V),ee=M-$*Math.sin(q+V);L.beginPath(),L.moveTo(F,M),L.lineTo(te,ce),L.lineTo(X,ee),L.closePath(),L.fill()}if(r.arrowLeft){const te=q+Math.PI,ce=v-$*Math.cos(te-V),X=U-$*Math.sin(te-V),ee=v-$*Math.cos(te+V),se=U-$*Math.sin(te+V);L.beginPath(),L.moveTo(v,U),L.lineTo(ce,X),L.lineTo(ee,se),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const te=r.p1.rawTime,ce=r.p2.rawTime,X=r.p1.price,ee=r.p2.price,se=[];if(r.statsPriceRange){const ne=Math.abs(ee-X),he=X!==0?Math.abs((ee-X)/X*100):0,de=ne<1e-4?6:ne<.01?5:ne<1?4:2;se.push("↕ "+ne.toFixed(de)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const ne=o.timeScale().timeToCoordinate(te),he=o.timeScale().timeToCoordinate(ce);if(ne!=null&&he!=null){const de=o.timeScale().coordinateToLogical(ne),we=o.timeScale().coordinateToLogical(he);de!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const ne=Math.abs(ce-te),he=Math.floor(ne/86400),de=Math.floor(ne%86400/3600),we=Math.floor(ne%3600/60);let xe=he>0?he+" day"+(he!==1?"s":""):"";de>0&&(xe+=(xe?" ":"")+de+" hour"+(de!==1?"s":"")),!he&&!de&&(xe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+xe+")":le.push(xe)}if(r.statsDistance){const ne=N/c,he=R/h;le.push("distance: "+Math.sqrt(ne*ne+he*he).toFixed(2))}if(le.length>0&&se.push(le.join(", ")),r.statsAngle){const ne=N/c,he=R/h,de=Math.atan2(he,ne)*180/Math.PI;se.push("∠ "+de.toFixed(0)+"°")}if(se.length>0){const ne=Math.min(c,h),he=11*ne,de=he*1.5,we=5*ne;L.font=he+"px sans-serif";const Ue=se.reduce((Se,fe)=>Math.max(Se,L.measureText(fe).width),0)+we*2,ye=se.length*de+we*2,[ve,be,Ee,Ie]=v<=F?[v,U,F,M]:[F,M,v,U];let Ze,ze;r.statsPosition==="left"?(Ze=ve,ze=be):r.statsPosition==="center"?(Ze=(ve+Ee)/2,ze=(be+Ie)/2):(Ze=Ee,ze=Ie);const Ce=Ze-Ue/2,Ne=ze-ye-12*ne;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(Ce,Ne,Ue,ye),L.strokeStyle=r.statsColor,L.lineWidth=1*ne,L.strokeRect(Ce,Ne,Ue,ye),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",se.forEach((Se,fe)=>{L.fillText(Se,Ce+we,Ne+we+fe*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 Lv{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,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),C=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||C==null||x==null||b==null)return;const v=Math.round(g*c),U=Math.round(x*h),F=Math.round(C*c),M=Math.round(b*h),N=F-v,R=M-U,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*h,L.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-v);L.beginPath(),L.moveTo(0,ce),L.lineTo(v,U),L.stroke()}if(r.rayRight){const te=s.bitmapSize.width,ce=M+z*(te-F);L.beginPath(),L.moveTo(F,M),L.lineTo(te,ce),L.stroke()}L.beginPath(),L.moveTo(v,U),L.lineTo(F,M),L.stroke();const q=Math.atan2(M-U,F-v),$=(r.lineWidth*4+4)*h,V=Math.PI/7;if(r.arrowRight){const te=F-$*Math.cos(q-V),ce=M-$*Math.sin(q-V),X=F-$*Math.cos(q+V),ee=M-$*Math.sin(q+V);L.beginPath(),L.moveTo(F,M),L.lineTo(te,ce),L.lineTo(X,ee),L.closePath(),L.fill()}if(r.arrowLeft){const te=q+Math.PI,ce=v-$*Math.cos(te-V),X=U-$*Math.sin(te-V),ee=v-$*Math.cos(te+V),se=U-$*Math.sin(te+V);L.beginPath(),L.moveTo(v,U),L.lineTo(ce,X),L.lineTo(ee,se),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const te=r.p1.rawTime,ce=r.p2.rawTime,X=r.p1.price,ee=r.p2.price,se=[];if(r.statsPriceRange){const ne=Math.abs(ee-X),he=X!==0?Math.abs((ee-X)/X*100):0,de=ne<1e-4?6:ne<.01?5:ne<1?4:2;se.push("↕ "+ne.toFixed(de)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const ne=o.timeScale().timeToCoordinate(te),he=o.timeScale().timeToCoordinate(ce);if(ne!=null&&he!=null){const de=o.timeScale().coordinateToLogical(ne),we=o.timeScale().coordinateToLogical(he);de!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const ne=Math.abs(ce-te),he=Math.floor(ne/86400),de=Math.floor(ne%86400/3600),we=Math.floor(ne%3600/60);let xe=he>0?he+" day"+(he!==1?"s":""):"";de>0&&(xe+=(xe?" ":"")+de+" hour"+(de!==1?"s":"")),!he&&!de&&(xe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+xe+")":le.push(xe)}if(r.statsDistance){const ne=N/c,he=R/h;le.push("distance: "+Math.sqrt(ne*ne+he*he).toFixed(2))}if(le.length>0&&se.push(le.join(", ")),r.statsAngle){const ne=N/c,he=R/h,de=Math.atan2(he,ne)*180/Math.PI;se.push("∠ "+de.toFixed(0)+"°")}if(se.length>0){const ne=Math.min(c,h),he=11*ne,de=he*1.5,we=5*ne;L.font=he+"px sans-serif";const Ue=se.reduce((Se,fe)=>Math.max(Se,L.measureText(fe).width),0)+we*2,ye=se.length*de+we*2,[ve,be,Ee,Ie]=v<=F?[v,U,F,M]:[F,M,v,U];let Ze,ze;r.statsPosition==="left"?(Ze=ve,ze=be):r.statsPosition==="center"?(Ze=(ve+Ee)/2,ze=(be+Ie)/2):(Ze=Ee,ze=Ie);const Ce=Ze-Ue/2,Ne=ze-ye-12*ne;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(Ce,Ne,Ue,ye),L.strokeStyle=r.statsColor,L.lineWidth=1*ne,L.strokeRect(Ce,Ne,Ue,ye),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",se.forEach((Se,fe)=>{L.fillText(Se,Ce+we,Ne+we+fe*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,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),C=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||C==null||x==null||b==null)return;const v=Math.round(g*c),U=Math.round(x*h),F=Math.round(C*c),M=Math.round(b*h),N=F-v,R=M-U,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*h,L.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-v);L.beginPath(),L.moveTo(0,ce),L.lineTo(v,U),L.stroke()}if(r.rayRight){const te=s.bitmapSize.width,ce=M+z*(te-F);L.beginPath(),L.moveTo(F,M),L.lineTo(te,ce),L.stroke()}L.beginPath(),L.moveTo(v,U),L.lineTo(F,M),L.stroke();const q=Math.atan2(M-U,F-v),$=(r.lineWidth*4+4)*h,V=Math.PI/7;if(r.arrowRight){const te=F-$*Math.cos(q-V),ce=M-$*Math.sin(q-V),X=F-$*Math.cos(q+V),ee=M-$*Math.sin(q+V);L.beginPath(),L.moveTo(F,M),L.lineTo(te,ce),L.lineTo(X,ee),L.closePath(),L.fill()}if(r.arrowLeft){const te=q+Math.PI,ce=v-$*Math.cos(te-V),X=U-$*Math.sin(te-V),ee=v-$*Math.cos(te+V),se=U-$*Math.sin(te+V);L.beginPath(),L.moveTo(v,U),L.lineTo(ce,X),L.lineTo(ee,se),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const te=r.p1.rawTime,ce=r.p2.rawTime,X=r.p1.price,ee=r.p2.price,se=[];if(r.statsPriceRange){const ne=Math.abs(ee-X),he=X!==0?Math.abs((ee-X)/X*100):0,de=ne<1e-4?6:ne<.01?5:ne<1?4:2;se.push("↕ "+ne.toFixed(de)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const ne=o.timeScale().timeToCoordinate(te),he=o.timeScale().timeToCoordinate(ce);if(ne!=null&&he!=null){const de=o.timeScale().coordinateToLogical(ne),we=o.timeScale().coordinateToLogical(he);de!=null&&we!=null&&le.push("↔ "+Math.abs(Math.round(we-de))+" bars")}}catch{}if(r.statsDateRange){const ne=Math.abs(ce-te),he=Math.floor(ne/86400),de=Math.floor(ne%86400/3600),we=Math.floor(ne%3600/60);let xe=he>0?he+" day"+(he!==1?"s":""):"";de>0&&(xe+=(xe?" ":"")+de+" hour"+(de!==1?"s":"")),!he&&!de&&(xe=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+xe+")":le.push(xe)}if(r.statsDistance){const ne=N/c,he=R/h;le.push("distance: "+Math.sqrt(ne*ne+he*he).toFixed(2))}if(le.length>0&&se.push(le.join(", ")),r.statsAngle){const ne=N/c,he=R/h,de=Math.atan2(he,ne)*180/Math.PI;se.push("∠ "+de.toFixed(0)+"°")}if(se.length>0){const ne=Math.min(c,h),he=11*ne,de=he*1.5,we=5*ne;L.font=he+"px sans-serif";const Ue=se.reduce((Se,fe)=>Math.max(Se,L.measureText(fe).width),0)+we*2,ye=se.length*de+we*2,[ve,be,Ee,Ie]=v<=F?[v,U,F,M]:[F,M,v,U];let Ze,ze;r.statsPosition==="left"?(Ze=ve,ze=be):r.statsPosition==="center"?(Ze=(ve+Ee)/2,ze=(be+Ie)/2):(Ze=Ee,ze=Ie);const Ce=Ze-Ue/2,Ne=ze-ye-12*ne;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(Ce,Ne,Ue,ye),L.strokeStyle=r.statsColor,L.lineWidth=1*ne,L.strokeRect(Ce,Ne,Ue,ye),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",se.forEach((Se,fe)=>{L.fillText(Se,Ce+we,Ne+we+fe*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="#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 h=n._chart,g=n._series;if(!h||!g)return;const C=o.horizontalPixelRatio,x=o.verticalPixelRatio,b=h.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),v=h.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=g.priceToCoordinate(n.p1.price),F=g.priceToCoordinate(n.p2.price);if(b==null||v==null||U==null||F==null)return;const M=b*C,N=U*x,R=v*C,L=F*x,[z,q,$,V]=M<=R?[M,N,R,L]:[R,L,M,N];let j=$-z,te=V-q;Math.abs(j)<1e-4&&(j=1e-4);const ce=te/j,X=o.context;if(X.save(),X.strokeStyle=n.color,X.fillStyle=n.color,X.lineWidth=n.lineWidth*x,X.setLineDash([]),n.rayLeft){const he=q+ce*(0-z);X.beginPath(),X.moveTo(0,he),X.lineTo(z,q),X.stroke()}if(n.rayRight){const ne=o.bitmapSize.width,he=V+ce*(ne-$);X.beginPath(),X.moveTo($,V),X.lineTo(ne,he),X.stroke()}const ee=Math.atan2(te,j),se=(n.lineWidth*4+4)*x,le=Math.PI/7;if(n.arrowRight){const ne=$-se*Math.cos(ee-le),he=V-se*Math.sin(ee-le),de=$-se*Math.cos(ee+le),we=V-se*Math.sin(ee+le);X.beginPath(),X.moveTo($,V),X.lineTo(ne,he),X.lineTo(de,we),X.closePath(),X.fill()}if(n.arrowLeft){const ne=ee+Math.PI,he=z-se*Math.cos(ne-le),de=q-se*Math.sin(ne-le),we=z-se*Math.cos(ne+le),xe=q-se*Math.sin(ne+le);X.beginPath(),X.moveTo(z,q),X.lineTo(he,de),X.lineTo(we,xe),X.closePath(),X.fill()}if(c){const ne=n.p1.rawTime??n.p1.time,he=n.p2.rawTime??n.p2.time,de=n.p1.price,we=n.p2.price,xe=[];if(n.statsPriceRange){const ye=Math.abs(we-de),ve=de!==0?Math.abs((we-de)/de*100):0,be=ye<1e-4?6:ye<.01?5:ye<1?4:2;xe.push("↕ "+ye.toFixed(be)+" ("+ve.toFixed(2)+"%)")}const Ue=[];if(n.statsBarsRange)try{const ye=h.timeScale().timeToCoordinate(ne),ve=h.timeScale().timeToCoordinate(he);if(ye!=null&&ve!=null){const be=h.timeScale().coordinateToLogical(ye),Ee=h.timeScale().coordinateToLogical(ve);be!=null&&Ee!=null&&Ue.push("↔ "+Math.abs(Math.round(Ee-be))+" bars")}}catch{}if(n.statsDateRange){const ye=Math.abs(he-ne),ve=Math.floor(ye/86400),be=Math.floor(ye%86400/3600),Ee=Math.floor(ye%3600/60);let Ie=ve>0?ve+" day"+(ve!==1?"s":""):"";be>0&&(Ie+=(Ie?" ":"")+be+" hour"+(be!==1?"s":"")),!ve&&!be&&(Ie=Ee+" min"+(Ee!==1?"s":"")),n.statsBarsRange&&Ue.length>0?Ue[Ue.length-1]+=" ("+Ie+")":Ue.push(Ie)}if(n.statsDistance){const ye=(R-M)/C,ve=(L-N)/x;Ue.push("distance: "+Math.sqrt(ye*ye+ve*ve).toFixed(2))}if(Ue.length>0&&xe.push(Ue.join(", ")),n.statsAngle){const ye=j/C,ve=te/x,be=Math.atan2(ve,ye)*180/Math.PI;xe.push("∠ "+be.toFixed(0)+"°")}if(xe.length>0){const ye=Math.min(C,x),ve=11*ye,be=ve*1.5,Ee=5*ye;X.font=ve+"px sans-serif";const Ze=xe.reduce((Pe,Je)=>Math.max(Pe,X.measureText(Je).width),0)+Ee*2,ze=xe.length*be+Ee*2;let Ce,Ne;n.statsPosition==="left"?(Ce=z,Ne=q):n.statsPosition==="center"?(Ce=(z+$)/2,Ne=(q+V)/2):(Ce=$,Ne=V);const Se=Ce-Ze/2,fe=Ne-ze-12*ye;X.fillStyle="rgba(20, 20, 30, 0.72)",X.fillRect(Se,fe,Ze,ze),X.strokeStyle=n.statsColor,X.lineWidth=1*ye,X.strokeRect(Se,fe,Ze,ze),X.fillStyle=n.statsColor,X.textBaseline="top",X.textAlign="left",xe.forEach((Pe,Je)=>{X.fillText(Pe,Se+Ee,fe+Ee+Je*be)})}}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 Iv{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,h=s.timeScale().timeToCoordinate(A.center.rawTime),g=o.priceToCoordinate(A.center.price);if(h==null||g==null)return;const C=Math.round(h*l),x=Math.round(g*c),b=n.bitmapSize.width,v=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,x),U.lineTo(b,x),U.stroke(),U.beginPath(),U.moveTo(C,0),U.lineTo(C,v),U.stroke(),A.showPrice){const F=A.center.price.toFixed(5),M=Math.round(11*c);U.font=M+"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),L=Math.round(3*c),z=M+2*L,q=N+2*R,$=b-q-Math.round(2*l),V=x-z/2;U.fillStyle=A.color,U.fillRect($,V,q,z),U.fillStyle="#ffffff",U.fillText(F,$+R,x)}if(A.showTime){const F=A.center.rawTime,M=new Date(F*1e3),N=X=>String(X).padStart(2,"0"),R=N(M.getUTCDate())+"."+N(M.getUTCMonth()+1)+"."+M.getUTCFullYear()+" "+N(M.getUTCHours())+":"+N(M.getUTCMinutes())+":"+N(M.getUTCSeconds()),L=Math.round(11*c);U.font=L+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const z=U.measureText(R).width,q=Math.round(6*l),$=Math.round(3*c),V=L+2*$,j=z+2*q,te=C-j/2,ce=v-V-Math.round(4*c);U.fillStyle=A.color,U.fillRect(te,ce,j,V),U.fillStyle="#ffffff",U.fillText(R,C,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 Dv{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,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),C=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(g==null||C==null||x==null||b==null)return;const v=g*c,U=x*h,F=C*c,M=b*h,N=v-F,R=U-M,L=F-v,z=M-U;if(Math.hypot(N,R)<1e-4)return;const $=Math.atan2(R,N),V=Math.round(Math.abs($*180/Math.PI)),j=s.context;j.save(),j.strokeStyle=r.color,j.fillStyle=r.color,j.lineWidth=r.lineWidth*h,j.setLineDash([]);const te=Math.abs(L)<1e-4?0:z/L;if(r.rayLeft){const we=U+te*(0-v);j.beginPath(),j.moveTo(0,we),j.lineTo(v,U),j.stroke()}if(r.rayRight){const de=s.bitmapSize.width,we=M+te*(de-F);j.beginPath(),j.moveTo(F,M),j.lineTo(de,we),j.stroke()}j.beginPath(),j.moveTo(v,U),j.lineTo(F,M),j.stroke();const ce=Math.atan2(z,L),X=(r.lineWidth*4+4)*h,ee=Math.PI/7;if(r.arrowRight){const de=F-X*Math.cos(ce-ee),we=M-X*Math.sin(ce-ee),xe=F-X*Math.cos(ce+ee),Ue=M-X*Math.sin(ce+ee);j.beginPath(),j.moveTo(F,M),j.lineTo(de,we),j.lineTo(xe,Ue),j.closePath(),j.fill()}if(r.arrowLeft){const de=ce+Math.PI,we=v-X*Math.cos(de-ee),xe=U-X*Math.sin(de-ee),Ue=v-X*Math.cos(de+ee),ye=U-X*Math.sin(de+ee);j.beginPath(),j.moveTo(v,U),j.lineTo(we,xe),j.lineTo(Ue,ye),j.closePath(),j.fill()}const se=28*h;j.strokeStyle="rgba(122,166,174,0.55)",j.fillStyle=r.color,j.lineWidth=1*h,j.beginPath(),j.moveTo(F,M),j.lineTo(F+se,M),j.stroke(),j.beginPath(),j.strokeStyle="rgba(122,166,174,0.45)",j.arc(F,M,se,0,$,$<0),j.stroke(),j.fillStyle="#4b7c86",j.font=`${Math.round(10*h)}px sans-serif`,j.textAlign="left",j.textBaseline="middle";const le=F+(se+10*h)*Math.cos($/2),ne=M+(se+10*h)*Math.sin($/2);if(j.fillText(`${V}°`,le,ne),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const de=r.p1.price,we=r.p2.price,xe=[];if(r.statsPriceRange){const ye=Math.abs(we-de),ve=de!==0?Math.abs((we-de)/de*100):0,be=ye<1e-4?6:ye<.01?5:ye<1?4:2;xe.push("↕ "+ye.toFixed(be)+" ("+ve.toFixed(2)+"%)")}const Ue=[];if(r.statsDistance){const ye=L/c,ve=z/h;Ue.push("distance: "+Math.sqrt(ye*ye+ve*ve).toFixed(2))}if(Ue.length>0&&xe.push(Ue.join(", ")),xe.length>0){const ye=Math.min(c,h),ve=11*ye,be=ve*1.5,Ee=5*ye;j.font=ve+"px sans-serif";const Ze=xe.reduce((Ge,ke)=>Math.max(Ge,j.measureText(ke).width),0)+Ee*2,ze=xe.length*be+Ee*2,[Ce,Ne,Se,fe]=v<=F?[v,U,F,M]:[F,M,v,U];let Pe,Je;r.statsPosition==="left"?(Pe=Ce,Je=Ne):r.statsPosition==="center"?(Pe=(Ce+Se)/2,Je=(Ne+fe)/2):(Pe=Se,Je=fe);const it=Pe-Ze/2,rt=Je-ze-12*ye;j.fillStyle="rgba(20, 20, 30, 0.72)",j.fillRect(it,rt,Ze,ze),j.strokeStyle=r.statsColor,j.lineWidth=1*ye,j.strokeRect(it,rt,Ze,ze),j.fillStyle=r.statsColor,j.textBaseline="top",j.textAlign="left",xe.forEach((Ge,ke)=>{j.fillText(Ge,it+Ee,rt+Ee+ke*be)})}}j.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class _v{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,h=s.verticalPixelRatio,g=s.context,C=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(C==null||x==null||b==null||v==null||U==null||F==null)return;const M=C*c,N=x*h,R=b*c,L=v*h,z=U*c,q=F*h,$=(R+z)/2,V=(L+q)/2;let j=$-M,te=V-N;Math.abs(j)<1e-4&&(j=1e-4);const ce=te/j,X=s.bitmapSize.width,ee=(R-z)/2,se=(L-q)/2,le=ye=>({x:$+ee*ye,y:V+se*ye}),ne=(ye,ve)=>({x:X,y:ve+ce*(X-ye)}),he=le(1),de=le(-1),we=ne(he.x,he.y),xe=ne(de.x,de.y);g.save(),g.beginPath(),g.moveTo(he.x,he.y),g.lineTo(we.x,we.y),g.lineTo(xe.x,xe.y),g.lineTo(de.x,de.y),g.closePath(),g.fillStyle="rgba(148, 163, 184, 0.2)",g.fill(),g.beginPath(),g.strokeStyle="rgba(148, 163, 184, 0.9)",g.lineWidth=1*h,g.moveTo(R,L),g.lineTo(z,q),g.stroke(),r._levels.forEach(ye=>{const ve=le(ye.k),be=ne(ve.x,ve.y);g.beginPath(),g.strokeStyle=ye.color,g.lineWidth=ye.width*h,g.moveTo(ve.x,ve.y),g.lineTo(be.x,be.y),g.stroke()});const Ue=ne(M,N);g.beginPath(),g.strokeStyle="rgba(161, 98, 7, 0.9)",g.lineWidth=1.1*h,g.moveTo(M,N),g.lineTo(Ue.x,Ue.y),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Pv{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,h=n.context,g=s.timeScale().timeToCoordinate(A.p1.rawTime),C=o.priceToCoordinate(A.p1.price),x=s.timeScale().timeToCoordinate(A.p2.rawTime),b=o.priceToCoordinate(A.p2.price);if(g==null||C==null||x==null||b==null)return;const v=g*l,U=C*c,F=x*l,M=b*c,N=n.bitmapSize.width,R=Math.abs(F-v)<1e-4?1:F-v,L=(M-U)/R,z=F>=v?1:-1,q=z>0?N:0,$=v+z*Math.min(220*l,Math.max(80*l,N*.35)),V=A._rays.map(te=>{const ce=L*te.ratio;return{...te,yEnd:U+ce*(q-v),yLabel:U+ce*($-v)}});h.save();const j=(te,ce,X)=>{!te||!ce||(h.beginPath(),h.moveTo(v,U),h.lineTo(q,te.yEnd),h.lineTo(q,ce.yEnd),h.closePath(),h.fillStyle=X,h.fill())};j(V[0],V[3],"rgba(161, 98, 7, 0.10)"),j(V[3],V[4],"rgba(5, 150, 105, 0.10)"),j(V[4],V[5],"rgba(107, 114, 128, 0.12)"),V.forEach(te=>{h.beginPath(),h.strokeStyle=te.color,h.lineWidth=1*c,h.moveTo(v,U),h.lineTo(q,te.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=z>0?"left":"right",h.textBaseline="middle",V.forEach(te=>{h.fillStyle=te.color;const ce=$+(z>0?4*l:-4*l),X=te.yLabel;X<-20||X>n.bitmapSize.height+20||h.fillText(te.label,ce,X)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class kv{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,h=s.verticalPixelRatio,g=s.context,C=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p2.price);if(C==null||x==null||b==null||v==null)return;const U=C*c,F=x*h,M=b*c,N=v*h,R=M-U,L=N-F,z=Math.hypot(R,L);if(z<1e-4)return;const q=R/z,$=L/z,V=-$,j=q,te=M+V*z,ce=N+j*z,X=U+V*z,ee=F+j*z,se=(ne,he)=>({x:U+q*z*ne+V*z*he,y:F+$*z*ne+j*z*he});g.save();const le=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let ne=0;ne<r.divisions;ne++){const he=ne/r.divisions,de=(ne+1)/r.divisions,we=se(0,he),xe=se(1,he),Ue=se(1,de),ye=se(0,de);g.beginPath(),g.moveTo(we.x,we.y),g.lineTo(xe.x,xe.y),g.lineTo(Ue.x,Ue.y),g.lineTo(ye.x,ye.y),g.closePath(),g.fillStyle=le[ne%le.length],g.fill()}g.lineWidth=1*h,g.strokeStyle="rgba(148, 163, 184, 0.55)";for(let ne=0;ne<=r.divisions;ne++){const he=ne/r.divisions,de=se(0,he),we=se(1,he),xe=se(he,0),Ue=se(he,1);g.beginPath(),g.moveTo(de.x,de.y),g.lineTo(we.x,we.y),g.stroke(),g.beginPath(),g.moveTo(xe.x,xe.y),g.lineTo(Ue.x,Ue.y),g.stroke()}g.strokeStyle="rgba(100, 116, 139, 0.85)",g.lineWidth=1*h,g.beginPath(),g.moveTo(U,F),g.lineTo(te,ce),g.stroke(),g.beginPath(),g.moveTo(M,N),g.lineTo(X,ee),g.stroke(),g.strokeStyle="rgba(122, 166, 174, 0.95)",g.lineWidth=1.2*h,g.beginPath(),g.moveTo(U,F),g.lineTo(M,N),g.lineTo(te,ce),g.lineTo(X,ee),g.closePath(),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ha{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:h=!0,showPrices:g=!0,pricesColor:C="#129f5c",rayLeft:x=!1,rayRight:b=!1,arrowLeft:v=!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=h,this.showPrices=g,this.pricesColor=C,this.rayLeft=x,this.rayRight=b,this.arrowLeft=v,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(M){M.useBitmapCoordinateSpace(N=>{if(!F.visible)return;const R=F._chart,L=F._series;if(!R||!L)return;const z=N.horizontalPixelRatio,q=N.verticalPixelRatio,$=[F.p1,F.p3,F.p4,F.p2].map(ze=>{const Ce=R.timeScale().timeToCoordinate(ze.rawTime),Ne=L.priceToCoordinate(ze.price);return Ce==null||Ne==null?null:{x:Ce*z,y:Ne*q}}).filter(Boolean);if($.length!==4)return;const[V,j,te,ce]=$,X=N.context;X.save();const ee=j.x-V.x,se=j.y-V.y,le=Math.sqrt(ee*ee+se*se)||1,ne=ee/le,he=se/le,de=te.x-ce.x,we=te.y-ce.y,xe=Math.sqrt(de*de+we*we)||1,Ue=de/xe,ye=we/xe,ve=1e5,be=F.rayLeft?{x:V.x-ne*ve,y:V.y-he*ve}:V,Ee=F.rayRight?{x:j.x+ne*ve,y:j.y+he*ve}:j,Ie=F.rayLeft?{x:ce.x-Ue*ve,y:ce.y-ye*ve}:ce,Ze=F.rayRight?{x:te.x+Ue*ve,y:te.y+ye*ve}:te;if(F.showBackground){const ze=F.fillColor||"#6aa84f",Ce=parseInt(ze.slice(1,3),16),Ne=parseInt(ze.slice(3,5),16),Se=parseInt(ze.slice(5,7),16);X.beginPath(),X.moveTo(V.x,V.y),X.lineTo(j.x,j.y),X.lineTo(te.x,te.y),X.lineTo(ce.x,ce.y),X.closePath(),X.fillStyle=`rgba(${Ce},${Ne},${Se},${F.fillOpacity??.1})`,X.fill()}if(X.strokeStyle=F.lineColor,X.lineWidth=F.lineWidth*q,X.setLineDash([]),X.beginPath(),X.moveTo(be.x,be.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(ce.x,ce.y),X.moveTo(j.x,j.y),X.lineTo(te.x,te.y),X.stroke(),F.arrowLeft||F.arrowRight){const ze=8*q,Ce=(Ne,Se,fe)=>{X.save(),X.translate(Ne,Se),X.rotate(fe),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&&(Ce(be.x,be.y,Math.atan2(-he,-ne)),Ce(Ie.x,Ie.y,Math.atan2(-ye,-Ue))),F.arrowRight&&(Ce(Ee.x,Ee.y,Math.atan2(he,ne)),Ce(Ze.x,Ze.y,Math.atan2(ye,Ue)))}if(X.fillStyle="#ffffff",X.strokeStyle="#3b82f6",X.lineWidth=2*q,[V,j,te,ce].forEach(ze=>{X.beginPath(),X.arc(ze.x,ze.y,6*q,0,Math.PI*2),X.fill(),X.stroke()}),F.showPrices){const ze=[F.p1,F.p3,F.p2,F.p4],Ce=[V,j,ce,te];X.fillStyle=F.pricesColor||F.lineColor,X.font=`${Math.round(10*q)}px sans-serif`,X.textAlign="left",X.textBaseline="middle",Ce.forEach((Ne,Se)=>{const fe=ze[Se]?.price;typeof fe=="number"&&X.fillText(fe.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 Hd extends Ha{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class Id{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const h=o._chart,g=o._series;if(!h||!g)return;const C=c.horizontalPixelRatio,x=c.verticalPixelRatio,b=c.context,v=R=>{const L=h.timeScale().timeToCoordinate(R.rawTime),z=g.priceToCoordinate(R.price);return L==null||z==null?null:{x:L*C,y:z*x}},U=v(o.p1),F=v(o.p2),M=v(o.b2),N=v(o.b1);!U||!F||!M||!N||(b.save(),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(F.x,F.y),b.lineTo(M.x,M.y),b.lineTo(N.x,N.y),b.closePath(),b.fillStyle=o.fillColor,b.fill(),b.strokeStyle=o.strokeColor,b.lineWidth=o.lineWidth*x,b.setLineDash([]),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(F.x,F.y),b.stroke(),b.beginPath(),b.moveTo(N.x,N.y),b.lineTo(M.x,M.y),b.stroke(),b.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ia{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(h=>{if(!l.visible)return;const g=l._chart,C=l._series;if(!g||!C)return;const x=h.horizontalPixelRatio,b=h.verticalPixelRatio,v=h.context,U=$=>{const V=g.timeScale().timeToCoordinate($.rawTime),j=C.priceToCoordinate($.price);return V==null||j==null?null:{x:V*x,y:j*b}},F=U(l.mid1),M=U(l.mid2),N=U(l.top1),R=U(l.top2),L=U(l.bot1),z=U(l.bot2);if(!F||!M||!N||!R||!L||!z)return;v.save(),v.beginPath(),v.moveTo(F.x,F.y),v.lineTo(M.x,M.y),v.lineTo(R.x,R.y),v.lineTo(N.x,N.y),v.closePath(),v.fillStyle=l.upperFillColor,v.fill(),v.beginPath(),v.moveTo(L.x,L.y),v.lineTo(z.x,z.y),v.lineTo(M.x,M.y),v.lineTo(F.x,F.y),v.closePath(),v.fillStyle=l.lowerFillColor,v.fill();const q=($,V,j)=>{v.beginPath(),v.strokeStyle=j,v.lineWidth=l.lineWidth*b,v.setLineDash([]),v.moveTo($.x,$.y),v.lineTo(V.x,V.y),v.stroke()};if(q(N,R,l.upperStrokeColor),q(F,M,l.centerStrokeColor),q(L,z,l.lowerStrokeColor),l.showDeviationLabel){const $=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite($)?$.toFixed(5):null;if(V){const j=Math.max(10,Math.round(10*b));v.fillStyle=l.labelColor,v.font=`${j}px sans-serif`,v.textAlign="left",v.textBaseline="top",v.fillText(V,L.x+2*x,L.y+10*b)}}v.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 extends Ia{}class _d{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,h=n.context,g=n.bitmapSize.width;n.bitmapSize.height;const C=A.p1.price,x=A.p2.price,b=C-x,v=$=>x+b*$,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),M=o.priceToCoordinate(C),N=o.priceToCoordinate(x),R=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,L=U!=null&&F!=null?Math.round(Math.max(U,F)*l):g,z=L-R;h.save(),A._zoneFills.forEach(({from:$,to:V,color:j})=>{const te=v($),ce=v(V),X=o.priceToCoordinate(te),ee=o.priceToCoordinate(ce);if(X==null||ee==null)return;const se=Math.round(X*c),le=Math.round(ee*c);h.fillStyle=j,h.fillRect(R,Math.min(se,le),z,Math.abs(le-se))}),A._levels.forEach(({ratio:$,label:V})=>{const j=v($),te=o.priceToCoordinate(j);if(te==null)return;const ce=Math.round(te*c),X=A._levelColors[$]||"#888888";h.beginPath(),h.strokeStyle=X,h.lineWidth=$===0||$===1?1.5*c:1*c,$!==0&&$!==1&&$<1?h.setLineDash([4*l,4*l]):h.setLineDash([]),h.moveTo(R,ce),h.lineTo(L,ce),h.stroke(),h.setLineDash([])});const q=Math.round(11*c);if(h.font=`${q}px sans-serif`,h.textAlign="left",A._levels.forEach(({ratio:$,label:V})=>{const j=v($),te=o.priceToCoordinate(j);if(te==null)return;const ce=Math.round(te*c),X=A._levelColors[$]||"#888888",ee=`${V} (${j.toFixed(5)})`;h.fillStyle=X,h.textAlign="right",h.fillText(ee,R-4*l,ce-4*c)}),U!=null&&F!=null&&M!=null&&N!=null){const $=Math.round(U*l),V=Math.round(M*c),j=Math.round(F*l),te=Math.round(N*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo($,V),h.lineTo(j,te),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc($,V,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(j,te,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Nv{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 h=Math.round(c*o.horizontalPixelRatio),g=o.bitmapSize.height,C=o.context;C.save(),C.beginPath(),C.strokeStyle=n.color,C.lineWidth=n.lineWidth*o.horizontalPixelRatio,C.setLineDash([]),C.moveTo(h,0),C.lineTo(h,g),C.stroke();const x=Math.round(g/2);if(n.midYCss=x/o.verticalPixelRatio,n.showDot){C.beginPath(),C.strokeStyle=n.color,C.lineWidth=1.5*o.horizontalPixelRatio;const b=5*o.horizontalPixelRatio;C.arc(h,x,b,0,Math.PI*2),C.stroke()}if(n.showDate!==!1){const b=n.time,v=new Date(typeof b=="number"?b*1e3:b),U=j=>String(j).padStart(2,"0"),F=`${U(v.getUTCDate())}.${U(v.getUTCMonth()+1)}.${v.getUTCFullYear()} ${U(v.getUTCHours())}:${U(v.getUTCMinutes())}:${U(v.getUTCSeconds())}`,M=Math.round(11*o.verticalPixelRatio);C.font=`${M}px ui-sans-serif, system-ui, sans-serif`,C.textBaseline="middle",C.textAlign="center";const N=C.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),L=Math.round(3*o.verticalPixelRatio),z=M+2*L,q=N+2*R,$=h-q/2,V=g-z-Math.round(4*o.verticalPixelRatio);C.fillStyle=n.color,C.fillRect($,V,q,z),C.fillStyle="#ffffff",C.fillText(F,h,V+z/2)}C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Pd(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 Ov(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 h=c;for(;h.length>s;){let g=h.lastIndexOf(" ",s);g<=0&&(g=s),o.push(h.slice(0,g)),h=h.slice(g).trimStart()}o.push(h)};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=Ov(A.text??i?.text??"Text",r,n),o=s.reduce((b,v)=>Math.max(b,v.length),1),c=Math.max(20,o*r*.58)+16,h=r*1.2,g=s.length*h+10,C=e-c/2,x=t-g;return{left:C,right:C+c,top:x,bottom:x+g+12}}class Kv{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),h=l.priceToCoordinate(r.price);if(c==null||h==null)return;const g=s.horizontalPixelRatio,C=s.verticalPixelRatio,x=Math.round(c*g),b=Math.round(h*C),v=s.context;v.save();const U=Math.round(r.fontSize*C);v.font=`${r.fontStyle} ${r.fontWeight} ${U}px sans-serif`;const F=`${r.text??""}`,M=220*g,N=[],R=he=>{if(!r.textWrap||he.length===0){N.push(he);return}const de=he.split(/\s+/);let we="";for(const xe of de){const Ue=we?`${we} ${xe}`:xe;v.measureText(Ue).width<=M||!we?we=Ue:(N.push(we),we=xe)}N.push(we)};F.split(`
12
- `).forEach(R),N.length===0&&N.push("");const L=N.map(he=>v.measureText(he).width),z=Math.max(...L,20*g),q=8*g,$=5*C,V=z+q*2,j=U*1.2,te=j*N.length+$*2,ce=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",X=x-V/2,ee=b-te;r.bgEnabled&&(v.fillStyle=Pd(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),v.beginPath(),v.rect(X,ee,V,te),v.fill()),r.borderEnabled&&(v.strokeStyle=Pd(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),v.lineWidth=Math.max(.5,(r.borderWidth??1)*C),v.beginPath(),v.rect(X,ee,V,te),v.stroke()),v.fillStyle=r.color,v.textAlign=ce,v.textBaseline="middle";const se=ce==="left"?X+q:ce==="right"?X+V-q:X+V/2;for(let he=0;he<N.length;he++)v.fillText(N[he],se,ee+$+j*(he+.5));const le=5*C,ne=b+10*C;v.beginPath(),v.strokeStyle="#3b82f6",v.lineWidth=1.5*C,v.arc(x,ne,le,0,Math.PI*2),v.stroke(),v.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const Vv={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Nd(i){if(!i)return 7;const e=String(i).toUpperCase();return Vv[e]??7}function zv(i,e){const t=String(i||"").toUpperCase(),A=e||Nd(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:Y(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 h=t+c*s,g=A+c*o;return Math.hypot(i-h,e-g)}function Wv(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 h=t+c*s,g=A+c*o;return Math.hypot(i-h,e-g)}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);const c=((i-t)*s+(e-A)*o)/l,h=t+c*s,g=A+c*o;return Math.hypot(i-h,e-g)}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 Od(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??Y(i.rawTime),r=e.normalizedTime??Y(e.rawTime),n=t.normalizedTime??Y(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),h=Y((A+r)/2),g=(l+c)/2;return h==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:h,normalizedTime:h,price:g}}}function Ni(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??Y(e.rawTime),n=t.normalizedTime??Y(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map($=>({time:Y($.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 h=0,g=0,C=0,x=0;for(let $=0;$<c;$++){const V=$,j=l[$].close;h+=V,g+=j,C+=V*j,x+=V*V}const b=c*x-h*h,v=Math.abs(b)<1e-12?0:(c*C-h*g)/b,U=(g-v*h)/c;let F=0;for(let $=0;$<c;$++){const V=U+v*$,j=l[$].close-V;F+=j*j}const M=Math.sqrt(F/c),N=Math.max(M*A,1e-8),R=l[0].time,L=l[c-1].time,z=U,q=U+v*(c-1);return{slope:v,intercept:U,stdDev:M,offset:N,barCount:c,p1:{rawTime:R,normalizedTime:R,price:z},p2:{rawTime:L,normalizedTime:L,price:q},top1:{rawTime:R,normalizedTime:R,price:z+N},top2:{rawTime:L,normalizedTime:L,price:q+N},bot1:{rawTime:R,normalizedTime:R,price:z-N},bot2:{rawTime:L,normalizedTime:L,price:q-N}}}function Sr(i,e,t,A=1){return Ni(i,e,t,A)}const Gv={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}},$v={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 Xv(i,e){if(!i||!i.type)return!1;const t=Gv[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function Zv(i){return i?$v[i]??"#22c55e":"#22c55e"}const Jv=300,Kd=24,Yv=150,Vd=150;function Da(i,e,t=Jv){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=Y(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 qv(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=Y(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function jv(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 ms(i,e,t,A){const r=Y(e),n=Y(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=C=>{const x=jv(i,C);if(x<=0)return 0;if(x>=i.length)return i.length-1;const b=i[x-1],v=i[x];return Math.abs(C-b)<=Math.abs(v-C)?x-1:x},h=c(r),g=c(n);return Math.max(1,Math.abs(g-h)+1)}function zd(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=qv(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 h=A.getVisibleLogicalRange(),g=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,C=Number.isFinite(g)&&g>20?g:120,x=Math.min(Vd,C/2),b=Math.max(20,C-x),v={from:c-b,to:c+x};try{return A.setVisibleLogicalRange(v),!0}catch{}}}const s=tA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-Yv*o,to:r+Vd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const eT=Ae.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=Ae.useRef(null),l=Ae.useRef(null),c=Ae.useRef(null),h=Ae.useRef(null),g=Ae.useRef(null),C=Ae.useRef(null),x=Ae.useRef([]),b=Ae.useRef(!1),v=Ae.useRef(null),U=Ae.useRef(null),F=Ae.useRef(null),M=Ae.useRef(null),N=Ae.useRef([]),[R,L]=Ae.useState(null),[z,q]=Ae.useState(null),[$,V]=Ae.useState([]),[j,te]=Ae.useState(null),[ce,X]=Ae.useState([]),ee=Ae.useRef(null),se=Ae.useRef(null),le=Ae.useRef(null),ne=Ae.useRef(!1),he=Ae.useRef(!1);Ae.useEffect(()=>{le.current=R;let d=!1;x.current.forEach(p=>{if(p.type==="trendline"&&p.decoration){const O=p===R;p.decoration.isSelected!==O&&(p.decoration.isSelected=O,d=!0)}}),d&&c.current?.applyOptions({})},[R]);const de=Ae.useRef(new Map),we=Ae.useRef(null),xe=Ae.useRef(null),Ue=(d,p)=>`${d}_${p}`,ye=()=>{const d=Ue(Se,fe);return de.current.get(d)||null},ve=d=>{if(!d)return;const p=Ue(Se,fe);de.current.set(p,d)},{activeTool:be,setActiveTool:Ee,showGrid:Ie,snapToGrid:Ze,chartObjects:ze,setChartObjects:Ce,orders:Ne,selectedSymbol:Se,selectedTimeframe:fe,drawingsVisible:Pe,chartType:Je,chartLocked:it,theme:rt,baseUrl:Ge,endpoints:ke,endpointParams:me}=Lt(),ge=Ae.useRef([]),[Me,_e]=Ae.useState(!1),[Qe,Ke]=Ae.useState(null),[Ve,dt]=Ae.useState([]),[wt,It]=Ae.useState(!0),[Ir,Bs]=Ae.useState(null),[gi,ys]=Ae.useState(0),Dt=Ae.useMemo(()=>{const d=Ve.map(p=>Y(p?.time)).filter(p=>Number.isFinite(p));return d.sort((p,O)=>p-O),d},[Ve]),vt=Ae.useRef(null),St=Ae.useRef(new Map);Ae.useRef(null);const jt=Ae.useRef(0),qA=Ae.useRef(null);Ae.useEffect(()=>{const d=g.current;d&&d.setData(Da(Ve,fe))},[Ve,fe]),Ae.useImperativeHandle(s,()=>({zoomIn:()=>{const d=c.current?.timeScale();if(!d)return;const p=d.getVisibleRange();if(!p||!p.from||!p.to)return;const O=p.to-p.from,Te=(p.from+p.to)/2,S=O*.8;try{d.setVisibleRange({from:Te-S/2,to:Te+S/2}),ve(d.getVisibleRange())}catch{}},zoomOut:()=>{const d=c.current?.timeScale();if(!d)return;const p=d.getVisibleRange();if(!p||!p.from||!p.to)return;const O=p.to-p.from,Te=(p.from+p.to)/2,S=O*1.25;try{d.setVisibleRange({from:Te-S/2,to:Te+S/2}),ve(d.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const d=o.current;if(!d){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const p=d.querySelectorAll("canvas"),O=rt==="light"?"#ffffff":"#12161d";let Te=null,S=0;if(p.forEach(y=>{if(y.width>0&&y.height>0){const J=y.width*y.height;J>S&&(S=J,Te=y)}}),Te)try{const y=document.createElement("canvas");y.width=Te.width,y.height=Te.height;const J=y.getContext("2d");J.fillStyle=O,J.fillRect(0,0,y.width,y.height),J.drawImage(Te,0,0);const T=document.createElement("a");T.download=`chart-${Se}-${fe}-${Date.now()}.png`,T.href=y.toDataURL("image/png"),T.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(y){console.warn("Canvas export failed, trying html2canvas",y)}Cv(d,{useCORS:!0,allowTaint:!0,backgroundColor:O,scale:2,logging:!1}).then(y=>{const J=document.createElement("a");J.download=`chart-${Se}-${fe}-${Date.now()}.png`,J.href=y.toDataURL("image/png"),J.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(y=>{console.error("Chart screenshot failed",y),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Se,fe,rt]);const ka=Ae.useMemo(()=>Ve.length===0?[]:Je==="line"||Je==="area"?Ve.map(d=>({time:d.time,value:d.close})):Ve,[Ve,Je]),yT=d=>{r?r(d):(Ke("BUY"),_e(!0))},CT=d=>{n?n(d):(Ke("SELL"),_e(!0))},vT=()=>{_e(!1),Ke(null)},TT=d=>{const p=z;if(!p||!d)return;const O=(y,J)=>{if(typeof y!="string")return J;const T=y.trim(),oe=T.startsWith("#")?T:`#${T}`;return/^#[0-9A-Fa-f]{6}$/.test(oe)?oe.toLowerCase():J},Te=(y,J)=>{const T=Number(y);return Number.isFinite(T)?Math.max(0,Math.min(1,T)):J};let S={...p,visibleTimeframes:Array.isArray(d.visibleTimeframes)?[...d.visibleTimeframes]:p.visibleTimeframes};if(p.type==="text"){const y=Number.isFinite(Number(d.price))?Number(d.price):p.price,J=p.primitive;J&&(J.text=typeof d.text=="string"?d.text:J.text,J.color=O(d.color,J.color??"#5f8f96"),J.fontSize=Number.isFinite(Number(d.fontSize))?Number(d.fontSize):J.fontSize,J.fontWeight=d.fontWeight==="bold"?"bold":"normal",J.fontStyle=d.fontStyle==="italic"?"italic":"normal",J.textAlign=["left","center","right"].includes(d.textAlign)?d.textAlign:J.textAlign,J.textWrap=!!d.textWrap,J.borderEnabled=!!d.borderEnabled,J.borderColor=O(d.borderColor,J.borderColor??"#5f8f96"),J.borderOpacity=Te(d.borderOpacity,J.borderOpacity??.1),J.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(d.borderWidth))?Number(d.borderWidth):1)),J.bgEnabled=!!d.bgEnabled,J.bgColor=O(d.bgColor,J.bgColor??"#5f8f96"),J.bgOpacity=Te(d.bgOpacity,J.bgOpacity??.1),J.price=y),S={...S,price:y,text:typeof d.text=="string"?d.text:p.text}}if(p.type==="trendline"){const y=O(d.lineColor,"#22c55e"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2));if(p.series)try{p.series.applyOptions({color:y,lineWidth:J})}catch{}const T=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.point1?.price,oe=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.point2?.price;if(p.series&&p.point1&&p.point2){const ae=p.point1.time??p.point1.rawTime,re=p.point2.time??p.point2.rawTime;try{const f=UA([{time:ae,value:T},{time:re,value:oe}]);f.length>0&&p.series.setData(f)}catch{}}const E={...p.point1,price:T},K={...p.point2,price:oe};p.decoration&&(p.decoration.color=y,p.decoration.lineWidth=J,p.decoration.arrowLeft=!!d.arrowLeft,p.decoration.arrowRight=!!d.arrowRight,p.decoration.rayLeft=!!d.rayLeft,p.decoration.rayRight=!!d.rayRight,p.decoration.statsColor=O(d.statsColor,"#5f8f96"),p.decoration.statsPosition=d.statsPosition??"right",p.decoration.statsShowAlways=!!d.statsShowAlways,p.decoration.statsPriceRange=!!d.statsPriceRange,p.decoration.statsBarsRange=!!d.statsBarsRange,p.decoration.statsDateRange=!!d.statsDateRange,p.decoration.statsAngle=!!d.statsAngle,p.decoration.statsDistance=!!d.statsDistance,p.decoration.p1=E,p.decoration.p2=K),S={...S,lineColor:y,lineWidth:J,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsShowAlways:!!d.statsShowAlways,statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,point1:E,point2:K,decoration:p.decoration}}if(p.type==="pricelevel"){const y=O(d.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=d.showPrice!==!1,oe=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",K=O(d.textColor,"#ffffff"),ae=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",re=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",f=Number.isFinite(Number(d.price))?Number(d.price):p.price;if(p.priceLine)try{p.priceLine.applyOptions({price:f,color:y,lineWidth:J,axisLabelVisible:T,title:T&&typeof f=="number"?f.toFixed(5):""})}catch{}const B=h.current;if(oe&&E&&B)if(p.textPrimitive)p.textPrimitive.text=E,p.textPrimitive.textColor=K,p.textPrimitive.hAlign=ae,p.textPrimitive.vAlign=re,p.textPrimitive.price=f;else{const Q=new Ed(f,{text:E,textColor:K,hAlign:ae,vAlign:re});try{B.attachPrimitive(Q)}catch{}p.textPrimitive=Q}else if(p.textPrimitive&&B){try{B.detachPrimitive(p.textPrimitive)}catch{}p.textPrimitive=null}S={...S,price:f,lineColor:y,lineWidth:J,showPrice:T,showText:oe,textContent:E,textColor:K,textHAlign:ae,textVAlign:re,textPrimitive:p.textPrimitive}}if(p.type==="horizontalray"){const y=O(d.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=d.showPrice!==!1,oe=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",K=O(d.textColor,"#ffffff"),ae=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",re=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",f=Number.isFinite(Number(d.price))?Number(d.price):p.price,B=p.primitive;if(B&&(B.price=f,B.color=y,B.lineWidth=J),p.priceLine)try{p.priceLine.applyOptions({price:f,color:y,axisLabelVisible:T,title:T&&typeof f=="number"?f.toFixed(5):""})}catch{}const Q=h.current;if(oe&&E&&Q)if(p.textPrimitive)p.textPrimitive.text=E,p.textPrimitive.textColor=K,p.textPrimitive.hAlign=ae,p.textPrimitive.vAlign=re,p.textPrimitive.price=f,p.textPrimitive.originTime=p.rawOriginTime;else{const w=new Ed(f,{text:E,textColor:K,hAlign:ae,vAlign:re,originTime:p.rawOriginTime});try{Q.attachPrimitive(w)}catch{}p.textPrimitive=w}else if(p.textPrimitive&&Q){try{Q.detachPrimitive(p.textPrimitive)}catch{}p.textPrimitive=null}S={...S,price:f,lineColor:y,lineWidth:J,showPrice:T,showText:oe,textContent:E,textColor:K,textHAlign:ae,textVAlign:re,textPrimitive:p.textPrimitive}}if(p.type==="verticalline"){const y=O(d.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=d.showDate!==!1,oe=p.primitive;oe&&(oe.color=y,oe.lineWidth=J,oe.showDate=T),S={...S,lineColor:y,lineWidth:J,showDate:T}}if(p.type==="infoline"){const y=O(d.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=d.statsShowAlways!==!1,oe=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",K=!!d.statsPriceRange,ae=!!d.statsBarsRange,re=!!d.statsDateRange,f=!!d.statsAngle,B=!!d.statsDistance,Q=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.p1.price,w=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.p2.price,u=p.p1.rawTime,D=p.p2.rawTime,H=w-Q,P=Q!==0?H/Math.abs(Q)*100:0,I=p.p1.normalizedTime??0,m=p.p2.normalizedTime??0,_=tA(fe)||3600,k=Math.abs(m-I),W=Math.max(1,Math.round(k/_)),G=Math.max(1,Math.round(k/86400)),Z=c.current,ie=h.current,ue=Z?Z.timeScale().timeToCoordinate(u):null,Be=ie?ie.priceToCoordinate(Q):null,Fe=Z?Z.timeScale().timeToCoordinate(D):null,He=ie?ie.priceToCoordinate(w):null,$e=ue!=null&&Be!=null&&Fe!=null&&He!=null?Math.atan2(-(He-Be),Fe-ue)*(180/Math.PI):p.primitive?.info?.angle??0,qe={priceDiff:H,pricePct:P,bars:W,days:G,angle:$e},Re=p.primitive;Re&&(Re.color=y,Re.lineWidth=J,Re.statsShowAlways=T,Re.statsColor=oe,Re.statsPosition=E,Re.statsPriceRange=K,Re.statsBarsRange=ae,Re.statsDateRange=re,Re.statsAngle=f,Re.statsDistance=B,Re.p1={...p.p1,price:Q},Re.p2={...p.p2,price:w},Re.info=qe),S={...S,lineColor:y,lineWidth:J,statsShowAlways:T,statsColor:oe,statsPosition:E,statsPriceRange:K,statsBarsRange:ae,statsDateRange:re,statsAngle:f,statsDistance:B,p1:{...p.p1,price:Q},p2:{...p.p2,price:w}}}if(p.type==="rulerline"){const y=O(d.lineColor,"#3b82f6"),J=d.showArea!==!1,T=!!d.statsShowAlways,oe=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",K=!!d.statsPriceRange,ae=!!d.statsBarsRange,re=!!d.statsDateRange,f=p.primitive;f&&(f.lineColor=y,f.showArea=J,f.statsShowAlways=T,f.statsColor=oe,f.statsPosition=E,f.statsPriceRange=K,f.statsBarsRange=ae,f.statsDateRange=re),S={...S,lineColor:y,showArea:J,statsShowAlways:T,statsColor:oe,statsPosition:E,statsPriceRange:K,statsBarsRange:ae,statsDateRange:re}}if(p.type==="arrowedline"){const y=O(d.lineColor,"#f59e0b"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.p1.price,oe=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.p2.price,E=p.primitive;E&&(E.color=y,E.lineWidth=J,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...p.p1,price:T},E.p2={...p.p2,price:oe}),S={...S,lineColor:y,lineWidth:J,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...p.p1,price:T},p2:{...p.p2,price:oe}}}if(p.type==="rayline"){const y=O(d.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.p1.price,oe=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.p2.price,E=p.primitive;E&&(E.color=y,E.lineWidth=J,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...p.p1,price:T},E.p2={...p.p2,price:oe}),S={...S,lineColor:y,lineWidth:J,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...p.p1,price:T},p2:{...p.p2,price:oe}}}if(p.type==="extendedline"){const y=O(d.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.p1.price,oe=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.p2.price,E=p.primitive;E&&(E.color=y,E.lineWidth=J,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...p.p1,price:T},E.p2={...p.p2,price:oe}),S={...S,lineColor:y,lineWidth:J,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...p.p1,price:T},p2:{...p.p2,price:oe}}}if(p.type==="crossline"){const y=O(d.lineColor,"#06a0e3"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=Number.isFinite(Number(d.price))?Number(d.price):p.p.price,oe=p.primitive;oe&&(oe.color=y,oe.lineWidth=J,oe.showTime=!!d.showTime,oe.showPrice=!!d.showPrice,oe.center={...p.p,price:T}),S={...S,lineColor:y,lineWidth:J,showTime:!!d.showTime,showPrice:!!d.showPrice,p:{...p.p,price:T}}}if(p.type==="trendbyangle"){const y=O(d.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.p1.price,oe=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.p2.price,E=p.primitive;E&&(E.color=y,E.lineWidth=J,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsDistance=!!d.statsDistance,E.p1={...p.p1,price:T},E.p2={...p.p2,price:oe}),S={...S,lineColor:y,lineWidth:J,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsDistance:!!d.statsDistance,p1:{...p.p1,price:T},p2:{...p.p2,price:oe}}}if(p.type==="disjointchannel"){const y=O(d.lineColor,"#129f5c"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=O(d.fillColor,"#6aa84f"),oe=Te(d.fillOpacity,.1),E=O(d.pricesColor,"#129f5c"),K=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.p1.price,ae=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.p3.price,re=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):p.p2.price,f=p.primitive;f&&(f.lineColor=y,f.lineWidth=J,f.fillColor=T,f.fillOpacity=oe,f.showBackground=!!d.showBackground,f.showPrices=!!d.showPrices,f.pricesColor=E,f.rayLeft=!!d.rayLeft,f.rayRight=!!d.rayRight,f.arrowLeft=!!d.arrowLeft,f.arrowRight=!!d.arrowRight,f.p1={...p.p1,price:K},f.p3={...p.p3,price:ae},f.p2={...p.p2,price:re}),S={...S,lineColor:y,lineWidth:J,fillColor:T,fillOpacity:oe,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...p.p1,price:K},p3:{...p.p3,price:ae},p2:{...p.p2,price:re}}}if(p.type==="flattopbottom"){const y=O(d.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),T=O(d.fillColor,"#3b82f6"),oe=Te(d.fillOpacity,.12),E=O(d.pricesColor,"#3b82f6"),K=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):p.p1.price,ae=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):p.p3.price,re=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):p.p2.price,f=p.primitive;f&&(f.lineColor=y,f.lineWidth=J,f.fillColor=T,f.fillOpacity=oe,f.showBackground=!!d.showBackground,f.showPrices=!!d.showPrices,f.pricesColor=E,f.rayLeft=!!d.rayLeft,f.rayRight=!!d.rayRight,f.arrowLeft=!!d.arrowLeft,f.arrowRight=!!d.arrowRight,f.p1={...p.p1,price:K},f.p3={...p.p3,price:ae},f.p2={...p.p2,price:re}),S={...S,lineColor:y,lineWidth:J,fillColor:T,fillOpacity:oe,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...p.p1,price:K},p3:{...p.p3,price:ae},p2:{...p.p2,price:re}}}Ce(y=>{const J=y.map(T=>T===p?S:T);return x.current=J,J}),le.current===p&&(le.current=S),L(y=>y===p?S:y),te(y=>y===p?S:y),q(S);try{c.current?.applyOptions({})}catch{}};Ae.useEffect(()=>{const d=o.current;if(!d)return;const p=d.getBoundingClientRect(),O=K=>{const ae=Math.abs(Number(K));return Number.isFinite(ae)?ae>=1e3?ae.toFixed(2):(ae>=1,ae.toFixed(5)):"0"},Te=rt==="light",S=V0(d,{width:p.width||d.clientWidth,height:p.height||d.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:Te?"#FFFFFF":"#0d1117",type:"solid"},textColor:Te?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ie,color:Ie?Te?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0},horzLines:{visible:Ie,color:Ie?Te?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0}},rightPriceScale:{borderColor:Te?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,textColor:Te?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:Te?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:be===1?1:0,vertLine:{width:1,color:Te?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Te?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:Te?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Te?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:be===1,horzLineVisible:be===1},handleScroll:{mouseWheel:!0,pressedMouseMove:be===null||be===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}}),y=S.addCandlestickSeries({upColor:Te?"#089981":"#26a69a",downColor:Te?"#f23645":"#ef5350",wickUpColor:Te?"#089981":"#26a69a",wickDownColor:Te?"#f23645":"#ef5350",borderUpColor:Te?"#089981":"#26a69a",borderDownColor:Te?"#f23645":"#ef5350",borderVisible:!0}),J=S.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)"});c.current=S,h.current=y,g.current=J,J.setData(Da(Ve,fe)),requestAnimationFrame(()=>{if(d&&S){const K=d.getBoundingClientRect();K.width>0&&K.height>0&&S.resize(K.width,K.height)}});const T=S.timeScale(),oe=()=>{if(he.current&&St.current.size>0){const K=T.getVisibleRange();K&&ve(K)}};T.subscribeVisibleTimeRangeChange(oe);const E=new ResizeObserver(K=>{for(const ae of K){const{width:re,height:f}=ae.contentRect;if(re>0&&f>0&&S){const B=T.getVisibleRange();S.resize(re,f),B&&setTimeout(()=>{try{T.setVisibleRange(B)}catch{}},0)}}});return E.observe(d),()=>{T.unsubscribeVisibleTimeRangeChange(oe),E.disconnect(),S.remove(),c.current=null,h.current=null,g.current=null,C.current=null,x.current=[],qA.current&&clearTimeout(qA.current)}},[]),Ae.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]),Ae.useEffect(()=>{const d=c.current;if(!d)return;const p=rt==="light";d.applyOptions({layout:{background:{color:p?"#FFFFFF":"#12161d"},textColor:p?"#020617":"#fff"},grid:{vertLines:{color:Ie?p?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ie?p?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:p?"#e5e7eb":"#1e293b"},timeScale:{borderColor:p?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:p?"#3b82f6":"#58a6ff",labelBackgroundColor:p?"#eff6ff":"#161b22",width:1},horzLine:{color:p?"#3b82f6":"#58a6ff",labelBackgroundColor:p?"#eff6ff":"#161b22",width:1}}})},[rt,Ie]),Ae.useEffect(()=>{if(!c.current)return;const p=!it&&!(be!==null&&be!==1&&be!==0),O=!it;c.current.applyOptions({crosshair:{mode:be===1?1:0,vertLine:{visible:be===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:be===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:p,horzTouchDrag:p,vertTouchDrag:p},handleScale:{axisPressedMouseMove:{time:p,price:p},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:p,price:p},mouseWheel:O,pinch:O}})},[be,it]);const xT=()=>{const d=h.current;x.current.forEach(p=>{if(p.primitive){try{d&&d.detachPrimitive(p.primitive)}catch{}if(p.series&&p.series!==d)try{p.series.detachPrimitive(p.primitive)}catch{}}if(p.priceLine&&d)try{d.removePriceLine(p.priceLine)}catch{}if(p.textPrimitive&&d)try{d.detachPrimitive(p.textPrimitive)}catch{}}),x.current=[],Ce([]),Ee(null)},Jd=(d,p=!1)=>{d&&x.current.forEach(O=>{if(O.primitive){try{d.detachPrimitive(O.primitive)}catch{}try{d.attachPrimitive(O.primitive)}catch{}}if(p&&O.type==="pricelevel"&&O.priceLine)try{const Te=O.showPrice!==!1,S=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:Te,title:Te&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=S}catch{}if(p&&O.type==="horizontalray"&&O.priceLine)try{const Te=O.showPrice!==!1,S=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:Te,title:Te&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=S}catch{}})};Ae.useEffect(()=>{(async()=>{if(!Se||!fe){dt([]),he.current=!1;return}try{if(It(!0),Bs(null),dt([]),he.current=!1,xe.current!==null&&xe.current!==Se&&xT(),xe.current=Se,h.current)try{h.current.setData([])}catch{}const p=Nd(fe),O=zv(fe,p),Te=Ge||xv?.VITE_BASE_URL||"http://localhost:5002",S=ke?.candles||"/api/chart/candles",y=me?.candles||{},J={symbol:y.symbol||"symbol",timeframe:y.timeframe||"timeframe",limit:y.limit||"limit",daysBack:y.daysBack||"daysBack"},T={};T[J.symbol]=Se,T[J.timeframe]=fe,T[J.limit]=O,y.daysBack!==!1&&(T[J.daysBack]=p);const oe=await ht.get(`${Te}${S}`,{params:T,timeout:1e4});let E=[];if(Array.isArray(oe.data)?E=oe.data:oe.data&&oe.data.data&&Array.isArray(oe.data.data)?E=oe.data.data:oe.data&&Array.isArray(oe.data)&&(E=oe.data),E&&E.length>0){const{candles:K,stats:ae}=Ra(E,Se,fe);K.length>0?(dt(K),St.current=new Map,K.forEach(re=>{St.current.set(re.time,re)})):(console.warn(`⚠️ No valid candles after processing for ${Se}`),dt([]))}else console.warn(`⚠️ No candle data returned for ${Se}`),dt([])}catch(p){console.error(`❌ Error fetching ${Se}:`,p.message);const O=p.code==="ECONNABORTED"||p.message&&p.message.includes("timeout");Bs(O?"Request timed out. No data available for this symbol.":p.message||"Failed to load candles."),dt([]),It(!1)}})()},[Se,fe,gi]),Ae.useEffect(()=>{vt.current=Bn.getSocket();const d=vt.current,p=()=>{if(Se&&fe&&d.connected){const T={symbol:Se,timeframe:fe};d.emit("subscribeCandles",T)}},O=()=>{setTimeout(()=>{Se&&fe&&p()},200)},Te=T=>{},S=T=>{};d.on("connect",O),d.on("disconnect",Te),d.on("connect_error",S),d.on("subscription:confirmed",T=>{T.type});const y=T=>{if(!T||!T.candle||!T.symbol||T.symbol.toUpperCase()!==Se?.toUpperCase())return;const{candle:oe}=T,E=Ga(oe,Se,fe);if(!E)return;const K=Date.now();if(K-jt.current<200)return;jt.current=K;const ae=c.current?.timeScale(),re=ae?.getVisibleRange(),f=h.current,B=c.current;if(!(!f||!B||!he.current||f?.seriesType?.()!==(Je==="line"?"Line":Je==="area"?"Area":Je==="bars"?"Bar":"Candlestick")))try{const u=St.current.get(E.time),D=!u,H=u?{time:E.time,open:u.open,high:Math.max(u.high,E.close),low:Math.min(u.low,E.close),close:E.close}:E;St.current.set(E.time,H),D&&g.current&&g.current.setData(Da(Array.from(St.current.values()),fe));try{Je==="line"||Je==="area"?f.update({time:H.time,value:H.close}):f.update(H),ae&&re&&ve(re)}catch(P){throw P}}catch{}};d.on("candleUpdate",y);const J=()=>{d.connected&&Se&&fe&&p()};if(d.connected)J();else{const T=()=>{setTimeout(J,200)};d.once("connect",T),setTimeout(()=>{d.connected&&J()},500)}return()=>{d.off("candleUpdate",y),d.off("connect",O),d.off("disconnect",Te),d.off("connect_error",S),d.off("subscription:confirmed"),Se&&fe&&d.connected&&d.emit("unsubscribeCandles",{symbol:Se,timeframe:fe})}},[Se,fe,Ge]),Ae.useEffect(()=>{const d=h.current,p=c.current;if(!d||!p){It(!1);return}if(!(Ve.length===0&&he.current)){if(Ve.length===0&&!he.current){if(wt)return;const O=p.timeScale();d.setData([]),O.fitContent(),qA.current&&clearTimeout(qA.current),qA.current=setTimeout(()=>requestAnimationFrame(()=>It(!1)),400);return}if(!he.current){const O=p.timeScale(),Te=Ue(Se,fe);we.current,we.current=Te;const S=[...Ve].sort((T,oe)=>T.time-oe.time);if(Je==="line"||Je==="area"){const T=S?.map(oe=>({time:oe.time,value:oe.close})).filter(oe=>oe.time!=null);T.length>0&&d.setData(T)}else S?.length>0&&d.setData(S);Jd(d);const y=tA(fe)||60;if(x.current.forEach(T=>{if(T.type==="horizontalray"&&T.primitive){const f=T.rawOriginTime??T.primitive.originTime,B=We(f,y);T.primitive.originTime=B,T.originTime=B;return}if(T.type==="verticalline"&&T.primitive){const f=T.rawTime??T.primitive.time,B=We(f,y);T.primitive.time=B,T.time=Y(B);return}if(T.type==="infoline"&&T.primitive&&T.p1&&T.p2){const f=T.rawP1Time??T.p1.rawTime,B=T.rawP2Time??T.p2.rawTime,Q=S.length>0?S[0].time:null,w=S.length>0?S[S.length-1].time:null,u=P=>{const I=We(P,y);return Q==null||w==null?I:Math.min(Math.max(I,Q),w)},D=u(f),H=u(B);T.p1.rawTime=D,T.p1.normalizedTime=Y(D),T.p2.rawTime=H,T.p2.normalizedTime=Y(H),T.primitive.p1={rawTime:D,price:T.p1.price},T.primitive.p2={rawTime:H,price:T.p2.price};return}if(T.type==="rulerline"&&T.primitive&&T.p1&&T.p2){const f=T.rawP1Time??T.p1.rawTime,B=T.rawP2Time??T.p2.rawTime,Q=S.length>0?S[0].time:null,w=S.length>0?S[S.length-1].time:null,u=_=>{const k=We(_,y);return Q==null||w==null?k:Math.min(Math.max(k,Q),w)},D=u(f),H=u(B);T.p1.rawTime=D,T.p2.rawTime=H,T.primitive.p1={rawTime:D,price:T.p1.price},T.primitive.p2={rawTime:H,price:T.p2.price};const P=Y(D),I=Y(H),m=Math.abs((I??0)-(P??0));T.primitive.info={priceDiff:T.p2.price-T.p1.price,pricePct:(T.p2.price-T.p1.price)/Math.abs(T.p1.price||1)*100,bars:ms(Dt,D,H,fe),days:Math.max(1,Math.round(m/86400))};return}if(T.type==="arrowedline"&&T.primitive&&T.p1&&T.p2){const f=T.p1.rawTime,B=T.p2.rawTime,Q=We(f,y),w=We(B,y);T.p1.rawTime=Q,T.p1.normalizedTime=Y(Q),T.p2.rawTime=w,T.p2.normalizedTime=Y(w),T.primitive.p1={rawTime:Q,price:T.p1.price},T.primitive.p2={rawTime:w,price:T.p2.price};return}if(T.type==="rayline"&&T.primitive&&T.p1&&T.p2){const f=T.p1.rawTime,B=T.p2.rawTime,Q=We(f,y),w=We(B,y);T.p1.rawTime=Q,T.p1.normalizedTime=Y(Q),T.p2.rawTime=w,T.p2.normalizedTime=Y(w),T.primitive.p1={rawTime:Q,price:T.p1.price},T.primitive.p2={rawTime:w,price:T.p2.price};return}if(T.type==="extendedline"&&T.primitive&&T.p1&&T.p2){const f=T.p1.rawTime,B=T.p2.rawTime,Q=We(f,y),w=We(B,y);T.p1.rawTime=Q,T.p1.normalizedTime=Y(Q),T.p2.rawTime=w,T.p2.normalizedTime=Y(w),T.primitive.p1={rawTime:Q,price:T.p1.price},T.primitive.p2={rawTime:w,price:T.p2.price};return}if(T.type==="trendbyangle"&&T.primitive&&T.p1&&T.p2){const f=T.p1.rawTime,B=T.p2.rawTime,Q=We(f,y),w=We(B,y);T.p1.rawTime=Q,T.p1.normalizedTime=Y(Q),T.p2.rawTime=w,T.p2.normalizedTime=Y(w),T.primitive.p1={rawTime:Q,price:T.p1.price},T.primitive.p2={rawTime:w,price:T.p2.price};return}if(T.type==="disjointchannel"&&T.primitive&&T.p1&&T.p2&&T.p3&&T.p4){const f=B=>{const Q=We(B.rawTime,y);B.rawTime=Q,B.normalizedTime=Y(Q)};f(T.p1),f(T.p2),f(T.p3),f(T.p4),T.primitive.p1={rawTime:T.p1.rawTime,price:T.p1.price},T.primitive.p2={rawTime:T.p2.rawTime,price:T.p2.price},T.primitive.p3={rawTime:T.p3.rawTime,price:T.p3.price},T.primitive.p4={rawTime:T.p4.rawTime,price:T.p4.price};return}if(T.type==="flattopbottom"&&T.primitive&&T.p1&&T.p2&&T.p3&&T.p4){const f=B=>{const Q=We(B.rawTime,y);B.rawTime=Q,B.normalizedTime=Y(Q)};f(T.p1),f(T.p2),f(T.p3),f(T.p4),T.primitive.p1={rawTime:T.p1.rawTime,price:T.p1.price},T.primitive.p2={rawTime:T.p2.rawTime,price:T.p2.price},T.primitive.p3={rawTime:T.p3.rawTime,price:T.p3.price},T.primitive.p4={rawTime:T.p4.rawTime,price:T.p4.price};return}if(T.type==="regressionchannel"&&T.primitive&&T.p1&&T.p2){const f=Ni(S,T.p1,T.p2,T.stdMultiplier??1);if(!f)return;const B=T.primitive;B.mid1={rawTime:f.p1.rawTime,price:f.p1.price},B.mid2={rawTime:f.p2.rawTime,price:f.p2.price},B.top1={rawTime:f.top1.rawTime,price:f.top1.price},B.top2={rawTime:f.top2.rawTime,price:f.top2.price},B.bot1={rawTime:f.bot1.rawTime,price:f.bot1.price},B.bot2={rawTime:f.bot2.rawTime,price:f.bot2.price},T.p1=f.p1,T.p2=f.p2,T.top1=f.top1,T.top2=f.top2,T.bot1=f.bot1,T.bot2=f.bot2,T.slope=f.slope,T.intercept=f.intercept,T.stdDev=f.stdDev,T.offset=f.offset,T.barCount=f.barCount;return}if(T.type==="stddevchannel"&&T.primitive&&T.p1&&T.p2){const f=Sr(S,T.p1,T.p2,T.stdMultiplier??1);if(!f)return;const B=T.primitive;B.mid1={rawTime:f.p1.rawTime,price:f.p1.price},B.mid2={rawTime:f.p2.rawTime,price:f.p2.price},B.top1={rawTime:f.top1.rawTime,price:f.top1.price},B.top2={rawTime:f.top2.rawTime,price:f.top2.price},B.bot1={rawTime:f.bot1.rawTime,price:f.bot1.price},B.bot2={rawTime:f.bot2.rawTime,price:f.bot2.price},T.p1=f.p1,T.p2=f.p2,T.top1=f.top1,T.top2=f.top2,T.bot1=f.bot1,T.bot2=f.bot2,T.slope=f.slope,T.stdDev=f.stdDev,T.offset=f.offset,T.barCount=f.barCount;return}if(T.type==="andrewspitchfork"&&T.primitive&&T.p1&&T.p2&&T.p3){const f=We(T.p1.rawTime,y),B=We(T.p2.rawTime,y),Q=We(T.p3.rawTime,y);T.p1.rawTime=f,T.p1.normalizedTime=Y(f),T.p2.rawTime=B,T.p2.normalizedTime=Y(B),T.p3.rawTime=Q,T.p3.normalizedTime=Y(Q),T.primitive.p1={rawTime:f,price:T.p1.price},T.primitive.p2={rawTime:B,price:T.p2.price},T.primitive.p3={rawTime:Q,price:T.p3.price};return}if((T.type==="gannfan"||T.type==="ganngrid")&&T.primitive&&T.p1&&T.p2){const f=We(T.p1.rawTime,y),B=We(T.p2.rawTime,y);T.p1.rawTime=f,T.p1.normalizedTime=Y(f),T.p2.rawTime=B,T.p2.normalizedTime=Y(B),T.primitive.p1={rawTime:f,price:T.p1.price},T.primitive.p2={rawTime:B,price:T.p2.price};return}if((T.type==="circle"||T.type==="ellipse")&&T.primitive&&T.p1&&T.p2){const f=We(T.p1.rawTime,y),B=We(T.p2.rawTime,y);T.p1.rawTime=f,T.p1.normalizedTime=Y(f),T.p2.rawTime=B,T.p2.normalizedTime=Y(B),T.primitive.p1={rawTime:f,price:T.p1.price},T.primitive.p2={rawTime:B,price:T.p2.price};return}if(T.type==="triangle"&&T.primitive&&T.p1&&T.p2&&T.p3){const f=We(T.p1.rawTime,y),B=We(T.p2.rawTime,y),Q=We(T.p3.rawTime,y);T.p1.rawTime=f,T.p1.normalizedTime=Y(f),T.p2.rawTime=B,T.p2.normalizedTime=Y(B),T.p3.rawTime=Q,T.p3.normalizedTime=Y(Q),T.primitive.p1={rawTime:f,price:T.p1.price},T.primitive.p2={rawTime:B,price:T.p2.price},T.primitive.p3={rawTime:Q,price:T.p3.price};return}if((T.type==="fibonacci"||T.type==="rectangle")&&T.primitive&&T.p1&&T.p2){const f=We(T.p1.rawTime,y),B=We(T.p2.rawTime,y);T.p1.rawTime=f,T.p1.normalizedTime=Y(f),T.p2.rawTime=B,T.p2.normalizedTime=Y(B),T.primitive.p1={rawTime:f,price:T.p1.price},T.primitive.p2={rawTime:B,price:T.p2.price};return}if(T.type!=="trendline"&&T.type!=="gannline"||!T.series||!T.point1||!T.point2)return;const oe=T.point1.rawTime??T.point1.time,E=T.point2.rawTime??T.point2.time,K=We(oe,y),ae=We(E,y);T.point1.time=K,T.point2.time=ae;const re=UA([{time:K,value:T.point1.price},{time:ae,value:T.point2.price}]);try{re.length>0&&T.series.setData(re)}catch{}}),S?.length>0){const T=S[S?.length-1].time,oe=tA(fe)||60,K=T-(fe==="M1"?150:fe==="M5"?120:100)*oe;try{O.setVisibleRange({from:K,to:T+oe*Kd})}catch{O.fitContent()}}else O.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}he.current=!0;const J=O.getVisibleRange();ve(J),qA.current&&clearTimeout(qA.current),qA.current=setTimeout(()=>requestAnimationFrame(()=>It(!1)),400)}}},[Ve.length,Je,Se,fe]),Ae.useEffect(()=>{const d=c.current;if(!d||!he.current||Ve.length===0)return;const p=d.timeScale(),O=p.getVisibleRange()||ye();if(h.current)try{d.removeSeries(h.current)}catch{}if(C.current)try{d.removeSeries(C.current),C.current=null}catch{}let Te;if(Je==="bars"){const y=rt==="light";Te=d.addBarSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",scaleMargins:{top:.1,bottom:.1}});const J=[...Ve].sort((T,oe)=>T.time-oe.time);J?.length>0&&Te.setData(J)}else if(Je==="line"){Te=d.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const y=UA(ka);y.length>0&&Te.setData(y)}else if(Je==="area"){Te=d.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const y=UA(ka);y.length>0&&Te.setData(y)}else if(Je==="volume ticks"||Je==="volume"){const y=rt==="light";Te=d.addCandlestickSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",wickUpColor:y?"#089981":"#26A69A",wickDownColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",borderVisible:!0,priceScaleId:"right"});const J=[...Ve].sort((E,K)=>E.time-K.time);J?.length>0&&Te.setData(J);const T=d.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),d.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const oe=J?.map(E=>({time:E.time,value:E.volume||0,color:E.close>=E.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));oe.length>0&&T.setData(oe),C.current=T}else{const y=rt==="light";Te=d.addCandlestickSeries({upColor:y?"#089981":"#26A69A",downColor:y?"#f23645":"#EF5350",wickUpColor:y?"#089981":"#26A69A",wickDownColor:y?"#f23645":"#EF5350",borderUpColor:y?"#089981":"#26A69A",borderDownColor:y?"#f23645":"#EF5350",borderVisible:!0,scaleMargins:{top:.1,bottom:.1}});const J=[...Ve].sort((T,oe)=>T.time-oe.time);J?.length>0&&Te.setData(J)}h.current=Te,Jd(Te,!0);const S=tA(fe)||60;if(x.current.forEach(y=>{if(y.type==="horizontalray"&&y.primitive){const f=y.rawOriginTime??y.primitive.originTime,B=We(f,S);y.primitive.originTime=B,y.originTime=B;return}if(y.type==="verticalline"&&y.primitive){const f=y.rawTime??y.primitive.time,B=We(f,S);y.primitive.time=B,y.time=Y(B);return}if(y.type==="infoline"&&y.primitive&&y.p1&&y.p2){const f=y.rawP1Time??y.p1.rawTime,B=y.rawP2Time??y.p2.rawTime,Q=[...Ve].sort((I,m)=>I.time-m.time),w=Q.length>0?Q[0].time:null,u=Q.length>0?Q[Q.length-1].time:null,D=I=>{const m=We(I,S);return w==null||u==null?m:Math.min(Math.max(m,w),u)},H=D(f),P=D(B);y.p1.rawTime=H,y.p1.normalizedTime=Y(H),y.p2.rawTime=P,y.p2.normalizedTime=Y(P),y.primitive.p1={rawTime:H,price:y.p1.price},y.primitive.p2={rawTime:P,price:y.p2.price};return}if(y.type==="rulerline"&&y.primitive&&y.p1&&y.p2){const f=y.rawP1Time??y.p1.rawTime,B=y.rawP2Time??y.p2.rawTime,Q=[...Ve].sort((k,W)=>k.time-W.time),w=Q.length>0?Q[0].time:null,u=Q.length>0?Q[Q.length-1].time:null,D=k=>{const W=We(k,S);return w==null||u==null?W:Math.min(Math.max(W,w),u)},H=D(f),P=D(B);y.p1.rawTime=H,y.p2.rawTime=P,y.primitive.p1={rawTime:H,price:y.p1.price},y.primitive.p2={rawTime:P,price:y.p2.price};const I=Y(H),m=Y(P),_=Math.abs((m??0)-(I??0));y.primitive.info={priceDiff:y.p2.price-y.p1.price,pricePct:(y.p2.price-y.p1.price)/Math.abs(y.p1.price||1)*100,bars:ms(Dt,H,P,fe),days:Math.max(1,Math.round(_/86400))};return}if(y.type==="arrowedline"&&y.primitive&&y.p1&&y.p2){const f=y.p1.rawTime,B=y.p2.rawTime,Q=We(f,S),w=We(B,S);y.p1.rawTime=Q,y.p1.normalizedTime=Y(Q),y.p2.rawTime=w,y.p2.normalizedTime=Y(w),y.primitive.p1={rawTime:Q,price:y.p1.price},y.primitive.p2={rawTime:w,price:y.p2.price};return}if(y.type==="rayline"&&y.primitive&&y.p1&&y.p2){const f=y.p1.rawTime,B=y.p2.rawTime,Q=We(f,S),w=We(B,S);y.p1.rawTime=Q,y.p1.normalizedTime=Y(Q),y.p2.rawTime=w,y.p2.normalizedTime=Y(w),y.primitive.p1={rawTime:Q,price:y.p1.price},y.primitive.p2={rawTime:w,price:y.p2.price};return}if(y.type==="extendedline"&&y.primitive&&y.p1&&y.p2){const f=y.p1.rawTime,B=y.p2.rawTime,Q=We(f,S),w=We(B,S);y.p1.rawTime=Q,y.p1.normalizedTime=Y(Q),y.p2.rawTime=w,y.p2.normalizedTime=Y(w),y.primitive.p1={rawTime:Q,price:y.p1.price},y.primitive.p2={rawTime:w,price:y.p2.price};return}if(y.type==="trendbyangle"&&y.primitive&&y.p1&&y.p2){const f=y.p1.rawTime,B=y.p2.rawTime,Q=We(f,S),w=We(B,S);y.p1.rawTime=Q,y.p1.normalizedTime=Y(Q),y.p2.rawTime=w,y.p2.normalizedTime=Y(w),y.primitive.p1={rawTime:Q,price:y.p1.price},y.primitive.p2={rawTime:w,price:y.p2.price};return}if(y.type==="disjointchannel"&&y.primitive&&y.p1&&y.p2&&y.p3&&y.p4){const f=B=>{const Q=We(B.rawTime,S);B.rawTime=Q,B.normalizedTime=Y(Q)};f(y.p1),f(y.p2),f(y.p3),f(y.p4),y.primitive.p1={rawTime:y.p1.rawTime,price:y.p1.price},y.primitive.p2={rawTime:y.p2.rawTime,price:y.p2.price},y.primitive.p3={rawTime:y.p3.rawTime,price:y.p3.price},y.primitive.p4={rawTime:y.p4.rawTime,price:y.p4.price};return}if(y.type==="flattopbottom"&&y.primitive&&y.p1&&y.p2&&y.p3&&y.p4){const f=B=>{const Q=We(B.rawTime,S);B.rawTime=Q,B.normalizedTime=Y(Q)};f(y.p1),f(y.p2),f(y.p3),f(y.p4),y.primitive.p1={rawTime:y.p1.rawTime,price:y.p1.price},y.primitive.p2={rawTime:y.p2.rawTime,price:y.p2.price},y.primitive.p3={rawTime:y.p3.rawTime,price:y.p3.price},y.primitive.p4={rawTime:y.p4.rawTime,price:y.p4.price};return}if(y.type==="regressionchannel"&&y.primitive&&y.p1&&y.p2){const f=[...Ve].sort((w,u)=>w.time-u.time),B=Ni(f,y.p1,y.p2,y.stdMultiplier??1);if(!B)return;const Q=y.primitive;Q.mid1={rawTime:B.p1.rawTime,price:B.p1.price},Q.mid2={rawTime:B.p2.rawTime,price:B.p2.price},Q.top1={rawTime:B.top1.rawTime,price:B.top1.price},Q.top2={rawTime:B.top2.rawTime,price:B.top2.price},Q.bot1={rawTime:B.bot1.rawTime,price:B.bot1.price},Q.bot2={rawTime:B.bot2.rawTime,price:B.bot2.price},y.p1=B.p1,y.p2=B.p2,y.top1=B.top1,y.top2=B.top2,y.bot1=B.bot1,y.bot2=B.bot2,y.slope=B.slope,y.intercept=B.intercept,y.stdDev=B.stdDev,y.offset=B.offset,y.barCount=B.barCount;return}if(y.type==="stddevchannel"&&y.primitive&&y.p1&&y.p2){const f=[...Ve].sort((w,u)=>w.time-u.time),B=Sr(f,y.p1,y.p2,y.stdMultiplier??1);if(!B)return;const Q=y.primitive;Q.mid1={rawTime:B.p1.rawTime,price:B.p1.price},Q.mid2={rawTime:B.p2.rawTime,price:B.p2.price},Q.top1={rawTime:B.top1.rawTime,price:B.top1.price},Q.top2={rawTime:B.top2.rawTime,price:B.top2.price},Q.bot1={rawTime:B.bot1.rawTime,price:B.bot1.price},Q.bot2={rawTime:B.bot2.rawTime,price:B.bot2.price},y.p1=B.p1,y.p2=B.p2,y.top1=B.top1,y.top2=B.top2,y.bot1=B.bot1,y.bot2=B.bot2,y.slope=B.slope,y.stdDev=B.stdDev,y.offset=B.offset,y.barCount=B.barCount;return}if(y.type==="andrewspitchfork"&&y.primitive&&y.p1&&y.p2&&y.p3){const f=We(y.p1.rawTime,S),B=We(y.p2.rawTime,S),Q=We(y.p3.rawTime,S);y.p1.rawTime=f,y.p1.normalizedTime=Y(f),y.p2.rawTime=B,y.p2.normalizedTime=Y(B),y.p3.rawTime=Q,y.p3.normalizedTime=Y(Q),y.primitive.p1={rawTime:f,price:y.p1.price},y.primitive.p2={rawTime:B,price:y.p2.price},y.primitive.p3={rawTime:Q,price:y.p3.price};return}if((y.type==="gannfan"||y.type==="ganngrid")&&y.primitive&&y.p1&&y.p2){const f=We(y.p1.rawTime,S),B=We(y.p2.rawTime,S);y.p1.rawTime=f,y.p1.normalizedTime=Y(f),y.p2.rawTime=B,y.p2.normalizedTime=Y(B),y.primitive.p1={rawTime:f,price:y.p1.price},y.primitive.p2={rawTime:B,price:y.p2.price};return}if((y.type==="circle"||y.type==="ellipse")&&y.primitive&&y.p1&&y.p2){const f=We(y.p1.rawTime,S),B=We(y.p2.rawTime,S);y.p1.rawTime=f,y.p1.normalizedTime=Y(f),y.p2.rawTime=B,y.p2.normalizedTime=Y(B),y.primitive.p1={rawTime:f,price:y.p1.price},y.primitive.p2={rawTime:B,price:y.p2.price};return}if(y.type==="triangle"&&y.primitive&&y.p1&&y.p2&&y.p3){const f=We(y.p1.rawTime,S),B=We(y.p2.rawTime,S),Q=We(y.p3.rawTime,S);y.p1.rawTime=f,y.p1.normalizedTime=Y(f),y.p2.rawTime=B,y.p2.normalizedTime=Y(B),y.p3.rawTime=Q,y.p3.normalizedTime=Y(Q),y.primitive.p1={rawTime:f,price:y.p1.price},y.primitive.p2={rawTime:B,price:y.p2.price},y.primitive.p3={rawTime:Q,price:y.p3.price};return}if((y.type==="fibonacci"||y.type==="rectangle")&&y.primitive&&y.p1&&y.p2){const f=We(y.p1.rawTime,S),B=We(y.p2.rawTime,S);y.p1.rawTime=f,y.p1.normalizedTime=Y(f),y.p2.rawTime=B,y.p2.normalizedTime=Y(B),y.primitive.p1={rawTime:f,price:y.p1.price},y.primitive.p2={rawTime:B,price:y.p2.price};return}if(y.type!=="trendline"&&y.type!=="gannline"||!y.series||!y.point1||!y.point2)return;const J=y.type==="gannline"?"#7aa6ae":"#22c55e";try{d.removeSeries(y.series)}catch{}const T=d.addLineSeries({color:y.lineColor??J,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),oe=y.point1.rawTime??y.point1.time,E=y.point2.rawTime??y.point2.time,K=We(oe,S),ae=We(E,S);y.point1.time=K,y.point2.time=ae;const re=UA([{time:K,value:y.point1.price},{time:ae,value:y.point2.price}]);try{re.length>0&&T.setData(re)}catch{}if(y.decoration)try{T.attachPrimitive(y.decoration)}catch{}y.series=T}),O&&he.current)setTimeout(()=>{try{p.setVisibleRange(O),ve(O)}catch{if(Ve.length>0)try{const J=Ve[Ve.length-1].time,T=tA(fe)||60,oe=J-100*T;p.setVisibleRange({from:oe,to:J+T*Kd}),ve(p.getVisibleRange())}catch{p.fitContent(),ve(p.getVisibleRange())}}try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!he.current){p.fitContent();try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}he.current=!0,ve(p.getVisibleRange())}},[Je,Ve.length,ka.length]),Ae.useEffect(()=>{const d=c.current,p=C.current;if(!d||!p||!he.current||Ve.length===0||Je!=="volume"&&Je!=="volume ticks")return;const Te=[...Ve].sort((S,y)=>S.time-y.time)?.map(S=>({time:S.time,value:S.volume||0,color:S.close>=S.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));Te.length>0&&p.setData(Te)},[Ve,Je]),Ae.useEffect(()=>{const d=c.current,p=h.current,O=o.current;if(!d||!p||!O)return;const S=be!==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"][be]:null,y=(E,K)=>{const ae=Math.min(E.time,K.time),re=Math.max(E.time,K.time),f=E.time<=K.time?E.rawTime:K.rawTime,B=E.time<=K.time?K.rawTime:E.rawTime,Q=Math.max(E.price,K.price),w=Math.min(E.price,K.price),u=Y(Math.round((ae+re)/2));return u==null?null:{p1:{rawTime:u,normalizedTime:u,price:Q},p2:{rawTime:f,normalizedTime:ae,price:w},p3:{rawTime:B,normalizedTime:re,price:w}}};if(!S){if(b.current=!1,v.current=null,U.current=null,M.current=null,F.current?.series)try{d.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{p.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(S==="pricelevel"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const u={type:"pricelevel",priceLine:p.createPriceLine({price:Q,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:Q.toFixed(5)}),price:Q,showPrice:!0,showText:!1};Ce(D=>[...D,u]),x.current.push(u),Ee(null)};return O.addEventListener("click",E),()=>{O.removeEventListener("click",E)}}if(S==="horizontalray"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=new bv(Q,B);p.attachPrimitive(w);const u=p.createPriceLine({price:Q,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof Q=="number"?Q.toFixed(5):""}),D=Y(B),H={type:"horizontalray",primitive:w,priceLine:u,price:Q,originTime:D,rawOriginTime:B,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};Ce(P=>[...P,H]),x.current.push(H),Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="verticalline"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=d.timeScale().coordinateToTime(re);if(f==null)return;const B=new Nv(f);p.attachPrimitive(B);const Q=Y(f),w={type:"verticalline",primitive:B,time:Q,rawTime:f,lineColor:"#3b82f6",lineWidth:2,showDate:!0};Ce(u=>[...u,w]),x.current.push(w),Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="text"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=new Kv(B,Q);p.attachPrimitive(w);const u={type:"text",primitive:w,rawTime:B,price:Q,text:"Text"};Ce(D=>[...D,u]),x.current.push(u),Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="infoline"){let E=null,K=null;const ae=f=>{if(!E)return;const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top,u=d.timeScale().coordinateToTime(Q),D=p.coordinateToPrice(w);if(u==null||D==null)return;K||(K=d.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const H=E.normalizedTime,P=Y(u);if(H==null||P==null||H===P)return;const I=H<=P?[{time:H,value:E.price},{time:P,value:D}]:[{time:P,value:D},{time:H,value:E.price}];try{K.setData(I)}catch{}},re=f=>{const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top,u=d.timeScale().coordinateToTime(Q),D=p.coordinateToPrice(w);if(u==null||D==null)return;if(!E){E={rawTime:u,price:D,normalizedTime:Y(u),x:Q,y:w};return}if(K){try{d.removeSeries(K)}catch{}K=null}const H=E.normalizedTime,P=Y(u);if(H==null||P==null)return;const I=D-E.price,m=I/Math.abs(E.price)*100,_=tA(fe)||3600,k=Math.abs(P-H),W=Math.max(1,Math.round(k/_)),G=Math.max(1,Math.round(k/86400)),Z=E.x,ie=E.y,ue=Q,Fe=Math.atan2(-(w-ie),ue-Z)*(180/Math.PI),He={priceDiff:I,pricePct:m,bars:W,days:G,angle:Fe},$e=new Qv({rawTime:E.rawTime,price:E.price},{rawTime:u,price:D},He);p.attachPrimitive($e);const qe={type:"infoline",primitive:$e,rawP1Time:E.rawTime,rawP2Time:u,p1:{rawTime:E.rawTime,normalizedTime:H,price:E.price},p2:{rawTime:u,normalizedTime:P,price:D},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};Ce(Re=>[...Re,qe]),x.current.push(qe),E=null,Ee(null)};return O.addEventListener("mousemove",ae),O.addEventListener("click",re),()=>{if(O.removeEventListener("mousemove",ae),O.removeEventListener("click",re),K)try{d.removeSeries(K)}catch{}}}if(S==="rulerline"){let E=null,K=null;const ae=(B,Q,w,u)=>{const D=Y(B),H=Y(w),P=u-Q,I=P/Math.abs(Q)*100,m=ms(Dt,B,w,fe),_=Math.abs((H??0)-(D??0)),k=Math.max(1,Math.round(_/86400));return{priceDiff:P,pricePct:I,bars:m,days:k}},re=B=>{if(!E)return;const Q=O.getBoundingClientRect(),w=B.clientX-Q.left,u=B.clientY-Q.top,D=d.timeScale().coordinateToTime(w),H=p.coordinateToPrice(u);if(D==null||H==null)return;const P=Y(D);if(P==null||P===E.normalizedTime)return;const I=ae(E.rawTime,E.price,D,H);if(!K)K=new Ld({rawTime:E.rawTime,price:E.price},{rawTime:D,price:H},I),p.attachPrimitive(K);else{K.p2={rawTime:D,price:H},K.info=I;const m=H>=E.price;K.color=m?"#3b82f6":"#ef5350",K.fillColor=m?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},f=B=>{const Q=O.getBoundingClientRect(),w=B.clientX-Q.left,u=B.clientY-Q.top,D=d.timeScale().coordinateToTime(w),H=p.coordinateToPrice(u);if(D==null||H==null)return;if(!E){E={rawTime:D,price:H,normalizedTime:Y(D)};return}if(K){try{p.detachPrimitive(K)}catch{}K=null}const P=E.normalizedTime,I=Y(D);if(P==null||I==null)return;const m=ae(E.rawTime,E.price,D,H),_=new Ld({rawTime:E.rawTime,price:E.price},{rawTime:D,price:H},m);p.attachPrimitive(_);const k={type:"rulerline",primitive:_,rawP1Time:E.rawTime,rawP2Time:D,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:D,normalizedTime:I,price:H},lineColor:H>=E.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};Ce(W=>[...W,k]),x.current.push(k),E=null,Ee(null)};return O.addEventListener("mousemove",re),O.addEventListener("click",f),()=>{if(O.removeEventListener("mousemove",re),O.removeEventListener("click",f),K)try{p.detachPrimitive(K)}catch{}}}if(S==="arrowedline"){let E=null,K=null;const ae=f=>{if(!E)return;const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top,u=d.timeScale().coordinateToTime(Q),D=p.coordinateToPrice(w);if(u==null||D==null)return;const H=Y(u);if(!(H==null||H===E.normalizedTime))if(!K)K=new Md({rawTime:E.rawTime,price:E.price},{rawTime:u,price:D}),p.attachPrimitive(K);else{K.p2={rawTime:u,price:D};try{c.current?.applyOptions({})}catch{}}},re=f=>{const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top,u=d.timeScale().coordinateToTime(Q),D=p.coordinateToPrice(w);if(u==null||D==null)return;if(!E){E={rawTime:u,price:D,normalizedTime:Y(u)};return}if(K){try{p.detachPrimitive(K)}catch{}K=null}const H=E.normalizedTime,P=Y(u);if(H==null||P==null||H===P)return;const I=new Md({rawTime:E.rawTime,price:E.price},{rawTime:u,price:D});p.attachPrimitive(I);const m={type:"arrowedline",primitive:I,p1:{rawTime:E.rawTime,normalizedTime:H,price:E.price},p2:{rawTime:u,normalizedTime:P,price:D},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Ce(_=>[..._,m]),x.current.push(m),E=null,Ee(null)};return O.addEventListener("mousemove",ae),O.addEventListener("click",re),()=>{if(O.removeEventListener("mousemove",ae),O.removeEventListener("click",re),K)try{p.detachPrimitive(K)}catch{}}}if(S==="rayline"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=re+140,u=d.timeScale().coordinateToTime(w);if(u==null)return;const D=Y(B),H=Y(u);if(D==null||H==null)return;const P=new Lv({rawTime:B,price:Q},{rawTime:u,price:Q});p.attachPrimitive(P);const I={type:"rayline",primitive:P,p1:{rawTime:B,normalizedTime:D,price:Q},p2:{rawTime:u,normalizedTime:H,price:Q},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Ce(m=>[...m,I]),x.current.push(I),Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="extendedline"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=re+140,u=d.timeScale().coordinateToTime(w);if(u==null)return;const D=Y(B),H=Y(u);if(D==null||H==null)return;const P=new Mv({rawTime:B,price:Q},{rawTime:u,price:Q});p.attachPrimitive(P);const I={type:"extendedline",primitive:P,p1:{rawTime:B,normalizedTime:D,price:Q},p2:{rawTime:u,normalizedTime:H,price:Q},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Ce(m=>[...m,I]),x.current.push(I),Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="crossline"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=Y(B);if(w==null)return;const u=new Iv({rawTime:B,price:Q});p.attachPrimitive(u);const D={type:"crossline",primitive:u,p:{rawTime:B,normalizedTime:w,price:Q},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};Ce(H=>[...H,D]),x.current.push(D),Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="trendbyangle"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=re+140,u=d.timeScale().coordinateToTime(w);if(u==null)return;const D=Y(B),H=Y(u);if(D==null||H==null)return;const P=new Dv({rawTime:B,price:Q},{rawTime:u,price:Q});p.attachPrimitive(P);const I={type:"trendbyangle",primitive:P,p1:{rawTime:B,normalizedTime:D,price:Q},p2:{rawTime:u,normalizedTime:H,price:Q},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};Ce(m=>[...m,I]),x.current.push(I),Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="disjointchannel"){let E=null,K=null,ae=null,re=null,f=0,B=null;const Q=(D,H,P,I)=>{if(!B)B=new Ha(D,H,P,I),p.attachPrimitive(B);else{B.p1=D,B.p2=H,B.p3=P,B.p4=I;try{c.current?.applyOptions({})}catch{}}},w=D=>{if(f===0||!E)return;const H=O.getBoundingClientRect(),P=D.clientX-H.left,I=D.clientY-H.top;if(f===1){const m=p.coordinateToPrice(I);if(m==null)return;K={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:m},Q({rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price},{rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price});return}if(f===2&&K){const m=d.timeScale().coordinateToTime(P),_=p.coordinateToPrice(I);if(m==null||_==null)return;const k=Y(m);if(k==null)return;const W=(E.price+K.price)/2;_>=W?(ae={rawTime:m,normalizedTime:k,price:_},re={rawTime:m,normalizedTime:k,price:2*W-_}):(re={rawTime:m,normalizedTime:k,price:_},ae={rawTime:m,normalizedTime:k,price:2*W-_}),Q({rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price},{rawTime:ae.rawTime,price:ae.price},{rawTime:re.rawTime,price:re.price})}},u=D=>{const H=O.getBoundingClientRect(),P=D.clientX-H.left,I=D.clientY-H.top,m=d.timeScale().coordinateToTime(P),_=p.coordinateToPrice(I);if(m==null||_==null)return;const k=Y(m);if(k!=null){if(f===0){E={rawTime:m,normalizedTime:k,price:_},K={rawTime:m,normalizedTime:k,price:_},f=1,Q({rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price},{rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price});return}if(f===1){const W=p.coordinateToPrice(I);if(W==null||Math.abs(W-E.price)<1e-7)return;K={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:W},f=2;return}if(f===2&&B){try{p.detachPrimitive(B)}catch{}const W=new Ha(B.p1,B.p2,B.p3,B.p4);p.attachPrimitive(W);const G={type:"disjointchannel",primitive:W,p1:E,p2:K,p3:{rawTime:B.p3.rawTime,normalizedTime:Y(B.p3.rawTime),price:B.p3.price},p4:{rawTime:B.p4.rawTime,normalizedTime:Y(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};Ce(Z=>[...Z,G]),x.current.push(G),Ee(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",u),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",u),B)try{p.detachPrimitive(B)}catch{}}}if(S==="flattopbottom"){let E=null,K=null,ae=null,re=null,f=0,B=null;const Q=(D,H,P,I)=>{if(!B)B=new Hd(D,H,P,I),p.attachPrimitive(B);else{B.p1=D,B.p2=H,B.p3=P,B.p4=I;try{c.current?.applyOptions({})}catch{}}},w=D=>{if(f===0||!E)return;const H=O.getBoundingClientRect(),P=D.clientX-H.left,I=D.clientY-H.top;if(f===1){const m=p.coordinateToPrice(I);if(m==null)return;K={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:m},Q({rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price},{rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price});return}if(f===2&&K){const m=d.timeScale().coordinateToTime(P),_=p.coordinateToPrice(I);if(m==null||_==null)return;const k=Y(m);if(k==null)return;ae={rawTime:m,normalizedTime:k,price:_},re={rawTime:m,normalizedTime:k,price:K.price},Q({rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price},{rawTime:ae.rawTime,price:ae.price},{rawTime:re.rawTime,price:re.price})}},u=D=>{const H=O.getBoundingClientRect(),P=D.clientX-H.left,I=D.clientY-H.top,m=d.timeScale().coordinateToTime(P),_=p.coordinateToPrice(I);if(m==null||_==null)return;const k=Y(m);if(k!=null){if(f===0){E={rawTime:m,normalizedTime:k,price:_},K={rawTime:m,normalizedTime:k,price:_},f=1,Q({rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price},{rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price});return}if(f===1){const W=p.coordinateToPrice(I);if(W==null||Math.abs(W-E.price)<1e-7)return;K={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:W},f=2;return}if(f===2&&B){try{p.detachPrimitive(B)}catch{}const W=new Hd(B.p1,B.p2,B.p3,B.p4);p.attachPrimitive(W);const G={type:"flattopbottom",primitive:W,p1:E,p2:K,p3:{rawTime:B.p3.rawTime,normalizedTime:Y(B.p3.rawTime),price:B.p3.price},p4:{rawTime:B.p4.rawTime,normalizedTime:Y(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};Ce(Z=>[...Z,G]),x.current.push(G),Ee(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",u),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",u),B)try{p.detachPrimitive(B)}catch{}}}if(S==="regressionchannel"){let E=null,K=null;const ae=(B,Q)=>{B.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},B.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},B.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},B.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},B.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},B.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price}},re=B=>{if(!E)return;const Q=O.getBoundingClientRect(),w=B.clientX-Q.left,u=B.clientY-Q.top,D=d.timeScale().coordinateToTime(w),H=p.coordinateToPrice(u);if(D==null||H==null)return;const P=Y(D);if(P==null)return;const m=Ni(Ve,E,{rawTime:D,normalizedTime:P},1);if(m)if(!K)K=new Ia({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),p.attachPrimitive(K);else{ae(K,m);try{d.applyOptions({})}catch{}}},f=B=>{const Q=O.getBoundingClientRect(),w=B.clientX-Q.left,u=B.clientY-Q.top,D=d.timeScale().coordinateToTime(w),H=p.coordinateToPrice(u);if(D==null||H==null)return;const P=Y(D);if(P==null)return;if(!E){E={rawTime:D,normalizedTime:P,price:H};return}const m=Ni(Ve,E,{rawTime:D,normalizedTime:P},1);if(!m)return;if(K){try{p.detachPrimitive(K)}catch{}K=null}const _=new Ia({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});p.attachPrimitive(_);const k={type:"regressionchannel",primitive:_,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,intercept:m.intercept,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Ce(W=>[...W,k]),x.current.push(k),E=null,Ee(null)};return O.addEventListener("mousemove",re),O.addEventListener("click",f),()=>{if(O.removeEventListener("mousemove",re),O.removeEventListener("click",f),K)try{p.detachPrimitive(K)}catch{}}}if(S==="stddevchannel"){let E=null,K=null;const ae=(B,Q)=>{B.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},B.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},B.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},B.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},B.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},B.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price}},re=B=>{if(!E)return;const Q=O.getBoundingClientRect(),w=B.clientX-Q.left,u=B.clientY-Q.top,D=d.timeScale().coordinateToTime(w),H=p.coordinateToPrice(u);if(D==null||H==null)return;const P=Y(D);if(P==null)return;const m=Sr(Ve,E,{rawTime:D,normalizedTime:P},1);if(m)if(!K)K=new Dd({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),p.attachPrimitive(K);else{ae(K,m);try{d.applyOptions({})}catch{}}},f=B=>{const Q=O.getBoundingClientRect(),w=B.clientX-Q.left,u=B.clientY-Q.top,D=d.timeScale().coordinateToTime(w),H=p.coordinateToPrice(u);if(D==null||H==null)return;const P=Y(D);if(P==null)return;if(!E){E={rawTime:D,normalizedTime:P,price:H};return}const m=Sr(Ve,E,{rawTime:D,normalizedTime:P},1);if(!m)return;if(K){try{p.detachPrimitive(K)}catch{}K=null}const _=new Dd({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});p.attachPrimitive(_);const k={type:"stddevchannel",primitive:_,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Ce(W=>[...W,k]),x.current.push(k),E=null,Ee(null)};return O.addEventListener("mousemove",re),O.addEventListener("click",f),()=>{if(O.removeEventListener("mousemove",re),O.removeEventListener("click",f),K)try{p.detachPrimitive(K)}catch{}}}if(S==="andrewspitchfork"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=Y(B);if(w==null)return;const u=re+140,D=d.timeScale().coordinateToTime(u);if(D==null)return;const H=Y(D);if(H==null)return;const P={rawTime:B,normalizedTime:w,price:Q},I={rawTime:D,normalizedTime:H,price:Q},m={rawTime:B,normalizedTime:w,price:Q},_=new _v({rawTime:P.rawTime,price:P.price},{rawTime:I.rawTime,price:I.price},{rawTime:m.rawTime,price:m.price});p.attachPrimitive(_);const k={type:"andrewspitchfork",primitive:_,p1:P,p2:I,p3:m};Ce(W=>[...W,k]),x.current.push(k),L(k),le.current=k,Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="gannfan"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=Y(B);if(w==null)return;const u={rawTime:B,normalizedTime:w,price:Q},D={rawTime:B,normalizedTime:w,price:Q},H=new Pv({rawTime:u.rawTime,price:u.price},{rawTime:D.rawTime,price:D.price});p.attachPrimitive(H);const P={type:"gannfan",primitive:H,p1:u,p2:D};Ce(I=>[...I,P]),x.current.push(P),L(P),le.current=P,Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="ganngrid"){const E=K=>{const ae=O.getBoundingClientRect(),re=K.clientX-ae.left,f=K.clientY-ae.top,B=d.timeScale().coordinateToTime(re),Q=p.coordinateToPrice(f);if(B==null||Q==null)return;const w=Y(B);if(w==null)return;const u={rawTime:B,normalizedTime:w,price:Q},D={rawTime:B,normalizedTime:w,price:Q},H=new kv({rawTime:u.rawTime,price:u.price},{rawTime:D.rawTime,price:D.price});p.attachPrimitive(H);const P={type:"ganngrid",primitive:H,p1:u,p2:D};Ce(I=>[...I,P]),x.current.push(P),L(P),le.current=P,Ee(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(S==="trendline"||S==="gannline"){const E=S,K=E==="gannline"?"#7aa6ae":"#22c55e",ae=Q=>{Q.preventDefault(),Q.stopPropagation(),Q.stopImmediatePropagation();const w=O.getBoundingClientRect(),u=Q.clientX-w.left,D=Q.clientY-w.top;let H=d.timeScale().coordinateToTime(u);const P=p.coordinateToPrice(D);if(!(H==null||P==null)&&(H=Y(H),H!=null))if(M.current===null){M.current={time:H,price:P};const I=d.addLineSeries({color:K,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:E,series:I},I.setData([{time:H,value:P}])}else{const I=M.current,m={time:H,price:P},_=1,k=1e-5,W=Math.abs(m.time-I.time),G=Math.abs(m.price-I.price);if(W<_&&G<k){try{d.removeSeries(F.current.series)}catch{}M.current=null,F.current=null;return}const Z={time:I.time,rawTime:I.time,price:I.price},ie={time:m.time,rawTime:m.time,price:m.price},ue=UA([{time:Z.time,value:Z.price},{time:ie.time,value:ie.price}]);if(ue.length>0){F.current.series.setData(ue);const Be=new Hv(Z,ie,K,2);try{F.current.series.attachPrimitive(Be)}catch{}const Fe={type:E,series:F.current.series,point1:Z,point2:ie,decoration:Be};Ce(He=>[...He,Fe]),x.current.push(Fe)}Ee(null),M.current=null,F.current=null}},re=Q=>{if(M.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;Q.preventDefault(),Q.stopPropagation();const w=O.getBoundingClientRect(),u=Q.clientX-w.left,D=Q.clientY-w.top;let H=d.timeScale().coordinateToTime(u);const P=p.coordinateToPrice(D);if(H==null||P==null||(H=Y(H),H==null))return;const I=M.current,m=UA([{time:I.time,value:I.price},{time:H,value:P}]);m.length>0&&F.current.series.setData(m)},f=Q=>{Q.stopPropagation()},B={capture:!0,passive:!1};return O.addEventListener("click",ae,B),O.addEventListener("mousemove",re,B),O.addEventListener("mousemove",f,B),()=>{if(M.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{d.removeSeries(F.current.series)}catch{}F.current=null}O.removeEventListener("click",ae,B),O.removeEventListener("mousemove",re,B),O.removeEventListener("mousemove",f,B)}}if(S==="parallellines"){let E=null,K=null,ae=null,re=0,f=null;const B=(P,I,m,_)=>{P.p1={rawTime:I.rawTime,price:I.price},P.p2={rawTime:m.rawTime,price:m.price},P.b1={rawTime:_.b1.rawTime,price:_.b1.price},P.b2={rawTime:_.b2.rawTime,price:_.b2.price},P.p3={rawTime:_.bottomMid.rawTime,price:_.bottomMid.price}},Q=(P,I,m)=>{const _=Od(P,I,m);if(!_)return null;if(!f)f=new Id({rawTime:P.rawTime,price:P.price},{rawTime:I.rawTime,price:I.price},{rawTime:_.b1.rawTime,price:_.b1.price},{rawTime:_.b2.rawTime,price:_.b2.price},{rawTime:_.bottomMid.rawTime,price:_.bottomMid.price}),p.attachPrimitive(f);else{B(f,P,I,_);try{d.applyOptions({})}catch{}}return _},w=P=>{P.preventDefault(),P.stopPropagation(),P.stopImmediatePropagation();const I=O.getBoundingClientRect(),m=P.clientX-I.left,_=P.clientY-I.top,k=d.timeScale().coordinateToTime(m),W=p.coordinateToPrice(_);if(k==null||W==null)return;const G=Y(k);if(G!=null){if(re===0){E={rawTime:k,normalizedTime:G,price:W},re=1;return}if(re===1){if(K={rawTime:k,normalizedTime:G,price:W},Math.abs(K.normalizedTime-E.normalizedTime)<1)return;const Z=Y((E.normalizedTime+K.normalizedTime)/2);if(Z==null)return;const ie=(E.price+K.price)/2;ae={rawTime:Z,normalizedTime:Z,price:ie},Q(E,K,ae),re=2;return}if(re===2&&E&&K){ae={rawTime:k,normalizedTime:G,price:W};const Z=Q(E,K,ae);if(!Z||!f)return;try{p.detachPrimitive(f)}catch{}const ie=new Id({rawTime:E.rawTime,price:E.price},{rawTime:K.rawTime,price:K.price},{rawTime:Z.b1.rawTime,price:Z.b1.price},{rawTime:Z.b2.rawTime,price:Z.b2.price},{rawTime:Z.bottomMid.rawTime,price:Z.bottomMid.price});p.attachPrimitive(ie);const ue={type:"equidistantchannel",primitive:ie,p1:E,p2:K,p3:Z.bottomMid,b1:Z.b1,b2:Z.b2,bottomMid:Z.bottomMid};Ce(Be=>[...Be,ue]),x.current.push(ue),Ee(null),re=0,E=null,K=null,ae=null,f=null}}},u=P=>{if(re===0||!E)return;const I=O.getBoundingClientRect(),m=P.clientX-I.left,_=P.clientY-I.top,k=d.timeScale().coordinateToTime(m),W=p.coordinateToPrice(_);if(k==null||W==null)return;const G=Y(k);if(G!=null){if(re===1){const Z={rawTime:k,normalizedTime:G,price:W},ie=Y((E.normalizedTime+Z.normalizedTime)/2);if(ie==null)return;const ue=(E.price+Z.price)/2;Q(E,Z,{rawTime:ie,normalizedTime:ie,price:ue});return}re===2&&K&&Q(E,K,{rawTime:k,normalizedTime:G,price:W})}},D=P=>{P.stopPropagation()},H={capture:!0,passive:!1};return O.addEventListener("click",w,H),O.addEventListener("mousemove",u,H),O.addEventListener("mousemove",D,H),()=>{if(re=0,E=null,K=null,ae=null,N.current=[],f)try{p.detachPrimitive(f)}catch{}f=null,O.removeEventListener("click",w,H),O.removeEventListener("mousemove",u,H),O.removeEventListener("mousemove",D,H)}}if(S==="fibonacci"){let E=null,K=null;const ae=f=>{if(!E)return;const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top,u=d.timeScale().coordinateToTime(Q),D=p.coordinateToPrice(w);if(!(u==null||D==null))if(!K)K=new _d({rawTime:E.rawTime,price:E.price},{rawTime:u,price:D}),p.attachPrimitive(K);else{K.p2={rawTime:u,price:D};try{d.applyOptions({})}catch{}}},re=f=>{const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top,u=d.timeScale().coordinateToTime(Q),D=p.coordinateToPrice(w);if(u==null||D==null)return;if(!E){E={rawTime:u,price:D,normalizedTime:Y(u)};return}if(K){try{p.detachPrimitive(K)}catch{}K=null}const H=E.normalizedTime,P=Y(u);if(H==null||P==null)return;if(Math.abs(D-E.price)<1e-5){E=null;return}const I=new _d({rawTime:E.rawTime,price:E.price},{rawTime:u,price:D});p.attachPrimitive(I);const m={type:"fibonacci",primitive:I,p1:{rawTime:E.rawTime,normalizedTime:H,price:E.price},p2:{rawTime:u,normalizedTime:P,price:D}};Ce(_=>[..._,m]),x.current.push(m),E=null,Ee(null)};return O.addEventListener("mousemove",ae),O.addEventListener("click",re),()=>{if(O.removeEventListener("mousemove",ae),O.removeEventListener("click",re),K)try{p.detachPrimitive(K)}catch{}}}if(M.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{d.removeSeries(F.current.series)}catch{}F.current=null}const J=E=>{if(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),S==="trendline"||S==="gannline"||S==="parallellines"||S==="fibonacci"||S!=="rectangle"&&S!=="circle"&&S!=="triangle"&&S!=="ellipse")return;const K=O.getBoundingClientRect(),ae=E.clientX-K.left,re=E.clientY-K.top;let f=d.timeScale().coordinateToTime(ae);const B=p.coordinateToPrice(re);if(f==null||B==null)return;const Q=f;if(f=Y(f),f!=null){if(b.current=!0,v.current={time:f,normalizedTime:f,rawTime:Q,price:B},U.current=null,S==="rectangle"){const w=new Fv({rawTime:Q,price:B},{rawTime:Q,price:B},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});p.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(S==="circle"){const w=new Uv({rawTime:Q,price:B},{rawTime:Q,price:B},{strokeColor:"#7aa6ae",lineWidth:1});p.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(S==="triangle"){const w=new Sv({rawTime:Q,price:B},{rawTime:Q,price:B},{rawTime:Q,price:B},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});p.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(S==="ellipse"){const w=new Ev({rawTime:Q,price:B},{rawTime:Q,price:B},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});p.attachPrimitive(w),F.current={type:"ellipse",primitive:w}}if(S==="parallellines"){const w=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},T=E=>{if(!b.current||!v.current||!F.current)return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const K=O.getBoundingClientRect(),ae=E.clientX-K.left,re=E.clientY-K.top;let f=d.timeScale().coordinateToTime(ae);const B=p.coordinateToPrice(re);if(f==null||B==null)return;const Q=f;if(f=Y(f),f==null)return;U.current={time:f,normalizedTime:f,rawTime:Q,price:B};const w=v.current;if(F.current.type==="rectangle"){const u=F.current.primitive;u.p1={rawTime:w.rawTime,price:w.price},u.p2={rawTime:Q,price:B};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const u=F.current.primitive;u.p1={rawTime:w.rawTime,price:w.price},u.p2={rawTime:Q,price:B};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const u=F.current.primitive,D=y(w,{time:f,rawTime:Q,price:B});if(!D)return;u.p1={rawTime:D.p1.rawTime,price:D.p1.price},u.p2={rawTime:D.p2.rawTime,price:D.p2.price},u.p3={rawTime:D.p3.rawTime,price:D.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const u=F.current.primitive;u.p1={rawTime:w.rawTime,price:w.price},u.p2={rawTime:Q,price:B};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const u=F.current.firstLine;u.endTime-u.startTime;const D=u.endPrice-u.startPrice,H=B,P=H+D;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:H},{time:f,value:P}]);else{const I=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});I.setData([{time:w.time,value:H},{time:f,value:P}]),F.current.secondLine=I}}else F.current.series.setData([{time:w.time,value:w.price},{time:f,value:B}])},oe=E=>{if(E&&(E.preventDefault(),E.stopPropagation()),!b.current||!F.current||!v.current)return;const K=v.current,ae=U.current||K;if(F.current.type==="parallellines")if(F.current.firstLine){const re={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};Ce(f=>[...f,re]),x.current.push(re),Ee(null),F.current=null,b.current=!1,v.current=null,U.current=null;return}else{F.current.firstLine={startTime:K.time,startPrice:K.price,endTime:ae.time,endPrice:ae.price},b.current=!1,v.current=null,U.current=null;return}if(F.current.type==="rectangle"){const re=v.current,f=U.current||re,B=Math.max(re.price,f.price),Q=Math.min(re.price,f.price),w=Y(Math.min(re.time,f.time)),u=Y(Math.max(re.time,f.time));if(w!=null&&u!=null&&Math.abs(u-w)>=1&&Math.abs(B-Q)>=1e-5){const D=F.current.primitive,H=re.time<=f.time?re.rawTime:f.rawTime,P=re.time<=f.time?f.rawTime:re.rawTime,I={rawTime:H,normalizedTime:w,price:B},m={rawTime:P,normalizedTime:u,price:Q};D.p1={rawTime:I.rawTime,price:I.price},D.p2={rawTime:m.rawTime,price:m.price};const _={type:"rectangle",primitive:D,p1:I,p2:m};Ce(k=>[...k,_]),x.current.push(_),Ee(null)}else try{p.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const re=F.current.primitive,f={rawTime:K.rawTime,normalizedTime:K.time,price:K.price},B={rawTime:ae.rawTime,normalizedTime:ae.time,price:ae.price},Q=d.timeScale().timeToCoordinate(f.rawTime),w=p.priceToCoordinate(f.price),u=d.timeScale().timeToCoordinate(B.rawTime),D=p.priceToCoordinate(B.price);if((Q!=null&&w!=null&&u!=null&&D!=null?Math.hypot(u-Q,D-w):0)>=3){re.p1={rawTime:f.rawTime,price:f.price},re.p2={rawTime:B.rawTime,price:B.price};const P={type:"circle",primitive:re,p1:f,p2:B};Ce(I=>[...I,P]),x.current.push(P),Ee(null)}else try{p.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const re=F.current.primitive,f=y(K,ae);if(f){const B=Math.abs(f.p3.normalizedTime-f.p2.normalizedTime),Q=Math.abs(f.p1.price-f.p2.price);if(B>=1&&Q>=1e-5){re.p1={rawTime:f.p1.rawTime,price:f.p1.price},re.p2={rawTime:f.p2.rawTime,price:f.p2.price},re.p3={rawTime:f.p3.rawTime,price:f.p3.price};const w={type:"triangle",primitive:re,p1:f.p1,p2:f.p2,p3:f.p3};Ce(u=>[...u,w]),x.current.push(w),Ee(null)}else try{p.detachPrimitive(F.current.primitive)}catch{}}else try{p.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const re=F.current.primitive,f={rawTime:K.rawTime,normalizedTime:K.time,price:K.price},B={rawTime:ae.rawTime,normalizedTime:ae.time,price:ae.price},Q=d.timeScale().timeToCoordinate(f.rawTime),w=p.priceToCoordinate(f.price),u=d.timeScale().timeToCoordinate(B.rawTime),D=p.priceToCoordinate(B.price);if((Q!=null&&w!=null&&u!=null&&D!=null?Math.hypot(u-Q,D-w):0)>=4){re.p1={rawTime:f.rawTime,price:f.price},re.p2={rawTime:B.rawTime,price:B.price},re.previewAsLine=!1,re.minorRatio=.45;const P={type:"ellipse",primitive:re,p1:f,p2:B,minorRatio:.45};Ce(I=>[...I,P]),x.current.push(P),Ee(null)}else try{p.detachPrimitive(F.current.primitive)}catch{}}b.current=!1,v.current=null,U.current=null,F.current=null};if(S==="rectangle"||S==="circle"||S==="triangle"||S==="ellipse"){const E={capture:!0,passive:!1},K=ae=>{b.current||ae.stopPropagation()};return O.addEventListener("mousedown",J,E),O.addEventListener("mousemove",T,E),O.addEventListener("mousemove",K,E),O.addEventListener("mouseup",oe,E),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{p.detachPrimitive(F.current.primitive)}catch{}F.current=null,b.current=!1,v.current=null,U.current=null,O.removeEventListener("mousedown",J,E),O.removeEventListener("mousemove",T,E),O.removeEventListener("mousemove",K,E),O.removeEventListener("mouseup",oe,E)}}},[be,Ve,Ce,Ee]),Ae.useEffect(()=>{const d=c.current,p=h.current,O=o.current,Te=be===null||be===1;if(!Te||!d||!p||!O){Te||(L(null),V([]),te(null),X([]));return}const S=10,y=8;function J(f){if(!f)return[];if(f.type==="trendline"&&f.point1&&f.point2){const B=d.timeScale().timeToCoordinate(f.point1.time),Q=p.priceToCoordinate(f.point1.price),w=d.timeScale().timeToCoordinate(f.point2.time),u=p.priceToCoordinate(f.point2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="gannline"&&f.point1&&f.point2){const B=d.timeScale().timeToCoordinate(f.point1.time),Q=p.priceToCoordinate(f.point1.price),w=d.timeScale().timeToCoordinate(f.point2.time),u=p.priceToCoordinate(f.point2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:(B+w)/2,y:(Q+u)/2},{x:w,y:u}]}if(f.type==="rectangle"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);if(B==null||Q==null||w==null||u==null)return[];const D=Math.min(B,w),H=Math.max(B,w),P=Math.min(Q,u),I=Math.max(Q,u),m=(D+H)/2,_=(P+I)/2;return[{x:D,y:P},{x:m,y:P},{x:H,y:P},{x:D,y:_},{x:H,y:_},{x:D,y:I},{x:m,y:I},{x:H,y:I}]}if(f.type==="circle"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="triangle"&&f.p1&&f.p2&&f.p3){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price),D=d.timeScale().timeToCoordinate(f.p3.rawTime),H=p.priceToCoordinate(f.p3.price);return B==null||Q==null||w==null||u==null||D==null||H==null?[]:[{x:B,y:Q},{x:w,y:u},{x:D,y:H}]}if(f.type==="ellipse"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);if(B==null||Q==null||w==null||u==null)return[];const D=(B+w)/2,H=(Q+u)/2,P=w-B,I=u-Q,m=Math.hypot(P,I);if(m<.001)return[];const _=P/m,k=I/m,W=-k,G=_,Z=m/2,ie=Z*Math.max(.05,f.minorRatio??.45);return[{x:D-_*Z,y:H-k*Z},{x:D+W*ie,y:H+G*ie},{x:D+_*Z,y:H+k*Z},{x:D-W*ie,y:H-G*ie}]}if(f.type==="gannfan"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="ganngrid"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="arrowedline"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="rayline"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="extendedline"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="crossline"&&f.p){const B=d.timeScale().timeToCoordinate(f.p.rawTime),Q=p.priceToCoordinate(f.p.price);return B==null||Q==null?[]:[{x:B,y:Q}]}if(f.type==="pricelevel"&&f.price!=null){const B=p.priceToCoordinate(f.price);return B==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:B}]}if(f.type==="text"&&f.rawTime!=null&&f.price!=null){const B=d.timeScale().timeToCoordinate(f.rawTime),Q=p.priceToCoordinate(f.price);return B==null||Q==null?[]:[{x:B,y:Q}]}if(f.type==="trendbyangle"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="andrewspitchfork"&&f.p1&&f.p2&&f.p3){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price),D=d.timeScale().timeToCoordinate(f.p3.rawTime),H=p.priceToCoordinate(f.p3.price);return B==null||Q==null||w==null||u==null||D==null||H==null?[]:[{x:B,y:Q},{x:w,y:u},{x:D,y:H}]}if(f.type==="equidistantchannel"&&f.p1&&f.p2&&f.b1&&f.b2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price),D=d.timeScale().timeToCoordinate(f.b1.rawTime),H=p.priceToCoordinate(f.b1.price),P=d.timeScale().timeToCoordinate(f.b2.rawTime),I=p.priceToCoordinate(f.b2.price);return B==null||Q==null||w==null||u==null||D==null||H==null||P==null||I==null?[]:[{x:B,y:Q},{x:w,y:u},{x:(D+P)/2,y:(H+I)/2}]}if(f.type==="regressionchannel"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="stddevchannel"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="disjointchannel"&&f.p1&&f.p2&&f.p3&&f.p4){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price),D=d.timeScale().timeToCoordinate(f.p3.rawTime),H=p.priceToCoordinate(f.p3.price),P=d.timeScale().timeToCoordinate(f.p4.rawTime),I=p.priceToCoordinate(f.p4.price);return B==null||Q==null||w==null||u==null||D==null||H==null||P==null||I==null?[]:[{x:B,y:Q},{x:w,y:u},{x:D,y:H},{x:P,y:I}]}if(f.type==="flattopbottom"&&f.p1&&f.p2&&f.p3&&f.p4){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price),D=d.timeScale().timeToCoordinate(f.p3.rawTime),H=p.priceToCoordinate(f.p3.price),P=d.timeScale().timeToCoordinate(f.p4.rawTime),I=p.priceToCoordinate(f.p4.price);return B==null||Q==null||w==null||u==null||D==null||H==null||P==null||I==null?[]:[{x:B,y:Q},{x:w,y:u},{x:D,y:H},{x:P,y:I}]}if(f.type==="infoline"&&f.p1&&f.p2){const B=f.p1.rawTime??f.p1.time,Q=f.p2.rawTime??f.p2.time,w=d.timeScale().timeToCoordinate(B),u=p.priceToCoordinate(f.p1.price),D=d.timeScale().timeToCoordinate(Q),H=p.priceToCoordinate(f.p2.price);return w==null||u==null||D==null||H==null?[]:[{x:w,y:u},{x:D,y:H}]}if(f.type==="rulerline"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:(B+w)/2,y:(Q+u)/2},{x:w,y:u}]}if(f.type==="fibonacci"&&f.p1&&f.p2){const B=d.timeScale().timeToCoordinate(f.p1.rawTime),Q=p.priceToCoordinate(f.p1.price),w=d.timeScale().timeToCoordinate(f.p2.rawTime),u=p.priceToCoordinate(f.p2.price);return B==null||Q==null||w==null||u==null?[]:[{x:B,y:Q},{x:w,y:u}]}if(f.type==="horizontalray"&&f.primitive){const B=f.primitive,Q=d.timeScale().timeToCoordinate(B.originTime),w=p.priceToCoordinate(B.price);return Q==null||w==null?[]:[{x:Q,y:w}]}if(f.type==="verticalline"&&f.primitive){const B=f.primitive,Q=d.timeScale().timeToCoordinate(B.time);if(Q==null)return[];const w=B.midYCss??200;return[{x:Q,y:w}]}return[]}function T(f,B){for(let Q=ze.length-1;Q>=0;Q--){const w=ze[Q];if(w.type==="trendline"&&w.point1&&w.point2){const u=d.timeScale().timeToCoordinate(w.point1.time),D=p.priceToCoordinate(w.point1.price),H=d.timeScale().timeToCoordinate(w.point2.time),P=p.priceToCoordinate(w.point2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-u,B-D),m=Math.hypot(f-H,B-P);if(I<S)return{object:w,mode:"handle1"};if(m<S)return{object:w,mode:"handle2"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const u=d.timeScale().timeToCoordinate(w.point1.time),D=p.priceToCoordinate(w.point1.price),H=d.timeScale().timeToCoordinate(w.point2.time),P=p.priceToCoordinate(w.point2.price);if(u==null||D==null||H==null||P==null)continue;const I=(u+H)/2,m=(D+P)/2,_=Math.hypot(f-u,B-D),k=Math.hypot(f-H,B-P),W=Math.hypot(f-I,B-m);if(_<S)return{object:w,mode:"handle1"};if(k<S)return{object:w,mode:"handle2"};if(W<S)return{object:w,mode:"line"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.min(u,H),m=Math.max(u,H),_=Math.min(D,P),k=Math.max(D,P),W=(I+m)/2,G=(_+k)/2,Z=[{x:I,y:_,mode:"handle1"},{x:W,y:_,mode:"handle2"},{x:m,y:_,mode:"handle3"},{x:I,y:G,mode:"handle4"},{x:m,y:G,mode:"handle5"},{x:I,y:k,mode:"handle6"},{x:W,y:k,mode:"handle7"},{x:m,y:k,mode:"handle8"}];for(const He of Z)if(Math.hypot(f-He.x,B-He.y)<S)return{object:w,mode:He.mode};const ie=nt(f,B,I,_,m,_),ue=nt(f,B,I,k,m,k),Be=nt(f,B,I,_,I,k),Fe=nt(f,B,m,_,m,k);if(ie<y||ue<y||Be<y||Fe<y||YA(f,B,[{x:I,y:_},{x:m,y:_},{x:m,y:k},{x:I,y:k}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(H-u,P-D);if(I<2)continue;const m=Math.hypot(f-u,B-D),_=Math.hypot(f-H,B-P);if(m<S)return{object:w,mode:"handle1"};if(_<S)return{object:w,mode:"handle2"};if(Math.abs(m-I)<y||m<I)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price),I=d.timeScale().timeToCoordinate(w.p3.rawTime),m=p.priceToCoordinate(w.p3.price);if(u==null||D==null||H==null||P==null||I==null||m==null)continue;const _=Math.hypot(f-u,B-D),k=Math.hypot(f-H,B-P),W=Math.hypot(f-I,B-m);if(_<S)return{object:w,mode:"handle1"};if(k<S)return{object:w,mode:"handle2"};if(W<S)return{object:w,mode:"handle3"};const G=nt(f,B,u,D,H,P),Z=nt(f,B,H,P,I,m),ie=nt(f,B,I,m,u,D);if(G<y||Z<y||ie<y||YA(f,B,[{x:u,y:D},{x:H,y:P},{x:I,y:m}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=(u+H)/2,m=(D+P)/2,_=H-u,k=P-D,W=Math.hypot(_,k);if(W<2)continue;const G=_/W,Z=k/W,ie=-Z,ue=G,Be=W/2,Fe=Be*Math.max(.05,w.minorRatio??.45);if(Be<2||Fe<2)continue;const He=I-G*Be,$e=m-Z*Be,qe=I+ie*Fe,Re=m+ue*Fe,lt=I+G*Be,st=m+Z*Be,ct=I-ie*Fe,Tt=m-ue*Fe,Kt=Math.hypot(f-He,B-$e),Gt=Math.hypot(f-qe,B-Re),eA=Math.hypot(f-lt,B-st),LA=Math.hypot(f-ct,B-Tt);if(Kt<S)return{object:w,mode:"handle1"};if(Gt<S)return{object:w,mode:"handle2"};if(eA<S)return{object:w,mode:"handle3"};if(LA<S)return{object:w,mode:"handle4"};const mi=(f-I)*G+(B-m)*Z,Cs=(f-I)*ie+(B-m)*ue,jd=mi/Be,ep=Cs/Fe,tp=jd*jd+ep*ep;if(Math.abs(tp-1)<.2||tp<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-H,B-P),m=Math.hypot(f-u,B-D);if(I<S)return{object:w,mode:"handle2"};if(m<S)return{object:w,mode:"handle1"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-H,B-P),m=Math.hypot(f-u,B-D);if(I<S)return{object:w,mode:"handle2"};if(m<S)return{object:w,mode:"handle1"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-u,B-D),m=Math.hypot(f-H,B-P);if(I<S)return{object:w,mode:"handle1"};if(m<S)return{object:w,mode:"handle2"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-u,B-D),m=Math.hypot(f-H,B-P);if(I<S)return{object:w,mode:"handle1"};if(m<S)return{object:w,mode:"handle2"};if(Wv(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-u,B-D),m=Math.hypot(f-H,B-P);if(I<S)return{object:w,mode:"handle1"};if(m<S)return{object:w,mode:"handle2"};if(Rv(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const u=d.timeScale().timeToCoordinate(w.p.rawTime),D=p.priceToCoordinate(w.p.price);if(u==null||D==null)continue;if(Math.hypot(f-u,B-D)<S)return{object:w,mode:"handle1"};const P=Math.abs(B-D),I=Math.abs(f-u);if(P<y||I<y)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const u=d.timeScale().timeToCoordinate(w.rawTime),D=p.priceToCoordinate(w.price);if(u==null||D==null)continue;const H=kd(w,u,D);if(f>=H.left&&f<=H.right&&B>=H.top&&B<=H.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-u,B-D),m=Math.hypot(f-H,B-P);if(I<S)return{object:w,mode:"handle1"};if(m<S)return{object:w,mode:"handle2"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price),I=d.timeScale().timeToCoordinate(w.b1.rawTime),m=p.priceToCoordinate(w.b1.price),_=d.timeScale().timeToCoordinate(w.b2.rawTime),k=p.priceToCoordinate(w.b2.price),W=I!=null&&_!=null?(I+_)/2:null,G=m!=null&&k!=null?(m+k)/2:null;if(u==null||D==null||H==null||P==null||W==null||G==null||I==null||m==null||_==null||k==null)continue;const Z=Math.hypot(f-u,B-D),ie=Math.hypot(f-H,B-P),ue=Math.hypot(f-W,B-G),Be=Math.hypot(u-W,D-G)<S*1.5;if(Be&&Math.min(Z,ue)<S*1.5)return{object:w,mode:"handle3"};if(ue<S)return{object:w,mode:"handle3"};if(ie<S)return{object:w,mode:"handle2"};if(Be)continue;if(Z<S)return{object:w,mode:"handle1"};const Fe=nt(f,B,u,D,H,P),He=nt(f,B,I,m,_,k);if(Fe<y||He<y||YA(f,B,[{x:u,y:D},{x:H,y:P},{x:_,y:k},{x:I,y:m}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price),I=d.timeScale().timeToCoordinate(w.top1.rawTime),m=p.priceToCoordinate(w.top1.price),_=d.timeScale().timeToCoordinate(w.top2.rawTime),k=p.priceToCoordinate(w.top2.price),W=d.timeScale().timeToCoordinate(w.bot1.rawTime),G=p.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),ie=p.priceToCoordinate(w.bot2.price);if(u==null||D==null||H==null||P==null||I==null||m==null||_==null||k==null||W==null||G==null||Z==null||ie==null)continue;const ue=Math.hypot(f-u,B-D),Be=Math.hypot(f-H,B-P);if(ue<S)return{object:w,mode:"handle1"};if(Be<S)return{object:w,mode:"handle2"};const Fe=nt(f,B,u,D,H,P),He=nt(f,B,I,m,_,k),$e=nt(f,B,W,G,Z,ie);if(Fe<y||He<y||$e<y||YA(f,B,[{x:I,y:m},{x:_,y:k},{x:Z,y:ie},{x:W,y:G}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price),I=d.timeScale().timeToCoordinate(w.top1.rawTime),m=p.priceToCoordinate(w.top1.price),_=d.timeScale().timeToCoordinate(w.top2.rawTime),k=p.priceToCoordinate(w.top2.price),W=d.timeScale().timeToCoordinate(w.bot1.rawTime),G=p.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),ie=p.priceToCoordinate(w.bot2.price);if(u==null||D==null||H==null||P==null||I==null||m==null||_==null||k==null||W==null||G==null||Z==null||ie==null)continue;const ue=Math.hypot(f-u,B-D),Be=Math.hypot(f-H,B-P);if(ue<S)return{object:w,mode:"handle1"};if(Be<S)return{object:w,mode:"handle2"};const Fe=nt(f,B,u,D,H,P),He=nt(f,B,I,m,_,k),$e=nt(f,B,W,G,Z,ie);if(Fe<y||He<y||$e<y||YA(f,B,[{x:I,y:m},{x:_,y:k},{x:Z,y:ie},{x:W,y:G}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price),I=d.timeScale().timeToCoordinate(w.p3.rawTime),m=p.priceToCoordinate(w.p3.price);if(u==null||D==null||H==null||P==null||I==null||m==null)continue;const _=Math.hypot(f-u,B-D),k=Math.hypot(f-H,B-P),W=Math.hypot(f-I,B-m);if(_<S)return{object:w,mode:"handle1"};if(k<S)return{object:w,mode:"handle2"};if(W<S)return{object:w,mode:"handle3"};const G=(H+I)/2,Z=(P+m)/2;let ie=G-u,ue=Z-D;Math.abs(ie)<1e-4&&(ie=1e-4);const Be=ue/ie,Fe=O.clientWidth,He=P+Be*(Fe-H),$e=m+Be*(Fe-I),qe=nt(f,B,H,P,Fe,He),Re=nt(f,B,I,m,Fe,$e);if(qe<y||Re<y||YA(f,B,[{x:H,y:P},{x:Fe,y:He},{x:Fe,y:$e},{x:I,y:m}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price),I=d.timeScale().timeToCoordinate(w.p3.rawTime),m=p.priceToCoordinate(w.p3.price),_=d.timeScale().timeToCoordinate(w.p4.rawTime),k=p.priceToCoordinate(w.p4.price);if(u==null||D==null||H==null||P==null||I==null||m==null||_==null||k==null)continue;const W=Math.hypot(f-u,B-D),G=Math.hypot(f-H,B-P),Z=Math.hypot(f-I,B-m),ie=Math.hypot(f-_,B-k);if(W<S)return{object:w,mode:"handle1"};if(G<S)return{object:w,mode:"handle2"};if(Z<S)return{object:w,mode:"handle3"};if(ie<S)return{object:w,mode:"handle4"};const ue=nt(f,B,u,D,I,m),Be=nt(f,B,H,P,_,k),Fe=nt(f,B,u,D,H,P),He=nt(f,B,I,m,_,k);if(ue<y||Be<y||Fe<y||He<y||YA(f,B,[{x:u,y:D},{x:I,y:m},{x:_,y:k},{x:H,y:P}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price),I=d.timeScale().timeToCoordinate(w.p3.rawTime),m=p.priceToCoordinate(w.p3.price),_=d.timeScale().timeToCoordinate(w.p4.rawTime),k=p.priceToCoordinate(w.p4.price);if(u==null||D==null||H==null||P==null||I==null||m==null||_==null||k==null)continue;const W=Math.hypot(f-u,B-D),G=Math.hypot(f-H,B-P),Z=Math.hypot(f-I,B-m),ie=Math.hypot(f-_,B-k);if(W<S)return{object:w,mode:"handle1"};if(G<S)return{object:w,mode:"handle2"};if(Z<S)return{object:w,mode:"handle3"};if(ie<S)return{object:w,mode:"handle4"};const ue=nt(f,B,u,D,I,m),Be=nt(f,B,H,P,_,k),Fe=nt(f,B,u,D,H,P),He=nt(f,B,I,m,_,k);if(ue<y||Be<y||Fe<y||He<y||YA(f,B,[{x:u,y:D},{x:I,y:m},{x:_,y:k},{x:H,y:P}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=(u+H)/2,m=(D+P)/2,_=Math.hypot(f-u,B-D),k=Math.hypot(f-H,B-P),W=Math.hypot(f-I,B-m);if(_<S)return{object:w,mode:"handle1"};if(k<S)return{object:w,mode:"handle2"};if(W<S)return{object:w,mode:"line"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const u=w.p1.rawTime??w.p1.time,D=w.p2.rawTime??w.p2.time,H=d.timeScale().timeToCoordinate(u),P=p.priceToCoordinate(w.p1.price),I=d.timeScale().timeToCoordinate(D),m=p.priceToCoordinate(w.p2.price);if(H==null||P==null||I==null||m==null)continue;const _=Math.hypot(f-H,B-P),k=Math.hypot(f-I,B-m);if(_<S)return{object:w,mode:"handle1"};if(k<S)return{object:w,mode:"handle2"};if(nt(f,B,H,P,I,m)<y)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const u=d.timeScale().timeToCoordinate(w.p1.rawTime),D=p.priceToCoordinate(w.p1.price),H=d.timeScale().timeToCoordinate(w.p2.rawTime),P=p.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||P==null)continue;const I=Math.hypot(f-u,B-D),m=Math.hypot(f-H,B-P);if(I<S)return{object:w,mode:"handle1"};if(m<S)return{object:w,mode:"handle2"};if(nt(f,B,u,D,H,P)<y)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const u=w.primitive,D=d.timeScale().timeToCoordinate(u.originTime),H=p.priceToCoordinate(u.price);if(H==null)continue;if(D!=null&&Math.hypot(f-D,B-H)<S)return{object:w,mode:"handle1"};const P=D==null?0:Math.max(0,D);if(f>=P&&Math.abs(B-H)<y)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const u=w.primitive,D=d.timeScale().timeToCoordinate(u.time);if(D==null)continue;const H=u.midYCss??200;if(Math.hypot(f-D,B-H)<S)return{object:w,mode:"handle1"};if(Math.abs(f-D)<y)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const u=p.priceToCoordinate(w.price);if(u==null)continue;const H=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(f-H,B-u)<S)return{object:w,mode:"line"};if(Math.abs(B-u)<y)return{object:w,mode:"line"}}}return null}const oe=f=>{const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top,u=T(Q,w);if(u){if(f.preventDefault(),f.stopPropagation(),f.detail>=2){ne.current=!0,q(u.object),ee.current=null,se.current=null;return}L(u.object),te(null),X([]),ee.current=u.mode,u.object.type==="rayline"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="extendedline"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="crossline"&&(u.mode==="handle1"||u.mode==="line")&&(se.current={x:Q,y:w,p:{...u.object.p}}),u.object.type==="text"&&u.mode==="line"&&(se.current={x:Q,y:w,rawTime:u.object.rawTime,price:u.object.price}),u.object.type==="trendbyangle"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="equidistantchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="andrewspitchfork"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="regressionchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="stddevchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="disjointchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="flattopbottom"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="fibonacci"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="gannfan"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="ganngrid"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="rectangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4"||u.mode==="handle5"||u.mode==="handle6"||u.mode==="handle7"||u.mode==="handle8")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="circle"&&(u.mode==="handle1"||u.mode==="handle2")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="triangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="ellipse"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}),u.object.type==="horizontalray"&&(u.mode==="handle1"||u.mode==="line")&&(se.current={x:Q,y:w,price:u.object.primitive.price,originTime:u.object.primitive.originTime}),u.object.type==="verticalline"&&(u.mode==="handle1"||u.mode==="line")&&(se.current={x:Q,y:w,time:u.object.primitive.time}),u.mode==="line"&&(u.object.type==="rulerline"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="infoline"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="arrowedline"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rayline"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="extendedline"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="crossline"?se.current={x:Q,y:w,p:{...u.object.p}}:u.object.type==="text"?se.current={x:Q,y:w,rawTime:u.object.rawTime,price:u.object.price}:u.object.type==="trendbyangle"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="equidistantchannel"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="andrewspitchfork"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="regressionchannel"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="stddevchannel"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="disjointchannel"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="flattopbottom"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="fibonacci"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="gannfan"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rectangle"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="circle"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="triangle"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="ellipse"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}:u.object.type==="ganngrid"?se.current={x:Q,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="horizontalray"?se.current={x:Q,y:w,price:u.object.primitive.price,originTime:u.object.primitive.originTime}:u.object.type==="verticalline"?se.current={x:Q,y:w,time:u.object.primitive.time}:u.object.type==="pricelevel"?se.current={y:w,price:u.object.price}:se.current={x:Q,y:w,point1:{...u.object.point1},point2:{...u.object.point2}})}else L(null),ee.current=null,V([]),te(null),X([])},E=f=>{const B=O.getBoundingClientRect(),Q=f.clientX-B.left,w=f.clientY-B.top;if(!ee.current){const I=T(Q,w);if(I?.object&&!le.current){const m=J(I.object);te(_=>_===I.object?_:I.object),X(_=>_.length===m.length&&_.every((k,W)=>k.x===m[W].x&&k.y===m[W].y)?_:m)}else te(m=>m==null?m:null),X(m=>m.length===0?m:[]);return}const u=le.current;if(!u)return;const D=d.timeScale().coordinateToTime(Q),H=p.coordinateToPrice(w);if(D==null||H==null)return;let P=Y(D);if(P!=null){if(u.type==="infoline"&&u.p1&&u.p2){const I=W=>{const G=W.rawTime??W.time,Z=W.normalizedTime??Y(G);return{rawTime:G,normalizedTime:Z,price:W.price}},m=(W,G)=>{const Z=W.normalizedTime??Y(W.rawTime),ie=G.normalizedTime??Y(G.rawTime);if(Z==null||ie==null)return;const ue=G.price-W.price,Be=ue/Math.abs(W.price)*100,Fe=tA(fe)||3600,He=Math.abs(ie-Z),$e=Math.max(1,Math.round(He/Fe)),qe=Math.max(1,Math.round(He/86400)),Re=d.timeScale().timeToCoordinate(W.rawTime),lt=p.priceToCoordinate(W.price),st=d.timeScale().timeToCoordinate(G.rawTime),ct=p.priceToCoordinate(G.price),Tt=Re!=null&&lt!=null&&st!=null&&ct!=null?Math.atan2(-(ct-lt),st-Re)*(180/Math.PI):u.primitive?.info?.angle??0,Kt={priceDiff:ue,pricePct:Be,bars:$e,days:qe,angle:Tt},Gt=u.primitive;if(Gt){Gt.p1={rawTime:W.rawTime,price:W.price},Gt.p2={rawTime:G.rawTime,price:G.price},Gt.info=Kt;try{c.current?.applyOptions({})}catch{}}const eA={...u,rawP1Time:W.rawTime,rawP2Time:G.rawTime,p1:{rawTime:W.rawTime,normalizedTime:Z,price:W.price},p2:{rawTime:G.rawTime,normalizedTime:ie,price:G.price}};Ce(LA=>{const mi=LA.map(Cs=>Cs===u?eA:Cs);return x.current=mi,mi}),L(eA),le.current=eA,Re!=null&&lt!=null&&st!=null&&ct!=null&&V([{x:Re,y:lt},{x:st,y:ct}])},_=I(u.p1),k=I(u.p2);if(_.rawTime==null||_.normalizedTime==null||k.rawTime==null||k.normalizedTime==null)return;if(ee.current==="handle1"){const W=d.timeScale().coordinateToTime(Q)??D;m({rawTime:W,normalizedTime:P,price:H},k)}else if(ee.current==="handle2"){const W=d.timeScale().coordinateToTime(Q)??D;m(_,{rawTime:W,normalizedTime:P,price:H})}else if(ee.current==="line"){const W=se.current;if(!W)return;const G=I(W.p1),Z=I(W.p2);if(G.rawTime==null||G.normalizedTime==null||Z.rawTime==null||Z.normalizedTime==null)return;const ie=d.timeScale().coordinateToTime(W.x)??G.rawTime,ue=p.coordinateToPrice(W.y);if(ie==null||ue==null)return;const Be=Y(ie)??G.normalizedTime;if(Be==null)return;const Fe=P-Be,He=H-ue,$e=Y(G.normalizedTime+Fe),qe=Y(Z.normalizedTime+Fe);if($e==null||qe==null)return;const Re=D-ie;m({rawTime:G.rawTime+Re,normalizedTime:$e,price:G.price+He},{rawTime:Z.rawTime+Re,normalizedTime:qe,price:Z.price+He})}return}if(u.type==="rulerline"&&u.p1&&u.p2){const I=(m,_)=>{const k=m.normalizedTime??m.rawTime,W=_.normalizedTime??_.rawTime,G=_.price-m.price,Z=G/Math.abs(m.price)*100,ie=ms(Dt,m.rawTime,_.rawTime,fe),ue=Math.abs(W-k),Be=Math.max(1,Math.round(ue/86400)),Fe={priceDiff:G,pricePct:Z,bars:ie,days:Be},He=u.primitive;if(He){He.p1={rawTime:m.rawTime,price:m.price},He.p2={rawTime:_.rawTime,price:_.price},He.info=Fe;const ct=_.price>=m.price;He.color=ct?"#3b82f6":"#ef5350",He.fillColor=ct?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const $e={...u,rawP1Time:m.rawTime,rawP2Time:_.rawTime,p1:m,p2:_};Ce(ct=>{const Tt=ct.map(Kt=>Kt===u?$e:Kt);return x.current=Tt,Tt}),L($e),le.current=$e;const qe=d.timeScale().timeToCoordinate(m.rawTime),Re=p.priceToCoordinate(m.price),lt=d.timeScale().timeToCoordinate(_.rawTime),st=p.priceToCoordinate(_.price);qe!=null&&Re!=null&&lt!=null&&st!=null&&V([{x:qe,y:Re},{x:(qe+lt)/2,y:(Re+st)/2},{x:lt,y:st}])};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H})}else if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="arrowedline"&&u.p1&&u.p2){const I=(m,_)=>{const k=u.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p1:m,p2:_};Ce(Be=>{const Fe=Be.map(He=>He===u?W:He);return x.current=Fe,Fe}),L(W),le.current=W;const G=d.timeScale().timeToCoordinate(m.rawTime),Z=p.priceToCoordinate(m.price),ie=d.timeScale().timeToCoordinate(_.rawTime),ue=p.priceToCoordinate(_.price);G!=null&&Z!=null&&ie!=null&&ue!=null&&V([{x:G,y:Z},{x:ie,y:ue}])};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H})}else if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="rayline"&&u.p1&&u.p2){const I=(m,_)=>{const k=u.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p1:m,p2:_};Ce(Be=>{const Fe=Be.map(He=>He===u?W:He);return x.current=Fe,Fe}),L(W),le.current=W;const G=d.timeScale().timeToCoordinate(m.rawTime),Z=p.priceToCoordinate(m.price),ie=d.timeScale().timeToCoordinate(_.rawTime),ue=p.priceToCoordinate(_.price);G!=null&&Z!=null&&ie!=null&&ue!=null&&V([{x:G,y:Z},{x:ie,y:ue}])};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;const _=Y(m);if(_==null)return;I(u.p1,{rawTime:m,normalizedTime:_,price:H})}else if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="extendedline"&&u.p1&&u.p2){const I=(m,_)=>{const k=u.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p1:m,p2:_};Ce(Be=>{const Fe=Be.map(He=>He===u?W:He);return x.current=Fe,Fe}),L(W),le.current=W;const G=d.timeScale().timeToCoordinate(m.rawTime),Z=p.priceToCoordinate(m.price),ie=d.timeScale().timeToCoordinate(_.rawTime),ue=p.priceToCoordinate(_.price);G!=null&&Z!=null&&ie!=null&&ue!=null&&V([{x:G,y:Z},{x:ie,y:ue}])};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H})}else if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="crossline"&&u.p){const I=_=>{const k=u.primitive;if(k){k.center={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p:_};Ce(ie=>{const ue=ie.map(Be=>Be===u?W:Be);return x.current=ue,ue}),L(W),le.current=W;const G=d.timeScale().timeToCoordinate(_.rawTime),Z=p.priceToCoordinate(_.price);G!=null&&Z!=null&&V([{x:G,y:Z}])},m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H});return}if(u.type==="pricelevel"&&u.price!=null){const I=p.coordinateToPrice(w);if(I==null)return;try{u.priceLine.applyOptions({price:I,title:I.toFixed(5)})}catch{}u.textPrimitive&&(u.textPrimitive.price=I);const m=c.current?c.current.paneSize().width:400,_=p.priceToCoordinate(I);_!=null&&V([{x:m/2,y:_}]);const k={...u,price:I};Ce(W=>{const G=W.map(Z=>Z===u?k:Z);return x.current=G,G}),L(k),le.current=k;return}if(u.type==="text"){const I=d.timeScale().coordinateToTime(Q);if(I==null)return;const m=u.primitive;if(m){m.rawTime=I,m.price=H;try{c.current?.applyOptions({})}catch{}}const _={...u,rawTime:I,price:H};Ce(k=>{const W=k.map(G=>G===u?_:G);return x.current=W,W}),L(_),le.current=_;return}if(u.type==="trendbyangle"&&u.p1&&u.p2){const I=(m,_)=>{const k=u.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p1:m,p2:_};Ce(Be=>{const Fe=Be.map(He=>He===u?W:He);return x.current=Fe,Fe}),L(W),le.current=W;const G=d.timeScale().timeToCoordinate(m.rawTime),Z=p.priceToCoordinate(m.price),ie=d.timeScale().timeToCoordinate(_.rawTime),ue=p.priceToCoordinate(_.price);G!=null&&Z!=null&&ie!=null&&ue!=null&&V([{x:G,y:Z},{x:ie,y:ue}])};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"||ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="equidistantchannel"&&u.p1&&u.p2&&u.p3){const I=(m,_,k)=>{const W=Od(m,_,k);if(!W)return;const G=u.primitive;if(G){G.p1={rawTime:m.rawTime,price:m.price},G.p2={rawTime:_.rawTime,price:_.price},G.b1={rawTime:W.b1.rawTime,price:W.b1.price},G.b2={rawTime:W.b2.rawTime,price:W.b2.price},G.p3={rawTime:W.bottomMid.rawTime,price:W.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const Z={...u,p1:m,p2:_,p3:W.bottomMid,b1:W.b1,b2:W.b2,bottomMid:W.bottomMid};Ce(ie=>{const ue=ie.map(Be=>Be===u?Z:Be);return x.current=ue,ue}),L(Z),le.current=Z};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2,u.p3);return}if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H},u.p3);return}if(ee.current==="handle3"){I(u.p1,u.p2,{rawTime:u.p3.rawTime,normalizedTime:u.p3.normalizedTime??Y(u.p3.rawTime),price:H});return}if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W),ue=Y(m.p3.normalizedTime+W);if(Z==null||ie==null||ue==null)return;const Be=D-_;I({rawTime:m.p1.rawTime+Be,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+Be,normalizedTime:ie,price:m.p2.price+G},{rawTime:m.p3.rawTime+Be,normalizedTime:ue,price:m.p3.price+G});return}}if(u.type==="regressionchannel"&&u.p1&&u.p2){const I=(m,_)=>{const k=Ni(Ve,m,_,u.stdMultiplier??1);if(!k)return;const W=u.primitive;if(W){W.mid1={rawTime:k.p1.rawTime,price:k.p1.price},W.mid2={rawTime:k.p2.rawTime,price:k.p2.price},W.top1={rawTime:k.top1.rawTime,price:k.top1.price},W.top2={rawTime:k.top2.rawTime,price:k.top2.price},W.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},W.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const G={...u,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,intercept:k.intercept,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};Ce(Z=>{const ie=Z.map(ue=>ue===u?G:ue);return x.current=ie,ie}),L(G),le.current=G};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P},u.p2);return}if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P});return}if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G});return}}if(u.type==="stddevchannel"&&u.p1&&u.p2){const I=(m,_)=>{const k=Sr(Ve,m,_,u.stdMultiplier??1);if(!k)return;const W=u.primitive;if(W){W.mid1={rawTime:k.p1.rawTime,price:k.p1.price},W.mid2={rawTime:k.p2.rawTime,price:k.p2.price},W.top1={rawTime:k.top1.rawTime,price:k.top1.price},W.top2={rawTime:k.top2.rawTime,price:k.top2.price},W.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},W.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const G={...u,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};Ce(Z=>{const ie=Z.map(ue=>ue===u?G:ue);return x.current=ie,ie}),L(G),le.current=G};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P},u.p2);return}if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P});return}if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G});return}}if(u.type==="andrewspitchfork"&&u.p1&&u.p2&&u.p3){const I=(m,_,k)=>{const W=u.primitive;if(W){W.p1={rawTime:m.rawTime,price:m.price},W.p2={rawTime:_.rawTime,price:_.price},W.p3={rawTime:k.rawTime,price:k.price};try{c.current?.applyOptions({})}catch{}}const G={...u,p1:m,p2:_,p3:k};Ce(Z=>{const ie=Z.map(ue=>ue===u?G:ue);return x.current=ie,ie}),L(G),le.current=G};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2,u.p3);return}if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H},u.p3);return}if(ee.current==="handle3"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,u.p2,{rawTime:m,normalizedTime:P,price:H});return}if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W),ue=Y(m.p3.normalizedTime+W);if(Z==null||ie==null||ue==null)return;const Be=D-_;I({rawTime:m.p1.rawTime+Be,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+Be,normalizedTime:ie,price:m.p2.price+G},{rawTime:m.p3.rawTime+Be,normalizedTime:ue,price:m.p3.price+G});return}}if(u.type==="disjointchannel"&&u.p1&&u.p2&&u.p3&&u.p4){const I=(G,Z,ie,ue)=>{const Be=u.primitive;if(Be){Be.p1={rawTime:G.rawTime,price:G.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:ie.rawTime,price:ie.price},Be.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Fe={...u,p1:G,p2:Z,p3:ie,p4:ue};Ce(He=>{const $e=He.map(qe=>qe===u?Fe:qe);return x.current=$e,$e}),L(Fe),le.current=Fe},m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(Q);if(_==null)return;const k=Y(_);if(k==null)return;const W=(G,Z,ie,ue)=>{const Be=G.normalizedTime??Y(G.rawTime);if(Be==null)return null;const Fe=Y(Be+ie);return Fe==null?null:{rawTime:G.rawTime+Z,normalizedTime:Fe,price:G.price+ue}};if(ee.current==="line"){const G=d.timeScale().coordinateToTime(m.x),Z=p.coordinateToPrice(m.y);if(G==null||Z==null)return;const ie=Y(G);if(ie==null)return;const ue=_-G,Be=k-ie,Fe=H-Z,He=W(m.p1,ue,Be,Fe),$e=W(m.p2,ue,Be,Fe),qe=W(m.p3,ue,Be,Fe),Re=W(m.p4,ue,Be,Fe);if(!He||!$e||!qe||!Re)return;I(He,$e,qe,Re);return}if(ee.current==="handle1"){const G=(m.p1.price+m.p2.price)/2,Z={rawTime:_,normalizedTime:k,price:H},ie={rawTime:_,normalizedTime:k,price:2*G-H};I(Z,ie,m.p3,m.p4);return}if(ee.current==="handle3"){const G=(m.p3.price+m.p4.price)/2,Z={rawTime:_,normalizedTime:k,price:H},ie={rawTime:_,normalizedTime:k,price:2*G-H};I(m.p1,m.p2,Z,ie);return}if(ee.current==="handle2"){const G=(m.p1.price+m.p2.price)/2,Z={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??Y(m.p1.rawTime),price:H};if(Z.normalizedTime==null)return;const ie={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??Y(m.p1.rawTime),price:2*G-H};if(ie.normalizedTime==null)return;I(ie,Z,m.p3,m.p4);return}if(ee.current==="handle4"){const G=H-m.p4.price,Z={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??Y(m.p3.rawTime),price:m.p4.price+G};if(Z.normalizedTime==null)return;const ie={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??Y(m.p1.rawTime),price:m.p2.price+G};if(ie.normalizedTime==null)return;I(m.p1,ie,m.p3,Z);return}}if(u.type==="flattopbottom"&&u.p1&&u.p2&&u.p3&&u.p4){const I=(G,Z,ie,ue)=>{const Be=u.primitive;if(Be){Be.p1={rawTime:G.rawTime,price:G.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:ie.rawTime,price:ie.price},Be.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Fe={...u,p1:G,p2:Z,p3:ie,p4:ue};Ce(He=>{const $e=He.map(qe=>qe===u?Fe:qe);return x.current=$e,$e}),L(Fe),le.current=Fe},m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(Q);if(_==null)return;const k=Y(_);if(k==null)return;const W=(G,Z,ie,ue)=>{const Be=G.normalizedTime??Y(G.rawTime);if(Be==null)return null;const Fe=Y(Be+ie);return Fe==null?null:{rawTime:G.rawTime+Z,normalizedTime:Fe,price:G.price+ue}};if(ee.current==="line"){const G=d.timeScale().coordinateToTime(m.x),Z=p.coordinateToPrice(m.y);if(G==null||Z==null)return;const ie=Y(G);if(ie==null)return;const ue=_-G,Be=k-ie,Fe=H-Z,He=W(m.p1,ue,Be,Fe),$e=W(m.p2,ue,Be,Fe),qe=W(m.p3,ue,Be,Fe),Re=W(m.p4,ue,Be,Fe);if(!He||!$e||!qe||!Re)return;I(He,$e,qe,Re);return}if(ee.current==="handle1"){const G={rawTime:_,normalizedTime:k,price:H},Z={rawTime:_,normalizedTime:k,price:m.p2.price};I(G,Z,m.p3,m.p4);return}if(ee.current==="handle3"){const G={rawTime:_,normalizedTime:k,price:H},Z={rawTime:_,normalizedTime:k,price:m.p4.price};I(m.p1,m.p2,G,Z);return}if(ee.current==="handle2"||ee.current==="handle4"){const G=ee.current==="handle2"?m.p2:m.p4,Z=H-G.price,ie={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??Y(m.p1.rawTime),price:m.p2.price+Z},ue={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??Y(m.p3.rawTime),price:m.p4.price+Z};if(ie.normalizedTime==null||ue.normalizedTime==null)return;I(m.p1,ie,m.p3,ue);return}}if(u.type==="fibonacci"&&u.p1&&u.p2){const I=(m,_)=>{const k=u.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p1:m,p2:_};Ce(G=>{const Z=G.map(ie=>ie===u?W:ie);return x.current=Z,Z}),L(W),le.current=W};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H})}else if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="rectangle"&&u.p1&&u.p2){const I=(st,ct)=>{const Tt=u.primitive;if(Tt){Tt.p1={rawTime:st.rawTime,price:st.price},Tt.p2={rawTime:ct.rawTime,price:ct.price};try{c.current?.applyOptions({})}catch{}}const Kt={...u,p1:st,p2:ct};Ce(Gt=>{const eA=Gt.map(LA=>LA===u?Kt:LA);return x.current=eA,eA}),L(Kt),le.current=Kt},m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(Q);if(_==null)return;const k=Y(_);if(k==null)return;if(ee.current==="line"){const st=d.timeScale().coordinateToTime(m.x),ct=p.coordinateToPrice(m.y);if(st==null||ct==null)return;const Tt=Y(st);if(Tt==null)return;const Kt=k-Tt,Gt=H-ct,eA=Y(m.p1.normalizedTime+Kt),LA=Y(m.p2.normalizedTime+Kt);if(eA==null||LA==null)return;const mi=D-st;I({rawTime:m.p1.rawTime+mi,normalizedTime:eA,price:m.p1.price+Gt},{rawTime:m.p2.rawTime+mi,normalizedTime:LA,price:m.p2.price+Gt});return}const W=Math.min(m.p1.normalizedTime,m.p2.normalizedTime),G=Math.max(m.p1.normalizedTime,m.p2.normalizedTime),Z=Math.max(m.p1.price,m.p2.price),ie=Math.min(m.p1.price,m.p2.price),ue=m.p1.normalizedTime<=m.p2.normalizedTime?m.p1.rawTime:m.p2.rawTime,Be=m.p1.normalizedTime<=m.p2.normalizedTime?m.p2.rawTime:m.p1.rawTime;let Fe=W,He=G,$e=Z,qe=ie,Re=ue,lt=Be;if((ee.current==="handle1"||ee.current==="handle4"||ee.current==="handle6")&&(Fe=k,Re=_),(ee.current==="handle3"||ee.current==="handle5"||ee.current==="handle8")&&(He=k,lt=_),(ee.current==="handle1"||ee.current==="handle2"||ee.current==="handle3")&&($e=H),(ee.current==="handle6"||ee.current==="handle7"||ee.current==="handle8")&&(qe=H),Fe>He){const st=Fe,ct=Re;Fe=He,Re=lt,He=st,lt=ct}if($e<qe){const st=$e;$e=qe,qe=st}I({rawTime:Re,normalizedTime:Fe,price:$e},{rawTime:lt,normalizedTime:He,price:qe});return}if(u.type==="circle"&&u.p1&&u.p2){const I=($e,qe)=>{const Re=u.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 lt={...u,p1:$e,p2:qe};Ce(st=>{const ct=st.map(Tt=>Tt===u?lt:Tt);return x.current=ct,ct}),L(lt),le.current=lt},m=d.timeScale().coordinateToTime(Q);if(m==null)return;const _=Y(m);if(_==null)return;if(ee.current==="handle2"){I(u.p1,{rawTime:m,normalizedTime:_,price:H});return}const k=se.current;if(!k)return;const W=d.timeScale().coordinateToTime(k.x),G=p.coordinateToPrice(k.y);if(W==null||G==null)return;const Z=Y(W);if(Z==null)return;const ie=_-Z,ue=H-G,Be=Y(k.p1.normalizedTime+ie),Fe=Y(k.p2.normalizedTime+ie);if(Be==null||Fe==null)return;const He=D-W;I({rawTime:k.p1.rawTime+He,normalizedTime:Be,price:k.p1.price+ue},{rawTime:k.p2.rawTime+He,normalizedTime:Fe,price:k.p2.price+ue});return}if(u.type==="triangle"&&u.p1&&u.p2&&u.p3){const I=(Re,lt,st)=>{const ct=u.primitive;if(ct){ct.p1={rawTime:Re.rawTime,price:Re.price},ct.p2={rawTime:lt.rawTime,price:lt.price},ct.p3={rawTime:st.rawTime,price:st.price};try{c.current?.applyOptions({})}catch{}}const Tt={...u,p1:Re,p2:lt,p3:st};Ce(Kt=>{const Gt=Kt.map(eA=>eA===u?Tt:eA);return x.current=Gt,Gt}),L(Tt),le.current=Tt},m=d.timeScale().coordinateToTime(Q);if(m==null)return;const _=Y(m);if(_==null)return;if(ee.current==="handle1"){I({rawTime:m,normalizedTime:_,price:H},u.p2,u.p3);return}if(ee.current==="handle2"){I(u.p1,{rawTime:m,normalizedTime:_,price:H},u.p3);return}if(ee.current==="handle3"){I(u.p1,u.p2,{rawTime:m,normalizedTime:_,price:H});return}const k=se.current;if(!k)return;const W=d.timeScale().coordinateToTime(k.x),G=p.coordinateToPrice(k.y);if(W==null||G==null)return;const Z=Y(W);if(Z==null)return;const ie=_-Z,ue=H-G,Be=D-W,Fe=Re=>{const lt=Re.normalizedTime??Y(Re.rawTime);if(lt==null)return null;const st=Y(lt+ie);return st==null?null:{rawTime:Re.rawTime+Be,normalizedTime:st,price:Re.price+ue}},He=Fe(k.p1),$e=Fe(k.p2),qe=Fe(k.p3);if(!He||!$e||!qe)return;I(He,$e,qe);return}if(u.type==="ellipse"&&u.p1&&u.p2){const I=(W,G,Z=u.minorRatio??.45)=>{const ie=u.primitive;if(ie){ie.p1={rawTime:W.rawTime,price:W.price},ie.p2={rawTime:G.rawTime,price:G.price},ie.minorRatio=Math.max(.05,Z);try{c.current?.applyOptions({})}catch{}}const ue={...u,p1:W,p2:G,minorRatio:Math.max(.05,Z)};Ce(Be=>{const Fe=Be.map(He=>He===u?ue:He);return x.current=Fe,Fe}),L(ue),le.current=ue},m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(Q);if(_==null)return;const k=Y(_);if(k==null)return;if(ee.current==="line"){const W=d.timeScale().coordinateToTime(m.x),G=p.coordinateToPrice(m.y);if(W==null||G==null)return;const Z=Y(W);if(Z==null)return;const ie=k-Z,ue=H-G,Be=Y(m.p1.normalizedTime+ie),Fe=Y(m.p2.normalizedTime+ie);if(Be==null||Fe==null)return;const He=D-W;I({rawTime:m.p1.rawTime+He,normalizedTime:Be,price:m.p1.price+ue},{rawTime:m.p2.rawTime+He,normalizedTime:Fe,price:m.p2.price+ue},m.minorRatio??u.minorRatio??.45);return}if(ee.current==="handle1"){I({rawTime:_,normalizedTime:k,price:H},u.p2,u.minorRatio??.45);return}if(ee.current==="handle3"){I(u.p1,{rawTime:_,normalizedTime:k,price:H},u.minorRatio??.45);return}if(ee.current==="handle2"||ee.current==="handle4"){const W=d.timeScale().timeToCoordinate(u.p1.rawTime),G=p.priceToCoordinate(u.p1.price),Z=d.timeScale().timeToCoordinate(u.p2.rawTime),ie=p.priceToCoordinate(u.p2.price);if(W==null||G==null||Z==null||ie==null)return;const ue=(W+Z)/2,Be=(G+ie)/2,Fe=Z-W,He=ie-G,$e=Math.hypot(Fe,He);if($e<.001)return;const qe=-He/$e,Re=Fe/$e,lt=Math.abs((Q-ue)*qe+(w-Be)*Re),st=Math.max(.05,lt*2/$e);I(u.p1,u.p2,st);return}return}if(u.type==="gannfan"&&u.p1&&u.p2){const I=(m,_)=>{const k=u.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p1:m,p2:_};Ce(G=>{const Z=G.map(ie=>ie===u?W:ie);return x.current=Z,Z}),L(W),le.current=W};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H})}else if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="ganngrid"&&u.p1&&u.p2){const I=(m,_)=>{const k=u.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:_.rawTime,price:_.price};try{c.current?.applyOptions({})}catch{}}const W={...u,p1:m,p2:_};Ce(G=>{const Z=G.map(ie=>ie===u?W:ie);return x.current=Z,Z}),L(W),le.current=W};if(ee.current==="handle1"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I({rawTime:m,normalizedTime:P,price:H},u.p2)}else if(ee.current==="handle2"){const m=d.timeScale().coordinateToTime(Q);if(m==null)return;I(u.p1,{rawTime:m,normalizedTime:P,price:H})}else if(ee.current==="line"){const m=se.current;if(!m)return;const _=d.timeScale().coordinateToTime(m.x),k=p.coordinateToPrice(m.y);if(_==null||k==null)return;const W=P-Y(_),G=H-k,Z=Y(m.p1.normalizedTime+W),ie=Y(m.p2.normalizedTime+W);if(Z==null||ie==null)return;const ue=D-_;I({rawTime:m.p1.rawTime+ue,normalizedTime:Z,price:m.p1.price+G},{rawTime:m.p2.rawTime+ue,normalizedTime:ie,price:m.p2.price+G})}return}if(u.type==="verticalline"&&u.primitive){const I=u.primitive;I.time=D;const m={...u,time:Y(D),rawTime:D};Ce(k=>{const W=k.map(G=>G===u?m:G);return x.current=W,W}),L(m),le.current=m;const _=d.timeScale().timeToCoordinate(D);_!=null&&V([{x:_,y:I.midYCss??200}]),c.current?.applyOptions({});return}if(u.type==="horizontalray"&&u.primitive){const I=u.primitive,m=se.current;if(!m)return;if(ee.current==="handle1"){if(I.price=H,I.originTime=D,u.priceLine)try{u.priceLine.applyOptions({price:H,title:u.showPrice!==!1?H.toFixed(5):""})}catch{}u.textPrimitive&&(u.textPrimitive.price=H,u.textPrimitive.originTime=D);const _={...u,price:I.price,originTime:I.originTime,rawOriginTime:D};Ce(k=>{const W=k.map(G=>G===u?_:G);return x.current=W,W}),L(_),le.current=_,c.current?.applyOptions({})}else if(ee.current==="line"){const _=p.coordinateToPrice(m.y);if(_==null)return;const k=H-_;if(I.price=m.price+k,u.priceLine)try{u.priceLine.applyOptions({price:I.price,title:u.showPrice!==!1?I.price.toFixed(5):""})}catch{}u.textPrimitive&&(u.textPrimitive.price=I.price);const W={...u,price:I.price};Ce(G=>{const Z=G.map(ie=>ie===u?W:ie);return x.current=Z,Z}),L(W),le.current=W,c.current?.applyOptions({})}return}if(!(u.type!=="trendline"&&u.type!=="gannline")&&!(!u.point1||!u.point2)){if(ee.current==="handle1"){const I={time:P,price:H},m=UA([{time:I.time,value:I.price},{time:u.point2.time,value:u.point2.price}]);m.length>0&&u.series.setData(m),u.decoration&&(u.decoration.p1=I);const _={...u,point1:I};Ce(k=>{const W=k.map(G=>G===u?_:G);return x.current=W,W}),L(_),le.current=_}else if(ee.current==="handle2"){const I={time:P,price:H},m=UA([{time:u.point1.time,value:u.point1.price},{time:I.time,value:I.price}]);m.length>0&&u.series.setData(m),u.decoration&&(u.decoration.p2=I);const _={...u,point2:I};Ce(k=>{const W=k.map(G=>G===u?_:G);return x.current=W,W}),L(_),le.current=_}else if(ee.current==="line"){const I=se.current;if(!I)return;const m=d.timeScale().coordinateToTime(I.x),_=p.coordinateToPrice(I.y);if(m==null||_==null)return;const k=P-m,W=H-_,G={time:Y(I.point1.time+k),price:I.point1.price+W},Z={time:Y(I.point2.time+k),price:I.point2.price+W},ie=UA([{time:G.time,value:G.price},{time:Z.time,value:Z.price}]);ie.length>0&&u.series.setData(ie),u.decoration&&(u.decoration.p1=G,u.decoration.p2=Z);const ue={...u,point1:G,point2:Z};Ce(Be=>{const Fe=Be.map(He=>He===u?ue:He);return x.current=Fe,Fe}),L(ue),le.current=ue}}}},K=()=>{ee.current=null,se.current=null},ae=()=>{ee.current||le.current||(te(null),X([]))},re={capture:!0,passive:!1};return O.addEventListener("mousedown",oe,re),O.addEventListener("mousemove",E,re),O.addEventListener("mouseup",K,re),O.addEventListener("mouseleave",ae,re),()=>{O.removeEventListener("mousedown",oe,re),O.removeEventListener("mousemove",E,re),O.removeEventListener("mouseup",K,re),O.removeEventListener("mouseleave",ae,re)}},[be,Ve,ze,Ce]),Ae.useEffect(()=>{const d=c.current,p=h.current;if(!d||!p)return;const O=()=>{const S=R;if(!S){V([]);return}const y=d.timeScale();if(S.type==="infoline"&&S.p1&&S.p2){const J=S.p1.rawTime??S.p1.time,T=S.p2.rawTime??S.p2.time,oe=y.timeToCoordinate(J),E=p.priceToCoordinate(S.p1.price),K=y.timeToCoordinate(T),ae=p.priceToCoordinate(S.p2.price);oe!=null&&E!=null&&K!=null&&ae!=null?V([{x:oe,y:E},{x:K,y:ae}]):V([]);return}if(S.type==="rulerline"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:(J+oe)/2,y:(T+E)/2},{x:oe,y:E}]):V([]);return}if(S.type==="arrowedline"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="rayline"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="extendedline"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="crossline"&&S.p){const J=y.timeToCoordinate(S.p.rawTime),T=p.priceToCoordinate(S.p.price);J!=null&&T!=null?V([{x:J,y:T}]):V([]);return}if(S.type==="text"&&S.rawTime!=null&&S.price!=null){const J=y.timeToCoordinate(S.rawTime),T=p.priceToCoordinate(S.price);J!=null&&T!=null?V([{x:J,y:T}]):V([]);return}if(S.type==="trendbyangle"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="equidistantchannel"&&S.p1&&S.p2&&S.b1&&S.b2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price),K=y.timeToCoordinate(S.b1.rawTime),ae=p.priceToCoordinate(S.b1.price),re=y.timeToCoordinate(S.b2.rawTime),f=p.priceToCoordinate(S.b2.price);J!=null&&T!=null&&oe!=null&&E!=null&&K!=null&&ae!=null&&re!=null&&f!=null?V([{x:J,y:T},{x:oe,y:E},{x:(K+re)/2,y:(ae+f)/2}]):V([]);return}if(S.type==="regressionchannel"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="stddevchannel"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="andrewspitchfork"&&S.p1&&S.p2&&S.p3){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price),K=y.timeToCoordinate(S.p3.rawTime),ae=p.priceToCoordinate(S.p3.price);J!=null&&T!=null&&oe!=null&&E!=null&&K!=null&&ae!=null?V([{x:J,y:T},{x:oe,y:E},{x:K,y:ae}]):V([]);return}if(S.type==="disjointchannel"&&S.p1&&S.p2&&S.p3&&S.p4){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price),K=y.timeToCoordinate(S.p3.rawTime),ae=p.priceToCoordinate(S.p3.price),re=y.timeToCoordinate(S.p4.rawTime),f=p.priceToCoordinate(S.p4.price);J!=null&&T!=null&&oe!=null&&E!=null&&K!=null&&ae!=null&&re!=null&&f!=null?V([{x:J,y:T},{x:oe,y:E},{x:K,y:ae},{x:re,y:f}]):V([]);return}if(S.type==="flattopbottom"&&S.p1&&S.p2&&S.p3&&S.p4){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price),K=y.timeToCoordinate(S.p3.rawTime),ae=p.priceToCoordinate(S.p3.price),re=y.timeToCoordinate(S.p4.rawTime),f=p.priceToCoordinate(S.p4.price);J!=null&&T!=null&&oe!=null&&E!=null&&K!=null&&ae!=null&&re!=null&&f!=null?V([{x:J,y:T},{x:oe,y:E},{x:K,y:ae},{x:re,y:f}]):V([]);return}if(S.type==="fibonacci"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="trendline"&&S.point1&&S.point2){const J=y.timeToCoordinate(S.point1.time),T=p.priceToCoordinate(S.point1.price),oe=y.timeToCoordinate(S.point2.time),E=p.priceToCoordinate(S.point2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="gannline"&&S.point1&&S.point2){const J=y.timeToCoordinate(S.point1.time),T=p.priceToCoordinate(S.point1.price),oe=y.timeToCoordinate(S.point2.time),E=p.priceToCoordinate(S.point2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:(J+oe)/2,y:(T+E)/2},{x:oe,y:E}]):V([]);return}if(S.type==="rectangle"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);if(J!=null&&T!=null&&oe!=null&&E!=null){const K=Math.min(J,oe),ae=Math.max(J,oe),re=Math.min(T,E),f=Math.max(T,E),B=(K+ae)/2,Q=(re+f)/2;V([{x:K,y:re},{x:B,y:re},{x:ae,y:re},{x:K,y:Q},{x:ae,y:Q},{x:K,y:f},{x:B,y:f},{x:ae,y:f}])}else V([]);return}if(S.type==="circle"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="triangle"&&S.p1&&S.p2&&S.p3){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price),K=y.timeToCoordinate(S.p3.rawTime),ae=p.priceToCoordinate(S.p3.price);J!=null&&T!=null&&oe!=null&&E!=null&&K!=null&&ae!=null?V([{x:J,y:T},{x:oe,y:E},{x:K,y:ae}]):V([]);return}if(S.type==="ellipse"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);if(J!=null&&T!=null&&oe!=null&&E!=null){const K=(J+oe)/2,ae=(T+E)/2,re=oe-J,f=E-T,B=Math.hypot(re,f);if(B<.001){V([]);return}const Q=re/B,w=f/B,u=-w,D=Q,H=B/2,P=H*Math.max(.05,S.minorRatio??.45);V([{x:K-Q*H,y:ae-w*H},{x:K+u*P,y:ae+D*P},{x:K+Q*H,y:ae+w*H},{x:K-u*P,y:ae-D*P}])}else V([]);return}if(S.type==="gannfan"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="ganngrid"&&S.p1&&S.p2){const J=y.timeToCoordinate(S.p1.rawTime),T=p.priceToCoordinate(S.p1.price),oe=y.timeToCoordinate(S.p2.rawTime),E=p.priceToCoordinate(S.p2.price);J!=null&&T!=null&&oe!=null&&E!=null?V([{x:J,y:T},{x:oe,y:E}]):V([]);return}if(S.type==="horizontalray"&&S.primitive){const J=S.primitive,T=y.timeToCoordinate(J.originTime),oe=p.priceToCoordinate(J.price);T!=null&&oe!=null?V([{x:T,y:oe}]):V([]);return}if(S.type==="verticalline"&&S.primitive){const J=S.primitive,T=y.timeToCoordinate(J.time);if(T!=null){const oe=J.midYCss??200;V([{x:T,y:oe}])}else V([]);return}if(S.type==="pricelevel"&&S.priceLine){const J=h.current?.priceToCoordinate(S.price);if(J!=null){const T=c.current?c.current.paneSize().width:400;V([{x:T/2,y:J}])}else V([]);return}V([])};O();const Te=d.timeScale();return Te.subscribeVisibleTimeRangeChange(O),()=>{Te.unsubscribeVisibleTimeRangeChange(O)}},[R]),Ae.useEffect(()=>{let d=!1;x.current.forEach(p=>{if(p.type==="verticalline"&&p.primitive){const O=p===R||p===j;p.primitive.showDot!==O&&(p.primitive.showDot=O,d=!0)}}),d&&c.current?.applyOptions({})},[R,j]),Ae.useEffect(()=>{let d=!1;x.current.forEach(p=>{if((p.type==="infoline"||p.type==="rulerline"||p.type==="arrowedline"||p.type==="rayline"||p.type==="extendedline"||p.type==="trendbyangle")&&p.primitive){const O=p===R||p===j;p.primitive.isActive!==O&&(p.primitive.isActive=O,d=!0)}}),d&&c.current?.applyOptions({})},[R,j]),Ae.useEffect(()=>{!c.current||!h.current||x.current.forEach(d=>{if(d.series&&d.series.applyOptions({visible:Pe}),d.priceLine){const p=Pe&&d.showPrice!==!1;d.priceLine.applyOptions(Pe?{color:d.lineColor??"#3b82f6",axisLabelVisible:p,title:p&&typeof d.price=="number"?d.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(d.type==="fibonacci"&&d.primitive){d.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}if(d.type==="rectangle"&&d.primitive){d.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}if(d.type==="parallellines"&&(d.baseLine&&d.baseLine.applyOptions({visible:Pe}),d.parallelLine&&d.parallelLine.applyOptions({visible:Pe}),d.firstLine&&d.firstLine.applyOptions({visible:Pe}),d.secondLine&&d.secondLine.applyOptions({visible:Pe})),(d.type==="horizontalray"||d.type==="verticalline"||d.type==="infoline"||d.type==="rulerline"||d.type==="arrowedline"||d.type==="rayline"||d.type==="extendedline"||d.type==="crossline"||d.type==="trendbyangle"||d.type==="equidistantchannel"||d.type==="regressionchannel"||d.type==="stddevchannel"||d.type==="gannfan"||d.type==="ganngrid"||d.type==="andrewspitchfork"||d.type==="disjointchannel"||d.type==="flattopbottom"||d.type==="circle"||d.type==="triangle"||d.type==="ellipse"||d.type==="text")&&d.primitive){d.primitive.visible=Pe;try{c.current?.applyOptions({})}catch{}}})},[Pe,ze]),Ae.useEffect(()=>{!Pe&&R&&(L(null),V([]))},[Pe,R]),Ae.useEffect(()=>{if(x.current.length>ze.length){const d=x.current.filter((p,O)=>!ze.includes(p));R&&d.some(p=>p===R)&&(L(null),V([])),d.forEach(p=>{if(p.series&&c.current?.removeSeries(p.series),p.priceLine&&h.current?.removePriceLine(p.priceLine),p.textPrimitive)try{h.current?.detachPrimitive(p.textPrimitive)}catch{}if(p.type==="horizontalray"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="verticalline"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="infoline"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="rulerline"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="arrowedline"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="rayline"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="extendedline"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="crossline"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="trendbyangle"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="equidistantchannel"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="regressionchannel"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="stddevchannel"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="gannfan"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="ganngrid"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="andrewspitchfork"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="disjointchannel"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="flattopbottom"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="fibonacci"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="rectangle"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="circle"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="triangle"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="ellipse"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="text"&&p.primitive)try{h.current?.detachPrimitive(p.primitive)}catch{}if(p.type==="parallellines")try{p.baseLine&&c.current?.removeSeries(p.baseLine),p.parallelLine&&c.current?.removeSeries(p.parallelLine),p.firstLine&&c.current?.removeSeries(p.firstLine),p.secondLine&&c.current?.removeSeries(p.secondLine)}catch{}}),x.current=ze}},[ze,R]),Ae.useEffect(()=>{const d=h.current;return d?(ge.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),ge.current=[],Ne.filter(O=>O.symbol===Se).forEach(O=>{const Te=parseFloat(O.price);if(isNaN(Te))return;const y=O.type==="BUY"?"#26A69A":"#EF5350",J=d.createPriceLine({price:Te,color:y,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume} @ ${O.price}`,textColor:y});ge.current.push(J)}),()=>{ge.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),ge.current=[]}):void 0},[Ne,Se]),Ae.useEffect(()=>{const d=o.current;if(!d)return;const p=O=>{if(ne.current){ne.current=!1;return}if(b.current||!c.current)return;const Te=c.current,S=h.current;if(Te&&S&&x.current.length>0){const y=d.getBoundingClientRect(),J=O.clientX-y.left,T=O.clientY-y.top,oe=15;for(let E=x.current.length-1;E>=0;E--){const K=x.current[E];let ae=!1;if(K.type==="text"&&K.rawTime!=null&&K.price!=null){const re=Te.timeScale().timeToCoordinate(K.rawTime),f=S.priceToCoordinate(K.price);if(re!=null&&f!=null){const B=kd(K,re,f);J>=B.left&&J<=B.right&&T>=B.top&&T<=B.bottom&&(ae=!0)}}else if(K.point1&&K.point2){const re=Te.timeScale().timeToCoordinate(K.point1.time??K.point1.rawTime),f=S.priceToCoordinate(K.point1.price),B=Te.timeScale().timeToCoordinate(K.point2.time??K.point2.rawTime),Q=S.priceToCoordinate(K.point2.price);if(re!=null&&f!=null&&B!=null&&Q!=null){const w=Math.hypot(J-re,T-f),u=Math.hypot(J-B,T-Q),D=(re+B)/2,H=(f+Q)/2,P=Math.hypot(J-D,T-H);(w<oe||u<oe||P<oe)&&(ae=!0)}}else if(K.p1&&K.p2){const re=Te.timeScale().timeToCoordinate(K.p1.rawTime),f=S.priceToCoordinate(K.p1.price),B=Te.timeScale().timeToCoordinate(K.p2.rawTime),Q=S.priceToCoordinate(K.p2.price);if(re!=null&&f!=null&&B!=null&&Q!=null){const w=Math.min(re,B),u=Math.max(re,B),D=Math.min(f,Q),H=Math.max(f,Q);J>=w-5&&J<=u+5&&T>=D-5&&T<=H+5&&(ae=!0)}}else if(K.p){const re=Te.timeScale().timeToCoordinate(K.p.rawTime),f=S.priceToCoordinate(K.p.price);re!=null&&f!=null&&Math.hypot(J-re,T-f)<oe&&(ae=!0)}else if(K.type==="pricelevel"&&K.price!=null){const re=S.priceToCoordinate(K.price);re!=null&&Math.abs(T-re)<oe&&(ae=!0)}if(ae){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),q(K);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;zd(c.current,Ve,fe)||c.current.timeScale().fitContent();const J=c.current.timeScale().getVisibleRange();ve(J)},80)};return d.addEventListener("dblclick",p,!0),()=>{d.removeEventListener("dblclick",p,!0)}},[Ve,fe]);const Yd=R??j,qd=R?$:ce,bT=Pe&&Xv(Yd,qd),QT=Zv(Yd?.type);Ae.useEffect(()=>{const d=o.current,p=l.current;if(!d||!p)return;const O=80,Te=y=>{const J=d.getBoundingClientRect();p.style.opacity=J.bottom-y.clientY<=O?"1":"0"},S=()=>{p.style.opacity="0"};return d.addEventListener("mousemove",Te),d.addEventListener("mouseleave",S),()=>{d.removeEventListener("mousemove",Te),d.removeEventListener("mouseleave",S)}},[]);const FT=Ae.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const p=d.getVisibleRange();if(!p?.from||!p?.to)return;const O=p.to-p.from,Te=(p.from+p.to)/2,S=O*.8;try{d.setVisibleRange({from:Te-S/2,to:Te+S/2}),ve(d.getVisibleRange())}catch{}},[ve]),UT=Ae.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const p=d.getVisibleRange();if(!p?.from||!p?.to)return;const O=p.to-p.from,Te=(p.from+p.to)/2,S=O*1.25;try{d.setVisibleRange({from:Te-S/2,to:Te+S/2}),ve(d.getVisibleRange())}catch{}},[ve]),ST=Ae.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const p=d.getVisibleLogicalRange();if(!p)return;const O=Math.max(1,Math.round((p.to-p.from)*.1));try{d.setVisibleLogicalRange({from:p.from-O,to:p.to-O})}catch{}},[]),ET=Ae.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const p=d.getVisibleLogicalRange();if(!p)return;const O=Math.max(1,Math.round((p.to-p.from)*.1));try{d.setVisibleLogicalRange({from:p.from+O,to:p.to+O})}catch{}},[]),LT=Ae.useCallback(()=>{if(!c.current)return;zd(c.current,Ve,fe)||c.current.timeScale().fitContent();const p=c.current.timeScale().getVisibleRange();ve(p)},[Ve,fe,ve]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${rt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:be===1||be!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[wt&&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 Se=="object"?Se?.symbol:Se,"..."]})]})}),!wt&&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})]})}),!wt&&!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 Se=="object"?Se?.symbol:Se]})})}),A&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Ch,{bidPrice:e,askPrice:t,onBuyClick:yT,onSellClick:CT})}),a.jsx(vh,{isOpen:Me,onClose:vT,orderType:Qe,bidPrice:e,askPrice:t}),a.jsx(Fh,{isOpen:z!==null,onClose:()=>q(null),chartObject:z,onUpdate:TT}),wt&&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"}})}),bT&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:qd.map((d,p)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:d.x-5,top:d.y-5,backgroundColor:QT}},p))}),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:UT,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:FT,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:ST,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:ET,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:LT,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:d,onClick:p,icon:O})=>a.jsx("button",{title:d,onClick:p,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:Te=>{Te.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",Te.currentTarget.style.color=rt==="light"?"#111827":"#e2e8f0"},onMouseLeave:Te=>{Te.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",Te.currentTarget.style.color=rt==="light"?"#374151":"#94a3b8"},children:O},d))})]})})}),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 Wd({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Lt(),[s,o]=Ae.useState(!1),[l,c]=Ae.useState(""),[h,g]=Ae.useState(-1),C=Ae.useRef(null),x=Ae.useRef(null);Ae.useEffect(()=>{const M=N=>{C.current&&!C.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]),Ae.useEffect(()=>{s&&x.current&&x.current.focus()},[s]);const b=r.filter(M=>M.symbol.toLowerCase().includes(l.toLowerCase())),v=b.filter(M=>!M.symbol.endsWith("USDT")),U=b.filter(M=>M.symbol.endsWith("USDT")),F=M=>{A(M),o(!1),c("")};return r.find(M=>M.symbol===t),a.jsxs("div",{ref:C,style:{...gt.container,...i},className:e,children:[a.jsxs("button",{style:gt.button,onClick:()=>o(!s),onMouseEnter:M=>Object.assign(M.currentTarget.style,gt.buttonHover),onMouseLeave:M=>{M.currentTarget.style.borderColor="#334155",M.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:x,style:gt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:M=>c(M.target.value)})}),a.jsx("div",{style:gt.list,children:b.length===0?a.jsx("div",{style:gt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[v.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:gt.categoryLabel,children:"Forex & Metals"}),v.map(M=>a.jsxs("div",{style:{...gt.item,...M.symbol===t?gt.itemSelected:{}},onClick:()=>F(M.symbol),onMouseEnter:N=>{M.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{M.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:gt.symbolName,children:M.symbol}),M.bid&&a.jsx("span",{style:{...gt.symbolPrice,...parseFloat(M.change)>=0?gt.priceUp:gt.priceDown},children:parseFloat(M.bid).toFixed(5)})]},M.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:gt.categoryLabel,children:"Crypto"}),U.map(M=>a.jsxs("div",{style:{...gt.item,...M.symbol===t?gt.itemSelected:{}},onClick:()=>F(M.symbol),onMouseEnter:N=>{M.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{M.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:gt.symbolName,children:M.symbol}),M.bid&&a.jsx("span",{style:{...gt.symbolPrice,...parseFloat(M.change)>=0?gt.priceUp:gt.priceDown},children:parseFloat(M.bid).toFixed(2)})]},M.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"}},tT=[.01,.05,.1,.5,1];function Rd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=tT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:h}){const[g,C]=Ae.useState(.1),x=i!==void 0?i:g,b=Ae.useCallback(M=>{const N=Math.max(t,Math.min(A,parseFloat(M)||t)),R=Math.round(N/r)*r,L=parseFloat(R.toFixed(8));i!==void 0||C(L),e?.(L)},[t,A,r,i,e]),v=()=>b(x+r),U=()=>b(x-r),F=(x>=1,x.toFixed(2));return a.jsxs("div",{style:{...SA.container,...c},className:h,children:[o&&a.jsx("span",{style:SA.label,children:l}),a.jsx("button",{style:SA.btn,onClick:U,onMouseEnter:M=>Object.assign(M.currentTarget.style,SA.btnHover),onMouseLeave:M=>{M.currentTarget.style.borderColor="#334155",M.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:SA.input,type:"text",value:F,onChange:M=>{const N=M.target.value;if(N===""||N==="."||N==="0.")return;const R=parseFloat(N);isNaN(R)||b(R)},onBlur:()=>b(x)}),a.jsx("button",{style:SA.btn,onClick:v,onMouseEnter:M=>Object.assign(M.currentTarget.style,SA.btnHover),onMouseLeave:M=>{M.currentTarget.style.borderColor="#334155",M.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:SA.presets,children:n.map(M=>a.jsx("button",{style:{...SA.preset,...Math.abs(x-M)<1e-4?SA.presetActive:{}},onClick:()=>b(M),onMouseEnter:N=>{Math.abs(x-M)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(x-M)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:M},M))})]})}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 Gd({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:h,className:g}){const{currentSymbolData:C}=Lt(),[x,b]=Ae.useState(""),[v,U]=Ae.useState(!1),[F,M]=Ae.useState("price"),N=i!==void 0?i:x,R=t!==void 0?t:v,L=r!==void 0?r:F,z=Ae.useCallback(te=>{t!==void 0||U(te),A?.(te)},[t,A]),q=Ae.useCallback(te=>{r!==void 0||M(te),n?.(te)},[r,n]),$=Ae.useCallback(te=>{i!==void 0||b(te),e?.(te)},[i,e]),V=te=>{const ce=te.target.value;if(ce===""||ce==="."||ce==="0."){$(ce);return}const X=parseFloat(ce);isNaN(X)||$(ce)},j=L==="price"?C?.bid?parseFloat(C.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...Yt.container,...h},className:g,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:N,onChange:V,placeholder:j,onFocus:te=>te.currentTarget.style.borderColor="#EF5350",onBlur:te=>te.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...Yt.modeBtn,...L==="price"?Yt.modeBtnActive:{}},onClick:()=>q("price"),children:"Price"}),a.jsx("button",{style:{...Yt.modeBtn,...L==="pips"?Yt.modeBtnActive:{}},onClick:()=>q("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 $d({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:h,className:g}){const{currentSymbolData:C}=Lt(),[x,b]=Ae.useState(""),[v,U]=Ae.useState(!1),[F,M]=Ae.useState("price"),N=i!==void 0?i:x,R=t!==void 0?t:v,L=r!==void 0?r:F,z=Ae.useCallback(te=>{t!==void 0||U(te),A?.(te)},[t,A]),q=Ae.useCallback(te=>{r!==void 0||M(te),n?.(te)},[r,n]),$=Ae.useCallback(te=>{i!==void 0||b(te),e?.(te)},[i,e]),V=te=>{const ce=te.target.value;if(ce===""||ce==="."||ce==="0."){$(ce);return}const X=parseFloat(ce);isNaN(X)||$(ce)},j=L==="price"?C?.ask?parseFloat(C.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...qt.container,...h},className:g,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:j,onFocus:te=>te.currentTarget.style.borderColor="#26A69A",onBlur:te=>te.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...qt.modeBtn,...L==="price"?qt.modeBtnActive:{}},onClick:()=>q("price"),children:"Price"}),a.jsx("button",{style:{...qt.modeBtn,...L==="pips"?qt.modeBtnActive:{}},onClick:()=>q("pips"),children:"Pips"})]})]})]})}const AT=[{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 Xd({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:h,chartObjects:g,setChartObjects:C}=Lt(),[x,b]=Ae.useState(null),v=A||AT,U=N=>{l(o===N?null:N)},F=()=>{C([]),l(null)},M=()=>{h(!c)};return a.jsxs("div",{style:{...EA.container,...n},className:s,children:[i&&a.jsx("span",{style:EA.label,children:r}),v.map(N=>a.jsxs("button",{style:{...EA.btn,...o===N.id?EA.btnActive:{}},onClick:()=>U(N.id),onMouseEnter:R=>{b(N.id),o!==N.id&&Object.assign(R.currentTarget.style,EA.btnHover)},onMouseLeave:R=>{b(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,x===N.id&&a.jsx("div",{style:EA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:EA.divider}),t&&a.jsx("button",{style:{...EA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:M,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:EA.deleteBtn,onClick:F,onMouseEnter:N=>Object.assign(N.currentTarget.style,EA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Zd={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 iT({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:h,onStopLossEnabledChange:g,takeProfit:C,onTakeProfitChange:x,takeProfitEnabled:b,onTakeProfitEnabledChange:v,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:M={},takeProfitProps:N={},drawingToolsProps:R={},style:L,className:z}){const q=[];i&&q.push(a.jsx(Wd,{...U},"coin")),e&&q.push(a.jsx(Rd,{value:s,onChange:o,...F},"volume")),t&&q.push(a.jsx(Gd,{value:l,onChange:c,enabled:h,onEnabledChange:g,...M},"sl")),A&&q.push(a.jsx($d,{value:C,onChange:x,enabled:b,onEnabledChange:v,...N},"tp")),r&&q.push(a.jsx(Xd,{...R},"draw"));const $=[];return q.forEach((V,j)=>{$.push(V),n&&j<q.length-1&&$.push(a.jsx("div",{style:Zd.divider},`div-${j}`))}),a.jsx("div",{style:{...Zd.toolbar,...L},className:z,children:$})}const rT=[{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"}],_a={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 nT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Lt();return a.jsx("div",{style:{..._a.container,...i},className:e,children:rT.map(r=>a.jsx("button",{style:{..._a.btn,...t===r.value?_a.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 sT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Pa={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 oT({style:i,className:e}){const{chartType:t,setChartType:A}=Lt();return a.jsx("div",{style:{...Pa.container,...i},className:e,children:sT.map(r=>a.jsxs("button",{style:{...Pa.btn,...t===r.value?Pa.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 aT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Lt(),[h,g]=Ae.useState(null),C=parseFloat(o?.bid||0),x=parseFloat(o?.ask||0),b=x>0&&C>0?Math.abs(x-C):0,v=M=>!M||M===0?"-.-----":M>=1e3?M.toFixed(2):M>=1?M.toFixed(4):M.toFixed(5),U=M=>M===0?"-":M>=1?M.toFixed(1):M>=.01?M.toFixed(3):(M*1e4).toFixed(1)+"p",F=Ae.useCallback(M=>{if(!s)return;const N=M==="BUY"?x:C;if(!N||N<=0){g({type:"error",message:"No price available"});return}const R={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:M,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 L=i*N*.01;c(z=>z-L),g({type:"success",message:`${M} executed`}),A?.(R),setTimeout(()=>g(null),3e3)},[s,x,C,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:M=>{Object.assign(M.currentTarget.style,Rt.sellBtnHover)},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#7f1d1d",M.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:v(C)})]}),a.jsxs("div",{style:Rt.spread,children:[a.jsx("span",{style:Rt.spreadLabel,children:"Spread"}),a.jsx("span",{style:Rt.spreadValue,children:U(b)})]}),a.jsxs("div",{style:Rt.priceBox,children:[a.jsx("span",{style:Rt.priceLabel,children:"Ask"}),a.jsx("span",{style:{...Rt.priceValue,color:"#26A69A"},children:v(x)})]}),a.jsx("button",{style:Rt.buyBtn,onClick:()=>F("BUY"),onMouseEnter:M=>{Object.assign(M.currentTarget.style,Rt.buyBtnHover)},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#14532d",M.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&a.jsx("span",{style:{...Rt.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const 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 lT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Lt(),[l,c]=Ae.useState(null),h=A.filter(v=>v.status==="OPEN"||!v.closeAt),g=Ae.useCallback((v,U)=>{const F=n.find(M=>M.symbol===v);return F?parseFloat(U==="BUY"?F.bid||0:F.ask||0):0},[n]),C=Ae.useCallback(v=>{if(l)return;c(v.id);const U=g(v.symbol,v.type),M=(v.type==="BUY"?U-v.price:v.price-U)*v.volume,N=v.volume*v.price*.01;r(R=>R.filter(L=>L.id!==v.id)),o(R=>R+N+M),c(null)},[l,g,r,o]),x=v=>{const U=parseFloat(v);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},b=v=>{const U=parseFloat(v);return isNaN(U)?"-":(U>=0?"+":"")+U.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 (",h.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:h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:et.emptyRow,children:"No open positions"})}):h.map(v=>{const U=g(v.symbol,v.type),F=v.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...et.td,fontWeight:700,color:"#e2e8f0"},children:v.symbol}),a.jsx("td",{style:{...et.td,...v.type==="BUY"?et.typeBuy:et.typeSell},children:v.type}),a.jsx("td",{style:et.td,children:v.volume}),a.jsx("td",{style:et.td,children:x(v.price)}),a.jsx("td",{style:et.td,children:x(U)}),a.jsx("td",{style:et.td,children:v.stopLoss?x(v.stopLoss):"-"}),a.jsx("td",{style:et.td,children:v.takeProfit?x(v.takeProfit):"-"}),a.jsx("td",{style:{...et.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:b(F)}),a.jsx("td",{style:et.td,children:a.jsx("button",{style:{...et.closeBtn,...l===v.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>C(v),disabled:l===v.id,onMouseEnter:M=>{l!==v.id&&(M.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#7f1d1d"},children:l===v.id?"...":"Close"})})]},v.id)})})]})})]})}function cT(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 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 13H5v-2h14v2z"},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:"m7 10 5 5 5-5z"},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 14 5-5 5 5z"},child:[]}]})(i)}const pT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:g=!0,onToggleMarketWatch:C,buySellPanelOpen:x,onMove:b})=>{const{theme:v}=Lt(),U=v==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],M={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:M[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:M[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:x?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${x?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(cT,{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(hT,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:b,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>C?.(),title:g?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${g?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[a.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14Zm-1 2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h12Z"})]})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${U?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:a.jsx("path",{d:"M22 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0-4a1 1 0 0 1-1-1V4h-1a1 1 0 1 1 0-2h1a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Zm1 7v8a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-8l3.764-1s.45-.428.789-1.105l.171-.342a.998.998 0 0 1 .894-.553h4.764a1 1 0 0 1 .894.552l.171.342c.339.678.789 1.106.789 1.106L23 13Zm-8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm0 4.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3ZM16 4h-2a1 1 0 1 1 0-2h2a1 1 0 1 1 0 2Zm-6 0H8a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2ZM4 22H3a2 2 0 0 1-2-2v-1a1 1 0 1 1 2 0v1h1a1 1 0 1 1 0 2ZM4 4H3v1a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2h1a1 1 0 0 1 0 2ZM2 8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Zm0 5a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1Z"})})}),a.jsx("button",{type:"button",onClick:()=>h?.(),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"})})})]})]})},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"})})}],ws=({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})}),fT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:h,drawingsVisible:g,setDrawingsVisible:C,chartLocked:x,setChartLocked:b,theme:v,setTheme:U,setIsShow:F}=Lt(),[M,N]=Ae.useState(!1),[R,L]=Ae.useState(null),[z,q]=Ae.useState(null),[$,V]=Ae.useState(0),[j,te]=Ae.useState(!1),[ce,X]=Ae.useState(0),[ee,se]=Ae.useState(!1),[le,ne]=Ae.useState(0),[he,de]=Ae.useState(!1),[we,xe]=Ae.useState(0),[Ue,ye]=Ae.useState(!1),[ve,be]=Ae.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Ee=Ae.useRef(null),Ie=Ae.useRef(null),Ze=Ae.useRef(null),ze=Ae.useRef(null),Ce=Ae.useRef(null),Ne=Ae.useRef(null);Ae.useEffect(()=>{const ke=me=>{const ge=Ee.current;M&&ge&&!ge.contains(me.target)&&(N(!1),L(null));const Me=Ie.current;z==="line"&&Me&&!Me.contains(me.target)&&q(null);const _e=Ze.current;z==="channel"&&_e&&!_e.contains(me.target)&&q(null);const Qe=ze.current;z==="gann"&&Qe&&!Qe.contains(me.target)&&q(null);const Ke=Ce.current;z==="shape"&&Ke&&!Ke.contains(me.target)&&q(null)};return window.addEventListener("mousedown",ke),()=>window.removeEventListener("mousedown",ke)},[M,z]),Ae.useEffect(()=>{const ke=me=>{me.key==="Escape"&&(N(!1),L(null),q(null))};return window.addEventListener("keydown",ke),()=>window.removeEventListener("keydown",ke)},[]);const Se=Ae.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"}],[]),fe=ke=>{const me=Se[ke].label;if(me==="Menu"){N(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(),h(ge)}return}if(me==="Eye"){C(!g);return}if(me==="Lock"){b(!x);return}if(me==="Light Theme"||me==="Dark Theme"){U(v==="light"?"dark":"light"),N(!1),L(null);return}if(me==="History"){F(!0);return}r(A===ke?null:ke)};Se.slice(0,12);const Pe=Se.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:v==="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"&&U(ge=>ge==="light"?"dark":"light"),N(!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,Me)=>{const _e=ve[ke.key]===ge.label||ge.selected&&ve[ke.key]==null;return a.jsxs("button",{type:"button",onClick:()=>{be(Qe=>({...Qe,[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"})})})]},Me)})})})]})},Ge=v==="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",Me=ge?null:Se[ke],_e=ge?-1:ke;return a.jsxs(Ae.Fragment,{children:[_e===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Qe=Er[$].toolId;r(A===Qe?null:Qe)},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:()=>te(!0),onMouseLeave:()=>te(!1),onMouseDown:Qe=>{Qe.stopPropagation(),q(Ke=>Ke==="line"?null:"line")},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 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 Qe=Lr[ce].toolId;r(A===Qe?null:Qe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
- ${A===Lr[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:Lr[ce].label,children:Lr[ce].icon}),a.jsx("span",{onMouseEnter:()=>se(!0),onMouseLeave:()=>se(!1),onMouseDown:Qe=>{Qe.stopPropagation(),q(Ke=>Ke==="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"})})})]}):ge?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Qe=Mr[le].toolId;r(A===Qe?null:Qe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
- ${A===Mr[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:Mr[le].label,children:Mr[le].icon}),a.jsx("span",{onMouseEnter:()=>de(!0),onMouseLeave:()=>de(!1),onMouseDown:Qe=>{Qe.stopPropagation(),q(Ke=>Ke==="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"})})})]}):_e===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Qe=Hr[we].toolId;r(A===Qe?null:Qe)},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:()=>ye(!0),onMouseLeave:()=>ye(!1),onMouseDown:Qe=>{Qe.stopPropagation(),q(Ke=>Ke==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Ue?10:7,height:Ue?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:()=>fe(_e),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
- ${Me.label==="Grid"&&n||Me.label==="Eye"&&!g||Me.label==="Lock"&&x||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:`${Me.label}: ${Me.description}`,children:Me.icon}),!ge&&Me.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${Ge?"border-slate-200":"border-slate-700"}`})]},ge?"gann-slot":`${Me.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:()=>fe(ge),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
- ${ke.label==="Grid"&&n||ke.label==="Eye"&&!g||ke.label==="Lock"&&x||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(ws,{top:84,panelRef:Ie,isLight:Ge,children:Er.map((ke,me)=>{const ge=$===me;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),V(me),r(ke.toolId),q(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(ws,{top:128,panelRef:Ze,isLight:Ge,children:Lr.map((ke,me)=>{const ge=ce===me;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),X(me),r(ke.toolId),q(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(ws,{top:210,panelRef:ze,isLight:Ge,children:Mr.map((ke,me)=>{const ge=le===me;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),ne(me),r(ke.toolId),q(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(ws,{top:250,panelRef:Ce,isLight:Ge,children:Hr.map((ke,me)=>{const ge=we===me;return a.jsxs("button",{type:"button",onMouseDown:Me=>{Me.stopPropagation(),xe(me),r(ke.toolId),q(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)})}),M&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{N(!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 gT(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 mT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Lt(),o=s==="light",[l,c]=Ae.useState(""),h=e.filter(x=>x.symbol.toLowerCase().includes(l.toLowerCase())),g=h.filter(x=>!x.symbol.toUpperCase().endsWith("USDT")),C=h.filter(x=>x.symbol.toUpperCase().endsWith("USDT"));return a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
9
+ }`,ev=function(i){tv(i,"."+La+qC+Fd+`
10
+ .`+Ma+jC+Fd)},tv=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Ud=(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})(),Av=(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)||(Ia(e)||sv(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 Rt(this,void 0,void 0,function(){var t,A,r,n,s=this;return Ot(this,function(o){switch(o.label){case 0:return t=Ud.isSameOrigin(e),A=!Ha(e)&&this._options.useCORS===!0&&Dt.SUPPORT_CORS_IMAGES&&!t,r=!Ha(e)&&!t&&!Ia(e)&&typeof this._options.proxy=="string"&&Dt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Ha(e)&&!Ia(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 h=new Image;h.onload=function(){return l(h)},h.onerror=c,(ov(n)||A)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return l(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},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 d=new FileReader;d.addEventListener("load",function(){return n(d.result)},!1),d.addEventListener("error",function(y){return s(y)},!1),d.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 h=t._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+r)}}l.send()})},i})(),iv=/^data:image\/svg\+xml/i,rv=/^data:image\/.*;base64,/i,nv=/^data:image\/.*/i,sv=function(i){return Dt.SUPPORT_SVG_DRAWING||!av(i)},Ha=function(i){return nv.test(i)},ov=function(i){return rv.test(i)},Ia=function(i){return i.substr(0,4)==="blob"},av=function(i){return i.substr(-3).toLowerCase()==="svg"||iv.test(i)},Oe=(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 Oe(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=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})(),uA=function(i){return i.type===1},lv=(function(){function i(e){var t=e.styles,A=e.bounds,r=Tr(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=Tr(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],h=Tr(t.borderBottomRightRadius,A.width,A.height),d=h[0],y=h[1],Q=Tr(t.borderBottomLeftRadius,A.width,A.height),b=Q[0],C=Q[1],U=[];U.push((n+l)/A.width),U.push((b+d)/A.width),U.push((s+C)/A.height),U.push((c+y)/A.height);var M=Math.max.apply(Math,U);M>1&&(n/=M,s/=M,l/=M,c/=M,d/=M,y/=M,b/=M,C/=M);var E=A.width-l,I=A.height-y,R=A.width-d,L=A.height-C,O=t.borderTopWidth,Y=t.borderRightWidth,X=t.borderBottomWidth,Ae=t.borderLeftWidth,oe=gt(t.paddingTop,e.bounds.width),W=gt(t.paddingRight,e.bounds.width),ce=gt(t.paddingBottom,e.bounds.width),$=gt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?Bt(A.left+Ae/3,A.top+O/3,n-Ae/3,s-O/3,ht.TOP_LEFT):new Oe(A.left+Ae/3,A.top+O/3),this.topRightBorderDoubleOuterBox=n>0||s>0?Bt(A.left+E,A.top+O/3,l-Y/3,c-O/3,ht.TOP_RIGHT):new Oe(A.left+A.width-Y/3,A.top+O/3),this.bottomRightBorderDoubleOuterBox=d>0||y>0?Bt(A.left+R,A.top+I,d-Y/3,y-X/3,ht.BOTTOM_RIGHT):new Oe(A.left+A.width-Y/3,A.top+A.height-X/3),this.bottomLeftBorderDoubleOuterBox=b>0||C>0?Bt(A.left+Ae/3,A.top+L,b-Ae/3,C-X/3,ht.BOTTOM_LEFT):new Oe(A.left+Ae/3,A.top+A.height-X/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?Bt(A.left+Ae*2/3,A.top+O*2/3,n-Ae*2/3,s-O*2/3,ht.TOP_LEFT):new Oe(A.left+Ae*2/3,A.top+O*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?Bt(A.left+E,A.top+O*2/3,l-Y*2/3,c-O*2/3,ht.TOP_RIGHT):new Oe(A.left+A.width-Y*2/3,A.top+O*2/3),this.bottomRightBorderDoubleInnerBox=d>0||y>0?Bt(A.left+R,A.top+I,d-Y*2/3,y-X*2/3,ht.BOTTOM_RIGHT):new Oe(A.left+A.width-Y*2/3,A.top+A.height-X*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||C>0?Bt(A.left+Ae*2/3,A.top+L,b-Ae*2/3,C-X*2/3,ht.BOTTOM_LEFT):new Oe(A.left+Ae*2/3,A.top+A.height-X*2/3),this.topLeftBorderStroke=n>0||s>0?Bt(A.left+Ae/2,A.top+O/2,n-Ae/2,s-O/2,ht.TOP_LEFT):new Oe(A.left+Ae/2,A.top+O/2),this.topRightBorderStroke=n>0||s>0?Bt(A.left+E,A.top+O/2,l-Y/2,c-O/2,ht.TOP_RIGHT):new Oe(A.left+A.width-Y/2,A.top+O/2),this.bottomRightBorderStroke=d>0||y>0?Bt(A.left+R,A.top+I,d-Y/2,y-X/2,ht.BOTTOM_RIGHT):new Oe(A.left+A.width-Y/2,A.top+A.height-X/2),this.bottomLeftBorderStroke=b>0||C>0?Bt(A.left+Ae/2,A.top+L,b-Ae/2,C-X/2,ht.BOTTOM_LEFT):new Oe(A.left+Ae/2,A.top+A.height-X/2),this.topLeftBorderBox=n>0||s>0?Bt(A.left,A.top,n,s,ht.TOP_LEFT):new Oe(A.left,A.top),this.topRightBorderBox=l>0||c>0?Bt(A.left+E,A.top,l,c,ht.TOP_RIGHT):new Oe(A.left+A.width,A.top),this.bottomRightBorderBox=d>0||y>0?Bt(A.left+R,A.top+I,d,y,ht.BOTTOM_RIGHT):new Oe(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=b>0||C>0?Bt(A.left,A.top+L,b,C,ht.BOTTOM_LEFT):new Oe(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?Bt(A.left+Ae,A.top+O,Math.max(0,n-Ae),Math.max(0,s-O),ht.TOP_LEFT):new Oe(A.left+Ae,A.top+O),this.topRightPaddingBox=l>0||c>0?Bt(A.left+Math.min(E,A.width-Y),A.top+O,E>A.width+Y?0:Math.max(0,l-Y),Math.max(0,c-O),ht.TOP_RIGHT):new Oe(A.left+A.width-Y,A.top+O),this.bottomRightPaddingBox=d>0||y>0?Bt(A.left+Math.min(R,A.width-Ae),A.top+Math.min(I,A.height-X),Math.max(0,d-Y),Math.max(0,y-X),ht.BOTTOM_RIGHT):new Oe(A.left+A.width-Y,A.top+A.height-X),this.bottomLeftPaddingBox=b>0||C>0?Bt(A.left+Ae,A.top+Math.min(L,A.height-X),Math.max(0,b-Ae),Math.max(0,C-X),ht.BOTTOM_LEFT):new Oe(A.left+Ae,A.top+A.height-X),this.topLeftContentBox=n>0||s>0?Bt(A.left+Ae+$,A.top+O+oe,Math.max(0,n-(Ae+$)),Math.max(0,s-(O+oe)),ht.TOP_LEFT):new Oe(A.left+Ae+$,A.top+O+oe),this.topRightContentBox=l>0||c>0?Bt(A.left+Math.min(E,A.width+Ae+$),A.top+O+oe,E>A.width+Ae+$?0:l-Ae+$,c-(O+oe),ht.TOP_RIGHT):new Oe(A.left+A.width-(Y+W),A.top+O+oe),this.bottomRightContentBox=d>0||y>0?Bt(A.left+Math.min(R,A.width-(Ae+$)),A.top+Math.min(I,A.height+O+oe),Math.max(0,d-(Y+W)),y-(X+ce),ht.BOTTOM_RIGHT):new Oe(A.left+A.width-(Y+W),A.top+A.height-(X+ce)),this.bottomLeftContentBox=b>0||C>0?Bt(A.left+Ae+$,A.top+L,Math.max(0,b-(Ae+$)),C-(X+ce),ht.BOTTOM_LEFT):new Oe(A.left+Ae+$,A.top+A.height-(X+ce))}return i})(),ht;(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"})(ht||(ht={}));var Bt=function(i,e,t,A,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,l=i+t,c=e+A;switch(r){case ht.TOP_LEFT:return new ds(new Oe(i,c),new Oe(i,c-o),new Oe(l-s,e),new Oe(l,e));case ht.TOP_RIGHT:return new ds(new Oe(i,e),new Oe(i+s,e),new Oe(l,c-o),new Oe(l,c));case ht.BOTTOM_RIGHT:return new ds(new Oe(l,e),new Oe(l,e+o),new Oe(i+s,c),new Oe(i,c));case ht.BOTTOM_LEFT:default:return new ds(new Oe(l,c),new Oe(l-s,c),new Oe(i,e+o),new Oe(i,e))}},ps=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},cv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},fs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},hv=(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})(),uv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),dv=function(i){return i.type===0},Sd=function(i){return i.type===1},pv=function(i){return i.type===2},Ed=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},fv=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})},Ld=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Md=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new lv(this.container),this.container.styles.opacity<1&&this.effects.push(new uv(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 hv(A,r,n))}if(this.container.styles.overflowX!==0){var s=ps(this.curves),o=fs(this.curves);Ed(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!Sd(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);Ed(s,o)||r.unshift(new gs(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return Et(l.target,e)})},i})(),Pa=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Et(r.flags,4),s=Et(r.flags,2),o=new Md(r,i);Et(r.styles.display,2048)&&A.push(o);var l=Et(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,h=new Ld(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var d=r.styles.zIndex.order;if(d<0){var y=0;c.negativeZIndex.some(function(b,C){return d>b.element.container.styles.zIndex.order?(y=C,!1):y>0}),c.negativeZIndex.splice(y,0,h)}else if(d>0){var Q=0;c.positiveZIndex.some(function(b,C){return d>=b.element.container.styles.zIndex.order?(Q=C+1,!1):Q>0}),c.positiveZIndex.splice(Q,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);Pa(o,h,n?h:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Pa(o,e,t,l);Et(r.flags,8)&&Hd(r,l)})},Hd=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 rd&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Er(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},gv=function(i){var e=new Md(i,null),t=new Ld(e),A=[];return Pa(e,t,t,A),Hd(e.container,A),t},Id=function(i,e){switch(e){case 0:return dA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return dA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return dA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return dA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},mv=function(i,e){switch(e){case 0:return dA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return dA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return dA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return dA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},wv=function(i,e){switch(e){case 0:return dA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return dA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return dA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return dA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},Bv=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 uA(i)?t.push(i.subdivide(.5,!1)):t.push(i),uA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},dA=function(i,e,t,A){var r=[];return uA(i)?r.push(i.subdivide(.5,!1)):r.push(i),uA(t)?r.push(t.subdivide(.5,!0)):r.push(t),uA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),uA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},Pd=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=gt(e.paddingLeft,t.width),r=gt(e.paddingRight,t.width),n=gt(e.paddingTop,t.width),s=gt(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))},yv=function(i,e){return i===0?e.bounds:i===2?ws(e):Pd(e)},Cv=function(i,e){return i===0?e.bounds:i===2?ws(e):Pd(e)},Da=function(i,e,t){var A=yv(Oi(i.styles.backgroundOrigin,e),i),r=Cv(Oi(i.styles.backgroundClip,e),i),n=vv(Oi(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=Tr(Oi(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=xv(Oi(i.styles.backgroundRepeat,e),l,n,A,r),h=Math.round(A.left+l[0]),d=Math.round(A.top+l[1]);return[c,h,d,s,o]},Ni=function(i){return dt(i)&&i.value===Ii.AUTO},Bs=function(i){return typeof i=="number"},vv=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(St(s)&&o&&St(o))return[gt(s,t.width),gt(o,t.height)];var l=Bs(n);if(dt(s)&&(s.value===Ii.CONTAIN||s.value===Ii.COVER)){if(Bs(n)){var c=t.width/t.height;return c<n!=(s.value===Ii.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var h=Bs(A),d=Bs(r),y=h||d;if(Ni(s)&&(!o||Ni(o))){if(h&&d)return[A,r];if(!l&&!y)return[t.width,t.height];if(y&&l){var Q=h?A:r*n,b=d?r:A/n;return[Q,b]}var C=h?A:t.width,U=d?r:t.height;return[C,U]}if(l){var M=0,E=0;return St(s)?M=gt(s,t.width):St(o)&&(E=gt(o,t.height)),Ni(s)?M=E*n:(!o||Ni(o))&&(E=M/n),[M,E]}var I=null,R=null;if(St(s)?I=gt(s,t.width):o&&St(o)&&(R=gt(o,t.height)),I!==null&&(!o||Ni(o))&&(R=h&&d?I/A*r:t.height),R!==null&&Ni(s)&&(I=h&&d?R/r*A:t.width),I!==null&&R!==null)return[I,R];throw new Error("Unable to calculate background-size for element")},Oi=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},xv=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 Oe(Math.round(A.left),Math.round(A.top+s)),new Oe(Math.round(A.left+A.width),Math.round(A.top+s)),new Oe(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Oe(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Oe(Math.round(A.left+n),Math.round(A.top)),new Oe(Math.round(A.left+n+o),Math.round(A.top)),new Oe(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Oe(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Oe(Math.round(A.left+n),Math.round(A.top+s)),new Oe(Math.round(A.left+n+o),Math.round(A.top+s)),new Oe(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Oe(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Oe(Math.round(r.left),Math.round(r.top)),new Oe(Math.round(r.left+r.width),Math.round(r.top)),new Oe(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Oe(Math.round(r.left),Math.round(r.height+r.top))]}},Tv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Dd="Hidden Text",bv=(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=Tv,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(Dd)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Dd)),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})(),_d=(function(){function i(e,t){this.context=e,this.options=t}return i})(),Qv=1e4,Fv=(function(i){wA(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 bv(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(),pv(t)&&(this.ctx.globalAlpha=t.opacity),dv(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)),Sd(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 Rt(this,void 0,void 0,function(){var A;return Ot(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 Rt(this,void 0,void 0,function(){return Ot(this,function(A){switch(A.label){case 0:if(Et(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=xa(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=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 Rt(this,void 0,void 0,function(){var r,n,s,o,l,c,h,d,y=this;return Ot(this,function(Q){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,h=l.middle,d=A.paintOrder,t.textBounds.forEach(function(b){d.forEach(function(C){switch(C){case 0:y.ctx.fillStyle=Ht(A.color),y.renderTextWithLetterSpacing(b,A.letterSpacing,c);var U=A.textShadow;U.length&&b.text.trim().length&&(U.slice(0).reverse().forEach(function(M){y.ctx.shadowColor=Ht(M.color),y.ctx.shadowOffsetX=M.offsetX.number*y.options.scale,y.ctx.shadowOffsetY=M.offsetY.number*y.options.scale,y.ctx.shadowBlur=M.blur.number,y.renderTextWithLetterSpacing(b,A.letterSpacing,c)}),y.ctx.shadowColor="",y.ctx.shadowOffsetX=0,y.ctx.shadowOffsetY=0,y.ctx.shadowBlur=0),A.textDecorationLine.length&&(y.ctx.fillStyle=Ht(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(M){switch(M){case 1:y.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+c),b.bounds.width,1);break;case 2:y.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:y.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+h),b.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&b.text.trim().length&&(y.ctx.strokeStyle=Ht(A.webkitTextStrokeColor),y.ctx.lineWidth=A.webkitTextStrokeWidth,y.ctx.lineJoin=window.chrome?"miter":"round",y.ctx.strokeText(b.text,b.bounds.left,b.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 Rt(this,void 0,void 0,function(){var A,r,n,s,o,l,E,E,c,h,d,y,R,Q,b,L,C,U,M,E,I,R,L;return Ot(this,function(O){switch(O.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,r=t.curves,n=A.styles,s=0,o=A.textNodes,O.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,n)]):[3,4];case 2:O.sent(),O.label=3;case 3:return s++,[3,1];case 4:if(!(A instanceof td))return[3,8];O.label=5;case 5:return O.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return E=O.sent(),this.renderReplacedElement(A,r,E),[3,8];case 7:return O.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Ad&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof id))return[3,12];O.label=9;case 9:return O.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return E=O.sent(),this.renderReplacedElement(A,r,E),[3,12];case 11:return O.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof ad&&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:h=O.sent(),A.width&&A.height&&this.ctx.drawImage(h,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),O.label=14;case 14:if(A instanceof ba&&(d=Math.min(A.bounds.width,A.bounds.height),A.type===os?A.checked&&(this.ctx.save(),this.path([new Oe(A.bounds.left+d*.39363,A.bounds.top+d*.79),new Oe(A.bounds.left+d*.16,A.bounds.top+d*.5549),new Oe(A.bounds.left+d*.27347,A.bounds.top+d*.44071),new Oe(A.bounds.left+d*.39694,A.bounds.top+d*.5649),new Oe(A.bounds.left+d*.72983,A.bounds.top+d*.23),new Oe(A.bounds.left+d*.84,A.bounds.top+d*.34085),new Oe(A.bounds.left+d*.39363,A.bounds.top+d*.79)]),this.ctx.fillStyle=Ht(nd),this.ctx.fill(),this.ctx.restore()):A.type===as&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+d/2,A.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ht(nd),this.ctx.fill(),this.ctx.restore())),Uv(A)&&A.value.length){switch(y=this.createFontStyle(n),R=y[0],Q=y[1],b=this.fontMetrics.getMetrics(R,Q).baseline,this.ctx.font=R,this.ctx.fillStyle=Ht(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Ev(A.styles.textAlign),L=ws(A),C=0,A.styles.textAlign){case 1:C+=L.width/2;break;case 2:C+=L.width;break}U=L.add(C,0,0,-L.height/2+1),this.ctx.save(),this.path([new Oe(L.left,L.top),new Oe(L.left+L.width,L.top),new Oe(L.left+L.width,L.top+L.height),new Oe(L.left,L.top+L.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Ur(A.value,U),n.letterSpacing,b),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Et(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(M=A.styles.listStyleImage,M.type!==0)return[3,18];E=void 0,I=M.url,O.label=15;case 15:return O.trys.push([15,17,,18]),[4,this.context.cache.match(I)];case 16:return E=O.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.bounds.top),[3,18];case 17:return O.sent(),this.context.logger.error("Error loading list-style-image "+I),[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=Ht(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",L=new DA(A.bounds.left,A.bounds.top+gt(A.styles.paddingTop,A.bounds.width),A.bounds.width,Du(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Ur(t.listValue,L),n.letterSpacing,Du(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),O.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return Rt(this,void 0,void 0,function(){var A,r,M,n,s,M,o,l,M,c,h,M,d,y,M,Q,b,M,C,U,M;return Ot(this,function(E){switch(E.label){case 0:if(Et(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?(M=r[A],[4,this.renderStack(M)]):[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?(M=s[n],[4,this.renderNode(M)]):[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?(M=l[o],[4,this.renderStack(M)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,E.label=15;case 15:return c<h.length?(M=h[c],[4,this.renderStack(M)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:d=0,y=t.inlineLevel,E.label=19;case 19:return d<y.length?(M=y[d],[4,this.renderNode(M)]):[3,22];case 20:E.sent(),E.label=21;case 21:return d++,[3,19];case 22:Q=0,b=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return Q<b.length?(M=b[Q],[4,this.renderStack(M)]):[3,26];case 24:E.sent(),E.label=25;case 25:return Q++,[3,23];case 26:C=0,U=t.positiveZIndex,E.label=27;case 27:return C<U.length?(M=U[C],[4,this.renderStack(M)]):[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=uA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),uA(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 Rt(this,void 0,void 0,function(){var A,r,n,s,o,l;return Ot(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(h){var d,y,Q,oe,ee,Z,$,Be,X,b,oe,ee,Z,$,Be,C,U,M,E,I,R,L,O,Y,X,Ae,oe,W,ce,$,Be,Ce,ee,Z,re,fe,we,ve,xe,me,Se,He;return Ot(this,function(Ee){switch(Ee.label){case 0:if(h.type!==0)return[3,5];d=void 0,y=h.url,Ee.label=1;case 1:return Ee.trys.push([1,3,,4]),[4,n.context.cache.match(y)];case 2:return d=Ee.sent(),[3,4];case 3:return Ee.sent(),n.context.logger.error("Error loading background-image "+y),[3,4];case 4:return d&&(Q=Da(t,A,[d.width,d.height,d.width/d.height]),oe=Q[0],ee=Q[1],Z=Q[2],$=Q[3],Be=Q[4],X=n.ctx.createPattern(n.resizeImage(d,$,Be),"repeat"),n.renderRepeat(oe,X,ee,Z)),[3,6];case 5:d2(h)?(b=Da(t,A,[null,null,null]),oe=b[0],ee=b[1],Z=b[2],$=b[3],Be=b[4],C=a2(h.angle,$,Be),U=C[0],M=C[1],E=C[2],I=C[3],R=C[4],L=document.createElement("canvas"),L.width=$,L.height=Be,O=L.getContext("2d"),Y=O.createLinearGradient(M,I,E,R),bu(h.stops,U).forEach(function(_e){return Y.addColorStop(_e.stop,Ht(_e.color))}),O.fillStyle=Y,O.fillRect(0,0,$,Be),$>0&&Be>0&&(X=n.ctx.createPattern(L,"repeat"),n.renderRepeat(oe,X,ee,Z))):p2(h)&&(Ae=Da(t,A,[null,null,null]),oe=Ae[0],W=Ae[1],ce=Ae[2],$=Ae[3],Be=Ae[4],Ce=h.position.length===0?[aa]:h.position,ee=gt(Ce[0],$),Z=gt(Ce[Ce.length-1],Be),re=l2(h,ee,Z,$,Be),fe=re[0],we=re[1],fe>0&&we>0&&(ve=n.ctx.createRadialGradient(W+ee,ce+Z,0,W+ee,ce+Z,fe),bu(h.stops,fe*2).forEach(function(_e){return ve.addColorStop(_e.stop,Ht(_e.color))}),n.path(oe),n.ctx.fillStyle=ve,fe!==we?(xe=t.bounds.left+.5*t.bounds.width,me=t.bounds.top+.5*t.bounds.height,Se=we/fe,He=1/Se,n.ctx.save(),n.ctx.translate(xe,me),n.ctx.transform(1,0,0,Se,0,0),n.ctx.translate(-xe,-me),n.ctx.fillRect(W,He*(ce-me)+me,$,Be*He),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 Rt(this,void 0,void 0,function(){return Ot(this,function(n){return this.path(Id(r,A)),this.ctx.fillStyle=Ht(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return Rt(this,void 0,void 0,function(){var s,o;return Ot(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=mv(n,r),this.path(s),this.ctx.fillStyle=Ht(t),this.ctx.fill(),o=wv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Rt(this,void 0,void 0,function(){var A,r,n,s,o,l,c,h,d=this;return Ot(this,function(y){switch(y.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!ZA(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=Sv(Oi(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),ZA(A.backgroundColor)||(this.ctx.fillStyle=Ht(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(Q){d.ctx.save();var b=ps(t.curves),C=Q.inset?0:Qv,U=fv(b,-C+(Q.inset?1:-1)*Q.spread.number,(Q.inset?1:-1)*Q.spread.number,Q.spread.number*(Q.inset?-2:2),Q.spread.number*(Q.inset?-2:2));Q.inset?(d.path(b),d.ctx.clip(),d.mask(U)):(d.mask(b),d.ctx.clip(),d.path(U)),d.ctx.shadowOffsetX=Q.offsetX.number+C,d.ctx.shadowOffsetY=Q.offsetY.number,d.ctx.shadowColor=Ht(Q.color),d.ctx.shadowBlur=Q.blur.number,d.ctx.fillStyle=Q.inset?Ht(Q.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),y.label=2;case 2:o=0,l=0,c=n,y.label=3;case 3:return l<c.length?(h=c[l],h.style!==0&&!ZA(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return y.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return y.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return y.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.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 Rt(this,void 0,void 0,function(){var o,l,c,h,d,y,Q,b,C,U,M,E,I,R,L,O,L,O;return Ot(this,function(Y){return this.ctx.save(),o=Bv(n,r),l=Id(n,r),s===2&&(this.path(l),this.ctx.clip()),uA(l[0])?(c=l[0].start.x,h=l[0].start.y):(c=l[0].x,h=l[0].y),uA(l[1])?(d=l[1].end.x,y=l[1].end.y):(d=l[1].x,y=l[1].y),r===0||r===2?Q=Math.abs(c-d):Q=Math.abs(h-y),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),b=A<3?A*3:A*2,C=A<3?A*2:A,s===3&&(b=A,C=A),U=!0,Q<=b*2?U=!1:Q<=b*2+C?(M=Q/(2*b+C),b*=M,C*=M):(E=Math.floor((Q+C)/(b+C)),I=(Q-E*b)/(E-1),R=(Q-(E+1)*b)/E,C=R<=0||Math.abs(C-I)<Math.abs(C-R)?I:R),U&&(s===3?this.ctx.setLineDash([0,b+C]):this.ctx.setLineDash([b,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=Ht(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(uA(l[0])&&(L=l[3],O=l[0],this.ctx.beginPath(),this.formatPath([new Oe(L.end.x,L.end.y),new Oe(O.start.x,O.start.y)]),this.ctx.stroke()),uA(l[1])&&(L=l[1],O=l[2],this.ctx.beginPath(),this.formatPath([new Oe(L.end.x,L.end.y),new Oe(O.start.x,O.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Rt(this,void 0,void 0,function(){var A;return Ot(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ht(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=gv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(_d),Uv=function(i){return i instanceof od||i instanceof sd?!0:i instanceof ba&&i.type!==as&&i.type!==os},Sv=function(i,e){switch(i){case 0:return ps(e);case 2:return cv(e);default:return fs(e)}},Ev=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},Lv=["-apple-system","system-ui"],Mv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return Lv.indexOf(e)===-1}):i},Hv=(function(i){wA(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 Rt(this,void 0,void 0,function(){var A,r;return Ot(this,function(n){switch(n.label){case 0:return A=va(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Iv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ht(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})(_d),Iv=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Pv=(function(){function i(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return i.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,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})(),Dv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Pv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new Av(this,e)}return i.instanceCount=1,i})(),_v=function(i,e){return e===void 0&&(e={}),kv(i,e)};typeof window<"u"&&Ud.setContext(window);var kv=function(i,e){return Rt(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,h,d,y,Q,b,C,U,M,E,I,R,L,Y,O,Y,X,Ae,oe,W,ce,$,Be,Ce,ee,Z,re,fe,we,ve,xe,me,Se;return Ot(this,function(He){switch(He.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,imageTimeout:(Ae=e.imageTimeout)!==null&&Ae!==void 0?Ae:15e3,proxy:e.proxy,useCORS:(oe=e.useCORS)!==null&&oe!==void 0?oe:!1},n=Ko({logging:(W=e.logging)!==null&&W!==void 0?W:!0,cache:e.cache},r),s={windowWidth:(ce=e.windowWidth)!==null&&ce!==void 0?ce:A.innerWidth,windowHeight:($=e.windowHeight)!==null&&$!==void 0?$:A.innerHeight,scrollX:(Be=e.scrollX)!==null&&Be!==void 0?Be:A.pageXOffset,scrollY:(Ce=e.scrollY)!==null&&Ce!==void 0?Ce:A.pageYOffset},o=new DA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new Dv(n,o),c=(ee=e.foreignObjectRendering)!==null&&ee!==void 0?ee:!1,h={allowTaint:(Z=e.allowTaint)!==null&&Z!==void 0?Z:!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),d=new Qd(l,i,h),y=d.clonedReferenceElement,y?[4,d.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return Q=He.sent(),b=Fa(y)||NC(y)?fw(y.ownerDocument):Un(l,y),C=b.width,U=b.height,M=b.left,E=b.top,I=Nv(l,y,e.backgroundColor),R={canvas:e.canvas,backgroundColor:I,scale:(fe=(re=e.scale)!==null&&re!==void 0?re:A.devicePixelRatio)!==null&&fe!==void 0?fe:1,x:((we=e.x)!==null&&we!==void 0?we:0)+M,y:((ve=e.y)!==null&&ve!==void 0?ve:0)+E,width:(xe=e.width)!==null&&xe!==void 0?xe:Math.ceil(C),height:(me=e.height)!==null&&me!==void 0?me:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),Y=new Hv(l,R),[4,Y.render(y)]):[3,3];case 2:return L=He.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+M+","+E+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),O=cd(l,y),I===O.styles.backgroundColor&&(O.styles.backgroundColor=kA.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),Y=new Fv(l,R),[4,Y.render(O)];case 4:L=He.sent(),He.label=5;case 5:return(!((Se=e.removeContainer)!==null&&Se!==void 0)||Se)&&(Qd.destroy(Q)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,L]}})})},Nv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?br(i,getComputedStyle(A.documentElement).backgroundColor):kA.TRANSPARENT,n=A.body?br(i,getComputedStyle(A.body).backgroundColor):kA.TRANSPARENT,s=typeof t=="string"?br(i,t):t===null?kA.TRANSPARENT:4294967295;return e===A.documentElement?ZA(r)?ZA(n)?s:n:r:s};const Ov={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class Kv{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,h=n._series;if(!c||!h)return;const d=h.priceToCoordinate(n.price);if(d==null)return;const y=Math.round(d*o.verticalPixelRatio),Q=c.timeScale().timeToCoordinate(n.originTime),b=Q==null?0:Math.max(0,Math.round(Q*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(b>=C)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(b,y),l.lineTo(C,y),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(b,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 kd{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 h=Math.round(A.fontSize*l);n.font=`${h}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const d=Math.round(8*o),y=Math.round(14*l),Q=s.width;let b;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const M=A._chart.timeScale().timeToCoordinate(A.originTime);b=M!=null?Math.round(M*o):d,n.textAlign="right"}else b=d,n.textAlign="left";else A.hAlign==="right"?(b=Q-d,n.textAlign="right"):(b=Q/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,b,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Vv{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,h=s._series;if(!c||!h)return;const d=l.horizontalPixelRatio,y=l.verticalPixelRatio,Q=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=h.priceToCoordinate(s.p1.price),U=h.priceToCoordinate(s.p2.price);if(Q==null||b==null||C==null||U==null)return;const M=Math.round(Q*d),E=Math.round(C*y),I=Math.round(b*d),R=Math.round(U*y),L=l.context;if(L.save(),L.beginPath(),L.strokeStyle=s.color,L.lineWidth=s.lineWidth*y,L.setLineDash([]),L.moveTo(M,E),L.lineTo(I,R),L.stroke(),L.beginPath(),L.fillStyle=s.color,L.arc(M,E,3*y,0,Math.PI*2),L.fill(),L.beginPath(),L.arc(I,R,3*y,0,Math.PI*2),L.fill(),!s.statsShowAlways&&!s.isActive){L.restore();return}const{priceDiff:O,pricePct:Y,bars:X,days:Ae,angle:oe}=s.info,W=O>=0?"+":"",ce=[];if(s.statsPriceRange!==!1&&ce.push(`${W}${O.toFixed(5)} (${W}${Y.toFixed(2)}%)`),s.statsBarsRange!==!1&&ce.push(`${X} bars`),s.statsDateRange!==!1&&ce.push(`${Ae} days`),s.statsAngle!==!1&&ce.push(`∠ ${oe.toFixed(1)}°`),s.statsDistance&&ce.push(`Δ ${Math.abs(O).toFixed(5)}`),ce.length===0){L.restore();return}const $=Math.round(11*y);L.font=`${$}px sans-serif`;const Be=$*1.6,Ce=8*y,ee=Math.max(...ce.map(Qe=>L.measureText(Qe).width))+Ce*2,Z=ce.length*Be+Ce*2,re=s.statsPosition??"right";let fe,we;re==="left"?(fe=M,we=E):re==="center"?(fe=Math.round((M+I)/2),we=Math.round((E+R)/2)):(fe=I,we=R);let ve,xe;re==="left"?(ve=fe-ee-10*d,xe=we-Z-4*y):re==="center"?(ve=fe-ee/2,xe=we-Z-8*y):(ve=fe+10*d,xe=we-Z-4*y);const me=l.bitmapSize.width,Se=l.bitmapSize.height,He=Math.min(Math.max(0,ve),me-ee-4*d),Ee=Math.min(Math.max(4*y,xe),Se-Z-4*y),_e=4*y;L.beginPath(),L.moveTo(He+_e,Ee),L.lineTo(He+ee-_e,Ee),L.quadraticCurveTo(He+ee,Ee,He+ee,Ee+_e),L.lineTo(He+ee,Ee+Z-_e),L.quadraticCurveTo(He+ee,Ee+Z,He+ee-_e,Ee+Z),L.lineTo(He+_e,Ee+Z),L.quadraticCurveTo(He,Ee+Z,He,Ee+Z-_e),L.lineTo(He,Ee+_e),L.quadraticCurveTo(He,Ee,He+_e,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",ce.forEach((Qe,Ie)=>{L.fillText(Qe,He+Ce,Ee+Ce+$+Ie*Be)}),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 Nd{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,h=s._series;if(!c||!h)return;const d=l.horizontalPixelRatio,y=l.verticalPixelRatio,Q=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),b=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=h.priceToCoordinate(s.p1.price),U=h.priceToCoordinate(s.p2.price);if(Q==null||b==null||C==null||U==null)return;const M=Math.round(Q*d),E=Math.round(C*y),I=Math.round(b*d),R=Math.round(U*y),L=s.lineColor??s.color,O=l.context;if(O.save(),s.showArea&&(O.fillStyle=s.fillColor,O.fillRect(Math.min(M,I),Math.min(E,R),Math.abs(I-M),Math.abs(R-E)),O.strokeStyle=L,O.lineWidth=1*y,O.setLineDash([]),O.strokeRect(Math.min(M,I),Math.min(E,R),Math.abs(I-M),Math.abs(R-E))),O.beginPath(),O.strokeStyle=L,O.lineWidth=2*y,O.moveTo(M,E),O.lineTo(I,R),O.stroke(),O.fillStyle=L,O.beginPath(),O.arc(M,E,3*y,0,Math.PI*2),O.fill(),O.beginPath(),O.arc(I,R,3*y,0,Math.PI*2),O.fill(),!s.statsShowAlways&&!s.isActive){O.restore();return}const{priceDiff:Y,pricePct:X,bars:Ae,days:oe}=s.info,W=Y>=0?"+":"",ce=[];if(s.statsPriceRange&&ce.push(W+Y.toFixed(5)+" ("+W+X.toFixed(2)+"%)"),s.statsBarsRange&&ce.push(Ae+" bars"),s.statsDateRange&&ce.push(oe+" days"),ce.length===0){O.restore();return}const $=Math.round(11*y);O.font=$+"px sans-serif";const Be=$*1.6,Ce=8*y,ee=Math.max(...ce.map(He=>O.measureText(He).width))+Ce*2,Z=ce.length*Be+Ce*2,re=l.bitmapSize.width,fe=l.bitmapSize.height;let we,ve;if(s.statsPosition==="left")we=M-ee-10*d,ve=E-Z-4*y;else if(s.statsPosition==="center"){const He=(M+I)/2,Ee=(E+R)/2;we=He-ee/2,ve=Ee-Z-4*y}else we=I+10*d,ve=R-Z-4*y;const xe=Math.min(Math.max(0,we),re-ee-4*d),me=Math.min(Math.max(4*y,ve),fe-Z-4*y),Se=4*y;O.beginPath(),O.moveTo(xe+Se,me),O.lineTo(xe+ee-Se,me),O.quadraticCurveTo(xe+ee,me,xe+ee,me+Se),O.lineTo(xe+ee,me+Z-Se),O.quadraticCurveTo(xe+ee,me+Z,xe+ee-Se,me+Z),O.lineTo(xe+Se,me+Z),O.quadraticCurveTo(xe,me+Z,xe,me+Z-Se),O.lineTo(xe,me+Se),O.quadraticCurveTo(xe,me,xe+Se,me),O.closePath(),O.fillStyle="rgba(30, 41, 59, 0.92)",O.fill(),O.strokeStyle=s.statsColor||L,O.lineWidth=1*y,O.stroke(),O.fillStyle="#e2e8f0",O.textAlign="left",ce.forEach((He,Ee)=>{O.fillText(He,xe+Ce,me+Ce+$+Ee*Be)}),O.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class zv{constructor(e,t,A={}){this.p1=e,this.p2=t,this.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,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),Q=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=Math.min(d,y)*c,U=Math.max(d,y)*c,M=Math.min(Q,b)*h,E=Math.max(Q,b)*h,I=U-C,R=E-M;if(I<.5||R<.5)return;const L=s.context;L.save(),L.fillStyle=r.fillColor,L.fillRect(C,M,I,R),L.strokeStyle=r.strokeColor,L.lineWidth=r.lineWidth*h,L.setLineDash([]),L.strokeRect(C,M,I,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 Wv{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,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),Q=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=d*c,U=y*h,M=Q*c,E=b*h,I=Math.hypot(M-C,E-U);if(I<.5)return;const R=s.context;R.save(),R.strokeStyle=r.strokeColor,R.lineWidth=r.lineWidth*h,R.setLineDash([]),R.beginPath(),R.arc(C,U,I,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 Rv{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 h=o.horizontalPixelRatio,d=o.verticalPixelRatio,y=l.timeScale().timeToCoordinate(n.p1.rawTime),Q=c.priceToCoordinate(n.p1.price),b=l.timeScale().timeToCoordinate(n.p2.rawTime),C=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),M=c.priceToCoordinate(n.p3.price);if(y==null||Q==null||b==null||C==null||U==null||M==null)return;const E=y*h,I=Q*d,R=b*h,L=C*d,O=U*h,Y=M*d,X=o.context;X.save(),X.beginPath(),X.moveTo(E,I),X.lineTo(R,L),X.lineTo(O,Y),X.closePath(),X.fillStyle=n.fillColor,X.fill(),X.strokeStyle=n.strokeColor,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.stroke(),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Gv{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,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),Q=o.timeScale().timeToCoordinate(r.p2.rawTime),b=l.priceToCoordinate(r.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=d*c,U=y*h,M=Q*c,E=b*h,I=M-C,R=E-U,L=Math.hypot(I,R);if(L<.5)return;const O=s.context;if(O.save(),O.strokeStyle=r.strokeColor,O.lineWidth=r.lineWidth*h,O.setLineDash([]),r.previewAsLine)O.beginPath(),O.moveTo(C,U),O.lineTo(M,E),O.stroke();else{const Y=(C+M)/2,X=(U+E)/2,Ae=Math.atan2(R,I),oe=L/2,W=Math.max(1,oe*Math.max(.05,r.minorRatio));O.beginPath(),O.ellipse(Y,X,oe,W,Ae,0,Math.PI*2),O.stroke()}O.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Od{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,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),Q=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=Math.round(d*c),U=Math.round(Q*h),M=Math.round(y*c),E=Math.round(b*h),I=M-C,R=E-U,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*h,L.setLineDash([]);const O=Math.abs(I)<1e-4?0:R/I;if(r.rayLeft){const ce=U+O*(0-C);L.beginPath(),L.moveTo(0,ce),L.lineTo(C,U),L.stroke()}if(r.rayRight){const W=s.bitmapSize.width,ce=E+O*(W-M);L.beginPath(),L.moveTo(M,E),L.lineTo(W,ce),L.stroke()}L.beginPath(),L.moveTo(C,U),L.lineTo(M,E),L.stroke();const Y=Math.atan2(E-U,M-C),X=(r.lineWidth*4+4)*h,Ae=Math.PI/7;if(r.arrowRight){const W=M-X*Math.cos(Y-Ae),ce=E-X*Math.sin(Y-Ae),$=M-X*Math.cos(Y+Ae),Be=E-X*Math.sin(Y+Ae);L.beginPath(),L.moveTo(M,E),L.lineTo(W,ce),L.lineTo($,Be),L.closePath(),L.fill()}if(r.arrowLeft){const W=Y+Math.PI,ce=C-X*Math.cos(W-Ae),$=U-X*Math.sin(W-Ae),Be=C-X*Math.cos(W+Ae),Ce=U-X*Math.sin(W+Ae);L.beginPath(),L.moveTo(C,U),L.lineTo(ce,$),L.lineTo(Be,Ce),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const W=r.p1.rawTime,ce=r.p2.rawTime,$=r.p1.price,Be=r.p2.price,Ce=[];if(r.statsPriceRange){const Z=Math.abs(Be-$),re=$!==0?Math.abs((Be-$)/$*100):0,fe=Z<1e-4?6:Z<.01?5:Z<1?4:2;Ce.push("↕ "+Z.toFixed(fe)+" ("+re.toFixed(2)+"%)")}const ee=[];if(r.statsBarsRange)try{const Z=o.timeScale().timeToCoordinate(W),re=o.timeScale().timeToCoordinate(ce);if(Z!=null&&re!=null){const fe=o.timeScale().coordinateToLogical(Z),we=o.timeScale().coordinateToLogical(re);fe!=null&&we!=null&&ee.push("↔ "+Math.abs(Math.round(we-fe))+" bars")}}catch{}if(r.statsDateRange){const Z=Math.abs(ce-W),re=Math.floor(Z/86400),fe=Math.floor(Z%86400/3600),we=Math.floor(Z%3600/60);let ve=re>0?re+" day"+(re!==1?"s":""):"";fe>0&&(ve+=(ve?" ":"")+fe+" hour"+(fe!==1?"s":"")),!re&&!fe&&(ve=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ee.length>0?ee[ee.length-1]+=" ("+ve+")":ee.push(ve)}if(r.statsDistance){const Z=I/c,re=R/h;ee.push("distance: "+Math.sqrt(Z*Z+re*re).toFixed(2))}if(ee.length>0&&Ce.push(ee.join(", ")),r.statsAngle){const Z=I/c,re=R/h,fe=Math.atan2(re,Z)*180/Math.PI;Ce.push("∠ "+fe.toFixed(0)+"°")}if(Ce.length>0){const Z=Math.min(c,h),re=11*Z,fe=re*1.5,we=5*Z;L.font=re+"px sans-serif";const xe=Ce.reduce((Te,it)=>Math.max(Te,L.measureText(it).width),0)+we*2,me=Ce.length*fe+we*2,[Se,He,Ee,_e]=C<=M?[C,U,M,E]:[M,E,C,U];let Qe,Ie;r.statsPosition==="left"?(Qe=Se,Ie=He):r.statsPosition==="center"?(Qe=(Se+Ee)/2,Ie=(He+_e)/2):(Qe=Ee,Ie=_e);const Ze=Qe-xe/2,We=Ie-me-12*Z;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(Ze,We,xe,me),L.strokeStyle=r.statsColor,L.lineWidth=1*Z,L.strokeRect(Ze,We,xe,me),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",Ce.forEach((Te,it)=>{L.fillText(Te,Ze+we,We+we+it*fe)})}}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 $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,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),Q=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=Math.round(d*c),U=Math.round(Q*h),M=Math.round(y*c),E=Math.round(b*h),I=M-C,R=E-U,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*h,L.setLineDash([]);const O=Math.abs(I)<1e-4?0:R/I;if(r.rayLeft){const ce=U+O*(0-C);L.beginPath(),L.moveTo(0,ce),L.lineTo(C,U),L.stroke()}if(r.rayRight){const W=s.bitmapSize.width,ce=E+O*(W-M);L.beginPath(),L.moveTo(M,E),L.lineTo(W,ce),L.stroke()}L.beginPath(),L.moveTo(C,U),L.lineTo(M,E),L.stroke();const Y=Math.atan2(E-U,M-C),X=(r.lineWidth*4+4)*h,Ae=Math.PI/7;if(r.arrowRight){const W=M-X*Math.cos(Y-Ae),ce=E-X*Math.sin(Y-Ae),$=M-X*Math.cos(Y+Ae),Be=E-X*Math.sin(Y+Ae);L.beginPath(),L.moveTo(M,E),L.lineTo(W,ce),L.lineTo($,Be),L.closePath(),L.fill()}if(r.arrowLeft){const W=Y+Math.PI,ce=C-X*Math.cos(W-Ae),$=U-X*Math.sin(W-Ae),Be=C-X*Math.cos(W+Ae),Ce=U-X*Math.sin(W+Ae);L.beginPath(),L.moveTo(C,U),L.lineTo(ce,$),L.lineTo(Be,Ce),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const W=r.p1.rawTime,ce=r.p2.rawTime,$=r.p1.price,Be=r.p2.price,Ce=[];if(r.statsPriceRange){const Z=Math.abs(Be-$),re=$!==0?Math.abs((Be-$)/$*100):0,fe=Z<1e-4?6:Z<.01?5:Z<1?4:2;Ce.push("↕ "+Z.toFixed(fe)+" ("+re.toFixed(2)+"%)")}const ee=[];if(r.statsBarsRange)try{const Z=o.timeScale().timeToCoordinate(W),re=o.timeScale().timeToCoordinate(ce);if(Z!=null&&re!=null){const fe=o.timeScale().coordinateToLogical(Z),we=o.timeScale().coordinateToLogical(re);fe!=null&&we!=null&&ee.push("↔ "+Math.abs(Math.round(we-fe))+" bars")}}catch{}if(r.statsDateRange){const Z=Math.abs(ce-W),re=Math.floor(Z/86400),fe=Math.floor(Z%86400/3600),we=Math.floor(Z%3600/60);let ve=re>0?re+" day"+(re!==1?"s":""):"";fe>0&&(ve+=(ve?" ":"")+fe+" hour"+(fe!==1?"s":"")),!re&&!fe&&(ve=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ee.length>0?ee[ee.length-1]+=" ("+ve+")":ee.push(ve)}if(r.statsDistance){const Z=I/c,re=R/h;ee.push("distance: "+Math.sqrt(Z*Z+re*re).toFixed(2))}if(ee.length>0&&Ce.push(ee.join(", ")),r.statsAngle){const Z=I/c,re=R/h,fe=Math.atan2(re,Z)*180/Math.PI;Ce.push("∠ "+fe.toFixed(0)+"°")}if(Ce.length>0){const Z=Math.min(c,h),re=11*Z,fe=re*1.5,we=5*Z;L.font=re+"px sans-serif";const xe=Ce.reduce((Te,it)=>Math.max(Te,L.measureText(it).width),0)+we*2,me=Ce.length*fe+we*2,[Se,He,Ee,_e]=C<=M?[C,U,M,E]:[M,E,C,U];let Qe,Ie;r.statsPosition==="left"?(Qe=Se,Ie=He):r.statsPosition==="center"?(Qe=(Se+Ee)/2,Ie=(He+_e)/2):(Qe=Ee,Ie=_e);const Ze=Qe-xe/2,We=Ie-me-12*Z;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(Ze,We,xe,me),L.strokeStyle=r.statsColor,L.lineWidth=1*Z,L.strokeRect(Ze,We,xe,me),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",Ce.forEach((Te,it)=>{L.fillText(Te,Ze+we,We+we+it*fe)})}}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 Xv{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,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),Q=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=Math.round(d*c),U=Math.round(Q*h),M=Math.round(y*c),E=Math.round(b*h),I=M-C,R=E-U,L=s.context;L.save(),L.strokeStyle=r.color,L.fillStyle=r.color,L.lineWidth=r.lineWidth*h,L.setLineDash([]);const O=Math.abs(I)<1e-4?0:R/I;if(r.rayLeft){const ce=U+O*(0-C);L.beginPath(),L.moveTo(0,ce),L.lineTo(C,U),L.stroke()}if(r.rayRight){const W=s.bitmapSize.width,ce=E+O*(W-M);L.beginPath(),L.moveTo(M,E),L.lineTo(W,ce),L.stroke()}L.beginPath(),L.moveTo(C,U),L.lineTo(M,E),L.stroke();const Y=Math.atan2(E-U,M-C),X=(r.lineWidth*4+4)*h,Ae=Math.PI/7;if(r.arrowRight){const W=M-X*Math.cos(Y-Ae),ce=E-X*Math.sin(Y-Ae),$=M-X*Math.cos(Y+Ae),Be=E-X*Math.sin(Y+Ae);L.beginPath(),L.moveTo(M,E),L.lineTo(W,ce),L.lineTo($,Be),L.closePath(),L.fill()}if(r.arrowLeft){const W=Y+Math.PI,ce=C-X*Math.cos(W-Ae),$=U-X*Math.sin(W-Ae),Be=C-X*Math.cos(W+Ae),Ce=U-X*Math.sin(W+Ae);L.beginPath(),L.moveTo(C,U),L.lineTo(ce,$),L.lineTo(Be,Ce),L.closePath(),L.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const W=r.p1.rawTime,ce=r.p2.rawTime,$=r.p1.price,Be=r.p2.price,Ce=[];if(r.statsPriceRange){const Z=Math.abs(Be-$),re=$!==0?Math.abs((Be-$)/$*100):0,fe=Z<1e-4?6:Z<.01?5:Z<1?4:2;Ce.push("↕ "+Z.toFixed(fe)+" ("+re.toFixed(2)+"%)")}const ee=[];if(r.statsBarsRange)try{const Z=o.timeScale().timeToCoordinate(W),re=o.timeScale().timeToCoordinate(ce);if(Z!=null&&re!=null){const fe=o.timeScale().coordinateToLogical(Z),we=o.timeScale().coordinateToLogical(re);fe!=null&&we!=null&&ee.push("↔ "+Math.abs(Math.round(we-fe))+" bars")}}catch{}if(r.statsDateRange){const Z=Math.abs(ce-W),re=Math.floor(Z/86400),fe=Math.floor(Z%86400/3600),we=Math.floor(Z%3600/60);let ve=re>0?re+" day"+(re!==1?"s":""):"";fe>0&&(ve+=(ve?" ":"")+fe+" hour"+(fe!==1?"s":"")),!re&&!fe&&(ve=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ee.length>0?ee[ee.length-1]+=" ("+ve+")":ee.push(ve)}if(r.statsDistance){const Z=I/c,re=R/h;ee.push("distance: "+Math.sqrt(Z*Z+re*re).toFixed(2))}if(ee.length>0&&Ce.push(ee.join(", ")),r.statsAngle){const Z=I/c,re=R/h,fe=Math.atan2(re,Z)*180/Math.PI;Ce.push("∠ "+fe.toFixed(0)+"°")}if(Ce.length>0){const Z=Math.min(c,h),re=11*Z,fe=re*1.5,we=5*Z;L.font=re+"px sans-serif";const xe=Ce.reduce((Te,it)=>Math.max(Te,L.measureText(it).width),0)+we*2,me=Ce.length*fe+we*2,[Se,He,Ee,_e]=C<=M?[C,U,M,E]:[M,E,C,U];let Qe,Ie;r.statsPosition==="left"?(Qe=Se,Ie=He):r.statsPosition==="center"?(Qe=(Se+Ee)/2,Ie=(He+_e)/2):(Qe=Ee,Ie=_e);const Ze=Qe-xe/2,We=Ie-me-12*Z;L.fillStyle="rgba(20, 20, 30, 0.72)",L.fillRect(Ze,We,xe,me),L.strokeStyle=r.statsColor,L.lineWidth=1*Z,L.strokeRect(Ze,We,xe,me),L.fillStyle=r.statsColor,L.textBaseline="top",L.textAlign="left",Ce.forEach((Te,it)=>{L.fillText(Te,Ze+we,We+we+it*fe)})}}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 Zv{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 h=n._chart,d=n._series;if(!h||!d)return;const y=o.horizontalPixelRatio,Q=o.verticalPixelRatio,b=h.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),C=h.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=d.priceToCoordinate(n.p1.price),M=d.priceToCoordinate(n.p2.price);if(b==null||C==null||U==null||M==null)return;const E=b*y,I=U*Q,R=C*y,L=M*Q,[O,Y,X,Ae]=E<=R?[E,I,R,L]:[R,L,E,I];let oe=X-O,W=Ae-Y;Math.abs(oe)<1e-4&&(oe=1e-4);const ce=W/oe,$=o.context;if($.save(),$.strokeStyle=n.color,$.fillStyle=n.color,$.lineWidth=n.lineWidth*Q,$.setLineDash([]),n.rayLeft){const re=Y+ce*(0-O);$.beginPath(),$.moveTo(0,re),$.lineTo(O,Y),$.stroke()}if(n.rayRight){const Z=o.bitmapSize.width,re=Ae+ce*(Z-X);$.beginPath(),$.moveTo(X,Ae),$.lineTo(Z,re),$.stroke()}const Be=Math.atan2(W,oe),Ce=(n.lineWidth*4+4)*Q,ee=Math.PI/7;if(n.arrowRight){const Z=X-Ce*Math.cos(Be-ee),re=Ae-Ce*Math.sin(Be-ee),fe=X-Ce*Math.cos(Be+ee),we=Ae-Ce*Math.sin(Be+ee);$.beginPath(),$.moveTo(X,Ae),$.lineTo(Z,re),$.lineTo(fe,we),$.closePath(),$.fill()}if(n.arrowLeft){const Z=Be+Math.PI,re=O-Ce*Math.cos(Z-ee),fe=Y-Ce*Math.sin(Z-ee),we=O-Ce*Math.cos(Z+ee),ve=Y-Ce*Math.sin(Z+ee);$.beginPath(),$.moveTo(O,Y),$.lineTo(re,fe),$.lineTo(we,ve),$.closePath(),$.fill()}if(c){const Z=n.p1.rawTime??n.p1.time,re=n.p2.rawTime??n.p2.time,fe=n.p1.price,we=n.p2.price,ve=[];if(n.statsPriceRange){const me=Math.abs(we-fe),Se=fe!==0?Math.abs((we-fe)/fe*100):0,He=me<1e-4?6:me<.01?5:me<1?4:2;ve.push("↕ "+me.toFixed(He)+" ("+Se.toFixed(2)+"%)")}const xe=[];if(n.statsBarsRange)try{const me=h.timeScale().timeToCoordinate(Z),Se=h.timeScale().timeToCoordinate(re);if(me!=null&&Se!=null){const He=h.timeScale().coordinateToLogical(me),Ee=h.timeScale().coordinateToLogical(Se);He!=null&&Ee!=null&&xe.push("↔ "+Math.abs(Math.round(Ee-He))+" bars")}}catch{}if(n.statsDateRange){const me=Math.abs(re-Z),Se=Math.floor(me/86400),He=Math.floor(me%86400/3600),Ee=Math.floor(me%3600/60);let _e=Se>0?Se+" day"+(Se!==1?"s":""):"";He>0&&(_e+=(_e?" ":"")+He+" hour"+(He!==1?"s":"")),!Se&&!He&&(_e=Ee+" min"+(Ee!==1?"s":"")),n.statsBarsRange&&xe.length>0?xe[xe.length-1]+=" ("+_e+")":xe.push(_e)}if(n.statsDistance){const me=(R-E)/y,Se=(L-I)/Q;xe.push("distance: "+Math.sqrt(me*me+Se*Se).toFixed(2))}if(xe.length>0&&ve.push(xe.join(", ")),n.statsAngle){const me=oe/y,Se=W/Q,He=Math.atan2(Se,me)*180/Math.PI;ve.push("∠ "+He.toFixed(0)+"°")}if(ve.length>0){const me=Math.min(y,Q),Se=11*me,He=Se*1.5,Ee=5*me;$.font=Se+"px sans-serif";const Qe=ve.reduce((Ge,Ve)=>Math.max(Ge,$.measureText(Ve).width),0)+Ee*2,Ie=ve.length*He+Ee*2;let Ze,We;n.statsPosition==="left"?(Ze=O,We=Y):n.statsPosition==="center"?(Ze=(O+X)/2,We=(Y+Ae)/2):(Ze=X,We=Ae);const Te=Ze-Qe/2,it=We-Ie-12*me;$.fillStyle="rgba(20, 20, 30, 0.72)",$.fillRect(Te,it,Qe,Ie),$.strokeStyle=n.statsColor,$.lineWidth=1*me,$.strokeRect(Te,it,Qe,Ie),$.fillStyle=n.statsColor,$.textBaseline="top",$.textAlign="left",ve.forEach((Ge,Ve)=>{$.fillText(Ge,Te+Ee,it+Ee+Ve*He)})}}$.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Jv{constructor(e,t={}){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,h=s.timeScale().timeToCoordinate(A.center.rawTime),d=o.priceToCoordinate(A.center.price);if(h==null||d==null)return;const y=Math.round(h*l),Q=Math.round(d*c),b=n.bitmapSize.width,C=n.bitmapSize.height,U=n.context;if(U.save(),U.strokeStyle=A.color,U.lineWidth=A.lineWidth*c,U.setLineDash([]),U.beginPath(),U.moveTo(0,Q),U.lineTo(b,Q),U.stroke(),U.beginPath(),U.moveTo(y,0),U.lineTo(y,C),U.stroke(),A.showPrice){const M=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 I=U.measureText(M).width,R=Math.round(6*l),L=Math.round(3*c),O=E+2*L,Y=I+2*R,X=b-Y-Math.round(2*l),Ae=Q-O/2;U.fillStyle=A.color,U.fillRect(X,Ae,Y,O),U.fillStyle="#ffffff",U.fillText(M,X+R,Q)}if(A.showTime){const M=A.center.rawTime,E=new Date(M*1e3),I=$=>String($).padStart(2,"0"),R=I(E.getUTCDate())+"."+I(E.getUTCMonth()+1)+"."+E.getUTCFullYear()+" "+I(E.getUTCHours())+":"+I(E.getUTCMinutes())+":"+I(E.getUTCSeconds()),L=Math.round(11*c);U.font=L+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const O=U.measureText(R).width,Y=Math.round(6*l),X=Math.round(3*c),Ae=L+2*X,oe=O+2*Y,W=y-oe/2,ce=C-Ae-Math.round(4*c);U.fillStyle=A.color,U.fillRect(W,ce,oe,Ae),U.fillStyle="#ffffff",U.fillText(R,y,ce+Ae/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 Yv{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,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),Q=l.priceToCoordinate(r.p1.price),b=l.priceToCoordinate(r.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=d*c,U=Q*h,M=y*c,E=b*h,I=C-M,R=U-E,L=M-C,O=E-U;if(Math.hypot(I,R)<1e-4)return;const X=Math.atan2(R,I),Ae=Math.round(Math.abs(X*180/Math.PI)),oe=s.context;oe.save(),oe.strokeStyle=r.color,oe.fillStyle=r.color,oe.lineWidth=r.lineWidth*h,oe.setLineDash([]);const W=Math.abs(L)<1e-4?0:O/L;if(r.rayLeft){const we=U+W*(0-C);oe.beginPath(),oe.moveTo(0,we),oe.lineTo(C,U),oe.stroke()}if(r.rayRight){const fe=s.bitmapSize.width,we=E+W*(fe-M);oe.beginPath(),oe.moveTo(M,E),oe.lineTo(fe,we),oe.stroke()}oe.beginPath(),oe.moveTo(C,U),oe.lineTo(M,E),oe.stroke();const ce=Math.atan2(O,L),$=(r.lineWidth*4+4)*h,Be=Math.PI/7;if(r.arrowRight){const fe=M-$*Math.cos(ce-Be),we=E-$*Math.sin(ce-Be),ve=M-$*Math.cos(ce+Be),xe=E-$*Math.sin(ce+Be);oe.beginPath(),oe.moveTo(M,E),oe.lineTo(fe,we),oe.lineTo(ve,xe),oe.closePath(),oe.fill()}if(r.arrowLeft){const fe=ce+Math.PI,we=C-$*Math.cos(fe-Be),ve=U-$*Math.sin(fe-Be),xe=C-$*Math.cos(fe+Be),me=U-$*Math.sin(fe+Be);oe.beginPath(),oe.moveTo(C,U),oe.lineTo(we,ve),oe.lineTo(xe,me),oe.closePath(),oe.fill()}const Ce=28*h;oe.strokeStyle="rgba(122,166,174,0.55)",oe.fillStyle=r.color,oe.lineWidth=1*h,oe.beginPath(),oe.moveTo(M,E),oe.lineTo(M+Ce,E),oe.stroke(),oe.beginPath(),oe.strokeStyle="rgba(122,166,174,0.45)",oe.arc(M,E,Ce,0,X,X<0),oe.stroke(),oe.fillStyle="#4b7c86",oe.font=`${Math.round(10*h)}px sans-serif`,oe.textAlign="left",oe.textBaseline="middle";const ee=M+(Ce+10*h)*Math.cos(X/2),Z=E+(Ce+10*h)*Math.sin(X/2);if(oe.fillText(`${Ae}°`,ee,Z),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const fe=r.p1.price,we=r.p2.price,ve=[];if(r.statsPriceRange){const me=Math.abs(we-fe),Se=fe!==0?Math.abs((we-fe)/fe*100):0,He=me<1e-4?6:me<.01?5:me<1?4:2;ve.push("↕ "+me.toFixed(He)+" ("+Se.toFixed(2)+"%)")}const xe=[];if(r.statsDistance){const me=L/c,Se=O/h;xe.push("distance: "+Math.sqrt(me*me+Se*Se).toFixed(2))}if(xe.length>0&&ve.push(xe.join(", ")),ve.length>0){const me=Math.min(c,h),Se=11*me,He=Se*1.5,Ee=5*me;oe.font=Se+"px sans-serif";const Qe=ve.reduce((ue,ae)=>Math.max(ue,oe.measureText(ae).width),0)+Ee*2,Ie=ve.length*He+Ee*2,[Ze,We,Te,it]=C<=M?[C,U,M,E]:[M,E,C,U];let Ge,Ve;r.statsPosition==="left"?(Ge=Ze,Ve=We):r.statsPosition==="center"?(Ge=(Ze+Te)/2,Ve=(We+it)/2):(Ge=Te,Ve=it);const De=Ge-Qe/2,Pe=Ve-Ie-12*me;oe.fillStyle="rgba(20, 20, 30, 0.72)",oe.fillRect(De,Pe,Qe,Ie),oe.strokeStyle=r.statsColor,oe.lineWidth=1*me,oe.strokeRect(De,Pe,Qe,Ie),oe.fillStyle=r.statsColor,oe.textBaseline="top",oe.textAlign="left",ve.forEach((ue,ae)=>{oe.fillText(ue,De+Ee,Pe+Ee+ae*He)})}}oe.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class qv{constructor(e,t,A){this.p1=e,this.p2=t,this.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,h=s.verticalPixelRatio,d=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),Q=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),M=l.priceToCoordinate(r.p3.price);if(y==null||Q==null||b==null||C==null||U==null||M==null)return;const E=y*c,I=Q*h,R=b*c,L=C*h,O=U*c,Y=M*h,X=(R+O)/2,Ae=(L+Y)/2;let oe=X-E,W=Ae-I;Math.abs(oe)<1e-4&&(oe=1e-4);const ce=W/oe,$=s.bitmapSize.width,Be=(R-O)/2,Ce=(L-Y)/2,ee=me=>({x:X+Be*me,y:Ae+Ce*me}),Z=(me,Se)=>({x:$,y:Se+ce*($-me)}),re=ee(1),fe=ee(-1),we=Z(re.x,re.y),ve=Z(fe.x,fe.y);d.save(),d.beginPath(),d.moveTo(re.x,re.y),d.lineTo(we.x,we.y),d.lineTo(ve.x,ve.y),d.lineTo(fe.x,fe.y),d.closePath(),d.fillStyle="rgba(148, 163, 184, 0.2)",d.fill(),d.beginPath(),d.strokeStyle="rgba(148, 163, 184, 0.9)",d.lineWidth=1*h,d.moveTo(R,L),d.lineTo(O,Y),d.stroke(),r._levels.forEach(me=>{const Se=ee(me.k),He=Z(Se.x,Se.y);d.beginPath(),d.strokeStyle=me.color,d.lineWidth=me.width*h,d.moveTo(Se.x,Se.y),d.lineTo(He.x,He.y),d.stroke()});const xe=Z(E,I);d.beginPath(),d.strokeStyle="rgba(161, 98, 7, 0.9)",d.lineWidth=1.1*h,d.moveTo(E,I),d.lineTo(xe.x,xe.y),d.stroke(),d.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class jv{constructor(e,t){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,h=n.context,d=s.timeScale().timeToCoordinate(A.p1.rawTime),y=o.priceToCoordinate(A.p1.price),Q=s.timeScale().timeToCoordinate(A.p2.rawTime),b=o.priceToCoordinate(A.p2.price);if(d==null||y==null||Q==null||b==null)return;const C=d*l,U=y*c,M=Q*l,E=b*c,I=n.bitmapSize.width,R=Math.abs(M-C)<1e-4?1:M-C,L=(E-U)/R,O=M>=C?1:-1,Y=O>0?I:0,X=C+O*Math.min(220*l,Math.max(80*l,I*.35)),Ae=A._rays.map(W=>{const ce=L*W.ratio;return{...W,yEnd:U+ce*(Y-C),yLabel:U+ce*(X-C)}});h.save();const oe=(W,ce,$)=>{!W||!ce||(h.beginPath(),h.moveTo(C,U),h.lineTo(Y,W.yEnd),h.lineTo(Y,ce.yEnd),h.closePath(),h.fillStyle=$,h.fill())};oe(Ae[0],Ae[3],"rgba(161, 98, 7, 0.10)"),oe(Ae[3],Ae[4],"rgba(5, 150, 105, 0.10)"),oe(Ae[4],Ae[5],"rgba(107, 114, 128, 0.12)"),Ae.forEach(W=>{h.beginPath(),h.strokeStyle=W.color,h.lineWidth=1*c,h.moveTo(C,U),h.lineTo(Y,W.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=O>0?"left":"right",h.textBaseline="middle",Ae.forEach(W=>{h.fillStyle=W.color;const ce=X+(O>0?4*l:-4*l),$=W.yLabel;$<-20||$>n.bitmapSize.height+20||h.fillText(W.label,ce,$)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ex{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,h=s.verticalPixelRatio,d=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),Q=l.priceToCoordinate(r.p1.price),b=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price);if(y==null||Q==null||b==null||C==null)return;const U=y*c,M=Q*h,E=b*c,I=C*h,R=E-U,L=I-M,O=Math.hypot(R,L);if(O<1e-4)return;const Y=R/O,X=L/O,Ae=-X,oe=Y,W=E+Ae*O,ce=I+oe*O,$=U+Ae*O,Be=M+oe*O,Ce=(Z,re)=>({x:U+Y*O*Z+Ae*O*re,y:M+X*O*Z+oe*O*re});d.save();const ee=["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 Z=0;Z<r.divisions;Z++){const re=Z/r.divisions,fe=(Z+1)/r.divisions,we=Ce(0,re),ve=Ce(1,re),xe=Ce(1,fe),me=Ce(0,fe);d.beginPath(),d.moveTo(we.x,we.y),d.lineTo(ve.x,ve.y),d.lineTo(xe.x,xe.y),d.lineTo(me.x,me.y),d.closePath(),d.fillStyle=ee[Z%ee.length],d.fill()}d.lineWidth=1*h,d.strokeStyle="rgba(148, 163, 184, 0.55)";for(let Z=0;Z<=r.divisions;Z++){const re=Z/r.divisions,fe=Ce(0,re),we=Ce(1,re),ve=Ce(re,0),xe=Ce(re,1);d.beginPath(),d.moveTo(fe.x,fe.y),d.lineTo(we.x,we.y),d.stroke(),d.beginPath(),d.moveTo(ve.x,ve.y),d.lineTo(xe.x,xe.y),d.stroke()}d.strokeStyle="rgba(100, 116, 139, 0.85)",d.lineWidth=1*h,d.beginPath(),d.moveTo(U,M),d.lineTo(W,ce),d.stroke(),d.beginPath(),d.moveTo(E,I),d.lineTo($,Be),d.stroke(),d.strokeStyle="rgba(122, 166, 174, 0.95)",d.lineWidth=1.2*h,d.beginPath(),d.moveTo(U,M),d.lineTo(E,I),d.lineTo(W,ce),d.lineTo($,Be),d.closePath(),d.stroke(),d.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:h=!0,showPrices:d=!0,pricesColor:y="#129f5c",rayLeft:Q=!1,rayRight:b=!1,arrowLeft:C=!1,arrowRight:U=!1}=n;this.p1=e,this.p2=t,this.p3=A,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=h,this.showPrices=d,this.pricesColor=y,this.rayLeft=Q,this.rayRight=b,this.arrowLeft=C,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const M=this;this._paneView={renderer(){return{draw(E){E.useBitmapCoordinateSpace(I=>{if(!M.visible)return;const R=M._chart,L=M._series;if(!R||!L)return;const O=I.horizontalPixelRatio,Y=I.verticalPixelRatio,X=[M.p1,M.p3,M.p4,M.p2].map(Ie=>{const Ze=R.timeScale().timeToCoordinate(Ie.rawTime),We=L.priceToCoordinate(Ie.price);return Ze==null||We==null?null:{x:Ze*O,y:We*Y}}).filter(Boolean);if(X.length!==4)return;const[Ae,oe,W,ce]=X,$=I.context;$.save();const Be=oe.x-Ae.x,Ce=oe.y-Ae.y,ee=Math.sqrt(Be*Be+Ce*Ce)||1,Z=Be/ee,re=Ce/ee,fe=W.x-ce.x,we=W.y-ce.y,ve=Math.sqrt(fe*fe+we*we)||1,xe=fe/ve,me=we/ve,Se=1e5,He=M.rayLeft?{x:Ae.x-Z*Se,y:Ae.y-re*Se}:Ae,Ee=M.rayRight?{x:oe.x+Z*Se,y:oe.y+re*Se}:oe,_e=M.rayLeft?{x:ce.x-xe*Se,y:ce.y-me*Se}:ce,Qe=M.rayRight?{x:W.x+xe*Se,y:W.y+me*Se}:W;if(M.showBackground){const Ie=M.fillColor||"#6aa84f",Ze=parseInt(Ie.slice(1,3),16),We=parseInt(Ie.slice(3,5),16),Te=parseInt(Ie.slice(5,7),16);$.beginPath(),$.moveTo(Ae.x,Ae.y),$.lineTo(oe.x,oe.y),$.lineTo(W.x,W.y),$.lineTo(ce.x,ce.y),$.closePath(),$.fillStyle=`rgba(${Ze},${We},${Te},${M.fillOpacity??.1})`,$.fill()}if($.strokeStyle=M.lineColor,$.lineWidth=M.lineWidth*Y,$.setLineDash([]),$.beginPath(),$.moveTo(He.x,He.y),$.lineTo(Ee.x,Ee.y),$.moveTo(_e.x,_e.y),$.lineTo(Qe.x,Qe.y),$.moveTo(Ae.x,Ae.y),$.lineTo(ce.x,ce.y),$.moveTo(oe.x,oe.y),$.lineTo(W.x,W.y),$.stroke(),M.arrowLeft||M.arrowRight){const Ie=8*Y,Ze=(We,Te,it)=>{$.save(),$.translate(We,Te),$.rotate(it),$.beginPath(),$.moveTo(0,0),$.lineTo(-Ie,-Ie/2),$.lineTo(-Ie,Ie/2),$.closePath(),$.fillStyle=M.lineColor,$.fill(),$.restore()};M.arrowLeft&&(Ze(He.x,He.y,Math.atan2(-re,-Z)),Ze(_e.x,_e.y,Math.atan2(-me,-xe))),M.arrowRight&&(Ze(Ee.x,Ee.y,Math.atan2(re,Z)),Ze(Qe.x,Qe.y,Math.atan2(me,xe)))}if($.fillStyle="#ffffff",$.strokeStyle="#3b82f6",$.lineWidth=2*Y,[Ae,oe,W,ce].forEach(Ie=>{$.beginPath(),$.arc(Ie.x,Ie.y,6*Y,0,Math.PI*2),$.fill(),$.stroke()}),M.showPrices){const Ie=[M.p1,M.p3,M.p2,M.p4],Ze=[Ae,oe,ce,W];$.fillStyle=M.pricesColor||M.lineColor,$.font=`${Math.round(10*Y)}px sans-serif`,$.textAlign="left",$.textBaseline="middle",Ze.forEach((We,Te)=>{const it=Ie[Te]?.price;typeof it=="number"&&$.fillText(it.toFixed(5),We.x+8*O,We.y)})}$.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Kd extends _a{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class Vd{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 h=o._chart,d=o._series;if(!h||!d)return;const y=c.horizontalPixelRatio,Q=c.verticalPixelRatio,b=c.context,C=R=>{const L=h.timeScale().timeToCoordinate(R.rawTime),O=d.priceToCoordinate(R.price);return L==null||O==null?null:{x:L*y,y:O*Q}},U=C(o.p1),M=C(o.p2),E=C(o.b2),I=C(o.b1);!U||!M||!E||!I||(b.save(),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(M.x,M.y),b.lineTo(E.x,E.y),b.lineTo(I.x,I.y),b.closePath(),b.fillStyle=o.fillColor,b.fill(),b.strokeStyle=o.strokeColor,b.lineWidth=o.lineWidth*Q,b.setLineDash([]),b.beginPath(),b.moveTo(U.x,U.y),b.lineTo(M.x,M.y),b.stroke(),b.beginPath(),b.moveTo(I.x,I.y),b.lineTo(E.x,E.y),b.stroke(),b.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ka{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(h=>{if(!l.visible)return;const d=l._chart,y=l._series;if(!d||!y)return;const Q=h.horizontalPixelRatio,b=h.verticalPixelRatio,C=h.context,U=X=>{const Ae=d.timeScale().timeToCoordinate(X.rawTime),oe=y.priceToCoordinate(X.price);return Ae==null||oe==null?null:{x:Ae*Q,y:oe*b}},M=U(l.mid1),E=U(l.mid2),I=U(l.top1),R=U(l.top2),L=U(l.bot1),O=U(l.bot2);if(!M||!E||!I||!R||!L||!O)return;C.save(),C.beginPath(),C.moveTo(M.x,M.y),C.lineTo(E.x,E.y),C.lineTo(R.x,R.y),C.lineTo(I.x,I.y),C.closePath(),C.fillStyle=l.upperFillColor,C.fill(),C.beginPath(),C.moveTo(L.x,L.y),C.lineTo(O.x,O.y),C.lineTo(E.x,E.y),C.lineTo(M.x,M.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const Y=(X,Ae,oe)=>{C.beginPath(),C.strokeStyle=oe,C.lineWidth=l.lineWidth*b,C.setLineDash([]),C.moveTo(X.x,X.y),C.lineTo(Ae.x,Ae.y),C.stroke()};if(Y(I,R,l.upperStrokeColor),Y(M,E,l.centerStrokeColor),Y(L,O,l.lowerStrokeColor),l.showDeviationLabel){const X=Math.abs(l.top1.price-l.mid1.price),Ae=Number.isFinite(X)?X.toFixed(5):null;if(Ae){const oe=Math.max(10,Math.round(10*b));C.fillStyle=l.labelColor,C.font=`${oe}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(Ae,L.x+2*Q,L.y+10*b)}}C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class zd extends ka{}class Wd{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,h=n.context,d=n.bitmapSize.width;n.bitmapSize.height;const y=A.p1.price,Q=A.p2.price,b=y-Q,C=X=>Q+b*X,U=s.timeScale().timeToCoordinate(A.p1.rawTime),M=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(y),I=o.priceToCoordinate(Q),R=U!=null&&M!=null?Math.round(Math.min(U,M)*l):0,L=U!=null&&M!=null?Math.round(Math.max(U,M)*l):d,O=L-R;h.save(),A._zoneFills.forEach(({from:X,to:Ae,color:oe})=>{const W=C(X),ce=C(Ae),$=o.priceToCoordinate(W),Be=o.priceToCoordinate(ce);if($==null||Be==null)return;const Ce=Math.round($*c),ee=Math.round(Be*c);h.fillStyle=oe,h.fillRect(R,Math.min(Ce,ee),O,Math.abs(ee-Ce))}),A._levels.forEach(({ratio:X,label:Ae})=>{const oe=C(X),W=o.priceToCoordinate(oe);if(W==null)return;const ce=Math.round(W*c),$=A._levelColors[X]||"#888888";h.beginPath(),h.strokeStyle=$,h.lineWidth=X===0||X===1?1.5*c:1*c,X!==0&&X!==1&&X<1?h.setLineDash([4*l,4*l]):h.setLineDash([]),h.moveTo(R,ce),h.lineTo(L,ce),h.stroke(),h.setLineDash([])});const Y=Math.round(11*c);if(h.font=`${Y}px sans-serif`,h.textAlign="left",A._levels.forEach(({ratio:X,label:Ae})=>{const oe=C(X),W=o.priceToCoordinate(oe);if(W==null)return;const ce=Math.round(W*c),$=A._levelColors[X]||"#888888",Be=`${Ae} (${oe.toFixed(5)})`;h.fillStyle=$,h.textAlign="right",h.fillText(Be,R-4*l,ce-4*c)}),U!=null&&M!=null&&E!=null&&I!=null){const X=Math.round(U*l),Ae=Math.round(E*c),oe=Math.round(M*l),W=Math.round(I*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo(X,Ae),h.lineTo(oe,W),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(X,Ae,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(oe,W,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class tx{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 h=Math.round(c*o.horizontalPixelRatio),d=o.bitmapSize.height,y=o.context;y.save(),y.beginPath(),y.strokeStyle=n.color,y.lineWidth=n.lineWidth*o.horizontalPixelRatio,y.setLineDash([]),y.moveTo(h,0),y.lineTo(h,d),y.stroke();const Q=Math.round(d/2);if(n.midYCss=Q/o.verticalPixelRatio,n.showDot){y.beginPath(),y.strokeStyle=n.color,y.lineWidth=1.5*o.horizontalPixelRatio;const b=5*o.horizontalPixelRatio;y.arc(h,Q,b,0,Math.PI*2),y.stroke()}if(n.showDate!==!1){const b=n.time,C=new Date(typeof b=="number"?b*1e3:b),U=oe=>String(oe).padStart(2,"0"),M=`${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 I=y.measureText(M).width,R=Math.round(6*o.horizontalPixelRatio),L=Math.round(3*o.verticalPixelRatio),O=E+2*L,Y=I+2*R,X=h-Y/2,Ae=d-O-Math.round(4*o.verticalPixelRatio);y.fillStyle=n.color,y.fillRect(X,Ae,Y,O),y.fillStyle="#ffffff",y.fillText(M,h,Ae+O/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 Rd(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 Ax(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 h=c;for(;h.length>s;){let d=h.lastIndexOf(" ",s);d<=0&&(d=s),o.push(h.slice(0,d)),h=h.slice(d).trimStart()}o.push(h)};return A.split(`
11
+ `).forEach(l),o.length===0&&o.push(""),o}function Gd(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=Ax(A.text??i?.text??"Text",r,n),o=s.reduce((b,C)=>Math.max(b,C.length),1),c=Math.max(20,o*r*.58)+16,h=r*1.2,d=s.length*h+10,y=e-c/2,Q=t-d;return{left:y,right:y+c,top:Q,bottom:Q+d+12}}class ix{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),h=l.priceToCoordinate(r.price);if(c==null||h==null)return;const d=s.horizontalPixelRatio,y=s.verticalPixelRatio,Q=Math.round(c*d),b=Math.round(h*y),C=s.context;C.save();const U=Math.round(r.fontSize*y);C.font=`${r.fontStyle} ${r.fontWeight} ${U}px sans-serif`;const M=`${r.text??""}`,E=220*d,I=[],R=re=>{if(!r.textWrap||re.length===0){I.push(re);return}const fe=re.split(/\s+/);let we="";for(const ve of fe){const xe=we?`${we} ${ve}`:ve;C.measureText(xe).width<=E||!we?we=xe:(I.push(we),we=ve)}I.push(we)};M.split(`
12
+ `).forEach(R),I.length===0&&I.push("");const L=I.map(re=>C.measureText(re).width),O=Math.max(...L,20*d),Y=8*d,X=5*y,Ae=O+Y*2,oe=U*1.2,W=oe*I.length+X*2,ce=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",$=Q-Ae/2,Be=b-W;r.bgEnabled&&(C.fillStyle=Rd(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect($,Be,Ae,W),C.fill()),r.borderEnabled&&(C.strokeStyle=Rd(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),C.lineWidth=Math.max(.5,(r.borderWidth??1)*y),C.beginPath(),C.rect($,Be,Ae,W),C.stroke()),C.fillStyle=r.color,C.textAlign=ce,C.textBaseline="middle";const Ce=ce==="left"?$+Y:ce==="right"?$+Ae-Y:$+Ae/2;for(let re=0;re<I.length;re++)C.fillText(I[re],Ce,Be+X+oe*(re+.5));const ee=5*y,Z=b+10*y;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*y,C.arc(Q,Z,ee,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 rx={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function $d(i){if(!i)return 7;const e=String(i).toUpperCase();return rx[e]??7}function nx(i,e){const t=String(i||"").toUpperCase(),A=e||$d(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 EA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:ie(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 at(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 h=t+c*s,d=A+c*o;return Math.hypot(i-h,e-d)}function sx(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 h=t+c*s,d=A+c*o;return Math.hypot(i-h,e-d)}function ox(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,h=t+c*s,d=A+c*o;return Math.hypot(i-h,e-d)}function jA(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 Xd(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??ie(i.rawTime),r=e.normalizedTime??ie(e.rawTime),n=t.normalizedTime??ie(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),h=ie((A+r)/2),d=(l+c)/2;return h==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:h,normalizedTime:h,price:d}}}function Ki(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??ie(e.rawTime),n=t.normalizedTime??ie(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map(X=>({time:ie(X.time),close:typeof X.close=="number"?X.close:parseFloat(X.close)})).filter(X=>X.time!=null&&Number.isFinite(X.close)&&X.time>=s&&X.time<=o).sort((X,Ae)=>X.time-Ae.time);if(l.length<2)return null;const c=l.length;let h=0,d=0,y=0,Q=0;for(let X=0;X<c;X++){const Ae=X,oe=l[X].close;h+=Ae,d+=oe,y+=Ae*oe,Q+=Ae*Ae}const b=c*Q-h*h,C=Math.abs(b)<1e-12?0:(c*y-h*d)/b,U=(d-C*h)/c;let M=0;for(let X=0;X<c;X++){const Ae=U+C*X,oe=l[X].close-Ae;M+=oe*oe}const E=Math.sqrt(M/c),I=Math.max(E*A,1e-8),R=l[0].time,L=l[c-1].time,O=U,Y=U+C*(c-1);return{slope:C,intercept:U,stdDev:E,offset:I,barCount:c,p1:{rawTime:R,normalizedTime:R,price:O},p2:{rawTime:L,normalizedTime:L,price:Y},top1:{rawTime:R,normalizedTime:R,price:O+I},top2:{rawTime:L,normalizedTime:L,price:Y+I},bot1:{rawTime:R,normalizedTime:R,price:O-I},bot2:{rawTime:L,normalizedTime:L,price:Y-I}}}function Mr(i,e,t,A=1){return Ki(i,e,t,A)}const ax={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}},lx={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 cx(i,e){if(!i||!i.type)return!1;const t=ax[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function hx(i){return i?lx[i]??"#22c55e":"#22c55e"}const ux=300,Zd=24,dx=150,Jd=150;function Na(i,e,t=ux){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=ie(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 px(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=ie(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function fx(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=ie(e),n=ie(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 Q=fx(i,y);if(Q<=0)return 0;if(Q>=i.length)return i.length-1;const b=i[Q-1],C=i[Q];return Math.abs(y-b)<=Math.abs(C-y)?Q-1:Q},h=c(r),d=c(n);return Math.max(1,Math.abs(d-h)+1)}function Yd(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=px(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 h=A.getVisibleLogicalRange(),d=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,y=Number.isFinite(d)&&d>20?d:120,Q=Math.min(Jd,y/2),b=Math.max(20,y-Q),C={from:c-b,to:c+Q};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=iA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-dx*o,to:r+Jd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const gx=j.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n,onModifyTPSL:s,onClosePosition:o},l){const c=j.useRef(null),h=j.useRef(null),d=j.useRef(null),y=j.useRef(null),Q=j.useRef(null),b=j.useRef(null),C=j.useRef([]),U=j.useRef(!1),M=j.useRef(null),E=j.useRef(null),I=j.useRef(null),R=j.useRef(null),L=j.useRef([]),[O,Y]=j.useState(null),[X,Ae]=j.useState(null),[oe,W]=j.useState([]),[ce,$]=j.useState(null),[Be,Ce]=j.useState([]),ee=j.useRef(null),Z=j.useRef(null),re=j.useRef(null),fe=j.useRef(!1),we=j.useRef(!1);j.useEffect(()=>{re.current=O;let p=!1;C.current.forEach(f=>{if(f.type==="trendline"&&f.decoration){const K=f===O;f.decoration.isSelected!==K&&(f.decoration.isSelected=K,p=!0)}}),p&&d.current?.applyOptions({})},[O]);const ve=j.useRef(new Map),xe=j.useRef(null),me=j.useRef(null),Se=(p,f)=>`${p}_${f}`,He=()=>{const p=Se(Ge,Ve);return ve.current.get(p)||null},Ee=p=>{if(!p)return;const f=Se(Ge,Ve);ve.current.set(f,p)},{activeTool:_e,setActiveTool:Qe,showGrid:Ie,snapToGrid:Ze,chartObjects:We,setChartObjects:Te,orders:it,selectedSymbol:Ge,selectedTimeframe:Ve,drawingsVisible:De,chartType:Pe,chartLocked:ue,theme:ae,baseUrl:he,endpoints:Fe,endpointParams:Le,selectedTradeForModify:Ye,setSelectedTradeForModify:qe}=Lt(),Qt=j.useRef([]),tA=j.useRef({tp:null,sl:null,entry:null}),$t=j.useRef(null),ei=j.useRef(0),Je=j.useRef(0),[Re,Ne]=j.useState(!1),[ct,rt]=j.useState(null),[ke,mt]=j.useState([]),[vt,_r]=j.useState(!0),[Va,np]=j.useState(null),[_x,BT]=j.useState(0),vs=j.useMemo(()=>{const p=ke.map(f=>ie(f?.time)).filter(f=>Number.isFinite(f));return p.sort((f,K)=>f-K),p},[ke]),sp=j.useRef(null),Vi=j.useRef(new Map);j.useRef(null);const op=j.useRef(0),ti=j.useRef(null);j.useEffect(()=>{const p=Q.current;p&&p.setData(Na(ke,Ve))},[ke,Ve]),j.useImperativeHandle(l,()=>({zoomIn:()=>{const p=d.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const K=f.to-f.from,ge=(f.from+f.to)/2,F=K*.8;try{p.setVisibleRange({from:ge-F/2,to:ge+F/2}),Ee(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=d.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const K=f.to-f.from,ge=(f.from+f.to)/2,F=K*1.25;try{p.setVisibleRange({from:ge-F/2,to:ge+F/2}),Ee(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=c.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const f=p.querySelectorAll("canvas"),K=ae==="light"?"#ffffff":"#12161d";let ge=null,F=0;if(f.forEach(v=>{if(v.width>0&&v.height>0){const J=v.width*v.height;J>F&&(F=J,ge=v)}}),ge)try{const v=document.createElement("canvas");v.width=ge.width,v.height=ge.height;const J=v.getContext("2d");J.fillStyle=K,J.fillRect(0,0,v.width,v.height),J.drawImage(ge,0,0);const x=document.createElement("a");x.download=`chart-${Ge}-${Ve}-${Date.now()}.png`,x.href=v.toDataURL("image/png"),x.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(v){console.warn("Canvas export failed, trying html2canvas",v)}_v(p,{useCORS:!0,allowTaint:!0,backgroundColor:K,scale:2,logging:!1}).then(v=>{const J=document.createElement("a");J.download=`chart-${Ge}-${Ve}-${Date.now()}.png`,J.href=v.toDataURL("image/png"),J.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(v=>{console.error("Chart screenshot failed",v),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Ge,Ve,ae]);const za=j.useMemo(()=>ke.length===0?[]:Pe==="line"||Pe==="area"?ke.map(p=>({time:p.time,value:p.close})):ke,[ke,Pe]),kx=p=>{r?r(p):(rt("BUY"),Ne(!0))},Nx=p=>{n?n(p):(rt("SELL"),Ne(!0))},Ox=()=>{Ne(!1),rt(null)},Kx=p=>{const f=X;if(!f||!p)return;const K=(v,J)=>{if(typeof v!="string")return J;const x=v.trim(),te=x.startsWith("#")?x:`#${x}`;return/^#[0-9A-Fa-f]{6}$/.test(te)?te.toLowerCase():J},ge=(v,J)=>{const x=Number(v);return Number.isFinite(x)?Math.max(0,Math.min(1,x)):J};let F={...f,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:f.visibleTimeframes};if(f.type==="text"){const v=Number.isFinite(Number(p.price))?Number(p.price):f.price,J=f.primitive;J&&(J.text=typeof p.text=="string"?p.text:J.text,J.color=K(p.color,J.color??"#5f8f96"),J.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):J.fontSize,J.fontWeight=p.fontWeight==="bold"?"bold":"normal",J.fontStyle=p.fontStyle==="italic"?"italic":"normal",J.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:J.textAlign,J.textWrap=!!p.textWrap,J.borderEnabled=!!p.borderEnabled,J.borderColor=K(p.borderColor,J.borderColor??"#5f8f96"),J.borderOpacity=ge(p.borderOpacity,J.borderOpacity??.1),J.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),J.bgEnabled=!!p.bgEnabled,J.bgColor=K(p.bgColor,J.bgColor??"#5f8f96"),J.bgOpacity=ge(p.bgOpacity,J.bgOpacity??.1),J.price=v),F={...F,price:v,text:typeof p.text=="string"?p.text:f.text}}if(f.type==="trendline"){const v=K(p.lineColor,"#22c55e"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(f.series)try{f.series.applyOptions({color:v,lineWidth:J})}catch{}const x=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.point1?.price,te=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.point2?.price;if(f.series&&f.point1&&f.point2){const le=f.point1.time??f.point1.rawTime,ne=f.point2.time??f.point2.rawTime;try{const g=EA([{time:le,value:x},{time:ne,value:te}]);g.length>0&&f.series.setData(g)}catch{}}const S={...f.point1,price:x},V={...f.point2,price:te};f.decoration&&(f.decoration.color=v,f.decoration.lineWidth=J,f.decoration.arrowLeft=!!p.arrowLeft,f.decoration.arrowRight=!!p.arrowRight,f.decoration.rayLeft=!!p.rayLeft,f.decoration.rayRight=!!p.rayRight,f.decoration.statsColor=K(p.statsColor,"#5f8f96"),f.decoration.statsPosition=p.statsPosition??"right",f.decoration.statsShowAlways=!!p.statsShowAlways,f.decoration.statsPriceRange=!!p.statsPriceRange,f.decoration.statsBarsRange=!!p.statsBarsRange,f.decoration.statsDateRange=!!p.statsDateRange,f.decoration.statsAngle=!!p.statsAngle,f.decoration.statsDistance=!!p.statsDistance,f.decoration.p1=S,f.decoration.p2=V),F={...F,lineColor:v,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:V,decoration:f.decoration}}if(f.type==="pricelevel"){const v=K(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=p.showPrice!==!1,te=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",V=K(p.textColor,"#ffffff"),le=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",ne=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",g=Number.isFinite(Number(p.price))?Number(p.price):f.price;if(f.priceLine)try{f.priceLine.applyOptions({price:g,color:v,lineWidth:J,axisLabelVisible:x,title:x&&typeof g=="number"?g.toFixed(5):""})}catch{}const B=y.current;if(te&&S&&B)if(f.textPrimitive)f.textPrimitive.text=S,f.textPrimitive.textColor=V,f.textPrimitive.hAlign=le,f.textPrimitive.vAlign=ne,f.textPrimitive.price=g;else{const T=new kd(g,{text:S,textColor:V,hAlign:le,vAlign:ne});try{B.attachPrimitive(T)}catch{}f.textPrimitive=T}else if(f.textPrimitive&&B){try{B.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}F={...F,price:g,lineColor:v,lineWidth:J,showPrice:x,showText:te,textContent:S,textColor:V,textHAlign:le,textVAlign:ne,textPrimitive:f.textPrimitive}}if(f.type==="horizontalray"){const v=K(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=p.showPrice!==!1,te=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",V=K(p.textColor,"#ffffff"),le=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",ne=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",g=Number.isFinite(Number(p.price))?Number(p.price):f.price,B=f.primitive;if(B&&(B.price=g,B.color=v,B.lineWidth=J),f.priceLine)try{f.priceLine.applyOptions({price:g,color:v,axisLabelVisible:x,title:x&&typeof g=="number"?g.toFixed(5):""})}catch{}const T=y.current;if(te&&S&&T)if(f.textPrimitive)f.textPrimitive.text=S,f.textPrimitive.textColor=V,f.textPrimitive.hAlign=le,f.textPrimitive.vAlign=ne,f.textPrimitive.price=g,f.textPrimitive.originTime=f.rawOriginTime;else{const w=new kd(g,{text:S,textColor:V,hAlign:le,vAlign:ne,originTime:f.rawOriginTime});try{T.attachPrimitive(w)}catch{}f.textPrimitive=w}else if(f.textPrimitive&&T){try{T.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}F={...F,price:g,lineColor:v,lineWidth:J,showPrice:x,showText:te,textContent:S,textColor:V,textHAlign:le,textVAlign:ne,textPrimitive:f.textPrimitive}}if(f.type==="verticalline"){const v=K(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=p.showDate!==!1,te=f.primitive;te&&(te.color=v,te.lineWidth=J,te.showDate=x),F={...F,lineColor:v,lineWidth:J,showDate:x}}if(f.type==="infoline"){const v=K(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=p.statsShowAlways!==!1,te=K(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",V=!!p.statsPriceRange,le=!!p.statsBarsRange,ne=!!p.statsDateRange,g=!!p.statsAngle,B=!!p.statsDistance,T=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,u=f.p1.rawTime,D=f.p2.rawTime,H=w-T,k=T!==0?H/Math.abs(T)*100:0,P=f.p1.normalizedTime??0,m=f.p2.normalizedTime??0,_=iA(Ve)||3600,N=Math.abs(m-P),z=Math.max(1,Math.round(N/_)),G=Math.max(1,Math.round(N/86400)),q=d.current,se=y.current,de=q?q.timeScale().timeToCoordinate(u):null,ye=se?se.priceToCoordinate(T):null,be=q?q.timeScale().timeToCoordinate(D):null,Me=se?se.priceToCoordinate(w):null,Xe=de!=null&&ye!=null&&be!=null&&Me!=null?Math.atan2(-(Me-ye),be-de)*(180/Math.PI):f.primitive?.info?.angle??0,At={priceDiff:H,pricePct:k,bars:z,days:G,angle:Xe},$e=f.primitive;$e&&($e.color=v,$e.lineWidth=J,$e.statsShowAlways=x,$e.statsColor=te,$e.statsPosition=S,$e.statsPriceRange=V,$e.statsBarsRange=le,$e.statsDateRange=ne,$e.statsAngle=g,$e.statsDistance=B,$e.p1={...f.p1,price:T},$e.p2={...f.p2,price:w},$e.info=At),F={...F,lineColor:v,lineWidth:J,statsShowAlways:x,statsColor:te,statsPosition:S,statsPriceRange:V,statsBarsRange:le,statsDateRange:ne,statsAngle:g,statsDistance:B,p1:{...f.p1,price:T},p2:{...f.p2,price:w}}}if(f.type==="rulerline"){const v=K(p.lineColor,"#3b82f6"),J=p.showArea!==!1,x=!!p.statsShowAlways,te=K(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",V=!!p.statsPriceRange,le=!!p.statsBarsRange,ne=!!p.statsDateRange,g=f.primitive;g&&(g.lineColor=v,g.showArea=J,g.statsShowAlways=x,g.statsColor=te,g.statsPosition=S,g.statsPriceRange=V,g.statsBarsRange=le,g.statsDateRange=ne),F={...F,lineColor:v,showArea:J,statsShowAlways:x,statsColor:te,statsPosition:S,statsPriceRange:V,statsBarsRange:le,statsDateRange:ne}}if(f.type==="arrowedline"){const v=K(p.lineColor,"#f59e0b"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,te=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=v,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=K(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:x},S.p2={...f.p2,price:te}),F={...F,lineColor:v,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:K(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:x},p2:{...f.p2,price:te}}}if(f.type==="rayline"){const v=K(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,te=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=v,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=K(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:x},S.p2={...f.p2,price:te}),F={...F,lineColor:v,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:K(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:x},p2:{...f.p2,price:te}}}if(f.type==="extendedline"){const v=K(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,te=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=v,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=K(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:x},S.p2={...f.p2,price:te}),F={...F,lineColor:v,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:K(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...f.p1,price:x},p2:{...f.p2,price:te}}}if(f.type==="crossline"){const v=K(p.lineColor,"#06a0e3"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=Number.isFinite(Number(p.price))?Number(p.price):f.p.price,te=f.primitive;te&&(te.color=v,te.lineWidth=J,te.showTime=!!p.showTime,te.showPrice=!!p.showPrice,te.center={...f.p,price:x}),F={...F,lineColor:v,lineWidth:J,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...f.p,price:x}}}if(f.type==="trendbyangle"){const v=K(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,te=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.primitive;S&&(S.color=v,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=K(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsDistance=!!p.statsDistance,S.p1={...f.p1,price:x},S.p2={...f.p2,price:te}),F={...F,lineColor:v,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:K(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsDistance:!!p.statsDistance,p1:{...f.p1,price:x},p2:{...f.p2,price:te}}}if(f.type==="disjointchannel"){const v=K(p.lineColor,"#129f5c"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=K(p.fillColor,"#6aa84f"),te=ge(p.fillOpacity,.1),S=K(p.pricesColor,"#129f5c"),V=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,le=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,ne=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,g=f.primitive;g&&(g.lineColor=v,g.lineWidth=J,g.fillColor=x,g.fillOpacity=te,g.showBackground=!!p.showBackground,g.showPrices=!!p.showPrices,g.pricesColor=S,g.rayLeft=!!p.rayLeft,g.rayRight=!!p.rayRight,g.arrowLeft=!!p.arrowLeft,g.arrowRight=!!p.arrowRight,g.p1={...f.p1,price:V},g.p3={...f.p3,price:le},g.p2={...f.p2,price:ne}),F={...F,lineColor:v,lineWidth:J,fillColor:x,fillOpacity:te,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:V},p3:{...f.p3,price:le},p2:{...f.p2,price:ne}}}if(f.type==="flattopbottom"){const v=K(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),x=K(p.fillColor,"#3b82f6"),te=ge(p.fillOpacity,.12),S=K(p.pricesColor,"#3b82f6"),V=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,le=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,ne=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,g=f.primitive;g&&(g.lineColor=v,g.lineWidth=J,g.fillColor=x,g.fillOpacity=te,g.showBackground=!!p.showBackground,g.showPrices=!!p.showPrices,g.pricesColor=S,g.rayLeft=!!p.rayLeft,g.rayRight=!!p.rayRight,g.arrowLeft=!!p.arrowLeft,g.arrowRight=!!p.arrowRight,g.p1={...f.p1,price:V},g.p3={...f.p3,price:le},g.p2={...f.p2,price:ne}),F={...F,lineColor:v,lineWidth:J,fillColor:x,fillOpacity:te,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:V},p3:{...f.p3,price:le},p2:{...f.p2,price:ne}}}Te(v=>{const J=v.map(x=>x===f?F:x);return C.current=J,J}),re.current===f&&(re.current=F),Y(v=>v===f?F:v),$(v=>v===f?F:v),Ae(F);try{d.current?.applyOptions({})}catch{}};j.useEffect(()=>{const p=c.current;if(!p)return;const f=p.getBoundingClientRect(),K=V=>{const le=Math.abs(Number(V));return Number.isFinite(le)?le>=1e3?le.toFixed(2):(le>=1,le.toFixed(5)):"0"},ge=ae==="light",F=i1(p,{width:f.width||p.clientWidth,height:f.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:K},layout:{background:{color:ge?"#FFFFFF":"#0d1117",type:"solid"},textColor:ge?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ie,color:Ie?ge?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0},horzLines:{visible:Ie,color:Ie?ge?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ie?2:0}},rightPriceScale:{borderColor:ge?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,textColor:ge?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:ge?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:_e===1?1:0,vertLine:{width:1,color:ge?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ge?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:ge?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ge?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:_e===1,horzLineVisible:_e===1},handleScroll:{mouseWheel:!0,pressedMouseMove:_e===null||_e===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}}),v=F.addCandlestickSeries({upColor:ge?"#089981":"#26a69a",downColor:ge?"#f23645":"#ef5350",wickUpColor:ge?"#089981":"#26a69a",wickDownColor:ge?"#f23645":"#ef5350",borderUpColor:ge?"#089981":"#26a69a",borderDownColor:ge?"#f23645":"#ef5350",borderVisible:!0}),J=F.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)"});d.current=F,y.current=v,Q.current=J,J.setData(Na(ke,Ve)),requestAnimationFrame(()=>{if(p&&F){const V=p.getBoundingClientRect();V.width>0&&V.height>0&&F.resize(V.width,V.height)}});const x=F.timeScale(),te=()=>{if(we.current&&Vi.current.size>0){const V=x.getVisibleRange();V&&Ee(V)}};x.subscribeVisibleTimeRangeChange(te);const S=new ResizeObserver(V=>{for(const le of V){const{width:ne,height:g}=le.contentRect;if(ne>0&&g>0&&F){const B=x.getVisibleRange();F.resize(ne,g),B&&setTimeout(()=>{try{x.setVisibleRange(B)}catch{}},0)}}});return S.observe(p),()=>{x.unsubscribeVisibleTimeRangeChange(te),S.disconnect(),F.remove(),d.current=null,y.current=null,Q.current=null,b.current=null,C.current=[],ti.current&&clearTimeout(ti.current)}},[]),j.useEffect(()=>{d.current&&d.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]),j.useEffect(()=>{const p=d.current;if(!p)return;const f=ae==="light";p.applyOptions({layout:{background:{color:f?"#FFFFFF":"#12161d"},textColor:f?"#020617":"#fff"},grid:{vertLines:{color:Ie?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ie?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:f?"#e5e7eb":"#1e293b"},timeScale:{borderColor:f?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1},horzLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1}}})},[ae,Ie]),j.useEffect(()=>{if(!d.current)return;const f=!ue&&!(_e!==null&&_e!==1&&_e!==0),K=!ue;d.current.applyOptions({crosshair:{mode:_e===1?1:0,vertLine:{visible:_e===1,width:1,color:ae==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:ae==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:_e===1,width:1,color:ae==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:ae==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:K,pressedMouseMove:f,horzTouchDrag:f,vertTouchDrag:f},handleScale:{axisPressedMouseMove:{time:f,price:f},axisDoubleClickReset:{time:!1,price:K},axisTouch:{time:f,price:f},mouseWheel:K,pinch:K}})},[_e,ue]);const Vx=()=>{const p=y.current;C.current.forEach(f=>{if(f.primitive){try{p&&p.detachPrimitive(f.primitive)}catch{}if(f.series&&f.series!==p)try{f.series.detachPrimitive(f.primitive)}catch{}}if(f.priceLine&&p)try{p.removePriceLine(f.priceLine)}catch{}if(f.textPrimitive&&p)try{p.detachPrimitive(f.textPrimitive)}catch{}}),C.current=[],Te([]),Qe(null)},ap=(p,f=!1)=>{p&&C.current.forEach(K=>{if(K.primitive){try{p.detachPrimitive(K.primitive)}catch{}try{p.attachPrimitive(K.primitive)}catch{}}if(f&&K.type==="pricelevel"&&K.priceLine)try{const ge=K.showPrice!==!1,F=p.createPriceLine({price:K.price,color:K.lineColor??"#3b82f6",lineWidth:K.lineWidth??2,lineStyle:0,axisLabelVisible:ge,title:ge&&typeof K.price=="number"?K.price.toFixed(5):""});K.priceLine=F}catch{}if(f&&K.type==="horizontalray"&&K.priceLine)try{const ge=K.showPrice!==!1,F=p.createPriceLine({price:K.price,color:K.lineColor??"#3b82f6",lineWidth:K.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:ge,title:ge&&typeof K.price=="number"?K.price.toFixed(5):""});K.priceLine=F}catch{}})};j.useEffect(()=>{(async()=>{if(!Ge||!Ve){mt([]),we.current=!1;return}try{if(_r(!0),np(null),mt([]),we.current=!1,me.current!==null&&me.current!==Ge&&Vx(),me.current=Ge,y.current)try{y.current.setData([])}catch{}const f=$d(Ve),K=nx(Ve,f),ge=he||Ov?.VITE_BASE_URL||"http://localhost:5002",F=Fe?.candles||"/api/chart/candles",v=Le?.candles||{},J={symbol:v.symbol||"symbol",timeframe:v.timeframe||"timeframe",limit:v.limit||"limit",daysBack:v.daysBack||"daysBack"},x={};x[J.symbol]=Ge,x[J.timeframe]=Ve,x[J.limit]=K,v.daysBack!==!1&&(x[J.daysBack]=f);const te=await ut.get(`${ge}${F}`,{params:x,timeout:1e4});let S=[];if(Array.isArray(te.data)?S=te.data:te.data&&te.data.data&&Array.isArray(te.data.data)?S=te.data.data:te.data&&Array.isArray(te.data)&&(S=te.data),S&&S.length>0){const{candles:V,stats:le}=el(S,Ge,Ve);V.length>0?(mt(V),Vi.current=new Map,V.forEach(ne=>{Vi.current.set(ne.time,ne)})):(console.warn(`⚠️ No valid candles after processing for ${Ge}`),mt([]))}else console.warn(`⚠️ No candle data returned for ${Ge}`),mt([])}catch(f){console.error(`❌ Error fetching ${Ge}:`,f.message);const K=f.code==="ECONNABORTED"||f.message&&f.message.includes("timeout");np(K?"Request timed out. No data available for this symbol.":f.message||"Failed to load candles."),mt([]),_r(!1)}})()},[Ge,Ve,_x]),j.useEffect(()=>{sp.current=vn.getSocket();const p=sp.current,f=()=>{if(Ge&&Ve&&p.connected){const x={symbol:Ge,timeframe:Ve};p.emit("subscribeCandles",x)}},K=()=>{setTimeout(()=>{Ge&&Ve&&f()},200)},ge=x=>{},F=x=>{};p.on("connect",K),p.on("disconnect",ge),p.on("connect_error",F),p.on("subscription:confirmed",x=>{x.type});const v=x=>{if(!x||!x.candle||!x.symbol||x.symbol.toUpperCase()!==Ge?.toUpperCase())return;const{candle:te}=x,S=tl(te,Ge,Ve);if(!S)return;const V=Date.now();if(V-op.current<200)return;op.current=V;const le=d.current?.timeScale(),ne=le?.getVisibleRange(),g=y.current,B=d.current;if(!(!g||!B||!we.current||g?.seriesType?.()!==(Pe==="line"?"Line":Pe==="area"?"Area":Pe==="bars"?"Bar":"Candlestick")))try{const u=Vi.current.get(S.time),D=!u,H=u?{time:S.time,open:u.open,high:Math.max(u.high,S.close),low:Math.min(u.low,S.close),close:S.close}:S;Vi.current.set(S.time,H),D&&Q.current&&Q.current.setData(Na(Array.from(Vi.current.values()),Ve));try{Pe==="line"||Pe==="area"?g.update({time:H.time,value:H.close}):g.update(H),le&&ne&&Ee(ne)}catch(k){throw k}}catch{}};p.on("candleUpdate",v);const J=()=>{p.connected&&Ge&&Ve&&f()};if(p.connected)J();else{const x=()=>{setTimeout(J,200)};p.once("connect",x),setTimeout(()=>{p.connected&&J()},500)}return()=>{p.off("candleUpdate",v),p.off("connect",K),p.off("disconnect",ge),p.off("connect_error",F),p.off("subscription:confirmed"),Ge&&Ve&&p.connected&&p.emit("unsubscribeCandles",{symbol:Ge,timeframe:Ve})}},[Ge,Ve,he]),j.useEffect(()=>{const p=y.current,f=d.current;if(!p||!f){_r(!1);return}if(!(ke.length===0&&we.current)){if(ke.length===0&&!we.current){if(vt)return;const K=f.timeScale();p.setData([]),K.fitContent(),ti.current&&clearTimeout(ti.current),ti.current=setTimeout(()=>requestAnimationFrame(()=>_r(!1)),400);return}if(!we.current){const K=f.timeScale(),ge=Se(Ge,Ve);xe.current,xe.current=ge;const F=[...ke].sort((x,te)=>x.time-te.time);if(Pe==="line"||Pe==="area"){const x=F?.map(te=>({time:te.time,value:te.close})).filter(te=>te.time!=null);x.length>0&&p.setData(x)}else F?.length>0&&p.setData(F);ap(p);const v=iA(Ve)||60;if(C.current.forEach(x=>{if(x.type==="horizontalray"&&x.primitive){const g=x.rawOriginTime??x.primitive.originTime,B=ze(g,v);x.primitive.originTime=B,x.originTime=B;return}if(x.type==="verticalline"&&x.primitive){const g=x.rawTime??x.primitive.time,B=ze(g,v);x.primitive.time=B,x.time=ie(B);return}if(x.type==="infoline"&&x.primitive&&x.p1&&x.p2){const g=x.rawP1Time??x.p1.rawTime,B=x.rawP2Time??x.p2.rawTime,T=F.length>0?F[0].time:null,w=F.length>0?F[F.length-1].time:null,u=k=>{const P=ze(k,v);return T==null||w==null?P:Math.min(Math.max(P,T),w)},D=u(g),H=u(B);x.p1.rawTime=D,x.p1.normalizedTime=ie(D),x.p2.rawTime=H,x.p2.normalizedTime=ie(H),x.primitive.p1={rawTime:D,price:x.p1.price},x.primitive.p2={rawTime:H,price:x.p2.price};return}if(x.type==="rulerline"&&x.primitive&&x.p1&&x.p2){const g=x.rawP1Time??x.p1.rawTime,B=x.rawP2Time??x.p2.rawTime,T=F.length>0?F[0].time:null,w=F.length>0?F[F.length-1].time:null,u=_=>{const N=ze(_,v);return T==null||w==null?N:Math.min(Math.max(N,T),w)},D=u(g),H=u(B);x.p1.rawTime=D,x.p2.rawTime=H,x.primitive.p1={rawTime:D,price:x.p1.price},x.primitive.p2={rawTime:H,price:x.p2.price};const k=ie(D),P=ie(H),m=Math.abs((P??0)-(k??0));x.primitive.info={priceDiff:x.p2.price-x.p1.price,pricePct:(x.p2.price-x.p1.price)/Math.abs(x.p1.price||1)*100,bars:ys(vs,D,H,Ve),days:Math.max(1,Math.round(m/86400))};return}if(x.type==="arrowedline"&&x.primitive&&x.p1&&x.p2){const g=x.p1.rawTime,B=x.p2.rawTime,T=ze(g,v),w=ze(B,v);x.p1.rawTime=T,x.p1.normalizedTime=ie(T),x.p2.rawTime=w,x.p2.normalizedTime=ie(w),x.primitive.p1={rawTime:T,price:x.p1.price},x.primitive.p2={rawTime:w,price:x.p2.price};return}if(x.type==="rayline"&&x.primitive&&x.p1&&x.p2){const g=x.p1.rawTime,B=x.p2.rawTime,T=ze(g,v),w=ze(B,v);x.p1.rawTime=T,x.p1.normalizedTime=ie(T),x.p2.rawTime=w,x.p2.normalizedTime=ie(w),x.primitive.p1={rawTime:T,price:x.p1.price},x.primitive.p2={rawTime:w,price:x.p2.price};return}if(x.type==="extendedline"&&x.primitive&&x.p1&&x.p2){const g=x.p1.rawTime,B=x.p2.rawTime,T=ze(g,v),w=ze(B,v);x.p1.rawTime=T,x.p1.normalizedTime=ie(T),x.p2.rawTime=w,x.p2.normalizedTime=ie(w),x.primitive.p1={rawTime:T,price:x.p1.price},x.primitive.p2={rawTime:w,price:x.p2.price};return}if(x.type==="trendbyangle"&&x.primitive&&x.p1&&x.p2){const g=x.p1.rawTime,B=x.p2.rawTime,T=ze(g,v),w=ze(B,v);x.p1.rawTime=T,x.p1.normalizedTime=ie(T),x.p2.rawTime=w,x.p2.normalizedTime=ie(w),x.primitive.p1={rawTime:T,price:x.p1.price},x.primitive.p2={rawTime:w,price:x.p2.price};return}if(x.type==="disjointchannel"&&x.primitive&&x.p1&&x.p2&&x.p3&&x.p4){const g=B=>{const T=ze(B.rawTime,v);B.rawTime=T,B.normalizedTime=ie(T)};g(x.p1),g(x.p2),g(x.p3),g(x.p4),x.primitive.p1={rawTime:x.p1.rawTime,price:x.p1.price},x.primitive.p2={rawTime:x.p2.rawTime,price:x.p2.price},x.primitive.p3={rawTime:x.p3.rawTime,price:x.p3.price},x.primitive.p4={rawTime:x.p4.rawTime,price:x.p4.price};return}if(x.type==="flattopbottom"&&x.primitive&&x.p1&&x.p2&&x.p3&&x.p4){const g=B=>{const T=ze(B.rawTime,v);B.rawTime=T,B.normalizedTime=ie(T)};g(x.p1),g(x.p2),g(x.p3),g(x.p4),x.primitive.p1={rawTime:x.p1.rawTime,price:x.p1.price},x.primitive.p2={rawTime:x.p2.rawTime,price:x.p2.price},x.primitive.p3={rawTime:x.p3.rawTime,price:x.p3.price},x.primitive.p4={rawTime:x.p4.rawTime,price:x.p4.price};return}if(x.type==="regressionchannel"&&x.primitive&&x.p1&&x.p2){const g=Ki(F,x.p1,x.p2,x.stdMultiplier??1);if(!g)return;const B=x.primitive;B.mid1={rawTime:g.p1.rawTime,price:g.p1.price},B.mid2={rawTime:g.p2.rawTime,price:g.p2.price},B.top1={rawTime:g.top1.rawTime,price:g.top1.price},B.top2={rawTime:g.top2.rawTime,price:g.top2.price},B.bot1={rawTime:g.bot1.rawTime,price:g.bot1.price},B.bot2={rawTime:g.bot2.rawTime,price:g.bot2.price},x.p1=g.p1,x.p2=g.p2,x.top1=g.top1,x.top2=g.top2,x.bot1=g.bot1,x.bot2=g.bot2,x.slope=g.slope,x.intercept=g.intercept,x.stdDev=g.stdDev,x.offset=g.offset,x.barCount=g.barCount;return}if(x.type==="stddevchannel"&&x.primitive&&x.p1&&x.p2){const g=Mr(F,x.p1,x.p2,x.stdMultiplier??1);if(!g)return;const B=x.primitive;B.mid1={rawTime:g.p1.rawTime,price:g.p1.price},B.mid2={rawTime:g.p2.rawTime,price:g.p2.price},B.top1={rawTime:g.top1.rawTime,price:g.top1.price},B.top2={rawTime:g.top2.rawTime,price:g.top2.price},B.bot1={rawTime:g.bot1.rawTime,price:g.bot1.price},B.bot2={rawTime:g.bot2.rawTime,price:g.bot2.price},x.p1=g.p1,x.p2=g.p2,x.top1=g.top1,x.top2=g.top2,x.bot1=g.bot1,x.bot2=g.bot2,x.slope=g.slope,x.stdDev=g.stdDev,x.offset=g.offset,x.barCount=g.barCount;return}if(x.type==="andrewspitchfork"&&x.primitive&&x.p1&&x.p2&&x.p3){const g=ze(x.p1.rawTime,v),B=ze(x.p2.rawTime,v),T=ze(x.p3.rawTime,v);x.p1.rawTime=g,x.p1.normalizedTime=ie(g),x.p2.rawTime=B,x.p2.normalizedTime=ie(B),x.p3.rawTime=T,x.p3.normalizedTime=ie(T),x.primitive.p1={rawTime:g,price:x.p1.price},x.primitive.p2={rawTime:B,price:x.p2.price},x.primitive.p3={rawTime:T,price:x.p3.price};return}if((x.type==="gannfan"||x.type==="ganngrid")&&x.primitive&&x.p1&&x.p2){const g=ze(x.p1.rawTime,v),B=ze(x.p2.rawTime,v);x.p1.rawTime=g,x.p1.normalizedTime=ie(g),x.p2.rawTime=B,x.p2.normalizedTime=ie(B),x.primitive.p1={rawTime:g,price:x.p1.price},x.primitive.p2={rawTime:B,price:x.p2.price};return}if((x.type==="circle"||x.type==="ellipse")&&x.primitive&&x.p1&&x.p2){const g=ze(x.p1.rawTime,v),B=ze(x.p2.rawTime,v);x.p1.rawTime=g,x.p1.normalizedTime=ie(g),x.p2.rawTime=B,x.p2.normalizedTime=ie(B),x.primitive.p1={rawTime:g,price:x.p1.price},x.primitive.p2={rawTime:B,price:x.p2.price};return}if(x.type==="triangle"&&x.primitive&&x.p1&&x.p2&&x.p3){const g=ze(x.p1.rawTime,v),B=ze(x.p2.rawTime,v),T=ze(x.p3.rawTime,v);x.p1.rawTime=g,x.p1.normalizedTime=ie(g),x.p2.rawTime=B,x.p2.normalizedTime=ie(B),x.p3.rawTime=T,x.p3.normalizedTime=ie(T),x.primitive.p1={rawTime:g,price:x.p1.price},x.primitive.p2={rawTime:B,price:x.p2.price},x.primitive.p3={rawTime:T,price:x.p3.price};return}if((x.type==="fibonacci"||x.type==="rectangle")&&x.primitive&&x.p1&&x.p2){const g=ze(x.p1.rawTime,v),B=ze(x.p2.rawTime,v);x.p1.rawTime=g,x.p1.normalizedTime=ie(g),x.p2.rawTime=B,x.p2.normalizedTime=ie(B),x.primitive.p1={rawTime:g,price:x.p1.price},x.primitive.p2={rawTime:B,price:x.p2.price};return}if(x.type!=="trendline"&&x.type!=="gannline"||!x.series||!x.point1||!x.point2)return;const te=x.point1.rawTime??x.point1.time,S=x.point2.rawTime??x.point2.time,V=ze(te,v),le=ze(S,v);x.point1.time=V,x.point2.time=le;const ne=EA([{time:V,value:x.point1.price},{time:le,value:x.point2.price}]);try{ne.length>0&&x.series.setData(ne)}catch{}}),F?.length>0){const x=F[F?.length-1].time,te=iA(Ve)||60,V=x-(Ve==="M1"?150:Ve==="M5"?120:100)*te;try{K.setVisibleRange({from:V,to:x+te*Zd})}catch{K.fitContent()}}else K.fitContent();try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}we.current=!0;const J=K.getVisibleRange();Ee(J),ti.current&&clearTimeout(ti.current),ti.current=setTimeout(()=>requestAnimationFrame(()=>_r(!1)),400)}}},[ke.length,Pe,Ge,Ve]),j.useEffect(()=>{const p=d.current;if(!p||!we.current||ke.length===0)return;const f=p.timeScale(),K=f.getVisibleRange()||He();if(y.current)try{p.removeSeries(y.current)}catch{}if(b.current)try{p.removeSeries(b.current),b.current=null}catch{}let ge;if(Pe==="bars"){const v=ae==="light";ge=p.addBarSeries({upColor:v?"#089981":"#26A69A",downColor:v?"#f23645":"#EF5350",borderUpColor:v?"#089981":"#26A69A",borderDownColor:v?"#f23645":"#EF5350",scaleMargins:{top:.1,bottom:.1}});const J=[...ke].sort((x,te)=>x.time-te.time);J?.length>0&&ge.setData(J)}else if(Pe==="line"){ge=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const v=EA(za);v.length>0&&ge.setData(v)}else if(Pe==="area"){ge=p.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const v=EA(za);v.length>0&&ge.setData(v)}else if(Pe==="volume ticks"||Pe==="volume"){const v=ae==="light";ge=p.addCandlestickSeries({upColor:v?"#089981":"#26A69A",downColor:v?"#f23645":"#EF5350",wickUpColor:v?"#089981":"#26A69A",wickDownColor:v?"#f23645":"#EF5350",borderUpColor:v?"#089981":"#26A69A",borderDownColor:v?"#f23645":"#EF5350",borderVisible:!0,priceScaleId:"right"});const J=[...ke].sort((S,V)=>S.time-V.time);J?.length>0&&ge.setData(J);const x=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 te=J?.map(S=>({time:S.time,value:S.volume||0,color:S.close>=S.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));te.length>0&&x.setData(te),b.current=x}else{const v=ae==="light";ge=p.addCandlestickSeries({upColor:v?"#089981":"#26A69A",downColor:v?"#f23645":"#EF5350",wickUpColor:v?"#089981":"#26A69A",wickDownColor:v?"#f23645":"#EF5350",borderUpColor:v?"#089981":"#26A69A",borderDownColor:v?"#f23645":"#EF5350",borderVisible:!0,scaleMargins:{top:.1,bottom:.1}});const J=[...ke].sort((x,te)=>x.time-te.time);J?.length>0&&ge.setData(J)}y.current=ge,ap(ge,!0);const F=iA(Ve)||60;if(C.current.forEach(v=>{if(v.type==="horizontalray"&&v.primitive){const g=v.rawOriginTime??v.primitive.originTime,B=ze(g,F);v.primitive.originTime=B,v.originTime=B;return}if(v.type==="verticalline"&&v.primitive){const g=v.rawTime??v.primitive.time,B=ze(g,F);v.primitive.time=B,v.time=ie(B);return}if(v.type==="infoline"&&v.primitive&&v.p1&&v.p2){const g=v.rawP1Time??v.p1.rawTime,B=v.rawP2Time??v.p2.rawTime,T=[...ke].sort((P,m)=>P.time-m.time),w=T.length>0?T[0].time:null,u=T.length>0?T[T.length-1].time:null,D=P=>{const m=ze(P,F);return w==null||u==null?m:Math.min(Math.max(m,w),u)},H=D(g),k=D(B);v.p1.rawTime=H,v.p1.normalizedTime=ie(H),v.p2.rawTime=k,v.p2.normalizedTime=ie(k),v.primitive.p1={rawTime:H,price:v.p1.price},v.primitive.p2={rawTime:k,price:v.p2.price};return}if(v.type==="rulerline"&&v.primitive&&v.p1&&v.p2){const g=v.rawP1Time??v.p1.rawTime,B=v.rawP2Time??v.p2.rawTime,T=[...ke].sort((N,z)=>N.time-z.time),w=T.length>0?T[0].time:null,u=T.length>0?T[T.length-1].time:null,D=N=>{const z=ze(N,F);return w==null||u==null?z:Math.min(Math.max(z,w),u)},H=D(g),k=D(B);v.p1.rawTime=H,v.p2.rawTime=k,v.primitive.p1={rawTime:H,price:v.p1.price},v.primitive.p2={rawTime:k,price:v.p2.price};const P=ie(H),m=ie(k),_=Math.abs((m??0)-(P??0));v.primitive.info={priceDiff:v.p2.price-v.p1.price,pricePct:(v.p2.price-v.p1.price)/Math.abs(v.p1.price||1)*100,bars:ys(vs,H,k,Ve),days:Math.max(1,Math.round(_/86400))};return}if(v.type==="arrowedline"&&v.primitive&&v.p1&&v.p2){const g=v.p1.rawTime,B=v.p2.rawTime,T=ze(g,F),w=ze(B,F);v.p1.rawTime=T,v.p1.normalizedTime=ie(T),v.p2.rawTime=w,v.p2.normalizedTime=ie(w),v.primitive.p1={rawTime:T,price:v.p1.price},v.primitive.p2={rawTime:w,price:v.p2.price};return}if(v.type==="rayline"&&v.primitive&&v.p1&&v.p2){const g=v.p1.rawTime,B=v.p2.rawTime,T=ze(g,F),w=ze(B,F);v.p1.rawTime=T,v.p1.normalizedTime=ie(T),v.p2.rawTime=w,v.p2.normalizedTime=ie(w),v.primitive.p1={rawTime:T,price:v.p1.price},v.primitive.p2={rawTime:w,price:v.p2.price};return}if(v.type==="extendedline"&&v.primitive&&v.p1&&v.p2){const g=v.p1.rawTime,B=v.p2.rawTime,T=ze(g,F),w=ze(B,F);v.p1.rawTime=T,v.p1.normalizedTime=ie(T),v.p2.rawTime=w,v.p2.normalizedTime=ie(w),v.primitive.p1={rawTime:T,price:v.p1.price},v.primitive.p2={rawTime:w,price:v.p2.price};return}if(v.type==="trendbyangle"&&v.primitive&&v.p1&&v.p2){const g=v.p1.rawTime,B=v.p2.rawTime,T=ze(g,F),w=ze(B,F);v.p1.rawTime=T,v.p1.normalizedTime=ie(T),v.p2.rawTime=w,v.p2.normalizedTime=ie(w),v.primitive.p1={rawTime:T,price:v.p1.price},v.primitive.p2={rawTime:w,price:v.p2.price};return}if(v.type==="disjointchannel"&&v.primitive&&v.p1&&v.p2&&v.p3&&v.p4){const g=B=>{const T=ze(B.rawTime,F);B.rawTime=T,B.normalizedTime=ie(T)};g(v.p1),g(v.p2),g(v.p3),g(v.p4),v.primitive.p1={rawTime:v.p1.rawTime,price:v.p1.price},v.primitive.p2={rawTime:v.p2.rawTime,price:v.p2.price},v.primitive.p3={rawTime:v.p3.rawTime,price:v.p3.price},v.primitive.p4={rawTime:v.p4.rawTime,price:v.p4.price};return}if(v.type==="flattopbottom"&&v.primitive&&v.p1&&v.p2&&v.p3&&v.p4){const g=B=>{const T=ze(B.rawTime,F);B.rawTime=T,B.normalizedTime=ie(T)};g(v.p1),g(v.p2),g(v.p3),g(v.p4),v.primitive.p1={rawTime:v.p1.rawTime,price:v.p1.price},v.primitive.p2={rawTime:v.p2.rawTime,price:v.p2.price},v.primitive.p3={rawTime:v.p3.rawTime,price:v.p3.price},v.primitive.p4={rawTime:v.p4.rawTime,price:v.p4.price};return}if(v.type==="regressionchannel"&&v.primitive&&v.p1&&v.p2){const g=[...ke].sort((w,u)=>w.time-u.time),B=Ki(g,v.p1,v.p2,v.stdMultiplier??1);if(!B)return;const T=v.primitive;T.mid1={rawTime:B.p1.rawTime,price:B.p1.price},T.mid2={rawTime:B.p2.rawTime,price:B.p2.price},T.top1={rawTime:B.top1.rawTime,price:B.top1.price},T.top2={rawTime:B.top2.rawTime,price:B.top2.price},T.bot1={rawTime:B.bot1.rawTime,price:B.bot1.price},T.bot2={rawTime:B.bot2.rawTime,price:B.bot2.price},v.p1=B.p1,v.p2=B.p2,v.top1=B.top1,v.top2=B.top2,v.bot1=B.bot1,v.bot2=B.bot2,v.slope=B.slope,v.intercept=B.intercept,v.stdDev=B.stdDev,v.offset=B.offset,v.barCount=B.barCount;return}if(v.type==="stddevchannel"&&v.primitive&&v.p1&&v.p2){const g=[...ke].sort((w,u)=>w.time-u.time),B=Mr(g,v.p1,v.p2,v.stdMultiplier??1);if(!B)return;const T=v.primitive;T.mid1={rawTime:B.p1.rawTime,price:B.p1.price},T.mid2={rawTime:B.p2.rawTime,price:B.p2.price},T.top1={rawTime:B.top1.rawTime,price:B.top1.price},T.top2={rawTime:B.top2.rawTime,price:B.top2.price},T.bot1={rawTime:B.bot1.rawTime,price:B.bot1.price},T.bot2={rawTime:B.bot2.rawTime,price:B.bot2.price},v.p1=B.p1,v.p2=B.p2,v.top1=B.top1,v.top2=B.top2,v.bot1=B.bot1,v.bot2=B.bot2,v.slope=B.slope,v.stdDev=B.stdDev,v.offset=B.offset,v.barCount=B.barCount;return}if(v.type==="andrewspitchfork"&&v.primitive&&v.p1&&v.p2&&v.p3){const g=ze(v.p1.rawTime,F),B=ze(v.p2.rawTime,F),T=ze(v.p3.rawTime,F);v.p1.rawTime=g,v.p1.normalizedTime=ie(g),v.p2.rawTime=B,v.p2.normalizedTime=ie(B),v.p3.rawTime=T,v.p3.normalizedTime=ie(T),v.primitive.p1={rawTime:g,price:v.p1.price},v.primitive.p2={rawTime:B,price:v.p2.price},v.primitive.p3={rawTime:T,price:v.p3.price};return}if((v.type==="gannfan"||v.type==="ganngrid")&&v.primitive&&v.p1&&v.p2){const g=ze(v.p1.rawTime,F),B=ze(v.p2.rawTime,F);v.p1.rawTime=g,v.p1.normalizedTime=ie(g),v.p2.rawTime=B,v.p2.normalizedTime=ie(B),v.primitive.p1={rawTime:g,price:v.p1.price},v.primitive.p2={rawTime:B,price:v.p2.price};return}if((v.type==="circle"||v.type==="ellipse")&&v.primitive&&v.p1&&v.p2){const g=ze(v.p1.rawTime,F),B=ze(v.p2.rawTime,F);v.p1.rawTime=g,v.p1.normalizedTime=ie(g),v.p2.rawTime=B,v.p2.normalizedTime=ie(B),v.primitive.p1={rawTime:g,price:v.p1.price},v.primitive.p2={rawTime:B,price:v.p2.price};return}if(v.type==="triangle"&&v.primitive&&v.p1&&v.p2&&v.p3){const g=ze(v.p1.rawTime,F),B=ze(v.p2.rawTime,F),T=ze(v.p3.rawTime,F);v.p1.rawTime=g,v.p1.normalizedTime=ie(g),v.p2.rawTime=B,v.p2.normalizedTime=ie(B),v.p3.rawTime=T,v.p3.normalizedTime=ie(T),v.primitive.p1={rawTime:g,price:v.p1.price},v.primitive.p2={rawTime:B,price:v.p2.price},v.primitive.p3={rawTime:T,price:v.p3.price};return}if((v.type==="fibonacci"||v.type==="rectangle")&&v.primitive&&v.p1&&v.p2){const g=ze(v.p1.rawTime,F),B=ze(v.p2.rawTime,F);v.p1.rawTime=g,v.p1.normalizedTime=ie(g),v.p2.rawTime=B,v.p2.normalizedTime=ie(B),v.primitive.p1={rawTime:g,price:v.p1.price},v.primitive.p2={rawTime:B,price:v.p2.price};return}if(v.type!=="trendline"&&v.type!=="gannline"||!v.series||!v.point1||!v.point2)return;const J=v.type==="gannline"?"#7aa6ae":"#22c55e";try{p.removeSeries(v.series)}catch{}const x=p.addLineSeries({color:v.lineColor??J,lineWidth:v.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),te=v.point1.rawTime??v.point1.time,S=v.point2.rawTime??v.point2.time,V=ze(te,F),le=ze(S,F);v.point1.time=V,v.point2.time=le;const ne=EA([{time:V,value:v.point1.price},{time:le,value:v.point2.price}]);try{ne.length>0&&x.setData(ne)}catch{}if(v.decoration)try{x.attachPrimitive(v.decoration)}catch{}v.series=x}),K&&we.current)setTimeout(()=>{try{f.setVisibleRange(K),Ee(K)}catch{if(ke.length>0)try{const J=ke[ke.length-1].time,x=iA(Ve)||60,te=J-100*x;f.setVisibleRange({from:te,to:J+x*Zd}),Ee(f.getVisibleRange())}catch{f.fitContent(),Ee(f.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!we.current){f.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}we.current=!0,Ee(f.getVisibleRange())}},[Pe,ke.length,za.length]),j.useEffect(()=>{const p=d.current,f=b.current;if(!p||!f||!we.current||ke.length===0||Pe!=="volume"&&Pe!=="volume ticks")return;const ge=[...ke].sort((F,v)=>F.time-v.time)?.map(F=>({time:F.time,value:F.volume||0,color:F.close>=F.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ge.length>0&&f.setData(ge)},[ke,Pe]),j.useEffect(()=>{const p=d.current,f=y.current,K=c.current;if(!p||!f||!K)return;const F=_e!==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"][_e]:null,v=(S,V)=>{const le=Math.min(S.time,V.time),ne=Math.max(S.time,V.time),g=S.time<=V.time?S.rawTime:V.rawTime,B=S.time<=V.time?V.rawTime:S.rawTime,T=Math.max(S.price,V.price),w=Math.min(S.price,V.price),u=ie(Math.round((le+ne)/2));return u==null?null:{p1:{rawTime:u,normalizedTime:u,price:T},p2:{rawTime:g,normalizedTime:le,price:w},p3:{rawTime:B,normalizedTime:ne,price:w}}};if(!F){if(U.current=!1,M.current=null,E.current=null,R.current=null,I.current?.series)try{p.removeSeries(I.current.series)}catch{}if(I.current?.primitive)try{f.detachPrimitive(I.current.primitive)}catch{}I.current=null;return}if(F==="pricelevel"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const u={type:"pricelevel",priceLine:f.createPriceLine({price:T,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:T.toFixed(5)}),price:T,showPrice:!0,showText:!1};Te(D=>[...D,u]),C.current.push(u),Qe(null)};return K.addEventListener("click",S),()=>{K.removeEventListener("click",S)}}if(F==="horizontalray"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=new Kv(T,B);f.attachPrimitive(w);const u=f.createPriceLine({price:T,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof T=="number"?T.toFixed(5):""}),D=ie(B),H={type:"horizontalray",primitive:w,priceLine:u,price:T,originTime:D,rawOriginTime:B,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};Te(k=>[...k,H]),C.current.push(H),Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="verticalline"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=p.timeScale().coordinateToTime(ne);if(g==null)return;const B=new tx(g);f.attachPrimitive(B);const T=ie(g),w={type:"verticalline",primitive:B,time:T,rawTime:g,lineColor:"#3b82f6",lineWidth:2,showDate:!0};Te(u=>[...u,w]),C.current.push(w),Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="text"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=new ix(B,T);f.attachPrimitive(w);const u={type:"text",primitive:w,rawTime:B,price:T,text:"Text"};Te(D=>[...D,u]),C.current.push(u),Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="infoline"){let S=null,V=null;const le=g=>{if(!S)return;const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top,u=p.timeScale().coordinateToTime(T),D=f.coordinateToPrice(w);if(u==null||D==null)return;V||(V=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const H=S.normalizedTime,k=ie(u);if(H==null||k==null||H===k)return;const P=H<=k?[{time:H,value:S.price},{time:k,value:D}]:[{time:k,value:D},{time:H,value:S.price}];try{V.setData(P)}catch{}},ne=g=>{const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top,u=p.timeScale().coordinateToTime(T),D=f.coordinateToPrice(w);if(u==null||D==null)return;if(!S){S={rawTime:u,price:D,normalizedTime:ie(u),x:T,y:w};return}if(V){try{p.removeSeries(V)}catch{}V=null}const H=S.normalizedTime,k=ie(u);if(H==null||k==null)return;const P=D-S.price,m=P/Math.abs(S.price)*100,_=iA(Ve)||3600,N=Math.abs(k-H),z=Math.max(1,Math.round(N/_)),G=Math.max(1,Math.round(N/86400)),q=S.x,se=S.y,de=T,be=Math.atan2(-(w-se),de-q)*(180/Math.PI),Me={priceDiff:P,pricePct:m,bars:z,days:G,angle:be},Xe=new Vv({rawTime:S.rawTime,price:S.price},{rawTime:u,price:D},Me);f.attachPrimitive(Xe);const At={type:"infoline",primitive:Xe,rawP1Time:S.rawTime,rawP2Time:u,p1:{rawTime:S.rawTime,normalizedTime:H,price:S.price},p2:{rawTime:u,normalizedTime:k,price:D},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};Te($e=>[...$e,At]),C.current.push(At),S=null,Qe(null)};return K.addEventListener("mousemove",le),K.addEventListener("click",ne),()=>{if(K.removeEventListener("mousemove",le),K.removeEventListener("click",ne),V)try{p.removeSeries(V)}catch{}}}if(F==="rulerline"){let S=null,V=null;const le=(B,T,w,u)=>{const D=ie(B),H=ie(w),k=u-T,P=k/Math.abs(T)*100,m=ys(vs,B,w,Ve),_=Math.abs((H??0)-(D??0)),N=Math.max(1,Math.round(_/86400));return{priceDiff:k,pricePct:P,bars:m,days:N}},ne=B=>{if(!S)return;const T=K.getBoundingClientRect(),w=B.clientX-T.left,u=B.clientY-T.top,D=p.timeScale().coordinateToTime(w),H=f.coordinateToPrice(u);if(D==null||H==null)return;const k=ie(D);if(k==null||k===S.normalizedTime)return;const P=le(S.rawTime,S.price,D,H);if(!V)V=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:D,price:H},P),f.attachPrimitive(V);else{V.p2={rawTime:D,price:H},V.info=P;const m=H>=S.price;V.color=m?"#3b82f6":"#ef5350",V.fillColor=m?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{d.current?.applyOptions({})}catch{}}},g=B=>{const T=K.getBoundingClientRect(),w=B.clientX-T.left,u=B.clientY-T.top,D=p.timeScale().coordinateToTime(w),H=f.coordinateToPrice(u);if(D==null||H==null)return;if(!S){S={rawTime:D,price:H,normalizedTime:ie(D)};return}if(V){try{f.detachPrimitive(V)}catch{}V=null}const k=S.normalizedTime,P=ie(D);if(k==null||P==null)return;const m=le(S.rawTime,S.price,D,H),_=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:D,price:H},m);f.attachPrimitive(_);const N={type:"rulerline",primitive:_,rawP1Time:S.rawTime,rawP2Time:D,p1:{rawTime:S.rawTime,normalizedTime:k,price:S.price},p2:{rawTime:D,normalizedTime:P,price:H},lineColor:H>=S.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};Te(z=>[...z,N]),C.current.push(N),S=null,Qe(null)};return K.addEventListener("mousemove",ne),K.addEventListener("click",g),()=>{if(K.removeEventListener("mousemove",ne),K.removeEventListener("click",g),V)try{f.detachPrimitive(V)}catch{}}}if(F==="arrowedline"){let S=null,V=null;const le=g=>{if(!S)return;const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top,u=p.timeScale().coordinateToTime(T),D=f.coordinateToPrice(w);if(u==null||D==null)return;const H=ie(u);if(!(H==null||H===S.normalizedTime))if(!V)V=new Od({rawTime:S.rawTime,price:S.price},{rawTime:u,price:D}),f.attachPrimitive(V);else{V.p2={rawTime:u,price:D};try{d.current?.applyOptions({})}catch{}}},ne=g=>{const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top,u=p.timeScale().coordinateToTime(T),D=f.coordinateToPrice(w);if(u==null||D==null)return;if(!S){S={rawTime:u,price:D,normalizedTime:ie(u)};return}if(V){try{f.detachPrimitive(V)}catch{}V=null}const H=S.normalizedTime,k=ie(u);if(H==null||k==null||H===k)return;const P=new Od({rawTime:S.rawTime,price:S.price},{rawTime:u,price:D});f.attachPrimitive(P);const m={type:"arrowedline",primitive:P,p1:{rawTime:S.rawTime,normalizedTime:H,price:S.price},p2:{rawTime:u,normalizedTime:k,price:D},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(_=>[..._,m]),C.current.push(m),S=null,Qe(null)};return K.addEventListener("mousemove",le),K.addEventListener("click",ne),()=>{if(K.removeEventListener("mousemove",le),K.removeEventListener("click",ne),V)try{f.detachPrimitive(V)}catch{}}}if(F==="rayline"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=ne+140,u=p.timeScale().coordinateToTime(w);if(u==null)return;const D=ie(B),H=ie(u);if(D==null||H==null)return;const k=new $v({rawTime:B,price:T},{rawTime:u,price:T});f.attachPrimitive(k);const P={type:"rayline",primitive:k,p1:{rawTime:B,normalizedTime:D,price:T},p2:{rawTime:u,normalizedTime:H,price:T},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(m=>[...m,P]),C.current.push(P),Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="extendedline"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=ne+140,u=p.timeScale().coordinateToTime(w);if(u==null)return;const D=ie(B),H=ie(u);if(D==null||H==null)return;const k=new Xv({rawTime:B,price:T},{rawTime:u,price:T});f.attachPrimitive(k);const P={type:"extendedline",primitive:k,p1:{rawTime:B,normalizedTime:D,price:T},p2:{rawTime:u,normalizedTime:H,price:T},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Te(m=>[...m,P]),C.current.push(P),Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="crossline"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=ie(B);if(w==null)return;const u=new Jv({rawTime:B,price:T});f.attachPrimitive(u);const D={type:"crossline",primitive:u,p:{rawTime:B,normalizedTime:w,price:T},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};Te(H=>[...H,D]),C.current.push(D),Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="trendbyangle"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=ne+140,u=p.timeScale().coordinateToTime(w);if(u==null)return;const D=ie(B),H=ie(u);if(D==null||H==null)return;const k=new Yv({rawTime:B,price:T},{rawTime:u,price:T});f.attachPrimitive(k);const P={type:"trendbyangle",primitive:k,p1:{rawTime:B,normalizedTime:D,price:T},p2:{rawTime:u,normalizedTime:H,price:T},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};Te(m=>[...m,P]),C.current.push(P),Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="disjointchannel"){let S=null,V=null,le=null,ne=null,g=0,B=null;const T=(D,H,k,P)=>{if(!B)B=new _a(D,H,k,P),f.attachPrimitive(B);else{B.p1=D,B.p2=H,B.p3=k,B.p4=P;try{d.current?.applyOptions({})}catch{}}},w=D=>{if(g===0||!S)return;const H=K.getBoundingClientRect(),k=D.clientX-H.left,P=D.clientY-H.top;if(g===1){const m=f.coordinateToPrice(P);if(m==null)return;V={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:m},T({rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price},{rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price});return}if(g===2&&V){const m=p.timeScale().coordinateToTime(k),_=f.coordinateToPrice(P);if(m==null||_==null)return;const N=ie(m);if(N==null)return;const z=(S.price+V.price)/2;_>=z?(le={rawTime:m,normalizedTime:N,price:_},ne={rawTime:m,normalizedTime:N,price:2*z-_}):(ne={rawTime:m,normalizedTime:N,price:_},le={rawTime:m,normalizedTime:N,price:2*z-_}),T({rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price},{rawTime:le.rawTime,price:le.price},{rawTime:ne.rawTime,price:ne.price})}},u=D=>{const H=K.getBoundingClientRect(),k=D.clientX-H.left,P=D.clientY-H.top,m=p.timeScale().coordinateToTime(k),_=f.coordinateToPrice(P);if(m==null||_==null)return;const N=ie(m);if(N!=null){if(g===0){S={rawTime:m,normalizedTime:N,price:_},V={rawTime:m,normalizedTime:N,price:_},g=1,T({rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price},{rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price});return}if(g===1){const z=f.coordinateToPrice(P);if(z==null||Math.abs(z-S.price)<1e-7)return;V={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:z},g=2;return}if(g===2&&B){try{f.detachPrimitive(B)}catch{}const z=new _a(B.p1,B.p2,B.p3,B.p4);f.attachPrimitive(z);const G={type:"disjointchannel",primitive:z,p1:S,p2:V,p3:{rawTime:B.p3.rawTime,normalizedTime:ie(B.p3.rawTime),price:B.p3.price},p4:{rawTime:B.p4.rawTime,normalizedTime:ie(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};Te(q=>[...q,G]),C.current.push(G),Qe(null)}}};return K.addEventListener("mousemove",w),K.addEventListener("click",u),()=>{if(K.removeEventListener("mousemove",w),K.removeEventListener("click",u),B)try{f.detachPrimitive(B)}catch{}}}if(F==="flattopbottom"){let S=null,V=null,le=null,ne=null,g=0,B=null;const T=(D,H,k,P)=>{if(!B)B=new Kd(D,H,k,P),f.attachPrimitive(B);else{B.p1=D,B.p2=H,B.p3=k,B.p4=P;try{d.current?.applyOptions({})}catch{}}},w=D=>{if(g===0||!S)return;const H=K.getBoundingClientRect(),k=D.clientX-H.left,P=D.clientY-H.top;if(g===1){const m=f.coordinateToPrice(P);if(m==null)return;V={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:m},T({rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price},{rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price});return}if(g===2&&V){const m=p.timeScale().coordinateToTime(k),_=f.coordinateToPrice(P);if(m==null||_==null)return;const N=ie(m);if(N==null)return;le={rawTime:m,normalizedTime:N,price:_},ne={rawTime:m,normalizedTime:N,price:V.price},T({rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price},{rawTime:le.rawTime,price:le.price},{rawTime:ne.rawTime,price:ne.price})}},u=D=>{const H=K.getBoundingClientRect(),k=D.clientX-H.left,P=D.clientY-H.top,m=p.timeScale().coordinateToTime(k),_=f.coordinateToPrice(P);if(m==null||_==null)return;const N=ie(m);if(N!=null){if(g===0){S={rawTime:m,normalizedTime:N,price:_},V={rawTime:m,normalizedTime:N,price:_},g=1,T({rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price},{rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price});return}if(g===1){const z=f.coordinateToPrice(P);if(z==null||Math.abs(z-S.price)<1e-7)return;V={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:z},g=2;return}if(g===2&&B){try{f.detachPrimitive(B)}catch{}const z=new Kd(B.p1,B.p2,B.p3,B.p4);f.attachPrimitive(z);const G={type:"flattopbottom",primitive:z,p1:S,p2:V,p3:{rawTime:B.p3.rawTime,normalizedTime:ie(B.p3.rawTime),price:B.p3.price},p4:{rawTime:B.p4.rawTime,normalizedTime:ie(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};Te(q=>[...q,G]),C.current.push(G),Qe(null)}}};return K.addEventListener("mousemove",w),K.addEventListener("click",u),()=>{if(K.removeEventListener("mousemove",w),K.removeEventListener("click",u),B)try{f.detachPrimitive(B)}catch{}}}if(F==="regressionchannel"){let S=null,V=null;const le=(B,T)=>{B.mid1={rawTime:T.p1.rawTime,price:T.p1.price},B.mid2={rawTime:T.p2.rawTime,price:T.p2.price},B.top1={rawTime:T.top1.rawTime,price:T.top1.price},B.top2={rawTime:T.top2.rawTime,price:T.top2.price},B.bot1={rawTime:T.bot1.rawTime,price:T.bot1.price},B.bot2={rawTime:T.bot2.rawTime,price:T.bot2.price}},ne=B=>{if(!S)return;const T=K.getBoundingClientRect(),w=B.clientX-T.left,u=B.clientY-T.top,D=p.timeScale().coordinateToTime(w),H=f.coordinateToPrice(u);if(D==null||H==null)return;const k=ie(D);if(k==null)return;const m=Ki(ke,S,{rawTime:D,normalizedTime:k},1);if(m)if(!V)V=new ka({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(V);else{le(V,m);try{p.applyOptions({})}catch{}}},g=B=>{const T=K.getBoundingClientRect(),w=B.clientX-T.left,u=B.clientY-T.top,D=p.timeScale().coordinateToTime(w),H=f.coordinateToPrice(u);if(D==null||H==null)return;const k=ie(D);if(k==null)return;if(!S){S={rawTime:D,normalizedTime:k,price:H};return}const m=Ki(ke,S,{rawTime:D,normalizedTime:k},1);if(!m)return;if(V){try{f.detachPrimitive(V)}catch{}V=null}const _=new ka({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(_);const N={type:"regressionchannel",primitive:_,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,intercept:m.intercept,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Te(z=>[...z,N]),C.current.push(N),S=null,Qe(null)};return K.addEventListener("mousemove",ne),K.addEventListener("click",g),()=>{if(K.removeEventListener("mousemove",ne),K.removeEventListener("click",g),V)try{f.detachPrimitive(V)}catch{}}}if(F==="stddevchannel"){let S=null,V=null;const le=(B,T)=>{B.mid1={rawTime:T.p1.rawTime,price:T.p1.price},B.mid2={rawTime:T.p2.rawTime,price:T.p2.price},B.top1={rawTime:T.top1.rawTime,price:T.top1.price},B.top2={rawTime:T.top2.rawTime,price:T.top2.price},B.bot1={rawTime:T.bot1.rawTime,price:T.bot1.price},B.bot2={rawTime:T.bot2.rawTime,price:T.bot2.price}},ne=B=>{if(!S)return;const T=K.getBoundingClientRect(),w=B.clientX-T.left,u=B.clientY-T.top,D=p.timeScale().coordinateToTime(w),H=f.coordinateToPrice(u);if(D==null||H==null)return;const k=ie(D);if(k==null)return;const m=Mr(ke,S,{rawTime:D,normalizedTime:k},1);if(m)if(!V)V=new zd({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),f.attachPrimitive(V);else{le(V,m);try{p.applyOptions({})}catch{}}},g=B=>{const T=K.getBoundingClientRect(),w=B.clientX-T.left,u=B.clientY-T.top,D=p.timeScale().coordinateToTime(w),H=f.coordinateToPrice(u);if(D==null||H==null)return;const k=ie(D);if(k==null)return;if(!S){S={rawTime:D,normalizedTime:k,price:H};return}const m=Mr(ke,S,{rawTime:D,normalizedTime:k},1);if(!m)return;if(V){try{f.detachPrimitive(V)}catch{}V=null}const _=new zd({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});f.attachPrimitive(_);const N={type:"stddevchannel",primitive:_,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Te(z=>[...z,N]),C.current.push(N),S=null,Qe(null)};return K.addEventListener("mousemove",ne),K.addEventListener("click",g),()=>{if(K.removeEventListener("mousemove",ne),K.removeEventListener("click",g),V)try{f.detachPrimitive(V)}catch{}}}if(F==="andrewspitchfork"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=ie(B);if(w==null)return;const u=ne+140,D=p.timeScale().coordinateToTime(u);if(D==null)return;const H=ie(D);if(H==null)return;const k={rawTime:B,normalizedTime:w,price:T},P={rawTime:D,normalizedTime:H,price:T},m={rawTime:B,normalizedTime:w,price:T},_=new qv({rawTime:k.rawTime,price:k.price},{rawTime:P.rawTime,price:P.price},{rawTime:m.rawTime,price:m.price});f.attachPrimitive(_);const N={type:"andrewspitchfork",primitive:_,p1:k,p2:P,p3:m};Te(z=>[...z,N]),C.current.push(N),Y(N),re.current=N,Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="gannfan"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=ie(B);if(w==null)return;const u={rawTime:B,normalizedTime:w,price:T},D={rawTime:B,normalizedTime:w,price:T},H=new jv({rawTime:u.rawTime,price:u.price},{rawTime:D.rawTime,price:D.price});f.attachPrimitive(H);const k={type:"gannfan",primitive:H,p1:u,p2:D};Te(P=>[...P,k]),C.current.push(k),Y(k),re.current=k,Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="ganngrid"){const S=V=>{const le=K.getBoundingClientRect(),ne=V.clientX-le.left,g=V.clientY-le.top,B=p.timeScale().coordinateToTime(ne),T=f.coordinateToPrice(g);if(B==null||T==null)return;const w=ie(B);if(w==null)return;const u={rawTime:B,normalizedTime:w,price:T},D={rawTime:B,normalizedTime:w,price:T},H=new ex({rawTime:u.rawTime,price:u.price},{rawTime:D.rawTime,price:D.price});f.attachPrimitive(H);const k={type:"ganngrid",primitive:H,p1:u,p2:D};Te(P=>[...P,k]),C.current.push(k),Y(k),re.current=k,Qe(null)};return K.addEventListener("click",S),()=>K.removeEventListener("click",S)}if(F==="trendline"||F==="gannline"){const S=F,V=S==="gannline"?"#7aa6ae":"#22c55e",le=T=>{T.preventDefault(),T.stopPropagation(),T.stopImmediatePropagation();const w=K.getBoundingClientRect(),u=T.clientX-w.left,D=T.clientY-w.top;let H=p.timeScale().coordinateToTime(u);const k=f.coordinateToPrice(D);if(!(H==null||k==null)&&(H=ie(H),H!=null))if(R.current===null){R.current={time:H,price:k};const P=p.addLineSeries({color:V,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});I.current={type:S,series:P},P.setData([{time:H,value:k}])}else{const P=R.current,m={time:H,price:k},_=1,N=1e-5,z=Math.abs(m.time-P.time),G=Math.abs(m.price-P.price);if(z<_&&G<N){try{p.removeSeries(I.current.series)}catch{}R.current=null,I.current=null;return}const q={time:P.time,rawTime:P.time,price:P.price},se={time:m.time,rawTime:m.time,price:m.price},de=EA([{time:q.time,value:q.price},{time:se.time,value:se.price}]);if(de.length>0){I.current.series.setData(de);const ye=new Zv(q,se,V,2);try{I.current.series.attachPrimitive(ye)}catch{}const be={type:S,series:I.current.series,point1:q,point2:se,decoration:ye};Te(Me=>[...Me,be]),C.current.push(be)}Qe(null),R.current=null,I.current=null}},ne=T=>{if(R.current===null||I.current?.type!=="trendline"&&I.current?.type!=="gannline")return;T.preventDefault(),T.stopPropagation();const w=K.getBoundingClientRect(),u=T.clientX-w.left,D=T.clientY-w.top;let H=p.timeScale().coordinateToTime(u);const k=f.coordinateToPrice(D);if(H==null||k==null||(H=ie(H),H==null))return;const P=R.current,m=EA([{time:P.time,value:P.price},{time:H,value:k}]);m.length>0&&I.current.series.setData(m)},g=T=>{T.stopPropagation()},B={capture:!0,passive:!1};return K.addEventListener("click",le,B),K.addEventListener("mousemove",ne,B),K.addEventListener("mousemove",g,B),()=>{if(R.current=null,(I.current?.type==="trendline"||I.current?.type==="gannline")&&I.current?.series){try{p.removeSeries(I.current.series)}catch{}I.current=null}K.removeEventListener("click",le,B),K.removeEventListener("mousemove",ne,B),K.removeEventListener("mousemove",g,B)}}if(F==="parallellines"){let S=null,V=null,le=null,ne=0,g=null;const B=(k,P,m,_)=>{k.p1={rawTime:P.rawTime,price:P.price},k.p2={rawTime:m.rawTime,price:m.price},k.b1={rawTime:_.b1.rawTime,price:_.b1.price},k.b2={rawTime:_.b2.rawTime,price:_.b2.price},k.p3={rawTime:_.bottomMid.rawTime,price:_.bottomMid.price}},T=(k,P,m)=>{const _=Xd(k,P,m);if(!_)return null;if(!g)g=new Vd({rawTime:k.rawTime,price:k.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.b1.rawTime,price:_.b1.price},{rawTime:_.b2.rawTime,price:_.b2.price},{rawTime:_.bottomMid.rawTime,price:_.bottomMid.price}),f.attachPrimitive(g);else{B(g,k,P,_);try{p.applyOptions({})}catch{}}return _},w=k=>{k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation();const P=K.getBoundingClientRect(),m=k.clientX-P.left,_=k.clientY-P.top,N=p.timeScale().coordinateToTime(m),z=f.coordinateToPrice(_);if(N==null||z==null)return;const G=ie(N);if(G!=null){if(ne===0){S={rawTime:N,normalizedTime:G,price:z},ne=1;return}if(ne===1){if(V={rawTime:N,normalizedTime:G,price:z},Math.abs(V.normalizedTime-S.normalizedTime)<1)return;const q=ie((S.normalizedTime+V.normalizedTime)/2);if(q==null)return;const se=(S.price+V.price)/2;le={rawTime:q,normalizedTime:q,price:se},T(S,V,le),ne=2;return}if(ne===2&&S&&V){le={rawTime:N,normalizedTime:G,price:z};const q=T(S,V,le);if(!q||!g)return;try{f.detachPrimitive(g)}catch{}const se=new Vd({rawTime:S.rawTime,price:S.price},{rawTime:V.rawTime,price:V.price},{rawTime:q.b1.rawTime,price:q.b1.price},{rawTime:q.b2.rawTime,price:q.b2.price},{rawTime:q.bottomMid.rawTime,price:q.bottomMid.price});f.attachPrimitive(se);const de={type:"equidistantchannel",primitive:se,p1:S,p2:V,p3:q.bottomMid,b1:q.b1,b2:q.b2,bottomMid:q.bottomMid};Te(ye=>[...ye,de]),C.current.push(de),Qe(null),ne=0,S=null,V=null,le=null,g=null}}},u=k=>{if(ne===0||!S)return;const P=K.getBoundingClientRect(),m=k.clientX-P.left,_=k.clientY-P.top,N=p.timeScale().coordinateToTime(m),z=f.coordinateToPrice(_);if(N==null||z==null)return;const G=ie(N);if(G!=null){if(ne===1){const q={rawTime:N,normalizedTime:G,price:z},se=ie((S.normalizedTime+q.normalizedTime)/2);if(se==null)return;const de=(S.price+q.price)/2;T(S,q,{rawTime:se,normalizedTime:se,price:de});return}ne===2&&V&&T(S,V,{rawTime:N,normalizedTime:G,price:z})}},D=k=>{k.stopPropagation()},H={capture:!0,passive:!1};return K.addEventListener("click",w,H),K.addEventListener("mousemove",u,H),K.addEventListener("mousemove",D,H),()=>{if(ne=0,S=null,V=null,le=null,L.current=[],g)try{f.detachPrimitive(g)}catch{}g=null,K.removeEventListener("click",w,H),K.removeEventListener("mousemove",u,H),K.removeEventListener("mousemove",D,H)}}if(F==="fibonacci"){let S=null,V=null;const le=g=>{if(!S)return;const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top,u=p.timeScale().coordinateToTime(T),D=f.coordinateToPrice(w);if(!(u==null||D==null))if(!V)V=new Wd({rawTime:S.rawTime,price:S.price},{rawTime:u,price:D}),f.attachPrimitive(V);else{V.p2={rawTime:u,price:D};try{p.applyOptions({})}catch{}}},ne=g=>{const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top,u=p.timeScale().coordinateToTime(T),D=f.coordinateToPrice(w);if(u==null||D==null)return;if(!S){S={rawTime:u,price:D,normalizedTime:ie(u)};return}if(V){try{f.detachPrimitive(V)}catch{}V=null}const H=S.normalizedTime,k=ie(u);if(H==null||k==null)return;if(Math.abs(D-S.price)<1e-5){S=null;return}const P=new Wd({rawTime:S.rawTime,price:S.price},{rawTime:u,price:D});f.attachPrimitive(P);const m={type:"fibonacci",primitive:P,p1:{rawTime:S.rawTime,normalizedTime:H,price:S.price},p2:{rawTime:u,normalizedTime:k,price:D}};Te(_=>[..._,m]),C.current.push(m),S=null,Qe(null)};return K.addEventListener("mousemove",le),K.addEventListener("click",ne),()=>{if(K.removeEventListener("mousemove",le),K.removeEventListener("click",ne),V)try{f.detachPrimitive(V)}catch{}}}if(R.current=null,(I.current?.type==="trendline"||I.current?.type==="gannline")&&I.current?.series){try{p.removeSeries(I.current.series)}catch{}I.current=null}const J=S=>{if(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),F==="trendline"||F==="gannline"||F==="parallellines"||F==="fibonacci"||F!=="rectangle"&&F!=="circle"&&F!=="triangle"&&F!=="ellipse")return;const V=K.getBoundingClientRect(),le=S.clientX-V.left,ne=S.clientY-V.top;let g=p.timeScale().coordinateToTime(le);const B=f.coordinateToPrice(ne);if(g==null||B==null)return;const T=g;if(g=ie(g),g!=null){if(U.current=!0,M.current={time:g,normalizedTime:g,rawTime:T,price:B},E.current=null,F==="rectangle"){const w=new zv({rawTime:T,price:B},{rawTime:T,price:B},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),I.current={type:"rectangle",primitive:w}}if(F==="circle"){const w=new Wv({rawTime:T,price:B},{rawTime:T,price:B},{strokeColor:"#7aa6ae",lineWidth:1});f.attachPrimitive(w),I.current={type:"circle",primitive:w}}if(F==="triangle"){const w=new Rv({rawTime:T,price:B},{rawTime:T,price:B},{rawTime:T,price:B},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),I.current={type:"triangle",primitive:w}}if(F==="ellipse"){const w=new Gv({rawTime:T,price:B},{rawTime:T,price:B},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});f.attachPrimitive(w),I.current={type:"ellipse",primitive:w}}if(F==="parallellines"){const w=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});I.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},x=S=>{if(!U.current||!M.current||!I.current)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();const V=K.getBoundingClientRect(),le=S.clientX-V.left,ne=S.clientY-V.top;let g=p.timeScale().coordinateToTime(le);const B=f.coordinateToPrice(ne);if(g==null||B==null)return;const T=g;if(g=ie(g),g==null)return;E.current={time:g,normalizedTime:g,rawTime:T,price:B};const w=M.current;if(I.current.type==="rectangle"){const u=I.current.primitive;u.p1={rawTime:w.rawTime,price:w.price},u.p2={rawTime:T,price:B};try{d.current?.applyOptions({})}catch{}}if(I.current.type==="circle"){const u=I.current.primitive;u.p1={rawTime:w.rawTime,price:w.price},u.p2={rawTime:T,price:B};try{d.current?.applyOptions({})}catch{}}if(I.current.type==="triangle"){const u=I.current.primitive,D=v(w,{time:g,rawTime:T,price:B});if(!D)return;u.p1={rawTime:D.p1.rawTime,price:D.p1.price},u.p2={rawTime:D.p2.rawTime,price:D.p2.price},u.p3={rawTime:D.p3.rawTime,price:D.p3.price};try{d.current?.applyOptions({})}catch{}}if(I.current.type==="ellipse"){const u=I.current.primitive;u.p1={rawTime:w.rawTime,price:w.price},u.p2={rawTime:T,price:B};try{d.current?.applyOptions({})}catch{}}if(I.current.type==="parallellines")if(I.current.firstLine){const u=I.current.firstLine;u.endTime-u.startTime;const D=u.endPrice-u.startPrice,H=B,k=H+D;if(I.current.secondLine)I.current.secondLine.setData([{time:w.time,value:H},{time:g,value:k}]);else{const P=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});P.setData([{time:w.time,value:H},{time:g,value:k}]),I.current.secondLine=P}}else I.current.series.setData([{time:w.time,value:w.price},{time:g,value:B}])},te=S=>{if(S&&(S.preventDefault(),S.stopPropagation()),!U.current||!I.current||!M.current)return;const V=M.current,le=E.current||V;if(I.current.type==="parallellines")if(I.current.firstLine){const ne={type:"parallellines",firstLine:I.current.series,secondLine:I.current.secondLine,firstLineData:I.current.firstLine};Te(g=>[...g,ne]),C.current.push(ne),Qe(null),I.current=null,U.current=!1,M.current=null,E.current=null;return}else{I.current.firstLine={startTime:V.time,startPrice:V.price,endTime:le.time,endPrice:le.price},U.current=!1,M.current=null,E.current=null;return}if(I.current.type==="rectangle"){const ne=M.current,g=E.current||ne,B=Math.max(ne.price,g.price),T=Math.min(ne.price,g.price),w=ie(Math.min(ne.time,g.time)),u=ie(Math.max(ne.time,g.time));if(w!=null&&u!=null&&Math.abs(u-w)>=1&&Math.abs(B-T)>=1e-5){const D=I.current.primitive,H=ne.time<=g.time?ne.rawTime:g.rawTime,k=ne.time<=g.time?g.rawTime:ne.rawTime,P={rawTime:H,normalizedTime:w,price:B},m={rawTime:k,normalizedTime:u,price:T};D.p1={rawTime:P.rawTime,price:P.price},D.p2={rawTime:m.rawTime,price:m.price};const _={type:"rectangle",primitive:D,p1:P,p2:m};Te(N=>[...N,_]),C.current.push(_),Qe(null)}else try{f.detachPrimitive(I.current.primitive)}catch{}}if(I.current.type==="circle"){const ne=I.current.primitive,g={rawTime:V.rawTime,normalizedTime:V.time,price:V.price},B={rawTime:le.rawTime,normalizedTime:le.time,price:le.price},T=p.timeScale().timeToCoordinate(g.rawTime),w=f.priceToCoordinate(g.price),u=p.timeScale().timeToCoordinate(B.rawTime),D=f.priceToCoordinate(B.price);if((T!=null&&w!=null&&u!=null&&D!=null?Math.hypot(u-T,D-w):0)>=3){ne.p1={rawTime:g.rawTime,price:g.price},ne.p2={rawTime:B.rawTime,price:B.price};const k={type:"circle",primitive:ne,p1:g,p2:B};Te(P=>[...P,k]),C.current.push(k),Qe(null)}else try{f.detachPrimitive(I.current.primitive)}catch{}}if(I.current.type==="triangle"){const ne=I.current.primitive,g=v(V,le);if(g){const B=Math.abs(g.p3.normalizedTime-g.p2.normalizedTime),T=Math.abs(g.p1.price-g.p2.price);if(B>=1&&T>=1e-5){ne.p1={rawTime:g.p1.rawTime,price:g.p1.price},ne.p2={rawTime:g.p2.rawTime,price:g.p2.price},ne.p3={rawTime:g.p3.rawTime,price:g.p3.price};const w={type:"triangle",primitive:ne,p1:g.p1,p2:g.p2,p3:g.p3};Te(u=>[...u,w]),C.current.push(w),Qe(null)}else try{f.detachPrimitive(I.current.primitive)}catch{}}else try{f.detachPrimitive(I.current.primitive)}catch{}}if(I.current.type==="ellipse"){const ne=I.current.primitive,g={rawTime:V.rawTime,normalizedTime:V.time,price:V.price},B={rawTime:le.rawTime,normalizedTime:le.time,price:le.price},T=p.timeScale().timeToCoordinate(g.rawTime),w=f.priceToCoordinate(g.price),u=p.timeScale().timeToCoordinate(B.rawTime),D=f.priceToCoordinate(B.price);if((T!=null&&w!=null&&u!=null&&D!=null?Math.hypot(u-T,D-w):0)>=4){ne.p1={rawTime:g.rawTime,price:g.price},ne.p2={rawTime:B.rawTime,price:B.price},ne.previewAsLine=!1,ne.minorRatio=.45;const k={type:"ellipse",primitive:ne,p1:g,p2:B,minorRatio:.45};Te(P=>[...P,k]),C.current.push(k),Qe(null)}else try{f.detachPrimitive(I.current.primitive)}catch{}}U.current=!1,M.current=null,E.current=null,I.current=null};if(F==="rectangle"||F==="circle"||F==="triangle"||F==="ellipse"){const S={capture:!0,passive:!1},V=le=>{U.current||le.stopPropagation()};return K.addEventListener("mousedown",J,S),K.addEventListener("mousemove",x,S),K.addEventListener("mousemove",V,S),K.addEventListener("mouseup",te,S),()=>{if((I.current?.type==="rectangle"||I.current?.type==="circle"||I.current?.type==="triangle"||I.current?.type==="ellipse")&&I.current?.primitive)try{f.detachPrimitive(I.current.primitive)}catch{}I.current=null,U.current=!1,M.current=null,E.current=null,K.removeEventListener("mousedown",J,S),K.removeEventListener("mousemove",x,S),K.removeEventListener("mousemove",V,S),K.removeEventListener("mouseup",te,S)}}},[_e,ke,Te,Qe]),j.useEffect(()=>{const p=d.current,f=y.current,K=c.current,ge=_e===null||_e===1;if(!ge||!p||!f||!K){ge||(Y(null),W([]),$(null),Ce([]));return}const F=10,v=8;function J(g){if(!g)return[];if(g.type==="trendline"&&g.point1&&g.point2){const B=p.timeScale().timeToCoordinate(g.point1.time),T=f.priceToCoordinate(g.point1.price),w=p.timeScale().timeToCoordinate(g.point2.time),u=f.priceToCoordinate(g.point2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="gannline"&&g.point1&&g.point2){const B=p.timeScale().timeToCoordinate(g.point1.time),T=f.priceToCoordinate(g.point1.price),w=p.timeScale().timeToCoordinate(g.point2.time),u=f.priceToCoordinate(g.point2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:(B+w)/2,y:(T+u)/2},{x:w,y:u}]}if(g.type==="rectangle"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);if(B==null||T==null||w==null||u==null)return[];const D=Math.min(B,w),H=Math.max(B,w),k=Math.min(T,u),P=Math.max(T,u),m=(D+H)/2,_=(k+P)/2;return[{x:D,y:k},{x:m,y:k},{x:H,y:k},{x:D,y:_},{x:H,y:_},{x:D,y:P},{x:m,y:P},{x:H,y:P}]}if(g.type==="circle"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="triangle"&&g.p1&&g.p2&&g.p3){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price),D=p.timeScale().timeToCoordinate(g.p3.rawTime),H=f.priceToCoordinate(g.p3.price);return B==null||T==null||w==null||u==null||D==null||H==null?[]:[{x:B,y:T},{x:w,y:u},{x:D,y:H}]}if(g.type==="ellipse"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);if(B==null||T==null||w==null||u==null)return[];const D=(B+w)/2,H=(T+u)/2,k=w-B,P=u-T,m=Math.hypot(k,P);if(m<.001)return[];const _=k/m,N=P/m,z=-N,G=_,q=m/2,se=q*Math.max(.05,g.minorRatio??.45);return[{x:D-_*q,y:H-N*q},{x:D+z*se,y:H+G*se},{x:D+_*q,y:H+N*q},{x:D-z*se,y:H-G*se}]}if(g.type==="gannfan"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="ganngrid"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="arrowedline"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="rayline"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="extendedline"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="crossline"&&g.p){const B=p.timeScale().timeToCoordinate(g.p.rawTime),T=f.priceToCoordinate(g.p.price);return B==null||T==null?[]:[{x:B,y:T}]}if(g.type==="pricelevel"&&g.price!=null){const B=f.priceToCoordinate(g.price);return B==null?[]:[{x:(d.current?d.current.paneSize().width:400)/2,y:B}]}if(g.type==="text"&&g.rawTime!=null&&g.price!=null){const B=p.timeScale().timeToCoordinate(g.rawTime),T=f.priceToCoordinate(g.price);return B==null||T==null?[]:[{x:B,y:T}]}if(g.type==="trendbyangle"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="andrewspitchfork"&&g.p1&&g.p2&&g.p3){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price),D=p.timeScale().timeToCoordinate(g.p3.rawTime),H=f.priceToCoordinate(g.p3.price);return B==null||T==null||w==null||u==null||D==null||H==null?[]:[{x:B,y:T},{x:w,y:u},{x:D,y:H}]}if(g.type==="equidistantchannel"&&g.p1&&g.p2&&g.b1&&g.b2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price),D=p.timeScale().timeToCoordinate(g.b1.rawTime),H=f.priceToCoordinate(g.b1.price),k=p.timeScale().timeToCoordinate(g.b2.rawTime),P=f.priceToCoordinate(g.b2.price);return B==null||T==null||w==null||u==null||D==null||H==null||k==null||P==null?[]:[{x:B,y:T},{x:w,y:u},{x:(D+k)/2,y:(H+P)/2}]}if(g.type==="regressionchannel"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="stddevchannel"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="disjointchannel"&&g.p1&&g.p2&&g.p3&&g.p4){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price),D=p.timeScale().timeToCoordinate(g.p3.rawTime),H=f.priceToCoordinate(g.p3.price),k=p.timeScale().timeToCoordinate(g.p4.rawTime),P=f.priceToCoordinate(g.p4.price);return B==null||T==null||w==null||u==null||D==null||H==null||k==null||P==null?[]:[{x:B,y:T},{x:w,y:u},{x:D,y:H},{x:k,y:P}]}if(g.type==="flattopbottom"&&g.p1&&g.p2&&g.p3&&g.p4){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price),D=p.timeScale().timeToCoordinate(g.p3.rawTime),H=f.priceToCoordinate(g.p3.price),k=p.timeScale().timeToCoordinate(g.p4.rawTime),P=f.priceToCoordinate(g.p4.price);return B==null||T==null||w==null||u==null||D==null||H==null||k==null||P==null?[]:[{x:B,y:T},{x:w,y:u},{x:D,y:H},{x:k,y:P}]}if(g.type==="infoline"&&g.p1&&g.p2){const B=g.p1.rawTime??g.p1.time,T=g.p2.rawTime??g.p2.time,w=p.timeScale().timeToCoordinate(B),u=f.priceToCoordinate(g.p1.price),D=p.timeScale().timeToCoordinate(T),H=f.priceToCoordinate(g.p2.price);return w==null||u==null||D==null||H==null?[]:[{x:w,y:u},{x:D,y:H}]}if(g.type==="rulerline"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:(B+w)/2,y:(T+u)/2},{x:w,y:u}]}if(g.type==="fibonacci"&&g.p1&&g.p2){const B=p.timeScale().timeToCoordinate(g.p1.rawTime),T=f.priceToCoordinate(g.p1.price),w=p.timeScale().timeToCoordinate(g.p2.rawTime),u=f.priceToCoordinate(g.p2.price);return B==null||T==null||w==null||u==null?[]:[{x:B,y:T},{x:w,y:u}]}if(g.type==="horizontalray"&&g.primitive){const B=g.primitive,T=p.timeScale().timeToCoordinate(B.originTime),w=f.priceToCoordinate(B.price);return T==null||w==null?[]:[{x:T,y:w}]}if(g.type==="verticalline"&&g.primitive){const B=g.primitive,T=p.timeScale().timeToCoordinate(B.time);if(T==null)return[];const w=B.midYCss??200;return[{x:T,y:w}]}return[]}function x(g,B){for(let T=We.length-1;T>=0;T--){const w=We[T];if(w.type==="trendline"&&w.point1&&w.point2){const u=p.timeScale().timeToCoordinate(w.point1.time),D=f.priceToCoordinate(w.point1.price),H=p.timeScale().timeToCoordinate(w.point2.time),k=f.priceToCoordinate(w.point2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-u,B-D),m=Math.hypot(g-H,B-k);if(P<F)return{object:w,mode:"handle1"};if(m<F)return{object:w,mode:"handle2"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const u=p.timeScale().timeToCoordinate(w.point1.time),D=f.priceToCoordinate(w.point1.price),H=p.timeScale().timeToCoordinate(w.point2.time),k=f.priceToCoordinate(w.point2.price);if(u==null||D==null||H==null||k==null)continue;const P=(u+H)/2,m=(D+k)/2,_=Math.hypot(g-u,B-D),N=Math.hypot(g-H,B-k),z=Math.hypot(g-P,B-m);if(_<F)return{object:w,mode:"handle1"};if(N<F)return{object:w,mode:"handle2"};if(z<F)return{object:w,mode:"line"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.min(u,H),m=Math.max(u,H),_=Math.min(D,k),N=Math.max(D,k),z=(P+m)/2,G=(_+N)/2,q=[{x:P,y:_,mode:"handle1"},{x:z,y:_,mode:"handle2"},{x:m,y:_,mode:"handle3"},{x:P,y:G,mode:"handle4"},{x:m,y:G,mode:"handle5"},{x:P,y:N,mode:"handle6"},{x:z,y:N,mode:"handle7"},{x:m,y:N,mode:"handle8"}];for(const Me of q)if(Math.hypot(g-Me.x,B-Me.y)<F)return{object:w,mode:Me.mode};const se=at(g,B,P,_,m,_),de=at(g,B,P,N,m,N),ye=at(g,B,P,_,P,N),be=at(g,B,m,_,m,N);if(se<v||de<v||ye<v||be<v||jA(g,B,[{x:P,y:_},{x:m,y:_},{x:m,y:N},{x:P,y:N}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(H-u,k-D);if(P<2)continue;const m=Math.hypot(g-u,B-D),_=Math.hypot(g-H,B-k);if(m<F)return{object:w,mode:"handle1"};if(_<F)return{object:w,mode:"handle2"};if(Math.abs(m-P)<v||m<P)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price),P=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(u==null||D==null||H==null||k==null||P==null||m==null)continue;const _=Math.hypot(g-u,B-D),N=Math.hypot(g-H,B-k),z=Math.hypot(g-P,B-m);if(_<F)return{object:w,mode:"handle1"};if(N<F)return{object:w,mode:"handle2"};if(z<F)return{object:w,mode:"handle3"};const G=at(g,B,u,D,H,k),q=at(g,B,H,k,P,m),se=at(g,B,P,m,u,D);if(G<v||q<v||se<v||jA(g,B,[{x:u,y:D},{x:H,y:k},{x:P,y:m}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=(u+H)/2,m=(D+k)/2,_=H-u,N=k-D,z=Math.hypot(_,N);if(z<2)continue;const G=_/z,q=N/z,se=-q,de=G,ye=z/2,be=ye*Math.max(.05,w.minorRatio??.45);if(ye<2||be<2)continue;const Me=P-G*ye,Xe=m-q*ye,At=P+se*be,$e=m+de*be,pt=P+G*ye,lt=m+q*ye,ft=P-se*be,Ft=m-de*be,Vt=Math.hypot(g-Me,B-Xe),Xt=Math.hypot(g-At,B-$e),AA=Math.hypot(g-pt,B-lt),HA=Math.hypot(g-ft,B-Ft);if(Vt<F)return{object:w,mode:"handle1"};if(Xt<F)return{object:w,mode:"handle2"};if(AA<F)return{object:w,mode:"handle3"};if(HA<F)return{object:w,mode:"handle4"};const Bi=(g-P)*G+(B-m)*q,bs=(g-P)*se+(B-m)*de,pp=Bi/ye,fp=bs/be,gp=pp*pp+fp*fp;if(Math.abs(gp-1)<.2||gp<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-H,B-k),m=Math.hypot(g-u,B-D);if(P<F)return{object:w,mode:"handle2"};if(m<F)return{object:w,mode:"handle1"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-H,B-k),m=Math.hypot(g-u,B-D);if(P<F)return{object:w,mode:"handle2"};if(m<F)return{object:w,mode:"handle1"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-u,B-D),m=Math.hypot(g-H,B-k);if(P<F)return{object:w,mode:"handle1"};if(m<F)return{object:w,mode:"handle2"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-u,B-D),m=Math.hypot(g-H,B-k);if(P<F)return{object:w,mode:"handle1"};if(m<F)return{object:w,mode:"handle2"};if(sx(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-u,B-D),m=Math.hypot(g-H,B-k);if(P<F)return{object:w,mode:"handle1"};if(m<F)return{object:w,mode:"handle2"};if(ox(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const u=p.timeScale().timeToCoordinate(w.p.rawTime),D=f.priceToCoordinate(w.p.price);if(u==null||D==null)continue;if(Math.hypot(g-u,B-D)<F)return{object:w,mode:"handle1"};const k=Math.abs(B-D),P=Math.abs(g-u);if(k<v||P<v)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const u=p.timeScale().timeToCoordinate(w.rawTime),D=f.priceToCoordinate(w.price);if(u==null||D==null)continue;const H=Gd(w,u,D);if(g>=H.left&&g<=H.right&&B>=H.top&&B<=H.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-u,B-D),m=Math.hypot(g-H,B-k);if(P<F)return{object:w,mode:"handle1"};if(m<F)return{object:w,mode:"handle2"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price),P=p.timeScale().timeToCoordinate(w.b1.rawTime),m=f.priceToCoordinate(w.b1.price),_=p.timeScale().timeToCoordinate(w.b2.rawTime),N=f.priceToCoordinate(w.b2.price),z=P!=null&&_!=null?(P+_)/2:null,G=m!=null&&N!=null?(m+N)/2:null;if(u==null||D==null||H==null||k==null||z==null||G==null||P==null||m==null||_==null||N==null)continue;const q=Math.hypot(g-u,B-D),se=Math.hypot(g-H,B-k),de=Math.hypot(g-z,B-G),ye=Math.hypot(u-z,D-G)<F*1.5;if(ye&&Math.min(q,de)<F*1.5)return{object:w,mode:"handle3"};if(de<F)return{object:w,mode:"handle3"};if(se<F)return{object:w,mode:"handle2"};if(ye)continue;if(q<F)return{object:w,mode:"handle1"};const be=at(g,B,u,D,H,k),Me=at(g,B,P,m,_,N);if(be<v||Me<v||jA(g,B,[{x:u,y:D},{x:H,y:k},{x:_,y:N},{x:P,y:m}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price),P=p.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),_=p.timeScale().timeToCoordinate(w.top2.rawTime),N=f.priceToCoordinate(w.top2.price),z=p.timeScale().timeToCoordinate(w.bot1.rawTime),G=f.priceToCoordinate(w.bot1.price),q=p.timeScale().timeToCoordinate(w.bot2.rawTime),se=f.priceToCoordinate(w.bot2.price);if(u==null||D==null||H==null||k==null||P==null||m==null||_==null||N==null||z==null||G==null||q==null||se==null)continue;const de=Math.hypot(g-u,B-D),ye=Math.hypot(g-H,B-k);if(de<F)return{object:w,mode:"handle1"};if(ye<F)return{object:w,mode:"handle2"};const be=at(g,B,u,D,H,k),Me=at(g,B,P,m,_,N),Xe=at(g,B,z,G,q,se);if(be<v||Me<v||Xe<v||jA(g,B,[{x:P,y:m},{x:_,y:N},{x:q,y:se},{x:z,y:G}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price),P=p.timeScale().timeToCoordinate(w.top1.rawTime),m=f.priceToCoordinate(w.top1.price),_=p.timeScale().timeToCoordinate(w.top2.rawTime),N=f.priceToCoordinate(w.top2.price),z=p.timeScale().timeToCoordinate(w.bot1.rawTime),G=f.priceToCoordinate(w.bot1.price),q=p.timeScale().timeToCoordinate(w.bot2.rawTime),se=f.priceToCoordinate(w.bot2.price);if(u==null||D==null||H==null||k==null||P==null||m==null||_==null||N==null||z==null||G==null||q==null||se==null)continue;const de=Math.hypot(g-u,B-D),ye=Math.hypot(g-H,B-k);if(de<F)return{object:w,mode:"handle1"};if(ye<F)return{object:w,mode:"handle2"};const be=at(g,B,u,D,H,k),Me=at(g,B,P,m,_,N),Xe=at(g,B,z,G,q,se);if(be<v||Me<v||Xe<v||jA(g,B,[{x:P,y:m},{x:_,y:N},{x:q,y:se},{x:z,y:G}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price),P=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price);if(u==null||D==null||H==null||k==null||P==null||m==null)continue;const _=Math.hypot(g-u,B-D),N=Math.hypot(g-H,B-k),z=Math.hypot(g-P,B-m);if(_<F)return{object:w,mode:"handle1"};if(N<F)return{object:w,mode:"handle2"};if(z<F)return{object:w,mode:"handle3"};const G=(H+P)/2,q=(k+m)/2;let se=G-u,de=q-D;Math.abs(se)<1e-4&&(se=1e-4);const ye=de/se,be=K.clientWidth,Me=k+ye*(be-H),Xe=m+ye*(be-P),At=at(g,B,H,k,be,Me),$e=at(g,B,P,m,be,Xe);if(At<v||$e<v||jA(g,B,[{x:H,y:k},{x:be,y:Me},{x:be,y:Xe},{x:P,y:m}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price),P=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),_=p.timeScale().timeToCoordinate(w.p4.rawTime),N=f.priceToCoordinate(w.p4.price);if(u==null||D==null||H==null||k==null||P==null||m==null||_==null||N==null)continue;const z=Math.hypot(g-u,B-D),G=Math.hypot(g-H,B-k),q=Math.hypot(g-P,B-m),se=Math.hypot(g-_,B-N);if(z<F)return{object:w,mode:"handle1"};if(G<F)return{object:w,mode:"handle2"};if(q<F)return{object:w,mode:"handle3"};if(se<F)return{object:w,mode:"handle4"};const de=at(g,B,u,D,P,m),ye=at(g,B,H,k,_,N),be=at(g,B,u,D,H,k),Me=at(g,B,P,m,_,N);if(de<v||ye<v||be<v||Me<v||jA(g,B,[{x:u,y:D},{x:P,y:m},{x:_,y:N},{x:H,y:k}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price),P=p.timeScale().timeToCoordinate(w.p3.rawTime),m=f.priceToCoordinate(w.p3.price),_=p.timeScale().timeToCoordinate(w.p4.rawTime),N=f.priceToCoordinate(w.p4.price);if(u==null||D==null||H==null||k==null||P==null||m==null||_==null||N==null)continue;const z=Math.hypot(g-u,B-D),G=Math.hypot(g-H,B-k),q=Math.hypot(g-P,B-m),se=Math.hypot(g-_,B-N);if(z<F)return{object:w,mode:"handle1"};if(G<F)return{object:w,mode:"handle2"};if(q<F)return{object:w,mode:"handle3"};if(se<F)return{object:w,mode:"handle4"};const de=at(g,B,u,D,P,m),ye=at(g,B,H,k,_,N),be=at(g,B,u,D,H,k),Me=at(g,B,P,m,_,N);if(de<v||ye<v||be<v||Me<v||jA(g,B,[{x:u,y:D},{x:P,y:m},{x:_,y:N},{x:H,y:k}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=(u+H)/2,m=(D+k)/2,_=Math.hypot(g-u,B-D),N=Math.hypot(g-H,B-k),z=Math.hypot(g-P,B-m);if(_<F)return{object:w,mode:"handle1"};if(N<F)return{object:w,mode:"handle2"};if(z<F)return{object:w,mode:"line"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const u=w.p1.rawTime??w.p1.time,D=w.p2.rawTime??w.p2.time,H=p.timeScale().timeToCoordinate(u),k=f.priceToCoordinate(w.p1.price),P=p.timeScale().timeToCoordinate(D),m=f.priceToCoordinate(w.p2.price);if(H==null||k==null||P==null||m==null)continue;const _=Math.hypot(g-H,B-k),N=Math.hypot(g-P,B-m);if(_<F)return{object:w,mode:"handle1"};if(N<F)return{object:w,mode:"handle2"};if(at(g,B,H,k,P,m)<v)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const u=p.timeScale().timeToCoordinate(w.p1.rawTime),D=f.priceToCoordinate(w.p1.price),H=p.timeScale().timeToCoordinate(w.p2.rawTime),k=f.priceToCoordinate(w.p2.price);if(u==null||D==null||H==null||k==null)continue;const P=Math.hypot(g-u,B-D),m=Math.hypot(g-H,B-k);if(P<F)return{object:w,mode:"handle1"};if(m<F)return{object:w,mode:"handle2"};if(at(g,B,u,D,H,k)<v)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const u=w.primitive,D=p.timeScale().timeToCoordinate(u.originTime),H=f.priceToCoordinate(u.price);if(H==null)continue;if(D!=null&&Math.hypot(g-D,B-H)<F)return{object:w,mode:"handle1"};const k=D==null?0:Math.max(0,D);if(g>=k&&Math.abs(B-H)<v)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const u=w.primitive,D=p.timeScale().timeToCoordinate(u.time);if(D==null)continue;const H=u.midYCss??200;if(Math.hypot(g-D,B-H)<F)return{object:w,mode:"handle1"};if(Math.abs(g-D)<v)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const u=f.priceToCoordinate(w.price);if(u==null)continue;const H=(d.current?d.current.paneSize().width:400)/2;if(Math.hypot(g-H,B-u)<F)return{object:w,mode:"line"};if(Math.abs(B-u)<v)return{object:w,mode:"line"}}}return null}const te=g=>{const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top,u=x(T,w);if(u){if(g.preventDefault(),g.stopPropagation(),g.detail>=2){fe.current=!0,Ae(u.object),ee.current=null,Z.current=null;return}Y(u.object),$(null),Ce([]),ee.current=u.mode,u.object.type==="rayline"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="extendedline"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="crossline"&&(u.mode==="handle1"||u.mode==="line")&&(Z.current={x:T,y:w,p:{...u.object.p}}),u.object.type==="text"&&u.mode==="line"&&(Z.current={x:T,y:w,rawTime:u.object.rawTime,price:u.object.price}),u.object.type==="trendbyangle"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="equidistantchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="andrewspitchfork"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="regressionchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="stddevchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="disjointchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="flattopbottom"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="fibonacci"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="gannfan"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="ganngrid"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="rectangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4"||u.mode==="handle5"||u.mode==="handle6"||u.mode==="handle7"||u.mode==="handle8")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="circle"&&(u.mode==="handle1"||u.mode==="handle2")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="triangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="ellipse"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}),u.object.type==="horizontalray"&&(u.mode==="handle1"||u.mode==="line")&&(Z.current={x:T,y:w,price:u.object.primitive.price,originTime:u.object.primitive.originTime}),u.object.type==="verticalline"&&(u.mode==="handle1"||u.mode==="line")&&(Z.current={x:T,y:w,time:u.object.primitive.time}),u.mode==="line"&&(u.object.type==="rulerline"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="infoline"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="arrowedline"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rayline"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="extendedline"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="crossline"?Z.current={x:T,y:w,p:{...u.object.p}}:u.object.type==="text"?Z.current={x:T,y:w,rawTime:u.object.rawTime,price:u.object.price}:u.object.type==="trendbyangle"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="equidistantchannel"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="andrewspitchfork"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="regressionchannel"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="stddevchannel"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="disjointchannel"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="flattopbottom"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="fibonacci"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="gannfan"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rectangle"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="circle"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="triangle"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="ellipse"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}:u.object.type==="ganngrid"?Z.current={x:T,y:w,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="horizontalray"?Z.current={x:T,y:w,price:u.object.primitive.price,originTime:u.object.primitive.originTime}:u.object.type==="verticalline"?Z.current={x:T,y:w,time:u.object.primitive.time}:u.object.type==="pricelevel"?Z.current={y:w,price:u.object.price}:Z.current={x:T,y:w,point1:{...u.object.point1},point2:{...u.object.point2}})}else Y(null),ee.current=null,W([]),$(null),Ce([])},S=g=>{const B=K.getBoundingClientRect(),T=g.clientX-B.left,w=g.clientY-B.top;if(!ee.current){const P=x(T,w);if(P?.object&&!re.current){const m=J(P.object);$(_=>_===P.object?_:P.object),Ce(_=>_.length===m.length&&_.every((N,z)=>N.x===m[z].x&&N.y===m[z].y)?_:m)}else $(m=>m==null?m:null),Ce(m=>m.length===0?m:[]);return}const u=re.current;if(!u)return;const D=p.timeScale().coordinateToTime(T),H=f.coordinateToPrice(w);if(D==null||H==null)return;let k=ie(D);if(k!=null){if(u.type==="infoline"&&u.p1&&u.p2){const P=z=>{const G=z.rawTime??z.time,q=z.normalizedTime??ie(G);return{rawTime:G,normalizedTime:q,price:z.price}},m=(z,G)=>{const q=z.normalizedTime??ie(z.rawTime),se=G.normalizedTime??ie(G.rawTime);if(q==null||se==null)return;const de=G.price-z.price,ye=de/Math.abs(z.price)*100,be=iA(Ve)||3600,Me=Math.abs(se-q),Xe=Math.max(1,Math.round(Me/be)),At=Math.max(1,Math.round(Me/86400)),$e=p.timeScale().timeToCoordinate(z.rawTime),pt=f.priceToCoordinate(z.price),lt=p.timeScale().timeToCoordinate(G.rawTime),ft=f.priceToCoordinate(G.price),Ft=$e!=null&&pt!=null&&lt!=null&&ft!=null?Math.atan2(-(ft-pt),lt-$e)*(180/Math.PI):u.primitive?.info?.angle??0,Vt={priceDiff:de,pricePct:ye,bars:Xe,days:At,angle:Ft},Xt=u.primitive;if(Xt){Xt.p1={rawTime:z.rawTime,price:z.price},Xt.p2={rawTime:G.rawTime,price:G.price},Xt.info=Vt;try{d.current?.applyOptions({})}catch{}}const AA={...u,rawP1Time:z.rawTime,rawP2Time:G.rawTime,p1:{rawTime:z.rawTime,normalizedTime:q,price:z.price},p2:{rawTime:G.rawTime,normalizedTime:se,price:G.price}};Te(HA=>{const Bi=HA.map(bs=>bs===u?AA:bs);return C.current=Bi,Bi}),Y(AA),re.current=AA,$e!=null&&pt!=null&&lt!=null&&ft!=null&&W([{x:$e,y:pt},{x:lt,y:ft}])},_=P(u.p1),N=P(u.p2);if(_.rawTime==null||_.normalizedTime==null||N.rawTime==null||N.normalizedTime==null)return;if(ee.current==="handle1"){const z=p.timeScale().coordinateToTime(T)??D;m({rawTime:z,normalizedTime:k,price:H},N)}else if(ee.current==="handle2"){const z=p.timeScale().coordinateToTime(T)??D;m(_,{rawTime:z,normalizedTime:k,price:H})}else if(ee.current==="line"){const z=Z.current;if(!z)return;const G=P(z.p1),q=P(z.p2);if(G.rawTime==null||G.normalizedTime==null||q.rawTime==null||q.normalizedTime==null)return;const se=p.timeScale().coordinateToTime(z.x)??G.rawTime,de=f.coordinateToPrice(z.y);if(se==null||de==null)return;const ye=ie(se)??G.normalizedTime;if(ye==null)return;const be=k-ye,Me=H-de,Xe=ie(G.normalizedTime+be),At=ie(q.normalizedTime+be);if(Xe==null||At==null)return;const $e=D-se;m({rawTime:G.rawTime+$e,normalizedTime:Xe,price:G.price+Me},{rawTime:q.rawTime+$e,normalizedTime:At,price:q.price+Me})}return}if(u.type==="rulerline"&&u.p1&&u.p2){const P=(m,_)=>{const N=m.normalizedTime??m.rawTime,z=_.normalizedTime??_.rawTime,G=_.price-m.price,q=G/Math.abs(m.price)*100,se=ys(vs,m.rawTime,_.rawTime,Ve),de=Math.abs(z-N),ye=Math.max(1,Math.round(de/86400)),be={priceDiff:G,pricePct:q,bars:se,days:ye},Me=u.primitive;if(Me){Me.p1={rawTime:m.rawTime,price:m.price},Me.p2={rawTime:_.rawTime,price:_.price},Me.info=be;const ft=_.price>=m.price;Me.color=ft?"#3b82f6":"#ef5350",Me.fillColor=ft?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{d.current?.applyOptions({})}catch{}}const Xe={...u,rawP1Time:m.rawTime,rawP2Time:_.rawTime,p1:m,p2:_};Te(ft=>{const Ft=ft.map(Vt=>Vt===u?Xe:Vt);return C.current=Ft,Ft}),Y(Xe),re.current=Xe;const At=p.timeScale().timeToCoordinate(m.rawTime),$e=f.priceToCoordinate(m.price),pt=p.timeScale().timeToCoordinate(_.rawTime),lt=f.priceToCoordinate(_.price);At!=null&&$e!=null&&pt!=null&&lt!=null&&W([{x:At,y:$e},{x:(At+pt)/2,y:($e+lt)/2},{x:pt,y:lt}])};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H})}else if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="arrowedline"&&u.p1&&u.p2){const P=(m,_)=>{const N=u.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p1:m,p2:_};Te(ye=>{const be=ye.map(Me=>Me===u?z:Me);return C.current=be,be}),Y(z),re.current=z;const G=p.timeScale().timeToCoordinate(m.rawTime),q=f.priceToCoordinate(m.price),se=p.timeScale().timeToCoordinate(_.rawTime),de=f.priceToCoordinate(_.price);G!=null&&q!=null&&se!=null&&de!=null&&W([{x:G,y:q},{x:se,y:de}])};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H})}else if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="rayline"&&u.p1&&u.p2){const P=(m,_)=>{const N=u.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p1:m,p2:_};Te(ye=>{const be=ye.map(Me=>Me===u?z:Me);return C.current=be,be}),Y(z),re.current=z;const G=p.timeScale().timeToCoordinate(m.rawTime),q=f.priceToCoordinate(m.price),se=p.timeScale().timeToCoordinate(_.rawTime),de=f.priceToCoordinate(_.price);G!=null&&q!=null&&se!=null&&de!=null&&W([{x:G,y:q},{x:se,y:de}])};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;const _=ie(m);if(_==null)return;P(u.p1,{rawTime:m,normalizedTime:_,price:H})}else if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="extendedline"&&u.p1&&u.p2){const P=(m,_)=>{const N=u.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p1:m,p2:_};Te(ye=>{const be=ye.map(Me=>Me===u?z:Me);return C.current=be,be}),Y(z),re.current=z;const G=p.timeScale().timeToCoordinate(m.rawTime),q=f.priceToCoordinate(m.price),se=p.timeScale().timeToCoordinate(_.rawTime),de=f.priceToCoordinate(_.price);G!=null&&q!=null&&se!=null&&de!=null&&W([{x:G,y:q},{x:se,y:de}])};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H})}else if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="crossline"&&u.p){const P=_=>{const N=u.primitive;if(N){N.center={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p:_};Te(se=>{const de=se.map(ye=>ye===u?z:ye);return C.current=de,de}),Y(z),re.current=z;const G=p.timeScale().timeToCoordinate(_.rawTime),q=f.priceToCoordinate(_.price);G!=null&&q!=null&&W([{x:G,y:q}])},m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H});return}if(u.type==="pricelevel"&&u.price!=null){const P=f.coordinateToPrice(w);if(P==null)return;try{u.priceLine.applyOptions({price:P,title:P.toFixed(5)})}catch{}u.textPrimitive&&(u.textPrimitive.price=P);const m=d.current?d.current.paneSize().width:400,_=f.priceToCoordinate(P);_!=null&&W([{x:m/2,y:_}]);const N={...u,price:P};Te(z=>{const G=z.map(q=>q===u?N:q);return C.current=G,G}),Y(N),re.current=N;return}if(u.type==="text"){const P=p.timeScale().coordinateToTime(T);if(P==null)return;const m=u.primitive;if(m){m.rawTime=P,m.price=H;try{d.current?.applyOptions({})}catch{}}const _={...u,rawTime:P,price:H};Te(N=>{const z=N.map(G=>G===u?_:G);return C.current=z,z}),Y(_),re.current=_;return}if(u.type==="trendbyangle"&&u.p1&&u.p2){const P=(m,_)=>{const N=u.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p1:m,p2:_};Te(ye=>{const be=ye.map(Me=>Me===u?z:Me);return C.current=be,be}),Y(z),re.current=z;const G=p.timeScale().timeToCoordinate(m.rawTime),q=f.priceToCoordinate(m.price),se=p.timeScale().timeToCoordinate(_.rawTime),de=f.priceToCoordinate(_.price);G!=null&&q!=null&&se!=null&&de!=null&&W([{x:G,y:q},{x:se,y:de}])};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"||ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="equidistantchannel"&&u.p1&&u.p2&&u.p3){const P=(m,_,N)=>{const z=Xd(m,_,N);if(!z)return;const G=u.primitive;if(G){G.p1={rawTime:m.rawTime,price:m.price},G.p2={rawTime:_.rawTime,price:_.price},G.b1={rawTime:z.b1.rawTime,price:z.b1.price},G.b2={rawTime:z.b2.rawTime,price:z.b2.price},G.p3={rawTime:z.bottomMid.rawTime,price:z.bottomMid.price};try{d.current?.applyOptions({})}catch{}}const q={...u,p1:m,p2:_,p3:z.bottomMid,b1:z.b1,b2:z.b2,bottomMid:z.bottomMid};Te(se=>{const de=se.map(ye=>ye===u?q:ye);return C.current=de,de}),Y(q),re.current=q};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2,u.p3);return}if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H},u.p3);return}if(ee.current==="handle3"){P(u.p1,u.p2,{rawTime:u.p3.rawTime,normalizedTime:u.p3.normalizedTime??ie(u.p3.rawTime),price:H});return}if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z),de=ie(m.p3.normalizedTime+z);if(q==null||se==null||de==null)return;const ye=D-_;P({rawTime:m.p1.rawTime+ye,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+ye,normalizedTime:se,price:m.p2.price+G},{rawTime:m.p3.rawTime+ye,normalizedTime:de,price:m.p3.price+G});return}}if(u.type==="regressionchannel"&&u.p1&&u.p2){const P=(m,_)=>{const N=Ki(ke,m,_,u.stdMultiplier??1);if(!N)return;const z=u.primitive;if(z){z.mid1={rawTime:N.p1.rawTime,price:N.p1.price},z.mid2={rawTime:N.p2.rawTime,price:N.p2.price},z.top1={rawTime:N.top1.rawTime,price:N.top1.price},z.top2={rawTime:N.top2.rawTime,price:N.top2.price},z.bot1={rawTime:N.bot1.rawTime,price:N.bot1.price},z.bot2={rawTime:N.bot2.rawTime,price:N.bot2.price};try{d.current?.applyOptions({})}catch{}}const G={...u,p1:N.p1,p2:N.p2,top1:N.top1,top2:N.top2,bot1:N.bot1,bot2:N.bot2,slope:N.slope,intercept:N.intercept,stdDev:N.stdDev,offset:N.offset,barCount:N.barCount};Te(q=>{const se=q.map(de=>de===u?G:de);return C.current=se,se}),Y(G),re.current=G};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k},u.p2);return}if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k});return}if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G});return}}if(u.type==="stddevchannel"&&u.p1&&u.p2){const P=(m,_)=>{const N=Mr(ke,m,_,u.stdMultiplier??1);if(!N)return;const z=u.primitive;if(z){z.mid1={rawTime:N.p1.rawTime,price:N.p1.price},z.mid2={rawTime:N.p2.rawTime,price:N.p2.price},z.top1={rawTime:N.top1.rawTime,price:N.top1.price},z.top2={rawTime:N.top2.rawTime,price:N.top2.price},z.bot1={rawTime:N.bot1.rawTime,price:N.bot1.price},z.bot2={rawTime:N.bot2.rawTime,price:N.bot2.price};try{d.current?.applyOptions({})}catch{}}const G={...u,p1:N.p1,p2:N.p2,top1:N.top1,top2:N.top2,bot1:N.bot1,bot2:N.bot2,slope:N.slope,stdDev:N.stdDev,offset:N.offset,barCount:N.barCount};Te(q=>{const se=q.map(de=>de===u?G:de);return C.current=se,se}),Y(G),re.current=G};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k},u.p2);return}if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k});return}if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G});return}}if(u.type==="andrewspitchfork"&&u.p1&&u.p2&&u.p3){const P=(m,_,N)=>{const z=u.primitive;if(z){z.p1={rawTime:m.rawTime,price:m.price},z.p2={rawTime:_.rawTime,price:_.price},z.p3={rawTime:N.rawTime,price:N.price};try{d.current?.applyOptions({})}catch{}}const G={...u,p1:m,p2:_,p3:N};Te(q=>{const se=q.map(de=>de===u?G:de);return C.current=se,se}),Y(G),re.current=G};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2,u.p3);return}if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H},u.p3);return}if(ee.current==="handle3"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,u.p2,{rawTime:m,normalizedTime:k,price:H});return}if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z),de=ie(m.p3.normalizedTime+z);if(q==null||se==null||de==null)return;const ye=D-_;P({rawTime:m.p1.rawTime+ye,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+ye,normalizedTime:se,price:m.p2.price+G},{rawTime:m.p3.rawTime+ye,normalizedTime:de,price:m.p3.price+G});return}}if(u.type==="disjointchannel"&&u.p1&&u.p2&&u.p3&&u.p4){const P=(G,q,se,de)=>{const ye=u.primitive;if(ye){ye.p1={rawTime:G.rawTime,price:G.price},ye.p2={rawTime:q.rawTime,price:q.price},ye.p3={rawTime:se.rawTime,price:se.price},ye.p4={rawTime:de.rawTime,price:de.price};try{d.current?.applyOptions({})}catch{}}const be={...u,p1:G,p2:q,p3:se,p4:de};Te(Me=>{const Xe=Me.map(At=>At===u?be:At);return C.current=Xe,Xe}),Y(be),re.current=be},m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(T);if(_==null)return;const N=ie(_);if(N==null)return;const z=(G,q,se,de)=>{const ye=G.normalizedTime??ie(G.rawTime);if(ye==null)return null;const be=ie(ye+se);return be==null?null:{rawTime:G.rawTime+q,normalizedTime:be,price:G.price+de}};if(ee.current==="line"){const G=p.timeScale().coordinateToTime(m.x),q=f.coordinateToPrice(m.y);if(G==null||q==null)return;const se=ie(G);if(se==null)return;const de=_-G,ye=N-se,be=H-q,Me=z(m.p1,de,ye,be),Xe=z(m.p2,de,ye,be),At=z(m.p3,de,ye,be),$e=z(m.p4,de,ye,be);if(!Me||!Xe||!At||!$e)return;P(Me,Xe,At,$e);return}if(ee.current==="handle1"){const G=(m.p1.price+m.p2.price)/2,q={rawTime:_,normalizedTime:N,price:H},se={rawTime:_,normalizedTime:N,price:2*G-H};P(q,se,m.p3,m.p4);return}if(ee.current==="handle3"){const G=(m.p3.price+m.p4.price)/2,q={rawTime:_,normalizedTime:N,price:H},se={rawTime:_,normalizedTime:N,price:2*G-H};P(m.p1,m.p2,q,se);return}if(ee.current==="handle2"){const G=(m.p1.price+m.p2.price)/2,q={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ie(m.p1.rawTime),price:H};if(q.normalizedTime==null)return;const se={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ie(m.p1.rawTime),price:2*G-H};if(se.normalizedTime==null)return;P(se,q,m.p3,m.p4);return}if(ee.current==="handle4"){const G=H-m.p4.price,q={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??ie(m.p3.rawTime),price:m.p4.price+G};if(q.normalizedTime==null)return;const se={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ie(m.p1.rawTime),price:m.p2.price+G};if(se.normalizedTime==null)return;P(m.p1,se,m.p3,q);return}}if(u.type==="flattopbottom"&&u.p1&&u.p2&&u.p3&&u.p4){const P=(G,q,se,de)=>{const ye=u.primitive;if(ye){ye.p1={rawTime:G.rawTime,price:G.price},ye.p2={rawTime:q.rawTime,price:q.price},ye.p3={rawTime:se.rawTime,price:se.price},ye.p4={rawTime:de.rawTime,price:de.price};try{d.current?.applyOptions({})}catch{}}const be={...u,p1:G,p2:q,p3:se,p4:de};Te(Me=>{const Xe=Me.map(At=>At===u?be:At);return C.current=Xe,Xe}),Y(be),re.current=be},m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(T);if(_==null)return;const N=ie(_);if(N==null)return;const z=(G,q,se,de)=>{const ye=G.normalizedTime??ie(G.rawTime);if(ye==null)return null;const be=ie(ye+se);return be==null?null:{rawTime:G.rawTime+q,normalizedTime:be,price:G.price+de}};if(ee.current==="line"){const G=p.timeScale().coordinateToTime(m.x),q=f.coordinateToPrice(m.y);if(G==null||q==null)return;const se=ie(G);if(se==null)return;const de=_-G,ye=N-se,be=H-q,Me=z(m.p1,de,ye,be),Xe=z(m.p2,de,ye,be),At=z(m.p3,de,ye,be),$e=z(m.p4,de,ye,be);if(!Me||!Xe||!At||!$e)return;P(Me,Xe,At,$e);return}if(ee.current==="handle1"){const G={rawTime:_,normalizedTime:N,price:H},q={rawTime:_,normalizedTime:N,price:m.p2.price};P(G,q,m.p3,m.p4);return}if(ee.current==="handle3"){const G={rawTime:_,normalizedTime:N,price:H},q={rawTime:_,normalizedTime:N,price:m.p4.price};P(m.p1,m.p2,G,q);return}if(ee.current==="handle2"||ee.current==="handle4"){const G=ee.current==="handle2"?m.p2:m.p4,q=H-G.price,se={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??ie(m.p1.rawTime),price:m.p2.price+q},de={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??ie(m.p3.rawTime),price:m.p4.price+q};if(se.normalizedTime==null||de.normalizedTime==null)return;P(m.p1,se,m.p3,de);return}}if(u.type==="fibonacci"&&u.p1&&u.p2){const P=(m,_)=>{const N=u.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p1:m,p2:_};Te(G=>{const q=G.map(se=>se===u?z:se);return C.current=q,q}),Y(z),re.current=z};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H})}else if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="rectangle"&&u.p1&&u.p2){const P=(lt,ft)=>{const Ft=u.primitive;if(Ft){Ft.p1={rawTime:lt.rawTime,price:lt.price},Ft.p2={rawTime:ft.rawTime,price:ft.price};try{d.current?.applyOptions({})}catch{}}const Vt={...u,p1:lt,p2:ft};Te(Xt=>{const AA=Xt.map(HA=>HA===u?Vt:HA);return C.current=AA,AA}),Y(Vt),re.current=Vt},m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(T);if(_==null)return;const N=ie(_);if(N==null)return;if(ee.current==="line"){const lt=p.timeScale().coordinateToTime(m.x),ft=f.coordinateToPrice(m.y);if(lt==null||ft==null)return;const Ft=ie(lt);if(Ft==null)return;const Vt=N-Ft,Xt=H-ft,AA=ie(m.p1.normalizedTime+Vt),HA=ie(m.p2.normalizedTime+Vt);if(AA==null||HA==null)return;const Bi=D-lt;P({rawTime:m.p1.rawTime+Bi,normalizedTime:AA,price:m.p1.price+Xt},{rawTime:m.p2.rawTime+Bi,normalizedTime:HA,price:m.p2.price+Xt});return}const z=Math.min(m.p1.normalizedTime,m.p2.normalizedTime),G=Math.max(m.p1.normalizedTime,m.p2.normalizedTime),q=Math.max(m.p1.price,m.p2.price),se=Math.min(m.p1.price,m.p2.price),de=m.p1.normalizedTime<=m.p2.normalizedTime?m.p1.rawTime:m.p2.rawTime,ye=m.p1.normalizedTime<=m.p2.normalizedTime?m.p2.rawTime:m.p1.rawTime;let be=z,Me=G,Xe=q,At=se,$e=de,pt=ye;if((ee.current==="handle1"||ee.current==="handle4"||ee.current==="handle6")&&(be=N,$e=_),(ee.current==="handle3"||ee.current==="handle5"||ee.current==="handle8")&&(Me=N,pt=_),(ee.current==="handle1"||ee.current==="handle2"||ee.current==="handle3")&&(Xe=H),(ee.current==="handle6"||ee.current==="handle7"||ee.current==="handle8")&&(At=H),be>Me){const lt=be,ft=$e;be=Me,$e=pt,Me=lt,pt=ft}if(Xe<At){const lt=Xe;Xe=At,At=lt}P({rawTime:$e,normalizedTime:be,price:Xe},{rawTime:pt,normalizedTime:Me,price:At});return}if(u.type==="circle"&&u.p1&&u.p2){const P=(Xe,At)=>{const $e=u.primitive;if($e){$e.p1={rawTime:Xe.rawTime,price:Xe.price},$e.p2={rawTime:At.rawTime,price:At.price};try{d.current?.applyOptions({})}catch{}}const pt={...u,p1:Xe,p2:At};Te(lt=>{const ft=lt.map(Ft=>Ft===u?pt:Ft);return C.current=ft,ft}),Y(pt),re.current=pt},m=p.timeScale().coordinateToTime(T);if(m==null)return;const _=ie(m);if(_==null)return;if(ee.current==="handle2"){P(u.p1,{rawTime:m,normalizedTime:_,price:H});return}const N=Z.current;if(!N)return;const z=p.timeScale().coordinateToTime(N.x),G=f.coordinateToPrice(N.y);if(z==null||G==null)return;const q=ie(z);if(q==null)return;const se=_-q,de=H-G,ye=ie(N.p1.normalizedTime+se),be=ie(N.p2.normalizedTime+se);if(ye==null||be==null)return;const Me=D-z;P({rawTime:N.p1.rawTime+Me,normalizedTime:ye,price:N.p1.price+de},{rawTime:N.p2.rawTime+Me,normalizedTime:be,price:N.p2.price+de});return}if(u.type==="triangle"&&u.p1&&u.p2&&u.p3){const P=($e,pt,lt)=>{const ft=u.primitive;if(ft){ft.p1={rawTime:$e.rawTime,price:$e.price},ft.p2={rawTime:pt.rawTime,price:pt.price},ft.p3={rawTime:lt.rawTime,price:lt.price};try{d.current?.applyOptions({})}catch{}}const Ft={...u,p1:$e,p2:pt,p3:lt};Te(Vt=>{const Xt=Vt.map(AA=>AA===u?Ft:AA);return C.current=Xt,Xt}),Y(Ft),re.current=Ft},m=p.timeScale().coordinateToTime(T);if(m==null)return;const _=ie(m);if(_==null)return;if(ee.current==="handle1"){P({rawTime:m,normalizedTime:_,price:H},u.p2,u.p3);return}if(ee.current==="handle2"){P(u.p1,{rawTime:m,normalizedTime:_,price:H},u.p3);return}if(ee.current==="handle3"){P(u.p1,u.p2,{rawTime:m,normalizedTime:_,price:H});return}const N=Z.current;if(!N)return;const z=p.timeScale().coordinateToTime(N.x),G=f.coordinateToPrice(N.y);if(z==null||G==null)return;const q=ie(z);if(q==null)return;const se=_-q,de=H-G,ye=D-z,be=$e=>{const pt=$e.normalizedTime??ie($e.rawTime);if(pt==null)return null;const lt=ie(pt+se);return lt==null?null:{rawTime:$e.rawTime+ye,normalizedTime:lt,price:$e.price+de}},Me=be(N.p1),Xe=be(N.p2),At=be(N.p3);if(!Me||!Xe||!At)return;P(Me,Xe,At);return}if(u.type==="ellipse"&&u.p1&&u.p2){const P=(z,G,q=u.minorRatio??.45)=>{const se=u.primitive;if(se){se.p1={rawTime:z.rawTime,price:z.price},se.p2={rawTime:G.rawTime,price:G.price},se.minorRatio=Math.max(.05,q);try{d.current?.applyOptions({})}catch{}}const de={...u,p1:z,p2:G,minorRatio:Math.max(.05,q)};Te(ye=>{const be=ye.map(Me=>Me===u?de:Me);return C.current=be,be}),Y(de),re.current=de},m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(T);if(_==null)return;const N=ie(_);if(N==null)return;if(ee.current==="line"){const z=p.timeScale().coordinateToTime(m.x),G=f.coordinateToPrice(m.y);if(z==null||G==null)return;const q=ie(z);if(q==null)return;const se=N-q,de=H-G,ye=ie(m.p1.normalizedTime+se),be=ie(m.p2.normalizedTime+se);if(ye==null||be==null)return;const Me=D-z;P({rawTime:m.p1.rawTime+Me,normalizedTime:ye,price:m.p1.price+de},{rawTime:m.p2.rawTime+Me,normalizedTime:be,price:m.p2.price+de},m.minorRatio??u.minorRatio??.45);return}if(ee.current==="handle1"){P({rawTime:_,normalizedTime:N,price:H},u.p2,u.minorRatio??.45);return}if(ee.current==="handle3"){P(u.p1,{rawTime:_,normalizedTime:N,price:H},u.minorRatio??.45);return}if(ee.current==="handle2"||ee.current==="handle4"){const z=p.timeScale().timeToCoordinate(u.p1.rawTime),G=f.priceToCoordinate(u.p1.price),q=p.timeScale().timeToCoordinate(u.p2.rawTime),se=f.priceToCoordinate(u.p2.price);if(z==null||G==null||q==null||se==null)return;const de=(z+q)/2,ye=(G+se)/2,be=q-z,Me=se-G,Xe=Math.hypot(be,Me);if(Xe<.001)return;const At=-Me/Xe,$e=be/Xe,pt=Math.abs((T-de)*At+(w-ye)*$e),lt=Math.max(.05,pt*2/Xe);P(u.p1,u.p2,lt);return}return}if(u.type==="gannfan"&&u.p1&&u.p2){const P=(m,_)=>{const N=u.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p1:m,p2:_};Te(G=>{const q=G.map(se=>se===u?z:se);return C.current=q,q}),Y(z),re.current=z};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H})}else if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="ganngrid"&&u.p1&&u.p2){const P=(m,_)=>{const N=u.primitive;if(N){N.p1={rawTime:m.rawTime,price:m.price},N.p2={rawTime:_.rawTime,price:_.price};try{d.current?.applyOptions({})}catch{}}const z={...u,p1:m,p2:_};Te(G=>{const q=G.map(se=>se===u?z:se);return C.current=q,q}),Y(z),re.current=z};if(ee.current==="handle1"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P({rawTime:m,normalizedTime:k,price:H},u.p2)}else if(ee.current==="handle2"){const m=p.timeScale().coordinateToTime(T);if(m==null)return;P(u.p1,{rawTime:m,normalizedTime:k,price:H})}else if(ee.current==="line"){const m=Z.current;if(!m)return;const _=p.timeScale().coordinateToTime(m.x),N=f.coordinateToPrice(m.y);if(_==null||N==null)return;const z=k-ie(_),G=H-N,q=ie(m.p1.normalizedTime+z),se=ie(m.p2.normalizedTime+z);if(q==null||se==null)return;const de=D-_;P({rawTime:m.p1.rawTime+de,normalizedTime:q,price:m.p1.price+G},{rawTime:m.p2.rawTime+de,normalizedTime:se,price:m.p2.price+G})}return}if(u.type==="verticalline"&&u.primitive){const P=u.primitive;P.time=D;const m={...u,time:ie(D),rawTime:D};Te(N=>{const z=N.map(G=>G===u?m:G);return C.current=z,z}),Y(m),re.current=m;const _=p.timeScale().timeToCoordinate(D);_!=null&&W([{x:_,y:P.midYCss??200}]),d.current?.applyOptions({});return}if(u.type==="horizontalray"&&u.primitive){const P=u.primitive,m=Z.current;if(!m)return;if(ee.current==="handle1"){if(P.price=H,P.originTime=D,u.priceLine)try{u.priceLine.applyOptions({price:H,title:u.showPrice!==!1?H.toFixed(5):""})}catch{}u.textPrimitive&&(u.textPrimitive.price=H,u.textPrimitive.originTime=D);const _={...u,price:P.price,originTime:P.originTime,rawOriginTime:D};Te(N=>{const z=N.map(G=>G===u?_:G);return C.current=z,z}),Y(_),re.current=_,d.current?.applyOptions({})}else if(ee.current==="line"){const _=f.coordinateToPrice(m.y);if(_==null)return;const N=H-_;if(P.price=m.price+N,u.priceLine)try{u.priceLine.applyOptions({price:P.price,title:u.showPrice!==!1?P.price.toFixed(5):""})}catch{}u.textPrimitive&&(u.textPrimitive.price=P.price);const z={...u,price:P.price};Te(G=>{const q=G.map(se=>se===u?z:se);return C.current=q,q}),Y(z),re.current=z,d.current?.applyOptions({})}return}if(!(u.type!=="trendline"&&u.type!=="gannline")&&!(!u.point1||!u.point2)){if(ee.current==="handle1"){const P={time:k,price:H},m=EA([{time:P.time,value:P.price},{time:u.point2.time,value:u.point2.price}]);m.length>0&&u.series.setData(m),u.decoration&&(u.decoration.p1=P);const _={...u,point1:P};Te(N=>{const z=N.map(G=>G===u?_:G);return C.current=z,z}),Y(_),re.current=_}else if(ee.current==="handle2"){const P={time:k,price:H},m=EA([{time:u.point1.time,value:u.point1.price},{time:P.time,value:P.price}]);m.length>0&&u.series.setData(m),u.decoration&&(u.decoration.p2=P);const _={...u,point2:P};Te(N=>{const z=N.map(G=>G===u?_:G);return C.current=z,z}),Y(_),re.current=_}else if(ee.current==="line"){const P=Z.current;if(!P)return;const m=p.timeScale().coordinateToTime(P.x),_=f.coordinateToPrice(P.y);if(m==null||_==null)return;const N=k-m,z=H-_,G={time:ie(P.point1.time+N),price:P.point1.price+z},q={time:ie(P.point2.time+N),price:P.point2.price+z},se=EA([{time:G.time,value:G.price},{time:q.time,value:q.price}]);se.length>0&&u.series.setData(se),u.decoration&&(u.decoration.p1=G,u.decoration.p2=q);const de={...u,point1:G,point2:q};Te(ye=>{const be=ye.map(Me=>Me===u?de:Me);return C.current=be,be}),Y(de),re.current=de}}}},V=()=>{ee.current=null,Z.current=null},le=()=>{ee.current||re.current||($(null),Ce([]))},ne={capture:!0,passive:!1};return K.addEventListener("mousedown",te,ne),K.addEventListener("mousemove",S,ne),K.addEventListener("mouseup",V,ne),K.addEventListener("mouseleave",le,ne),()=>{K.removeEventListener("mousedown",te,ne),K.removeEventListener("mousemove",S,ne),K.removeEventListener("mouseup",V,ne),K.removeEventListener("mouseleave",le,ne)}},[_e,ke,We,Te]),j.useEffect(()=>{const p=d.current,f=y.current;if(!p||!f)return;const K=()=>{const F=O;if(!F){W([]);return}const v=p.timeScale();if(F.type==="infoline"&&F.p1&&F.p2){const J=F.p1.rawTime??F.p1.time,x=F.p2.rawTime??F.p2.time,te=v.timeToCoordinate(J),S=f.priceToCoordinate(F.p1.price),V=v.timeToCoordinate(x),le=f.priceToCoordinate(F.p2.price);te!=null&&S!=null&&V!=null&&le!=null?W([{x:te,y:S},{x:V,y:le}]):W([]);return}if(F.type==="rulerline"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:(J+te)/2,y:(x+S)/2},{x:te,y:S}]):W([]);return}if(F.type==="arrowedline"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="rayline"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="extendedline"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="crossline"&&F.p){const J=v.timeToCoordinate(F.p.rawTime),x=f.priceToCoordinate(F.p.price);J!=null&&x!=null?W([{x:J,y:x}]):W([]);return}if(F.type==="text"&&F.rawTime!=null&&F.price!=null){const J=v.timeToCoordinate(F.rawTime),x=f.priceToCoordinate(F.price);J!=null&&x!=null?W([{x:J,y:x}]):W([]);return}if(F.type==="trendbyangle"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="equidistantchannel"&&F.p1&&F.p2&&F.b1&&F.b2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price),V=v.timeToCoordinate(F.b1.rawTime),le=f.priceToCoordinate(F.b1.price),ne=v.timeToCoordinate(F.b2.rawTime),g=f.priceToCoordinate(F.b2.price);J!=null&&x!=null&&te!=null&&S!=null&&V!=null&&le!=null&&ne!=null&&g!=null?W([{x:J,y:x},{x:te,y:S},{x:(V+ne)/2,y:(le+g)/2}]):W([]);return}if(F.type==="regressionchannel"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="stddevchannel"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="andrewspitchfork"&&F.p1&&F.p2&&F.p3){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price),V=v.timeToCoordinate(F.p3.rawTime),le=f.priceToCoordinate(F.p3.price);J!=null&&x!=null&&te!=null&&S!=null&&V!=null&&le!=null?W([{x:J,y:x},{x:te,y:S},{x:V,y:le}]):W([]);return}if(F.type==="disjointchannel"&&F.p1&&F.p2&&F.p3&&F.p4){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price),V=v.timeToCoordinate(F.p3.rawTime),le=f.priceToCoordinate(F.p3.price),ne=v.timeToCoordinate(F.p4.rawTime),g=f.priceToCoordinate(F.p4.price);J!=null&&x!=null&&te!=null&&S!=null&&V!=null&&le!=null&&ne!=null&&g!=null?W([{x:J,y:x},{x:te,y:S},{x:V,y:le},{x:ne,y:g}]):W([]);return}if(F.type==="flattopbottom"&&F.p1&&F.p2&&F.p3&&F.p4){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price),V=v.timeToCoordinate(F.p3.rawTime),le=f.priceToCoordinate(F.p3.price),ne=v.timeToCoordinate(F.p4.rawTime),g=f.priceToCoordinate(F.p4.price);J!=null&&x!=null&&te!=null&&S!=null&&V!=null&&le!=null&&ne!=null&&g!=null?W([{x:J,y:x},{x:te,y:S},{x:V,y:le},{x:ne,y:g}]):W([]);return}if(F.type==="fibonacci"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="trendline"&&F.point1&&F.point2){const J=v.timeToCoordinate(F.point1.time),x=f.priceToCoordinate(F.point1.price),te=v.timeToCoordinate(F.point2.time),S=f.priceToCoordinate(F.point2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="gannline"&&F.point1&&F.point2){const J=v.timeToCoordinate(F.point1.time),x=f.priceToCoordinate(F.point1.price),te=v.timeToCoordinate(F.point2.time),S=f.priceToCoordinate(F.point2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:(J+te)/2,y:(x+S)/2},{x:te,y:S}]):W([]);return}if(F.type==="rectangle"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);if(J!=null&&x!=null&&te!=null&&S!=null){const V=Math.min(J,te),le=Math.max(J,te),ne=Math.min(x,S),g=Math.max(x,S),B=(V+le)/2,T=(ne+g)/2;W([{x:V,y:ne},{x:B,y:ne},{x:le,y:ne},{x:V,y:T},{x:le,y:T},{x:V,y:g},{x:B,y:g},{x:le,y:g}])}else W([]);return}if(F.type==="circle"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="triangle"&&F.p1&&F.p2&&F.p3){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price),V=v.timeToCoordinate(F.p3.rawTime),le=f.priceToCoordinate(F.p3.price);J!=null&&x!=null&&te!=null&&S!=null&&V!=null&&le!=null?W([{x:J,y:x},{x:te,y:S},{x:V,y:le}]):W([]);return}if(F.type==="ellipse"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);if(J!=null&&x!=null&&te!=null&&S!=null){const V=(J+te)/2,le=(x+S)/2,ne=te-J,g=S-x,B=Math.hypot(ne,g);if(B<.001){W([]);return}const T=ne/B,w=g/B,u=-w,D=T,H=B/2,k=H*Math.max(.05,F.minorRatio??.45);W([{x:V-T*H,y:le-w*H},{x:V+u*k,y:le+D*k},{x:V+T*H,y:le+w*H},{x:V-u*k,y:le-D*k}])}else W([]);return}if(F.type==="gannfan"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="ganngrid"&&F.p1&&F.p2){const J=v.timeToCoordinate(F.p1.rawTime),x=f.priceToCoordinate(F.p1.price),te=v.timeToCoordinate(F.p2.rawTime),S=f.priceToCoordinate(F.p2.price);J!=null&&x!=null&&te!=null&&S!=null?W([{x:J,y:x},{x:te,y:S}]):W([]);return}if(F.type==="horizontalray"&&F.primitive){const J=F.primitive,x=v.timeToCoordinate(J.originTime),te=f.priceToCoordinate(J.price);x!=null&&te!=null?W([{x,y:te}]):W([]);return}if(F.type==="verticalline"&&F.primitive){const J=F.primitive,x=v.timeToCoordinate(J.time);if(x!=null){const te=J.midYCss??200;W([{x,y:te}])}else W([]);return}if(F.type==="pricelevel"&&F.priceLine){const J=y.current?.priceToCoordinate(F.price);if(J!=null){const x=d.current?d.current.paneSize().width:400;W([{x:x/2,y:J}])}else W([]);return}W([])};K();const ge=p.timeScale();return ge.subscribeVisibleTimeRangeChange(K),()=>{ge.unsubscribeVisibleTimeRangeChange(K)}},[O]),j.useEffect(()=>{let p=!1;C.current.forEach(f=>{if(f.type==="verticalline"&&f.primitive){const K=f===O||f===ce;f.primitive.showDot!==K&&(f.primitive.showDot=K,p=!0)}}),p&&d.current?.applyOptions({})},[O,ce]),j.useEffect(()=>{let p=!1;C.current.forEach(f=>{if((f.type==="infoline"||f.type==="rulerline"||f.type==="arrowedline"||f.type==="rayline"||f.type==="extendedline"||f.type==="trendbyangle")&&f.primitive){const K=f===O||f===ce;f.primitive.isActive!==K&&(f.primitive.isActive=K,p=!0)}}),p&&d.current?.applyOptions({})},[O,ce]),j.useEffect(()=>{!d.current||!y.current||C.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:De}),p.priceLine){const f=De&&p.showPrice!==!1;p.priceLine.applyOptions(De?{color:p.lineColor??"#3b82f6",axisLabelVisible:f,title:f&&typeof p.price=="number"?p.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(p.type==="fibonacci"&&p.primitive){p.primitive.visible=De;try{d.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=De;try{d.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:De}),p.parallelLine&&p.parallelLine.applyOptions({visible:De}),p.firstLine&&p.firstLine.applyOptions({visible:De}),p.secondLine&&p.secondLine.applyOptions({visible:De})),(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=De;try{d.current?.applyOptions({})}catch{}}})},[De,We]),j.useEffect(()=>{!De&&O&&(Y(null),W([]))},[De,O]),j.useEffect(()=>{if(C.current.length>We.length){const p=C.current.filter((f,K)=>!We.includes(f));O&&p.some(f=>f===O)&&(Y(null),W([])),p.forEach(f=>{if(f.series&&d.current?.removeSeries(f.series),f.priceLine&&y.current?.removePriceLine(f.priceLine),f.textPrimitive)try{y.current?.detachPrimitive(f.textPrimitive)}catch{}if(f.type==="horizontalray"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="verticalline"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="infoline"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rulerline"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="arrowedline"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rayline"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="extendedline"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="crossline"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="trendbyangle"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="equidistantchannel"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="regressionchannel"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="stddevchannel"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="gannfan"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ganngrid"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="andrewspitchfork"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="disjointchannel"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="flattopbottom"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="fibonacci"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rectangle"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="circle"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="triangle"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ellipse"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="text"&&f.primitive)try{y.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="parallellines")try{f.baseLine&&d.current?.removeSeries(f.baseLine),f.parallelLine&&d.current?.removeSeries(f.parallelLine),f.firstLine&&d.current?.removeSeries(f.firstLine),f.secondLine&&d.current?.removeSeries(f.secondLine)}catch{}}),C.current=We}},[We,O]),j.useEffect(()=>{const p=y.current;return p?(Qt.current.forEach(K=>{try{p.removePriceLine(K)}catch{}}),Qt.current=[],it.filter(K=>K.symbol===Ge).forEach(K=>{const ge=parseFloat(K.price);if(isNaN(ge))return;const v=K.type==="BUY"?"#26A69A":"#EF5350",J=p.createPriceLine({price:ge,color:v,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${K.type} ${K.volume} @ ${K.price}`,textColor:v});Qt.current.push(J)}),()=>{Qt.current.forEach(K=>{try{p.removePriceLine(K)}catch{}}),Qt.current=[]}):void 0},[it,Ge]);const xs=Ye?.id??null,Wa=Ye?.takeProfit??null,Ra=Ye?.stopLoss??null,Ga=Ye?.type??null,lp=Ye?.volume??null,$a=Ye?.symbol??null,cp=Ye?.price||Ye?.openPrice||null;j.useEffect(()=>{const p=y.current;if(!p)return;const f=tA.current;if(["tp","sl","entry"].forEach(te=>{if(f[te]){try{p.removePriceLine(f[te])}catch{}f[te]=null}}),!xs)return;const K=typeof Ge=="object"?Ge?.symbol:Ge;if($a!==K)return;const ge=parseFloat(cp),F=parseFloat(Wa),v=parseFloat(Ra),J=Ga==="BUY";Number.isFinite(ge)&&ge>0&&(f.entry=p.createPriceLine({price:ge,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`${Ga} ${lp} @ ${ge}`,textColor:"#3b82f6"}));const x=$a?.includes("JPY")?.01:1e-4;if(Number.isFinite(F)&&F>0&&Number.isFinite(ge)&&ge>0){const te=J?((F-ge)*(1/x)*10).toFixed(0):((ge-F)*(1/x)*10).toFixed(0);f.tp=p.createPriceLine({price:F,color:"#26A69A",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`TP, ${te} pts`,textColor:"#26A69A"})}if(Number.isFinite(v)&&v>0&&Number.isFinite(ge)&&ge>0){const te=J?((ge-v)*(1/x)*10).toFixed(0):((v-ge)*(1/x)*10).toFixed(0);f.sl=p.createPriceLine({price:v,color:"#EF5350",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`SL, ${te} pts`,textColor:"#EF5350"})}return()=>{["tp","sl","entry"].forEach(te=>{if(f[te]){try{p.removePriceLine(f[te])}catch{}f[te]=null}})}},[xs,Wa,Ra,Ga,lp,$a,cp,Ge]);const Ts=j.useRef(Ye);Ts.current=Ye;const hp=j.useRef(qe);hp.current=qe,j.useEffect(()=>{const f=J=>{const x=y.current;if(!x)return null;const te=tA.current[J];if(!te)return null;const S=te.options();return!S||!Number.isFinite(S.price)?null:x.priceToCoordinate(S.price)},K=J=>{const x=c.current,te=d.current;if(!x||!te||!Ts.current)return;const S=x.getBoundingClientRect(),V=J.clientY-S.top,le=f("tp"),ne=f("sl");le!==null&&Math.abs(V-le)<20?($t.current="tp",ei.current=V,Je.current=tA.current.tp.options().price,J.preventDefault(),J.stopImmediatePropagation(),x.style.cursor="ns-resize",te.applyOptions({handleScroll:!1,handleScale:!1})):ne!==null&&Math.abs(V-ne)<20&&($t.current="sl",ei.current=V,Je.current=tA.current.sl.options().price,J.preventDefault(),J.stopImmediatePropagation(),x.style.cursor="ns-resize",te.applyOptions({handleScroll:!1,handleScale:!1}))},ge=J=>{const x=c.current,te=y.current;if(!x)return;const S=$t.current;if(!S){if(!Ts.current)return;const D=x.getBoundingClientRect(),H=J.clientY-D.top,k=f("tp"),P=f("sl"),m=k!==null&&Math.abs(H-k)<20,_=P!==null&&Math.abs(H-P)<20;x.style.cursor=m||_?"ns-resize":"";return}if(!te)return;const V=x.getBoundingClientRect(),le=J.clientY-V.top,ne=te.coordinateToPrice(le);if(!Number.isFinite(ne)||ne<=0)return;const g=tA.current[S];if(!g)return;const B=Ts.current;if(!B)return;const T=parseFloat(B.price||B.openPrice),w=B.type==="BUY",u=S==="tp"?w?((ne-T)*1e5).toFixed(0):((T-ne)*1e5).toFixed(0):w?((T-ne)*1e5).toFixed(0):((ne-T)*1e5).toFixed(0);g.applyOptions({price:ne,title:`${S.toUpperCase()} ${u} pts`})},F=()=>{const J=c.current,x=d.current,te=$t.current;if(!te)return;const S=tA.current[te],V=S?S.options().price:null;if($t.current=null,J&&(J.style.cursor=""),x&&x.applyOptions({handleScroll:!0,handleScale:!0}),!Number.isFinite(V)||V<=0)return;const le=hp.current;le&&le(ne=>ne&&(te==="tp"?{...ne,takeProfit:V}:te==="sl"?{...ne,stopLoss:V}:ne))},v=c.current;if(v)return v.addEventListener("mousedown",K,!0),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",F),()=>{v.removeEventListener("mousedown",K,!0),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",F)}},[vt]),j.useEffect(()=>{const p=c.current,f=d.current,K=y.current;if(!p||!f||!K)return;let ge=p.querySelector(".tp-sl-handle-canvas");ge||(ge=document.createElement("canvas"),ge.className="tp-sl-handle-canvas",ge.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:5;",p.appendChild(ge));const F=()=>{const J=p.getBoundingClientRect(),x=window.devicePixelRatio||1;ge.width=J.width*x,ge.height=J.height*x,ge.style.width=J.width+"px",ge.style.height=J.height+"px";const te=ge.getContext("2d");if(te.clearRect(0,0,ge.width,ge.height),te.scale(x,x),!xs)return;const S=tA.current,V=J.width/2,le=(ne,g)=>{if(!ne)return;const B=ne.options()?.price;if(!Number.isFinite(B))return;const T=K.priceToCoordinate(B);T!=null&&(te.beginPath(),te.arc(V,T,7,0,Math.PI*2),te.fillStyle=g,te.fill(),te.strokeStyle="#fff",te.lineWidth=2,te.stroke(),te.beginPath(),te.arc(V,T,2.5,0,Math.PI*2),te.fillStyle="#fff",te.fill())};le(S.tp,"#26A69A"),le(S.sl,"#EF5350")};F(),f.subscribeCrosshairMove(F);const v=f.timeScale();return v.subscribeVisibleTimeRangeChange(F),()=>{f.unsubscribeCrosshairMove(F),v.unsubscribeVisibleTimeRangeChange(F)}},[xs,Wa,Ra]),j.useEffect(()=>{const p=c.current;if(!p)return;const f=K=>{if(fe.current){fe.current=!1;return}if(U.current||!d.current)return;const ge=d.current,F=y.current;if(ge&&F&&C.current.length>0){const v=p.getBoundingClientRect(),J=K.clientX-v.left,x=K.clientY-v.top,te=15;for(let S=C.current.length-1;S>=0;S--){const V=C.current[S];let le=!1;if(V.type==="text"&&V.rawTime!=null&&V.price!=null){const ne=ge.timeScale().timeToCoordinate(V.rawTime),g=F.priceToCoordinate(V.price);if(ne!=null&&g!=null){const B=Gd(V,ne,g);J>=B.left&&J<=B.right&&x>=B.top&&x<=B.bottom&&(le=!0)}}else if(V.point1&&V.point2){const ne=ge.timeScale().timeToCoordinate(V.point1.time??V.point1.rawTime),g=F.priceToCoordinate(V.point1.price),B=ge.timeScale().timeToCoordinate(V.point2.time??V.point2.rawTime),T=F.priceToCoordinate(V.point2.price);if(ne!=null&&g!=null&&B!=null&&T!=null){const w=Math.hypot(J-ne,x-g),u=Math.hypot(J-B,x-T),D=(ne+B)/2,H=(g+T)/2,k=Math.hypot(J-D,x-H);(w<te||u<te||k<te)&&(le=!0)}}else if(V.p1&&V.p2){const ne=ge.timeScale().timeToCoordinate(V.p1.rawTime),g=F.priceToCoordinate(V.p1.price),B=ge.timeScale().timeToCoordinate(V.p2.rawTime),T=F.priceToCoordinate(V.p2.price);if(ne!=null&&g!=null&&B!=null&&T!=null){const w=Math.min(ne,B),u=Math.max(ne,B),D=Math.min(g,T),H=Math.max(g,T);J>=w-5&&J<=u+5&&x>=D-5&&x<=H+5&&(le=!0)}}else if(V.p){const ne=ge.timeScale().timeToCoordinate(V.p.rawTime),g=F.priceToCoordinate(V.p.price);ne!=null&&g!=null&&Math.hypot(J-ne,x-g)<te&&(le=!0)}else if(V.type==="pricelevel"&&V.price!=null){const ne=F.priceToCoordinate(V.price);ne!=null&&Math.abs(x-ne)<te&&(le=!0)}if(le){K.preventDefault(),K.stopPropagation(),typeof K.stopImmediatePropagation=="function"&&K.stopImmediatePropagation(),Ae(V);return}}}K.preventDefault(),K.stopPropagation(),typeof K.stopImmediatePropagation=="function"&&K.stopImmediatePropagation(),setTimeout(()=>{if(!d.current)return;Yd(d.current,ke,Ve)||d.current.timeScale().fitContent();const J=d.current.timeScale().getVisibleRange();Ee(J)},80)};return p.addEventListener("dblclick",f,!0),()=>{p.removeEventListener("dblclick",f,!0)}},[ke,Ve]);const up=O??ce,dp=O?oe:Be,zx=De&&cx(up,dp),Wx=hx(up?.type);j.useEffect(()=>{const p=c.current,f=h.current;if(!p||!f)return;const K=80,ge=v=>{const J=p.getBoundingClientRect();f.style.opacity=J.bottom-v.clientY<=K?"1":"0"},F=()=>{f.style.opacity="0"};return p.addEventListener("mousemove",ge),p.addEventListener("mouseleave",F),()=>{p.removeEventListener("mousemove",ge),p.removeEventListener("mouseleave",F)}},[]);const Rx=j.useCallback(()=>{const p=d.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const K=f.to-f.from,ge=(f.from+f.to)/2,F=K*.8;try{p.setVisibleRange({from:ge-F/2,to:ge+F/2}),Ee(p.getVisibleRange())}catch{}},[Ee]),Gx=j.useCallback(()=>{const p=d.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const K=f.to-f.from,ge=(f.from+f.to)/2,F=K*1.25;try{p.setVisibleRange({from:ge-F/2,to:ge+F/2}),Ee(p.getVisibleRange())}catch{}},[Ee]),$x=j.useCallback(()=>{const p=d.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const K=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from-K,to:f.to-K})}catch{}},[]),Xx=j.useCallback(()=>{const p=d.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const K=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from+K,to:f.to+K})}catch{}},[]),Zx=j.useCallback(()=>{if(!d.current)return;Yd(d.current,ke,Ve)||d.current.timeScale().fitContent();const f=d.current.timeScale().getVisibleRange();Ee(f)},[ke,Ve,Ee]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${ae==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:c,className:"relative h-full w-full flex-1",style:{cursor:_e===1||_e!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[vt&&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 Ge=="object"?Ge?.symbol:Ge,"..."]})]})}),!vt&&Va&&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:ae==="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:ae==="light"?"#64748b":"#94a3b8"},children:Va})]})}),!vt&&!Va&&ke.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:ae==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof Ge=="object"?Ge?.symbol:Ge]})})}),A&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Sh,{bidPrice:e,askPrice:t,onBuyClick:kx,onSellClick:Nx})}),a.jsx(Eh,{isOpen:Re,onClose:Ox,orderType:ct,bidPrice:e,askPrice:t}),a.jsx(Ph,{isOpen:X!==null,onClose:()=>Ae(null),chartObject:X,onUpdate:Kx}),vt&&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"}})}),zx&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:dp.map((p,f)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:p.x-5,top:p.y-5,backgroundColor:Wx}},f))}),a.jsx("div",{ref:h,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:Gx,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:Rx,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:$x,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:Xx,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:Zx,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:p,onClick:f,icon:K})=>a.jsx("button",{title:p,onClick:f,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:ae==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:ae==="light"?"#374151":"#94a3b8",border:"1px solid "+(ae==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:ge=>{ge.currentTarget.style.backgroundColor=ae==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",ge.currentTarget.style.color=ae==="light"?"#111827":"#e2e8f0"},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=ae==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",ge.currentTarget.style.color=ae==="light"?"#374151":"#94a3b8"},children:K},p))})]})})}),yt={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 qd({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Lt(),[s,o]=j.useState(!1),[l,c]=j.useState(""),[h,d]=j.useState(-1),y=j.useRef(null),Q=j.useRef(null);j.useEffect(()=>{const E=I=>{y.current&&!y.current.contains(I.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),j.useEffect(()=>{s&&Q.current&&Q.current.focus()},[s]);const b=r.filter(E=>E.symbol.toLowerCase().includes(l.toLowerCase())),C=b.filter(E=>!E.symbol.endsWith("USDT")),U=b.filter(E=>E.symbol.endsWith("USDT")),M=E=>{A(E),o(!1),c("")};return r.find(E=>E.symbol===t),a.jsxs("div",{ref:y,style:{...yt.container,...i},className:e,children:[a.jsxs("button",{style:yt.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,yt.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:{...yt.arrow,...s?yt.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:yt.dropdown,children:[a.jsx("div",{style:yt.searchContainer,children:a.jsx("input",{ref:Q,style:yt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:E=>c(E.target.value)})}),a.jsx("div",{style:yt.list,children:b.length===0?a.jsx("div",{style:yt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:yt.categoryLabel,children:"Forex & Metals"}),C.map(E=>a.jsxs("div",{style:{...yt.item,...E.symbol===t?yt.itemSelected:{}},onClick:()=>M(E.symbol),onMouseEnter:I=>{E.symbol!==t&&(I.currentTarget.style.backgroundColor="#334155")},onMouseLeave:I=>{E.symbol!==t&&(I.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:yt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...yt.symbolPrice,...parseFloat(E.change)>=0?yt.priceUp:yt.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:yt.categoryLabel,children:"Crypto"}),U.map(E=>a.jsxs("div",{style:{...yt.item,...E.symbol===t?yt.itemSelected:{}},onClick:()=>M(E.symbol),onMouseEnter:I=>{E.symbol!==t&&(I.currentTarget.style.backgroundColor="#334155")},onMouseLeave:I=>{E.symbol!==t&&(I.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:yt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...yt.symbolPrice,...parseFloat(E.change)>=0?yt.priceUp:yt.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const LA={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"}},mx=[.01,.05,.1,.5,1];function jd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=mx,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:h}){const[d,y]=j.useState(.1),Q=i!==void 0?i:d,b=j.useCallback(E=>{const I=Math.max(t,Math.min(A,parseFloat(E)||t)),R=Math.round(I/r)*r,L=parseFloat(R.toFixed(8));i!==void 0||y(L),e?.(L)},[t,A,r,i,e]),C=()=>b(Q+r),U=()=>b(Q-r),M=(Q>=1,Q.toFixed(2));return a.jsxs("div",{style:{...LA.container,...c},className:h,children:[o&&a.jsx("span",{style:LA.label,children:l}),a.jsx("button",{style:LA.btn,onClick:U,onMouseEnter:E=>Object.assign(E.currentTarget.style,LA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:LA.input,type:"text",value:M,onChange:E=>{const I=E.target.value;if(I===""||I==="."||I==="0.")return;const R=parseFloat(I);isNaN(R)||b(R)},onBlur:()=>b(Q)}),a.jsx("button",{style:LA.btn,onClick:C,onMouseEnter:E=>Object.assign(E.currentTarget.style,LA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:LA.presets,children:n.map(E=>a.jsx("button",{style:{...LA.preset,...Math.abs(Q-E)<1e-4?LA.presetActive:{}},onClick:()=>b(E),onMouseEnter:I=>{Math.abs(Q-E)>=1e-4&&Object.assign(I.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:I=>{Math.abs(Q-E)>=1e-4&&(I.currentTarget.style.borderColor="#334155")},children:E},E))})]})}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:"#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 ep({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:h,className:d}){const{currentSymbolData:y}=Lt(),[Q,b]=j.useState(""),[C,U]=j.useState(!1),[M,E]=j.useState("price"),I=i!==void 0?i:Q,R=t!==void 0?t:C,L=r!==void 0?r:M,O=j.useCallback(W=>{t!==void 0||U(W),A?.(W)},[t,A]),Y=j.useCallback(W=>{r!==void 0||E(W),n?.(W)},[r,n]),X=j.useCallback(W=>{i!==void 0||b(W),e?.(W)},[i,e]),Ae=W=>{const ce=W.target.value;if(ce===""||ce==="."||ce==="0."){X(ce);return}const $=parseFloat(ce);isNaN($)||X(ce)},oe=L==="price"?y?.bid?parseFloat(y.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...jt.container,...h},className:d,children:[l&&a.jsx("span",{style:jt.label,children:c}),s&&a.jsx("button",{style:{...jt.toggle,...R?jt.toggleOn:jt.toggleOff},onClick:()=>O(!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:I,onChange:Ae,placeholder:oe,onFocus:W=>W.currentTarget.style.borderColor="#EF5350",onBlur:W=>W.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...jt.modeBtn,...L==="price"?jt.modeBtnActive:{}},onClick:()=>Y("price"),children:"Price"}),a.jsx("button",{style:{...jt.modeBtn,...L==="pips"?jt.modeBtnActive:{}},onClick:()=>Y("pips"),children:"Pips"})]})]})]})}const eA={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 tp({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:h,className:d}){const{currentSymbolData:y}=Lt(),[Q,b]=j.useState(""),[C,U]=j.useState(!1),[M,E]=j.useState("price"),I=i!==void 0?i:Q,R=t!==void 0?t:C,L=r!==void 0?r:M,O=j.useCallback(W=>{t!==void 0||U(W),A?.(W)},[t,A]),Y=j.useCallback(W=>{r!==void 0||E(W),n?.(W)},[r,n]),X=j.useCallback(W=>{i!==void 0||b(W),e?.(W)},[i,e]),Ae=W=>{const ce=W.target.value;if(ce===""||ce==="."||ce==="0."){X(ce);return}const $=parseFloat(ce);isNaN($)||X(ce)},oe=L==="price"?y?.ask?parseFloat(y.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...eA.container,...h},className:d,children:[l&&a.jsx("span",{style:eA.label,children:c}),s&&a.jsx("button",{style:{...eA.toggle,...R?eA.toggleOn:eA.toggleOff},onClick:()=>O(!R),children:a.jsx("div",{style:{...eA.toggleKnob,...R?eA.knobOn:eA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:eA.inputGroup,children:[a.jsx("input",{style:eA.input,type:"text",value:I,onChange:Ae,placeholder:oe,onFocus:W=>W.currentTarget.style.borderColor="#26A69A",onBlur:W=>W.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...eA.modeBtn,...L==="price"?eA.modeBtnActive:{}},onClick:()=>Y("price"),children:"Price"}),a.jsx("button",{style:{...eA.modeBtn,...L==="pips"?eA.modeBtnActive:{}},onClick:()=>Y("pips"),children:"Pips"})]})]})]})}const wx=[{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:"─"}],MA={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 Ap({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:h,chartObjects:d,setChartObjects:y}=Lt(),[Q,b]=j.useState(null),C=A||wx,U=I=>{l(o===I?null:I)},M=()=>{y([]),l(null)},E=()=>{h(!c)};return a.jsxs("div",{style:{...MA.container,...n},className:s,children:[i&&a.jsx("span",{style:MA.label,children:r}),C.map(I=>a.jsxs("button",{style:{...MA.btn,...o===I.id?MA.btnActive:{}},onClick:()=>U(I.id),onMouseEnter:R=>{b(I.id),o!==I.id&&Object.assign(R.currentTarget.style,MA.btnHover)},onMouseLeave:R=>{b(null),o!==I.id&&(R.currentTarget.style.borderColor="#334155",R.currentTarget.style.backgroundColor="#1e293b",R.currentTarget.style.color="#94a3b8")},title:I.name,children:[I.icon,Q===I.id&&a.jsx("div",{style:MA.tooltip,children:I.name})]},I.id)),(e||t)&&a.jsx("div",{style:MA.divider}),t&&a.jsx("button",{style:{...MA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:E,onMouseEnter:I=>{I.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:I=>{I.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:MA.deleteBtn,onClick:M,onMouseEnter:I=>Object.assign(I.currentTarget.style,MA.deleteBtnHover),onMouseLeave:I=>{I.currentTarget.style.borderColor="#334155",I.currentTarget.style.backgroundColor="#1e293b",I.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const ip={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 Bx({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:h,onStopLossEnabledChange:d,takeProfit:y,onTakeProfitChange:Q,takeProfitEnabled:b,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:M={},stopLossProps:E={},takeProfitProps:I={},drawingToolsProps:R={},style:L,className:O}){const Y=[];i&&Y.push(a.jsx(qd,{...U},"coin")),e&&Y.push(a.jsx(jd,{value:s,onChange:o,...M},"volume")),t&&Y.push(a.jsx(ep,{value:l,onChange:c,enabled:h,onEnabledChange:d,...E},"sl")),A&&Y.push(a.jsx(tp,{value:y,onChange:Q,enabled:b,onEnabledChange:C,...I},"tp")),r&&Y.push(a.jsx(Ap,{...R},"draw"));const X=[];return Y.forEach((Ae,oe)=>{X.push(Ae),n&&oe<Y.length-1&&X.push(a.jsx("div",{style:ip.divider},`div-${oe}`))}),a.jsx("div",{style:{...ip.toolbar,...L},className:O,children:X})}const yx=[{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"}],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"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function Cx({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Lt();return a.jsx("div",{style:{...Oa.container,...i},className:e,children:yx.map(r=>a.jsx("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")},children:r.label},r.value))})}const vx=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Ka={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 xx({style:i,className:e}){const{chartType:t,setChartType:A}=Lt();return a.jsx("div",{style:{...Ka.container,...i},className:e,children:vx.map(r=>a.jsxs("button",{style:{...Ka.btn,...t===r.value?Ka.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 Gt={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 Tx({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Lt(),[h,d]=j.useState(null),y=parseFloat(o?.bid||0),Q=parseFloat(o?.ask||0),b=Q>0&&y>0?Math.abs(Q-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",M=j.useCallback(E=>{if(!s)return;const I=E==="BUY"?Q:y;if(!I||I<=0){d({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:I,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(O=>[...O,R]);const L=i*I*.01;c(O=>O-L),d({type:"success",message:`${E} executed`}),A?.(R),setTimeout(()=>d(null),3e3)},[s,Q,y,i,e,t,l,c,A]);return a.jsxs("div",{style:{...Gt.container,...r},className:n,children:[a.jsx("button",{style:Gt.sellBtn,onClick:()=>M("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Gt.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:Gt.priceBox,children:[a.jsx("span",{style:Gt.priceLabel,children:"Bid"}),a.jsx("span",{style:{...Gt.priceValue,color:"#EF5350"},children:C(y)})]}),a.jsxs("div",{style:Gt.spread,children:[a.jsx("span",{style:Gt.spreadLabel,children:"Spread"}),a.jsx("span",{style:Gt.spreadValue,children:U(b)})]}),a.jsxs("div",{style:Gt.priceBox,children:[a.jsx("span",{style:Gt.priceLabel,children:"Ask"}),a.jsx("span",{style:{...Gt.priceValue,color:"#26A69A"},children:C(Q)})]}),a.jsx("button",{style:Gt.buyBtn,onClick:()=>M("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Gt.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&a.jsx("span",{style:{...Gt.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const nt={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 bx({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Lt(),[l,c]=j.useState(null),h=A.filter(C=>C.status==="OPEN"||!C.closeAt),d=j.useCallback((C,U)=>{const M=n.find(E=>E.symbol===C);return M?parseFloat(U==="BUY"?M.bid||0:M.ask||0):0},[n]),y=j.useCallback(C=>{if(l)return;c(C.id);const U=d(C.symbol,C.type),E=(C.type==="BUY"?U-C.price:C.price-U)*C.volume,I=C.volume*C.price*.01;r(R=>R.filter(L=>L.id!==C.id)),o(R=>R+I+E),c(null)},[l,d,r,o]),Q=C=>{const U=parseFloat(C);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},b=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...nt.container,...i},className:e,children:[a.jsxs("div",{style:nt.header,children:[a.jsxs("span",{style:nt.headerTitle,children:["Positions (",h.length,")"]}),a.jsxs("div",{style:nt.summary,children:[a.jsxs("div",{style:nt.summaryItem,children:[a.jsx("span",{style:nt.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...nt.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:nt.summaryItem,children:[a.jsx("span",{style:nt.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...nt.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:nt.summaryItem,children:[a.jsx("span",{style:nt.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...nt.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...nt.scrollArea,maxHeight:t},children:a.jsxs("table",{style:nt.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:nt.th,children:"Symbol"}),a.jsx("th",{style:nt.th,children:"Type"}),a.jsx("th",{style:nt.th,children:"Volume"}),a.jsx("th",{style:nt.th,children:"Open Price"}),a.jsx("th",{style:nt.th,children:"Current"}),a.jsx("th",{style:nt.th,children:"SL"}),a.jsx("th",{style:nt.th,children:"TP"}),a.jsx("th",{style:nt.th,children:"Profit"}),a.jsx("th",{style:nt.th,children:"Action"})]})}),a.jsx("tbody",{children:h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:nt.emptyRow,children:"No open positions"})}):h.map(C=>{const U=d(C.symbol,C.type),M=C.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...nt.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...nt.td,...C.type==="BUY"?nt.typeBuy:nt.typeSell},children:C.type}),a.jsx("td",{style:nt.td,children:C.volume}),a.jsx("td",{style:nt.td,children:Q(C.price)}),a.jsx("td",{style:nt.td,children:Q(U)}),a.jsx("td",{style:nt.td,children:C.stopLoss?Q(C.stopLoss):"-"}),a.jsx("td",{style:nt.td,children:C.takeProfit?Q(C.takeProfit):"-"}),a.jsx("td",{style:{...nt.td,color:M>=0?"#26A69A":"#EF5350",fontWeight:700},children:b(M)}),a.jsx("td",{style:nt.td,children:a.jsx("button",{style:{...nt.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 Qx(i){return Wt({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 Fx(i){return Wt({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 Ux(i){return Wt({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 Sx(i){return Wt({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 Ex=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:d=!0,onToggleMarketWatch:y,buySellPanelOpen:Q,onMove:b})=>{const{theme:C}=Lt(),U=C==="light",M=["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(I=>a.jsx("button",{onClick:()=>r(I),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
+ ${A===I?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:I,children:E[I]},I))}),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(I=>a.jsx("button",{onClick:()=>r(I),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
15
+ ${A===I?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:I,children:E[I]},I))}),a.jsxs("div",{className:"flex items-center gap-2",children:[M.map(I=>a.jsx("button",{onClick:()=>t(I),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===I?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:I},I)),a.jsx("div",{className:`border-r h-6 mx-1 ${U?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:Q?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${Q?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(Qx,{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(Fx,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:b,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>y?.(),title:d?"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 ${d?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:()=>h?.(),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"})})})]})]})},Hr=[{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"})]})}],Ir=[{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"})})}],Pr=[{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"})})}],Dr=[{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})}),Lx=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:h,drawingsVisible:d,setDrawingsVisible:y,chartLocked:Q,setChartLocked:b,theme:C,setTheme:U,setIsShow:M}=Lt(),[E,I]=j.useState(!1),[R,L]=j.useState(null),[O,Y]=j.useState(null),[X,Ae]=j.useState(0),[oe,W]=j.useState(!1),[ce,$]=j.useState(0),[Be,Ce]=j.useState(!1),[ee,Z]=j.useState(0),[re,fe]=j.useState(!1),[we,ve]=j.useState(0),[xe,me]=j.useState(!1),[Se,He]=j.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Ee=j.useRef(null),_e=j.useRef(null),Qe=j.useRef(null),Ie=j.useRef(null),Ze=j.useRef(null),We=j.useRef(null);j.useEffect(()=>{const ae=he=>{const Fe=Ee.current;E&&Fe&&!Fe.contains(he.target)&&(I(!1),L(null));const Le=_e.current;O==="line"&&Le&&!Le.contains(he.target)&&Y(null);const Ye=Qe.current;O==="channel"&&Ye&&!Ye.contains(he.target)&&Y(null);const qe=Ie.current;O==="gann"&&qe&&!qe.contains(he.target)&&Y(null);const Qt=Ze.current;O==="shape"&&Qt&&!Qt.contains(he.target)&&Y(null)};return window.addEventListener("mousedown",ae),()=>window.removeEventListener("mousedown",ae)},[E,O]),j.useEffect(()=>{const ae=he=>{he.key==="Escape"&&(I(!1),L(null),Y(null))};return window.addEventListener("keydown",ae),()=>window.removeEventListener("keydown",ae)},[]);const Te=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"}],[]),it=ae=>{const he=Te[ae].label;if(he==="Menu"){I(Fe=>!Fe),L(null);return}if(he==="Grid"){s(!n);return}if(he==="Magnet"){l(!o),r(o?null:ae);return}if(he==="Delete"){if(c.length>0){const Fe=[...c];Fe.pop(),h(Fe)}return}if(he==="Eye"){y(!d);return}if(he==="Lock"){b(!Q);return}if(he==="Light Theme"||he==="Dark Theme"){U(C==="light"?"dark":"light"),I(!1),L(null);return}if(he==="History"){M(!0);return}r(A===ae?null:ae)};Te.slice(0,12);const Ge=Te.slice(12),Ve=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],De=[{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"})]})}],Pe=({item:ae})=>{const he=!!ae.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{We.current&&(clearTimeout(We.current),We.current=null),he&&L(ae.key)},onMouseLeave:()=>{he&&(We.current=setTimeout(()=>L(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{he?L(Fe=>Fe===ae.key?null:ae.key):(ae.key==="theme"&&U(Fe=>Fe==="light"?"dark":"light"),I(!1),L(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${ue?"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 ${ue?"text-slate-500":"text-slate-400"}`,children:ae.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:ae.label}),ae.rightText&&a.jsx("span",{className:`text-xs ${ue?"text-slate-500":"text-slate-400"}`,children:ae.rightText}),he&&a.jsx("svg",{className:`w-4 h-4 ${ue?"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"})})]}),he&&R===ae.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 ${ue?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:ae.submenu.map((Fe,Le)=>{const Ye=Se[ae.key]===Fe.label||Fe.selected&&Se[ae.key]==null;return a.jsxs("button",{type:"button",onClick:()=>{He(qe=>({...qe,[ae.key]:Fe.label}))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${ue?"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 ${ue?"text-slate-500":"text-slate-400"}`,children:Fe.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Fe.label}),Ye&&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"})})})]},Le)})})})]})},ue=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 ${ue?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:Ve.map((ae,he)=>{const Fe=ae==="gann",Le=Fe?null:Te[ae],Ye=Fe?-1:ae;return a.jsxs(j.Fragment,{children:[Ye===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const qe=Hr[X].toolId;r(A===qe?null:qe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
+ ${A===Hr[X].toolId?ue?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ue?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Hr[X].label,children:Hr[X].icon}),a.jsx("span",{onMouseEnter:()=>W(!0),onMouseLeave:()=>W(!1),onMouseDown:qe=>{qe.stopPropagation(),Y(Qt=>Qt==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:oe?10:7,height:oe?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:ue?"#64748b":"#94a3b8"})})})]}):Ye===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const qe=Ir[ce].toolId;r(A===qe?null:qe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
+ ${A===Ir[ce].toolId?ue?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ue?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Ir[ce].label,children:Ir[ce].icon}),a.jsx("span",{onMouseEnter:()=>Ce(!0),onMouseLeave:()=>Ce(!1),onMouseDown:qe=>{qe.stopPropagation(),Y(Qt=>Qt==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:Be?10:7,height:Be?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More 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:ue?"#64748b":"#94a3b8"})})})]}):Fe?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const qe=Pr[ee].toolId;r(A===qe?null:qe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
+ ${A===Pr[ee].toolId?ue?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ue?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Pr[ee].label,children:Pr[ee].icon}),a.jsx("span",{onMouseEnter:()=>fe(!0),onMouseLeave:()=>fe(!1),onMouseDown:qe=>{qe.stopPropagation(),Y(Qt=>Qt==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:re?10:7,height:re?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:ue?"#64748b":"#94a3b8"})})})]}):Ye===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const qe=Dr[we].toolId;r(A===qe?null:qe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
+ ${A===Dr[we].toolId?ue?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ue?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Dr[we].label,children:Dr[we].icon}),a.jsx("span",{onMouseEnter:()=>me(!0),onMouseLeave:()=>me(!1),onMouseDown:qe=>{qe.stopPropagation(),Y(Qt=>Qt==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:xe?10:7,height:xe?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:ue?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>it(Ye),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
+ ${Le.label==="Grid"&&n||Le.label==="Eye"&&!d||Le.label==="Lock"&&Q||A===Ye?ue?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ue?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Le.label}: ${Le.description}`,children:Le.icon}),!Fe&&Le.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${ue?"border-slate-200":"border-slate-700"}`})]},Fe?"gann-slot":`${Le.label}-${ae}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:Ge.map((ae,he)=>{const Fe=12+he;return a.jsx("button",{onClick:()=>it(Fe),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
+ ${ae.label==="Grid"&&n||ae.label==="Eye"&&!d||ae.label==="Lock"&&Q||A===Fe?ue?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ue?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${ae.label}: ${ae.description}`,children:ae.icon},ae.label)})})]}),O==="line"&&a.jsx(Cs,{top:84,panelRef:_e,isLight:ue,children:Hr.map((ae,he)=>{const Fe=X===he;return a.jsxs("button",{type:"button",onMouseDown:Le=>{Le.stopPropagation(),Ae(he),r(ae.toolId),Y(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ue?"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 ${ue?"text-slate-500":"text-slate-400"}`,children:ae.icon}),a.jsx("span",{className:"flex-1",children:ae.label}),Fe&&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"})})})]},ae.toolId)})}),O==="channel"&&a.jsx(Cs,{top:128,panelRef:Qe,isLight:ue,children:Ir.map((ae,he)=>{const Fe=ce===he;return a.jsxs("button",{type:"button",onMouseDown:Le=>{Le.stopPropagation(),$(he),r(ae.toolId),Y(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ue?"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 ${ue?"text-slate-500":"text-slate-400"}`,children:ae.icon}),a.jsx("span",{className:"flex-1",children:ae.label}),Fe&&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"})})})]},ae.toolId)})}),O==="gann"&&a.jsx(Cs,{top:210,panelRef:Ie,isLight:ue,children:Pr.map((ae,he)=>{const Fe=ee===he;return a.jsxs("button",{type:"button",onMouseDown:Le=>{Le.stopPropagation(),Z(he),r(ae.toolId),Y(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ue?"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 ${ue?"text-slate-500":"text-slate-400"}`,children:ae.icon}),a.jsx("span",{className:"flex-1",children:ae.label}),Fe&&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"})})})]},ae.toolId)})}),O==="shape"&&a.jsx(Cs,{top:250,panelRef:Ze,isLight:ue,children:Dr.map((ae,he)=>{const Fe=we===he;return a.jsxs("button",{type:"button",onMouseDown:Le=>{Le.stopPropagation(),ve(he),r(ae.toolId),Y(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ue?"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 ${ue?"text-slate-500":"text-slate-400"}`,children:ae.icon}),a.jsx("span",{className:"flex-1",children:ae.label}),Fe&&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"})})})]},ae.toolId)})}),E&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{I(!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 ${ue?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${ue?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${ue?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),a.jsx("div",{className:`text-[12px] mt-0.5 ${ue?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:De.map(ae=>a.jsx(Pe,{item:ae},ae.key))})]})]})]})};function Mx(i){return Wt({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 Hx=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Lt(),o=s==="light",[l,c]=j.useState(""),h=e.filter(Q=>Q.symbol.toLowerCase().includes(l.toLowerCase())),d=h.filter(Q=>!Q.symbol.toUpperCase().endsWith("USDT")),y=h.filter(Q=>Q.symbol.toUpperCase().endsWith("USDT"));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(gT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:x=>c(x.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):h.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change"})]})}),a.jsxs("tbody",{children:[g.length>0&&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?"text-sky-600":"text-sky-400"}`,children:"FOREX"})}),g.map(x=>a.jsxs("tr",{onClick:()=>A(x.symbol),className:`cursor-pointer transition-colors ${t===x.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[a.jsxs("td",{className:`px-3 flex items-center justify-start gap-2 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:[x.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(dT,{className:"text-2xl text-emerald-500"})}):x.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(uT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Tm,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:x.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${x.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[x.change>=0?"+":"",x.change,"%"]})]},x.symbol)),C.length>0&&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?"text-emerald-600":"text-emerald-400"}`,children:"CRYPTO"})}),C.map(x=>a.jsxs("tr",{onClick:()=>A(x.symbol),className:`cursor-pointer transition-colors ${t===x.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[a.jsx("td",{className:`px-3 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:x.symbol}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:x.bid.toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:x.ask.toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${x.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[x.change>=0?"+":"",x.change,"%"]})]},x.symbol))]})]})})]})]})},wT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:h,fetchHistoryOrders:g}=Lt(),C=i||n,x=e?.length>0?e:s,b=h||[],v=o==="light",U=l?"history":"trade";Ae.useEffect(()=>{l&&g&&g()},[l,g]);const F="#26A69A",M="#EF5350",N=v?"#f8fafc":"#12161D",R=v?"#e2e8f0":"#1e293b",L=v?"#f1f5f9":"#12161D",z=v?"#F0F5F9":"#2B3543",q=v?"#f8fafc":"#131c2e",$=v?"#12161D":"#fff",V=v?"#64748b":"#fff",j=(x||[]).filter(fe=>fe.status==="OPEN"||!fe.closeAt),te=C?.balance||0,ce=C?.equity??te,X=C?.margin||0,ee=C?.freeMargin??ce-X,se=X>0?ce/X*100:0,le=j.reduce((fe,Pe)=>fe+(Pe.livePnL??Pe.profit??0),0),ne=fe=>{const Pe=parseFloat(fe);return Number.isFinite(Pe)?Pe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},he=fe=>{const Pe=parseFloat(fe);return!Pe||isNaN(Pe)?"—":Pe>=1e4?Pe.toFixed(2):Pe>=10?Pe.toFixed(4):Pe.toFixed(5)},de=fe=>{const Pe=parseFloat(fe);return isNaN(Pe)?"—":(Pe>=0?"+":"")+Pe.toFixed(2)},we=fe=>{const Pe=parseFloat(fe);return isNaN(Pe)?"—":Pe.toFixed(2)},xe=fe=>{if(!fe)return"—";const Pe=new Date(fe);return isNaN(Pe.getTime())?String(fe):`${Pe.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${Pe.toTimeString().slice(0,8)}`},Ue=Ae.useCallback((fe,Pe)=>{fe.stopPropagation(),t&&t(Pe.id,Pe)},[t]),ye=Ae.useCallback((fe,Pe)=>{fe.stopPropagation(),A&&A(Pe)},[A]),ve={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:$},be={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},Ce=fe=>({padding:"5px 14px",fontSize:"11px",fontWeight:fe?700:500,color:fe?v?"#0ea5e9":"#38bdf8":V,borderBottom:fe?`2px solid ${v?"#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},Se={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:$};return a.jsxs("div",{style:ve,children:[a.jsxs("div",{style:be,children:[a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Balance:"}),a.jsxs("span",{style:{...Ze,color:$},children:["$",ne(te)]})]}),a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Equity:"}),a.jsxs("span",{style:{...Ze,color:ce>=te?F:M},children:["$",ne(ce)]})]}),a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Margin:"}),a.jsxs("span",{style:{...Ze,color:$},children:["$",ne(X)]})]}),a.jsxs("div",{style:Ee,children:[a.jsx("span",{style:Ie,children:"Free Margin:"}),a.jsxs("span",{style:{...Ze,color:ee>=0?$:M},children:["$",ne(ee)]})]}),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:se>=100?F:M},children:X>0?se.toFixed(2)+"%":"—"})]}),j.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:le>=0?F:M,fontWeight:700},children:[le>=0?"+":"",ne(le)]})]})]}),a.jsxs("div",{style:ze,children:[a.jsx("button",{style:Ce(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:Ce(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: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:j.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Se,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):j.map(fe=>{const Pe=fe.livePnL??fe.profit??0,Je=Pe>=0?F:M;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=q,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Se,fontWeight:700,color:$,letterSpacing:"0.02em"},children:fe.symbol}),a.jsx("td",{style:{...Se,color:V,fontSize:"10px"},children:String(fe.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Se,color:V},children:xe(fe.openAt||fe.time)}),a.jsx("td",{style:{...Se,fontWeight:700,color:fe.type==="BUY"?F:M},children:fe.type}),a.jsx("td",{style:{...Se,textAlign:"right"},children:we(fe.volume)}),a.jsx("td",{style:{...Se,textAlign:"right"},children:he(fe.price??fe.openPrice)}),a.jsx("td",{style:{...Se,textAlign:"right",color:fe.stopLoss?M:V},children:fe.stopLoss?he(fe.stopLoss):"—"}),a.jsx("td",{style:{...Se,textAlign:"right",color:fe.takeProfit?F:V},children:fe.takeProfit?he(fe.takeProfit):"—"}),a.jsx("td",{style:{...Se,textAlign:"right",color:V}}),a.jsx("td",{style:{...Se,textAlign:"right",fontWeight:700,color:Je},children:de(Pe)}),a.jsx("td",{style:{...Se,textAlign:"center"},children:a.jsx("button",{onClick:it=>ye(it,fe),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:{...Se,textAlign:"right",fontWeight:700,color:Je},children:a.jsx("button",{onClick:it=>Ue(it,fe),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:it=>it.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:it=>it.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},fe.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: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:b.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Se,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):b.map(fe=>{const Pe=fe.profit??0,Je=Pe>=0?F:M;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:it=>it.currentTarget.style.backgroundColor=q,onMouseLeave:it=>it.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Se,fontWeight:700,color:$,letterSpacing:"0.02em"},children:fe.symbol}),a.jsx("td",{style:{...Se,color:V,fontSize:"10px"},children:String(fe.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Se,color:V},children:xe(fe.openAt)}),a.jsx("td",{style:{...Se,fontWeight:700,color:fe.type==="BUY"?F:M},children:fe.type}),a.jsx("td",{style:{...Se,textAlign:"right"},children:we(fe.volume)}),a.jsx("td",{style:{...Se,textAlign:"right"},children:he(fe.openPrice)}),a.jsx("td",{style:{...Se,color:V},children:xe(fe.closeAt)}),a.jsx("td",{style:{...Se,textAlign:"right"},children:he(fe.closePrice)}),a.jsx("td",{style:{...Se,textAlign:"right",color:fe.stopLoss?M:V},children:fe.stopLoss?he(fe.stopLoss):"—"}),a.jsx("td",{style:{...Se,textAlign:"right",color:fe.takeProfit?F:V},children:fe.takeProfit?he(fe.takeProfit):"—"}),a.jsx("td",{style:{...Se,textAlign:"right",fontWeight:700,color:Je},children:de(Pe)})]},fe.id)})})]})})]})},BT="2.3.2";je.AccountPanel=wT,je.BuySellPanel=Ch,je.Chart=eT,je.ChartTypeSelector=oT,je.CoinSelector=Wd,je.DrawingTools=Xd,je.LeftSidebar=fT,je.MarketExecutionModal=vh,je.MarketWatch=mT,je.PositionsPanel=lT,je.SYMBOL_CONFIG=Na,je.StopLoss=Gd,je.TakeProfit=$d,je.TimeframeSelector=nT,je.ToolCustomizationModal=Fh,je.TopBar=pT,je.TradePanel=aT,je.TradingProvider=cm,je.TradingToolbar=iT,je.VolumeControl=Rd,je.alignToTimeframe=We,je.detectGaps=op,je.getSymbolConfig=Oi,je.is24x7Symbol=sp,je.isCryptoSymbol=np,je.isForexSymbol=rp,je.isWithinTradingSession=ap,je.normalizeCandleTimes=Ka,je.normalizeTime=Y,je.processCandles=Ra,je.processSingleCandle=Ga,je.setSocketBaseUrl=ph,je.timeframeToSeconds=tA,je.useTrading=Lt,je.validateTimeOrdering=lp,je.version=BT,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(Mx,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:Q=>c(Q.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):h.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:e.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change"})]})}),a.jsxs("tbody",{children:[d.length>0&&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?"text-sky-600":"text-sky-400"}`,children:"FOREX"})}),d.map(Q=>a.jsxs("tr",{onClick:()=>A(Q.symbol),className:`cursor-pointer transition-colors ${t===Q.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:[Q.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Sx,{className:"text-2xl text-emerald-500"})}):Q.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Ux,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Nm,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:Q.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${Q.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(Q.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${Q.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(Q.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${Q.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[Q.change>=0?"+":"",Q.change,"%"]})]},Q.symbol)),y.length>0&&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?"text-emerald-600":"text-emerald-400"}`,children:"CRYPTO"})}),y.map(Q=>a.jsxs("tr",{onClick:()=>A(Q.symbol),className:`cursor-pointer transition-colors ${t===Q.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.jsx("td",{className:`px-3 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:Q.symbol}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${Q.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Q.bid.toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${Q.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Q.ask.toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${Q.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[Q.change>=0?"+":"",Q.change,"%"]})]},Q.symbol))]})]})})]})]})},Ix=({accountSummary:i,orders:e,onClose:t,height:A,onNewOrder:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:h,fetchHistoryOrders:d,setIsTradeOpenModal:y,isTradeOpenModal:Q,selectedTradeForModify:b,setSelectedTradeForModify:C}=Lt(),U=i||n,M=e?.length>0?e:s,E=h||[],I=o==="light",R=l?"history":"trade";j.useEffect(()=>{l&&d&&d()},[l,d]);const L="#26A69A",O="#EF5350",Y=I?"#f8fafc":"#12161D",X=I?"#e2e8f0":"#1e293b",Ae=I?"#f1f5f9":"#12161D",oe=I?"#F0F5F9":"#2B3543",W=I?"#f8fafc":"#131c2e",ce=I?"#12161D":"#fff",$=I?"#64748b":"#fff",Be=(M||[]).filter(ue=>ue.status==="OPEN"||!ue.closeAt),Ce=U?.balance||0,ee=U?.equity??Ce,Z=U?.margin||0,re=U?.freeMargin??ee-Z,fe=Z>0?ee/Z*100:0,we=Be.reduce((ue,ae)=>ue+(ae.livePnL??ae.profit??0),0),ve=ue=>{const ae=parseFloat(ue);return Number.isFinite(ae)?ae.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},xe=ue=>{const ae=parseFloat(ue);return!ae||isNaN(ae)?"—":ae>=1e4?ae.toFixed(2):ae>=10?ae.toFixed(4):ae.toFixed(5)},me=ue=>{const ae=parseFloat(ue);return isNaN(ae)?"—":(ae>=0?"+":"")+ae.toFixed(2)},Se=ue=>{const ae=parseFloat(ue);return isNaN(ae)?"—":ae.toFixed(2)},He=ue=>{if(!ue)return"—";const ae=new Date(ue);return isNaN(ae.getTime())?String(ue):`${ae.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${ae.toTimeString().slice(0,8)}`},Ee=j.useCallback((ue,ae)=>{ue.stopPropagation(),t&&t(ae.id,ae)},[t]),_e=j.useCallback(ue=>{b&&b.id===ue.id?(C(null),y(!1)):(C(ue),y(!0),r&&r())},[C,y,b,r]),Qe=j.useCallback((ue,ae)=>{ue.stopPropagation(),_e(ae)},[_e]),Ie={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:Y,borderTop:`1px solid ${X}`,display:"flex",flexDirection:"column",height:A?`${A}px`:"auto",overflow:"hidden",fontSize:"11px",color:ce},Ze={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:oe,borderBottom:`1px solid ${X}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},We={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${X}`,whiteSpace:"nowrap"},Te={color:$,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},it={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ge={display:"flex",borderBottom:`1px solid ${X}`,flexShrink:0,backgroundColor:Ae},Ve=ue=>({padding:"5px 14px",fontSize:"11px",fontWeight:ue?700:500,color:ue?I?"#0ea5e9":"#38bdf8":$,borderBottom:ue?`2px solid ${I?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),De={padding:"4px 8px",textAlign:"left",color:$,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${X}`,whiteSpace:"nowrap",backgroundColor:Ae,position:"sticky",top:0,zIndex:1},Pe={padding:"3px 8px",borderBottom:`1px solid ${X}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:ce};return a.jsxs("div",{style:Ie,children:[a.jsxs("div",{style:Ze,children:[a.jsxs("div",{style:We,children:[a.jsx("span",{style:Te,children:"Balance:"}),a.jsxs("span",{style:{...it,color:ce},children:["$",ve(Ce)]})]}),a.jsxs("div",{style:We,children:[a.jsx("span",{style:Te,children:"Equity:"}),a.jsxs("span",{style:{...it,color:ee>=Ce?L:O},children:["$",ve(ee)]})]}),a.jsxs("div",{style:We,children:[a.jsx("span",{style:Te,children:"Margin:"}),a.jsxs("span",{style:{...it,color:ce},children:["$",ve(Z)]})]}),a.jsxs("div",{style:We,children:[a.jsx("span",{style:Te,children:"Free Margin:"}),a.jsxs("span",{style:{...it,color:re>=0?ce:O},children:["$",ve(re)]})]}),a.jsxs("div",{style:{...We,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Te,children:"Margin Level:"}),a.jsx("span",{style:{...it,color:fe>=100?L:O},children:Z>0?fe.toFixed(2)+"%":"—"})]}),Be.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Te,children:"Float P/L:"}),a.jsxs("span",{style:{...it,color:we>=0?L:O,fontWeight:700},children:[we>=0?"+":"",ve(we)]})]})]}),a.jsxs("div",{style:Ge,children:[a.jsx("button",{style:Ve(R==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:Ve(R==="history"),onClick:()=>c&&c(!0),children:"History"})]}),R==="trade"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:De,children:"Symbol"}),a.jsx("th",{style:De,children:"Ticket"}),a.jsx("th",{style:De,children:"Time"}),a.jsx("th",{style:De,children:"Type"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...De,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...De,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:Be.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Pe,textAlign:"center",padding:"16px",color:$},children:"No open positions"})}):Be.map(ue=>{const ae=ue.livePnL??ue.profit??0,he=ae>=0?L:O,Fe=b&&b.id===ue.id;return a.jsxs("tr",{style:{cursor:"pointer",backgroundColor:Fe?I?"#e0f2fe":"#1e3a5f":"transparent"},onClick:()=>_e(ue),onMouseEnter:Le=>{Fe||(Le.currentTarget.style.backgroundColor=W)},onMouseLeave:Le=>{Fe||(Le.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("td",{style:{...Pe,fontWeight:700,color:ce,letterSpacing:"0.02em"},children:ue.symbol}),a.jsx("td",{style:{...Pe,color:$,fontSize:"10px"},children:String(ue.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Pe,color:$},children:He(ue.openAt||ue.time)}),a.jsx("td",{style:{...Pe,fontWeight:700,color:ue.type==="BUY"?L:O},children:ue.type}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:Se(ue.volume)}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:xe(ue.price??ue.openPrice)}),a.jsx("td",{style:{...Pe,textAlign:"right",color:ue.stopLoss?O:$},children:ue.stopLoss?xe(ue.stopLoss):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",color:ue.takeProfit?L:$},children:ue.takeProfit?xe(ue.takeProfit):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",color:$}}),a.jsx("td",{style:{...Pe,textAlign:"right",fontWeight:700,color:he},children:me(ae)}),a.jsx("td",{style:{...Pe,textAlign:"center"},children:a.jsx("button",{onClick:Le=>Qe(Le,ue),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:$,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:Le=>Le.currentTarget.style.color="#f59e0b",onMouseLeave:Le=>Le.currentTarget.style.color=$,children:"✎"})}),a.jsx("td",{style:{...Pe,textAlign:"right",fontWeight:700,color:he},children:a.jsx("button",{onClick:Le=>Ee(Le,ue),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},ue.id)})})]})}),R==="history"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:De,children:"Symbol"}),a.jsx("th",{style:De,children:"Ticket"}),a.jsx("th",{style:De,children:"Open Time"}),a.jsx("th",{style:De,children:"Type"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:De,children:"Close Time"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:E.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Pe,textAlign:"center",padding:"16px",color:$},children:"No trade history"})}):E.map(ue=>{const ae=ue.profit??0,he=ae>=0?L:O;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Fe=>Fe.currentTarget.style.backgroundColor=W,onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Pe,fontWeight:700,color:ce,letterSpacing:"0.02em"},children:ue.symbol}),a.jsx("td",{style:{...Pe,color:$,fontSize:"10px"},children:String(ue.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Pe,color:$},children:He(ue.openAt)}),a.jsx("td",{style:{...Pe,fontWeight:700,color:ue.type==="BUY"?L:O},children:ue.type}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:Se(ue.volume)}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:xe(ue.openPrice)}),a.jsx("td",{style:{...Pe,color:$},children:He(ue.closeAt)}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:xe(ue.closePrice)}),a.jsx("td",{style:{...Pe,textAlign:"right",color:ue.stopLoss?O:$},children:ue.stopLoss?xe(ue.stopLoss):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",color:ue.takeProfit?L:$},children:ue.takeProfit?xe(ue.takeProfit):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",fontWeight:700,color:he},children:me(ae)})]},ue.id)})})]})})]})},rp={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Px=({onModify:i,onClosePosition:e,priceFormatter:t})=>{const{isTradeOpenModal:A,setIsTradeOpenModal:r,selectedTradeForModify:n,setSelectedTradeForModify:s,symbols:o,theme:l,baseUrl:c,setOrders:h,fetchOrders:d}=Lt(),y=!!(A&&n),Q=n,b=l==="light",[C,U]=j.useState(""),[M,E]=j.useState(""),[I,R]=j.useState(""),[L,O]=j.useState(!1),[Y,X]=j.useState(""),[Ae,oe]=j.useState(0),[W,ce]=j.useState(0),[$,Be]=j.useState("inherit"),[Ce,ee]=j.useState("inherit"),Z=j.useRef(0),re=j.useRef(0),fe=j.useRef(null),we=j.useRef(null),ve=j.useRef(null),xe=j.useRef(null);j.useEffect(()=>{if(!y||!Q){xe.current=null;return}const Re=Q.id;xe.current!==Re&&(xe.current=Re,U(Q.stopLoss!=null?String(Q.stopLoss):""),E(Q.takeProfit!=null?String(Q.takeProfit):""),R(Q.comment||""),X(""),fe.current=Q.stopLoss??null,we.current=Q.takeProfit??null)},[y,Q?.id]),j.useEffect(()=>{if(!y||!Q?.symbol)return;const Re=o.find(rt=>rt.symbol===Q.symbol);if(Re){const rt=parseFloat(Re.bid)||0,ke=parseFloat(Re.ask)||0;rt>0&&(oe(rt),Z.current=rt),ke>0&&(ce(ke),re.current=ke)}const Ne=vn.getSocket(),ct=rt=>{if(!rt?.symbol||rt.symbol.toUpperCase()!==Q.symbol.toUpperCase())return;const ke=parseFloat(rt.bid)||0,mt=parseFloat(rt.ask)||0;ke>0&&(Be(ke>Z.current?"text-green-400":ke<Z.current?"text-red-400":""),setTimeout(()=>Be(""),500),oe(ke),Z.current=ke),mt>0&&(ee(mt>re.current?"text-green-400":mt<re.current?"text-red-400":""),setTimeout(()=>ee(""),500),ce(mt),re.current=mt)};return Ne.on("priceUpdate",ct),()=>Ne.off("priceUpdate",ct)},[y,Q?.symbol,o]),j.useEffect(()=>{if(!(!y||!s))return clearTimeout(ve.current),ve.current=setTimeout(()=>{const Re=C!==""?parseFloat(C):null,Ne=M!==""?parseFloat(M):null;fe.current=Re,we.current=Ne,s(ct=>!ct||ct.stopLoss===Re&&ct.takeProfit===Ne?ct:{...ct,stopLoss:Re,takeProfit:Ne})},150),()=>clearTimeout(ve.current)},[C,M,y,s]),j.useEffect(()=>{if(!y||!Q)return;const Re=Q.stopLoss??null,Ne=Q.takeProfit??null,ct=(rt,ke)=>rt===ke||rt!=null&&ke!=null&&Math.abs(rt-ke)<1e-6;ct(Re,fe.current)||(fe.current=Re,U(Re!=null?String(Re):"")),ct(Ne,we.current)||(we.current=Ne,E(Ne!=null?String(Ne):""))},[Q?.stopLoss,Q?.takeProfit,y]);const me=j.useCallback(Re=>{if(t)return t(Re,Q?.symbol);const Ne=parseFloat(Re);return!Ne||isNaN(Ne)?"—":Ne>=1e3?Ne.toFixed(3):Ne>=10?Ne.toFixed(4):Ne.toFixed(5)},[t,Q?.symbol]),Se=String(Q?.symbol||"").toUpperCase().includes("JPY"),He=Se?3:5,Ee=Se?.01:1e-4,_e=Q?.type==="BUY",Qe=_e?Ae:W,Ie=parseFloat(Q?.price||Q?.openPrice||0),Ze=parseFloat(Q?.volume||0),We=String(Q?.symbol||"").toUpperCase(),Te=We.includes("XAU")?100:We.includes("XAG")?5e3:We.endsWith("USDT")||We.includes("BTC")||We.includes("ETH")?1:1e5,Ge=(_e?Qe-Ie:Ie-Qe)*Ze*Te,Ve=isNaN(Ge)?"0.00":Ge.toFixed(2),De=Ge>=0,Pe=(Ze*Te).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),ue=We.slice(3)||"",ae=Re=>{const Ne=parseFloat(C),ct=Number.isFinite(Ne)&&Ne>0?Ne:_e?Qe-Ee*50:Qe+Ee*50;U((ct+Re*Ee).toFixed(He)),X("")},he=Re=>{const Ne=parseFloat(M),ct=Number.isFinite(Ne)&&Ne>0?Ne:_e?Qe+Ee*50:Qe-Ee*50;E((ct+Re*Ee).toFixed(He)),X("")},Le=We.includes("XAU")?.5:Se?.05:2e-4,Ye=()=>{const Re=C!==""?parseFloat(C):null,Ne=M!==""?parseFloat(M):null;if(Re!==null){if(isNaN(Re)||Re<=0)return"Stop Loss must be a valid positive number";if(_e&&Re>=Ie)return`SL must be below entry price (${me(Ie)}) for BUY`;if(!_e&&Re<=Ie)return`SL must be above entry price (${me(Ie)}) for SELL`;if(Qe>0){if(_e&&Re>=Qe-Le)return`SL ${me(Re)} is too close to current bid ${me(Qe)} — move it at least ${(Le*1e4).toFixed(0)} pips lower`;if(!_e&&Re<=Qe+Le)return`SL ${me(Re)} is too close to current ask ${me(Qe)} — move it at least ${(Le*1e4).toFixed(0)} pips higher`}}if(Ne!==null){if(isNaN(Ne)||Ne<=0)return"Take Profit must be a valid positive number";if(_e&&Ne<=Ie)return`TP must be above entry price (${me(Ie)}) for BUY`;if(!_e&&Ne>=Ie)return`TP must be below entry price (${me(Ie)}) for SELL`;if(Qe>0){if(_e&&Ne<=Qe+Le)return`TP ${me(Ne)} is too close to current bid ${me(Qe)} — move it at least ${(Le*1e4).toFixed(0)} pips higher`;if(!_e&&Ne>=Qe-Le)return`TP ${me(Ne)} is too close to current ask ${me(Qe)} — move it at least ${(Le*1e4).toFixed(0)} pips lower`}}return null},qe=async()=>{if(!Q)return;const Re=Ye();if(Re){X(Re);return}X(""),O(!0);const Ne=C!==""?parseFloat(C):null,ct=M!==""?parseFloat(M):null;console.log("[ModifyTradeModal] Submitting modify:",{tradeId:Q.id,stopLoss:Ne,takeProfit:ct,tradeType:Q.type,entryPrice:Ie,currentClosePrice:Qe});try{if(i)await i(Q.id,{stopLoss:Ne,takeProfit:ct});else{const rt=localStorage.getItem("token"),ke=c||rp?.VITE_BASE_URL||"http://localhost:8000";await ut.patch(`${ke}/trades/${Q.id}/modify`,{stopLoss:Ne,takeProfit:ct},{headers:{Authorization:`Bearer ${rt}`,"Content-Type":"application/json"}}),h&&h(mt=>mt.map(vt=>vt.id===Q.id?{...vt,stopLoss:Ne,takeProfit:ct}:vt)),d&&d()}tA()}catch(rt){const ke=rt?.response?.data?.message||rt?.message||"Modify failed";X(ke),console.error("[ModifyTradeModal] Modify error:",rt)}finally{O(!1)}},Qt=async()=>{if(Q){if(!Qe||Qe<=0){X("Current price not available — cannot close");return}O(!0),console.log("[ModifyTradeModal] Closing position:",{tradeId:Q.id,closePrice:Qe,tradeType:Q.type});try{if(e)await e(Q.id,Qe);else{const Re=localStorage.getItem("token"),Ne=c||rp?.VITE_BASE_URL||"http://localhost:8000";await ut.patch(`${Ne}/trades/${Q.id}`,{closePrice:Qe},{headers:{Authorization:`Bearer ${Re}`,"Content-Type":"application/json"}}),h&&h(ct=>ct.filter(rt=>rt.id!==Q.id)),d&&d()}tA()}catch(Re){X(Re?.response?.data?.message||Re?.message||"Close failed"),console.error("[ModifyTradeModal] Close error:",Re)}finally{O(!1)}}},tA=()=>{s(null),r(!1),xe.current=null,X(""),clearTimeout(ve.current)};if(!y||!Q)return null;const $t=Q.ticket||String(Q.id||"").replace(/-/g,"").slice(0,10),ei=(Q.type||"").toLowerCase(),Je={bg:b?"#ffffff":"#12161d",border:b?"#e2e8f0":"#1e293b",inputBg:b?"#ffffff":"#0f172a",inputBorder:b?"#cbd5e1":"#1e293b",stepperBg:b?"#f1f5f9":"#1e293b",priceBg:b?"#f8fafc":"#1a2332",closeBtnBg:b?"#f1f5f9":"#1e293b",text:b?"#1e293b":"#f1f5f9",label:b?"#475569":"#cbd5e1",muted:b?"#64748b":"#94a3b8"};return a.jsxs("div",{className:"w-full h-full flex flex-col pointer-events-auto overflow-hidden text-sm",style:{background:Je.bg,color:Je.text},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b shrink-0",style:{borderColor:Je.border},children:[a.jsxs("span",{className:"font-mono text-xs font-semibold truncate",style:{color:Je.text},children:["#",$t," ",ei," ",parseFloat(Q.volume||0).toFixed(2)," ",Q.symbol," ",me(Ie)]}),a.jsx("button",{onClick:tA,className:"ml-2 shrink-0 p-1 rounded transition-colors hover:bg-white/10",style:{color:Je.muted},children:a.jsx("svg",{className:"w-3.5 h-3.5",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:"flex-1 overflow-y-auto p-3 space-y-3",children:[Y&&a.jsx("div",{className:"p-2 rounded border text-xs leading-snug",style:{background:"rgba(239,68,68,0.08)",borderColor:"rgba(239,68,68,0.3)",color:"#f87171"},children:Y}),a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 rounded text-xs border",style:{background:Je.priceBg,borderColor:Je.border},children:[a.jsxs("div",{children:[a.jsx("span",{style:{color:Je.muted},children:"SELL "}),a.jsx("span",{className:"font-mono font-bold transition-colors duration-300",style:{color:$?void 0:Je.text},...$?{className:`font-mono font-bold transition-colors duration-300 ${$}`}:{},children:Ae>0?me(Ae):"—"})]}),a.jsx("span",{className:"font-semibold text-xs",style:{color:Je.muted},children:Q.symbol}),a.jsxs("div",{children:[a.jsx("span",{style:{color:Je.muted},children:"BUY "}),a.jsx("span",{className:"font-mono font-bold transition-colors duration-300",style:{color:Ce?void 0:Je.text},...Ce?{className:`font-mono font-bold transition-colors duration-300 ${Ce}`}:{},children:W>0?me(W):"—"})]})]}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{label:"Volume",sub:`${Pe} ${ue}`,val:parseFloat(Q.volume||0).toFixed(2)},{label:"Price",sub:null,val:me(Ie)}].map(({label:Re,sub:Ne,val:ct})=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs font-medium",style:{color:Je.label},children:Re}),Ne&&a.jsx("span",{className:"text-xs font-mono",style:{color:Je.muted},children:Ne})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{className:"absolute left-1 w-7 h-7 flex items-center justify-center rounded text-sm z-10 opacity-40 cursor-default",style:{background:Je.stepperBg,color:Je.text},children:"−"}),a.jsx("input",{type:"text",value:ct,readOnly:!0,className:"w-full px-8 py-1.5 rounded text-xs text-center font-mono border cursor-default focus:outline-none",style:{background:Je.inputBg,borderColor:Je.inputBorder,color:Je.text}}),a.jsx("button",{className:"absolute right-1 w-7 h-7 flex items-center justify-center rounded text-sm z-10 opacity-40 cursor-default",style:{background:Je.stepperBg,color:Je.text},children:"+"})]})]},Re))}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs font-medium",style:{color:Je.label},children:"Stop Loss"}),C!==""&&a.jsx("button",{onClick:()=>{U(""),X("")},className:"hover:text-red-400 transition-colors",style:{color:Je.muted},title:"Clear Stop Loss",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{onClick:()=>ae(-1),className:"absolute left-1 w-7 h-7 flex items-center justify-center rounded text-sm z-10 transition-colors hover:opacity-80",style:{background:Je.stepperBg,color:Je.text},children:"−"}),a.jsx("input",{type:"text",value:C,onChange:Re=>{const Ne=Re.target.value;(Ne===""||/^\d*\.?\d*$/.test(Ne))&&(U(Ne),X(""))},onBlur:Re=>{const Ne=parseFloat(Re.target.value);!isNaN(Ne)&&Ne>0?U(Ne.toFixed(He)):Re.target.value!==""&&Re.target.value!=="."&&U("")},placeholder:"—",className:"w-full px-8 py-1.5 rounded text-xs text-center font-mono border focus:outline-none transition-colors",style:C!==""?{background:"rgba(239,68,68,0.05)",borderColor:"rgba(239,68,68,0.5)",color:"#f87171"}:{background:Je.inputBg,borderColor:Je.inputBorder,color:Je.text}}),a.jsx("button",{onClick:()=>ae(1),className:"absolute right-1 w-7 h-7 flex items-center justify-center rounded text-sm z-10 transition-colors hover:opacity-80",style:{background:Je.stepperBg,color:Je.text},children:"+"})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs font-medium",style:{color:Je.label},children:"Take Profit"}),M!==""&&a.jsx("button",{onClick:()=>{E(""),X("")},className:"hover:text-red-400 transition-colors",style:{color:Je.muted},title:"Clear Take Profit",children:a.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{onClick:()=>he(-1),className:"absolute left-1 w-7 h-7 flex items-center justify-center rounded text-sm z-10 transition-colors hover:opacity-80",style:{background:Je.stepperBg,color:Je.text},children:"−"}),a.jsx("input",{type:"text",value:M,onChange:Re=>{const Ne=Re.target.value;(Ne===""||/^\d*\.?\d*$/.test(Ne))&&(E(Ne),X(""))},onBlur:Re=>{const Ne=parseFloat(Re.target.value);!isNaN(Ne)&&Ne>0?E(Ne.toFixed(He)):Re.target.value!==""&&Re.target.value!=="."&&E("")},placeholder:"—",className:"w-full px-8 py-1.5 rounded text-xs text-center font-mono border focus:outline-none transition-colors",style:M!==""?{background:"rgba(34,197,94,0.05)",borderColor:"rgba(34,197,94,0.5)",color:"#4ade80"}:{background:Je.inputBg,borderColor:Je.inputBorder,color:Je.text}}),a.jsx("button",{onClick:()=>he(1),className:"absolute right-1 w-7 h-7 flex items-center justify-center rounded text-sm z-10 transition-colors hover:opacity-80",style:{background:Je.stepperBg,color:Je.text},children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium mb-1",style:{color:Je.label},children:"Comment"}),a.jsx("textarea",{value:I,onChange:Re=>R(Re.target.value),rows:2,className:"w-full px-2 py-1.5 rounded text-xs font-mono border resize-none focus:outline-none",style:{background:Je.inputBg,borderColor:Je.inputBorder,color:Je.text}})]}),a.jsx("button",{onClick:qe,disabled:L,className:"w-full py-2.5 bg-blue-600 hover:bg-blue-700 active:bg-blue-800 disabled:opacity-50 disabled:cursor-not-allowed text-white font-semibold rounded text-sm transition-colors",children:L?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Modifying..."]}):"Modify"}),a.jsxs("button",{onClick:Qt,disabled:L||!Qe,className:"w-full py-2 rounded text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:{background:Je.closeBtnBg,color:Je.muted},children:[a.jsxs("span",{className:"block",children:["Close #",$t," ",ei," ",parseFloat(Q.volume||0).toFixed(2)," ",Q.symbol]}),a.jsxs("span",{className:"block font-mono mt-0.5",children:[me(Ie)," at ",Qe>0?me(Qe):"—"," with"," ",a.jsxs("span",{className:De?"text-green-400":"text-red-400",children:[De?"Profit":"Loss"," ",De?"+":"",Ve]})]})]})]})]})},Dx="2.3.2";et.AccountPanel=Ix,et.BuySellPanel=Sh,et.Chart=gx,et.ChartTypeSelector=xx,et.CoinSelector=qd,et.DrawingTools=Ap,et.LeftSidebar=Lx,et.MarketExecutionModal=Eh,et.MarketWatch=Hx,et.ModifyTradeModal=Px,et.PositionsPanel=bx,et.SYMBOL_CONFIG=Xa,et.StopLoss=ep,et.TakeProfit=tp,et.TimeframeSelector=Cx,et.ToolCustomizationModal=Ph,et.TopBar=Ex,et.TradePanel=Tx,et.TradingProvider=Qm,et.TradingToolbar=Bx,et.VolumeControl=jd,et.alignToTimeframe=ze,et.detectGaps=vp,et.getSymbolConfig=zi,et.is24x7Symbol=Cp,et.isCryptoSymbol=yp,et.isForexSymbol=Bp,et.isWithinTradingSession=xp,et.normalizeCandleTimes=Ja,et.normalizeTime=ie,et.processCandles=el,et.processSingleCandle=tl,et.setSocketBaseUrl=xh,et.timeframeToSeconds=iA,et.useTrading=Lt,et.validateTimeOrdering=Tp,et.version=Dx,Object.defineProperty(et,Symbol.toStringTag,{value:"Module"})}));