ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
3 lines • 126 kB
JavaScript
var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,m=(s,e,t,i)=>{for(var n=i>1?void 0:i?Ji(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Zi(e,t,n),n};import{BaseProperties as Be,FONT_SIZE as Ki,Property as E,ProxyPropertyOnWrite as K,callWithContext as Qi,createId as ts,isArray as es,isSegmentTruncated as is,isTextTruncated as ss,toPlainText as ze,toTextString as $e,wrapText as ns,wrapTextSegments as rs}from"ag-charts-core";import{DeclaredSceneChangeDetection as We,Logger as Zt,createId as as,createSvgElement as qe,objectsEqual as os}from"ag-charts-core";import{boxContains as hs,boxesEqual as cs,clamp as Ge,nearestSquared as ls}from"ag-charts-core";var Xe=Symbol("interpolate"),ds=(()=>{var s=class vt{constructor(t,i,n,r){this.x=t,this.y=i,this.width=n,this.height=r}static fromObject({x:t,y:i,width:n,height:r}){return new vt(t,i,n,r)}static merge(t){let i=1/0,n=1/0,r=-1/0,a=-1/0;for(const o of t)o.x<i&&(i=o.x),o.y<n&&(n=o.y),W(o.x,o.width)>r&&(r=W(o.x,o.width)),W(o.y,o.height)>a&&(a=W(o.y,o.height));return new vt(i,n,r-i,a-n)}static nearestBox(t,i,n){return ls(t,i,n)}toDOMRect(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.y,left:this.x,right:W(this.x,this.width),bottom:W(this.y,this.height),toJSON(){return{}}}}clone(){const{x:t,y:i,width:n,height:r}=this;return new vt(t,i,n,r)}equals(t){return cs(this,t)}containsPoint(t,i){return hs(this,t,i)}intersectsWith(t){return!(this.x+this.width<=t.x||t.x+t.width<=this.x||this.y+this.height<=t.y||t.y+t.height<=this.y)}intersection(t){const i=Math.max(this.x,t.x),n=Math.max(this.y,t.y),r=Math.min(W(this.x,this.width),W(t.x,t.width)),a=Math.min(W(this.y,this.height),W(t.y,t.height));if(!(i>r||n>a))return new vt(i,n,r-i,a-n)}collidesBBox(t){return this.x<W(t.x,t.width)&&W(this.x,this.width)>t.x&&this.y<W(t.y,t.height)&&W(this.y,this.height)>t.y}computeCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)&&Number.isFinite(this.width)&&Number.isFinite(this.height)}distanceSquared(t,i){if(this.containsPoint(t,i))return 0;const n=t-Ge(this.x,t,W(this.x,this.width)),r=i-Ge(this.y,i,W(this.y,this.height));return n*n+r*r}shrink(t,i){if(typeof t=="number")this.applyMargin(t,i);else for(const n of Object.keys(t)){const r=t[n];typeof r=="number"&&this.applyMargin(r,n)}return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(t,i){if(typeof t=="number")this.applyMargin(-t,i);else for(const n of Object.keys(t)){const r=t[n];typeof r=="number"&&this.applyMargin(-r,n)}return this}applyMargin(t,i){switch(i){case"top":this.y+=t;case"bottom":this.height-=t;break;case"left":this.x+=t;case"right":this.width-=t;break;case"vertical":this.y+=t,this.height-=t*2;break;case"horizontal":this.x+=t,this.width-=t*2;break;case void 0:this.x+=t,this.y+=t,this.width-=t*2,this.height-=t*2;break}}translate(t,i){return this.x+=t,this.y+=i,this}[Xe](t,i){return new vt(this.x*(1-i)+t.x*i,this.y*(1-i)+t.y*i,this.width*(1-i)+t.width*i,this.height*(1-i)+t.height*i)}};return s.zero=Object.freeze(new s(0,0,0,0)),s.NaN=Object.freeze(new s(Number.NaN,Number.NaN,Number.NaN,Number.NaN)),s})(),L=ds;function W(s,e){return s===-1/0&&e===1/0?1/0:s+e}var Jt=(s,e)=>Math.sign(s-e);function us(s,e){if(typeof s=="number"&&typeof e=="number")return Jt(s,e);const t=typeof s=="number"?[s]:s,i=typeof e=="number"?[e]:e,n=Math.min(t.length,i.length);for(let r=0;r<n;r+=1){const a=Jt(t[r],i[r]);if(a!==0)return a}return Jt(t.length,i.length)}import{SceneChangeDetection as T}from"ag-charts-core";var fs=5,ps=(()=>{var s=class _e{constructor(t){this.serialNumber=_e._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=as(this),this.name=void 0,this.transitionOut=void 0,this.pointerEvents=0,this._datum=void 0,this._previousDatum=void 0,this.scene=void 0,this._debugDirtyProperties=void 0,this.parentNode=void 0,this.cachedBBox=void 0,this.isContainerNode=!1,this.visible=!0,this.zIndex=0,this.batchLevel=0,this.batchDirty=!1,this.name=t?.name,this.tag=t?.tag??Number.NaN,this.zIndex=t?.zIndex??0,this.scene=t?.scene,(t?.debugDirty??_e._debugEnabled)&&(this._debugDirtyProperties=new Map([["__first__",[]]]))}static toSVG(t,i,n){const r=t?.toSVG();if(r==null||!r.elements.length&&!r.defs?.length)return;const a=qe("svg");if(a.setAttribute("width",String(i)),a.setAttribute("height",String(n)),a.setAttribute("viewBox",`0 0 ${i} ${n}`),a.setAttribute("overflow","visible"),r.defs?.length){const o=qe("defs");o.append(...r.defs),a.append(o)}return a.append(...r.elements),a.outerHTML}static*extractBBoxes(t,i){for(const n of t)if(!i||n.visible&&!n.transitionOut){const r=n.getBBox();r&&(yield r)}}get datum(){return this._datum}set datum(t){this._datum!==t&&(this._previousDatum=this._datum,this._datum=t)}get previousDatum(){return this._previousDatum}get unsafeNonNullDatum(){return this.datum}get unsafeDatum(){return this.datum}set unsafeDatum(t){this.datum=t}get unsafePreviousDatum(){return this.previousDatum}get layerManager(){return this.scene?.layersManager}get imageLoader(){return this.scene?.imageLoader}closestDatum(){for(const{datum:t}of this.traverseUp(!0))if(t!=null)return t}unsafeClosestDatum(){return this.closestDatum()}preRender(t,i=1){if(this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i,this.batchLevel>0||this.batchDirty)throw new Error("AG Charts - illegal rendering state; batched update in progress");return this.childNodeCounts}isolatedRender(t){const i=t.currentFont;t.ctx.save();try{this.render(t)}catch(n){const r=n.errorCount??1;if(r>=fs)throw n.errorCount=r,n;Zt.warnOnce("Error during rendering",n,n.stack)}finally{t.ctx.restore(),t.currentFont=i}}render(t){const{stats:i}=t;if(this.debugDirtyProperties(),t.debugNodeSearch){const n=this.name??this.id;t.debugNodeSearch.some(r=>typeof r=="string"?r===n:r.test(n))&&(t.debugNodes[this.name??this.id]=this)}i&&(i.nodesRendered++,i.opsPerformed+=this.childNodeCounts.thisComplexity)}setScene(t){this.scene=t}*traverseUp(t){t&&(yield this);let i=this.parentNode;for(;i;)yield i,i=i.parentNode}isRoot(){return!this.parentNode}removeChild(t){throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`)}remove(){this.parentNode?.removeChild(this)}destroy(){this.parentNode&&this.remove()}batchedUpdate(t){this.batchLevel++;try{t()}finally{this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}}setProperties(t){this.batchLevel++;try{const i=this,n=t,r=Object.keys(n);for(let a=0,o=r.length;a<o;a++){const h=r[a];i[h]=n[h]}}finally{this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}return this}setPropertiesWithKeys(t,i){this.batchLevel++;try{const n=this,r=t;for(let a=0,o=i.length;a<o;a++){const h=i[a];n[h]=r[h]}}finally{this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}return this}containsPoint(t,i){return!1}distanceSquared(t,i){return 1/0}pickNode(t,i){if(!(!this.visible||this.pointerEvents===1)&&this.containsPoint(t,i))return this}pickNodes(t,i,n=[]){return!this.visible||this.pointerEvents===1||this.containsPoint(t,i)&&n.push(this),n}getBBox(){return this.cachedBBox??(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}onChangeDetection(t){this.markDirty(t)}markDirtyChildrenOrder(){this.cachedBBox=void 0}markDirty(t){if(this.batchLevel>0){this.batchDirty=!0;return}t!=null&&this._debugDirtyProperties&&this.markDebugProperties(t),this.cachedBBox=void 0,this.parentNode?.markDirty()}markDebugProperties(t){const i=this._debugDirtyProperties?.get(t)??[],n=new Error("Stack trace for property change tracking").stack?.split(`
`).filter(r=>r!=="Error"&&!r.includes(".markDebugProperties")&&!r.includes(".markDirty")&&!r.includes("Object.assign ")&&!r.includes(`${this.constructor.name}.`))??"unknown";i.push(n[0].replace(" at ","").trim()),this._debugDirtyProperties?.set(t,i)}debugDirtyProperties(){if(this._debugDirtyProperties!=null){if(!this._debugDirtyProperties.has("__first__"))for(const[t,i]of this._debugDirtyProperties.entries())i.length>1&&Zt.logGroup(`Property changed multiple times before render: ${this.constructor.name}.${t} (${i.length}x)`,()=>{for(const n of i)Zt.log(n)});this._debugDirtyProperties.clear()}}static handleNodeZIndexChange(t){t.onZIndexChange()}onZIndexChange(){this.parentNode?.markDirtyChildrenOrder()}resolveFont(){}toSVG(){}};return s.className="AbstractNode",s._nextSerialNumber=0,s._debugEnabled=!1,m([We()],s.prototype,"visible",2),m([We({equals:os,changeCb:s.handleNodeZIndexChange})],s.prototype,"zIndex",2),s})(),ut=ps;import{BLOCK_IMAGE_SPACING as Ue,Debug as gs,LineSplitter as Kt,Logger as ms,SceneRefChangeDetection as ys,blockStripHeight as bs,blockStripWidth as xs,cachedTextMeasurer as Qt,createSvgElement as Ye,imageBoxAroundBaseline as vs,isArray as rt,measureTextSegments as je,resolvePadding as Ms,toCanvasTextBaseline as kt,toFontString as Ss,toPlainText as Ps,toTextString as ft}from"ag-charts-core";import{clamp as Cs,toIterable as _s}from"ag-charts-core";import{getOffscreenCanvas as He}from"ag-charts-core";var Ve=1e-8;function at(s,e){const t=e*s,i=t-Math.floor(t),n=Math.abs(i-.5)<Ve?t+Ve:t;return Math.round(n)}function Ze(s,e){return at(s,e)/s}function q(s,e,t){const i=Ze(s,e);return t==null?i:t===0?0:t<1?ws(s,t):Ze(s,t+e)-i}function Je(s,e){return Math.floor(e*s)/s}function ws(s,e){return Math.ceil(e*s)/s}import{Debug as Ts}from"ag-charts-core";function Ke({context:s,pixelRatio:e,width:t,height:i}){s.save();try{s.resetTransform(),s.clearRect(0,0,Math.ceil(t*e),Math.ceil(i*e))}finally{s.restore()}}function Qe(s){if(Ts.check("canvas")){const e=s.save.bind(s),t=s.restore.bind(s);let i=0;Object.assign(s,{save(){e(),i++},restore(){if(i===0)throw new Error("AG Charts - Unable to restore() past depth 0");t(),i--},verifyDepthZero(){if(i!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${i}`)}})}}function ti(s,e,t){return[at(t,s),at(t,e)]}var te;function ks(){const s=He();return te??(te=new s(1,1)),te}var ee=class{constructor(s){const{width:e,height:t,pixelRatio:i,willReadFrequently:n=!1}=s;this.width=e,this.height=t,this.pixelRatio=i;const[r,a]=ti(e,t,i),o=He();this.canvas=new o(r,a),this.context=this.canvas.getContext("2d",{willReadFrequently:n}),this.context.setTransform(i,0,0,i,0,0),Qe(this.context)}drawImage(s,e=0,t=0){return s.drawImage(this.canvas,e,t)}transferToImageBitmap(){return this.canvas.width<1||this.canvas.height<1?ks().transferToImageBitmap():this.canvas.transferToImageBitmap()}resize(s,e,t){if(!(s>0&&e>0))return;const{canvas:i,context:n}=this;if(s!==this.width||e!==this.height||t!==this.pixelRatio){const[r,a]=ti(s,e,t);i.width=r,i.height=a}n.setTransform(t,0,0,t,0,0),this.width=s,this.height=e,this.pixelRatio=t}clear(){Ke(this)}destroy(){this.canvas.width=0,this.canvas.height=0,this.context.clearRect(0,0,0,0),this.canvas=null,this.context=null,Object.freeze(this)}};import{DeclaredSceneChangeDetection as Z,DeclaredSceneObjectChangeDetection as ie,SceneArrayChangeDetection as Ds,SceneObjectChangeDetection as ei,TRIPLE_EQ as Ns,boxesEqual as As,clamp as Rs,generateUUID as se,isGradientFill as ne,isImageFill as ii,isPatternFill as si,isString as Is,objectsEqual as Dt}from"ag-charts-core";import{createSvgElement as Ls,normalizeAngle360FromDegrees as Os}from"ag-charts-core";import{createSvgElement as Fs}from"ag-charts-core";import{Color as re,Logger as ae,clamp as Es,toNumber as Bs}from"ag-charts-core";var oe=class{invertWithPercentage(s){return this.invert(s,!0)}snapshotDomain(){return this.domain}restoreDomain(s){this.domain=s}get domainMin(){return this.getDomainMinMax()[0]}get domainMax(){return this.getDomainMinMax()[1]}ticks(s,e,t){}niceDomain(s,e=this.domain){return e}get bandwidth(){}get step(){}get inset(){}},St=(s,e)=>{const t=Symbol(String(e));s[t]=void 0,Object.defineProperty(s,e,{get(){return this[t]},set(i){this[t]!==i&&(this[t]=i,this.invalid=!0)},enumerable:!0,configurable:!1})};import{clamp as ni,readIntegratedWrappedValue as ri}from"ag-charts-core";function zs(s,e,t){if(t==null||t[0]===0&&t[1]===1)return;const i=ni(0,Math.floor(t[0]*s.length),s.length),n=ni(0,Math.ceil(t[1]*s.length),s.length),r=e?s.length-n:i,a=e?s.length-i:n;return[r,a]}function $s(s,e,t){const i=zs(s,e,t);if(i==null)return{ticks:s,count:s.length,firstTickIndex:0};const[n,r]=i;return{ticks:s.slice(n,r),count:s.length,firstTickIndex:n}}function he(s){const e=ri(s.at(0)),t=ri(s.at(-1));return e!=null&&t!=null?[e,t]:[void 0,void 0]}var ai=s=>{const e=re.fromString(s),[t,i,n]=re.RGBtoOKLCH(e.r,e.g,e.b);return{l:t,c:i,h:n,a:e.a}},ce=1e-6,oi=s=>s.c<ce||s.l<ce||s.l>1-ce,Ws=(s,e,t)=>{t=Es(0,t,1);let i;if(oi(s))i=e.h;else if(oi(e))i=s.h;else{const o=s.h;let h=e.h;const c=e.h-s.h;c>180?h-=360:c<-180&&(h+=360),i=o*(1-t)+h*t}const n=s.c*(1-t)+e.c*t,r=s.l*(1-t)+e.l*t,a=s.a*(1-t)+e.a*t;return re.fromOKLCH(r,n,i,a)},hi=(()=>{var s=class extends oe{constructor(){super(...arguments),this.type="color",this.defaultTickCount=0,this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.mode="continuous",this.parsedRange=this.range.map(ai)}update(){const{domain:e,range:t}=this;e.length<2&&(ae.warnOnce("`colorDomain` should have at least 2 values."),e.length===0?e.push(0,1):e.length===1&&e.push(e[0]+1));for(let n=1;n<e.length;n++){const r=e[n-1],a=e[n];if(r>a){ae.warnOnce("`colorDomain` values should be supplied in ascending order."),e.sort((o,h)=>o-h);break}}const i=this.mode==="discrete"?e.length-1:e.length;if(t.length<i)for(let n=t.length;n<i;n++)t.push(t.length>0?t[0]:"black");this.parsedRange=this.range.map(ai)}normalizeDomains(...e){return{domain:e.map(t=>t.domain).flat(),animatable:!0}}toDomain(){}convert(e){this.refresh();const t=Bs(e),{domain:i,range:n,parsedRange:r}=this,a=i[0],o=i.at(-1),h=n[0],c=n.at(-1);if(t<=a)return h;if(t>=o)return c;let l,d;if(i.length===2){const p=(t-a)/(o-a),g=1/(n.length-1);l=n.length<=2?0:Math.min(Math.floor(p*(n.length-1)),n.length-2),d=(p-l*g)/g}else{for(l=0;l<i.length-2&&!(t<i[l+1]);l++);const p=i[l],g=i[l+1];d=(t-p)/(g-p)}if(this.mode==="discrete")return n[l];const u=r[l],f=r[l+1];return Ws(u,f,d).toRgbaString()}invert(){}getDomainMinMax(){return he(this.domain)}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&ae.warnOnce("Expected update to not invalidate scale"))}};return m([St],s.prototype,"domain",2),m([St],s.prototype,"range",2),m([St],s.prototype,"mode",2),s})(),le=class{constructor(s,e=[],t){this.colorSpace=s,this.stops=e,this.bbox=t,this._cache=void 0}createGradient(s,e,t){const i=this.bbox??e;if(!i.isFinite())return;if(this._cache?.ctx===s&&this._cache.bbox.equals(i))return this._cache.gradient;const{stops:n,colorSpace:r}=this;if(n.length===0)return;if(n.length===1)return n[0].color;let a=this.createCanvasGradient(s,i,t);if(a==null)return;const o=r==="oklch",h=.05;let c=n[0];a.addColorStop(c.stop,c.color);for(let l=1;l<n.length;l+=1){const d=n[l];if(o){const u=new hi;u.domain=[c.stop,d.stop],u.range=[c.color,d.color];for(let f=c.stop+h;f<d.stop;f+=h)a.addColorStop(f,u.convert(f)??"transparent")}a.addColorStop(d.stop,d.color),c=d}return"createPattern"in a&&(a=a.createPattern()),this._cache={ctx:s,bbox:i,gradient:a},a}toSvg(s){const e=this.bbox??s,t=this.createSvgGradient(e);for(const{stop:i,color:n}of this.stops){const r=Fs("stop");r.setAttribute("offset",`${i}`),r.setAttribute("stop-color",`${n}`),t.appendChild(r)}return t}},qs=class extends le{constructor(s,e,t=0,i){super(s,e,i),this.angle=t}createCanvasGradient(s,e,t){const{angle:n}=this,r=Os(n+-90),a=t?.centerX??e.x+e.width*.5,o=t?.centerY??e.y+e.height*.5;return s.createConicGradient(r,a,o)}createSvgGradient(s){return Ls("linearGradient")}};import{createSvgElement as Gs,normalizeAngle360FromDegrees as Xs}from"ag-charts-core";var Us=class extends le{constructor(s,e,t=0,i){super(s,e,i),this.angle=t}getGradientPoints(s){const{angle:t}=this,i=Xs(t+90),n=Math.cos(i),r=Math.sin(i),a=s.width,o=s.height,h=s.x+a*.5,c=s.y+o*.5,l=Math.hypot(o,a)/2,d=Math.atan2(o,a);let u;i<Math.PI/2?u=i:i<Math.PI?u=Math.PI-i:i<1.5*Math.PI?u=i-Math.PI:u=2*Math.PI-i;const f=l*Math.abs(Math.cos(u-d));return{x0:h+n*f,y0:c+r*f,x1:h-n*f,y1:c-r*f}}createCanvasGradient(s,e){const{x0:t,y0:i,x1:n,y1:r}=this.getGradientPoints(e);if(!(Number.isNaN(t)||Number.isNaN(i)||Number.isNaN(n)||Number.isNaN(r)))return s.createLinearGradient(t,i,n,r)}createSvgGradient(s){const{x0:e,y0:t,x1:i,y1:n}=this.getGradientPoints(s),r=Gs("linearGradient");return r.setAttribute("x1",String(e)),r.setAttribute("y1",String(t)),r.setAttribute("x2",String(i)),r.setAttribute("y2",String(n)),r.setAttribute("gradientUnits","userSpaceOnUse"),r}};import{createSvgElement as Ys}from"ag-charts-core";var js=class extends le{constructor(s,e,t){super(s,e,t)}createCanvasGradient(s,e,t){const i=t?.centerX??e.x+e.width*.5,n=t?.centerY??e.y+e.height*.5,r=t?.innerRadius??0,a=t?.outerRadius??Math.hypot(e.width*.5,e.height*.5)/Math.SQRT2;return s.createRadialGradient(i,n,r,i,n,a)}createSvgGradient(s){const e=s.x+s.width*.5,t=s.y+s.height*.5,i=Ys("radialGradient");return i.setAttribute("cx",String(e)),i.setAttribute("cy",String(t)),i.setAttribute("r",String(Math.hypot(s.width*.5,s.height*.5)/Math.SQRT2)),i.setAttribute("gradientUnits","userSpaceOnUse"),i}};import{BaseProperties as ci,PropertiesArray as Hs,Property as ot,discreteColorStops as li,resolveStopPositions as Vs}from"ag-charts-core";var Zs=(()=>{var s=class extends ci{constructor(){super(...arguments),this.color="black"}};return m([ot],s.prototype,"stop",2),m([ot],s.prototype,"color",2),m([ot],s.prototype,"name",2),s})(),ga=(()=>{var s=class extends ci{constructor(){super(...arguments),this.fills=new Hs(Zs),this.mode="continuous"}};return m([ot],s.prototype,"fills",2),m([ot],s.prototype,"domain",2),m([ot],s.prototype,"mode",2),m([ot],s.prototype,"missingDataFill",2),s})();function Js(s,e){const t=e==="discrete"?1:0,i=s.map((n,r,{length:a})=>({stop:(r+t)/(a-1+t),color:n}));return e==="discrete"?li(i):i}function Ks(s,e,t,i="continuous"){const n=s.map(u=>typeof u=="string"?{color:u}:u);if(n.length===0)return Js(e,i);const r=Math.min(...t),a=Math.max(...t),h=Vs(n,r,a,i==="discrete");let c=n.find(u=>u.color!=null)?.color,l;const d=n.map((u,f)=>{let p=u?.color;const g=Math.max(0,Math.min(1,(h[f]-r)/(a-r)));return p!=null?c=p:c==null?(l==null&&(l=new hi,l.domain=[0,1],l.range=e),p=l.convert(g)):p=c,{stop:g,color:p}});return i==="discrete"?li(d):d}import{Logger as Qs,createSvgElement as de,getDOMMatrix as tn,normalizeAngle360FromDegrees as en}from"ag-charts-core";var sn=class{constructor(s,e){this.imageLoader=s,this._cache=void 0,this.url=e.url,this.backgroundFill=e.backgroundFill??"black",this.backgroundFillOpacity=e.backgroundFillOpacity??1,this.repeat=e.repeat??"no-repeat",this.width=e.width,this.height=e.height,this.fit=e.fit??"stretch",this.rotation=e.rotation??0}createCanvasImage(s,e,t,i){if(!e)return null;const[n,r]=this.getSize(e.width,e.height,t,i);return n<1||r<1?(Qs.warnOnce("Image fill is too small to render, ignoring."),null):s.createPattern(e,this.repeat)}getSize(s,e,t,i){const{fit:n}=this;let r=s,a=e,o=1;const h=t/i,c=s/e;return n==="stretch"||s===0||e===0?(r=t,a=i):n==="contain"?o=c>h?t/s:i/e:n==="cover"&&(o=c>h?i/e:t/s),[Math.max(1,r*o),Math.max(1,a*o)]}setImageTransform(s,e){if(typeof s=="string")return;const{url:t,rotation:i,width:n,height:r}=this,a=this.imageLoader?.loadImage(t);if(!a)return;const o=en(i),h=Math.cos(o),c=Math.sin(o),[l,d]=this.getSize(a.width,a.height,n??e.width,r??e.height),u=l/a.width,f=d/a.height,p=e.x+e.width/2,g=e.y+e.height/2,y=h*l-c*d,b=c*l+h*d,x=y/2,v=b/2,S=tn();s?.setTransform(new S([h*u,c*f,-c*u,h*f,p-x,g-v]))}createPattern(s,e,t,i){const n=this.width??e,r=this.height??t,a=this._cache;if(a?.ctx===s&&a.width===n&&a.height===r)return a.pattern;const o=this.imageLoader?.loadImage(this.url,i),h=this.createCanvasImage(s,o,n,r);if(h!=null)return this._cache={ctx:s,pattern:h,width:n,height:r},h}toSvg(s,e){const{url:t,rotation:i,backgroundFill:n,backgroundFillOpacity:r}=this,{x:a,y:o,width:h,height:c}=s,l=de("pattern");l.setAttribute("viewBox",`0 0 ${h} ${c}`),l.setAttribute("x",String(a)),l.setAttribute("y",String(o)),l.setAttribute("width",String(h)),l.setAttribute("height",String(c)),l.setAttribute("patternUnits","userSpaceOnUse");const d=de("rect");d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width",String(h)),d.setAttribute("height",String(c)),d.setAttribute("fill",n),d.setAttribute("fill-opacity",String(r)),l.appendChild(d);const u=de("image");return u.setAttribute("href",t),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(h)),u.setAttribute("height",String(c)),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("transform",`scale(${1/e}) rotate(${i}, ${h/2}, ${c/2})`),l.appendChild(u),l}};import{Logger as nn,createSvgElement as ue,getDOMMatrix as rn,normalizeAngle360FromDegrees as an}from"ag-charts-core";import{bezier2DDistance as on,bezier2DExtrema as hn,evaluateBezier as di,getPath2D as ui,lineDistanceSquared as fi,normalizeAngle360 as pi}from"ag-charts-core";import{Logger as gi}from"ag-charts-core";var cn=/^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i,N=/^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i,ln=/[\t\n\f\r ]*,?[\t\n\f\r ]*/,mi=/^[01]/,dn={z:[],h:[N],v:[N],m:[N,N],l:[N,N],t:[N,N],s:[N,N,N,N],q:[N,N,N,N],c:[N,N,N,N,N,N],a:[N,N,N,mi,mi,N,N]};function un(s){if(!s)return;const e=[];let t=0,i;for(;t<s.length;){const n=cn.exec(s.slice(t));let r;if(n==null){if(!i){gi.warnOnce(`Invalid SVG path, error at index ${t}: Missing command.`);return}r=i}else r=n[1],t+=n[0].length;const a=fn(r,s,t);if(!a)return;t=a[0],i=r,e.push(a[1])}return e}function fn(s,e,t){const i=dn[s.toLocaleLowerCase()],n={command:s,params:[]};for(const r of i){const a=e.slice(t),o=r.exec(a);if(o!=null){n.params.push(Number.parseFloat(o[0])),t+=o[0].length;const h=ln.exec(a.slice(o[0].length));h!=null&&(t+=h[0].length)}else{if(n.params.length===1)return[t,n];gi.warnOnce(`Invalid SVG path, error at index ${t}: No path segment parameters for command [${s}]`);return}}return[t,n]}function pn(s,e){const t=-e/s;return s!==0&&t>=0&&t<=1?[t]:[]}function gn(s,e,t,i=1e-6){if(Math.abs(s)<i)return pn(e,t);const n=e*e-4*s*t,r=[];if(Math.abs(n)<i){const a=-e/(2*s);a>=0&&a<=1&&r.push(a)}else if(n>0){const a=Math.sqrt(n),o=(-e-a)/(2*s),h=(-e+a)/(2*s);o>=0&&o<=1&&r.push(o),h>=0&&h<=1&&r.push(h)}return r}function mn(s,e,t,i,n=1e-6){if(Math.abs(s)<n)return gn(e,t,i,n);const r=e/s,a=t/s,o=i/s,h=(3*a-r*r)/9,c=(9*r*a-27*o-2*r*r*r)/54,l=h*h*h+c*c,d=1/3,u=[];if(l>=0){const f=Math.sqrt(l),p=Math.sign(c+f)*Math.pow(Math.abs(c+f),d),g=Math.sign(c-f)*Math.pow(Math.abs(c-f),d),y=Math.abs(Math.sqrt(3)*(p-g)/2),b=-d*r+(p+g);if(b>=0&&b<=1&&u.push(b),Math.abs(y)<n){const x=-d*r-(p+g)/2;x>=0&&x<=1&&u.push(x)}}else{const f=Math.acos(c/Math.sqrt(-h*h*h)),p=d*r,g=2*Math.sqrt(-h),y=g*Math.cos(d*f)-p,b=g*Math.cos(d*(f+2*Math.PI))-p,x=g*Math.cos(d*(f+4*Math.PI))-p;y>=0&&y<=1&&u.push(y),b>=0&&b<=1&&u.push(b),x>=0&&x<=1&&u.push(x)}return u}function fe(s,e,t,i,n,r,a,o){const h=(t-s)*(o-r)-(i-e)*(a-n);if(h===0)return 0;const c=((a-n)*(e-r)-(s-n)*(o-r))/h,l=((t-s)*(e-r)-(i-e)*(s-n))/h;return c>=0&&c<=1&&l>=0&&l<=1?1:0}function yn(s,e,t,i,n,r,a,o,h,c,l,d){let u=0;const f=c-d,p=l-h,g=h*(d-c)-c*(l-h),y=yi(s,t,n,a),b=yi(e,i,r,o),x=f*y[0]+p*b[0],v=f*y[1]+p*b[1],S=f*y[2]+p*b[2],_=f*y[3]+p*b[3]+g,P=mn(x,v,S,_);for(const M of P){const C=M*M,w=M*C,A=y[0]*w+y[1]*C+y[2]*M+y[3],I=b[0]*w+b[1]*C+b[2]*M+b[3];let D;h===l?D=(I-c)/(d-c):D=(A-h)/(l-h),D>=0&&D<=1&&u++}return u}function yi(s,e,t,i){return[-s+3*e-3*t+i,3*s-6*e+3*t,-3*s+3*e,s]}var pt=class{constructor(){this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],this.commandsLength=0,this.paramsLength=0,this.cx=Number.NaN,this.cy=Number.NaN,this.sx=Number.NaN,this.sy=Number.NaN,this.openedPath=!1,this.closedPath=!1;const s=ui();this.path2d=new s}isEmpty(){return this.commandsLength===0}isDirty(){return this.closedPath!==this.previousClosedPath||this.previousCommands.length!==this.commandsLength||this.previousParams.length!==this.paramsLength||this.previousCommands.toString()!==this.commands.slice(0,this.commandsLength).toString()||this.previousParams.toString()!==this.params.slice(0,this.paramsLength).toString()}getPath2D(){return this.path2d}moveTo(s,e){this.openedPath=!0,this.sx=s,this.sy=e,this.cx=s,this.cy=e,this.path2d.moveTo(s,e),this.commands[this.commandsLength++]=0,this.params[this.paramsLength++]=s,this.params[this.paramsLength++]=e}lineTo(s,e){this.openedPath?(this.cx=s,this.cy=e,this.path2d.lineTo(s,e),this.commands[this.commandsLength++]=1,this.params[this.paramsLength++]=s,this.params[this.paramsLength++]=e):this.moveTo(s,e)}cubicCurveTo(s,e,t,i,n,r){this.openedPath||this.moveTo(s,e),this.path2d.bezierCurveTo(s,e,t,i,n,r),this.commands[this.commandsLength++]=2,this.params[this.paramsLength++]=s,this.params[this.paramsLength++]=e,this.params[this.paramsLength++]=t,this.params[this.paramsLength++]=i,this.params[this.paramsLength++]=n,this.params[this.paramsLength++]=r}closePath(){this.openedPath&&(this.cx=this.sx,this.cy=this.sy,this.sx=Number.NaN,this.sy=Number.NaN,this.path2d.closePath(),this.commands[this.commandsLength++]=3,this.openedPath=!1,this.closedPath=!0)}rect(s,e,t,i){this.moveTo(s,e),this.lineTo(s+t,e),this.lineTo(s+t,e+i),this.lineTo(s,e+i),this.closePath()}roundRect(s,e,t,i,n){n=Math.min(n,t/2,i/2),this.moveTo(s,e+n),this.arc(s+n,e+n,n,Math.PI,1.5*Math.PI),this.lineTo(s+n,e),this.lineTo(s+t-n,e),this.arc(s+t-n,e+n,n,1.5*Math.PI,2*Math.PI),this.lineTo(s+t,e+n),this.lineTo(s+t,e+i-n),this.arc(s+t-n,e+i-n,n,0,Math.PI/2),this.lineTo(s+t-n,e+i),this.lineTo(s+n,e+i),this.arc(s+ +n,e+i-n,n,Math.PI/2,Math.PI),this.lineTo(s,e+i-n),this.closePath()}ellipse(s,e,t,i,n,r,a,o=!1){const h=t,c=i/t,l=Math.cos(n),d=Math.sin(n),u=-c*d,f=c*l,p=h*Math.cos(r),g=h*Math.sin(r),y=s+l*p+u*g,b=e+d*p+f*g,x=(y-this.cx)**2+(b-this.cy)**2;this.openedPath?x>1e-6&&this.lineTo(y,b):this.moveTo(y,b);let v=o?-pi(r-a):pi(a-r);Math.abs(Math.abs(a-r)-2*Math.PI)<1e-6&&v<2*Math.PI&&(v+=2*Math.PI*(o?-1:1));const S=Math.max(Math.ceil(Math.abs(v)/(Math.PI/2)),1),_=v/S,P=4/3*Math.tan(_/4);for(let M=0;M<S;M+=1){const C=r+_*(M+0),w=r+_*(M+1),A=h*Math.sin(C),I=h*Math.cos(C),D=h*Math.sin(w),B=h*Math.cos(w),j=I-P*A,it=A+P*I,H=B+P*D,U=D-P*B,k=B,z=D;this.cubicCurveTo(s+l*j+u*it,e+d*j+f*it,s+l*H+u*U,e+d*H+f*U,s+l*k+u*z,e+d*k+f*z)}}arc(s,e,t,i,n,r){this.ellipse(s,e,t,t,0,i,n,r)}appendSvg(s){const e=un(s);if(e==null)return!1;let t=0,i=0,n,r,a=0,o=0;for(const{command:h,params:c}of e){n??(n=c[0]),r??(r=c[1]);const l=h===h.toLowerCase(),d=l?n:0,u=l?r:0;switch(h.toLowerCase()){case"m":this.moveTo(d+c[0],u+c[1]),n=d+c[0],r=u+c[1],t=n,i=r;break;case"c":this.cubicCurveTo(d+c[0],u+c[1],d+c[2],u+c[3],d+c[4],u+c[5]),a=d+c[2],o=u+c[3],n=d+c[4],r=u+c[5];break;case"s":this.cubicCurveTo(n+n-a,r+r-o,d+c[0],u+c[1],d+c[2],u+c[3]),a=d+c[0],o=u+c[1],n=d+c[2],r=u+c[3];break;case"q":this.cubicCurveTo((d+2*c[0])/3,(u+2*c[1])/3,(2*c[0]+c[2])/3,(2*c[1]+c[3])/3,c[2],c[3]),a=c[0],o=c[1],n=c[2],r=c[3];break;case"t":this.cubicCurveTo((n+2*(n+n-a))/3,(r+2*(r+r-o))/3,(2*(n+n-a)+c[0])/3,(2*(r+r-o)+c[1])/3,c[0],c[1]),a=n+n-a,o=r+r-o,n=c[0],r=c[1];break;case"a":this.svgEllipse(n,r,c[0],c[1],c[2]*Math.PI/180,c[3],c[4],d+c[5],u+c[6]),n=d+c[5],r=u+c[6];break;case"h":this.lineTo(d+c[0],r),n=d+c[0];break;case"l":this.lineTo(d+c[0],u+c[1]),n=d+c[0],r=u+c[1];break;case"v":this.lineTo(n,u+c[0]),r=u+c[0];break;case"z":this.closePath(),n=t,r=i;break;default:throw new Error(`Could not translate command '${h}' with '${c.join(" ")}'`)}}return!0}svgEllipse(s,e,t,i,n,r,a,o,h){t=Math.abs(t),i=Math.abs(i);const c=(s-o)/2,l=(e-h)/2,d=Math.sin(n),u=Math.cos(n),f=u*c+d*l,p=-d*c+u*l,g=f/t,y=p/i;let b=g*g+y*y,x=(s+o)/2,v=(e+h)/2,S=0,_=0;b>=1?(b=Math.sqrt(b),t*=b,i*=b):(b=Math.sqrt(1/b-1),r===a&&(b=-b),S=b*t*y,_=-b*i*g,x+=u*S-d*_,v+=d*S+u*_);const P=Math.atan2((p-_)/i,(f-S)/t),M=Math.atan2((-p-_)/i,(-f-S)/t)-P,C=P+M,w=!!(1-a);this.ellipse(x,v,t,i,n,P,C,w)}clear(s){s?(this.previousCommands=this.commands.slice(0,this.commandsLength),this.previousParams=this.params.slice(0,this.paramsLength),this.previousClosedPath=this.closedPath,this.commands=[],this.params=[],this.commandsLength=0,this.paramsLength=0):(this.commandsLength=0,this.paramsLength=0);const e=ui();this.path2d=new e,this.openedPath=!1,this.closedPath=!1}isPointInPath(s,e){const t=this.commands,i=this.params,n=this.commandsLength,r=-1e4,a=-1e4;let o=Number.NaN,h=Number.NaN,c=0,l=0,d=0;for(let u=0,f=0;u<n;u++)switch(t[u]){case 0:d+=fe(o,h,c,l,r,a,s,e),c=i[f++],o=c,l=i[f++],h=l;break;case 1:d+=fe(c,l,i[f++],i[f++],r,a,s,e),c=i[f-2],l=i[f-1];break;case 2:d+=yn(c,l,i[f++],i[f++],i[f++],i[f++],i[f++],i[f++],r,a,s,e),c=i[f-2],l=i[f-1];break;case 3:d+=fe(o,h,c,l,r,a,s,e);break}return d%2===1}distanceSquared(s,e){let t=1/0;const i=this.commands,n=this.params,r=this.commandsLength;let a=Number.NaN,o=Number.NaN,h=0,c=0;for(let l=0,d=0;l<r;l++)switch(i[l]){case 0:h=a=n[d++],c=o=n[d++];break;case 1:{const u=h,f=c;h=n[d++],c=n[d++],t=fi(s,e,u,f,h,c,t);break}case 2:{const u=h,f=c,p=n[d++],g=n[d++],y=n[d++],b=n[d++];h=n[d++],c=n[d++],t=on(u,f,p,g,y,b,h,c,s,e)**2;break}case 3:t=fi(s,e,h,c,a,o,t);break}return t}toSVG(s=(e,t)=>({x:e,y:t})){const e=[],{commands:t,params:i}=this,n=(a,o)=>{e.push(a);for(let h=0;h<o;h+=2){const{x:c,y:l}=s(i[r++],i[r++]);e.push(c,l)}};let r=0;for(let a=0;a<this.commandsLength;a++)switch(t[a]){case 0:n("M",2);break;case 1:n("L",2);break;case 2:n("C",6);break;case 3:n("Z",0);break}return e.join(" ")}computeBBox(){const{commands:s,params:e}=this;let[t,i,n,r]=[1/0,1/0,-1/0,-1/0],[a,o]=[Number.NaN,Number.NaN],[h,c]=[Number.NaN,Number.NaN];const l=(u,f)=>{t=Math.min(f,t),i=Math.min(u,i),n=Math.max(u,n),r=Math.max(f,r),a=u,o=f};let d=0;for(let u=0;u<this.commandsLength;u++)switch(s[u]){case 0:l(e[d++],e[d++]),h=a,c=o;break;case 1:l(e[d++],e[d++]);break;case 2:{const p=a,g=o,y=e[d++],b=e[d++],x=e[d++],v=e[d++],S=e[d++],_=e[d++],P=hn(p,g,y,b,x,v,S,_);for(const M of P){const C=di(p,y,x,S,M),w=di(g,b,v,_,M);l(C,w)}l(S,_);break}case 3:l(h,c),h=Number.NaN,c=Number.NaN;break}return new L(i,t,n-i,r-t)}};import{toRadians as Nt}from"ag-charts-core";function pe(s,e,t){const{width:i,height:n,padding:r,strokeWidth:a}=e,o=i/2,h=n/2,c=Math.max(1,i-r-a/2),l=Math.max(1,n-r-a/2);let d=!1;for(const[u,f]of t){const p=o+(u-.5)*c,g=h+(f-.5)*l;d?s.lineTo(p,g):s.moveTo(p,g),d=!0}s.closePath()}var bi={circles(s,{width:e,strokeWidth:t,padding:i}){const n=e/2,r=Math.max(1,n-i-t/2);s.arc(n,n,r,0,Math.PI*2)},squares(s,{width:e,height:t,pixelRatio:i,padding:n,strokeWidth:r}){const a=n+r/2;s.moveTo(q(i,a),q(i,a)),s.lineTo(q(i,e-a),q(i,a)),s.lineTo(q(i,e-a),q(i,t-a)),s.lineTo(q(i,a),q(i,t-a)),s.closePath()},triangles(s,e){pe(s,e,[[.5,0],[1,1],[0,1]])},diamonds(s,e){pe(s,e,[[.5,0],[1,.5],[.5,1],[0,.5]])},stars(s,{width:e,height:t,padding:i}){const r=Math.max(1,(e-i)/2),a=r/2,o=Math.PI/2;for(let h=0;h<5*2;h++){const c=h%2===0?r:a,l=h*Math.PI/5-o,d=e/2+Math.cos(l)*c,u=t/2+Math.sin(l)*c;s.lineTo(d,u)}s.closePath()},hearts(s,{width:e,height:t,padding:i}){const n=Math.max(1,e/4-i/2),r=e/2,a=t/2+n/2;s.arc(r-n,a-n,n,Nt(130),Nt(330)),s.arc(r+n,a-n,n,Nt(220),Nt(50)),s.lineTo(r,a+n),s.closePath()},crosses(s,e){pe(s,e,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},"vertical-lines"(s,{width:e,height:t,pixelRatio:i,strokeWidth:n}){const r=q(i,e/2)-n%2/2;s.moveTo(r,0),s.lineTo(r,t)},"horizontal-lines"(s,{width:e,height:t,pixelRatio:i,strokeWidth:n}){const r=q(i,t/2)-n%2/2;s.moveTo(0,r),s.lineTo(e,r)},"forward-slanted-lines"(s,{width:e,height:t,strokeWidth:i}){const n=Math.atan2(t,e),r=i*Math.cos(n),a=i*Math.sin(n);s.moveTo(-r,a),s.lineTo(r,-a),s.moveTo(-r,t+a),s.lineTo(e+r,-a),s.moveTo(e-r,t+a),s.lineTo(e+r,t-a)},"backward-slanted-lines"(s,{width:e,height:t,strokeWidth:i}){const n=Math.atan2(t,e),r=i*Math.cos(n),a=i*Math.sin(n);s.moveTo(e-r,-a),s.lineTo(e+r,a),s.moveTo(-r,-a),s.lineTo(e+r,t+a),s.moveTo(-r,t-a),s.lineTo(r,t+a)}},bn=class{constructor(s){this._cache=void 0,this.width=Math.max(s?.width??10,1),this.height=Math.max(s?.height??10,1),this.fill=s.fill??"none",this.fillOpacity=s.fillOpacity??1,this.backgroundFill=s.backgroundFill??"none",this.backgroundFillOpacity=s.backgroundFillOpacity??1,this.stroke=s.stroke??"black",this.strokeOpacity=s.strokeOpacity??1,this.strokeWidth=s.strokeWidth??1,this.padding=s.padding??1,this.pattern=s.pattern??"forward-slanted-lines",this.rotation=s.rotation??0,this.scale=s.scale??1,this.path=s.path}getPath(s){const{pattern:e,width:t,height:i,padding:n,strokeWidth:r,path:a}=this,o=new pt;let h=bi[e]!=null;return a&&h&&(h=!o.appendSvg(a)),h&&bi[e](o,{width:t,height:i,pixelRatio:s,strokeWidth:r,padding:n}),o}renderStroke(s,e){const{stroke:t,strokeWidth:i,strokeOpacity:n}=this;i&&(e.strokeStyle=t,e.lineWidth=i,e.globalAlpha=n,e.stroke(s))}renderFill(s,e){const{fill:t,fillOpacity:i}=this;t!=="none"&&(e.fillStyle=t,e.globalAlpha=i,e.fill(s))}createCanvasPattern(s,e){const{width:t,height:i,scale:n,backgroundFill:r,backgroundFillOpacity:a}=this;if(t*n<1||i*n<1)return nn.warnOnce("Pattern fill is too small to render, ignoring."),null;const o=new ee({width:t,height:i,pixelRatio:e*n}),h=o.context;r!=="none"&&(h.fillStyle=r,h.globalAlpha=a,h.fillRect(0,0,t,i));const c=this.getPath(e).getPath2D();this.renderFill(c,h),this.renderStroke(c,h);const l=s.createPattern(o.canvas,"repeat");return this.setPatternTransform(l,e),o.destroy(),l}setPatternTransform(s,e,t=0,i=0){if(s==null)return;const n=an(this.rotation),r=1/e,a=Math.cos(n)*r,o=Math.sin(n)*r,h=rn();s.setTransform(new h([a,o,-o,a,t,i]))}createPattern(s,e){if(this._cache?.ctx===s&&this._cache.pixelRatio===e)return this._cache.pattern;const t=this.createCanvasPattern(s,e);if(t!=null)return this._cache={ctx:s,pattern:t,pixelRatio:e},t}toSvg(){const{width:s,height:e,fill:t,fillOpacity:i,backgroundFill:n,backgroundFillOpacity:r,stroke:a,strokeWidth:o,strokeOpacity:h,rotation:c,scale:l}=this,d=ue("pattern");d.setAttribute("viewBox",`0 0 ${s} ${e}`),d.setAttribute("width",String(s)),d.setAttribute("height",String(e)),d.setAttribute("patternUnits","userSpaceOnUse");const u=ue("rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(s)),u.setAttribute("height",String(e)),u.setAttribute("fill",n),u.setAttribute("fill-opacity",String(r)),d.appendChild(u);const f=ue("path");return f.setAttribute("fill",t),f.setAttribute("fill-opacity",String(i)),f.setAttribute("stroke-opacity",String(h)),f.setAttribute("stroke",a),f.setAttribute("stroke-width",String(o)),f.setAttribute("transform",`rotate(${c}) scale(${l})`),f.setAttribute("d",this.getPath(1).toSVG()),d.appendChild(f),d}};function xi(s,e){const{fontStyle:t,fontWeight:i,fontSize:n,fontFamily:r}=e;t&&s.setAttribute("font-style",t),i&&s.setAttribute("font-weight",String(i)),n!=null&&s.setAttribute("font-size",String(n)),r&&s.setAttribute("font-family",r)}function xn(s,e){const{stroke:t,strokeWidth:i,strokeOpacity:n}=e;t&&s.setAttribute("stroke",t),i!=null&&s.setAttribute("stroke-width",String(i)),n!=null&&s.setAttribute("stroke-opacity",String(n))}function vn(s,e){const{lineDash:t,lineDashOffset:i}=e;if(t?.some(n=>n!==0)){const n=t.length%2===1?[...t,...t]:t;s.setAttribute("stroke-dasharray",n.join(" ")),i!=null&&s.setAttribute("stroke-dashoffset",String(i))}}var Mn=(()=>{var s=class extends ut{constructor(){super(...arguments),this.drawingMode="overlay",this.fillOpacity=1,this.strokeOpacity=1,this.fill="black",this.strokeWidth=0,this.lineDashOffset=0,this.opacity=1}getGradient(t){if(ne(t))return this.createGradient(t)}createGradient(t){const{colorSpace:i="rgb",gradient:n="linear",colorStops:r,rotation:a=0,reverse:o=!1}=t;if(r==null)return;let h=Ks(r,["black"],[0,1]);switch(o&&(h=h.map(c=>({color:c.color,stop:1-c.stop})).reverse()),n){case"linear":return new Us(i,h,a);case"radial":return new js(i,h);case"conic":return new qs(i,h,a)}}getPattern(t){if(si(t))return this.createPattern(t)}createPattern(t){return new bn(t)}getImage(t){if(ii(t))return this.createImage(t)}createImage(t){return new sn(this.imageLoader,t)}onFillChange(){typeof this.fill=="object"&&Dt(this._cachedFill??{},this.fill)||(this.fillGradient=this.getGradient(this.fill),this.fillPattern=this.getPattern(this.fill),this.fillImage=this.getImage(this.fill),this._cachedFill=this.fill)}onStrokeChange(){this.strokeGradient=this.getGradient(this.stroke)}align(t,i){return q(this.layerManager?.canvas?.pixelRatio??1,t,i)}markDirty(t){super.markDirty(t),this.cachedDefaultGradientFillBBox=void 0}fillStroke(t,i,n,r){this.__drawingMode==="cutout"&&(t.globalCompositeOperation="destination-out",this.executeFill(t,i),t.globalCompositeOperation="source-over"),this.renderFill(t,i,n,r),this.renderStroke(t,i,n)}renderFill(t,i,n,r){const{__fill:a,__fillOpacity:o=1,fillImage:h}=this;if(a!=null&&a!=="none"&&o>0){const c=t.globalAlpha;h&&(t.globalAlpha=h.backgroundFillOpacity,t.fillStyle=h.backgroundFill,this.executeFill(t,i),t.globalAlpha=c),this.applyFillAndAlpha(t,n,r),this.applyShadow(t),this.executeFill(t,i),t.globalAlpha=c,this.fillShadow?.enabled&&(t.shadowColor="rgba(0, 0, 0, 0)")}}executeFill(t,i){i?t.fill(i):t.fill()}applyFillAndAlpha(t,i,n){const{__fill:r,fillGradient:a,fillPattern:o,fillImage:h,__fillOpacity:c=1,__opacity:l=1}=this,d=l*c;if(d!==1&&(t.globalAlpha*=d),a){const u=n??this.fillBBox??this.getDefaultGradientFillBBox()??i??this.getBBox(),{fillParams:f}=this;t.fillStyle=a.createGradient(t,u,f)??"black"}else if(o){const{x:u,y:f}=i??this.getBBox(),p=this.layerManager?.canvas?.pixelRatio??1,g=o.createPattern(t,p);o.setPatternTransform(g,p,u,f),g?t.fillStyle=g:(t.fillStyle=o.fill,t.globalAlpha*=o.fillOpacity)}else if(h){const u=i??this.getBBox(),f=h.createPattern(t,u.width,u.height,this);h.setImageTransform(f,u),t.fillStyle=f??"transparent"}else t.fillStyle=typeof r=="string"?r:"black"}applyStrokeAndAlpha(t,i){const{__stroke:n,__strokeOpacity:r=1,strokeGradient:a,__opacity:o=1}=this;t.strokeStyle=a?.createGradient(t,i??this.getBBox())??(typeof n=="string"?n:void 0)??"black";const h=o*r;h!==1&&(t.globalAlpha*=h)}applyShadow(t){const i=this.layerManager?.canvas.pixelRatio??1,{__fillShadow:n}=this;n?.enabled&&(t.shadowColor=n.color,t.shadowOffsetX=n.xOffset*i,t.shadowOffsetY=n.yOffset*i,t.shadowBlur=n.blur*i)}renderStroke(t,i,n){const{__stroke:r,__strokeWidth:a=0,__strokeOpacity:o=1,__lineDash:h,__lineDashOffset:c,__lineCap:l,__lineJoin:d,__miterLimit:u}=this;if(r!=null&&r!=="none"&&a>0&&o>0){const{globalAlpha:f}=t;this.applyStrokeAndAlpha(t,n),t.lineWidth=a,h&&t.setLineDash(h),c&&(t.lineDashOffset=c),l&&(t.lineCap=l),d&&(t.lineJoin=d),u!=null&&(t.miterLimit=u),this.executeStroke(t,i),t.globalAlpha=f}}executeStroke(t,i){i?t.stroke(i):t.stroke()}getDefaultGradientFillBBox(){return this.cachedDefaultGradientFillBBox??(this.cachedDefaultGradientFillBBox=Object.freeze(this.computeDefaultGradientFillBBox())),this.cachedDefaultGradientFillBBox}computeDefaultGradientFillBBox(){}containsPoint(t,i){return this.isPointInPath(t,i)}applySvgFillAttributes(t,i){const{fill:n,fillOpacity:r}=this;if(typeof n=="string")t.setAttribute("fill",n);else if(ne(n)&&this.fillGradient){i??(i=[]);const a=this.fillGradient.toSvg(this.fillBBox??this.getBBox()),o=se();a.setAttribute("id",o),i.push(a),t.setAttribute("fill",`url(#${o})`)}else if(si(n)&&this.fillPattern){i??(i=[]);const a=this.fillPattern.toSvg(),o=se();a.setAttribute("id",o),i.push(a),t.setAttribute("fill",`url(#${o})`)}else if(ii(n)&&this.fillImage){i??(i=[]);const a=this.layerManager?.canvas?.pixelRatio??1,o=this.fillImage.toSvg(this.getBBox(),a),h=se();o.setAttribute("id",h),i.push(o),t.setAttribute("fill",`url(#${h})`)}else t.setAttribute("fill","none");return t.setAttribute("fill-opacity",String(r)),i}applySvgStrokeAttributes(t){const{stroke:i,strokeOpacity:n,strokeWidth:r,lineDash:a,lineDashOffset:o}=this;xn(t,{stroke:Is(i)?i:void 0,strokeOpacity:n,strokeWidth:r}),vn(t,{lineDash:a,lineDashOffset:o})}static handleFillChange(t){t.onFillChange()}static handleStrokeChange(t){t.onStrokeChange()}setStyleProperties(t,i,n){const r=t?.opacity??1,a=t?.fill,o=(t?.fillOpacity??1)*r,h=(t?.strokeOpacity??1)*r,c=t?.strokeWidth??0,l=t?.lineDashOffset??0;let d=!1;this.__fillOpacity!==o&&(this.__fillOpacity=o,d=!0),this.__strokeOpacity!==h&&(this.__strokeOpacity=h,d=!0),this.__strokeWidth!==c&&(this.__strokeWidth=c,d=!0),this.__lineDashOffset!==l&&(this.__lineDashOffset=l,d=!0),this.__lineDash!==t?.lineDash&&(this.__lineDash=t?.lineDash,d=!0),this.setFillProperties(a,i,n),a!==this.fill&&(this.fill=a),t?.stroke!==this.stroke&&(this.stroke=t?.stroke),d&&this.markDirty()}setFillProperties(t,i,n){const r=i==null||!ne(t)||t.bounds==null||t.bounds==="item"?void 0:i[t.bounds];let a=!1;this.__fillBBox!==r&&(this.__fillBBox=r,a=!0),this.__fillParams!==n&&(this.__fillParams=n,a=!0),a&&(this.onFillChange(),this.markDirty())}};return m([Z()],s.prototype,"drawingMode",2),m([Z()],s.prototype,"fillOpacity",2),m([Z()],s.prototype,"strokeOpacity",2),m([ie({equals:Dt,changeCb:s.handleFillChange})],s.prototype,"fill",2),m([ei({equals:Dt,changeCb:s.handleStrokeChange})],s.prototype,"stroke",2),m([Z()],s.prototype,"strokeWidth",2),m([Ds()],s.prototype,"lineDash",2),m([Z()],s.prototype,"lineDashOffset",2),m([Z()],s.prototype,"lineCap",2),m([Z()],s.prototype,"lineJoin",2),m([Z()],s.prototype,"miterLimit",2),m([Z({convertor:e=>Rs(0,e??1,1)})],s.prototype,"opacity",2),m([ei({equals:Ns,checkDirtyOnAssignment:!0})],s.prototype,"fillShadow",2),m([ie({equals:As,changeCb:e=>e.onFillChange()})],s.prototype,"fillBBox",2),m([ie({equals:Dt,changeCb:e=>e.onFillChange()})],s.prototype,"fillParams",2),s})(),Pt=Mn;import{createSvgElement as Sn}from"ag-charts-core";import{isNumberEqual as gt}from"ag-charts-core";var vi=[1,0,0,1,0,0],ht=class Ht{get e(){return[...this.elements]}constructor(e=vi){this.elements=[...e]}setElements(e){const t=this.elements;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],this}get identity(){const e=this.elements;return gt(e[0],1)&>(e[1],0)&>(e[2],0)&>(e[3],1)&>(e[4],0)&>(e[5],0)}AxB(e,t,i){const n=e[0]*t[0]+e[2]*t[1],r=e[1]*t[0]+e[3]*t[1],a=e[0]*t[2]+e[2]*t[3],o=e[1]*t[2]+e[3]*t[3],h=e[0]*t[4]+e[2]*t[5]+e[4],c=e[1]*t[4]+e[3]*t[5]+e[5];i=i??e,i[0]=n,i[1]=r,i[2]=a,i[3]=o,i[4]=h,i[5]=c}multiplySelf(e){return this.AxB(this.elements,e.elements),this}multiply(e){const t=[Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN];return e instanceof Ht?this.AxB(this.elements,e.elements,t):this.AxB(this.elements,[e.a,e.b,e.c,e.d,e.e,e.f],t),new Ht(t)}preMultiplySelf(e){return this.AxB(e.elements,this.elements,this.elements),this}inverse(){const e=this.elements;let t=e[0],i=e[1],n=e[2],r=e[3];const a=e[4],o=e[5],h=1/(t*r-i*n);return t*=h,i*=h,n*=h,r*=h,new Ht([r,-i,-n,t,n*o-r*a,i*a-t*o])}invertSelf(){const e=this.elements;let t=e[0],i=e[1],n=e[2],r=e[3];const a=e[4],o=e[5],h=1/(t*r-i*n);return t*=h,i*=h,n*=h,r*=h,e[0]=r,e[1]=-i,e[2]=-n,e[3]=t,e[4]=n*o-r*a,e[5]=i*a-t*o,this}transformPoint(e,t){const i=this.elements;return{x:e*i[0]+t*i[2]+i[4],y:e*i[1]+t*i[3]+i[5]}}transformBBox(e,t){const i=this.elements,n=i[0],r=i[1],a=i[2],o=i[3],h=e.width*.5,c=e.height*.5,l=e.x+h,d=e.y+c,u=Math.abs(h*n)+Math.abs(c*a),f=Math.abs(h*r)+Math.abs(c*o);return t??(t=new L(0,0,0,0)),t.x=l*n+d*a+i[4]-u,t.y=l*r+d*o+i[5]-f,t.width=u+u,t.height=f+f,t}toContext(e){if(this.identity)return;const t=this.elements;e.transform(t[0],t[1],t[2],t[3],t[4],t[5])}static updateTransformMatrix(e,t,i,n,r,a,o){const h=t,c=i;let l,d;h===1&&c===1?(l=0,d=0):(l=o?.scalingCenterX??0,d=o?.scalingCenterY??0);const u=n,f=Math.cos(u),p=Math.sin(u);let g,y;u===0?(g=0,y=0):(g=o?.rotationCenterX??0,y=o?.rotationCenterY??0);const b=r,x=a,v=l*(1-h)-g,S=d*(1-c)-y;return e.setElements([f*h,p*h,-p*c,f*c,f*v-p*S+g+b,p*v+f*S+y+x]),e}};function Q(s){return Si(s.constructor)}var Mi=Symbol("isMatrixTransform");function Si(s){return s[Mi]===!0}function ge(s){var e,t;const i=s;if(Si(s))return s;const n=Symbol("matrix_combined_transform");class r extends i{constructor(){super(...arguments),this[t]=new ht,this._dirtyTransform=!0}onChangeDetection(o){super.onChangeDetection(o),this._dirtyTransform=!0,!(this.batchLevel>0)&&this.markDirty("transform")}updateMatrix(o){}computeTransformMatrix(){this._dirtyTransform&&(this[n].setElements(vi),this.updateMatrix(this[n]),this._dirtyTransform=!1)}toParent(o){return this.computeTransformMatrix(),this[n].identity?o.clone():this[n].transformBBox(o)}toParentPoint(o,h){return this.computeTransformMatrix(),this[n].identity?{x:o,y:h}:this[n].transformPoint(o,h)}fromParent(o){return this.computeTransformMatrix(),this[n].identity?o.clone():this[n].inverse().transformBBox(o)}fromParentPoint(o,h){return this.computeTransformMatrix(),this[n].identity?{x:o,y:h}:this[n].inverse().transformPoint(o,h)}computeBBox(){const o=super.computeBBox();return o&&this.toParent(o)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(o,h){return{x:o,y:h}=this.fromParentPoint(o,h),super.pickNode(o,h)}pickNodes(o,h,c){return{x:o,y:h}=this.fromParentPoint(o,h),super.pickNodes(o,h,c)}distanceSquared(o,h){return{x:o,y:h}=this.fromParentPoint(o,h),super.distanceSquared(o,h)}render(o){this.computeTransformMatrix();const{ctx:h}=o,c=this[n];let l=!1;try{c.identity||(h.save(),l=!0,c.toContext(h)),super.render(o)}finally{l&&h.restore()}}toSVG(){this.computeTransformMatrix();const o=super.toSVG(),h=this[n];if(h.identity||o==null)return o;const c=Sn("g");c.append(...o.elements);const[l,d,u,f,p,g]=h.e;return c.setAttribute("transform",`matrix(${l} ${d} ${u} ${f} ${p} ${g})`),{elements:[c],defs:o.defs}}}return e=Mi,t=n,r[e]=!0,r}function Ct(s){var e;const t=s,i=Symbol("matrix_rotation");class n extends ge(t){constructor(){super(...arguments),this[e]=new ht,this.rotationCenterX=0,this.rotationCenterY=0,this.rotation=0}updateMatrix(a){super.updateMatrix(a);const{rotation:o,rotationCenterX:h,rotationCenterY:c}=this;o!==0&&(ht.updateTransformMatrix(this[i],1,1,o,0,0,{rotationCenterX:h,rotationCenterY:c}),a.multiplySelf(this[i]))}}return e=i,m([T()],n.prototype,"rotationCenterX",2),m([T()],n.prototype,"rotationCenterY",2),m([T()],n.prototype,"rotation",2),n}function Pi(s){var e;const t=s,i=Symbol("matrix_scale");class n extends ge(t){constructor(){super(...arguments),this[e]=new ht,this.scalingX=1,this.scalingY=1,this.scalingCenterX=0,this.scalingCenterY=0}updateMatrix(a){super.updateMatrix(a);const{scalingX:o,scalingY:h,scalingCenterX:c,scalingCenterY:l}=this;o===1&&h===1||(ht.updateTransformMatrix(this[i],o,h,0,0,0,{scalingCenterX:c,scalingCenterY:l}),a.multiplySelf(this[i]))}resetScalingProperties(a,o,h,c){this.__scalingX=a,this.__scalingY=o,this.__scalingCenterX=h,this.__scalingCenterY=c,this.onChangeDetection("scaling")}}return e=i,m([T()],n.prototype,"scalingX",2),m([T()],n.prototype,"scalingY",2),m([T()],n.prototype,"scalingCenterX",2),m([T()],n.prototype,"scalingCenterY",2),n}function At(s){var e;const t=s,i=Symbol("matrix_translation");class n extends ge(t){constructor(){super(...arguments),this[e]=new ht,this.translationX=0,this.translationY=0}updateMatrix(a){super.updateMatrix(a);const{translationX:o,translationY:h}=this;o===0&&h===0||(ht.updateTransformMatrix(this[i],1,1,0,o,h),a.multiplySelf(this[i]))}}return e=i,m([T()],n.prototype,"translationX",2),m([T()],n.prototype,"translationY",2),n}var ct=class{static fromCanvas(s,e){const t=[];for(const i of s.traverseUp())Q(i)&&t.unshift(i);for(const i of t)e=i.fromParent(e);return Q(s)&&(e=s.fromParent(e)),e}static toCanvas(s,e){e==null?e=s.getBBox():Q(s)&&(e=s.toParent(e));for(const t of s.traverseUp())Q(t)&&(e=t.toParent(e));return e}static fromCanvasPoint(s,e,t){const i=[];for(const n of s.traverseUp())Q(n)&&i.unshift(n);for(const n of i)({x:e,y:t}=n.fromParentPoint(e,t));return Q(s)&&({x:e,y:t}=s.fromParentPoint(e,t)),{x:e,y:t}}static toCanvasPoint(s,e,t){Q(s)&&({x:e,y:t}=s.toParentPoint(e,t));for(const i of s.traverseUp())Q(i)&&({x:e,y:t}=i.toParentPoint(e,t));return{x:e,y:t}}},Rt,Pn=(()=>{var s=class Tt extends ut{constructor(t){super(t),this.childNodes=new Set,this.dirty=!1,this.dirtyZIndex=!1,this.clipRect=void 0,this.opacity=1,this._childFontDirty=!0,this.layer=void 0,this.image=void 0,this._lastWidth=Number.NaN,this._lastHeight=Number.NaN,this._lastDevicePixelRatio=Number.NaN,this.isContainerNode=!0,this.renderToOffscreenCanvas=t?.renderToOffscreenCanvas===!0,this.optimizeForInfrequentRedraws=t?.optimizeForInfrequentRedraws===!0}static is(t){return t instanceof Tt}static computeChildrenBBox(t,i=!0){return L.merge(ut.extractBBoxes(t,i))}static compareChildren(t,i){return us(t.__zIndex,i.__zIndex)||t.serialNumber-i.serialNumber}containsPoint(t,i){return!0}computeBBox(){return Tt.computeChildrenBBox(this.children())}computeSafeClippingBBox(t){const i=this.computeBBox();if(i?.isFinite()!==!0)return;let n=0;const r=4;for(const f of this.descendants())f instanceof Pt&&(n=Math.max(n,f.strokeWidth));const a=Math.max(1,n/2*r),{x:o,y:h}=ct.toCanvasPoint(this,0,0),c=Je(t,o+i.x-a)-o,l=Je(t,h+i.y-a)-h,d=Math.ceil(i.x+i.width-c+a),u=Math.ceil(i.y+i.height-l+a);return new L(c,l,d,u)}prepareSharedCanvas(t,i,n){return Rt?.pixelRatio===n?Rt.resize(t,i,n):Rt=new ee({width:t,height:i,pixelRatio:n}),Rt}setScene(t){const i=this.scene;super.setScene(t),this.layer&&i&&i!==t&&(i.layersManager.removeLayer(this.layer),this.layer=void 0);for(const n of this.children())n.setScene(t)}resolveFont(){if(!this.renderToOffscreenCanvas)return this.resolveChildFont()}resolveChildFont(){if(this._childFontDirty){this._cachedChildFont=void 0;for(const t of this.children()){const i=t.resolveFont();if(i!=null){this._cachedChildFont=i;break}}this._childFontDirty=!1}return this._cachedChildFont}markDirty(t){this.dirty=!0,this._childFontDirty=!0,super.markDirty(t)}markDirtyChildrenOrder(){super.markDirtyChildrenOrder(),this.dirtyZIndex=!0,this.markDirty()}append(t){for(const i of _s(t))i.remove(),this.childNodes.add(i),i.parentNode=this,i.setScene(this.scene);this.markDirtyChildrenOrder(),this.markDirty()}appendChild(t){return this.append(t),t}removeChild(t){if(!this.childNodes?.delete(t))throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`);t.parentNode=void 0,t.setScene(),this.markDirtyChildrenOrder(),this.markDirty()}clear(){for(const t of this.children())delete t.parentNode,t.setScene();this.childNodes?.clear(),this.markDirty()}pickNode(t,i){if(!(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))){if(this.childNodes!=null&&this.childNodes.size!==0){const n=[...this.children()];for(let r=n.length-1;r>=0;r--){const o=n[r].pickNode(t,i);if(o!=null)return o}}else if(!this.isContainerNode)return this}}pickNodes(t,i,n=[]){if(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))return n;this.isContainerNode||n.push(this);for(const r of this.children())r.pickNodes(t,i,n);return n}isDirty(t){const{width:i,height:n,devicePixelRatio:r}=t,{dirty:a,layer:o}=this,h=o!=null&&(this._lastWidth!==i||this._lastHeight!==n),c=this._lastDevicePixelRatio!==r;return this._lastWidth=i,this._lastHeight=n,this._lastDevicePixelRatio=r,a||h||c}preRender(t){let i;if(this.dirty){i=super.preRender(t,0);for(const n of this.children()){const r=n.preRender(t);i.groups+=r.groups,i.nonGroups+=r.nonGroups,i.complexity+=r.complexity}i.groups+=1,i.nonGroups-=1}else i=this.childNodeCounts;return this.renderToOffscreenCanvas&&!this.optimizeForInfrequentRedraws&&i.nonGroups>0&&this.getVisibility()?this.layer??(this.layer=this.layerManager?.addLayer({name:this.name})):this.layer!=null&&(this.layerManager?.removeLayer(this.layer),this.layer=void 0),i}render(t){const{layer:i,renderToOffscreenCanvas:n}=this,r={...t},a=this.isDirty(t);if(this.dirty=!1,!n){this.renderInContext(r),super.render(r);return}const{ctx:o,stats:h,devicePixelRatio:c}=t;let{image:l}=this;if(a){l?.bitmap.close(),l=void 0;const u=i?void 0:this.computeSafeClippingBBox(c),f=(p,...g)=>{const y=p.context;y.direction=r.direction,r.ctx=y,r.currentFont=void 0,p.clear(),y.save();try{y.setTransform(...g),y.globalAlpha=1,this.renderInContext(r)}finally{y.restore(),y.verifyDepthZero?.()}};if(i)f(i,o.getTransform());else if(u){const{x:p,y:g,width:y,height:b}=u,x=Math.floor(y*c),v=Math.floor(b*c);if(x>0&&v>0){const S=this.prepareSharedCanvas(y,b,c);f(S,c,0,0,c,-p*c,-g*c),l={bitmap:S.transferToImageBitmap(),x:p,y:g,width:y,height:b}}}this.image=l,h&&h.layersRendered++}else h&&h.layersSkipped++;const{globalAlpha:d}=o;if(o.globalAlpha=d*this.opacity,i){o.save();try{o.resetTransform(),i.drawImage(o)}finally{o.restore()}}else if(l){const{bitmap:u,x:f,y:p,width:g,height:y}=l;o.drawImage(u,0,0,g*c,y*c,f,p,g,y)}o.globalAlpha=d,super.render(r)}applyClip(t,i){const{x:n,y:r,width:a,height:o}=i;t.beginPath(),t.rect(n,r,a,o),t.clip()}renderInContext(t){const{ctx:i,stats:n}=t;this.dirtyZIndex&&(this.sortChildren(Tt.compareChildren),this.dirtyZIndex=!1),i.save();try{i.globalAlpha*=this.opacity;const r=this.resolveChildFont();r!=null&&t.currentFont!==r&&(i.font=r,t.currentFont=r),this.clipRect!=null&&(this.applyClip(i,this.clipRect),t.clipBBox=ct.toCanvas(this,this.clipRect));for(const a of this.children()){if(!a.visible){n&&(n.nodesSkipped+=a.childNodeCounts.nonGroups+a.childNodeCounts.groups,n.opsSkipped+=a.childNodeCounts.complexity);continue}a.isolatedRender(t)}}finally{i.restore()}}sortChildren(t){if(!this.childNodes)return;const i=[...this.childNodes].sort(t);this.childNodes.clear();for(const n of i)this.childNodes.add(n)}*children(){yield*this.childNodes}*excludeChildren(t){for(const i of this.children())(t.instance&&!(i instanceof t.instance)||t.name&&i.name!==t.name)&&(yield i)}*descendants(){for(const t of this.children())yield t,t instanceof Tt&&(yield*t.descendants())}setClipRect(t){this.clipRect=t?ct.fromCanvas(this,t):void 0}setClipRectCanvasSpace(t){this.clipRect=t}getVisibility(){for(const t of this.traverseUp(!0))if(!t.visible)return!1;return!0}toSVG(){if(!this.visible)return;const t=[],i=[];for(const n of this.children()){const r=n.toSVG();r!=null&&(i.push(...r.elements),r.defs!=null&&t.push(...r.defs))}return{elements:i,defs:t}}};return s.className="Group",m([T({convertor:e=>Cs(0,e,1)})],s.prototype,"opacity",2),s})(),G=Pn,Ca=Pi(G),_a=Ct(G),Cn=At(G),wa=Ct(At(G));import{Debug as It,DebugMetrics as _n,Logger as Lt,TextMeasurer as wn,getWindow as Tn,isString as kn,toArray as Dn}from"ag-charts-core";var Nn=class{constructor(){this.stats=new Map,this.lastLogTime=Date.now(),this.LOG_INTERVAL_MS=1e4,this.startPeriodicLogging()}startPeriodicLogging(){It.check("scene:stats","scene:stats:verbose")&&(this.stopPeriodicLogging(),this.intervalId=setInterval(()=>{this.logAccumulatedStats()},this.LOG_INTERVAL_MS))}stopPeriodicLogging(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0)}recordTiming(s,e){const t=this.stats.get(s);t?(t.min=Math.min(t.min,e),t.max=Math.max(t.max,e),t.sum+=e,t.count+=1):this.stats.set(s,{min:e,max:e,sum:e,count:1})}recordTimings(s){for(const[e,t]of Object.entries(s))e!=="start"&&typeof t=="number"&&this.recordTiming(e,t)}logAccumulatedStats(){if(this.stats.size===0)return;const s=(Date.now()-this.lastLogTime)/1e3,e=Array.from(this.stats.keys()).sort((r,a)=>r==="\u23F1\uFE0F"?-1:a==="\u23F1\uFE0F"?1:r.localeCompare(a)),t=[];for(const r of e){const a=this.stats.get(r),o=a.sum/a.count;t.push(`${r}[${a.min.toFixed(1)}/${o.toFixed(1)}/${a.max.toFixed(1)}]ms`)}const n=this.stats.get("\u23F1\uFE0F")?.count??0;Lt.log(`\u{1F4CA} Stats (${s.toFixed(0)}s, ${n} renders): ${t.join(" ")}`),this.stats.clear(),this.lastLogTime=Date.now()}destroy(){this.stopPeriodicLogging(),this.stats.clear()}},mt,lt=0;function An(){return mt??(mt=new Nn),mt}function Rn(){lt++;let s=!1;return()=>{s||lt===0||(s=!0,lt--,lt===0&&Ti())}}function In(s){for(const e of["B","KB","MB","GB"]){if(s<1536)return`${s.toFixed(1)}${e}`;s/=1024}return`${s.toFixed(1)}TB}`}function Ln(){if(!("memory"in performance))return;const{totalJSHeapSize:s,usedJSHeapSize:e,jsHeapSizeLimit:t}=performance.memory,i=[];for(const n of[e,s,t])typeof n=="number"&&i.push(In(n));return`Heap ${i.join(" / ")}`}function Ci(s,e,t,i,n={},r=L.zero,a){if(!It.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:o=0,layersSkipped:h=0,nodesRendered:c=0,nodesSkipped:l=0,opsPerformed:d=0,opsSkipped:u=0}=i??{},f=performance.now(),{start:p,...g}=e,y=f-p,b=An();b.recordTimings(g),b.recordTiming("\u23F1\uFE0F",y);const x=Object.entries(g).map(([k,z])=>wi(k,z)).filter(k=>k!=null).join(" + "),v=Object.entries(n).map(([k,z])=>`${k}: ${JSON.stringify(z)}`).join(" ; "),S=It.check("scene:stats:verbose"),_=S?Ln():null,P=S?_n.flush():{},M=Object.entries(P),C=[],w=[];for(const[k,z]of M)k.endsWith(":aggregation")&&Array.isArray(z)?C.push(`${k.replace(":aggregation","")}(${z.join(",")})`):k.endsWith(":nodeData")&&typeof z=="number"&&w.push(`${k.replace(":nodeData","")}(${z})`);const A=C.length>0?`Aggregation: ${C.join(", ")}`:null,I=w.length>0?`NodeData: ${w.join(", ")}`:null,D=[`${wi("\u23F1\uFE0F",p,f)} (${x})`,`${v}`,A,I,`Layers: ${S?me(o,h):s.size}`,S?`Nodes: ${me(c,l)}`:null,S?`Ops: ${me(d,u)}`:null,_].filter(kn),B=new wn(t),j=new Map(D.map(k=>[k,B.measureText(k)])),it=Math.max(...Array.from(j.values(),k=>k.width)),H=$n(j.values(),k=>k.height),U=2+r.x;t.save();try{t.fillStyle=a?.background??"white",t.fillRect(U,0,it,H),t.fillStyle=a?.foreground??"black";let k=0;for(const[z,Mt]of j.entries())k+=Mt.height,t.fillText(z,U,k)}catch(k){Lt.warnOnce("Error during debug stats rendering",k)}finally{t.restore()}}function On(s){const e=Dn(Tn("agChartsSceneDebug")),t=[];for(const i of e)i==="layout"?t.push("seriesRoot","legend","root",/Axis-\d+-axis/):t.push(i);s.debugNodeSearch=t}function Fn(s,e){s.save();try{for(const[t,i]of Object.entries(e)){const n=ct.toCanvas(i);if(!n){Lt.log(`Scene.render() - no bbox for debugged node [${t}].`);continue}s.globalAlpha=.8,s.strokeStyle="red",s.lineWidth=1,s.strokeRect(n.x,n.y,n.width,n.height),s.fillStyle="red",s.strokeStyle="white",s.font="16px sans-serif",s.textBaseline="top",s.textAlign="left",s.lineWidth=2,s.strokeText(t,n.x,n.y,n.width),s.fillText(t,n.x,n.y,n.width)}}catch(t){Lt.warnOnce("Error during debug rendering",t)}finally{s.restore()}}var En=new Set,Bn=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function zn(s){const{...e}=s;for(const t of Object.keys(e))Bn.has(t)||typeof e[t]!="number"&&typeof e[t]!="string"&&typeof e[t]!="boolean"&&(En.add(t),delete e[t]);return e}function Ot(s,e){if(!It.check(!0,"scene"))return{};let t=0;return{node:e==="json"?zn(s):s,name:s.name??s.id,dirty:s instanceof G?s.dirty:void 0,...Array.from(s instanceof G?s.children():[],i=>Ot(i,e)).reduce((i,n)=>{let{name:r}=n;const{node:{visible:a,opacity:o,zIndex:h,translationX:c,translationY:l,rotation:d,scalingX:u,scalingY:f},node:p}=n;(!a||o<=0)&&(r=`(${r})`),G.is(p)&&p.renderToOffscreenCanvas&&(r=`*${r}*`);const g=Array.isArray(h)?`(${h.join(", ")})`:h,y=[`${(t++).toString().padStart(3,"0")}|`,`${r??"<unknown>"}`,`z: ${g}`,c&&`x: ${c}`,l&&`y: ${l}`,d&&`r: ${d}`,u!=null&&u!==1&&`sx: ${u}`,f!=null&&f!==1&&`sy: ${f}`].filter(v=>!!v).join(" ");let b=y,x=1;for(;i[b]!=null&&x<100;)b=`${y} (${x++})`;return i[b]=n,i},{})}}function _i(s){const e=s instanceof G?s.dirty:void 0;if(!e)return{dirtyTree:{},paths:[]};const t=Array.from(s instanceof G?s.children():[],r=>_i(r)).filter(r=>r.paths.length>0),i=G.is(s)?s.name??s.id:s.id,n=t.length?t.flatMap(r=>r.paths).map(r=>`${i}.${r}`):[i];return{dirtyTree:{name:i,node:s,dirty:e,...t.map(r=>r.dirtyTree).filter(r=>r.dirty!=null).reduce((r,a)=>(r[a.name??"<unknown>"]=a,r),{})},paths:n}}function me(s,e){const t=s+e;return`${s} / ${t} (${Math.round(100*s/t)}%)`}function wi(s,e,t){const i=t==null?e:t-e;return`${s}: ${Math.round(i*100)/100}ms`}function $n(s,e){let t=0;for(const i of s)t+=e(i);return t}function Ti(s=!1){if(!mt){s&&(lt=0);return}!s&<>0||(mt.destroy(),mt=void 0,s&&(lt=0))}import{Logger as Wn}from"ag-charts-core";var qn=(()=>{var s=class extends ut{constructor(){super(...arguments),this.x=0,this.y=0,this.boxWidth=0,this.boxHeight=0,this.imageWidth=0,this.imageHeight=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0,this.paddingLeft=0,this.cornerRadius=0,this.opacity=1,this.url=""}setScene(e){e==null&&this.registeredLoader&&(this.registeredLoader.unregisterNode(this),this.registeredLoader=void 0),super.setScene(e)}destroy(){this.registeredLoader&&(this.registeredLoader.unregisterNode(this),this.registeredLoader=void 0),super.destroy()}render(e){const{ctx:t}=e,{x:i,y:n,boxWidth:r,boxHeight:a,cornerRadius:o,opacity:h}=this;if(r<=0||a<=0){super.render(e);return}const c=t.globalAlpha;if(t.globalAlpha=c*h,this.backgroundFill&&(this.tracePath(t,i,n,r,a,o),t.fillStyle=this.backgroundFill,t.fill()),this.url){const l=this.imageLoader;l!==this.registeredLoader&&(this.registeredLoader?.unregisterNode(this),this.registeredLoader=l);const d=l?.loadImage(this.url,this,{width:this.imageWidth,height:this.imageHeight});if(d){const u=i+this.paddingLeft,f=n+this.paddingTop,p=o>0;p&&(t.save(),this.tracePath(t,i,n,r,a,o),t.clip()),t.drawImage(d,u,f,this.imageWidth,this.imageHeight),p&&t.restore()}}else Wn.warnOnce(`Image segment has an empty url; rendering background only (${r}x${a} box).`);t.globalAlpha=c,super.render(e)}tracePath(e,t,i,n,r,a){e.beginPath();const o=Math.max(0,Math.min(a,n/2,r/2));if(o===0){e.rect(t,i,n,r);return}e.moveTo(t+o,i),e.arcTo(t+n,i,t+n,i+r,o),e.arcTo(t+n,i+r,t,i+r,o),e.arcTo(t,i+r,t,i,o),e.arcTo(t,i,t+n,i,o),e.closePath()}computeBBox(){return new L(this.x,this.y,this.boxWidth,this.boxHeight)}};return m([T()],s.prototype,"x",2),m([T()],s.prototype,"y",2),m([T()],s.prototype,"boxWidth",2),m([T()],s.prototype,"boxHeight",2),m([T()],s.prototype,"imageWidth",2),m([T()],s.prototype,"imageHeight",2),m([T()],s.prototype,"paddingTop",2),m([T()],s.prototype,"paddingRight",2),m([T()],s.prototype,"paddingBottom",2),m([T()],s.prototype,"paddingLeft",2),m([T()],s.prototype,"cornerRadius",2),m([T()],s.prototype,"opacity",2),s})();import{DeclaredSceneChangeDetection as Y,boxesEqual as Gn,isNumberEqual as ki}from"ag-charts-core";var Ft=(s,{x0:e,y0:t,x1:i,y1:n,cx:r,cy:a},o,h)=>{if(h&&s.moveTo(e,t),e!==i||t!==n){const c=Math.atan2(t-a,e-r),l=Math.atan2(n-a,i-r);s.arc(r,a,o,c,l)}else s.lineTo(e,t)};import{SceneChangeDetection as ye,createSvgElement as Xn}from"ag-charts-core";var yt=(()=>{var s=class extends Pt{constructor(){super(...arguments),this._clipX=Number.NaN,this._clipY=Number.NaN,this.clip=!1,this._dirtyPath=!0,this.lastPixelRatio=Number.NaN}get path(){return this._path??(this._path=new pt),this._path}set path(e){this._path=e}set clipX(e){this._clipX=e,this.dirtyPath=!0}set clipY(e){this._clipY=e,this.dirtyPath=!0}set dirtyPath(e){this._dirtyPath!==e&&(this._dirtyPath=e,e&&this.markDirty("path"))}get dirtyPath(){return this._dirtyPath}checkPathDirty(){this._dirtyPath||(this.dirtyPath=this.path.isDirty()||(this.fillShadow?.isDirty()??!1)||(this._clipPath?.isDirty()??!1))}resetPathDirty(){this.path.clear(!0),this._dirtyPath=!1}isPathDirty(){return this.path.isDirty()}onChangeDetection(e){this._dirtyPath=!0,super.onChangeDetection(e)}computeBBox(){return this.updatePathIfDirty(),this.path.computeBBox()}isPointInPath(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)}distanceSquared(e,t){return this.distanceSquaredTransformedPoint(e,t)}svgPathData(e){return this.updatePathIfDirty(),this.path.toSVG(e)}distanceSquaredTransformedPoint(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)?0:this.path.distanceSquared(e,t)}isDirtyPath(){return!1}updatePath(){}updatePathIfDirty(){(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1)}preRender(e){return e.devicePixelRatio!==this.lastPixelRatio&&(this.dirtyPath=!0),this.lastPixelRatio=e.devicePixelRatio,this.updatePathIfDirty(),super.preRender(e,this.pathComplexity())}pathComplexity(){return this.path.commands.length}render(e){const{ctx:t}=e;if(this.clip&&!Number.isNaN(this._clipX)&&!Number.isNaN(this._clipY)){t.save();try{const i=this.strokeWidth/2;this._clipPath??(this._clipPath=new pt),this._clipPath.clear(),this._clipPath.rect(-i,-i,this._clipX+i,this._clipY+i+i),t.clip(this._clipPath?.getPath2D()),this._clipX>0&&this._clipY>0&&this.drawPath(t)}finally{t.restore()}}else this._clipPath=void 0,this.drawPath(t);this.fillShadow?.markClean(),super.render(e)}drawPath(e){this.fillStroke(e,this.path.getPath2D())}toSVG(){if(!this.visible)return;const e=Xn("path");e.setAttribute("d",this.svgPathData());const t=this.applySvgFillAttributes(e,[]);return this.applySvgStrokeAttributes(e),{elements:[e],defs:t}}};return s.className="_c$8",m([ye()],s.prototype,"clip",2),m([ye()],s.prototype,"clipX",1),m([ye()],s.prototype,"clipY",1),s})();function Et(s,e,t,i,n){let r=!1,a=!1,o=i-Math.sqrt(Math.max(n**2-t**2,0)),h=0,c=0,l=t-Math.sqrt(Math.max(n**2-i**2,0));return o>s?(r=!0,o=s,h=t-Math.sqrt(Math.max(n**2-(i-s)**2))):ki(o,0)&&(o=0),l>e?(a=!0,c=i-Math.sqrt(Math.max(n**2-(t-e)**2)),l=e):ki(l,0)&&(l=0),{leading0:o,leading1:h,trailing0:c,trailing1:l,leadingClipped:r,trailingClipped:a}}function be(s,e,t,i,n,r,a){let{topLeft:o,topRight:h,bottomRight:c,bottomLeft:l}=r;const d=Math.max(o+l,h+c),u=Math.max(o+h,l+c);if(d<=0&&u<=0){if(a==null)s.rect(e,t,i,n);else{const M=Math.max(e,a.x),C=Math.min(e+i,a.x+a.width),w=Math.max(t,a.y),A=Math.min(t+n,a.y+a.height);s.rect(M,w,C-M,A-w)}return}else if(a==null&&o===h&&o===c&&o===l){s.roundRect(e,t,i,n,o);return}if(i<0&&(e+=i,i=Math.abs(i)),n<0&&(t+=n,n=Math.abs(n)),i<=0||n<=0)return;if(a==null)a=new L(e,t,i,n);else{const M=Math.max(e,a.x),C=Math.min(e+i,a.x+a.width),w=Math.max(t,a.y),A=Math.min(t+n,a.y+a.height);a=new L(M,w,C-M,A-w)}const f=Math.max(d/n,u/i,1);f>1&&(o/=f,h/=f,c/=f,l/=f);let p=!0,g=!0,y=!0,b=!0,x,v,S,_;if(p){const M=Et(a.height,a.width,Math.max(e+o-a.x,0),Math.max(t+o-a.y,0),o);M.leadingClipped&&(b=!1),M.trailingClipped&&(g=!1);const C=Math.max(a.x+M.leading1,a.x),w=Math.max(a.y+M.leading0,a.y),A=Math.max(a.x+M.trailing1,a.x),I=Math.max(a.y+M.trailing0,a.y),D=e+o,B=t+o;x={x0:C,y0:w,x1:A,y1:I,cx:D,cy:B}}if(g){const M=Et(a.width,a.height,Math.max(t+h-a.y,0),Math.max(a.x+a.width-(e+i-h),0),h);M.leadingClipped&&(p=!1),M.trailingClipped&&(y=!1);const C=Math.min(a.x+a.width-M.leading0,a.x+a.width),w=Math.max(a.y+M.leading1,a.y),A=Math.min(a.x+a.width-M.trailing0,a.x+a.width),I=Math.max(a.y+M.trailing1,a.y),D=e+i-h,B=t+h;v={x0:C,y0:w,x1:A,y1:I,cx:D,cy:B}}if(y){const M=Et(a.height,a.width,Math.max(a.x+a.width-(e+i-c),0),Math.max(a.y+a.height-(t+n-c),0),c);M.leadingClipped&&(g=!1),M.trailingClipped&&(b=!1);const C=Math.min(a.x+a.width-M.leading1,a.x+a.width),w=Math.min(a.y+a.height-M.leading0,a.y+a.height),A=Math.min(a.x+a.width-M.trailing1,a.x+a.width),I=Math.min(a.y+a.height-M.trailing0,a.y+a.height),D=e+i-c,B=t+n-c;S={x0:C,y0:w,x1:A,y1:I,cx:D,cy:B}}if(b){const M=Et(a.width,a.height,Math.max(a.y+a.height-(t+n-l),0),Math.max(e+l-a.x,0),l);M.leadingClipped&&(y=!1),M.trailingClipped&&(p=!1);const C=Math.max(a.x+M.leading0,a.x),w=Math.min(a.y+a.height-M.leading1,a.y+a.height),A=Math.max(a.x+M.trailing0,a.x),I=Math.min(a.y+a.height-M.trailing1,a.y+a.height),D=e+l,B=t+n-l;_={x0:C,y0:w,x1:A,y1:I,cx:D,cy:B}}let P=!1;p&&x!=null&&(Ft(s,x,o,!P),P||(P=!0)),g&&v!=null&&(Ft(s,v,h,!P),P||(P=!0)),y&&S!=null&&(Ft(s,S,c,!P),P||(P=!0)),b&&_!=null&&Ft(s,_,l,!P),s.closePath()}var Di=(()=>{var s=class extends yt{constructor(){super(...arguments),this.borderPath=new pt,this.x=0,this.y=0,this.width=10,this.height=10,this.topLeftCornerRadius=0,this.topRightCornerRadius=0,this.bottomRightCornerRadius=0,this.bottomLeftCornerRadius=0,this.clipBBox=void 0,this.crisp=!1,this.lastUpdatePathStrokeWidth=this.__strokeWidth,this.effectiveStrokeWidth=this.__strokeWidth,this.hittester=super.isPointInPath.bind(this),this.distanceCalculator=super.distanceSquaredTransformedPoint.bind(this),this.microPixelEffectOpacity=1}set cornerRadius(e){this.topLeftCornerRadius=e,this.topRightCornerRadius=e,this.bottomRightCornerRadius=e,this.bottomLeftCornerRadius=e}isDirtyPath(){return this.lastUpdatePathStrokeWidth!==this.__strokeWidth||!!(this.path.isDirty()||this.borderPath.isDirty())}updatePath(){const{path:e,borderPath:t,__crisp:i,__topLeftCornerRadius:n,__topRightCornerRadius:r,__bottomRightCornerRadius:a,__bottomLeftCornerRadius:o}=this;let{__x:h,__y:c,__width:l,__height:d,__strokeWidth:u,__clipBBox:f}=this;const g=1/(this.layerManager?.canvas.pixelRatio??1);let y=1;if(e.clear(),t.clear(),l===0||d===0){this.effectiveStrokeWidth=0,this.lastUpdatePathStrokeWidth=0,this.microPixelEffectOpacity=0;return}if(i&&(l<=g&&(y*=l/g),d<=g&&(y*=d/g),l=this.align(h,l),d=this.align(c,d),h=this.align(h),c=this.align(c),f=f==null?void 0:new L(this.align(f.x),this.align(f.y),this.align(f.x,f.width),this.align(f.y,f.height))),u)if(l<g){const x=h+g/2;t.moveTo(x,c),t.lineTo(x,c+d),u=g,this.borderClipPath=void 0}else if(d<g){const x=c+g/2;t.moveTo(h,x),t.lineTo(h+l,x),u=g,this.borderClipPath=void 0}else if(u<l&&u<d){const x=u/2;h+=x,c+=x,l-=u,d-=u;const v=f?.clone().shrink(x),S={topLeft:n>0?n-u:0,topRight:r>0?r-u:0,bottomRight:a>0?a-u:0,bottomLeft:o>0?o-u:0};this.borderClipPath=void 0,l>0&&d>0&&(v==null||v?.width>0&&v?.height>0)&&(be(e,h,c,l,d,S,v),be(t,h,c,l,d,S,v))}else this.borderClipPath=this.borderClipPath??new pt,this.borderClipPath.clear(),this.borderClipPath.rect(h,c,l,d),t.rect(h,c,l,d);else{const x={topLeft:n,topRight:r,bottomRight:a,bottomLeft:o};this.borderClipPath=void 0,be(e,h,c,l,d,x,f)}if([n,r,a,o].every(Un)){let x=function(_,P){return S.getBBox().distanceSquared(_,P)};var b=x;const v=this.getBBox();this.hittester=v.containsPoint.bind(v);const S=this;this.distanceSquared=x}else this.hittester=super.isPointInPath,this.distanceCalculator=super.distanceSquaredTransformedPoint;this.effectiveStrokeWidth=u,this.lastUpdatePathStrokeWidth=u,this.microPixelEffectOpacity=y}computeBBox(){const{__x:e,__y:t,__width:i,__height:n,__clipBBox:r}=this;return r?.clone()??new L(e,t,i,n)}isPointInPath(e,t){return this.hittester(e,t)}get midPoint(){return{x:this.__x+this.__width/2,y:this.__y+this.__height/2}}setStaticProperties(e,t,i,n,r,a,o,h){this.__drawingMode=e,this.__topLeftCornerRadius=t,this.__topRightCornerRadius=i,this.__bottomRightCornerRadius=n,this.__bottomLeftCornerRadius=r,this.__visible=a,this.__crisp=o,this.__fillShadow=h,this.dirtyPath=!0,this.markDirty()}resetAnimationProperties(e,t,i,n,r,a){this.__x=e,this.__y=t,this.__width=i,this.__height=n,this.__opacity=r,this.__clipBBox=a,this.dirtyPath=!0,this.markDirty()}distanceSquared(e,t){return this.distanceCalculator(e,t)}applyFillAndAlpha(e){super.applyFillAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}applyStrokeAndAlpha(e){super.applyStrokeAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}renderStroke(e){const{stroke:t,effectiveStrokeWidth:i}=this;if(t&&i){const{globalAlpha:n}=e,{lineDash:r,lineDashOffset:a,lineCap:o,lineJoin:h,borderPath:c,borderClipPath:l}=this;l&&e.clip(l.getPath2D()),this.applyStrokeAndAlpha(e),e.lineWidth=i,r&&e.setLineDash(r),a&&(e.lineDashOffset=a),o&&(e.lineCap=o),h&&(e.lineJoin=h),e.stroke(c.getPath2D()),e.globalAlpha=n}}};return s.className="_c$9",m([Y()],s.prototype,"x",2),m([Y()],s.prototype,"y",2),m([Y()],s.prototype,"width",2),m([Y()],s.prototype,"height",2),m([Y()],s.prototype,"topLeftCornerRadius",2),m([Y()],s.prototype,"topRightCornerRadius",2),m([Y()],s.prototype,"bottomRightCornerRadius",2),m([Y()],s.prototype,"bottomLeftCornerRadius",2),m([Y({equals:Gn})],s.prototype,"clipBBox",2),m([Y()],s.prototype,"crisp",2),s})();function Un(s){return s===0}var Yn=(()=>{var s=class F extends Pt{constructor(t){super(t),this.generatingTextMap=!1,this.suppressedDirtyDuringGenerate=!1,this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontCache=void 0,this.fontSize=F.defaultFontSize,this.fontFamily="sans-serif",this.textAlign="start",this.textBaseline="alphabetic",this.boxPadding=0,this.trimText=t?.trimText??!0}onTextChange(){if(this.richText?.clear(),this.textMap?.clear(),this.segmentMetrics=void 0,rt(this.text)){this.lines=[],this.richText??(this.richText=new G),this.richText.parentNode=this,this.richText.setScene(this.scene);const t=[];for(const i of this.text)if(i.type==="image")t.push(new qn);else for(const n of ft(i.text).split(Kt))n&&t.push(new F({trimText:!1}));this.richText.append(t)}else{this.richText&&(this.richText.parentNode=void 0,this.richText.setScene(),this.richText=void 0);const t=ft(this.text).split(Kt);this.lines=this.trimText?t.map(i=>i.trim()):t}}get font(){return this.fontCache??(this.fontCache=Ss(this)),this.fontCache}resolveFont(){if(this.hasRenderableText())return this.font}static measureBBox(t,i,n,r){if(rt(t)){const{font:a,lineHeight:o,textAlign:h,textBaseline:c}=r,{width:l,height:d,lineMetrics:u}=je(t,a),f=o?o*u.length:d,p=F.calcTopOffset(f,u[0],c),g=F.calcLeftOffset(l,h);return new L(i-g,n-p,l,f)}else return F.computeBBox(ft(t).split(Kt),i,n,r)}static computeBBox(t,i,n,r){const{font:a,lineHeight:o,textAlign:h,textBaseline:c,isRtl:l}=r,{width:d,height:u,lineMetrics:f}=Qt(a).measureLines(t),p=o?o*f.length:u,g=F.calcTopOffset(p,f[0],c),y=F.calcLeftOffset(d,h,l);return new L(i-y,n-g,d,p)}static calcTopOffset(t,i,n){switch(n){case"alphabetic":return i?.ascent??0;case"middle":return t/2;case"bottom":return t;default:return 0}}static calcSegmentedTopOffset(t,i,n){switch(n){case"alphabetic":return i[0]?.ascent??0;case"middle":{const r=i[0];return i.length===1&&r.segments.length>0&&!r.blockImages?.length&&r.segments.every(o=>o.type!=="image")?r.ascent+r.segments.reduce((o,h)=>h.type==="image"?o:Math.min(o,Qt(h).baselineDistance("middle")),0):t/2}case"bottom":return t;default:return 0}}static calcLeftOffset(t,i,n){let r=0;switch(i){case"center":r=.5;break;case"right":case(n?"start":"end"):r=1}return t*r}getBBox(){const t=super.getBBox();if(!this.textMap?.size||!rt(this.text))return t;const{height:i,lineMetrics:n}=this.getSegmentMetrics(this.text),r=F.calcSegmentedTopOffset(i,n,this.textBaseline),a=this.y-r;return t.y===a?t:new L(t.x,a,t.width,t.height)}computeBBox(){if(!this.hasRenderableText())return new L(this.x,this.y,0,0);if(this.generateTextMap(),this.textMap?.size){const c=L.merge(this.textMap.values());return c.x=this.x-F.calcLeftOffset(c.width,this.textAlign),c.y=this.y,c}const t=this.scene?.isRtl,{x:i,y:n,lines:r,textBaseline:a,textAlign:o}=this,h=F.computeBBox(r,i,n,{font:this,textBaseline:a,textAlign:o,isRtl:t});return this.boxing!=null&&h.grow(this.boxPadding),h}getTextMeasureBBox(){return this.computeBBox()}getPlainText(){return Ps(this.text)}isPointInPath(t,i){return this.getBBox()?.containsPoint(t,i)??!1}setScene(t){this.richText?.setScene(t),super.setScene(t)}generateTextMap(){if(!(!rt(this.text)||this.textMap?.size)){this.textMap??(this.textMap=new Map),this.generatingTextMap=!0,this.suppressedDirtyDuringGenerate=!1;try{this.buildTextMap(this.text)}finally{this.generatingTextMap=!1,this.suppressedDirtyDuringGenerate&&(this.suppressedDirtyDuringGenerate=!1,super.markDirty())}}}getSegmentMetrics(t){return this.segmentMetrics??(this.segmentMetrics=je(t,this)),this.segmentMetrics}buildTextMap(t){const i=this.richText.children(),{width:n,lineMetrics:r}=this.getSegmentMetrics(t),a=this.x-n/2;let o=0;for(let h=0;h<r.length;){const c=r[h];if(c.blockImages?.length){const l=c.blockRowSpan??1,d=this.layoutBlockRow(r,h,l,o,a,i);if(d==null)return;o=d,h+=l;continue}o=this.renderLine(c,this.x-c.width/2,o,i),h+=1}}layoutBlockRow(t,i,n,r,a,o){const h=t[i].blockImages,c=xs(h),l=bs(h);let d=0;for(let b=0;b<n;b++)d+=t[i+b].height;const u=Math.max(l,d);let f=a;for(let b=0;b<h.length;b++){const x=h[b],v=x.textMetrics,S=kt(x.verticalAlign)??"middle",_=F.calcAnchoredOffset(S,u,v.height),P=o.next().value;if(!P)return this.abandonTextMap(),null;F.applyImageSegment(P,x,f,r+_),this.textMap.set(P,P.getBBox()),f+=v.width+(b<h.length-1?Ue:0)}const p=F.findFirstTextSegment(t,i,n),g=a+c+Ue;let y=r+F.calcAnchoredOffset(kt(p?.verticalAlign)??"alphabetic",u,d);for(let b=0;b<n;b++)y=this.renderLine(t[i+b],g,y,o);return r+u}static findFirstTextSegment(t,i,n){for(let r=0;r<n;r++){const a=t[i+r].segments.find(o=>o.type!=="image");if(a)return a}}renderLine(t,i,n,r){const{height:a,ascent:o,textAscent:h,textDescent:c,segments:l}=t,d=n+o;let u=0;for(const f of l){const p=r.next().value;if(!p)return this.abandonTextMap(),n+a;if(f.type==="image"){const P=f.textMetrics.width,M=f.textMetrics.height,{above:C}=vs(kt(f.verticalAlign),M,h,c),w=p;F.applyImageSegment(w,f,i+u,d-C),this.textMap.set(w,w.getBBox()),u+=P;continue}const{color:g,textMetrics:y,verticalAlign:b,...x}=f,v=p,S=kt(b)??"alphabetic";v.x=i+u,v.y=F.calcSegmentY(S,n,o,a),v.setProperties({...x,textBaseline:S,fill:g??this.fill});const _=v.getBBox();this.textMap.set(v,_),u+=y.width}return n+a}abandonTextMap(){this.textMap?.clear(),this.segmentMetrics=void 0}static calcAnchoredOffset(t,i,n){const r=Math.max(0,i-n);switch(t){case"middle":return r/2;case"bottom":case"ideographic":case"alphabetic":return r;case"top":case"hanging":default:return 0}}static applyImageSegment(t,i,n,r){const{top:a,right:o,bottom:h,left:c}=Ms(i.padding);t.x=n,t.y=r,t.boxWidth=i.textMetrics.width,t.boxHeight=i.textMetrics.height,t.imageWidth=i.width,t.imageHeight=i.height,t.paddingTop=a,t.paddingRight=o,t.paddingBottom=h,t.paddingLeft=c,t.cornerRadius=i.cornerRadius??0,t.backgroundFill=i.backgroundFill,t.url=i.url}static calcSegmentY(t,i,n,r){switch(t){case"top":case"hanging":return i;case"middle":return i+r/2;case"bottom":case"ideographic":return i+r;case"alphabetic":default:return i+n}}render(t){const{ctx:i,stats:n}=t;if(!this.layerManager||!this.hasRenderableText()){n&&(n.nodesSkipped+=1);return}if(rt(this.text)&&this.richText){this.generateTextMap();const r=this.richText.getBBox(),{width:a,height:o,lineMetrics:h}=this.getSegmentMetrics(this.text);let c=0;switch(this.textAlign){case"left":case"start":c=a/2;break;case"right":case"end":c=a/-2}const l=this.y-F.calcSegmentedTopOffset(o,h,this.textBaseline);this.renderBoxing(t,r.clone().translate(c,l)),i.save(),i.translate(c,l),this.richText.opacity=this.opacity,this.richText.render(t),i.restore()}else this.renderText(t);if(F.debug.check()){const r=this.getBBox();i.lineWidth=this.textMap?.size?2:1,i.strokeStyle=this.textMap?.size?"blue":"red",i.strokeRect(r.x,r.y,r.width,r.height)}super.render(t)}markDirty(t){if(this.generatingTextMap){this.suppressedDirtyDuringGenerate=!0;return}return this.textMap?.clear(),this.segmentMetrics=void 0,super.markDirty(t)}renderText(t){const{fill:i,stroke:n,strokeWidth:r,font:a,textAlign:o}=this;if(!i&&!(n&&r)||!this.layerManager)return super.render(t);const{ctx:h}=t;t.currentFont!==a&&(h.font=a,t.currentFont=a),h.textAlign=o,this.renderBoxing(t),this.fillStroke(h)}renderBoxing(t,i){if(!this.boxing)return;const n=i??F.computeBBox(this.lines,this.x,this.y,this);if(n.width===0||n.height===0)return;const{x:r,y:a,width:o,height:h}=n.grow(this.boxPadding);this.boxing.opacity=this.opacity,this.boxing.x=r,this.boxing.y=a,this.boxing.width=o,this.boxing.height=h,this.boxing.preRender(t),this.boxing.render(t)}executeFill(t){this.renderLines((i,n,r)=>t.fillText(i,n,r))}executeStroke(t){this.renderLines((i,n,r)=>t.strokeText(i,n,r))}renderLines(t){const{x:i,y:n,lines:r}=this;if(!Number.isFinite(i)||!Number.isFinite(n))return;const a=Qt(this),{lineMetrics:o}=a.measureLines(r),{textBaseline:h,lineHeight:c=a.lineHeight()}=this;let l=0;h==="top"?l=o[0].ascent:(h==="middle"||h==="bottom")&&(l=c*(1-r.length),h==="middle"?(l/=2,l-=a.baselineDistance(h)):l-=o[0].descent);for(const d of o)t(d.text,i,n+l),l+=c}setFont(t){this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,this.fontStyle=t.fontStyle,this.fontWeight=t.fontWeight}setAlign(t){this.textAlign=t.textAlign,this.textBaseline=t.textBaseline}setBoxing(t){const i=t.border?.enabled?t.border?.stroke:void 0;t.fill!=null||i!=null?(this.boxing??(this.boxing=new Di({scene:this.scene})),this.boxing.fill=t.fill,this.boxing.fillOpacity=t.fillOpacity??1,this.boxing.cornerRadius=t.cornerRadius??0,this.boxing.stroke=i,this.boxing.strokeWidth=t.border?.strokeWidth??0,this.boxing.strokeOpacity=t.border?.strokeOpacity??1,this.boxPadding=t.padding??0):this.boxing&&(this.boxing.destroy(),this.boxing=void 0)}hasBoxing(){return this.boxing!=null}getBoxingProperties(){const{fill:t,fillOpacity:i,cornerRadius:n,stroke:r,strokeWidth:a,strokeOpacity:o}=this.boxing??{};return{border:{enabled:r!=null,stroke:r,strokeWidth:a,strokeOpacity:o},cornerRadius:n,fill:t,fillOpacity:i,padding:this.boxPadding}}toSVG(){if(!this.visible||!this.hasRenderableText())return;const t=this.text;if(t==null)return;const i=Ye("text");if(rt(t))for(const n of t){if(n.type==="image"){ms.warnOnce("SVG export drops inline image segments; text content is preserved.");continue}const r=Ye("tspan");xi(r,{fontSize:n.fontSize??this.fontSize,fontFamily:n.fontFamily??this.fontFamily,fontWeight:n.fontWeight??this.fontWeight,fontStyle:n.fontStyle??this.fontStyle}),this.applySvgFillAttributes(r),r.textContent=ft(n.text),i.append(r)}else this.applySvgFillAttributes(i),xi(i,this),i.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),i.setAttribute("alignment-baseline",this.textBaseline),i.setAttribute("x",String(this.x)),i.setAttribute("y",String(this.y)),i.textContent=ft(t);return{elements:[i]}}hasRenderableText(){const{text:t}=this;return t==null?!1:rt(t)?t.length>0:ft(t)!==""}};return s.className="Text",s.debug=gs.create(!0,"scene:text"),s.defaultFontSize=10,m([T()],s.prototype,"x",2),m([T()],s.prototype,"y",2),m([ys({changeCb:e=>e.onTextChange()})],s.prototype,"text",2),m([T({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontStyle",2),m([T({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontWeight",2),m([T({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontSize",2),m([T({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontFamily",2),m([T()],s.prototype,"textAlign",2),m([T()],s.prototype,"textBaseline",2),m([T()],s.prototype,"lineHeight",2),s})(),Ni=Yn,jn=Ct(Ni),Aa=Ct(At(Ni)),Hn=(()=>{var s=class extends Be{};return m([E],s.prototype,"visible",2),m([E],s.prototype,"text",2),m([E],s.prototype,"renderer",2),s})(),Vn=(()=>{var s=class extends Be{constructor(){super(...arguments),this.id=ts(this),this.node=new jn({zIndex:1}).setProperties({textAlign:"center",pointerEvents:1}),this.enabled=!1,this.textAlign="center",this.fontSize=Ki.SMALLER,this.fontFamily="sans-serif",this.wrapping="always",this.truncate=!0,this.padding=0,this.layoutStyle="block",this.tooltip=new Hn,this.truncated=!1}registerInteraction(e,t){return e.eventsHub.on("layout:complete",()=>this.updateA11yText(e,t))}computeTextWrap(e,t){const{text:i,padding:n,wrapping:r,truncate:a}=this,o=a?e:1/0,h=a?t:1/0,c=Math.min(this.maxWidth??1/0,o)-n*2,l=this.maxHeight??h-n*2,d={maxWidth:c,maxHeight:l,font:this,textWrap:r};if(!Number.isFinite(c)&&!Number.isFinite(l)){this.node.text=i;return}let u;es(i)?(u=rs(i,d),this.truncated=u.some(is)):(u=ns($e(i),d),this.truncated=ss(u)),this.node.text=u}updateA11yText(e,t){const{proxyInteractionService:i}=e;if(!this.enabled||!this.text){this.destroyProxyText();return}const n=ct.toCanvas(this.node);if(!n)return;const{id:r}=this;this.proxyText==null&&(this.proxyText=i.createProxyElement({type:"text",domManagerId:r,where:t}),this.proxyTextListeners=[this.proxyText.addListener("mousemove",h=>this.handleMouseMove(e,h)),this.proxyText.addListener("mouseleave",()=>this.handleTooltipHide(e)),this.proxyText.addListener("focus",()=>this.handleFocus(e)),this.proxyText.addListener("blur",()=>this.handleTooltipHide(e))]);const a=ze(this.text);a!==this.lastProxyTextContent&&(this.proxyText.textContent=a,this.lastProxyTextContent=a);const{lastProxyBBox:o}=this;(n.x!==o?.x||n.y!==o?.y||n.width!==o?.width||n.height!==o?.height)&&(this.proxyText.setBounds(n),this.lastProxyBBox={x:n.x,y:n.y,width:n.width,height:n.height})}getEffectiveTooltipVisible(){const{visible:e,text:t,renderer:i}=this.tooltip;return e??(t!=null||i!=null?"always":"auto")}getTooltipContent(e){const t=ze(this.text),{renderer:i,text:n}=this.tooltip;if(i!=null){const a={text:t},o=Qi(e.chartService,i,a);if(o==="")return;if(o!=null)return{type:"raw",rawHtmlString:$e(o)}}return{type:"structured",title:n??t}}showTooltip(e,t,i){if(!this.enabled)return;const n=this.getEffectiveTooltipVisible();if(n==="never"||n==="auto"&&!this.truncated)return;const r=this.getTooltipContent(e);r!=null&&e.tooltipManager.updateTooltip(this.id,{canvasX:t,canvasY:i,showArrow:!1},[r])}handleMouseMove(e,t){if(t==null)return;const{x:i,y:n}=ct.toCanvas(this.node),r=t.sourceEvent.offsetX+i,a=t.sourceEvent.offsetY+n;this.showTooltip(e,r,a)}handleFocus(e){const t=ct.toCanvas(this.node);if(!t)return;const i=t.x+t.width/2,n=t.y+t.height/2;this.showTooltip(e,i,n)}handleTooltipHide(e){e.tooltipManager.removeTooltip(this.id,void 0,!0)}destroy(){this.destroyProxyText()}destroyProxyText(){if(this.proxyText!=null){for(const e of this.proxyTextListeners??[])e();this.proxyTextListeners=void 0,this.proxyText.destroy(),this.proxyText=void 0,this.lastProxyTextContent=void 0,this.lastProxyBBox=void 0}}};return s.className="_c$12",m([E,K("node","visible")],s.prototype,"enabled",2),m([E,K("node")],s.prototype,"text",2),m([E,K("node")],s.prototype,"textAlign",2),m([E,K("node")],s.prototype,"fontStyle",2),m([E,K("node")],s.prototype,"fontWeight",2),m([E,K("node")],s.prototype,"fontSize",2),m([E,K("node")],s.prototype,"fontFamily",2),m([E,K("node","fill")],s.prototype,"color",2),m([E],s.prototype,"spacing",2),m([E],s.prototype,"maxWidth",2),m([E],s.prototype,"maxHeight",2),m([E],s.prototype,"wrapping",2),m([E],s.prototype,"truncate",2),m([E],s.prototype,"padding",2),m([E],s.prototype,"layoutStyle",2),m([E],s.prototype,"tooltip",2),s})();import{DeclaredSceneChangeDetection as xe,DeclaredSceneObjectChangeDetection as Zn,TRIPLE_EQ as Jn}from"ag-charts-core";import{toRadians as Bt}from"ag-charts-core";function zt(s,e){const{path:t,size:i}=s,{x:n,y:r}=s;t.clear();let a=!1;for(const[o,h]of e){const c=n+(o-.5)*i,l=r+(h-.5)*i;a?t.lineTo(c,l):t.moveTo(c,l),a=!0}t.closePath()}var Kn={circle({path:s,x:e,y:t,size:i}){const n=i/2;s.arc(e,t,n,0,Math.PI*2),s.closePath()},cross(s){zt(s,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},diamond(s){zt(s,[[.5,0],[1,.5],[.5,1],[0,.5]])},heart({path:s,x:e,y:t,size:i}){const n=i/4;t=t+n/2,s.arc(e-n,t-n,n,Bt(130),Bt(330)),s.arc(e+n,t-n,n,Bt(220),Bt(50)),s.lineTo(e,t+n),s.closePath()},pin({path:s,x:e,y:t,size:i}){s.moveTo(e+(.891-.5)*i,t+(.391-.5)*i),s.cubicCurveTo(e+(.891-.5)*i,t+(.606-.5)*i,e+(.5-.5)*i,t+(1-.5)*i,e+(.5-.5)*i,t+(1-.5)*i),s.cubicCurveTo(e+(.5-.5)*i,t+(1-.5)*i,e+(.109-.5)*i,t+(.606-.5)*i,e+(.109-.5)*i,t+(.391-.5)*i),s.cubicCurveTo(e+(.109-.5)*i,t+(.175-.5)*i,e+(.284-.5)*i,t+(0-.5)*i,e+(.5-.5)*i,t+(0-.5)*i),s.cubicCurveTo(e+(.716-.5)*i,t+(0-.5)*i,e+(.891-.5)*i,t+(.175-.5)*i,e+(.891-.5)*i,t+(.391-.5)*i),s.closePath()},plus(s){zt(s,[[1/3,0],[2/3,0],[2/3,1/3],[1,1/3],[1,2/3],[2/3,2/3],[2/3,1],[1/3,1],[1/3,2/3],[0,2/3],[0,1/3],[1/3,1/3]])},square({path:s,x:e,y:t,size:i}){const n=i/2;s.moveTo(e-n,t-n),s.lineTo(e+n,t-n),s.lineTo(e+n,t+n),s.lineTo(e-n,t+n),s.closePath()},star({path:s,x:e,y:t,size:i}){const r=i/2,a=r/2,o=Math.PI/2;for(let h=0;h<5*2;h++){const c=h%2===0?r:a,l=h*Math.PI/5-o,d=e+Math.cos(l)*c,u=t+Math.sin(l)*c;s.lineTo(d,u)}s.closePath()},triangle(s){zt(s,[[.5,0],[1,.87],[0,.87]])}},Ai=1024,$t=new Map,Ri=new WeakMap;function ve(s,e,t){const i=new pt,n={path:i,x:0,y:0,size:e,pixelRatio:t};return typeof s=="string"?Kn[s](n):s(n),i}function Qn(s,e,t=1){if(typeof s=="string"){const i=`${s}:${e}`;let n=$t.get(i);return n===void 0&&($t.size>=Ai&&$t.clear(),n=ve(s,e,1),$t.set(i,n)),n}if(typeof s=="function"){let i=Ri.get(s);i===void 0&&(i=new Map,Ri.set(s,i));const n=`${e}:${t}`;let r=i.get(n);return r===void 0&&(i.size>=Ai&&i.clear(),r=ve(s,e,t),i.set(n,r)),r}return ve("square",e,t)}var tr=Object.freeze({x:.5,y:1}),er=Object.freeze({x:.5,y:.5}),_t=new L(0,0,0,0),wt=new L(0,0,0,0),ir=(()=>{var s=class extends yt{constructor(){super(...arguments),this.shape="square",this.x=0,this.y=0,this.size=12}onChangeDetection(e){if(e==="__x"||e==="__y"){this.markDirty(e);return}super.onChangeDetection(e)}isPointInPath(e,t){return this.distanceSquaredLocal(e,t)<=0}isPointInSharedPath(e,t){if(!this._sharedPath?.closedPath)return!1;const i=bt.anchor(this.shape),n=e-this.x+(i.x-.5)*this.size,r=t-this.y+(i.y-.5)*this.size;return this._sharedPath.isPointInPath(n,r)}get midPoint(){return{x:this.x,y:this.y}}distanceSquared(e,t){return this.distanceSquaredLocal(e,t)}distanceSquaredLocal(e,t){const i=bt.anchor(this.shape),n=e-this.x+(i.x-.5)*this.size,r=t-this.y+(i.y-.5)*this.size,a=this.size/2;return Math.max(n*n+r*r-a*a,0)}pathComplexity(){return this._sharedPath?.commands.length??0}updatePath(){const{shape:e,size:t}=this;if(e==null||!(t>0)){this._sharedPath=void 0;return}const i=this.layerManager?.canvas?.pixelRatio??1,n=e==="square"?q(i,t):t;this._sharedPath=Qn(e,n,i)}computeBBox(){const{x:e,y:t,size:i}=this,n=bt.anchor(this.shape);return new L(e-i*n.x,t-i*n.y,i,i)}drawPath(e){if(this._sharedPath===void 0)return;const{shape:t,x:i,y:n,size:r}=this,a=bt.anchor(t),o=i-(a.x-.5)*r,h=n-(a.y-.5)*r,c=this.layerManager?.canvas?.pixelRatio??1,l=(t==="square"?q(c,r):r)/2,d=t==="square"?q(c,o-l)+l:o,u=t==="square"?q(c,h-l)+l:h,f=super.getBBox();_t.x=f.x-d,_t.y=f.y-u,_t.width=f.width,_t.height=f.height;let p;const g=this.__fillBBox;g&&(wt.x=g.x-d,wt.y=g.y-u,wt.width=g.width,wt.height=g.height,p=wt),e.save(),e.translate(d,u);try{this.fillStroke(e,this._sharedPath.getPath2D(),_t,p)}finally{e.restore()}}svgPathData(e){if(this.updatePathIfDirty(),this._sharedPath===void 0)return"";const{shape:t,x:i,y:n,size:r}=this,a=bt.anchor(t),o=i-(a.x-.5)*r,h=n-(a.y-.5)*r;return e?this._sharedPath.toSVG((c,l)=>e(c+o,l+h)):this._sharedPath.toSVG((c,l)=>({x:c+o,y:l+h}))}executeFill(e,t){if(t)return super.executeFill(e,t)}executeStroke(e,t){if(t)return super.executeStroke(e,t)}};return m([Zn({equals:Jn})],s.prototype,"shape",2),m([xe()],s.prototype,"x",2),m([xe()],s.prototype,"y",2),m([xe({convertor:Math.abs})],s.prototype,"size",2),s})(),bt=class extends Ct(Pi(At(ir))){static anchor(s){return s==="pin"?tr:typeof s=="function"&&"anchor"in s?s.anchor:er}constructor(s){super(s),s?.shape!=null&&(this.shape=s.shape)}resetAnimationProperties(s,e,t,i,n,r){const a=this.__size!==t;this.__x=s,this.__y=e,this.__size=t,this.__opacity=i,this.resetScalingProperties(n,r,s,e),a&&(this.dirtyPath=!0),this.markDirty()}setVisibilityAndPosition(s,e,t,i){let n=!1,r=!1;this.__visible!==s&&(this.__visible=s,n=!0),this.__shape!==e&&(this.__shape=e,n=!0,r=!0);const a=Math.abs(t);if(this.__size!==a&&(this.__size=a,n=!0,r=!0),i){const{x:o,y:h}=i;this.__x!==o&&(this.__x=o,n=!0),this.__y!==h&&(this.__y=h,n=!0),this.__scalingCenterX!==o&&(this.__scalingCenterX=o,n=!0),this.__scalingCenterY!==h&&(this.__scalingCenterY=h,n=!0)}n&&(r&&(this.dirtyPath=!0),this.markDirty())}};import{clamp as Ii,dateToNumber as Me,previousPowerOf2 as Li}from"ag-charts-core";import{Logger as sr,clamp as Wt}from"ag-charts-core";var nr=(()=>{var s=class Hi extends oe{constructor(){super(...arguments),this.invalid=!0,this.range=[0,1],this.round=!1,this._bandwidth=1,this._step=1,this._inset=1,this._rawBandwidth=1,this._paddingInner=0,this._paddingOuter=0}static is(t){return t instanceof Hi}get bandwidth(){return this.refresh(),this._bandwidth}get step(){return this.refresh(),this._step}get inset(){return this.refresh(),this._inset}get rawBandwidth(){return this.refresh(),this._rawBandwidth}set padding(t){t=Wt(0,t,1),this._paddingInner=t,this._paddingOuter=t}get padding(){return this._paddingInner}set paddingInner(t){this.invalid=!0,this._paddingInner=Wt(0,t,1)}get paddingInner(){return this._paddingInner}set paddingOuter(t){this.invalid=!0,this._paddingOuter=Wt(0,t,1)}get paddingOuter(){return this._paddingOuter}getBandCountForUpdate(){return this.bands.length}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&sr.warnOnce("Expected update to not invalidate scale"))}convert(t,i){this.refresh();const n=this.findIndex(t,i?.alignment,i?.alignmentExclusive);return n==null||n<0||n>=this.getBandCountForUpdate()?Number.NaN:this.ordinalRange(n)}getDomainMinMax(){return he(this.domain)}invertNearestIndex(t,i="center"){this.refresh();const n=this.getBandCountForUpdate();if(n===0)return-1;let r=0,a=n-1,o=1/0,h=0;for(;r<=a;){const c=Math.trunc((a+r)/2),l=this.ordinalRange(c),d=l-t;if(d===0)return c;(i==="center"||d<0)&&Math.abs(d)<o&&(o=Math.abs(d),h=c),l<t?r=c+1:a=c-1}return h}update(){const[t,i]=this.range;let{_paddingInner:n}=this;const{_paddingOuter:r}=this,a=this.getBandCountForUpdate();if(a===0)return;const o=i-t;let h;a===1?(n=0,h=o*(1-r*2)):h=o/Math.max(1,a-n+r*2);const c=this.round&&Math.floor(h)>0,l=c?Math.floor(h):h;let d=t+(o-l*(a-n))/2,u=l*(1-n);c&&(d=Math.round(d),u=Math.round(u)),this._step=l,this._inset=d,this._bandwidth=u,this._rawBandwidth=h*(1-n)}ordinalRange(t){const{_inset:i,_step:n,range:r}=this,a=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return Wt(a,i+n*t,o)}};return m([St],s.prototype,"range",2),m([St],s.prototype,"round",2),s})(),rr=nr,ar=class Vi extends rr{constructor(){super(...arguments),this.type="category",this.defaultTickCount=0,this.index=new Map,this.indexInitialized=!1,this._domain=[]}static is(e){return e instanceof Vi}set domain(e){this._domain!==e&&(this.invalid=!0,this._domain=e,this.index.clear(),this.indexInitialized=!1)}get domain(){return this._domain}get bands(){return this._domain}normalizeDomains(...e){let t;const i=new Set;let n=!0;for(const r of e){const a=r.domain;i.has(a)||(i.add(a),t==null?t=Oi(a):(n&&(n=or(a,t)),t=Oi([...t,...a])))}return t??(t=[]),{domain:t,animatable:n}}toDomain(e){}invert(e,t=!1){this.refresh();const i=t?this.bandwidth/2:0,n=this.invertNearestIndex(Math.max(0,e-i));return t||e===this.ordinalRange(n)?this.domain[n]:void 0}invertWithPercentage(e){this.refresh();const t=this.invertNearestIndex(e,"left"),i=this.domain[t];if(i==null)return;const n=this.bandwidth===0?this.step:this.bandwidth,r=this.convert(i),a=n===0?0:(e-r)/n;return{value:i,groupPercentage:a}}ticks(e,t=this.domain,i){const{bands:n}=this;let{tickCount:r}=e;if(r===0){const g=n.length>1?1:0;return{ticks:n[g]?[n[g]]:[],count:void 0,firstTickIndex:g}}let a=r!=null&&r!==0?Math.trunc(n.length/r):1;if(a=Li(a),a<=1)return $s(t,!1,i);r=Math.trunc(n.length/a);const o=a*r,h=Li(Math.trunc((n.length-o)/2)),c=Ii(0,Math.floor((i?.[0]??0)*n.length),n.length),l=Ii(0,Math.ceil((i?.[1]??1)*n.length),n.length),d=Math.floor((c-h)/a)*a+h,u=Math.ceil((l-h)/a)*a+h,f=[];for(let g=d;g<u;g+=a)g>=0&&g<n.length&&f.push(n[g]);let p=f.length>0?this.findIndex(f[0]):void 0;return p!=null&&(p=Math.floor((p-h)/a)),{ticks:f,count:void 0,firstTickIndex:p}}findIndex(e){const{index:t,indexInitialized:i}=this;if(!i){const{domain:n}=this;for(let r=0;r<n.length;r++)t.set(Me(n[r]),r);this.indexInitialized=!0}return t.get(Me(e))}};function Oi(s){let e;const t=new Set;for(const i of s){const n=Me(i),r=t.size;t.add(n),t.size!==r?e?.push(i):e??(e=s.slice(0,t.size))}return e??s}function or(s,e){let t=-1;for(const i of s){const n=e.indexOf(i);if(n===-1)t=1/0;else{if(n<=t)return!1;t=n}}return!0}import{createBigIntTicks as hr,createTicks as cr,isBigInt as Se,isDenseInterval as lr,niceBigIntDomain as dr,niceTicksDomain as ur,range as fr,tickStep as pr}from"ag-charts-core";import{findMinMax as gr,maxValue as Fi,minValue as Ei,toNumber as mr}from"ag-charts-core";var yr=(()=>{var s=class we extends oe{constructor(t=[],i=[]){super(),this.range=i,this.defaultTickCount=we.defaultTickCount,this.defaultClamp=!1,this._domain=[],this.domainNeedsValueOf=!0,this.d0Cache=Number.NaN,this.d1Cache=Number.NaN,this.d0Big=void 0,this.d1Big=void 0,this.domain=t}static is(t){return t instanceof we}get domain(){return this._domain}set domain(t){if(!t||t.length<2){this._domain=Pe(t),this.d0Big=this.d1Big=void 0,this.d0Cache=Number.NaN,this.d1Cache=Number.NaN;return}const i=t[0],n=t[1];if(typeof i=="bigint"||typeof n=="bigint"){this.d0Big=typeof i=="bigint"?i:void 0,this.d1Big=typeof n=="bigint"?n:void 0,this.domainNeedsValueOf=!1,this.d0Cache=Number(i),this.d1Cache=Number(n),this._domain=Pe(t);return}this.d0Big=this.d1Big=void 0,this._domain=Pe(t),this.domainNeedsValueOf=i!=null&&typeof i=="object",this.domainNeedsValueOf?(this.d0Cache=i.valueOf(),this.d1Cache=n.valueOf()):(this.d0Cache=Number(i),this.d1Cache=Number(n))}normalizeDomains(...t){return xr(...t)}calcBandwidth(t=1,i=1){const{domain:n}=this,r=this.getPixelRange();if(n.length===0)return r;let o=Math.abs(this.d1Cache-this.d0Cache)/Number(t)+1;if(i!==0){const h=Math.floor(r);o=Math.min(o,h)}return r/Math.max(1,o)}convert(t,i){const{domain:n}=this;if(!n||n.length<2||t==null)return Number.NaN;const{range:r}=this,a=i?.clamp??this.defaultClamp;if(this.d0Big!=null&&this.d1Big!=null&&this.transform==null&&(typeof t=="bigint"||typeof t=="number"&&Number.isFinite(t)))return br(t,this.d0Big,this.d1Big,r,a);let o=this.d0Cache,h=this.d1Cache,c;if(typeof t=="number"?c=t:typeof t=="bigint"?c=Number(t):c=t.valueOf(),this.transform&&(o=this.transform(o),h=this.transform(h),c=this.transform(c)),a){const[d,u]=gr([o,h]);if(c<d)return r[0];if(c>u)return r[1]}if(o===h)return(r[0]+r[1])/2;if(c===o)return r[0];if(c===h)return r[1];const l=r[0];return l+(c-o)/(h-o)*(r[1]-l)}convertClamped(t){const{d0Big:i,d1Big:n}=this;if(typeof t=="bigint"&&i!=null&&n!=null){const c=Ei(i,n),l=Fi(i,n);return this.convert(Ei(l,Fi(c,t)))}const{d0Cache:r,d1Cache:a}=this,o=Math.min(r,a),h=Math.max(r,a);return this.convert(Math.min(h,Math.max(o,mr(t))))}invert(t,i){const{domain:n}=this;if(n.length<2)return;let r=this.d0Cache,a=this.d1Cache;this.transform&&(r=this.transform(r),a=this.transform(a));const{range:o}=this,[h,c]=o;let l;return h===c?l=this.toDomain((r+a)/2):l=this.toDomain(r+(t-h)/(c-h)*(a-r)),this.transformInvert?this.transformInvert(l):l}getDomainMinMax(){return he(this.domain)}snapshotDomain(){const t=this._domain.slice();return this.d0Big!=null&&(t[0]=this.d0Big),this.d1Big!=null&&(t[1]=this.d1Big),t}exactEndpoint(t){return(t===0?this.d0Big:this.d1Big)??this._domain[t]}startIsMin(){return this.exactEndpoint(0)<=this.exactEndpoint(1)}get domainMin(){return this._domain.length<2?this._domain.at(0):this.exactEndpoint(this.startIsMin()?0:1)}get domainMax(){return this._domain.length<2?this._domain.at(0):this.exactEndpoint(this.startIsMin()?1:0)}getPixelRange(){const[t,i]=this.range;return Math.abs(i-t)}};return s.defaultTickCount=5,s})(),qt=yr;function Pe(s){return s.map(e=>typeof e=="bigint"?Number(e):e)}var Bi=10n**12n;function br(s,e,t,i,n){const r=i[0],a=i[1];if(n){const u=e<t?e:t,f=e<t?t:e;if(s<u)return r;if(s>f)return a}if(e===t)return(r+a)/2;let o,h=0;if(typeof s=="number"){const u=Math.trunc(s);o=BigInt(u),h=s-u}else o=s;if(h===0){if(o===e)return r;if(o===t)return a}const c=t-e,l=(o-e)*Bi/c,d=Number(l)/Number(Bi)+h/Number(c);return r+d*(a-r)}function xr(...s){let e,t;for(const i of s)for(const n of i.domain)(e===void 0||n<e)&&(e=n),(t===void 0||n>t)&&(t=n);return e!=null&&t!=null?{domain:[e,t],animatable:!0}:{domain:[],animatable:!1}}var vr=class Te extends qt{constructor(){super([0,1],[0,1]),this.type="number"}static is(e){return e instanceof Te}static getTickStep(e,t,i){const{interval:n,tickCount:r=qt.defaultTickCount,minTickCount:a,maxTickCount:o}=i;return n==null?pr(e,t,r,a,o):Number(n)}toDomain(e){return Se(this.domainMin)&&Se(this.domainMax)&&(Se(e)||Number.isInteger(e))?BigInt(e):e}ticks({interval:e,tickCount:t=qt.defaultTickCount,minTickCount:i,maxTickCount:n},r=this.domain,a){if(!r||r.length<2||t<1)return{ticks:[],count:0,firstTickIndex:0};const[o,h]=r,c=typeof o=="bigint"&&typeof h=="bigint",l=a==null||a[0]===0&&a[1]===1;if(c&&!e&&l){const p=hr(o,h,t);return{ticks:p,count:p.length,firstTickIndex:0}}const d=r.map(Number);if(!d.every(Number.isFinite))return{ticks:[],count:0,firstTickIndex:0};const[u,f]=d;if(e){const p=Math.abs(Number(e));if(!lr((f-u)/p,this.getPixelRange()))return fr(u,f,p,a)}return cr(u,f,t,i,n,a)}niceDomain(e,t=this.domain){if(t.length<2)return[];const{tickCount:i=qt.defaultTickCount}=e,[n,r]=t;if(typeof n=="bigint"&&typeof r=="bigint"&&e.interval==null){const[l,d]=dr(n,r,i);return[e.nice[0]?l:n,e.nice[1]?d:r]}const o=t.map(Number);let[h,c]=o;if(i===1)[h,c]=ur(h,c);else if(i>1){const l=h>c?Math.ceil:Math.floor,d=h>c?Math.floor:Math.ceil,u=4;for(let f=0;f<u;f++){const p=h,g=c,y=Te.getTickStep(h,c,e),[b,x]=o;if(h=l(b/y)*y,c=d(x/y)*y,h===p&&c===g)break}}return[e.nice[0]?h:o[0],e.nice[1]?c:o[1]]}};import{CleanupRegistry as Mr,Debug as xt,EventEmitter as Sr,Logger as Pr,createId as Cr,downloadUrl as _r}from"ag-charts-core";var wr=class{constructor(s){this.width=600,this.height=300,this.direction="ltr";const{width:e,height:t,willReadFrequently:i=!1}=s;this.element=s.canvasElement,this.pixelRatio=s.pixelRatio,this.element.style.display="block",this.element.style.width=(e??this.width)+"px",this.element.style.height=(t??this.height)+"px",this.element.width=at(this.pixelRatio,e??this.width),this.element.height=at(this.pixelRatio,t??this.height),this.context=this.element.getContext("2d",{willReadFrequently:i}),this.context.direction=this.direction,this.resize(e??this.width,t??this.height,this.pixelRatio),Qe(this.context)}drawImage(s,e=0,t=0){return s.drawImage(this.context.canvas,e,t)}toDataURL(s){return this.element.toDataURL(s)}resize(s,e,t){if(!(s>0&&e>0))return;const{element:i,context:n}=this;i.width=at(t,s),i.height=at(t,e),n.setTransform(t,0,0,t,0,0),i.style.width=s+"px",i.style.height=e+"px",this.width=s,this.height=e,this.pixelRatio=t}setDirection(s){this.direction=s?"rtl":"ltr",this.element.dir=this.direction,this.context.direction=this.direction}clear(){Ke(this)}destroy(){this.element.remove(),this.element.width=0,this.element.height=0,this.context.clearRect(0,0,0,0),Object.freeze(this)}reset(){this.context.reset(),this.context.verifyDepthZero?.(),this.context.direction=this.direction}};import{EventEmitter as Tr,getImage as kr}from"ag-charts-core";var Dr=class extends Tr{constructor(){super(...arguments),this.cache=new Map,this.imageLoadingCount=0,this.destroyed=!1}loadImage(s,e,t){const i=Nr(s,t),n=this.cache.get(i);if(n?.image)return n.image;if(n!=null&&e){n.nodes.add(e);return}if(!e)return;const r={image:void 0,nodes:new Set([e]),blobUrl:void 0};this.cache.set(i,r),this.imageLoadingCount++;const a=()=>{r.blobUrl!=null&&(URL.revokeObjectURL(r.blobUrl),r.blobUrl=void 0)},o=c=>{if(this.destroyed){a();return}r.image=c;for(const l of r.nodes)l.markDirty();r.nodes.clear(),this.imageLoadingCount--,a(),this.emit("image-loaded",{uri:s})},h=()=>{if(this.destroyed){a();return}this.imageLoadingCount--,r.nodes.clear(),a(),this.cache.delete(i),this.emit("image-error",{uri:s})};this.resolveSource(s,t).then(c=>{if(this.destroyed){c.blobUrl!=null&&URL.revokeObjectURL(c.blobUrl);return}c.blobUrl!=null&&(r.blobUrl=c.blobUrl);const l=kr(),d=new l;d.onload=()=>o(d),d.onerror=h,d.src=c.src}).catch(h)}unregisterNode(s){for(const e of this.cache.values())e.nodes.delete(s)}async resolveSource(s,e){if(!e||typeof fetch!="function"||typeof Blob>"u")return{src:s};const t=Ar(s,".svg"),i=s.startsWith("data:image/svg");if(!t&&!i)return{src:s};try{const n=await fetch(s,{mode:"cors"}),r=n.headers.get("content-type")??"",a=r.startsWith("image/")||r.startsWith("application/"),o=r.includes("svg");if(a&&!o)return{src:s};const h=await n.text();if(!o&&!Ir(h))return{src:s};const c=Or(h,e.width,e.height);if(!c)return{src:s};const l=new Blob([c],{type:"image/svg+xml"}),d=URL.createObjectURL(l);return{src:d,blobUrl:d}}catch{return{src:s}}}waitingToLoad(){return this.imageLoadingCount>0}destroy(){this.destroyed=!0;for(const s of this.cache.values())s.nodes.clear(),s.blobUrl!=null&&(URL.revokeObjectURL(s.blobUrl),s.blobUrl=void 0);this.cache.clear()}};function Nr(s,e){return e?`${s}@${e.width}x${e.height}`:s}function Ar(s,e){const t=s.search(/[?#]/);return(t>=0?s.slice(0,t):s).toLowerCase().endsWith(e)}var Rr=/^\uFEFF?\s{0,32}(?:<\?xml[^>]{0,256}\?>\s{0,32})?(?:<!DOCTYPE[^>]{0,256}>\s{0,32})?<svg[\s>]/i;function Ir(s){return Rr.test(s)}var Lr=/^\s{0,8}\+?(\d{1,6}(?:\.\d{1,6})?(?:e[+-]?\d{1,3})?)\s{0,8}(?:px|pt|cm|mm|in|pc|q)?\s{0,8}$/i;function zi(s,e){const t=s.getAttribute(e);if(t==null)return!1;const i=Lr.exec(t);return i?Number.parseFloat(i[1])>0:!1}function Or(s,e,t){if(!(typeof DOMParser>"u"||typeof XMLSerializer>"u"))try{const n=new DOMParser().parseFromString(s,"image/svg+xml").documentElement;if(n?.tagName.toLowerCase()!=="svg")return;const r=zi(n,"width"),a=zi(n,"height");return r&&a?void 0:(r||n.setAttribute("width",String(e)),a||n.setAttribute("height",String(t)),new XMLSerializer().serializeToString(n))}catch{return}}import{Debug as Fr}from"ag-charts-core";var Er=class{constructor(s){this.canvas=s,this.debug=Fr.create(!0,"scene"),this.layersMap=new Map,this.nextLayerId=0}get size(){return this.layersMap.size}resize(s,e,t){this.canvas.resize(s,e,t);for(const{canvas:i}of this.layersMap.values())i.resize(s,e,t)}addLayer(s){const{width:e,height:t,pixelRatio:i}=this.canvas,{name:n}=s,r=new ee({width:e,height:t,pixelRatio:i});return this.layersMap.set(r,{id:this.nextLayerId++,name:n,canvas:r}),this.debug("Scene.addLayer() - layers",this.layersMap),r}removeLayer(s){this.layersMap.has(s)&&(this.layersMap.delete(s),s.destroy(),this.debug("Scene.removeLayer() - layers",this.layersMap))}clear(){for(const s of this.layersMap.values())s.canvas.destroy();this.layersMap.clear()}},Br=(()=>{var s=class extends Sr{constructor(e){super(),this.debug=xt.create(!0,"scene"),this.id=Cr(this),this.imageLoader=new Dr,this.root=null,this.pendingSize=null,this.isDirty=!1,this.direction="ltr",this.cleanup=new Mr,this.updateDebugFlags(),this.canvas=new wr(e),this.layersManager=new Er(this.canvas),this.cleanup.register(this.imageLoader.on("image-loaded",()=>{this.emit("scene-changed",{})}),this.imageLoader.on("image-error",({uri:t})=>{Pr.warnOnce(`Unable to load image ${t}`)}))}waitingForUpdate(){return this.imageLoader?.waitingToLoad()??!1}get width(){return this.pendingSize?.[0]??this.canvas.width}get height(){return this.pendingSize?.[1]??this.canvas.height}get pixelRatio(){return this.pendingSize?.[2]??this.canvas.pixelRatio}get isRtl(){return this.direction==="rtl"}setContainer(e){const{element:t}=this.canvas;return t.remove(),e.appendChild(t),this}setRoot(e){return this.root===e?this:(this.isDirty=!0,this.root?.setScene(),this.root=e,e&&(e.visible=!0,e.setScene(this)),this)}updateDebugFlags(){xt.inDevelopmentMode(()=>ut._debugEnabled=!0)}clearCanvas(){this.canvas.clear()}attachNode(e){return this.appendChild(e),()=>e.remove()}appendChild(e){return this.root?.appendChild(e),this}removeChild(e){return e.remove(),this}download(e,t){_r(this.canvas.toDataURL(t),e?.trim()??"image")}getDataURL(e){return this.canvas.toDataURL(e)}resize(e,t,i){return e=Math.round(e),t=Math.round(t),i??(i=this.pixelRatio),e>0&&t>0&&(e!==this.width||t!==this.height||i!==this.pixelRatio)?(this.pendingSize=[e,t,i],this.isDirty=!0,!0):!1}setDirection(e){this.direction=e?"rtl":"ltr",this.canvas.setDirection(e)}updateBaseFont(){const e=this.root?.resolveFont();e==null||e===this._contextFont||(this._baseFont=e,!this.pendingSize&&(this.canvas.context.font=e,this._contextFont=e))}applyPendingResize(){return this.pendingSize?(this.layersManager.resize(...this.pendingSize),this.pendingSize=null,this._contextFont=void 0,this._baseFont!=null&&(this.canvas.context.font=this._baseFont,this._contextFont=this._baseFont),!0):!1}render(e){const{debugSplitTimes:t={start:performance.now()},extraDebugStats:i,seriesRect:n,debugColors:r}=e??{},{canvas:a,canvas:{context:o}={},root:h,width:c,height:l,pixelRatio:d}=this;if(!o)return;const u=xt.check("scene:stats","scene:stats:verbose");u&&this.ensureDebugStatsRegistration();const f=performance.now(),p=this.applyPendingResize();if(h&&!h.visible){this.isDirty=!1;return}let g;if(h instanceof G&&(g=h.dirty),h!=null&&g===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:Ot(h,"console")}),u&&Ci(this.layersManager,t,o,void 0,i,n,r);return}const y={ctx:o,direction:this.direction,width:c,height:l,devicePixelRatio:d,debugNodes:{},currentFont:this._contextFont};xt.check("scene:stats:verbose")&&(y.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),On(y);let b=!1;if((g!==!1||p)&&(b=!0,a.clear()),h&&xt.check("scene:dirtyTree")){const{dirtyTree:x,paths:v}=_i(h);xt.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:x,paths:v})}if(h&&b){if(h.visible&&h.preRender(y),this.debug.check()){const x=Ot(h,"console");this.debug("Scene.render() - before",{canvasCleared:b,tree:x})}if(h.visible)try{o.save(),h.render(y),o.restore()}catch(x){throw this.canvas.reset(),x}}t["\u270D\uFE0F"]=performance.now()-f,o.verifyDepthZero?.(),this.isDirty=!1,u&&Ci(this.layersManager,t,o,y.stats,i,n,r),Fn(o,y.debugNodes),h&&this.debug.check()&&this.debug("Scene.render() - after",{tree:Ot(h,"console"),canvasCleared:b})}ensureDebugStatsRegistration(){if(this.releaseDebugStats)return;const e=Rn(),t=()=>{e(),this.releaseDebugStats=void 0};this.releaseDebugStats=t,this.cleanup.register(t)}toSVG(){const{root:e,width:t,height:i}=this;if(e!=null)return ut.toSVG(e,t,i)}strip(){const{context:e,pixelRatio:t}=this.canvas;e.setTransform(t,0,0,t,0,0),this.layersManager.clear(),this.setRoot(null),this.isDirty=!1,this.clear()}destroy(){this.canvas!=null&&(this.strip(),this.canvas.destroy(),this.imageLoader.destroy(),this.cleanup.flush(),Ti(),Object.assign(this,{canvas:void 0}))}};return s.className="_c$16",s})();import{SceneChangeDetection as dt,isNumberEqual as zr,normalizeAngle360 as $i}from"ag-charts-core";var $r=(()=>{var s=class extends yt{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=10,this.startAngle=0,this.endAngle=Math.PI*2,this.counterClockwise=!1,this.type=0}get fullPie(){return zr($i(this.startAngle),$i(this.endAngle))}updatePath(){const e=this.path;e.clear(),e.arc(this.centerX,this.centerY,this.radius,this.startAngle,this.endAngle,this.counterClockwise),this.type===1?e.closePath():this.type===2&&!this.fullPie&&(e.lineTo(this.centerX,this.centerY),e.closePath())}computeBBox(){return new L(this.centerX-this.radius,this.centerY-this.radius,this.radius*2,this.radius*2)}isPointInPath(e,t){const i=this.getBBox();return this.type!==0&&i.containsPoint(e,t)&&this.path.isPointInPath(e,t)}};return s.className="_c$17",m([dt()],s.prototype,"centerX",2),m([dt()],s.prototype,"centerY",2),m([dt()],s.prototype,"radius",2),m([dt()],s.prototype,"startAngle",2),m([dt()],s.prototype,"endAngle",2),m([dt()],s.prototype,"counterClockwise",2),m([dt()],s.prototype,"type",2),s})();import{createSvgElement as Wr,lineDistanceSquared as qr}from"ag-charts-core";var Gr=(()=>{var s=class extends Pt{constructor(e={}){super(e),this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.fill=void 0,this.strokeWidth=1}set x(e){this.x1=e,this.x2=e}set y(e){this.y1=e,this.y2=e}get midPoint(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}}computeBBox(){return new L(Math.min(this.x1,this.x2),Math.min(this.y1,this.y2),Math.abs(this.x2-this.x1),Math.abs(this.y2-this.y1))}isPointInPath(e,t){return this.x1===this.x2||this.y1===this.y2?this.getBBox().clone().grow(this.strokeWidth/2).containsPoint(e,t):!1}distanceSquared(e,t){const{x1:i,y1:n,x2:r,y2:a}=this;return qr(e,t,i,n,r,a,1/0)}render(e){const{ctx:t,devicePixelRatio:i}=e;let{x1:n,y1:r,x2:a,y2:o}=this;if(n===a){const{strokeWidth:h}=this,c=Math.round(n*i)/i+Math.trunc(h*i)%2/(i*2);n=c,a=c}else if(r===o){const{strokeWidth:h}=this,c=Math.round(r*i)/i+Math.trunc(h*i)%2/(i*2);r=c,o=c}t.beginPath(),t.moveTo(n,r),t.lineTo(a,o),this.fillStroke(t),this.fillShadow?.markClean(),super.render(e)}toSVG(){if(!this.visible)return;const e=Wr("line");return e.setAttribute("x1",String(this.x1)),e.setAttribute("y1",String(this.y1)),e.setAttribute("x2",String(this.x2)),e.setAttribute("y2",String(this.y2)),this.applySvgStrokeAttributes(e),{elements:[e]}}};return s.className="_c$18",m([T()],s.prototype,"x1",2),m([T()],s.prototype,"y1",2),m([T()],s.prototype,"x2",2),m([T()],s.prototype,"y2",2),s})();import{SceneChangeDetection as tt,angleBetween as Wi,isNumberEqual as qi,normalizeAngle360 as Xr}from"ag-charts-core";function Gt(s,e,t){const i=Math.hypot(s,e),r=Math.atan2(e,s)+t;return{x:Math.cos(r)*i,y:Math.sin(r)*i}}var Ur=(()=>{var s=class extends yt{constructor(){super(...arguments),this.isBeveled=!0,this.columnWidth=0,this.startAngle=0,this.endAngle=0,this.outerRadius=0,this.innerRadius=0,this.axisInnerRadius=0,this.axisOuterRadius=0}set cornerRadius(e){}computeBBox(){const{columnWidth:e}=this,[t,i]=this.normalizeRadii(this.innerRadius,this.outerRadius),n=this.getRotation(),r=-e/2,a=e/2,o=-i,h=-t;let c=1/0,l=1/0,d=-1/0,u=-1/0;for(let f=0;f<4;f+=1){const{x:p,y:g}=Gt(f%2===0?r:a,f<2?o:h,n);c=Math.min(p,c),l=Math.min(g,l),d=Math.max(p,d),u=Math.max(g,u)}return new L(c,l,d-c,u-l)}getRotation(){const{startAngle:e,endAngle:t}=this,i=Wi(e,t);return Xr(e+i/2+Math.PI/2)}normalizeRadii(e,t){return e>t?[t,e]:[e,t]}updatePath(){const{isBeveled:e}=this;e?this.updateBeveledPath():this.updateRectangularPath(),this.checkPathDirty()}updateRectangularPath(){const{columnWidth:e,path:t}=this,[i,n]=this.normalizeRadii(this.innerRadius,this.outerRadius),r=-e/2,a=e/2,o=-n,h=-i,c=this.getRotation(),l=[[r,h],[r,o],[a,o],[a,h]].map(([d,u])=>Gt(d,u,c));t.clear(!0),t.moveTo(l[0].x,l[0].y),t.lineTo(l[1].x,l[1].y),t.lineTo(l[2].x,l[2].y),t.lineTo(l[3].x,l[3].y),t.closePath()}calculateCircleIntersection(e,t){const i=e*e;if(t<i)return null;const n=-Math.sqrt(t-i),r=Math.atan2(n,e);return{y:n,angle:r}}calculateBothIntersections(e,t,i){const n=i*i,r=this.calculateCircleIntersection(e,n),a=this.calculateCircleIntersection(t,n);return!r||!a?null:{left:r,right:a}}calculateAxisOuterIntersections(e,t,i){const n=i*i,r=this.calculateCircleIntersection(e,n),a=this.calculateCircleIntersection(t,n);return!r||!a?null:{left:r,right:a,radiusSquared:n}}moveToRotated(e,t,i){const n=Gt(e,t,i);this.path.moveTo(n.x,n.y)}lineToRotated(e,t,i){const n=Gt(e,t,i);this.path.lineTo(n.x,n.y)}renderTopWithCornerClipping(e,t,i){const{path:n}=this,{right:r,top:a,rotation:o}=i,h=a*a,c=t.radiusSquared-h;if(c<=0)this.lineToRotated(r,t.right.y,o),n.arc(0,0,e,o+t.right.angle,o+t.left.angle,!0);else{const l=Math.sqrt(c),d=Math.atan2(a,l),u=Math.atan2(a,-l);this.lineToRotated(r,t.right.y,o),n.arc(0,0,e,o+t.right.angle,o+d,!0),this.lineToRotated(-l,a,o),n.arc(0,0,e,o+u,o+t.left.angle,!0)}}updateBeveledPath(){const{columnWidth:e,path:t,axisInnerRadius:i,axisOuterRadius:n}=this,[r,a]=this.normalizeRadii(this.innerRadius,this.outerRadius),o=-e/2,h=e/2,c=-a,l=-r,d=this.getRotation(),u=qi(r,i),f=qi(a,n),p=Math.hypot(o,c)>n||Math.hypot(h,c)>n;if(!u&&!f&&!p){this.updateRectangularPath();return}const g=u?this.calculateBothIntersections(o,h,r):null,y=f?this.calculateBothIntersections(o,h,a):null,b=p?this.calculateAxisOuterIntersections(o,h,n):null;if(u&&!g||f&&!y||p&&!b){this.updateRectangularPath();return}t.clear(!0);const x={left:o,right:h,top:c,bottom:l,rotation:d};g?this.moveToRotated(o,g.left.y,d):this.moveToRotated(o,l,d),g?t.arc(0,0,r,d+g.left.angle,d+g.right.angle,!1):this.lineToRotated(h,l,d),y?(this.lineToRotated(h,y.right.y,d),t.arc(0,0,a,d+y.right.angle,d+y.left.angle,!0)):b?this.renderTopWithCornerClipping(n,b,x):(this.lineToRotated(h,c,d),this.lineToRotated(o,c,d)),t.closePath()}};return s.className="_c$19",m([tt()],s.prototype,"isBeveled",2),m([tt()],s.prototype,"columnWidth",2),m([tt()],s.prototype,"startAngle",2),m([tt()],s.prototype,"endAngle",2),m([tt()],s.prototype,"outerRadius",2),m([tt()],s.prototype,"innerRadius",2),m([tt()],s.prototype,"axisInnerRadius",2),m([tt()],s.prototype,"axisOuterRadius",2),s})();function Yr(s,e,t,i,n){const r=Wi(s,e),a=r*(1-i)/2;if(s+=a,e-=a,r<.001)return 2*t*n;if(r>=2*Math.PI){const f=s+r/2;s=f-Math.PI,e=f+Math.PI}const o=t*Math.cos(s),h=t*Math.sin(s),c=t*Math.cos(e),l=t*Math.sin(e),d=Math.floor(Math.hypot(o-c,h-l)),u=2*t*n;return Math.max(1,Math.min(u,d))}import{SceneChangeDetection as X,SceneObjectChangeDetection as jr}from"ag-charts-core";var Hr=class ke{constructor(e,t,i,n){this.startAngle=e,this.endAngle=t,this.innerRadius=i,this.outerRadius=n}clone(){const{startAngle:e,endAngle:t,innerRadius:i,outerRadius:n}=this;return new ke(e,t,i,n)}equals(e){return this.startAngle===e.startAngle&&this.endAngle===e.endAngle&&this.innerRadius===e.innerRadius&&this.outerRadius===e.outerRadius}[Xe](e,t){return new ke(this.startAngle*(1-t)+e.startAngle*t,this.endAngle*(1-t)+e.endAngle*t,this.innerRadius*(1-t)+e.innerRadius*t,this.outerRadius*(1-t)+e.outerRadius*t)}};import{angleBetween as Vr,isBetweenAngles as Xt,normalizeAngle180 as Gi,normalizeAngle360 as Xi}from"ag-charts-core";function Zr({startAngle:s,endAngle:e,innerRadius:t,outerRadius:i}){let n=1/0,r=1/0,a=-1/0,o=-1/0;const h=(c,l)=>{n=Math.min(c,n),r=Math.min(l,r),a=Math.max(c,a),o=Math.max(l,o)};return h(t*Math.cos(s),t*Math.sin(s)),h(t*Math.cos(e),t*Math.sin(e)),h(i*Math.cos(s),i*Math.sin(s)),h(i*Math.cos(e),i*Math.sin(e)),Xt(0,s,e)&&h(i,0),Xt(Math.PI*.5,s,e)&&h(0,i),Xt(Math.PI,s,e)&&h(-i,0),Xt(Math.PI*1.5,s,e)&&h(0,-i),new L(n,r,a-n,o-r)}function Ui(s,e,t){const i=Math.sqrt(Math.pow(s,2)+Math.pow(e,2)),{innerRadius:n,outerRadius:r}=t;if(t.startAngle===t.endAngle||i<Math.min(n,r)||i>Math.max(n,r))return!1;const a=Gi(t.startAngle),o=Gi(t.endAngle),h=Math.atan2(e,s);return a<o?h<=o&&h>=a:h<=o&&h>=-Math.PI||h>=a&&h<=Math.PI}function Yi(s,e,t,i){if(t===0&&i===0)return 0;if(Math.asin(Math.abs(1*t)/(s+1*t))+Math.asin(Math.abs(1*i)/(s+1*i))-e<0)return 1;let r=0,a=1;for(let o=0;o<8;o+=1){const h=(r+a)/2;Math.asin(Math.abs(h*t)/(s+h*t))+Math.asin(Math.abs(h*i)/(s+h*i))-e<0?r=h:a=h}return r}var ji=1e-6;function et(s,e){return Vr(s,e)<ji?e:Xi(s-e)+e}function Ut(s,e,t=0){const n=Math.abs(e-s)>=2*Math.PI-ji?2*Math.PI:Xi(e-s);return s=et(s,t),e=s+n,{startAngle:s,endAngle:e}}function Yt(s,e,t,i,n,r){const a=Math.sin(r),o=Math.cos(r),h=s**2+e**2-t**2;let c,l,d,u;if(o>.5){const v=a/o,S=1+v**2,_=-2*(s+e*v),P=_**2-4*S*h;if(P<0)return;const M=(-_+Math.sqrt(P))/(2*S),C=(-_-Math.sqrt(P))/(2*S);c=M,l=M*v,d=C,u=C*v}else{const v=o/a,S=1+v**2,_=-2*(e+s*v),P=_**2-4*S*h;if(P<0)return;const M=(-_+Math.sqrt(P))/(2*S),C=(-_-Math.sqrt(P))/(2*S);c=M*v,l=M,d=C*v,u=C}const f=o,p=a,g=c*f+l*p,y=d*f+u*p,b=g>0?et(Math.atan2(l-e,c-s),i):Number.NaN,x=y>0?et(Math.atan2(u-e,d-s),i):Number.NaN;if(b>=i&&b<=n)return b;if(x>=i&&x<=n)return x}function jt(s,e,t,i,n,r){const a=Math.hypot(s,e),o=(a**2-t**2+r**2)/(2*a),h=a-o,c=Math.atan2(e,s),l=Math.acos(-h/t),d=et(c+l,i),u=et(c-l,i);if(d>=i&&d<=n)return d;if(u>=i&&u<=n)return u}var Ce=class{constructor(s,e,t,i,n){this.cx=s,this.cy=e,this.r=t,this.a0=i,this.a1=n,this.a0>=this.a1&&(this.a0=Number.NaN,this.a1=Number.NaN)}isValid(){return Number.isFinite(this.a0)&&Number.isFinite(this.a1)}pointAt(s){return{x:this.cx+this.r*Math.cos(s),y:this.cy+this.r*Math.sin(s)}}clipStart(s){s==null||!this.isValid()||s<this.a0||(this.a0=s,(Number.isNaN(s)||this.a0>=this.a1)&&(this.a0=Number.NaN,this.a1=Number.NaN))}clipEnd(s){s==null||!this.isValid()||s>this.a1||(this.a1=s,(Number.isNaN(s)||this.a0>=this.a1)&&(this.a0=Number.NaN,this.a1=Number.NaN))}},Jr=(()=>{var s=class extends yt{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.innerRadius=10,this.outerRadius=20,this.startAngle=0,this.endAngle=Math.PI*2,this.clipSector=void 0,this.concentricEdgeInset=0,this.radialEdgeInset=0,this.startOuterCornerRadius=0,this.endOuterCornerRadius=0,this.startInnerCornerRadius=0,this.endInnerCornerRadius=0}set inset(e){this.concentricEdgeInset=e,this.radialEdgeInset=e}set cornerRadius(e){this.startOuterCornerRadius=e,this.endOuterCornerRadius=e,this.startInnerCornerRadius=e,this.endInnerCornerRadius=e}computeBBox(){return Zr(this).translate(this.centerX,this.centerY)}normalizedRadii(){const{concentricEdgeInset:e}=this;let{innerRadius:t,outerRadius:i}=this;return t=t>0?t+e:0,i=Math.max(i-e,0),{innerRadius:t,outerRadius:i}}normalizedClipSector(){const{clipSector:e}=this;if(e==null)return;const{startAngle:t,endAngle:i}=Ut(this.startAngle,this.endAngle),{innerRadius:n,outerRadius:r}=this.normalizedRadii(),a=Ut(e.startAngle,e.endAngle,t);return new Hr(Math.max(t,a.startAngle),Math.min(i,a.endAngle),Math.max(n,e.innerRadius),Math.min(r,e.outerRadius))}getAngleOffset(e){return e>0?this.radialEdgeInset/e:0}arc(e,t,i,n,r,a,o,h){if(e<=0)return;const{startAngle:c,endAngle:l}=Ut(this.startAngle,this.endAngle),{innerRadius:d,outerRadius:u}=this.normalizedRadii(),f=this.normalizedClipSector();if(h&&d<=0)return;const p=h?this.getAngleOffset(d+e):this.getAngleOffset(u-e),g=o?c+p+t:l-p-t,y=h?d+e:u-e,b=y*Math.cos(g),x=y*Math.sin(g);if(f!=null&&(!o&&!(g>=c-1e-6&&g<=f.endAngle-1e-6)||o&&!(g>=f.startAngle+1e-6&&g<=l-1e-6)||h&&y<f.innerRadius-1e-6||!h&&y>f.outerRadius+1e-6))return;const v=new Ce(b,x,e,i,n);if(f!=null){h?(v.clipStart(Yt(b,x,e,i,n,f.endAngle)),v.clipEnd(Yt(b,x,e,i,n,f.startAngle))):(v.clipStart(Yt(b,x,e,i,n,f.startAngle)),v.clipEnd(Yt(b,x,e,i,n,f.endAngle)));let C,w;if(o?(C=jt(b,x,e,i,n,f.innerRadius),w=jt(b,x,e,i,n,f.outerRadius)):(C=jt(b,x,e,i,n,f.outerRadius),w=jt(b,x,e,i,n,f.innerRadius)),v.clipStart(C),v.clipEnd(w),C!=null){const{x:A,y:I}=v.pointAt(C),D=et(Math.atan2(I,A),c);o?a?.clipStart(D):r.clipEnd(D)}if(w!=null){const{x:A,y:I}=v.pointAt(w),D=et(Math.atan2(I,A),c);o?r.clipStart(D):a?.clipEnd(D)}}if(f!=null){const{x:C,y:w}=v.pointAt((v.a0+v.a1)/2);if(!Ui(C,w,f))return}const{x:S,y:_}=v.pointAt(o===h?v.a0:v.a1),P=et(Math.atan2(_,S),c),M=h?a:r;return o?M?.clipStart(P):M?.clipEnd(P),v}updatePath(){const{path:t,centerX:i,centerY:n,concentricEdgeInset:r,radialEdgeInset:a}=this;let{startOuterCornerRadius:o,endOuterCornerRadius:h,startInnerCornerRadius:c,endInnerCornerRadius:l}=this;const{startAngle:d,endAngle:u}=Ut(this.startAngle,this.endAngle),{innerRadius:f,outerRadius:p}=this.normalizedRadii(),g=this.normalizedClipSector(),y=u-d,b=y>=2*Math.PI-1e-6;t.clear();const x=this.getAngleOffset(f),v=y-2*x,S=p-f,_=f>0&&v>0?2*f*Math.sin(v/2):0,P=p>0&&v>0?2*p*Math.sin(v/2):0;if(o=Math.floor(Math.max(0,Math.min(o,P/2,S/2))),h=Math.floor(Math.max(0,Math.min(h,P/2,S/2))),c=Math.floor(Math.max(0,Math.min(c,_/2,S/2))),l=Math.floor(Math.max(0,Math.min(l,_/2,S/2))),f===0&&p===0||f>p||_<0||P<=0)return;if((g?.startAngle??d)===(g?.endAngle??u))return;if(b&&this.clipSector==null&&o===0&&h===0&&c===0&&l===0){t.moveTo(i+p*Math.cos(d),n+p*Math.sin(d)),t.arc(i,n,p,d,u),f>r&&(t.moveTo(i+f*Math.cos(u),n+f*Math.sin(u)),t.arc(i,n,f,u,d,!0)),t.closePath();return}else if(this.clipSector==null&&Math.abs(f-p)<1e-6){t.arc(i,n,p,d,u,!1),t.arc(i,n,p,u,d,!0),t.closePath();return}const C=this.getAngleOffset(p);if(y<2*C)return;const A=(g?.innerRadius??f)>r,I=f<r||y<2*x,D=Math.max(o,c,h,l),B=D>0?Math.min(S/D,1):1;o*=B,h*=B,c*=B,l*=B;const j=Yi(p,y-2*C,-o,-h);if(o*=j,h*=j,!I&&A){const R=Yi(f,y-2*x,c,l);c*=R,l*=R}else c=0,l=0;const it=Math.max(o+c,h+l),H=it>0?Math.min(S/it,1):1;o*=H,h*=H,c*=H,l*=H;let U=0,k=0;const z=o/(p-o),Mt=h/(p-h);if(z>=0&&z<.999999)U=Math.asin(z);else{U=y/2;const R=p/(1/Math.sin(U)+1);o=Math.min(R,o)}if(Mt>=0&&Mt<.999999)k=Math.asin(Mt);else{k=y/2;const R=p/(1/Math.sin(k)+1);h=Math.min(R,h)}const De=Math.asin(c/(f+c)),Ne=Math.asin(l/(f+l)),Ae=g?.outerRadius??p,Re=this.getAngleOffset(Ae),J=new Ce(0,0,Ae,d+Re,u-Re),Ie=g?.innerRadius??f,Le=this.getAngleOffset(Ie),V=A?new Ce(0,0,Ie,d+Le,u-Le):void 0;g!=null&&(J.clipStart(g.startAngle),J.clipEnd(g.endAngle),V?.clipStart(g.startAngle),V?.clipEnd(g.endAngle));const Oe=this.arc(o,U,d-Math.PI*.5,d+U,J,V,!0,!1),Fe=this.arc(h,k,u-k,u+Math.PI*.5,J,V,!1,!1),Ee=this.arc(l,Ne,u+Math.PI*.5,u+Math.PI-Ne,J,V,!1,!0),Vt=this.arc(c,De,d+Math.PI+De,d+Math.PI*1.5,J,V,!0,!0);if(!(I&&A)){if(I){const R=y<Math.PI*.5?a*(1+Math.cos(y))/Math.sin(y):Number.NaN;let O;R>0&&R<p?O=Math.max(Math.hypot(a,R),f):O=a,O=Math.max(O,f);const $=d+y*.5;t.moveTo(i+O*Math.cos($),n+O*Math.sin($))}else if(!(Vt?.isValid()===!0||V?.isValid()===!0)){const R=d+y/2,O=f*Math.cos(R),$=f*Math.sin(R);t.moveTo(i+O,n+$)}}if(Oe?.isValid()===!0){const{cx:R,cy:O,r:$,a0:st,a1:nt}=Oe;t.arc(i+R,n+O,$,st,nt)}if(J.isValid()){const{r:R,a0:O,a1:$}=J;t.arc(i,n,R,O,$)}if(Fe?.isValid()===!0){const{cx:R,cy:O,r:$,a0:st,a1:nt}=Fe;t.arc(i+R,n+O,$,st,nt)}if(!I){if(Ee?.isValid()===!0){const{cx:R,cy:O,r:$,a0:st,a1:nt}=Ee;t.arc(i+R,n+O,$,st,nt)}if(V?.isValid()===!0){const{r:R,a0:O,a1:$}=V;t.arc(i,n,R,$,O,!0)}if(Vt?.isValid()===!0){const{cx:R,cy:O,r:$,a0:st,a1:nt}=Vt;t.arc(i+R,n+O,$,st,nt)}}t.closePath()}isPointInPath(e,t){const{startAngle:i,endAngle:n,innerRadius:r,outerRadius:a}=this.clipSector??this;return Ui(e-this.centerX,t-this.centerY,{startAngle:i,endAngle:n,innerRadius:Math.min(r,a),outerRadius:Math.max(r,a)})}};return s.className="_c$20",m([X()],s.prototype,"centerX",2),m([X()],s.prototype,"centerY",2),m([X()],s.prototype,"innerRadius",2),m([X()],s.prototype,"outerRadius",2),m([X()],s.prototype,"startAngle",2),m([X()],s.prototype,"endAngle",2),m([jr({equals:(e,t)=>e.equals(t)})],s.prototype,"clipSector",2),m([X()],s.prototype,"concentricEdgeInset",2),m([X()],s.prototype,"radialEdgeInset",2),m([X()],s.prototype,"startOuterCornerRadius",2),m([X()],s.prototype,"endOuterCornerRadius",2),m([X()],s.prototype,"startInnerCornerRadius",2),m([X()],s.prototype,"endInnerCornerRadius",2),s})();import{toRadians as Kr}from"ag-charts-core";export{$r as Arc,L as BBox,Vn as Caption,ar as CategoryScale,G as Group,Gr as Line,vr as LinearScale,bt as Marker,yt as Path,Ur as RadialColumnShape,Di as Rect,Br as Scene,Jr as Sector,Pt as Shape,Cn as TranslatableGroup,Yr as getRadialColumnWidth,Kr as toRadians};