"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,e)=>{for(var i in e)__defProp(t,i,{get:e[i],enumerable:!0})},__copyProps=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of __getOwnPropNames(e))!__hasOwnProp.call(t,n)&&n!==i&&__defProp(t,n,{get:()=>e[n],enumerable:!(s=__getOwnPropDesc(e,n))||s.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,i,s)=>{for(var n=s>1?void 0:s?__getOwnPropDesc(e,i):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(n=(s?a(e,i,n):a(n))||n);return s&&n&&__defProp(e,i,n),n},main_modules_exports={};__export(main_modules_exports,{CartesianChartModule:()=>CartesianChartModule,ModuleRegistry:()=>ModuleRegistry,PolarChartModule:()=>PolarChartModule}),module.exports=__toCommonJS(main_modules_exports);var logger_exports={};__export(logger_exports,{error:()=>error,errorOnce:()=>errorOnce,log:()=>log,logGroup:()=>logGroup,reset:()=>reset,table:()=>table,warn:()=>warn,warnOnce:()=>warnOnce});var doOnceCache=new Set;function log(...t){console.log(...t)}function warn(t,...e){console.warn(`AG Charts - ${t}`,...e)}function error(t,...e){typeof t=="object"?console.error("AG Charts error",t,...e):console.error(`AG Charts - ${t}`,...e)}function table(...t){console.table(...t)}function warnOnce(t,...e){const i=`Logger.warn: ${t}`;doOnceCache.has(i)||(warn(t,...e),doOnceCache.add(i))}function errorOnce(t,...e){const i=`Logger.error: ${t}`;doOnceCache.has(i)||(error(t,...e),doOnceCache.add(i))}function reset(){doOnceCache.clear()}function logGroup(t,e){console.groupCollapsed(t);try{return e()}finally{console.groupEnd()}}var ModuleRegistry=class{static[Symbol.iterator](){return this.registeredModules.values()}static register(t){const e=this.registeredModules.get(t.name);if(e&&(e.enterprise||!t.enterprise))throw new Error(`AG Charts - Module '${t.name}' already registered`);this.registeredModules.set(t.name,t)}static registerMany(t){for(const e of t)this.register(e)}static reset(){this.registeredModules.clear()}static detectChartDefinition(t){return this.detectDefinition("chart",t)}static detectSeriesDefinition(t){return this.detectDefinition("series",t)}static detectDefinition(t,e){for(const i of this.registeredModules.values())if(i.type===t&&i.detect(e))return i;throw new Error(`AG Charts - Unknown ${t} type; Check options are correctly structured and series types are specified`)}};ModuleRegistry.registeredModules=new Map;var EventEmitter=class{constructor(){this.events=new Map}on(t,e){return this.events.has(t)||this.events.set(t,new Set),this.events.get(t)?.add(e),()=>this.off(t,e)}off(t,e){const i=this.events.get(t);i&&(i.delete(e),i.size===0&&this.events.delete(t))}emit(t,e){this.events.get(t)?.forEach(i=>i(e))}clear(t){t?this.events.delete(t):this.events.clear()}};function toArray(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}function groupBy(t,e){return t.reduce((i,s)=>{const n=e(s);return i[n]??(i[n]=[]),i[n].push(s),i},{})}function arraysEqual(t,e){if(t==null||e==null||t.length!==e.length)return!1;for(let i=0;ie)return;let s;for(;e>=t;){const n=Math.floor((e+t)/2);i(n)?(s=n,t=n+1):e=n-1}return s}function findMinIndex(t,e,i){if(t>e)return;let s;for(;e>=t;){const n=Math.floor((e+t)/2);i(n)?(s=n,e=n-1):t=n+1}return s}function findMinValue(t,e,i){if(t>e)return;let s;for(;e>=t;){const n=Math.floor((e+t)/2),r=i(n);r==null?t=n+1:(s=r,e=n-1)}return s}function diffArrays(t,e){const i=Math.max(t.length,e.length),s=new Set,n=new Set;for(let r=0;r0||n.size>0,added:s,removed:n}}function throttle(t,e,i){const{leading:s=!0,trailing:n=!0}=i??{};let r,a,o=!1;function c(){n&&a?(r=setTimeout(c,e),t(...a)):o=!1,a=null}function l(...h){o?a=h:(o=!0,r=setTimeout(c,e),s?t(...h):a=h)}return Object.assign(l,{cancel(){clearTimeout(r),o=!1,a=null}})}function*iterate(...t){for(const e of t)yield*e}function toIterable(t){return t!=null&&typeof t=="object"&&Symbol.iterator in t?t:[t]}function first(t){for(const e of t)return e;throw new Error("AG Charts - no first() value found")}function joinFormatted(t,e="and",i=String,s=1/0){if(t.length===1)return i(t[0]);t=t.map(i);const n=t.pop();if(t.length>=s){const r=t.length-(s-1);return`${t.slice(0,s-1).join(", ")}, and ${r} more ${e} ${n}`}return`${t.join(", ")} ${e} ${n}`}function stringifyValue(t,e=1/0){switch(typeof t){case"undefined":return"undefined";case"number":if(isNaN(t))return"NaN";if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";default:return t=JSON.stringify(t),t.length>e?`${t.slice(0,e)}... (+${t.length-e} characters)`:t}}function isArray(t){return Array.isArray(t)}function isBoolean(t){return typeof t=="boolean"}function isDate(t){return t instanceof Date}function isValidDate(t){return isDate(t)&&!isNaN(Number(t))}function isRegExp(t){return t instanceof RegExp}function isFunction(t){return typeof t=="function"}function isObject(t){return typeof t=="object"&&t!==null&&!isArray(t)}function isPlainObject(t){return typeof t=="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function isString(t){return typeof t=="string"}function isNumber(t){return typeof t=="number"}function isFiniteNumber(t){return Number.isFinite(t)}function isHtmlElement(t){return typeof window<"u"&&t instanceof HTMLElement}var descriptionSymbol=Symbol("description"),requiredSymbol=Symbol("required");function validate(t,e,i=""){if(!isObject(t))return{valid:null,errors:[{path:i,value:t,message:validateMessage(i,t,"an object")}]};const s=new Set(Object.keys(t)),n=[],r={};function a(o){return isArray(e)?`${i}[${o}]`:i?`${i}.${o}`:o}for(const[o,c]of Object.entries(e)){s.delete(o);const l=t[o];if(!(!c[requiredSymbol]&&typeof l>"u"))if(isFunction(c))c(l,t)?r[o]=l:n.push({key:o,path:i,value:l,message:validateMessage(a(o),l,c)});else{const h=validate(l,c,a(o));r[o]=h.valid,n.push(...h.errors)}}for(const o of s)n.push({key:o,path:i,unknown:!0,message:`Unknown option \`${a(o)}\`, ignoring.`});return{valid:r,errors:n}}function validateMessage(t,e,i){const s=isString(i)?i:i[descriptionSymbol],n=s?`; expecting ${s}`:"";return`${t?`Option \`${t}\``:"Value"} cannot be set to \`${stringifyValue(e)}\`${n}, ignoring.`}function attachDescription(t,e){return Object.assign((i,s)=>t(i,s),{[descriptionSymbol]:e})}var and=(...t)=>attachDescription((e,i)=>t.every(s=>s(e,i)),t.map(e=>e[descriptionSymbol]).filter(Boolean).join(" and ")),or=(...t)=>attachDescription((e,i)=>t.some(s=>s(e,i)),t.map(e=>e[descriptionSymbol]).filter(Boolean).join(" or ")),array=attachDescription(isArray,"an array"),boolean=attachDescription(isBoolean,"a boolean"),callback=attachDescription(isFunction,"a function"),number=attachDescription(isFiniteNumber,"a number"),object=attachDescription(isObject,"an object"),string=attachDescription(isString,"a string"),date=attachDescription(t=>isDate(t)||(isFiniteNumber(t)||isString(t))&&isValidDate(new Date(t)),"a date"),numberMin=(t,e=!0)=>attachDescription(i=>isFiniteNumber(i)&&(i>t||e&&i===t),`a number greater than ${e?"or equal to ":""}${t}`),numberRange=(t,e)=>attachDescription(i=>isFiniteNumber(i)&&i>=t&&i<=e,`a number between ${t} and ${e} inclusive`),positiveNumber=numberMin(0),ratio=numberRange(0,1),isComparable=t=>isFiniteNumber(t)||isValidDate(t),lessThan=t=>attachDescription((e,i)=>!isComparable(e)||!isComparable(i[t])||e`'${i}'`,6);return attachDescription(i=>t.includes(i),`a keyword such as ${e}`)}var arrayOf=(t,e)=>attachDescription((i,s)=>isArray(i)&&i.every(n=>t(n,s)),e??`${t[descriptionSymbol]} array`),verifiedGlobals={};typeof window<"u"?verifiedGlobals.window=window:typeof global<"u"&&(verifiedGlobals.window=global.window),typeof document<"u"?verifiedGlobals.document=document:typeof global<"u"&&(verifiedGlobals.document=global.document);function getDocument(t){return t?verifiedGlobals.document?.[t]:verifiedGlobals.document}function getWindow(t){return t?verifiedGlobals.window?.[t]:verifiedGlobals.window}function createElement(t,e,i){const s=getDocument().createElement(t);if(typeof e=="object"&&(i=e,e=void 0),e)for(const n of e.split(" "))s.classList.add(n);return i&&Object.assign(s.style,i),s}function createSvgElement(t){return getDocument().createElementNS("http://www.w3.org/2000/svg",t)}function downloadUrl(t,e){const i=getDocument("body"),s=createElement("a",{display:"none"});s.href=t,s.download=e,i.appendChild(s),s.click(),setTimeout(()=>i.removeChild(s))}var ID_MAP=new Map;function createId(t){const e=t.constructor,i=Object.hasOwn(e,"className")?e.className:e.name;if(!i)throw new Error(`The ${e} is missing the 'className' property.`);const s=(ID_MAP.get(i)??0)+1;return ID_MAP.set(i,s),`${i}-${s}`}var BBoxValues={containsPoint,isEmpty,normalize};function containsPoint(t,e,i){return e>=t.x&&e<=t.x+t.width&&i>=t.y&&i<=t.y+t.height}function isEmpty(t){return t==null||t.height===0||t.width===0||isNaN(t.height)||isNaN(t.width)}function normalize(t){let{x:e,y:i,width:s,height:n}=t;return(s==null||s>0)&&(n==null||n>0)?t:(e!=null&&s!=null&&s<0&&(s=-s,e=e-s),i!=null&&n!=null&&n<0&&(n=-n,i=i-n),{x:e,y:i,width:s,height:n})}var interpolate=Symbol("interpolate"),isInterpolating=t=>t[interpolate]!=null;function nearestSquared(t,e,i,s=1/0){const n={nearest:void 0,distanceSquared:s};for(const r of i){const a=r.distanceSquared(t,e);if(a===0)return{nearest:r,distanceSquared:0};ae[1]&&(e[1]=i);return e}function findRangeExtent(t){const[e,i]=findMinMax(t);return i-e}function isNumberEqual(t,e,i=1e-10){return t===e||Math.abs(t-e)=1e21){let n;[e,n]=e.split("e"),n!=null&&(i=Number(n))}const s=e.split(".")[1]?.length??0;return Math.max(s-i,0)}var _BBox=class Z{constructor(e,i,s,n){this.x=e,this.y=i,this.width=s,this.height=n}static fromDOMRect({x:e,y:i,width:s,height:n}){return new Z(e,i,s,n)}static merge(e){let i=1/0,s=1/0,n=-1/0,r=-1/0;for(const a of e)a.xn&&(n=a.x+a.width),a.y+a.height>r&&(r=a.y+a.height);return new Z(i,s,n-i,r-s)}static nearestBox(e,i,s){return nearestSquared(e,i,s)}toDOMRect(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.y,left:this.x,right:this.x+this.width,bottom:this.y+this.height,toJSON(){return{}}}}clone(){const{x:e,y:i,width:s,height:n}=this;return new Z(e,i,s,n)}equals(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}containsPoint(e,i){return BBoxValues.containsPoint(this,e,i)}intersection(e){if(!this.collidesBBox(e))return;const i=clamp(e.x,this.x,e.x+e.width),s=clamp(e.y,this.y,e.y+e.height),n=clamp(e.x,this.x+this.width,e.x+e.width),r=clamp(e.y,this.y+this.height,e.y+e.height);return new Z(i,s,n-i,r-s)}collidesBBox(e){return this.xe.x&&this.ye.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(e,i){if(this.containsPoint(e,i))return 0;const s=e-clamp(this.x,e,this.x+this.width),n=i-clamp(this.y,i,this.y+this.height);return s*s+n*n}shrink(e,i){if(typeof e=="number")this.applyMargin(e,i);else for(const[s,n]of Object.entries(e))this.applyMargin(n,s);return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(e,i){if(typeof e=="number")this.applyMargin(-e,i);else for(const[s,n]of Object.entries(e))this.applyMargin(-n,s);return this}applyMargin(e,i){switch(i){case"top":this.y+=e;case"bottom":this.height-=e;break;case"left":this.x+=e;case"right":this.width-=e;break;case"vertical":this.y+=e,this.height-=e*2;break;case"horizontal":this.x+=e,this.width-=e*2;break;case void 0:this.x+=e,this.y+=e,this.width-=e*2,this.height-=e*2;break}}translate(e,i){return this.x+=e,this.y+=i,this}[interpolate](e,i){return new Z(this.x*(1-i)+e.x*i,this.y*(1-i)+e.y*i,this.width*(1-i)+e.width*i,this.height*(1-i)+e.height*i)}};_BBox.zero=Object.freeze(new _BBox(0,0,0,0)),_BBox.NaN=Object.freeze(new _BBox(NaN,NaN,NaN,NaN));var BBox=_BBox;function SceneChangeDetection(t){return function(e,i){const s=`__${i}`;e[i]||prepareGetSet(e,i,s,t)}}function prepareGetSet(t,e,i,s){const{type:n="normal",changeCb:r,convertor:a,checkDirtyOnAssignment:o=!1}=s??{},c={type:n,changeCb:r,checkDirtyOnAssignment:o,convertor:a};let l;switch(n){case"normal":l=buildNormalSetter(i,c);break;case"transform":l=buildTransformSetter(i);break;case"path":l=buildPathSetter(i);break}l=buildCheckDirtyChain(buildChangeCallbackChain(buildConvertorChain(l,c),c),c),Object.defineProperty(t,e,{set:l,get:function(){return this[i]},enumerable:!0,configurable:!0})}function buildConvertorChain(t,e){const{convertor:i}=e;return i?function(s){t.call(this,i(s))}:t}var NO_CHANGE=Symbol("no-change");function buildChangeCallbackChain(t,e){const{changeCb:i}=e;return i?function(s){const n=t.call(this,s);return n!==NO_CHANGE&&i.call(this,this),n}:t}function buildCheckDirtyChain(t,e){const{checkDirtyOnAssignment:i}=e;return i?function(s){const n=t.call(this,s);return s?._dirty===!0&&this.markDirty(),n}:t}function buildNormalSetter(t,e){const{changeCb:i}=e;return function(s){const n=this[t];return s!==n?(this[t]=s,this.markDirty(),i?.(this),s):NO_CHANGE}}function buildTransformSetter(t){return function(e){const i=this[t];return e!==i?(this[t]=e,this.markDirtyTransform(),e):NO_CHANGE}}function buildPathSetter(t){return function(e){const i=this[t];return e!==i?(this[t]=e,this._dirtyPath||(this._dirtyPath=!0,this.markDirty()),e):NO_CHANGE}}var _Node=class nt{constructor(e){this.serialNumber=nt._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=createId(this),this.pointerEvents=0,this._dirty=!0,this.dirtyZIndex=!1,this.isContainerNode=!1,this.visible=!0,this.zIndex=0,this.name=e?.name,this.tag=e?.tag??NaN,this.zIndex=e?.zIndex??0}static toSVG(e,i,s){const n=e?.toSVG();if(n==null||!n.elements.length&&!n.defs?.length)return;const r=createSvgElement("svg");if(r.setAttribute("width",String(i)),r.setAttribute("height",String(s)),r.setAttribute("viewBox",`0 0 ${i} ${s}`),n.defs?.length){const a=createSvgElement("defs");a.append(...n.defs),r.append(a)}return r.append(...n.elements),r.outerHTML}static*extractBBoxes(e,i){for(const s of e)if(!i||s.visible&&!s.transitionOut){const n=s.getBBox();n&&(yield n)}}get datum(){return this._datum??this.parentNode?.datum}set datum(e){this._datum!==e&&(this._previousDatum=this._datum,this._datum=e)}get previousDatum(){return this._previousDatum}get layerManager(){return this._layerManager}get dirty(){return this._dirty}preRender(e,i=1){this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i;for(const s of this.children()){const n=s.preRender(e);this.childNodeCounts.groups+=n.groups,this.childNodeCounts.nonGroups+=n.nonGroups,this.childNodeCounts.complexity+=n.complexity}return this.childNodeCounts}render(e){const{stats:i}=e;if(this._dirty=!1,e.debugNodeSearch){const s=this.name??this.id;e.debugNodeSearch.some(n=>typeof n=="string"?n===s:n.test(s))&&(e.debugNodes[this.name??this.id]=this)}i&&(i.nodesRendered++,i.opsPerformed+=this.childNodeCounts.thisComplexity)}_setLayerManager(e){this._layerManager=e,this._debug=e?.debug;for(const i of this.children())i._setLayerManager(e)}sortChildren(e){if(this.dirtyZIndex=!1,!this.childNodes)return;const i=[...this.childNodes].sort(e);this.childNodes.clear();for(const s of i)this.childNodes.add(s)}*traverseUp(e){let i=this;for(e&&(yield i);i=i.parentNode;)yield i}*children(){if(this.childNodes)for(const e of this.childNodes)yield e}*descendants(){for(const e of this.children())yield e,yield*e.descendants()}isLeaf(){return!this.childNodes?.size}isRoot(){return!this.parentNode}append(e){this.childNodes??(this.childNodes=new Set);for(const i of toIterable(e))i.parentNode?.removeChild(i),this.childNodes.add(i),i.parentNode=this,i._setLayerManager(this.layerManager);this.invalidateCachedBBox(),this.dirtyZIndex=!0,this.markDirty()}appendChild(e){return this.append(e),e}removeChild(e){return this.childNodes?.delete(e)?(delete e.parentNode,e._setLayerManager(),this.invalidateCachedBBox(),this.dirtyZIndex=!0,this.markDirty(),!0):!1}remove(){return this.parentNode?.removeChild(this)??!1}clear(){for(const e of this.children())delete e.parentNode,e._setLayerManager();this.childNodes?.clear(),this.invalidateCachedBBox()}destroy(){this.parentNode?.removeChild(this)}setProperties(e,i){if(i)for(const s of i)this[s]=e[s];else Object.assign(this,e);return this}containsPoint(e,i){return!1}pickNode(e,i,s=!1){if(!this.visible||this.pointerEvents===1||!this.containsPoint(e,i))return;const n=[...this.children()];if(n.length>1e3)for(let r=n.length-1;r>=0;r--){const a=n[r],c=a.containsPoint(e,i)?a.pickNode(e,i):void 0;if(c)return c}else if(n.length)for(let r=n.length-1;r>=0;r--){const a=n[r].pickNode(e,i);if(a)return a}else if(!this.isContainerNode)return this}invalidateCachedBBox(){this.cachedBBox!=null&&(this.cachedBBox=void 0,this.parentNode?.invalidateCachedBBox())}getBBox(){return this.cachedBBox==null&&(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}markDirty(){const{_dirty:e}=this;this.cachedBBox==null&&e||(this.invalidateCachedBBox(),this._dirty=!0,this.parentNode&&this.parentNode.markDirty())}markClean(){if(this._dirty){this._dirty=!1;for(const e of this.children())e.markClean()}}onZIndexChange(){const{parentNode:e}=this;e&&(e.dirtyZIndex=!0)}toSVG(){}};_Node._nextSerialNumber=0,__decorateClass([SceneChangeDetection()],_Node.prototype,"visible",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onZIndexChange()})],_Node.prototype,"zIndex",2);var Node=_Node,lerp=(t,e,i)=>t*(1-i)+e*i,srgbToLinear=t=>{const e=t<0?-1:1,i=Math.abs(t);return i<=.04045?t/12.92:e*((i+.055)/1.055)**2.4},srgbFromLinear=t=>{const e=t<0?-1:1,i=Math.abs(t);return i>.0031308?e*(1.055*i**(1/2.4)-.055):12.92*t},_Color=class N{constructor(e,i,s,n=1){this.r=clamp(0,e||0,1),this.g=clamp(0,i||0,1),this.b=clamp(0,s||0,1),this.a=clamp(0,n||0,1)}static validColorString(e){return e.indexOf("#")>=0?!!N.parseHex(e):e.indexOf("rgb")>=0?!!N.stringToRgba(e):N.nameToHex.has(e.toLowerCase())}static fromString(e){if(e.indexOf("#")>=0)return N.fromHexString(e);const i=N.nameToHex.get(e.toLowerCase());if(i)return N.fromHexString(i);if(e.indexOf("rgb")>=0)return N.fromRgbaString(e);throw new Error(`Invalid color string: '${e}'`)}static parseHex(e){e=e.replace(/ /g,"").slice(1);let i;switch(e.length){case 6:case 8:i=[];for(let s=0;sparseInt(s,16)).map(s=>s+s*16);break}if(i?.length>=3&&i.every(s=>s>=0))return i.length===3&&i.push(255),i}static fromHexString(e){const i=N.parseHex(e);if(i){const[s,n,r,a]=i;return new N(s/255,n/255,r/255,a/255)}throw new Error(`Malformed hexadecimal color string: '${e}'`)}static stringToRgba(e){let i=-1,s=-1;for(let o=0;o=0?(l=clamp(0,l,100),l/=100):o===3?l=clamp(0,l,1):(l=clamp(0,l,255),l/=255),a.push(l)}return a}static fromRgbaString(e){const i=N.stringToRgba(e);if(i){if(i.length===3)return new N(i[0],i[1],i[2]);if(i.length===4)return new N(i[0],i[1],i[2],i[3])}throw new Error(`Malformed rgb/rgba color string: '${e}'`)}static fromArray(e){if(e.length===4)return new N(e[0],e[1],e[2],e[3]);if(e.length===3)return new N(e[0],e[1],e[2]);throw new Error("The given array should contain 3 or 4 color components (numbers).")}static fromHSB(e,i,s,n=1){const r=N.HSBtoRGB(e,i,s);return new N(r[0],r[1],r[2],n)}static fromHSL(e,i,s,n=1){const r=N.HSLtoRGB(e,i,s);return new N(r[0],r[1],r[2],n)}static fromOKLCH(e,i,s,n=1){const r=N.OKLCHtoRGB(e,i,s);return new N(r[0],r[1],r[2],n)}static padHex(e){return e.length===1?"0"+e:e}toHexString(){let e="#"+N.padHex(Math.round(this.r*255).toString(16))+N.padHex(Math.round(this.g*255).toString(16))+N.padHex(Math.round(this.b*255).toString(16));return this.a<1&&(e+=N.padHex(Math.round(this.a*255).toString(16))),e}toRgbaString(e=3){const i=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)],s=Math.pow(10,e);return this.a!==1?(i.push(Math.round(this.a*s)/s),`rgba(${i.join(", ")})`):`rgb(${i.join(", ")})`}toString(){return this.a===1?this.toHexString():this.toRgbaString()}toHSB(){return N.RGBtoHSB(this.r,this.g,this.b)}static RGBtoOKLCH(e,i,s){const n=srgbToLinear(e),r=srgbToLinear(i),a=srgbToLinear(s),o=Math.cbrt(.4122214708*n+.5363325363*r+.0514459929*a),c=Math.cbrt(.2119034982*n+.6806995451*r+.1073969566*a),l=Math.cbrt(.0883024619*n+.2817188376*r+.6299787005*a),h=.2104542553*o+.793617785*c-.0040720468*l,u=1.9779984951*o-2.428592205*c+.4505937099*l,d=.0259040371*o+.7827717662*c-.808675766*l,g=Math.atan2(d,u)*180/Math.PI,p=h,f=Math.hypot(u,d),y=g>=0?g:g+360;return[p,f,y]}static OKLCHtoRGB(e,i,s){const n=e,r=i*Math.cos(s*Math.PI/180),a=i*Math.sin(s*Math.PI/180),o=(n+.3963377774*r+.2158037573*a)**3,c=(n-.1055613458*r-.0638541728*a)**3,l=(n-.0894841775*r-1.291485548*a)**3,h=4.0767416621*o-3.3077115913*c+.2309699292*l,u=-1.2684380046*o+2.6097574011*c-.3413193965*l,d=-.0041960863*o-.7034186147*c+1.707614701*l,g=srgbFromLinear(h),p=srgbFromLinear(u),f=srgbFromLinear(d);return[g,p,f]}static RGBtoHSL(e,i,s){const n=Math.min(e,i,s),r=Math.max(e,i,s),a=(r+n)/2;let o,c;if(r===n)o=0,c=0;else{const l=r-n;c=a>.5?l/(2-r-n):l/(r+n),r===e?o=(i-s)/l+(i1&&(h-=1),h<1/6?r+(n-r)*6*h:h<1/2?n:h<2/3?r+(n-r)*(2/3-h)*6:r}const o=a(e/360+1/3),c=a(e/360),l=a(e/360-1/3);return[o,c,l]}static RGBtoHSB(e,i,s){const n=Math.min(e,i,s),r=Math.max(e,i,s),a=r===0?0:(r-n)/r;let o=0;if(n!==r){const c=r-n,l=(r-e)/c,h=(r-i)/c,u=(r-s)/c;e===r?o=u-h:i===r?o=2+l-u:o=4+h-l,o/=6,o<0&&(o=o+1)}return[o*360,a,r]}static HSBtoRGB(e,i,s){e=(e%360+360)%360/360;let n=0,r=0,a=0;if(i===0)n=r=a=s;else{const o=(e-Math.floor(e))*6,c=o-Math.floor(o),l=s*(1-i),h=s*(1-i*c),u=s*(1-i*(1-c));switch(o>>0){case 0:n=s,r=u,a=l;break;case 1:n=h,r=s,a=l;break;case 2:n=l,r=s,a=u;break;case 3:n=l,r=h,a=s;break;case 4:n=u,r=l,a=s;break;case 5:n=s,r=l,a=h;break}}return[n,r,a]}static mix(e,i,s){return new N(lerp(e.r,i.r,s),lerp(e.g,i.g,s),lerp(e.b,i.b,s),lerp(e.a,i.a,s))}};_Color.nameToHex=new Map([["aliceblue","#F0F8FF"],["antiquewhite","#FAEBD7"],["aqua","#00FFFF"],["aquamarine","#7FFFD4"],["azure","#F0FFFF"],["beige","#F5F5DC"],["bisque","#FFE4C4"],["black","#000000"],["blanchedalmond","#FFEBCD"],["blue","#0000FF"],["blueviolet","#8A2BE2"],["brown","#A52A2A"],["burlywood","#DEB887"],["cadetblue","#5F9EA0"],["chartreuse","#7FFF00"],["chocolate","#D2691E"],["coral","#FF7F50"],["cornflowerblue","#6495ED"],["cornsilk","#FFF8DC"],["crimson","#DC143C"],["cyan","#00FFFF"],["darkblue","#00008B"],["darkcyan","#008B8B"],["darkgoldenrod","#B8860B"],["darkgray","#A9A9A9"],["darkgreen","#006400"],["darkgrey","#A9A9A9"],["darkkhaki","#BDB76B"],["darkmagenta","#8B008B"],["darkolivegreen","#556B2F"],["darkorange","#FF8C00"],["darkorchid","#9932CC"],["darkred","#8B0000"],["darksalmon","#E9967A"],["darkseagreen","#8FBC8F"],["darkslateblue","#483D8B"],["darkslategray","#2F4F4F"],["darkslategrey","#2F4F4F"],["darkturquoise","#00CED1"],["darkviolet","#9400D3"],["deeppink","#FF1493"],["deepskyblue","#00BFFF"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1E90FF"],["firebrick","#B22222"],["floralwhite","#FFFAF0"],["forestgreen","#228B22"],["fuchsia","#FF00FF"],["gainsboro","#DCDCDC"],["ghostwhite","#F8F8FF"],["gold","#FFD700"],["goldenrod","#DAA520"],["gray","#808080"],["green","#008000"],["greenyellow","#ADFF2F"],["grey","#808080"],["honeydew","#F0FFF0"],["hotpink","#FF69B4"],["indianred","#CD5C5C"],["indigo","#4B0082"],["ivory","#FFFFF0"],["khaki","#F0E68C"],["lavender","#E6E6FA"],["lavenderblush","#FFF0F5"],["lawngreen","#7CFC00"],["lemonchiffon","#FFFACD"],["lightblue","#ADD8E6"],["lightcoral","#F08080"],["lightcyan","#E0FFFF"],["lightgoldenrodyellow","#FAFAD2"],["lightgray","#D3D3D3"],["lightgreen","#90EE90"],["lightgrey","#D3D3D3"],["lightpink","#FFB6C1"],["lightsalmon","#FFA07A"],["lightseagreen","#20B2AA"],["lightskyblue","#87CEFA"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#B0C4DE"],["lightyellow","#FFFFE0"],["lime","#00FF00"],["limegreen","#32CD32"],["linen","#FAF0E6"],["magenta","#FF00FF"],["maroon","#800000"],["mediumaquamarine","#66CDAA"],["mediumblue","#0000CD"],["mediumorchid","#BA55D3"],["mediumpurple","#9370DB"],["mediumseagreen","#3CB371"],["mediumslateblue","#7B68EE"],["mediumspringgreen","#00FA9A"],["mediumturquoise","#48D1CC"],["mediumvioletred","#C71585"],["midnightblue","#191970"],["mintcream","#F5FFFA"],["mistyrose","#FFE4E1"],["moccasin","#FFE4B5"],["navajowhite","#FFDEAD"],["navy","#000080"],["oldlace","#FDF5E6"],["olive","#808000"],["olivedrab","#6B8E23"],["orange","#FFA500"],["orangered","#FF4500"],["orchid","#DA70D6"],["palegoldenrod","#EEE8AA"],["palegreen","#98FB98"],["paleturquoise","#AFEEEE"],["palevioletred","#DB7093"],["papayawhip","#FFEFD5"],["peachpuff","#FFDAB9"],["peru","#CD853F"],["pink","#FFC0CB"],["plum","#DDA0DD"],["powderblue","#B0E0E6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#FF0000"],["rosybrown","#BC8F8F"],["royalblue","#4169E1"],["saddlebrown","#8B4513"],["salmon","#FA8072"],["sandybrown","#F4A460"],["seagreen","#2E8B57"],["seashell","#FFF5EE"],["sienna","#A0522D"],["silver","#C0C0C0"],["skyblue","#87CEEB"],["slateblue","#6A5ACD"],["slategray","#708090"],["slategrey","#708090"],["snow","#FFFAFA"],["springgreen","#00FF7F"],["steelblue","#4682B4"],["tan","#D2B48C"],["teal","#008080"],["thistle","#D8BFD8"],["tomato","#FF6347"],["transparent","#00000000"],["turquoise","#40E0D0"],["violet","#EE82EE"],["wheat","#F5DEB3"],["white","#FFFFFF"],["whitesmoke","#F5F5F5"],["yellow","#FFFF00"],["yellowgreen","#9ACD32"]]);var Color=_Color;function interpolateNumber(t,e){return i=>Number(t)*(1-i)+Number(e)*i}function interpolateColor(t,e){if(typeof t=="string")try{t=Color.fromString(t)}catch{t=Color.fromArray([0,0,0])}if(typeof e=="string")try{e=Color.fromString(e)}catch{e=Color.fromArray([0,0,0])}return i=>Color.mix(t,e,i).toRgbaString()}var BREAK_TRANSFORM_CHAIN=Symbol("BREAK"),CONFIG_KEY="__decorator_config";function initialiseConfig(t,e){Object.getOwnPropertyDescriptor(t,CONFIG_KEY)==null&&Object.defineProperty(t,CONFIG_KEY,{value:{}});const i=t[CONFIG_KEY],s=e.toString();if(typeof i[s]<"u")return i[s];const n=new WeakMap;i[s]={setters:[],getters:[],observers:[],valuesMap:n};const r=Object.getOwnPropertyDescriptor(t,e),a=r?.set,o=r?.get;return Object.defineProperty(t,e,{set:function(h){const{setters:u,observers:d}=i[s];let g;u.some(p=>p.length>2)&&(g=o?o.call(this):n.get(this));for(const p of u)if(h=p(this,e,h,g),h===BREAK_TRANSFORM_CHAIN)return;a?a.call(this,h):n.set(this,h);for(const p of d)p(this,h,g)},get:function(){let h=o?o.call(this):n.get(this);for(const u of i[s].getters)if(h=u(this,e,h),h===BREAK_TRANSFORM_CHAIN)return;return h},enumerable:!0,configurable:!1}),i[s]}function addTransformToInstanceProperty(t,e,i){return(s,n)=>{const r=initialiseConfig(s,n);r.setters.push(t),e&&r.getters.unshift(e),i&&Object.assign(r,i)}}function addObserverToInstanceProperty(t){return(e,i)=>{initialiseConfig(e,i).observers.push(t)}}function isDecoratedObject(t){return typeof t<"u"&&CONFIG_KEY in t}function listDecoratedProperties(t){const e=new Set;for(;isDecoratedObject(t);)e.add(t?.[CONFIG_KEY]),t=Object.getPrototypeOf(t);return Array.from(e).flatMap(i=>Object.keys(i))}function extractDecoratedProperties(t){return listDecoratedProperties(t).reduce((e,i)=>(e[i]=t[i]??null,e),{})}function extractDecoratedPropertyMetadata(t,e){const i=e.toString();for(;isDecoratedObject(t);){const s=t[CONFIG_KEY];if(Object.hasOwn(s,i))return s[i];t=Object.getPrototypeOf(t)}}function objectsEqual(t,e){return Array.isArray(t)?!Array.isArray(e)||t.length!==e.length?!1:t.every((i,s)=>objectsEqual(i,e[s])):isPlainObject(t)?isPlainObject(e)?objectsEqualWith(t,e,objectsEqual):!1:t===e}function objectsEqualWith(t,e,i){for(const s of Object.keys(e))if(!(s in t))return!1;for(const s of Object.keys(t))if(!(s in e)||!i(t[s],e[s]))return!1;return!0}function mergeDefaults(...t){const e={};for(const i of t){if(!isObject(i))continue;const s=isDecoratedObject(i)?listDecoratedProperties(i):Object.keys(i);for(const n of s)isPlainObject(e[n])&&isPlainObject(i[n])?e[n]=mergeDefaults(e[n],i[n]):e[n]??(e[n]=i[n])}return e}function without(t,e){const i={...t};for(const s of e)delete i[s];return i}function getPath(t,e){return(isArray(e)?e:e.split(".")).reduce((s,n)=>s[n],t)}var SKIP_JS_BUILTINS=new Set(["__proto__","constructor","prototype"]);function setPath(t,e,i){const s=isArray(e)?e.slice():e.split("."),n=s.pop();if(s.some(a=>SKIP_JS_BUILTINS.has(a)))return;const r=s.reduce((a,o)=>a[o],t);return r[n]=i,r[n]}function partialAssign(t,e,i){if(i===void 0)return e;for(const s of t){const n=i[s];n!==void 0&&(e[s]=n)}return e}var linear=t=>t,easeOut=t=>Math.sin(t*Math.PI/2),QUICK_TRANSITION=.2,PHASE_ORDER=["initial","remove","update","add","trailing","end","none"],PHASE_METADATA={initial:{animationDuration:1,animationDelay:0},add:{animationDuration:.25,animationDelay:.75},remove:{animationDuration:.25,animationDelay:0},update:{animationDuration:.5,animationDelay:.25},trailing:{animationDuration:QUICK_TRANSITION,animationDelay:1,skipIfNoEarlierAnimations:!0},end:{animationDelay:1+QUICK_TRANSITION,animationDuration:0,skipIfNoEarlierAnimations:!0},none:{animationDuration:0,animationDelay:0}};function isNodeArray(t){return t.every(e=>e instanceof Node)}function deconstructSelectionsOrNodes(t){return isNodeArray(t)?{nodes:t,selections:[]}:{nodes:[],selections:t}}function animationValuesEqual(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((i,s)=>animationValuesEqual(i,e[s])):isInterpolating(t)&&isInterpolating(e)?t.equals(e):isPlainObject(t)&&isPlainObject(e)?objectsEqualWith(t,e,animationValuesEqual):!1}var Animation=class{constructor(t){this.isComplete=!1,this.elapsed=0,this.iteration=0,this.isPlaying=!1,this.isReverse=!1,this.id=t.id,this.groupId=t.groupId,this.autoplay=t.autoplay??!0,this.ease=t.ease??linear,this.phase=t.phase;const e=t.duration??PHASE_METADATA[this.phase].animationDuration;this.duration=e*t.defaultDuration,this.delay=(t.delay??0)*t.defaultDuration,this.onComplete=t.onComplete,this.onPlay=t.onPlay,this.onStop=t.onStop,this.onUpdate=t.onUpdate,this.interpolate=this.createInterpolator(t.from,t.to),this.from=t.from,t.skip===!0&&(this.onUpdate?.(t.to,!1,this),this.onStop?.(this),this.onComplete?.(this),this.isComplete=!0),t.collapsable!==!1&&(this.duration=this.checkCollapse(t,this.duration))}checkCollapse(t,e){return animationValuesEqual(t.from,t.to)?0:e}play(t=!1){this.isPlaying||this.isComplete||(this.isPlaying=!0,this.onPlay?.(this),this.autoplay&&(this.autoplay=!1,t&&this.onUpdate?.(this.from,!0,this)))}stop(){this.isPlaying=!1,this.isComplete||(this.isComplete=!0,this.onStop?.(this))}update(t){if(this.isComplete)return t;!this.isPlaying&&this.autoplay&&this.play(!0);const e=this.elapsed;if(this.elapsed+=t,this.delay>this.elapsed)return 0;const i=this.interpolate(this.isReverse?1-this.delta:this.delta);this.onUpdate?.(i,!1,this);const s=this.delay+this.duration;return this.elapsed>=s?(this.stop(),this.isComplete=!0,this.onComplete?.(this),t-(s-e)):0}get delta(){return this.ease(clamp(0,(this.elapsed-this.delay)/this.duration,1))}createInterpolator(t,e){if(typeof e!="object"||isInterpolating(e))return this.interpolateValue(t,e);const i=[];for(const s of Object.keys(e)){const n=this.interpolateValue(t[s],e[s]);n!=null&&i.push([s,n])}return s=>{const n={};for(const[r,a]of i)n[r]=a(s);return n}}interpolateValue(t,e){if(!(t==null||e==null)){if(isInterpolating(t))return i=>t[interpolate](e,i);try{switch(typeof t){case"number":return interpolateNumber(t,e);case"string":return interpolateColor(t,e);case"boolean":if(t===e)return()=>t;break}}catch{}throw new Error(`Unable to interpolate values: ${t}, ${e}`)}}},NODE_UPDATE_STATE_TO_PHASE_MAPPING={added:"add",updated:"update",removed:"remove",unknown:"initial","no-op":"none"};function fromToMotion(t,e,i,s,n,r,a){const{fromFn:o,toFn:c,applyFn:l=(p,f)=>p.setProperties(f)}=n,{nodes:h,selections:u}=deconstructSelectionsOrNodes(s),d=(p,f)=>{let y,m=0,x=0;for(const b of f){const v=p[m]===b,I={last:x>=f.length-1,lastLive:m>=p.length-1,prev:f[x-1],prevFromProps:y,prevLive:p[m-1],next:f[x+1],nextLive:p[m+(v?1:0)]},S=`${t}_${e}_${b.id}`;i.stopByAnimationId(S);let D="unknown";v?r&&a&&(D=calculateStatus(b,b.datum,r,a)):D="removed",b.transitionOut=D==="removed";const{phase:w,start:L,finish:A,delay:k,duration:T,...j}=o(b,b.datum,D,I),{phase:X,start:Y,finish:q,delay:J,duration:U,...R}=c(b,b.datum,D,I),G=A==null;i.animate({id:S,groupId:t,phase:w??X??"update",duration:T??U,delay:k??J,from:j,to:R,ease:easeOut,collapsable:G,onPlay:()=>{const P={...L,...Y,...j};l(b,P,"start")},onUpdate(P){l(b,P,"update")},onStop:()=>{const P={...L,...Y,...j,...R,...A,...q};l(b,P,"end")}}),v&&m++,x++,y=j}};let g=0;for(const p of u){const f=p.nodes(),y=f.filter(m=>!p.isGarbage(m));d(y,f),i.animate({id:`${t}_${e}_selection_${g}`,groupId:t,phase:"end",from:0,to:1,ease:easeOut,onStop(){p.cleanup()}}),g++}d(h,h)}function staticFromToMotion(t,e,i,s,n,r,a){const{nodes:o,selections:c}=deconstructSelectionsOrNodes(s),{start:l,finish:h,phase:u}=a;i.animate({id:`${t}_${e}`,groupId:t,phase:u??"update",from:n,to:r,ease:easeOut,onPlay:()=>{if(l){for(const d of o)d.setProperties(l);for(const d of c)for(const g of d.nodes())g.setProperties(l)}},onUpdate(d){for(const g of o)g.setProperties(d);for(const g of c)for(const p of g.nodes())p.setProperties(d)},onStop:()=>{for(const d of o)d.setProperties({...r,...h});for(const d of c){for(const g of d.nodes())g.setProperties({...r,...h});d.cleanup()}}})}function calculateStatus(t,e,i,s){const n=i(t,e);return s.added.has(n)?"added":s.removed.has(n)?"removed":"updated"}var AbstractScale=class{ticks(t,e,i){}niceDomain(t,e=this.domain){return e}tickFormatter(t){}datumFormatter(t){}get bandwidth(){}get step(){}get inset(){}},_ContinuousScale=class rt extends AbstractScale{constructor(e=[],i=[]){super(),this.domain=e,this.range=i,this.defaultClamp=!1}static is(e){return e instanceof rt}normalizeDomains(...e){let i,s=1/0,n,r=-1/0;for(const a of e)for(const o of a){const c=o.valueOf();cr&&(r=c,n=o)}return i!=null&&n!=null?{domain:[i,n],animatable:!0}:{domain:[],animatable:!1}}transform(e){return e}transformInvert(e){return e}calcBandwidth(e=1){const{domain:i}=this,s=this.getPixelRange();if(i.length===0)return s;const n=Math.abs(i[1].valueOf()-i[0].valueOf())/e+1,r=Math.floor(s),a=Math.min(n,r);return s/Math.max(1,a)}convert(e,i=this.defaultClamp){const{domain:s}=this;if(!s||s.length<2)return NaN;const n=Number(this.transform(s[0])),r=Number(this.transform(s[1])),a=Number(this.transform(e)),{range:o}=this,[c,l]=o;if(i){const[h,u]=findMinMax([n,r]);if(au)return l}return n===r?(c+l)/2:a===n?c:a===r?l:c+(a-n)/(r-n)*(l-c)}invert(e,i){const s=this.domain.map(h=>this.transform(h)),[n,r]=s,{range:a}=this,[o,c]=a;let l;return o===c?l=this.toDomain((Number(n)+Number(r))/2):l=this.toDomain(Number(n)+(e-o)/(c-o)*(Number(r)-Number(n))),this.transformInvert(l)}getPixelRange(){const[e,i]=this.range;return Math.abs(i-e)}};_ContinuousScale.defaultTickCount=5;var ContinuousScale=_ContinuousScale,TimeInterval=class{constructor(t,e,i){this._encode=t,this._decode=e,this._rangeCallback=i}floor(t){const e=new Date(t),i=this._encode(e);return this._decode(i)}ceil(t){const e=new Date(Number(t)-1),i=this._encode(e);return this._decode(i+1)}range(t,e,{extend:i=!1,visibleRange:s=[0,1]}={}){let n=!1;t.getTime()>e.getTime()&&([t,e]=[e,t],n=!0);const r=this._rangeCallback?.(t,e),a=this._encode(i?this.floor(t):this.ceil(t)),o=this._encode(i?this.ceil(e):this.floor(e));if(o{const u=r==="start"?l:h;return i=this.getOffset(u,t),()=>i=c}}else typeof r=="number"?i=this.getOffset(new Date(r),t):r instanceof Date&&(i=this.getOffset(r,t));const a=c=>Math.floor((this._encode(c)-i)/t),o=c=>this._decode(c*t+i);return new TimeInterval(a,o,s)}};function encode(t){return t.getTime()}function decode(t){return new Date(t)}var millisecond=new CountableTimeInterval(encode,decode),durationSecond=1e3,durationMinute=durationSecond*60,durationHour=durationMinute*60,durationDay=durationHour*24,durationWeek=durationDay*7,durationMonth=durationDay*30,durationYear=durationDay*365,offset=new Date().getTimezoneOffset()*durationMinute;function encode2(t){return Math.floor((t.getTime()-offset)/durationSecond)}function decode2(t){return new Date(offset+t*durationSecond)}var second=new CountableTimeInterval(encode2,decode2),offset2=new Date().getTimezoneOffset()*durationMinute;function encode3(t){return Math.floor((t.getTime()-offset2)/durationMinute)}function decode3(t){return new Date(offset2+t*durationMinute)}var minute=new CountableTimeInterval(encode3,decode3),offset3=new Date().getTimezoneOffset()*durationMinute;function encode4(t){return Math.floor((t.getTime()-offset3)/durationHour)}function decode4(t){return new Date(offset3+t*durationHour)}var hour=new CountableTimeInterval(encode4,decode4);function encode5(t){const e=t.getTimezoneOffset()*durationMinute;return Math.floor((t.getTime()-e)/durationDay)}function decode5(t){const e=new Date(1970,0,1);return e.setDate(e.getDate()+t),e}var day=new CountableTimeInterval(encode5,decode5);function weekday(t){const i=(7+t-4)%7;function s(r){const a=r.getTimezoneOffset()*durationMinute;return Math.floor((r.getTime()-a)/durationWeek-i/7)}function n(r){const a=new Date(1970,0,1);return a.setDate(a.getDate()+r*7+i),a}return new CountableTimeInterval(s,n)}var sunday=weekday(0),monday=weekday(1),tuesday=weekday(2),wednesday=weekday(3),thursday=weekday(4),friday=weekday(5),saturday=weekday(6);function encode6(t){return t.getFullYear()*12+t.getMonth()}function decode6(t){const e=Math.floor(t/12),i=t-e*12;return new Date(e,i,1)}var month=new CountableTimeInterval(encode6,decode6);function encode7(t){return t.getFullYear()}function decode7(t){const e=new Date;return e.setFullYear(t),e.setMonth(0,1),e.setHours(0,0,0,0),e}var year=new CountableTimeInterval(encode7,decode7),CONSTANTS={periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};function dayOfYear(t,e=new Date(t.getFullYear(),0,1)){const i=t.getTimezoneOffset()-e.getTimezoneOffset(),s=t.getTime()-e.getTime()+i*6e4,n=36e5*24;return Math.floor(s/n)}function weekOfYear(t,e){const s=new Date(t.getFullYear(),0,1).getDay(),n=(e-s+7)%7,r=new Date(t.getFullYear(),0,n+1);return r<=t?Math.floor(dayOfYear(t,r)/7)+1:0}var SUNDAY=0,MONDAY=1,THURSDAY=4;function isoWeekOfYear(t,e=t.getFullYear()){const s=new Date(e,0,1).getDay(),n=(THURSDAY-s+7)%7,r=new Date(e,0,n-(THURSDAY-MONDAY)+1);return r<=t?Math.floor(dayOfYear(t,r)/7)+1:isoWeekOfYear(t,e-1)}function timezone(t){const e=t.getTimezoneOffset(),i=Math.abs(e);return`${e>0?"-":"+"}${pad(Math.floor(i/60),2,"0")}${pad(Math.floor(i%60),2,"0")}`}var FORMATTERS={a:t=>CONSTANTS.shortDays[t.getDay()],A:t=>CONSTANTS.days[t.getDay()],b:t=>CONSTANTS.shortMonths[t.getMonth()],B:t=>CONSTANTS.months[t.getMonth()],c:"%x, %X",d:(t,e)=>pad(t.getDate(),2,e??"0"),e:"%_d",f:(t,e)=>pad(t.getMilliseconds()*1e3,6,e??"0"),H:(t,e)=>pad(t.getHours(),2,e??"0"),I:(t,e)=>{const i=t.getHours()%12;return i===0?"12":pad(i,2,e??"0")},j:(t,e)=>pad(dayOfYear(t)+1,3,e??"0"),m:(t,e)=>pad(t.getMonth()+1,2,e??"0"),M:(t,e)=>pad(t.getMinutes(),2,e??"0"),L:(t,e)=>pad(t.getMilliseconds(),3,e??"0"),p:t=>t.getHours()<12?"AM":"PM",Q:t=>String(t.getTime()),s:t=>String(Math.floor(t.getTime()/1e3)),S:(t,e)=>pad(t.getSeconds(),2,e??"0"),u:t=>{let e=t.getDay();return e<1&&(e+=7),String(e%7)},U:(t,e)=>pad(weekOfYear(t,SUNDAY),2,e??"0"),V:(t,e)=>pad(isoWeekOfYear(t),2,e??"0"),w:(t,e)=>pad(t.getDay(),2,e??"0"),W:(t,e)=>pad(weekOfYear(t,MONDAY),2,e??"0"),x:"%-m/%-d/%Y",X:"%-I:%M:%S %p",y:(t,e)=>pad(t.getFullYear()%100,2,e??"0"),Y:(t,e)=>pad(t.getFullYear(),4,e??"0"),Z:t=>timezone(t),"%":()=>"%"},PADS={_:" ",0:"0","-":""};function pad(t,e,i){const s=String(Math.floor(t));return s.length>=e?s:`${i.repeat(e-s.length)}${s}`}function buildFormatter(t){const e=[];for(;t.length>0;){let i=t.indexOf("%");if(i!==0){const o=i>0?t.substring(0,i):t;e.push(o)}if(i<0)break;const s=t[i+1],n=PADS[s];n!=null&&i++;const r=t[i+1],a=FORMATTERS[r];if(typeof a=="function")e.push([a,n]);else if(typeof a=="string"){const o=buildFormatter(a);e.push([o,n])}else e.push(`${n??""}${r}`);t=t.substring(i+2)}return i=>{const s=typeof i=="number"?new Date(i):i;return e.map(n=>typeof n=="string"?n:n[0](s,n[1])).join("")}}function dateToNumber(t){return t instanceof Date?t.getTime():t}function defaultTimeTickFormat(t,e,i){const s=calculateDefaultTimeTickFormat(t,e,i),n=buildFormatter(s);return r=>n(r)}function calculateDefaultTimeTickFormat(t,e,i=0){let s=1/0;for(let h=1;h0,l=isFinite(s)?getIntervalLowestGranularityFormat(s,t):getLowestGranularityFormat(t[0]);return formatStringBuilder(Math.max(l-i,0),c,t)}function getIntervalLowestGranularityFormat(t,e){return t{if(typeof d=="string")return!0;const[g,p,f,y]=d;return y>=t&&p<=r&&r(typeof g=="string"?d.result.push(g):d.used.has(g[0])||(d.result.push(g),d.used.add(g[0])),d),{result:[],used:new Set}).result,h=l.findIndex(d=>typeof d!="string"),u=l.findLastIndex(d=>typeof d!="string");return l.slice(h,u+1).map(d=>typeof d=="string"?d:d[4]).join("").replaceAll(/\s+/g," ").trim()}var Invalidating=(t,e)=>{const i=Symbol(String(e));t[i]=void 0,Object.defineProperty(t,e,{get(){return this[i]},set(s){this[i]!==s&&(this[i]=s,this.invalid=!0)},enumerable:!0,configurable:!1})};function filterVisibleTicks(t,e,i){if(i==null||i[0]===0&&i[1]===1)return t;const s=clamp(0,Math.floor(i[0]*t.length),t.length),n=clamp(0,Math.ceil(i[1]*t.length),t.length),r=e?t.length-n:s,a=e?t.length-s:n;return t.slice(r,a)}var _BandScale=class at extends AbstractScale{constructor(){super(...arguments),this.invalid=!0,this.range=[0,1],this.round=!1,this.interval=void 0,this._bandwidth=1,this._step=1,this._inset=1,this._rawBandwidth=1,this._paddingInner=0,this._paddingOuter=0}static is(e){return e instanceof at}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(e){e=clamp(0,e,1),this._paddingInner=e,this._paddingOuter=e}get padding(){return this._paddingInner}set paddingInner(e){this.invalid=!0,this._paddingInner=clamp(0,e,1)}get paddingInner(){return this._paddingInner}set paddingOuter(e){this.invalid=!0,this._paddingOuter=clamp(0,e,1)}get paddingOuter(){return this._paddingOuter}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&logger_exports.warnOnce("Expected update to not invalidate scale"))}ticks(e,i=this.domain,s){return filterVisibleTicks(i,!1,s)}convert(e,i){this.refresh();const s=this.getIndex(e);return s==null||s<0||s>=this.domain.length?NaN:this.ordinalRange(s)}invertNearestIndex(e){this.refresh();const{domain:i}=this;if(i.length===0)return-1;let s=0,n=i.length-1,r=1/0,a=0;for(;s<=n;){const o=(n+s)/2|0,c=this.ordinalRange(o),l=Math.abs(c-e);if(l===0)return o;l{const{optional:i}=extractDecoratedPropertyMetadata(this,e),s=i===!0||typeof this[e]<"u";return s||logger_exports.warnOnce(`${t??""}[${e}] is required.`),s})}toJson(){return listDecoratedProperties(this).reduce((t,e)=>{const i=this[e];return t[e]=isProperties(i)?i.toJson():i,t},{})}},PropertiesArray=class ot extends Array{constructor(e,...i){super(i.length);const n=(r=>!!r?.prototype?.constructor?.name)(e)?r=>new e().set(r):e;Object.defineProperty(this,"itemFactory",{value:n,enumerable:!1,configurable:!1}),this.set(i)}set(e){if(isArray(e)){this.length=e.length;for(let i=0;ie?.toJson?.()??e)}};function isProperties(t){return t instanceof BaseProperties||t instanceof PropertiesArray}function Validate(t,e={}){const{optional:i=!1,property:s}=e;return addTransformToInstanceProperty((n,r,a)=>{const o={...e,target:n,property:r};if(i&&typeof a>"u"||t(a,o))return isProperties(n[r])&&!isProperties(a)?(n[r].set(a),n[r]):a;const c=s??String(r).replace(/^_*/,""),l=n.constructor.className??n.constructor.name.replace(/Properties$/,""),h=stringifyValue(a,50);return logger_exports.warn(`Property [${c}] of [${l}] cannot be set to [${h}]${t.message?`; expecting ${getPredicateMessage(t,o)}`:""}, ignoring.`),BREAK_TRANSFORM_CHAIN},void 0,{optional:i})}var AND=(...t)=>{const e=[];return predicateWithMessage((i,s)=>(e.length=0,t.every(n=>{const r=n(i,s);return r||e.push(getPredicateMessage(n,s)),r})),()=>e.filter(Boolean).join(" AND "))},OR=(...t)=>predicateWithMessage((e,i)=>t.some(s=>s(e,i)),e=>t.map(getPredicateMessageMapper(e)).filter(Boolean).join(" OR ")),OBJECT=attachObjectRestrictions(predicateWithMessage((t,e)=>isProperties(t)||isObject(t)&&isProperties(e.target[e.property]),"a properties object")),PLAIN_OBJECT=attachObjectRestrictions(predicateWithMessage(t=>isObject(t),"an object")),BOOLEAN=predicateWithMessage(isBoolean,"a boolean"),FUNCTION=predicateWithMessage(isFunction,"a function"),STRING=predicateWithMessage(isString,"a string"),NUMBER=attachNumberRestrictions(predicateWithMessage(isFiniteNumber,"a number")),REAL_NUMBER=predicateWithMessage(t=>isNumber(t)&&!isNaN(t),"a real number"),NAN=predicateWithMessage(t=>isNumber(t)&&isNaN(t),"NaN"),POSITIVE_NUMBER=NUMBER.restrict({min:0}),RATIO=NUMBER.restrict({min:0,max:1}),NUMBER_OR_NAN=OR(NUMBER,NAN),ARRAY=attachArrayRestrictions(predicateWithMessage(isArray,"an array")),ARRAY_OF=(t,e)=>predicateWithMessage((i,s)=>isArray(i)&&i.every(n=>t(n,s)),i=>{const s=getPredicateMessage(ARRAY,i)??"";return typeof e=="function"?`${s} of ${e(i)}`:e?`${s} of ${e}`:s}),isComparable2=t=>isFiniteNumber(t)||isValidDate(t),LESS_THAN=t=>predicateWithMessage((e,i)=>!isComparable2(e)||!isComparable2(i.target[t])||epredicateWithMessage((e,i)=>!isComparable2(e)||!isComparable2(i.target[t])||e>i.target[t],`to be greater than ${t}`),DATE=predicateWithMessage(isValidDate,"Date object"),DATE_OR_DATETIME_MS=OR(DATE,POSITIVE_NUMBER),colorMessage="A color string can be in one of the following formats to be valid: #rgb, #rrggbb, rgb(r, g, b), rgba(r, g, b, a) or a CSS color name such as 'white', 'orange', 'cyan', etc",COLOR_STRING=predicateWithMessage(t=>isString(t)&&Color.validColorString(t),`color String. ${colorMessage}`),COLOR_GRADIENT=attachObjectRestrictions(predicateWithMessage(t=>isObject(t)&&t.type==="gradient","a color gradient object")),COLOR_STRING_ARRAY=predicateWithMessage(ARRAY_OF(COLOR_STRING),`color strings. ${colorMessage}`),BOOLEAN_ARRAY=ARRAY_OF(BOOLEAN,"boolean values"),NUMBER_ARRAY=ARRAY_OF(NUMBER,"numbers"),STRING_ARRAY=ARRAY_OF(STRING,"strings"),DATE_ARRAY=predicateWithMessage(ARRAY_OF(DATE),"Date objects"),OBJECT_ARRAY=predicateWithMessage(ARRAY_OF(OBJECT),"objects"),LINE_CAP=UNION(["butt","round","square"],"a line cap"),LINE_JOIN=UNION(["round","bevel","miter"],"a line join"),LINE_STYLE=UNION(["solid","dashed","dotted"],"a line style"),LINE_DASH=predicateWithMessage(ARRAY_OF(POSITIVE_NUMBER),"numbers specifying the length in pixels of alternating dashes and gaps, for example, [6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels."),POSITION=UNION(["top","right","bottom","left"],"a position"),FONT_STYLE=UNION(["normal","italic","oblique"],"a font style"),FONT_WEIGHT=OR(UNION(["normal","bold","bolder","lighter"],"a font weight"),NUMBER.restrict({min:1,max:1e3})),TEXT_WRAP=UNION(["never","always","hyphenate","on-space"],"a text wrap strategy"),TEXT_ALIGN=UNION(["left","center","right"],"a text align"),VERTICAL_ALIGN=UNION(["top","middle","bottom"],"a vertical align"),OVERFLOW_STRATEGY=UNION(["ellipsis","hide"],"an overflow strategy"),DIRECTION=UNION(["horizontal","vertical"],"a direction"),PLACEMENT=UNION(["inside","outside"],"a placement"),INTERACTION_RANGE=OR(UNION(["exact","nearest"],"interaction range"),NUMBER),LABEL_PLACEMENT=UNION(["top","bottom","left","right"]);function UNION(t,e="a"){return predicateWithMessage((i,s)=>{const n=t.find(r=>{const a=typeof r=="string"?r:r.value;return i===a});if(n==null)return!1;if(typeof n!="string"&&(n.deprecated===!0||n.deprecatedTo!=null)){const r=[`Property [%s] with value '${n.value}' is deprecated.`];n.deprecatedTo&&r.push(`Use ${n.deprecatedTo} instead.`),logger_exports.warnOnce(r.join(" "),s.property)}return!0},`${e} keyword such as ${joinUnionOptions(t)}`)}var MIN_SPACING=OR(AND(NUMBER.restrict({min:1}),LESS_THAN("maxSpacing")),NAN),MAX_SPACING=OR(AND(NUMBER.restrict({min:1}),GREATER_THAN("minSpacing")),NAN);function predicateWithMessage(t,e){return t.message=e,t}function joinUnionOptions(t){const e=t.filter(s=>typeof s=="string"||s.undocumented!==!0).map(s=>`'${typeof s=="string"?s:s.value}'`);if(e.length===1)return e[0];const i=e.pop();return`${e.join(", ")} or ${i}`}function getPredicateMessage(t,e){return isFunction(t.message)?t.message(e):t.message}function getPredicateMessageMapper(t){return e=>getPredicateMessage(e,t)}function attachArrayRestrictions(t){return Object.assign(t,{restrict({length:e,minLength:i}={}){let s="an array";return isNumber(i)&&i>0?s="a non-empty array":isNumber(e)&&(s=`an array of length ${e}`),predicateWithMessage(n=>isArray(n)&&(isNumber(e)?n.length===e:!0)&&(isNumber(i)?n.length>=i:!0),s)}})}function attachNumberRestrictions(t){return Object.assign(t,{restrict({min:e,max:i}={}){const s=["a number"],n=isNumber(e),r=isNumber(i);return n&&r?s.push(`between ${e} and ${i} inclusive`):n?s.push(`greater than or equal to ${e}`):r&&s.push(`less than or equal to ${i}`),predicateWithMessage(a=>isFiniteNumber(a)&&(n?a>=e:!0)&&(r?a<=i:!0),s.join(" "))}})}function attachObjectRestrictions(t){return Object.assign(t,{restrict(e){return predicateWithMessage(i=>i instanceof e,i=>getPredicateMessage(t,i)??`an instance of ${e.name}`)}})}function resetMotion(t,e){const{nodes:i,selections:s}=deconstructSelectionsOrNodes(t);for(const n of s){for(const r of n.nodes()){const a=e(r,r.datum);r.setProperties(a)}n.cleanup()}for(const n of i){const r=e(n,n.datum);n.setProperties(r)}}var LONG_TIME_PERIOD_THRESHOLD=2e3,timeOfLastLog=Date.now(),logTimeGap=()=>{const t=Date.now()-timeOfLastLog;if(t>LONG_TIME_PERIOD_THRESHOLD){const e=(Math.floor(t/100)/10).toFixed(1);logger_exports.log(`**** ${e}s since last log message ****`)}timeOfLastLog=Date.now()},Debug={create(...t){return Object.assign((...i)=>{Debug.check(...t)&&(typeof i[0]=="function"&&(i=toArray(i[0]())),logTimeGap(),logger_exports.log(...i))},{check:()=>Debug.check(...t),group:(i,s)=>Debug.check(...t)?logger_exports.logGroup(i,s):s()})},check(...t){return t.length===0&&t.push(!0),toArray(getWindow("agChartsDebug")).some(i=>t.includes(i))}};function clearContext({context:t,pixelRatio:e,width:i,height:s}){t.save(),t.resetTransform(),t.clearRect(0,0,Math.ceil(i*e),Math.ceil(s*e)),t.restore()}function debugContext(t){if(Debug.check("canvas")){const e=t.save.bind(t),i=t.restore.bind(t);let s=0;Object.assign(t,{save(){e(),s++},restore(){if(s===0)throw new Error("AG Charts - Unable to restore() past depth 0");i(),s--},verifyDepthZero(){if(s!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${s}`)}})}}function canvasDimensions(t,e,i){return[Math.round(t*i),Math.round(e*i)]}var HdpiOffscreenCanvas=class{constructor(t){const{width:e,height:i,pixelRatio:s,willReadFrequently:n=!1}=t;this.width=e,this.height=i,this.pixelRatio=s;const[r,a]=canvasDimensions(e,i,s);this.canvas=new OffscreenCanvas(r,a),this.context=this.canvas.getContext("2d",{willReadFrequently:n}),this.context.setTransform(s,0,0,s,0,0),debugContext(this.context)}drawImage(t,e=0,i=0){return t.drawImage(this.canvas,e,i)}transferToImageBitmap(){return this.canvas.transferToImageBitmap()}resize(t,e,i){if(!(t>0&&e>0))return;const{canvas:s,context:n}=this;if(t!==this.width||e!==this.height||i!==this.pixelRatio){const[r,a]=canvasDimensions(t,e,i);s.width=r,s.height=a}n.setTransform(i,0,0,i,0,0),this.width=t,this.height=e,this.pixelRatio=i}clear(){clearContext(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)}},convertColorStringToOklcha=t=>{const e=Color.fromString(t),[i,s,n]=Color.RGBtoOKLCH(e.r,e.g,e.b);return{l:i,c:s,h:n,a:e.a}},delta=1e-6,isAchromatic=t=>t.c1-delta,interpolateOklch=(t,e,i)=>{i=clamp(0,i,1);let s;if(isAchromatic(t))s=e.h;else if(isAchromatic(e))s=t.h;else{const o=t.h;let c=e.h;const l=e.h-t.h;l>180?c-=360:l<-180&&(c+=360),s=o*(1-i)+c*i}const n=t.c*(1-i)+e.c*i,r=t.l*(1-i)+e.l*i,a=t.a*(1-i)+e.a*i;return Color.fromOKLCH(r,n,s,a)},ColorScale=class extends AbstractScale{constructor(){super(...arguments),this.type="color",this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.parsedRange=this.range.map(convertColorStringToOklcha)}update(){const{domain:t,range:e}=this;t.length<2&&(logger_exports.warnOnce("`colorDomain` should have at least 2 values."),t.length===0?t.push(0,1):t.length===1&&t.push(t[0]+1));for(let i=1;i=n){logger_exports.warnOnce("`colorDomain` values should be supplied in ascending order."),t.sort((r,a)=>r-a);break}}if(e.length0?e[0]:"black");this.parsedRange=this.range.map(convertColorStringToOklcha)}normalizeDomains(...t){return{domain:t.flat(),animatable:!0}}toDomain(){}convert(t){this.refresh();const{domain:e,range:i,parsedRange:s}=this,n=e[0],r=e.at(-1),a=i[0],o=i[i.length-1];if(t<=n)return a;if(t>=r)return o;let c,l;if(e.length===2){const d=(t-n)/(r-n),g=1/(i.length-1);c=i.length<=2?0:Math.min(Math.floor(d*(i.length-1)),i.length-2),l=(d-c*g)/g}else{for(c=0;cr?n<=s||s<=r:!0}function toRadians(t){return t/180*Math.PI}var LinearGradient=class extends Gradient{constructor(t,e,i=0,s){super(t,e,s),this.angle=i}createCanvasGradient(t,e){const{angle:s}=this,n=normalizeAngle360(toRadians(s+90)),r=Math.cos(n),a=Math.sin(n),o=e.width,c=e.height,l=e.x+o*.5,h=e.y+c*.5,u=Math.sqrt(c*c+o*o)/2,d=Math.atan2(c,o);let g;n{const{offset:s}=e,n=t.at(i+1)?.color;return n!=null?[e,{offset:s,color:n}]:[e]})}function getDefaultColorStops(t,e){const i=e==="discrete"?1:0,s=t.map((n,r,{length:a})=>({offset:(r+i)/(a-1+i),color:n}));return e==="discrete"?discreteColorStops(s):s}function getColorStops(t,e,i,s="continuous"){if(t.length===0)return getDefaultColorStops(e,s);if(!stopsAreAscending(t))return logger_exports.warnOnce("[fills] must have the stops defined in ascending order"),[];const n=Math.min(...i),r=Math.max(...i),a=s==="discrete",o=new Float64Array(t.length);let c=0,l=-1;for(let g=0;g=l){l=t.length-1;for(let y=g+1;yg.color!=null)?.color,u;const d=t.map(({color:g},p)=>{const f=o[p];return g!=null?h=g:h!=null?g=h:(u==null&&(u=new ColorScale,u.domain=[0,1],u.range=e),g=u.convert(f)),{offset:f,color:g}});return s==="discrete"?discreteColorStops(d):d}function isGradientFill(t){return t!==null&&isObject(t)&&t.type=="gradient"}function align(t,e,i){const s=Math.round(e*t)/t;return i==null?s:i===0?0:i<1?Math.ceil(i*t)/t:Math.round((i+e)*t)/t-s}function alignBefore(t,e){return Math.floor(e*t)/t}var LINEAR_GRADIENT_REGEXP=/^linear-gradient\((-?[\d.]+)deg,(.*?)\)$/i,_Shape=class z extends Node{constructor(){super(...arguments),this.fillOpacity=1,this.strokeOpacity=1,this.fill=z.defaultStyles.fill,this.stroke=z.defaultStyles.stroke,this.strokeWidth=z.defaultStyles.strokeWidth,this.lineDash=z.defaultStyles.lineDash,this.lineDashOffset=z.defaultStyles.lineDashOffset,this.lineCap=z.defaultStyles.lineCap,this.lineJoin=z.defaultStyles.lineJoin,this.miterLimit=void 0,this.opacity=z.defaultStyles.opacity,this.fillShadow=z.defaultStyles.fillShadow,this.gradientFillOptions={domain:[0,1],defaultColorRange:z.defaultStyles.defaultColorRange}}restoreOwnStyles(){const{defaultStyles:e}=this.constructor;Object.assign(this,e)}getGradient(e){let i;if(e instanceof Gradient)return e;if(typeof e=="string"&&e?.startsWith("linear-gradient")&&(i=LINEAR_GRADIENT_REGEXP.exec(e))){const s=parseFloat(i[1]),n=[],r=i[2],a=/(#[0-9a-f]+)|(rgba?\(.+?\))|([a-z]+)/gi;let o;for(;o=a.exec(r);)n.push(o[0]);return new LinearGradient("rgb",n.map((c,l)=>({color:c,offset:l/(n.length-1)})),s)}else if(isGradientFill(e))return this.createLinearGradient(e)}createLinearGradient(e){const{colorStops:i=[],direction:s}=e,n=s==="horizontal",{domain:r,defaultColorRange:a=[]}=this.gradientFillOptions,o=getColorStops(i,a,r);return new LinearGradient("oklch",o,n?0:90)}onFillChange(){this.fillGradient=this.getGradient(this.fill)}onStrokeChange(){this.strokeGradient=this.getGradient(this.stroke)}align(e,i){return align(this.layerManager?.canvas?.pixelRatio??1,e,i)}fillStroke(e,i){this.renderFill(e,i),this.renderStroke(e,i)}renderFill(e,i){if(this.fill){const{globalAlpha:s}=e;this.applyFill(e),this.applyFillAlpha(e),this.applyShadow(e),this.executeFill(e,i),e.globalAlpha=s}e.shadowColor="rgba(0, 0, 0, 0)"}executeFill(e,i){i?e.fill(i):e.fill()}applyFill(e){const i=this.gradientFillOptions.bbox??this.getBBox();e.fillStyle=this.fillGradient?.createGradient(e,i)??(typeof this.fill=="string"?this.fill:void 0)??"black"}applyStroke(e){e.strokeStyle=this.strokeGradient?.createGradient(e,this.getBBox())??(typeof this.stroke=="string"?this.stroke:void 0)??"black"}applyFillAlpha(e){e.globalAlpha*=this.opacity*this.fillOpacity}applyShadow(e){const i=this.layerManager?.canvas.pixelRatio??1,s=this.fillShadow;s?.enabled&&(e.shadowColor=s.color,e.shadowOffsetX=s.xOffset*i,e.shadowOffsetY=s.yOffset*i,e.shadowBlur=s.blur*i)}renderStroke(e,i){if(this.stroke&&this.strokeWidth){const{globalAlpha:s}=e;this.applyStroke(e),e.globalAlpha*=this.opacity*this.strokeOpacity,e.lineWidth=this.strokeWidth,this.lineDash&&e.setLineDash(this.lineDash),this.lineDashOffset&&(e.lineDashOffset=this.lineDashOffset),this.lineCap&&(e.lineCap=this.lineCap),this.lineJoin&&(e.lineJoin=this.lineJoin),this.miterLimit!=null&&(e.miterLimit=this.miterLimit),this.executeStroke(e,i),e.globalAlpha=s}}executeStroke(e,i){i?e.stroke(i):e.stroke()}containsPoint(e,i){return this.isPointInPath(e,i)}applySvgFillAttributes(e){const{fill:i,fillOpacity:s}=this;e.setAttribute("fill",typeof i=="string"?i:"none"),e.setAttribute("fill-opacity",String(s))}applySvgStrokeAttributes(e){const{stroke:i,strokeOpacity:s,strokeWidth:n,lineDash:r,lineDashOffset:a}=this;if(i!=null&&(e.setAttribute("stroke",typeof i=="string"?i:"none"),e.setAttribute("stroke-opacity",String(s)),e.setAttribute("stroke-width",String(n))),r?.some(o=>o!==0)===!0){const o=r.length%2===1?[...r,...r]:r;e.setAttribute("stroke-dasharray",o.join(" ")),e.setAttribute("stroke-dashoffset",String(a))}}};_Shape.defaultStyles={fill:"black",stroke:void 0,strokeWidth:0,lineDash:void 0,lineDashOffset:0,lineCap:void 0,lineJoin:void 0,opacity:1,fillShadow:void 0,defaultColorRange:["#5090dc","#ef5452"]},__decorateClass([SceneChangeDetection()],_Shape.prototype,"fillOpacity",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"strokeOpacity",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onFillChange()})],_Shape.prototype,"fill",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onStrokeChange()})],_Shape.prototype,"stroke",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"strokeWidth",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineDash",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineDashOffset",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineCap",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineJoin",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"miterLimit",2),__decorateClass([SceneChangeDetection({convertor:t=>clamp(0,t,1)})],_Shape.prototype,"opacity",2),__decorateClass([SceneChangeDetection({checkDirtyOnAssignment:!0})],_Shape.prototype,"fillShadow",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onFillChange()})],_Shape.prototype,"gradientFillOptions",2);var Shape=_Shape,IDENTITY_MATRIX_ELEMENTS=[1,0,0,1,0,0],Matrix=class W{get e(){return[...this.elements]}constructor(e=IDENTITY_MATRIX_ELEMENTS){this.elements=[...e]}setElements(e){const i=this.elements;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],this}get identity(){const e=this.elements;return isNumberEqual(e[0],1)&&isNumberEqual(e[1],0)&&isNumberEqual(e[2],0)&&isNumberEqual(e[3],1)&&isNumberEqual(e[4],0)&&isNumberEqual(e[5],0)}AxB(e,i,s){const n=e[0]*i[0]+e[2]*i[1],r=e[1]*i[0]+e[3]*i[1],a=e[0]*i[2]+e[2]*i[3],o=e[1]*i[2]+e[3]*i[3],c=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];s=s??e,s[0]=n,s[1]=r,s[2]=a,s[3]=o,s[4]=c,s[5]=l}multiplySelf(e){return this.AxB(this.elements,e.elements),this}multiply(e){const i=new Array(6);return e instanceof W?this.AxB(this.elements,e.elements,i):this.AxB(this.elements,[e.a,e.b,e.c,e.d,e.e,e.f],i),new W(i)}preMultiplySelf(e){return this.AxB(e.elements,this.elements,this.elements),this}inverse(){const e=this.elements;let i=e[0],s=e[1],n=e[2],r=e[3];const a=e[4],o=e[5],c=1/(i*r-s*n);return i*=c,s*=c,n*=c,r*=c,new W([r,-s,-n,i,n*o-r*a,s*a-i*o])}invertSelf(){const e=this.elements;let i=e[0],s=e[1],n=e[2],r=e[3];const a=e[4],o=e[5],c=1/(i*r-s*n);return i*=c,s*=c,n*=c,r*=c,e[0]=r,e[1]=-s,e[2]=-n,e[3]=i,e[4]=n*o-r*a,e[5]=s*a-i*o,this}transformPoint(e,i){const s=this.elements;return{x:e*s[0]+i*s[2]+s[4],y:e*s[1]+i*s[3]+s[5]}}transformBBox(e,i){const s=this.elements,n=s[0],r=s[1],a=s[2],o=s[3],c=e.width*.5,l=e.height*.5,h=e.x+c,u=e.y+l,d=Math.abs(c*n)+Math.abs(l*a),g=Math.abs(c*r)+Math.abs(l*o);return i??(i=new BBox(0,0,0,0)),i.x=h*n+u*a+s[4]-d,i.y=h*r+u*o+s[5]-g,i.width=d+d,i.height=g+g,i}toContext(e){if(this.identity)return;const i=this.elements;e.transform(i[0],i[1],i[2],i[3],i[4],i[5])}static updateTransformMatrix(e,i,s,n,r,a,o){const c=i,l=s;let h,u;c===1&&l===1?(h=0,u=0):(h=o?.scalingCenterX??0,u=o?.scalingCenterY??0);const d=n,g=Math.cos(d),p=Math.sin(d);let f,y;d===0?(f=0,y=0):(f=o?.rotationCenterX??0,y=o?.rotationCenterY??0);const m=r,x=a,b=h*(1-c)-f,v=u*(1-l)-y;return e.setElements([g*c,p*c,-p*l,g*l,g*b-p*v+f+m,p*b+g*v+y+x]),e}};function isMatrixTransform(t){return isMatrixTransformType(t.constructor)}var MATRIX_TRANSFORM_TYPE=Symbol("isMatrixTransform");function isMatrixTransformType(t){return t[MATRIX_TRANSFORM_TYPE]===!0}function MatrixTransform(t){var e,i;const s=t;if(isMatrixTransformType(t))return t;const n=Symbol("matrix_combined_transform");class r extends s{constructor(){super(...arguments),this[i]=new Matrix,this._dirtyTransform=!0}markDirtyTransform(){this._dirtyTransform=!0,super.markDirty()}updateMatrix(o){}computeTransformMatrix(){this._dirtyTransform&&(this[n].setElements(IDENTITY_MATRIX_ELEMENTS),this.updateMatrix(this[n]),this._dirtyTransform=!1)}toParent(o){return this.computeTransformMatrix(),this[n].identity?o.clone():this[n].transformBBox(o)}toParentPoint(o,c){return this.computeTransformMatrix(),this[n].identity?{x:o,y:c}:this[n].transformPoint(o,c)}fromParent(o){return this.computeTransformMatrix(),this[n].identity?o.clone():this[n].inverse().transformBBox(o)}fromParentPoint(o,c){return this.computeTransformMatrix(),this[n].identity?{x:o,y:c}:this[n].inverse().transformPoint(o,c)}computeBBox(){const o=super.computeBBox();return o&&this.toParent(o)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(o,c,l=!1){return l||({x:o,y:c}=this.fromParentPoint(o,c)),super.pickNode(o,c)}render(o){this.computeTransformMatrix();const{ctx:c}=o,l=this[n];let h=!1;l.identity||(c.save(),h=!0,l.toContext(c)),super.render(o),h&&c.restore()}toSVG(){this.computeTransformMatrix();const o=super.toSVG(),c=this[n];if(c.identity||o==null)return o;const l=createSvgElement("g");l.append(...o.elements);const[h,u,d,g,p,f]=c.e;return l.setAttribute("transform",`matrix(${h} ${u} ${d} ${g} ${p} ${f})`),{elements:[l],defs:o.defs}}}return e=MATRIX_TRANSFORM_TYPE,i=n,r[e]=!0,r}function Rotatable(t){var e;const i=t,s=Symbol("matrix_rotation");class n extends MatrixTransform(i){constructor(){super(...arguments),this[e]=new Matrix,this.rotationCenterX=null,this.rotationCenterY=null,this.rotation=0}updateMatrix(a){super.updateMatrix(a);const{rotation:o,rotationCenterX:c,rotationCenterY:l}=this;o!==0&&(Matrix.updateTransformMatrix(this[s],1,1,o,0,0,{rotationCenterX:c,rotationCenterY:l}),a.multiplySelf(this[s]))}}return e=s,__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"rotationCenterX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"rotationCenterY",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"rotation",2),n}function Scalable(t){var e;const i=t,s=Symbol("matrix_scale");class n extends MatrixTransform(i){constructor(){super(...arguments),this[e]=new Matrix,this.scalingX=1,this.scalingY=1,this.scalingCenterX=null,this.scalingCenterY=null}updateMatrix(a){super.updateMatrix(a);const{scalingX:o,scalingY:c,scalingCenterX:l,scalingCenterY:h}=this;o===1&&c===1||(Matrix.updateTransformMatrix(this[s],o,c,0,0,0,{scalingCenterX:l,scalingCenterY:h}),a.multiplySelf(this[s]))}}return e=s,__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingY",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingCenterX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingCenterY",2),n}function Translatable(t){var e;const i=t,s=Symbol("matrix_translation");class n extends MatrixTransform(i){constructor(){super(...arguments),this[e]=new Matrix,this.translationX=0,this.translationY=0}updateMatrix(a){super.updateMatrix(a);const{translationX:o,translationY:c}=this;o===0&&c===0||(Matrix.updateTransformMatrix(this[s],1,1,0,o,c),a.multiplySelf(this[s]))}}return e=s,__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"translationX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"translationY",2),n}var Transformable=class{static fromCanvas(t,e){const i=[];for(const s of t.traverseUp())isMatrixTransform(s)&&i.unshift(s);for(const s of i)e=s.fromParent(e);return isMatrixTransform(t)&&(e=t.fromParent(e)),e}static toCanvas(t,e){e==null?e=t.getBBox():isMatrixTransform(t)&&(e=t.toParent(e));for(const i of t.traverseUp())isMatrixTransform(i)&&(e=i.toParent(e));return e}static fromCanvasPoint(t,e,i){const s=[];for(const n of t.traverseUp())isMatrixTransform(n)&&s.unshift(n);for(const n of s)({x:e,y:i}=n.fromParentPoint(e,i));return isMatrixTransform(t)&&({x:e,y:i}=t.fromParentPoint(e,i)),{x:e,y:i}}static toCanvasPoint(t,e,i){isMatrixTransform(t)&&({x:e,y:i}=t.toParentPoint(e,i));for(const s of t.traverseUp())isMatrixTransform(s)&&({x:e,y:i}=s.toParentPoint(e,i));return{x:e,y:i}}},cmp=(t,e)=>Math.sign(t-e);function compareZIndex(t,e){if(typeof t=="number"&&typeof e=="number")return cmp(t,e);const i=typeof t=="number"?[t]:t,s=typeof e=="number"?[e]:e,n=Math.min(i.length,s.length);for(let r=0;r0&&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(e){const{layer:i,renderToOffscreenCanvas:s}=this,n={...e};if(!s){this.renderInContext(n),super.render(n);return}const{ctx:r,stats:a,devicePixelRatio:o}=e;let{image:c}=this;if(this.isDirty(e)){c?.bitmap.close(),c=void 0;const h=i?void 0:this.computeSafeClippingBBox(o),u=(d,...g)=>{const p=d.context;n.ctx=p,d.clear(),p.save(),p.setTransform(...g),p.globalAlpha=1,this.renderInContext(n),p.restore(),p.verifyDepthZero?.()};if(i)u(i,r.getTransform());else if(h){const{x:d,y:g,width:p,height:f}=h,y=this.prepareSharedCanvas(p,f,o);u(y,o,0,0,o,-d*o,-g*o),c={bitmap:y.transferToImageBitmap(),x:d,y:g,width:p,height:f}}else this.dirtyZIndex&&this.sortChildren(H.compareChildren);this.image=c,a&&a.layersRendered++}else this.skipRender(n),a&&a.layersSkipped++;const{globalAlpha:l}=r;if(r.globalAlpha=l*this.opacity,i)r.save(),r.resetTransform(),i.drawImage(r),r.restore();else if(c){const{bitmap:h,x:u,y:d,width:g,height:p}=c;r.drawImage(h,0,0,g*o,p*o,u,d,g,p)}r.globalAlpha=l,super.render(n)}skipRender(e){const{stats:i}=e;for(const s of this.children())s.markClean(),i&&(i.nodesSkipped+=this.childNodeCounts.groups+this.childNodeCounts.nonGroups,i.opsSkipped+=this.childNodeCounts.complexity)}applyClip(e,i){const{x:s,y:n,width:r,height:a}=i;e.beginPath(),e.rect(s,n,r,a),e.clip()}renderInContext(e){const{ctx:i,stats:s}=e;this.dirtyZIndex&&this.sortChildren(H.compareChildren),i.save(),i.globalAlpha*=this.opacity,this.clipRect!=null&&(this.applyClip(i,this.clipRect),e.clipBBox=Transformable.toCanvas(this,this.clipRect));for(const n of this.children()){if(!n.visible){n.markClean(),s&&(s.nodesSkipped+=n.childNodeCounts.nonGroups+n.childNodeCounts.groups,s.opsSkipped+=n.childNodeCounts.complexity);continue}i.save(),n.render(e),i.restore()}i.restore()}setClipRect(e){this.clipRect=e?Transformable.fromCanvas(this,e):void 0}setClipRectCanvasSpace(e){this.clipRect=e}_setLayerManager(e){this.layer&&(this._layerManager?.removeLayer(this.layer),this.layer=void 0),super._setLayerManager(e)}getVisibility(){for(const e of this.traverseUp(!0))if(!e.visible)return!1;return!0}toSVG(){if(!this.visible)return;const e=[],i=[];for(const s of this.children()){const n=s.toSVG();n!=null&&(i.push(...n.elements),n.defs!=null&&e.push(...n.defs))}return{elements:i,defs:e}}};_Group.className="Group",__decorateClass([SceneChangeDetection({convertor:t=>clamp(0,t,1)})],_Group.prototype,"opacity",2);var Group=_Group,ScalableGroup=class extends Scalable(Group){},RotatableGroup=class extends Rotatable(Group){},TranslatableGroup=class extends Translatable(Group){},TransformableGroup=class extends Rotatable(Translatable(Group)){};function createCanvasContext(t=0,e=0){return new OffscreenCanvas(t,e).getContext("2d")}var LRUCache=class{constructor(t=5){this.maxCacheSize=t,this.store=new Map}get(t){if(!this.store.has(t))return;const e=this.store.get(t);return this.store.delete(t),this.store.set(t,e),e}has(t){return this.store.has(t)}set(t,e){if(this.store.set(t,e),this.store.size>this.maxCacheSize){const i=this.store.keys();let s=this.store.size-this.maxCacheSize;for(;s>0;){const n=i.next();n.done||this.store.delete(n.value),s--}}return e}clear(){this.store.clear()}},CachedTextMeasurerPool=class{static measureText(t,e){return this.getMeasurer(e).measureText(t)}static measureLines(t,e){return this.getMeasurer(e).measureLines(t)}static getMeasurer(t){const e=typeof t.font=="string"?t.font:TextUtils.toFontString(t.font),i=`${e}-${t.textAlign??"start"}-${t.textBaseline??"alphabetic"}`;return this.instanceMap.get(i)??this.createFontMeasurer(e,t,i)}static createFontMeasurer(t,e,i){const s=createCanvasContext();s.font=t,s.textAlign=e.textAlign??"start",s.textBaseline=e.textBaseline??"alphabetic";const n=new CachedTextMeasurer(s,e);return this.instanceMap.set(i,n),n}};CachedTextMeasurerPool.instanceMap=new LRUCache(10);var CachedTextMeasurer=class{constructor(t,e){this.ctx=t,this.measureMap=new LRUCache(100),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline),t.font=typeof e.font=="string"?e.font:TextUtils.toFontString(e.font),this.textMeasurer=new SimpleTextMeasurer(i=>this.cachedCtxMeasureText(i),e.textBaseline??"alphabetic")}textWidth(t,e){return this.textMeasurer.textWidth(t,e)}measureText(t){return this.textMeasurer.measureText(t)}measureLines(t){return this.textMeasurer.measureLines(t)}cachedCtxMeasureText(t){if(!this.measureMap.has(t)){const e=this.ctx.measureText(t);this.measureMap.set(t,{actualBoundingBoxAscent:e.actualBoundingBoxAscent,emHeightAscent:e.emHeightAscent,emHeightDescent:e.emHeightDescent,actualBoundingBoxDescent:e.actualBoundingBoxDescent,actualBoundingBoxLeft:e.actualBoundingBoxLeft,actualBoundingBoxRight:e.actualBoundingBoxRight,alphabeticBaseline:e.alphabeticBaseline,fontBoundingBoxAscent:e.fontBoundingBoxAscent,fontBoundingBoxDescent:e.fontBoundingBoxDescent,hangingBaseline:e.hangingBaseline,ideographicBaseline:e.ideographicBaseline,width:e.width})}return this.measureMap.get(t)}},TextUtils=class{static toFontString({fontSize:t=10,fontStyle:e,fontWeight:i,fontFamily:s,lineHeight:n}){let r="";return e&&(r+=`${e} `),i&&(r+=`${i} `),r+=`${t}px`,n&&(r+=`/${n}px`),r+=` ${s}`,r.trim()}static getLineHeight(t){return Math.ceil(t*this.defaultLineHeight)}static getVerticalModifier(t){switch(t){case"hanging":case"top":return 0;case"middle":return .5;case"alphabetic":case"bottom":case"ideographic":default:return 1}}};TextUtils.EllipsisChar="\u2026",TextUtils.defaultLineHeight=1.15,TextUtils.lineSplitter=/\r?\n/g;var SimpleTextMeasurer=class{constructor(t,e="alphabetic"){this.measureTextFn=t,this.textBaseline=e,this.charMap=new Map}getMetrics(t){const e=this.measureTextFn(t);return e.fontBoundingBoxAscent??(e.fontBoundingBoxAscent=e.emHeightAscent),e.fontBoundingBoxDescent??(e.fontBoundingBoxDescent=e.emHeightDescent),{width:e.width,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,lineHeight:e.fontBoundingBoxAscent+e.fontBoundingBoxDescent,offsetTop:e.actualBoundingBoxAscent,offsetLeft:e.actualBoundingBoxLeft}}getMultilineMetrics(t){let e=0,i=0,s=0,n=0,r=0;const a=TextUtils.getVerticalModifier(this.textBaseline),o=[];let c=0;const l=t.length;for(const h of t){const u=this.measureTextFn(h);u.fontBoundingBoxAscent??(u.fontBoundingBoxAscent=u.emHeightAscent),u.fontBoundingBoxDescent??(u.fontBoundingBoxDescent=u.emHeightDescent),e1?this.measureTextFn(t).width:this.charMap.get(t)??this.charWidth(t)}measureText(t){return this.getMetrics(t)}measureLines(t){const e=typeof t=="string"?t.split(TextUtils.lineSplitter):t;return this.getMultilineMetrics(e)}charWidth(t){const{width:e}=this.measureTextFn(t);return this.charMap.set(t,e),e}},_Text=class $ extends Shape{constructor(){super(...arguments),this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontSize=10,this.fontFamily="sans-serif",this.textAlign=$.defaultStyles.textAlign,this.textBaseline=$.defaultStyles.textBaseline}onTextChange(){this.lines=this.text?.split(` `).map(e=>e.trim())??[]}static computeBBox(e,i,s,n){const{offsetTop:r,offsetLeft:a,width:o,height:c}=CachedTextMeasurerPool.measureLines(e,n);return new BBox(i-a,s-r,o,c)}computeBBox(){const{x:e,y:i,lines:s,textBaseline:n,textAlign:r}=this;return $.computeBBox(s,e,i,{font:this,textBaseline:n,textAlign:r})}isPointInPath(e,i){const s=this.getBBox();return s?s.containsPoint(e,i):!1}render(e){const{ctx:i,stats:s}=e;if(!this.lines.length||!this.layerManager)return s&&(s.nodesSkipped+=1),super.render(e);const{fill:n,stroke:r,strokeWidth:a}=this,{pixelRatio:o}=this.layerManager.canvas;if(i.font=TextUtils.toFontString(this),i.textAlign=this.textAlign,i.textBaseline=this.textBaseline,n){this.applyFill(i),i.globalAlpha*=this.opacity*this.fillOpacity;const{fillShadow:c}=this;c?.enabled&&(i.shadowColor=c.color,i.shadowOffsetX=c.xOffset*o,i.shadowOffsetY=c.yOffset*o,i.shadowBlur=c.blur*o),this.renderLines((l,h,u)=>i.fillText(l,h,u))}if(r&&a){this.applyStroke(i),i.lineWidth=a,i.globalAlpha*=this.opacity*this.strokeOpacity;const{lineDash:c,lineDashOffset:l,lineCap:h,lineJoin:u}=this;c&&i.setLineDash(c),l&&(i.lineDashOffset=l),h&&(i.lineCap=h),u&&(i.lineJoin=u),this.renderLines((d,g,p)=>i.strokeText(d,g,p))}super.render(e)}renderLines(e){const{lines:i,x:s,y:n}=this,r=this.lineHeight??TextUtils.getLineHeight(this.fontSize);let a=(r-r*i.length)*TextUtils.getVerticalModifier(this.textBaseline);for(const o of i)e(o,s,n+a),a+=r}setFont(e){this.fontFamily=e.fontFamily,this.fontSize=e.fontSize,this.fontStyle=e.fontStyle,this.fontWeight=e.fontWeight}setAlign(e){this.textAlign=e.textAlign,this.textBaseline=e.textBaseline}toSVG(){if(!this.visible||!this.text)return;const e=createSvgElement("text");return this.applySvgFillAttributes(e),e.setAttribute("font-family",this.fontFamily?.split(",")[0]??""),e.setAttribute("font-size",String(this.fontSize)),e.setAttribute("font-style",this.fontStyle??""),e.setAttribute("font-weight",String(this.fontWeight??"")),e.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),e.setAttribute("alignment-baseline",{alphabetic:"alphabetic",top:"top",bottom:"bottom",hanging:"hanging",middle:"middle",ideographic:"ideographic"}[this.textBaseline??"alphabetic"]),e.setAttribute("x",String(this.x)),e.setAttribute("y",String(this.y)),e.textContent=this.text??"",{elements:[e]}}};_Text.className="Text",_Text.defaultStyles={...Shape.defaultStyles,textAlign:"start",fontStyle:void 0,fontWeight:void 0,fontSize:10,fontFamily:"sans-serif",textBaseline:"alphabetic"},__decorateClass([SceneChangeDetection()],_Text.prototype,"x",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"y",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onTextChange()})],_Text.prototype,"text",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontStyle",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontWeight",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontSize",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontFamily",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"textAlign",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"textBaseline",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"lineHeight",2);var Text=_Text,RotatableText=class extends Rotatable(Text){},TransformableText=class extends Rotatable(Translatable(Text)){},debugColor="color: green",debugQuietColor="color: grey";function applyProperties(t,e){const i=listDecoratedProperties(e);if(i.length===0)return;const s=extractDecoratedProperties(t);for(const n of i)n in s&&(e[n]=s[n])}var AbstractStateMachine=class{transitionRoot(t,e){this.parent?this.parent.transitionRoot(t,e):this.transition(t,e)}},_StateMachine=class E extends AbstractStateMachine{constructor(e,i,s){super(),this.defaultState=e,this.states=i,this.enterEach=s,this.debug=Debug.create(!0,"animation"),this.state=e,this.debug(`%c${this.constructor.name} | init -> ${e}`,debugColor)}transition(e,i){if(!this.transitionChild(e,i)||this.state===E.child||this.state===E.parent)return;const n=this.state,r=this.states[this.state];let a=r[e];const o=`%c${this.constructor.name} | ${this.state} -> ${e} ->`;if(Array.isArray(a))a=a.find(h=>{if(!h.guard)return!0;const u=h.guard(i);return u||this.debug(`${o} (guarded)`,h.target,debugQuietColor),u});else if(typeof a=="object"&&!(a instanceof E)&&a.guard&&!a.guard(i)){this.debug(`${o} (guarded)`,a.target,debugQuietColor);return}if(!a){this.debug(`${o} ${this.state}`,debugQuietColor);return}const c=this.getDestinationState(a),l=c===this.state?void 0:r.onExit;this.debug(`${o} ${c}`,debugColor),this.state=c,typeof a=="function"?a(i):typeof a=="object"&&!(a instanceof E)&&a.action?.(i),l?.(),this.enterEach?.(n,c),c!==n&&c!==E.child&&c!==E.parent&&this.states[c].onEnter?.(n,i)}transitionAsync(e,i){setTimeout(()=>{this.transition(e,i)},0)}is(e){return this.state===E.child&&this.childState?this.childState.is(e):this.state===e}resetHierarchy(){this.debug(`%c${this.constructor.name} | ${this.state} -> [resetHierarchy] -> ${this.defaultState}`,"color: green"),this.state=this.defaultState}transitionChild(e,i){return this.state!==E.child||!this.childState||(applyProperties(this,this.childState),this.childState.transition(e,i),!this.childState.is(E.parent))?!0:(this.debug(`%c${this.constructor.name} | ${this.state} -> ${e} -> ${this.defaultState}`,debugColor),this.state=this.defaultState,this.states[this.state].onEnter?.(),this.childState.resetHierarchy(),!1)}getDestinationState(e){let i=this.state;return typeof e=="string"?i=e:e instanceof E?(this.childState=e,this.childState.parent=this,i=E.child):typeof e=="object"&&(e.target instanceof E?(this.childState=e.target,this.childState.parent=this,i=E.child):e.target!=null&&(i=e.target)),i}};_StateMachine.child="__child",_StateMachine.parent="__parent";var StateMachine=_StateMachine;function ProxyProperty(t,e){const i=isArray(t)?t:t.split(".");if(i.length===1){const[s]=i;return addTransformToInstanceProperty((n,r,a)=>n[s]=a,n=>n[s],e)}return addTransformToInstanceProperty((s,n,r)=>setPath(s,i,r),s=>getPath(s,i),e)}function ProxyPropertyOnWrite(t,e){return addTransformToInstanceProperty((i,s,n)=>i[t][e??s]=n)}function ActionOnSet(t){const{newValue:e,oldValue:i,changeValue:s}=t;return addTransformToInstanceProperty((n,r,a,o)=>(a!==o&&(o!==void 0&&i?.call(n,o),a!==void 0&&e?.call(n,a),s?.call(n,a,o)),a))}function ObserveChanges(t){return addObserverToInstanceProperty(t)}var TextWrapper=class{static wrapText(t,e){return this.wrapLines(t,e).join(` `)}static wrapLines(t,e){const i=this.textWrap(t,e);return e.overflow==="hide"&&i.some(s=>s.endsWith(TextUtils.EllipsisChar))?[]:i}static appendEllipsis(t){return t.replace(/[.,]{1,5}$/,"")+TextUtils.EllipsisChar}static truncateLine(t,e,i,s){const n=e.textWidth(TextUtils.EllipsisChar);let r=0,a=0;for(;ai)break;r+=o}if(t.length===a&&(!s||r+n<=i))return s?t+TextUtils.EllipsisChar:t;for(t=t.slice(0,a).trimEnd();t.length&&e.textWidth(t)+n>i;)t=t.slice(0,-1).trimEnd();return t+TextUtils.EllipsisChar}static textWrap(t,e){const i=t.split(TextUtils.lineSplitter),s=CachedTextMeasurerPool.getMeasurer(e);if(e.textWrap==="never")return i.map(o=>this.truncateLine(o.trimEnd(),s,e.maxWidth));const n=[],r=e.textWrap==="hyphenate",a=e.textWrap==null||e.textWrap==="on-space";for(const o of i){let c=o.trimEnd();if(c===""){n.push(c);continue}let l=0,h=0,u=0;for(;le.maxWidth){if(l===0)break;const g=s.textWidth(c.slice(0,l+1));if(g<=e.maxWidth){h=g,l++;continue}if(u){const y=this.getWordAt(c,u+1),m=s.textWidth(y);if(m<=e.maxWidth){n.push(c.slice(0,u).trimEnd()),c=c.slice(u).trimStart(),l=0,h=0,u=0;continue}else a&&m>e.maxWidth&&n.push(c.slice(0,u).trimEnd(),this.truncateLine(c.slice(u).trimStart(),s,e.maxWidth,!0))}else a&&n.push(this.truncateLine(c,s,e.maxWidth,!0));if(a){c="";break}const p=r?"-":"";let f=c.slice(0,l).trim();for(;f.length&&s.textWidth(f+p)>e.maxWidth;)f=f.slice(0,-1).trimEnd();if(n.push(f+p),!f.length){c="";break}c=c.slice(f.length).trimStart(),l=-1,h=0,u=0}l++}c&&n.push(c)}return this.avoidOrphans(n,s,e),this.clipLines(n,s,e)}static getWordAt(t,e){const i=t.indexOf(" ",e);return i===-1?t.slice(e):t.slice(e,i)}static clipLines(t,e,i){if(!i.maxHeight)return t;const{height:s,lineMetrics:n}=e.measureLines(t);if(s<=i.maxHeight)return t;for(let r=0,a=0;ri.maxHeight){if(i.overflow==="hide")return[];const c=t.slice(0,r||1),l=c.pop();return c.concat(this.truncateLine(l,e,i.maxWidth,!0))}}return t}static avoidOrphans(t,e,i){if(i.avoidOrphans===!1||t.length<2)return;const{length:s}=t,n=t[s-1],r=t[s-2];if(r.lengththis.updateA11yText(t,e))}computeTextWrap(t,e){const{text:i,padding:s,wrapping:n}=this,r=Math.min(this.maxWidth??1/0,t)-s*2,a=this.maxHeight??e-s*2;if(!isFinite(r)&&!isFinite(a)){this.node.text=i;return}const o=TextWrapper.wrapText(i??"",{maxWidth:r,maxHeight:a,font:this,textWrap:n});this.node.text=o,this.truncated=o.includes(TextUtils.EllipsisChar)}updateA11yText(t,e){const{proxyInteractionService:i}=t;if(this.enabled&&this.text){const s=Transformable.toCanvas(this.node);if(s){const{id:n}=this;this.proxyText??(this.proxyText=i.createProxyElement({type:"text",domManagerId:n,where:e})),this.proxyText.textContent=this.text,this.proxyText.setBounds(s),this.proxyText.addListener("mousemove",r=>this.handleMouseMove(t,r)),this.proxyText.addListener("mouseleave",r=>this.handleMouseLeave(t,r))}}else this.proxyText?.destroy(),this.proxyText=void 0}handleMouseMove(t,e){if(e!=null&&this.enabled&&this.node.visible&&this.truncated){const{x:i,y:s}=Transformable.toCanvas(this.node),n=e.sourceEvent.offsetX+i,r=e.sourceEvent.offsetY+s,a={type:"pointermove",canvasX:n,canvasY:r};t.tooltipManager.updateTooltip(this.id,{canvasX:n,canvasY:r,lastPointerEvent:a,showArrow:!1},{type:"structured",title:this.text})}}handleMouseLeave(t,e){t.tooltipManager.removeTooltip(this.id)}};Caption.SMALL_PADDING=10,Caption.LARGE_PADDING=20,__decorateClass([Validate(BOOLEAN),ProxyPropertyOnWrite("node","visible")],Caption.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"text",2),__decorateClass([Validate(TEXT_ALIGN,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"textAlign",2),__decorateClass([Validate(FONT_STYLE,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER),ProxyPropertyOnWrite("node")],Caption.prototype,"fontSize",2),__decorateClass([Validate(STRING),ProxyPropertyOnWrite("node")],Caption.prototype,"fontFamily",2),__decorateClass([Validate(COLOR_STRING,{optional:!0}),ProxyPropertyOnWrite("node","fill")],Caption.prototype,"color",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Caption.prototype,"spacing",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Caption.prototype,"maxWidth",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Caption.prototype,"maxHeight",2),__decorateClass([Validate(TEXT_WRAP)],Caption.prototype,"wrapping",2),__decorateClass([Validate(POSITIVE_NUMBER)],Caption.prototype,"padding",2),__decorateClass([Validate(STRING)],Caption.prototype,"layoutStyle",2);var ChartAxisDirection=(t=>(t.X="x",t.Y="y",t))(ChartAxisDirection||{}),ModuleMap=class{constructor(){this.moduleMap=new Map}*modules(){for(const t of this.moduleMap.values())yield t.moduleInstance}addModule(t,e){if(this.moduleMap.has(t.optionsKey))throw new Error(`AG Charts - module already initialised: ${t.optionsKey}`);this.moduleMap.set(t.optionsKey,{module:t,moduleInstance:e(t)})}removeModule(t){const e=isString(t)?t:t.optionsKey;this.moduleMap.get(e)?.moduleInstance.destroy(),this.moduleMap.delete(e)}getModule(t){return this.moduleMap.get(isString(t)?t:t.optionsKey)?.moduleInstance}isEnabled(t){return this.moduleMap.has(isString(t)?t:t.optionsKey)}mapModules(t){return Array.from(this.moduleMap.values(),(e,i)=>t(e.moduleInstance,i))}destroy(){for(const t of this.moduleMap.keys())this.moduleMap.get(t)?.moduleInstance.destroy();this.moduleMap.clear()}};function compareDates(t,e){return t.valueOf()-e.valueOf()}function deduplicateSortedArray(t){let e=NaN;const i=[];for(const s of t){const n=s.valueOf();e!==n&&i.push(s),e=n}return i}function sortAndUniqueDates(t){const e=t.slice().sort(compareDates);return datesSortOrder(e)==null?deduplicateSortedArray(e):e}function datesSortOrder(t){if(t.length===0)return 1;const e=Number(t[t.length-1])>Number(t[0])?1:-1;let i=-1/0*e;for(const s of t){const n=s.valueOf();if(Math.sign(n-i)!==e)return;i=n}return e}function parseFormat(t){let e,i;const s=surroundedRegEx.exec(t);s&&([,e,t,i]=s);const n=formatRegEx.exec(t);if(!n)throw new Error(`The number formatter is invalid: ${t}`);const[,r,a,o,c,l,h,u,d,g,p]=n;return{fill:r,align:a,sign:o,symbol:c,zero:l,width:parseInt(h),comma:u,precision:parseInt(d),trim:!!g,type:p,prefix:e,suffix:i}}function numberFormat(t){const e=typeof t=="string"?parseFormat(t):t,{fill:i,align:s,sign:n="-",symbol:r,zero:a,width:o,comma:c,type:l,prefix:h="",suffix:u="",precision:d}=e;let{trim:g}=e;const p=d==null||isNaN(d);let f;if(!l)f=decimalTypes.g,g=!0;else if(l in decimalTypes&&l in integerTypes)f=p?integerTypes[l]:decimalTypes[l];else if(l in decimalTypes)f=decimalTypes[l];else if(l in integerTypes)f=integerTypes[l];else throw new Error(`The number formatter type is invalid: ${l}`);let y;return d==null||p?y=l?6:12:y=d,m=>{let x=f(m,y);return g&&(x=removeTrailingZeros(x)),c&&(x=insertSeparator(x,c)),x=addSign(m,x,n),r&&r!=="#"&&(x=`${r}${x}`),r==="#"&&l==="x"&&(x=`0x${x}`),l==="s"&&(x=`${x}${getSIPrefix(m)}`),(l==="%"||l==="p")&&(x=`${x}%`),o!=null&&!isNaN(o)&&(x=addPadding(x,o,i??a,s)),x=`${h}${x}${u}`,x}}var formatRegEx=/^(?:(.)?([<>=^]))?([+\-( ])?([$€£¥₣₹#])?(0)?(\d+)?(,)?(?:\.(\d+))?(~)?([%a-z])?$/i,surroundedRegEx=/^((?:[^#]|#[^{])*)#{([^}]+)}(.*)$/,integerTypes={b:t=>absFloor(t).toString(2),c:t=>String.fromCharCode(t),d:t=>Math.round(Math.abs(t)).toFixed(0),o:t=>absFloor(t).toString(8),x:t=>absFloor(t).toString(16),X:t=>integerTypes.x(t).toUpperCase(),n:t=>integerTypes.d(t),"%":t=>`${absFloor(t*100).toFixed(0)}`},decimalTypes={e:(t,e)=>Math.abs(t).toExponential(e),E:(t,e)=>decimalTypes.e(t,e).toUpperCase(),f:(t,e)=>Math.abs(t).toFixed(e),F:(t,e)=>decimalTypes.f(t,e).toUpperCase(),g:(t,e)=>{if(t===0)return"0";const i=Math.abs(t),s=Math.floor(Math.log10(i));return s>=-4&&sdecimalTypes.g(t,e).toUpperCase(),n:(t,e)=>decimalTypes.g(t,e),p:(t,e)=>decimalTypes.r(t*100,e),r:(t,e)=>{if(t===0)return"0";const i=Math.abs(t),n=Math.floor(Math.log10(i))-(e-1);if(n<=0)return i.toFixed(-n);const r=10**n;return(Math.round(i/r)*r).toFixed()},s:(t,e)=>{const i=getSIPrefixPower(t);return decimalTypes.r(t/10**i,e)},"%":(t,e)=>decimalTypes.f(t*100,e)},minSIPrefix=-24,maxSIPrefix=24,siPrefixes={[minSIPrefix]:"y",[-21]:"z",[-18]:"a",[-15]:"f",[-12]:"p",[-9]:"n",[-6]:"\xB5",[-3]:"m",0:"",3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",[maxSIPrefix]:"Y"},minusSign="\u2212";function absFloor(t){return Math.floor(Math.abs(t))}function removeTrailingZeros(t){return t.replace(/\.0+$/,"").replace(/(\.[1-9])0+$/,"$1")}function insertSeparator(t,e){let i=t.indexOf(".");i<0&&(i=t.length);const s=t.substring(0,i).split(""),n=t.substring(i);for(let r=s.length-3;r>0;r-=3)s.splice(r,0,e);return`${s.join("")}${n}`}function getSIPrefix(t){return siPrefixes[getSIPrefixPower(t)]}function getSIPrefixPower(t){return clamp(minSIPrefix,t?Math.floor(Math.log10(Math.abs(t))/3)*3:0,maxSIPrefix)}function addSign(t,e,i=""){if(i==="(")return t>=0?e:`(${e})`;const s=i==="+"?"+":"";return`${t>=0?s:minusSign}${e}`}function addPadding(t,e,i=" ",s=">"){let n=t;if(s===">"||!s)n=n.padStart(e,i);else if(s==="<")n=n.padEnd(e,i);else if(s==="^"){const r=Math.max(0,e-n.length),a=Math.ceil(r/2),o=Math.floor(r/2);n=n.padStart(a+n.length,i),n=n.padEnd(o+n.length,i)}return n}var tInterval=(t,e,i)=>({duration:e*i,timeInterval:t,step:i}),TickIntervals=[tInterval(second,durationSecond,1),tInterval(second,durationSecond,5),tInterval(second,durationSecond,15),tInterval(second,durationSecond,30),tInterval(minute,durationMinute,1),tInterval(minute,durationMinute,5),tInterval(minute,durationMinute,15),tInterval(minute,durationMinute,30),tInterval(hour,durationHour,1),tInterval(hour,durationHour,3),tInterval(hour,durationHour,6),tInterval(hour,durationHour,12),tInterval(day,durationDay,1),tInterval(day,durationDay,2),tInterval(sunday,durationWeek,1),tInterval(sunday,durationWeek,2),tInterval(sunday,durationWeek,3),tInterval(month,durationMonth,1),tInterval(month,durationMonth,2),tInterval(month,durationMonth,3),tInterval(month,durationMonth,4),tInterval(month,durationMonth,6),tInterval(year,durationYear,1)],TickMultipliers=[1,2,5,10];function isCloseToInteger(t,e){return Math.abs(Math.round(t)-t)=s&&u<=n;if(l&&!d)continue;const g=Math.abs(u-i);(c>g||l!==d)&&(l||(l=d),c=g,o=h)}return o*a}function decimalPlaces(t){for(let e=t.length-1;e>=0;e-=1)if(t[e]!=="0")return e+1;return 0}function tickFormat(t,e){const i=parseFormat(e??",f");(i.precision==null||isNaN(i.precision))&&(!i.type||"eEFgGnprs".includes(i.type)?i.precision=Math.max(...t.map(n=>{if(!Number.isFinite(n))return 0;const[r,a]=n.toExponential((i.type?6:12)-1).split(/[.e]/g);return(r!=="1"&&r!=="-1"?1:0)+decimalPlaces(a)+1})):"f%".includes(i.type)&&(i.precision=Math.max(...t.map(n=>{if(!Number.isFinite(n)||n===0)return 0;const r=Math.floor(Math.log10(Math.abs(n))),a=i.type?6:12,o=n.toExponential(a-1).split(/[.e]/g)[1],c=decimalPlaces(o);return Math.max(0,c-r)}))));const s=numberFormat(i);return n=>s(Number(n))}function range(t,e,i){if(!Number.isFinite(i)||i<=0)return[];const s=10**countFractionDigits(i),n=Math.min(t,e),r=Math.max(t,e),a=[];for(let o=0;;o+=1){const c=Math.round((n+i*o)*s)/s;if(c>r)break;a.push(c)}return a}function isDenseInterval(t,e){return t>=e?(logger_exports.warnOnce("the configured interval results in more than 1 item per pixel, ignoring. Supply a larger interval or omit this configuration"),!0):!1}function niceTicksDomain(t,e){const i=Math.abs(e-t),s=10**Math.floor(Math.log10(i));let n=1/0,r=[t,e];for(const a of TickMultipliers){const o=a*s,c=Math.floor(t/o)*o,l=Math.ceil(e/o)*o,h=1-i/Math.abs(l-c);n>h&&(n=h,r=[c,l])}return r}function estimateTickCount(t,e,i,s,n,r){r=Math.max(r,t/(n+1)),isNaN(i)&&(i=r),isNaN(s)&&(s=t),i>s&&(i===r?i=s:s=i);const a=Math.max(1,Math.floor(t/(e*i))),o=Math.min(a,Math.ceil(t/(e*s))),c=clamp(o,Math.floor(n/e),a);return{minTickCount:o,maxTickCount:a,tickCount:c}}var TimeScale=class extends ContinuousScale{constructor(){super([],[0,1]),this.type="time"}toDomain(t){return new Date(t)}convert(t,e){return t instanceof Date||(t=new Date(t)),super.convert(t,e)}invert(t){return new Date(super.invert(t))}niceDomain(t,e=this.domain){if(e.length<2)return[];const i=4;let[s,n]=e;for(let r=0;rr%h.duration===0);if(a)return a.timeInterval.every(r/(a.duration/a.step)).range(new Date(t),new Date(e),{visibleRange:n});let o=new Date(Math.min(t,e));const c=new Date(Math.max(t,e)),l=[];for(;o<=c;)l.push(o),o=new Date(o),o.setMilliseconds(o.getMilliseconds()+r);return l}function updateNiceDomainIteration(t,e,i){const{interval:s}=i,n=Math.min(dateToNumber(t),dateToNumber(e)),r=Math.max(dateToNumber(t),dateToNumber(e)),a=t>e;let o;if(s instanceof TimeInterval)o=s;else{const c=typeof s=="number"?(r-n)/Math.max(s,1):i.tickCount??ContinuousScale.defaultTickCount;o=getTickInterval(n,r,c,i.minTickCount,i.maxTickCount)}if(o){const c=o.range(new Date(n),new Date(r),{extend:!0}),l=a?[...c].reverse():c,h=l[0],u=l.at(-1);return[h,u]}else return[t,e]}var OrdinalTimeScale=class ct extends BandScale{constructor(){super(...arguments),this.type="ordinal-time",this._domain=[],this.isReversed=!1}static is(e){return e instanceof ct}set domain(e){e!==this._domain&&(this.invalid=!0,this._domain=e,this.isReversed=e.length>0&&e[0]>e[e.length-1],this.sortedTimestamps=void 0,this.precomputedSteps=void 0)}get domain(){return this._domain}toDomain(e){return new Date(e)}normalizeDomains(...e){const i=e.filter(n=>n.length>0).map(n=>{let r=datesSortOrder(n);return r==null&&(n=sortAndUniqueDates(n.slice()),r=1),{domain:n,sortOrder:r}});if(i.length===0)return{domain:[],animatable:!1};if(i.length===1)return{domain:i[0].domain,animatable:!0};let s=i.flatMap(n=>n.domain);return s=sortAndUniqueDates(s),i.every(n=>n.sortOrder===-1)&&s.reverse(),{domain:s,animatable:!0}}ticks({interval:e,maxTickCount:i},s=this.domain,n=[0,1]){if(!s.length)return[];this.refresh();const{isReversed:r}=this;if(e==null)return getDefaultTicks(s,i,r,n);const[a,o]=[s[0].valueOf(),s.at(-1).valueOf()],c=Math.min(a,o),l=Math.max(a,o),[h,u]=this.range,d=Math.abs(u-h),g=getDateTicksForInterval({start:c,stop:l,interval:e,availableRange:d,visibleRange:n})??[];let p=-1;return g.filter(f=>{const y=this.findInterval(f.valueOf()),m=y===p;return p=y,!m})}getSortedTimestamps(){let{sortedTimestamps:e}=this;return e==null&&(e=this.domain.map(dateToNumber),this.isReversed&&e.reverse(),this.sortedTimestamps=e),e}getPrecomputedSteps(){const{domain:e}=this;let{precomputedSteps:i}=this;const s=e.length<1e4?e.length:Math.ceil(e.length/16);if(i!=null||s<=1)return i;const n=this.getSortedTimestamps();i=new Int32Array(s);const r=n[0],o=n[n.length-1]-r,c=0,l=n.length-1;for(let h=0;hthis.ordinalRange(r)>=e?s[r]:void 0)??s[0]}getIndex(e){const i=this.getSortedTimestamps(),s=Number(e);if(snew i:i}static select(e,i,s=!0){return new F(e,i,s)}static selectAll(e,i){const s=[],n=r=>{i(r)&&s.push(r);for(const a of r.children())n(a)};return n(e),s}static selectByClass(e,...i){return F.selectAll(e,s=>i.some(n=>s instanceof n))}static selectByTag(e,i){return F.selectAll(e,s=>s.tag===i)}createNode(e,i,s){const n=this.nodeFactory(e);return n.datum=e,i?.(n),s==null?this._nodes.push(n):this._nodes.splice(s,0,n),this.parentNode.appendChild(n),n}update(e,i,s){if(this.garbageBin.size>0&&this.debug("Selection - update() called with pending garbage",e),s){const n=new Map(e.map((r,a)=>[s(r),[r,a]]));for(const[r,a]of this._nodesMap.entries())if(n.has(a)){const[o]=n.get(a);r.datum=o,this.garbageBin.delete(r),n.delete(a)}else this.garbageBin.add(r);for(const[r,[a,o]]of n.entries())this._nodesMap.set(this.createNode(a,i,o),r)}else{const n=Math.max(e.length,this.data.length);for(let r=0;r=e.length?this.garbageBin.add(this._nodes[r]):r>=this._nodes.length?this.createNode(e[r],i):(this._nodes[r].datum=e[r],this.garbageBin.delete(this._nodes[r]))}return this.data=e.slice(),this.autoCleanup&&this.cleanup(),this}cleanup(){return this.garbageBin.size===0?this:(this._nodes=this._nodes.filter(e=>this.garbageBin.has(e)?(this._nodesMap.delete(e),this.garbageBin.delete(e),e.destroy(),!1):!0),this)}clear(){return this.update([]),this}isGarbage(e){return this.garbageBin.has(e)}each(e){for(const i of this._nodes.entries())e(i[1],i[1].datum,i[0]);return this}*[Symbol.iterator](){for(let e=0;e=0&&e<=Math.PI?-1:1,r=!s&&i>=0&&i<=Math.PI?-1:1;let a=0;return t.parallel?a=n*Math.PI/2:r===-1&&(a=Math.PI),{configuredRotation:s,defaultRotation:a,parallelFlipFlag:n,regularFlipFlag:r}}function getLabelSpacing(t,e){return isNaN(t)?e?0:10:t}function getTextBaseline(t,e,i,s){return t&&!e?i*s===-1?"hanging":"bottom":"middle"}function getTextAlign(t,e,i,s,n){const r=e>0&&e<=Math.PI,a=i>0&&i<=Math.PI,o=r||a?-1:1;if(t)if(e||i){if(s*o===-1)return"end"}else return"center";else if(s*n===-1)return"end";return"start"}function createLabelData(t,e,i,s){const n=[];for(const{tickLabel:r,translationY:a}of t){if(!r)continue;const{width:o,height:c}=s.measureLines(r),l=new BBox(e,a,o,c),h=new BBox(e,a,0,0);i.transformBBox(h,l);const{x:u,y:d}=l;n.push({point:{x:u,y:d},label:{text:r,width:o,height:c}})}return n}function isNumberObject(t){return t!=null&&Object.hasOwn(t,"valueOf")&&isFiniteNumber(t.valueOf())}function isContinuous(t){return isFiniteNumber(t)||isValidDate(t)||isNumberObject(t)}function checkDatum(t,e){return t!=null&&(!e||isContinuous(t))}var MATCHING_CROSSLINE_TYPE=t=>t==="value"?predicateWithMessage((e,i)=>i.target.type==="line",e=>e.target.type==="range"?"crossLine type 'range' to have a 'range' property instead of 'value'":"crossLine property 'type' to be 'line'"):predicateWithMessage((e,i)=>i.target.type==="range",e=>e.target.type==="line"?"crossLine type 'line' to have a 'value' property instead of 'range'":"crossLine property 'type' to be 'range'"),validateCrossLineValues=(t,e,i,s,n)=>{const r=t==="line"&&e!==void 0,a=t==="range"&&i!==void 0;if(!r&&!a)return!0;const[o,c]=i??[e,void 0],l=ContinuousScale.is(s)||OrdinalTimeScale.is(s),h=checkDatum(o,l)&&!isNaN(s.convert(o)),u=checkDatum(c,l)&&!isNaN(s.convert(c));if(r&&h||a&&h&&u)return n?.()??!0;const d=["Expecting crossLine"];return a?(h||d.push(`range start ${stringifyValue(o)}`),u||d.push(`${h?"":"and "}range end ${stringifyValue(c)}`)):d.push(`value ${stringifyValue(o)}`),d.push("to match the axis scale domain."),logger_exports.warnOnce(d.join(" ")),!1},horizontalCrosslineTranslationDirections={top:{xTranslationDirection:0,yTranslationDirection:-1},bottom:{xTranslationDirection:0,yTranslationDirection:1},left:{xTranslationDirection:-1,yTranslationDirection:0},right:{xTranslationDirection:1,yTranslationDirection:0},"top-left":{xTranslationDirection:1,yTranslationDirection:-1},"top-right":{xTranslationDirection:-1,yTranslationDirection:-1},"bottom-left":{xTranslationDirection:1,yTranslationDirection:1},"bottom-right":{xTranslationDirection:-1,yTranslationDirection:1},inside:{xTranslationDirection:0,yTranslationDirection:0},"inside-left":{xTranslationDirection:1,yTranslationDirection:0},"inside-right":{xTranslationDirection:-1,yTranslationDirection:0},"inside-top":{xTranslationDirection:0,yTranslationDirection:1},"inside-bottom":{xTranslationDirection:0,yTranslationDirection:-1},"inside-top-left":{xTranslationDirection:1,yTranslationDirection:1},"inside-bottom-left":{xTranslationDirection:1,yTranslationDirection:-1},"inside-top-right":{xTranslationDirection:-1,yTranslationDirection:1},"inside-bottom-right":{xTranslationDirection:-1,yTranslationDirection:-1}},verticalCrossLineTranslationDirections={top:{xTranslationDirection:1,yTranslationDirection:0},bottom:{xTranslationDirection:-1,yTranslationDirection:0},left:{xTranslationDirection:0,yTranslationDirection:-1},right:{xTranslationDirection:0,yTranslationDirection:1},"top-left":{xTranslationDirection:-1,yTranslationDirection:-1},"top-right":{xTranslationDirection:-1,yTranslationDirection:1},"bottom-left":{xTranslationDirection:1,yTranslationDirection:-1},"bottom-right":{xTranslationDirection:1,yTranslationDirection:1},inside:{xTranslationDirection:0,yTranslationDirection:0},"inside-left":{xTranslationDirection:0,yTranslationDirection:1},"inside-right":{xTranslationDirection:0,yTranslationDirection:-1},"inside-top":{xTranslationDirection:-1,yTranslationDirection:0},"inside-bottom":{xTranslationDirection:1,yTranslationDirection:0},"inside-top-left":{xTranslationDirection:-1,yTranslationDirection:1},"inside-bottom-left":{xTranslationDirection:1,yTranslationDirection:1},"inside-top-right":{xTranslationDirection:-1,yTranslationDirection:-1},"inside-bottom-right":{xTranslationDirection:1,yTranslationDirection:-1}};function calculateLabelTranslation({yDirection:t,padding:e=0,position:i="top",bbox:s}){const n=t?horizontalCrosslineTranslationDirections:verticalCrossLineTranslationDirections,{xTranslationDirection:r,yTranslationDirection:a}=n[i],o=r*(e+s.width/2),c=a*(e+s.height/2);return{xTranslation:o,yTranslation:c}}function calculateLabelChartPadding({yDirection:t,bbox:e,padding:i=0,position:s="top"}){const n={};return s.startsWith("inside")||(s==="top"&&!t?n.top=i+e.height:s==="bottom"&&!t?n.bottom=i+e.height:s==="left"&&t?n.left=i+e.width:s==="right"&&t&&(n.right=i+e.width)),n}var POSITION_TOP_COORDINATES=({direction:t,xEnd:e,yStart:i,yEnd:s})=>t==="y"?{x:e/2,y:i}:{x:e,y:isNaN(s)?i:(i+s)/2},POSITION_LEFT_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s,yEnd:n})=>t==="y"?{x:e,y:isNaN(n)?s:(s+n)/2}:{x:i/2,y:s},POSITION_RIGHT_COORDINATES=({direction:t,xEnd:e,yStart:i,yEnd:s})=>t==="y"?{x:e,y:isNaN(s)?i:(i+s)/2}:{x:e/2,y:isNaN(s)?i:s},POSITION_BOTTOM_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s,yEnd:n})=>t==="y"?{x:i/2,y:isNaN(n)?s:n}:{x:e,y:isNaN(n)?s:(s+n)/2},POSITION_INSIDE_COORDINATES=({xEnd:t,yStart:e,yEnd:i})=>({x:t/2,y:isNaN(i)?e:(e+i)/2}),POSITION_TOP_LEFT_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s})=>t==="y"?{x:e/2,y:s}:{x:i,y:s},POSITION_BOTTOM_LEFT_COORDINATES=({direction:t,xStart:e,yStart:i,yEnd:s})=>t==="y"?{x:e,y:isNaN(s)?i:s}:{x:e,y:i},POSITION_TOP_RIGHT_COORDINATES=({direction:t,xEnd:e,yStart:i,yEnd:s})=>t==="y"?{x:e,y:i}:{x:e,y:isNaN(s)?i:s},POSITION_BOTTOM_RIGHT_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s,yEnd:n})=>t==="y"?{x:i,y:isNaN(n)?s:n}:{x:e,y:isNaN(n)?s:n},labelDirectionHandling={top:{c:POSITION_TOP_COORDINATES},bottom:{c:POSITION_BOTTOM_COORDINATES},left:{c:POSITION_LEFT_COORDINATES},right:{c:POSITION_RIGHT_COORDINATES},"top-left":{c:POSITION_TOP_LEFT_COORDINATES},"top-right":{c:POSITION_TOP_RIGHT_COORDINATES},"bottom-left":{c:POSITION_BOTTOM_LEFT_COORDINATES},"bottom-right":{c:POSITION_BOTTOM_RIGHT_COORDINATES},inside:{c:POSITION_INSIDE_COORDINATES},"inside-left":{c:POSITION_LEFT_COORDINATES},"inside-right":{c:POSITION_RIGHT_COORDINATES},"inside-top":{c:POSITION_TOP_COORDINATES},"inside-bottom":{c:POSITION_BOTTOM_COORDINATES},"inside-top-left":{c:POSITION_TOP_LEFT_COORDINATES},"inside-bottom-left":{c:POSITION_BOTTOM_LEFT_COORDINATES},"inside-top-right":{c:POSITION_TOP_RIGHT_COORDINATES},"inside-bottom-right":{c:POSITION_BOTTOM_RIGHT_COORDINATES}},CROSSLINE_LABEL_POSITION=UNION(["top","left","right","bottom","top-left","top-right","bottom-left","bottom-right","inside","inside-left","inside-right","inside-top","inside-bottom","inside-top-left","inside-bottom-left","inside-top-right","inside-bottom-right"],"crossLine label position"),CartesianCrossLineLabel=class extends BaseProperties{constructor(){super(...arguments),this.fontSize=14,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianCrossLineLabel.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0})],CartesianCrossLineLabel.prototype,"text",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],CartesianCrossLineLabel.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],CartesianCrossLineLabel.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER)],CartesianCrossLineLabel.prototype,"fontSize",2),__decorateClass([Validate(STRING)],CartesianCrossLineLabel.prototype,"fontFamily",2),__decorateClass([Validate(NUMBER)],CartesianCrossLineLabel.prototype,"padding",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],CartesianCrossLineLabel.prototype,"color",2),__decorateClass([Validate(CROSSLINE_LABEL_POSITION,{optional:!0})],CartesianCrossLineLabel.prototype,"position",2),__decorateClass([Validate(NUMBER,{optional:!0})],CartesianCrossLineLabel.prototype,"rotation",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianCrossLineLabel.prototype,"parallel",2);var CartesianCrossLine=class extends BaseProperties{constructor(){super(),this.id=createId(this),this.label=new CartesianCrossLineLabel,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.sideFlag=-1,this.parallelFlipRotation=0,this.regularFlipRotation=0,this.direction="x",this.rangeGroup=new Group({name:this.id}),this.lineGroup=new Group({name:this.id}),this.labelGroup=new Group({name:this.id}),this.crossLineRange=new Range,this.crossLineLabel=new TransformableText,this.labelPoint=void 0,this.data=[],this.startLine=!1,this.endLine=!1,this.isRange=!1,this._isRange=void 0,this.lineGroup.append(this.crossLineRange),this.labelGroup.append(this.crossLineLabel),this.crossLineRange.pointerEvents=1}update(t){const{enabled:e,data:i,type:s,value:n,range:r,scale:a}=this;if(!s||!a||!e||!t||!validateCrossLineValues(s,n,r,a)||i.length===0){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=t,this.lineGroup.visible=t,this.labelGroup.visible=t,this.updateNodes();const{isRange:o}=this;o!==this._isRange&&(o?this.rangeGroup.appendChild(this.crossLineRange):this.lineGroup.appendChild(this.crossLineRange)),this._isRange=o}calculateLayout(t,e){if(!t)return;const{scale:i,gridLength:s,sideFlag:n,direction:r,label:{position:a="top"},clippedRange:o,strokeWidth:c=0}=this;if(this.data=[],!i)return;const l=i.bandwidth??0,h=i.step??0,u=(e?-1:1)*(i instanceof BandScale?(h-l)/2:0),[d,g]=[0,n*s];let[p,f]=this.getRange();const y=f===void 0&&OrdinalTimeScale.is(i)?l/2+u:0;let[m,x]=[Number(i.convert(p,!0))-u+y,i.convert(f,!0)+l+u];m=clampArray(m,o),x=clampArray(x,o),[p,f]=[Number(i.convert(p))+y,i.convert(f)+l];const b=(p===m||f===x||m!==x)&&Math.abs(x-m)>0;if(b&&m>x&&([m,x]=[x,m],[p,f]=[f,p]),p-u>=m&&(p-=u),f+u<=x&&(f+=u),this.isRange=b,this.startLine=c>0&&p>=m&&p<=m+u,this.endLine=c>0&&f>=x-l-u&&f<=x,!b&&!this.startLine&&!this.endLine||(this.data=[m,x],!this.label.enabled))return;const{c:v=POSITION_TOP_COORDINATES}=labelDirectionHandling[a]??{},{x:I,y:S}=v({direction:r,xStart:d,xEnd:g,yStart:m,yEnd:x});this.labelPoint={x:I,y:S}}updateNodes(){this.updateRangeNode(),this.label.enabled&&(this.updateLabel(),this.positionLabel())}updateRangeNode(){const{crossLineRange:t,sideFlag:e,gridLength:i,data:s,startLine:n,endLine:r,isRange:a,fill:o,fillOpacity:c,stroke:l,strokeWidth:h,lineDash:u}=this;t.x1=0,t.x2=e*i,t.y1=s[0],t.y2=s[1],t.startLine=n,t.endLine=r,t.isRange=a,t.fill=o,t.fillOpacity=c??1,t.stroke=l,t.strokeWidth=h??1,t.strokeOpacity=this.strokeOpacity??1,t.lineDash=u}updateLabel(){const{crossLineLabel:t,label:e}=this;e.text&&(t.fontStyle=e.fontStyle,t.fontWeight=e.fontWeight,t.fontSize=e.fontSize,t.fontFamily=e.fontFamily,t.fill=e.color,t.text=e.text)}positionLabel(){const{crossLineLabel:t,labelPoint:{x:e=void 0,y:i=void 0}={},label:{parallel:s,rotation:n,position:r="top",padding:a=0},direction:o,parallelFlipRotation:c,regularFlipRotation:l}=this;if(e===void 0||i===void 0)return;const{defaultRotation:h,configuredRotation:u}=calculateLabelRotation({rotation:n,parallel:s,regularFlipRotation:l,parallelFlipRotation:c});t.rotation=h+u,t.textBaseline="middle",t.textAlign="center";const d=t.getBBox();if(!d)return;const g=o==="y",{xTranslation:p,yTranslation:f}=calculateLabelTranslation({yDirection:g,padding:a,position:r,bbox:d});t.translationX=e+p,t.translationY=i+f}getRange(){const{value:t,range:e,scale:i}=this,s=ContinuousScale.is(i)||OrdinalTimeScale.is(i),n=e?.[0]??t;let r=e?.[1];return!s&&r===void 0&&(r=n),s&&n===r&&(r=void 0),[n,r]}computeLabelBBox(){const{label:t}=this;if(!t.enabled)return;const e=new TransformableText;e.fontFamily=t.fontFamily,e.fontSize=t.fontSize,e.fontStyle=t.fontStyle,e.fontWeight=t.fontWeight,e.text=t.text;const{labelPoint:{x:i=void 0,y:s=void 0}={},label:{parallel:n,rotation:r,position:a="top",padding:o=0},direction:c,parallelFlipRotation:l,regularFlipRotation:h}=this;if(i===void 0||s===void 0)return;const{configuredRotation:u}=calculateLabelRotation({rotation:r,parallel:n,regularFlipRotation:h,parallelFlipRotation:l});e.rotation=u,e.textBaseline="middle",e.textAlign="center";const d=e.getBBox();if(!d)return;const g=c==="y",{xTranslation:p,yTranslation:f}=calculateLabelTranslation({yDirection:g,padding:o,position:a,bbox:d});return e.x=i+p,e.y=s+f,e.getBBox()}calculatePadding(t){const{isRange:e,startLine:i,endLine:s,direction:n,label:{padding:r=0,position:a="top"}}=this;if(!e&&!i&&!s)return;const o=this.computeLabelBBox();if(o?.x==null||o?.y==null)return;const c=calculateLabelChartPadding({yDirection:n==="y",padding:r,position:a,bbox:o});t.left=Math.max(t.left??0,c.left??0),t.right=Math.max(t.right??0,c.right??0),t.top=Math.max(t.top??0,c.top??0),t.bottom=Math.max(t.bottom??0,c.bottom??0)}};CartesianCrossLine.className="CrossLine",__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianCrossLine.prototype,"enabled",2),__decorateClass([Validate(UNION(["range","line"],"a crossLine type"),{optional:!0})],CartesianCrossLine.prototype,"type",2),__decorateClass([Validate(AND(MATCHING_CROSSLINE_TYPE("range"),ARRAY.restrict({length:2})),{optional:!0})],CartesianCrossLine.prototype,"range",2),__decorateClass([Validate(MATCHING_CROSSLINE_TYPE("value"),{optional:!0})],CartesianCrossLine.prototype,"value",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],CartesianCrossLine.prototype,"fill",2),__decorateClass([Validate(RATIO,{optional:!0})],CartesianCrossLine.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],CartesianCrossLine.prototype,"stroke",2),__decorateClass([Validate(NUMBER,{optional:!0})],CartesianCrossLine.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO,{optional:!0})],CartesianCrossLine.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH,{optional:!0})],CartesianCrossLine.prototype,"lineDash",2),__decorateClass([Validate(OBJECT)],CartesianCrossLine.prototype,"label",2);var GRID_STYLE_KEYS=["stroke","lineDash"],GRID_STYLE=ARRAY_OF(t=>isObject(t)&&Object.keys(t).every(e=>GRID_STYLE_KEYS.includes(e)),"objects with gridline style properties such as 'stroke' or 'lineDash'"),AxisGridLine=class{constructor(){this.enabled=!0,this.width=1,this.style=[{stroke:void 0,lineDash:[]}]}};__decorateClass([Validate(BOOLEAN)],AxisGridLine.prototype,"enabled",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisGridLine.prototype,"width",2),__decorateClass([Validate(GRID_STYLE)],AxisGridLine.prototype,"style",2);function Default(t,e=[void 0]){return addTransformToInstanceProperty((i,s,n)=>e.includes(n)?isFunction(t)?t(n):t:n)}var TICK_INTERVAL=predicateWithMessage(t=>isFiniteNumber(t)&&t>0||t instanceof TimeInterval,"a non-zero positive Number value or, for a time axis, a Time Interval such as 'agCharts.time.month'"),AxisInterval=class extends BaseProperties{constructor(){super(...arguments),this.minSpacing=NaN,this.maxSpacing=NaN}};__decorateClass([Validate(TICK_INTERVAL,{optional:!0})],AxisInterval.prototype,"step",2),__decorateClass([Validate(ARRAY,{optional:!0})],AxisInterval.prototype,"values",2),__decorateClass([Validate(MIN_SPACING),Default(NaN)],AxisInterval.prototype,"minSpacing",2),__decorateClass([Validate(MAX_SPACING),Default(NaN)],AxisInterval.prototype,"maxSpacing",2);var AxisLabel=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0,this.fontSize=12,this.fontFamily="Verdana, sans-serif",this.spacing=5,this.minSpacing=NaN,this.color="#575757",this.avoidCollisions=!0,this.mirrored=!1,this.parallel=!1}getSideFlag(){return this.mirrored?1:-1}};__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"enabled",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],AxisLabel.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],AxisLabel.prototype,"fontWeight",2),__decorateClass([Validate(NUMBER.restrict({min:1}))],AxisLabel.prototype,"fontSize",2),__decorateClass([Validate(STRING)],AxisLabel.prototype,"fontFamily",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisLabel.prototype,"spacing",2),__decorateClass([Validate(NUMBER_OR_NAN),Default(NaN)],AxisLabel.prototype,"minSpacing",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisLabel.prototype,"color",2),__decorateClass([Validate(NUMBER,{optional:!0})],AxisLabel.prototype,"rotation",2),__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"avoidCollisions",2),__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"mirrored",2),__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"parallel",2),__decorateClass([Validate(FUNCTION,{optional:!0})],AxisLabel.prototype,"itemStyler",2),__decorateClass([Validate(FUNCTION,{optional:!0})],AxisLabel.prototype,"formatter",2),__decorateClass([Validate(STRING,{optional:!0})],AxisLabel.prototype,"format",2);var AxisLine=class{constructor(){this.enabled=!0,this.width=1,this.stroke=void 0}};__decorateClass([Validate(BOOLEAN)],AxisLine.prototype,"enabled",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisLine.prototype,"width",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisLine.prototype,"stroke",2);var AxisTick=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0,this.width=1,this.size=6}};__decorateClass([Validate(BOOLEAN)],AxisTick.prototype,"enabled",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisTick.prototype,"width",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisTick.prototype,"size",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisTick.prototype,"stroke",2);var AxisTitle=class extends BaseProperties{constructor(){super(...arguments),this.caption=new Caption,this.enabled=!1,this.spacing=Caption.SMALL_PADDING,this.fontSize=10,this.fontFamily="sans-serif",this.wrapping="always"}};__decorateClass([Validate(BOOLEAN)],AxisTitle.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0})],AxisTitle.prototype,"text",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],AxisTitle.prototype,"spacing",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],AxisTitle.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],AxisTitle.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisTitle.prototype,"fontSize",2),__decorateClass([Validate(STRING)],AxisTitle.prototype,"fontFamily",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisTitle.prototype,"color",2),__decorateClass([Validate(TEXT_WRAP)],AxisTitle.prototype,"wrapping",2),__decorateClass([Validate(FUNCTION,{optional:!0})],AxisTitle.prototype,"formatter",2);function prepareAxisAnimationContext(t){const[e,i]=findMinMax(t.range),s=Math.floor(e),n=Math.ceil(i);return{min:s,max:n,visible:s!==n}}var fullCircle=Math.PI*2,halfCircle=fullCircle/2;function normaliseEndRotation(t,e){return Math.abs(e-t)e?e+fullCircle:e-fullCircle}function prepareAxisAnimationFunctions(t){const e=(a,o)=>{const[c=t.min,l=t.max]=findMinMax(o??[]);return al};return{tick:{fromFn(a,o,c){let l=a.y1+a.translationY,h=a.opacity;return(c==="added"||e(a.datum.translationY,a.datum.range))&&(l=o.translationY,h=0),{y:0,translationY:l,opacity:h,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING[c]}},toFn(a,o,c){const l=o.translationY;let h=1;return c==="removed"&&(h=0),{y:0,translationY:l,opacity:h,finish:{y:l,translationY:0}}},applyFn(a,o){a.setProperties(o),a.visible=!e(a.y)}},line:{fromFn(a,o){return{...a.previousDatum??o,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING.updated}},toFn(a,o){return{...o}}},label:{fromFn(a,o,c){const l=a.previousDatum??o,h=l.x,u=l.y,d=l.rotationCenterX;let g=Math.round(a.translationY),p=l.rotation,f=a.opacity;return c==="removed"||e(l.y,l.range)?p=o.rotation:(c==="added"||e(a.datum.y,a.datum.range))&&(g=Math.round(l.translationY),f=0,p=o.rotation),{x:h,y:u,rotationCenterX:d,translationY:g,rotation:p,opacity:f,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING[c]}},toFn(a,o,c){const l=o.x,h=o.y,u=o.rotationCenterX,d=Math.round(o.translationY);let g=0,p=1;return c==="added"?g=o.rotation:c==="removed"?(p=0,g=o.rotation):g=normaliseEndRotation(a.previousDatum?.rotation??o.rotation,o.rotation),{x:l,y:h,rotationCenterX:u,translationY:d,rotation:g,opacity:p,finish:{rotation:o.rotation}}}},group:{fromFn(a,o){const{rotation:c,translationX:l,translationY:h}=a;return{rotation:c,translationX:l,translationY:h,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING.updated}},toFn(a,o){const{rotation:c,translationX:l,translationY:h}=o;return{rotation:c,translationX:l,translationY:h}}}}}function resetAxisGroupFn(){return(t,e)=>({rotation:e.rotation,rotationCenterX:e.rotationCenterX,rotationCenterY:e.rotationCenterY,translationX:e.translationX,translationY:e.translationY})}function resetAxisSelectionFn(t){const{visible:e,min:i,max:s}=t;return(n,r)=>{const a=r.translationY,o=e&&a>=i&&a<=s;return{y:a,translationY:0,opacity:1,visible:o}}}function resetAxisLabelSelectionFn(){return(t,e)=>({x:e.x,y:e.y,translationY:e.translationY,rotation:e.rotation,rotationCenterX:e.rotationCenterX})}function resetAxisLineSelectionFn(){return(t,e)=>({...e})}var TranslatableLine=class extends Translatable(Line){},_Axis=class lt{constructor(e,i){this.moduleCtx=e,this.scale=i,this.id=createId(this),this.nice=!0,this.reverse=!1,this.keys=[],this.interval=new AxisInterval,this.dataDomain={domain:[],clipped:!1},this.layoutConstraints={stacked:!0,align:"start",width:100,unit:"percent"},this.boundSeries=[],this.includeInvisibleDomains=!1,this.interactionEnabled=!0,this.axisGroup=new TransformableGroup({name:`${this.id}-axis`}),this.tickLineGroup=this.axisGroup.appendChild(new Group({name:`${this.id}-Axis-tick-lines`,zIndex:0})),this.tickLabelGroup=this.axisGroup.appendChild(new Group({name:`${this.id}-Axis-tick-labels`,zIndex:2})),this.labelGroup=new Group({name:`${this.id}-Labels`,zIndex:9}),this.gridGroup=new TransformableGroup({name:`${this.id}-Axis-grid`,zIndex:1}),this.gridLineGroup=this.gridGroup.appendChild(new Group({name:`${this.id}-gridLines`})),this.crossLineRangeGroup=new TransformableGroup({name:`${this.id}-CrossLines-Range`,zIndex:4}),this.crossLineLineGroup=new TransformableGroup({name:`${this.id}-CrossLines-Line`,zIndex:8}),this.crossLineLabelGroup=new TransformableGroup({name:`${this.id}-CrossLines-Label`,zIndex:13}),this.tickLineGroupSelection=Selection.select(this.tickLineGroup,TranslatableLine,!1),this.tickLabelGroupSelection=Selection.select(this.tickLabelGroup,TransformableText,!1),this.gridLineGroupSelection=Selection.select(this.gridLineGroup,TranslatableLine,!1),this._crossLines=[],this.line=new AxisLine,this.tick=new AxisTick,this.gridLine=new AxisGridLine,this.label=this.createLabel(),this.defaultTickMinSpacing=lt.defaultTickMinSpacing,this.translation={x:0,y:0},this.rotation=0,this.layout={label:{fractionDigits:0,spacing:this.label.spacing,format:this.label.format}},this.axisContext=void 0,this.labelFormatter=void 0,this.datumFormatter=void 0,this.scaleFormatterParams=void 0,this.destroyFns=[],this.range=[0,1],this.visibleRange=[0,1],this.title=new AxisTitle,this.gridLength=0,this.gridPadding=0,this.seriesAreaPadding=0,this.animatable=!0,this._scaleNiceDomainInputDomain=void 0,this._scaleNiceDomainRangeExtent=NaN,this.moduleMap=new ModuleMap,this.range=this.scale.range.slice(),this.crossLines.forEach(s=>this.initCrossLine(s))}get type(){return this.constructor.type??""}get labelNodes(){return this.tickLabelGroupSelection.nodes()}set crossLines(e){const{CrossLineConstructor:i}=this.constructor;this._crossLines.forEach(s=>this.detachCrossLine(s)),this._crossLines=e.map(s=>{const n=new i;return n.set(s),n}),this._crossLines.forEach(s=>{this.attachCrossLine(s),this.initCrossLine(s)})}get crossLines(){return this._crossLines}resetAnimation(e){}attachCrossLine(e){this.crossLineRangeGroup.appendChild(e.rangeGroup),this.crossLineLineGroup.appendChild(e.lineGroup),this.crossLineLabelGroup.appendChild(e.labelGroup)}detachCrossLine(e){this.crossLineRangeGroup.removeChild(e.rangeGroup),this.crossLineLineGroup.removeChild(e.lineGroup),this.crossLineLabelGroup.removeChild(e.labelGroup)}destroy(){this.moduleMap.destroy(),this.destroyFns.forEach(e=>e())}updateScale(){const{range:e,visibleRange:i,scale:s}=this,n=(e[1]-e[0])/(i[1]-i[0]),r=n*i[0],a=e[0]-r;s.range=[a,a+n],this.crossLines.forEach(o=>{o.clippedRange=[e[0],e[1]]})}setCrossLinesVisible(e){this.crossLineRangeGroup.visible=e,this.crossLineLineGroup.visible=e,this.crossLineLabelGroup.visible=e}attachAxis(e){e.gridNode.appendChild(this.gridGroup),e.axisNode.appendChild(this.axisGroup),e.labelNode.appendChild(this.labelGroup),e.crossLineRangeNode.appendChild(this.crossLineRangeGroup),e.crossLineLineNode.appendChild(this.crossLineLineGroup),e.crossLineLabelNode.appendChild(this.crossLineLabelGroup)}detachAxis(e){e.gridNode.removeChild(this.gridGroup),e.axisNode.removeChild(this.axisGroup),e.labelNode.removeChild(this.labelGroup),e.crossLineRangeNode.removeChild(this.crossLineRangeGroup),e.crossLineLineNode.removeChild(this.crossLineLineGroup),e.crossLineLabelNode.removeChild(this.crossLineLabelGroup)}attachLabel(e){this.labelGroup.append(e)}inRange(e,i=0){const[s,n]=findMinMax(this.range);return e>=s-i&&e<=n+i}defaultDatumFormatter(e,i){return formatValue(e,i+1)}defaultLabelFormatter(e,i){return formatValue(e,i)}onGridLengthChange(e,i){i^e&&this.onGridVisibilityChange(),this.crossLines.forEach(s=>this.initCrossLine(s))}onGridVisibilityChange(){this.gridLineGroupSelection.clear()}createLabel(){return new AxisLabel}update(){this.updatePosition(),this.updateSelections(),this.tickLineGroup.visible=this.tick.enabled,this.gridLineGroup.visible=this.gridLine.enabled,this.tickLabelGroup.visible=this.label.enabled,this.updateLabels(),this.updateGridLines(),this.updateTickLines(),this.updateCrossLines()}getAxisLineCoordinates(){const[e,i]=findMinMax(this.range);return{x:0,y1:e,y2:i}}getLabelStyles(e,i){const{label:s}=this,n={color:s.color,spacing:s.spacing,fontFamily:s.fontFamily,fontSize:s.fontSize,fontStyle:s.fontStyle,fontWeight:s.fontWeight};let r;s.itemStyler&&(r=this.moduleCtx.callbackCache.call(s.itemStyler,{...e,...n}));const{color:a,fontFamily:o,fontSize:c,fontStyle:l,fontWeight:h,spacing:u}=mergeDefaults(r,i,n);return{fill:a,fontFamily:o,fontSize:c,fontStyle:l,fontWeight:h,spacing:u}}getTickSize(){return this.tick.enabled?this.tick.size:0}setTitleProps(e,i){const{title:s}=this;if(!s.enabled){e.enabled=!1,e.node.visible=!1;return}e.enabled=!0,e.color=s.color,e.fontFamily=s.fontFamily,e.fontSize=s.fontSize,e.fontStyle=s.fontStyle,e.fontWeight=s.fontWeight,e.wrapping=s.wrapping;const n=e.node,r=(s.spacing??0)+i.spacing,a=this.label.getSideFlag(),o=normalizeAngle360(this.rotation),c=a===-1&&o>Math.PI&&om.defaultValue}=s,y=p.call(f,this.getTitleFormatterParams());e.text=y,n.setProperties({visible:!0,text:y,textBaseline:h,x:d,y:g,rotation:l})}processData(){const{includeInvisibleDomains:e,boundSeries:i,direction:s}=this,r=(e?i:i.filter(a=>a.isEnabled())).map(a=>a.getDomain(s));this.setDomains(...r)}setDomains(...e){let i,s;e.length>0?{domain:i,animatable:s}=this.scale.normalizeDomains(...e):(i=[],s=!0),this.dataDomain=this.normaliseDataDomain(i),this.reverse&&this.dataDomain.domain.reverse(),this.animatable=s}calculateLayout(e){const{scale:i,label:s,visibleRange:n,nice:r}=this;this.updateScale();const a=findRangeExtent(this.range),o=this.dataDomain.domain;let c;n[0]===0&&n[1]===1?c=void 0:r?this._scaleNiceDomainInputDomain===o&&this._scaleNiceDomainRangeExtent===a?c=this.scale.domain:c=this.calculateTickLayout(o,0,[0,1]).niceDomain:c=o;let l;r?c==null?l=0:l=1:l=2;const{niceDomain:h,primaryTickCount:u,ticks:d,tickDomain:g,fractionDigits:p,bbox:f}=this.calculateTickLayout(c??o,l,n,e);this.scale.domain=h,this._scaleNiceDomainInputDomain=r?o:void 0,this._scaleNiceDomainRangeExtent=r?a:NaN;const y=s.format;this.labelFormatter=i.tickFormatter({domain:g,specifier:y,ticks:d,fractionDigits:p})??(S=>this.defaultLabelFormatter(S,p)),this.datumFormatter=i.datumFormatter({domain:g,specifier:y,ticks:d,fractionDigits:p})??(S=>this.defaultDatumFormatter(S,p)),this.scaleFormatterParams={domain:g,ticks:d,fractionDigits:p},this.layout.label={fractionDigits:p,spacing:this.label.spacing,format:this.label.format};const m=s.getSideFlag(),x=this.isAnySeriesActive(),{rotation:b,parallelFlipRotation:v,regularFlipRotation:I}=this.calculateRotations();return this.crossLines.forEach(S=>{var D;S.sideFlag=-m,S.direction=b===-Math.PI/2?"x":"y",S instanceof CartesianCrossLine&&((D=S.label).parallel??(D.parallel=s.parallel)),S.parallelFlipRotation=v,S.regularFlipRotation=I,S.calculateLayout?.(x,this.reverse)}),{primaryTickCount:u,bbox:f}}getTransformBox(e){const i=new Matrix,{rotation:s,translationX:n,translationY:r}=this.getAxisTransform();return Matrix.updateTransformMatrix(i,1,1,s,n,r),i.transformBBox(e)}calculateRotations(){const e=toRadians(this.rotation),i=normalizeAngle360(e),s=normalizeAngle360(e-Math.PI/2);return{rotation:e,parallelFlipRotation:i,regularFlipRotation:s}}updateCrossLines(){const e=this.isAnySeriesActive();this.crossLines.forEach(i=>{i.update(e)})}updateTickLines(){const{tick:e,label:i}=this,s=i.getSideFlag();this.tickLineGroupSelection.each((n,r)=>{n.strokeWidth=r.tickWidth??e.width,n.stroke=r.tickStroke??e.stroke,n.x1=s*(r.tickSize??this.getTickSize()),n.x2=0})}getAxisTransform(){return{rotation:toRadians(this.rotation),translationX:Math.floor(this.translation.x),translationY:Math.floor(this.translation.y)}}updatePosition(){const{crossLineRangeGroup:e,crossLineLineGroup:i,crossLineLabelGroup:s,gridGroup:n,translation:r}=this,{rotation:a}=this.calculateRotations(),o=Math.floor(r.x),c=Math.floor(r.y);e.setProperties({rotation:a,translationX:o,translationY:c}),i.setProperties({rotation:a,translationX:o,translationY:c}),s.setProperties({rotation:a,translationX:o,translationY:c}),n.setProperties({rotation:a,translationX:o,translationY:c})}updateGridLines(){const e=this.label.getSideFlag(),{gridLine:{style:i,width:s},gridPadding:n,gridLength:r}=this;r===0||i.length===0||this.gridLineGroupSelection.each((a,o,c)=>{const{stroke:l,lineDash:h}=i[c%i.length];a.setProperties({x1:n,x2:-e*r+n,stroke:l,strokeWidth:s,lineDash:h})})}formatTick(e,i,s,n){const{labelFormatter:r,label:{formatter:a},moduleCtx:{callbackCache:o}}=this;let c;return a?c=o.call(a,{value:e,index:i,fractionDigits:s}):n?c=n(e):r&&(c=r(e)),String(c??e)}formatDatum(e){const{label:{formatter:i},moduleCtx:{callbackCache:s},datumFormatter:n=this.labelFormatter}=this;let r;return i?r=s.call(i,{value:e,index:NaN}):n?r=s.call(n,e):isArray(e)&&(r=e.filter(Boolean).join(" - ")),String(r??e)}getScaleValueFormatter(e){const{scaleFormatterParams:i}=this;let s;try{e!=null&&i!=null&&(s=this.scale.tickFormatter({...i,specifier:e}))}catch{logger_exports.warnOnce(`the format string ${e} is invalid, ignoring.`)}return s??(s=n=>this.formatDatum(n)),s}getBBox(){return this.axisGroup.getBBox()}initCrossLine(e){e.scale=this.scale,e.gridLength=this.gridLength}isAnySeriesActive(){return this.boundSeries.some(e=>this.includeInvisibleDomains||e.isEnabled())}clipTickLines(e,i,s,n){this.tickLineGroup.setClipRect(new BBox(e,i,s,n))}clipGrid(e,i,s,n){this.gridGroup.setClipRect(new BBox(e,i,s,n))}getTitleFormatterParams(){const{direction:e}=this,i=[];for(const s of this.boundSeries){const n=s.getKeys(e),r=s.getNames(e);for(let a=0;aTransformable.toCanvas(this.axisGroup),seriesKeyProperties:()=>this.boundSeries.reduce((i,s)=>(s.getKeyProperties(this.direction).forEach(r=>i.add(r)),i),new Set),seriesIds:()=>this.boundSeries.map(i=>i.id),scaleValueFormatter:i=>this.getScaleValueFormatter(i),scaleInvert:i=>e.invert(i,!0),scaleInvertNearest:i=>e.invert(i,!0),attachLabel:i=>this.attachLabel(i),inRange:(i,s)=>this.inRange(i,s)}}isReversed(){return this.reverse}};_Axis.defaultTickMinSpacing=50,_Axis.CrossLineConstructor=CartesianCrossLine,__decorateClass([Validate(BOOLEAN)],_Axis.prototype,"nice",2),__decorateClass([Validate(BOOLEAN)],_Axis.prototype,"reverse",2),__decorateClass([Validate(STRING_ARRAY)],_Axis.prototype,"keys",2),__decorateClass([Validate(OBJECT)],_Axis.prototype,"interval",2),__decorateClass([Validate(OBJECT)],_Axis.prototype,"title",2),__decorateClass([ObserveChanges((t,e,i)=>t.onGridLengthChange(e,i))],_Axis.prototype,"gridLength",2);var Axis=_Axis;function circleRectOverlap(t,e,i,s,n,r){if(t.size===0)return!1;let a=t.x,o=t.y;e!=null&&(a-=(e.x-.5)*t.size,o-=(e.y-.5)*t.size);let c=a;ai+n&&(c=i+n);let l=o;os+r&&(l=s+r);const h=a-c,u=o-l;return Math.sqrt(h*h+u*u)<=t.size*.5}function rectRectOverlap(t,e,i,s,n){const r=t.x+t.width>e&&t.xi&&t.yt.x&&i>t.y&&i+n[o,c.toSorted((l,h)=>h.point.size-l.point.size)])),a=[...r.values()].flat();for(const[o,c]of r.entries()){const l=[];if(c[0]?.label){for(let h=0,u=c.length;h0&&d.placement!=null){const T=labelPlacements[d.placement];v=(m*.5+b+i)*T.x,I=(x*.5+b+i)*T.y}const S=g.x-m*.5+v-((f?.x??.5)-.5)*g.size,D=g.y-x*.5+I-((f?.y??.5)-.5)*g.size;if(!(!e||rectContainsRect(e,S,D,m,x))||a.some(T=>circleRectOverlap(T.point,T.anchor,S,D,m,x))||n.some(T=>rectRectOverlap(T,S,D,m,x)))continue;const k={index:h,text:y,x:S,y:D,width:m,height:x,datum:d};l.push(k),n.push(k)}s.set(o,l)}}return s}function axisLabelsOverlap(t,e=0){const i=[];for(let s=0;srectRectOverlap(h,r,a,c,l)))return!0;i.push({index:s,text:o,x:r,y:a,width:c,height:l,datum:n})}return!1}function calculateNiceSecondaryAxis(t,e,i){let[s,n]=findMinMax(t);s=calculateNiceStart(Math.floor(s),n,e);const r=getTickStep(s,n,e),a=e-1;n=s+a*r;const o=i?[n,s]:[s,n],c=getTicks(s,r,e);return{domain:o,ticks:c}}function calculateNiceStart(t,e,i){const s=Math.abs(e-t)/(i-1),n=Math.floor(Math.log10(s)),r=Math.pow(10,n);return Math.floor(t/r)*r}function getTicks(t,e,i){const s=Math.floor(Math.log10(e)),n=e>0&&e<1?Math.abs(s):0,r=Math.pow(10,n),a=[];for(let o=0;o0&&s<=1?i/10:s>1&&s<=2?2*i/10:s>1&&s<=5?5*i/10:s>5&&s<=10?10*i/10:s>10&&s<=20?20*i/10:s>20&&s<=40?40*i/10:s>40&&s<=50?50*i/10:s>50&&s<=100?100*i/10:s}function createIdsGenerator(){const t=new Map;return e=>{const i=t.get(e);return i?(t.set(e,i+1),`${e}_${i}`):(t.set(e,1),e)}}var AxisTickGenerator=class{constructor(t){this.axis=t}estimateTickCount(t,e,i){return estimateTickCount(findRangeExtent(this.axis.range),findRangeExtent(t),e,i,ContinuousScale.defaultTickCount,this.axis.defaultTickMinSpacing)}filterTicks(t,e){const{minSpacing:i,maxSpacing:s}=this.axis.interval,r=!isNaN(i)||!isNaN(s)?Math.ceil(t.length/e):2,a=t.length%r?-1:0;return t.filter((o,c)=>(c+a)%r===0)}generateTicks({domain:t,primaryTickCount:e,visibleRange:i,niceMode:s,parallelFlipRotation:n,regularFlipRotation:r,labelX:a,sideFlag:o}){const{scale:c,label:l,interval:{minSpacing:h,maxSpacing:u}}=this.axis,{parallel:d,rotation:g,fontFamily:p,fontSize:f,fontStyle:y,fontWeight:m}=l,x=e!==void 0,{defaultRotation:b,configuredRotation:v,parallelFlipFlag:I,regularFlipFlag:S}=calculateLabelRotation({rotation:g,parallel:d,regularFlipRotation:r,parallelFlipRotation:n}),D=v+b,w=new Matrix,{maxTickCount:L}=this.estimateTickCount(i,h,u),k=!(ContinuousScale.is(c)||OrdinalTimeScale.is(c))||isNaN(L)?10:L;let T=getTextAlign(d,v,0,o,S);const j=getTextBaseline(d,v,o,I),X=TextUtils.toFontString({fontFamily:p,fontSize:f,fontStyle:y,fontWeight:m}),Y=CachedTextMeasurerPool.getMeasurer({font:X}),q={fontFamily:p,fontSize:f,fontStyle:y,fontWeight:m,textBaseline:j,textAlign:T},J=l.enabled&&l.avoidCollisions,U=({ticks:tt},st)=>{if(!J)return!1;const xt=v!==0||st!==0,bt=D+st,vt=getLabelSpacing(l.minSpacing,xt);Matrix.updateTransformMatrix(w,1,1,bt,0,0);const It=createLabelData(tt,a,w,Y);return axisLabelsOverlap(It,vt)};let R={tickDomain:[],ticks:[],rawTicks:[],fractionDigits:0,niceDomain:void 0},G=0,P=0,it=!0,Q=!1;for(;!Q&&it&&G<=k;){P=0;for(const tt of this.getTickStrategies({domain:t,niceMode:s,secondaryAxis:x,index:G}))({tickData:R,index:G,autoRotation:P,terminate:Q}=tt({index:G,tickData:R,textProps:q,terminate:Q,primaryTickCount:e,visibleRange:i,get labelOverlap(){return U(R,P)}}));it=U(R,P)}T=getTextAlign(d,v,P,o,S);const Mt=b+v+P;return!x&&R.rawTicks.length>0&&(e=R.rawTicks.length),{tickData:R,primaryTickCount:e,combinedRotation:Mt,textBaseline:j,textAlign:T}}getTickStrategies({domain:t,niceMode:e,index:i,secondaryAxis:s}){const{scale:n,label:r,interval:a}=this.axis,{minSpacing:o}=a,c=ContinuousScale.is(n)||OrdinalTimeScale.is(n),l=r.enabled&&r.avoidCollisions,h=!c&&i!==0&&l,u=r.autoRotate===!0&&r.rotation===void 0,d=[];let g;a.values?g=3:s?g=1:h?g=2:g=0;const p=({index:f,tickData:y,primaryTickCount:m,visibleRange:x,terminate:b})=>this.createTickData(t,e,x,m,g,f,y,b);if(d.push(p),!c&&!isNaN(o)){const f=({index:y,tickData:m,primaryTickCount:x,visibleRange:b,terminate:v})=>this.createTickData(t,e,b,x,2,y,m,v);d.push(f)}if(l&&u){const f=({index:y,tickData:m,labelOverlap:x,terminate:b})=>({index:y,tickData:m,autoRotation:x?normalizeAngle360(toRadians(r.autoRotateAngle??0)):0,terminate:b});d.push(f)}return d}createTickData(t,e,i,s,n,r,a,o){const{scale:c,interval:l}=this.axis,{step:h,values:u,minSpacing:d,maxSpacing:g}=l,{maxTickCount:p,minTickCount:f,tickCount:y}=this.estimateTickCount(i,d,g),m=ContinuousScale.is(c)||OrdinalTimeScale.is(c),x=!m||isNaN(p)?10:p,b=I=>m?Math.max(y-I,f):p,v=h==null&&u==null&&b(r)>f&&(m||n===2);for(;r<=x;){const I=a.rawTicks;if(a=this.getTicks({domain:t,niceMode:e,visibleRange:i,tickGenerationType:n,previousTicks:I,minTickCount:f,maxTickCount:p,primaryTickCount:s,tickCount:b(r)}),r++,!v||!arraysEqual(a.rawTicks,I))break}return o||(o=h!=null||u!=null),{tickData:a,index:r,autoRotation:0,terminate:o}}getTicks({domain:t,niceMode:e,visibleRange:i,tickGenerationType:s,previousTicks:n,tickCount:r,minTickCount:a,maxTickCount:o,primaryTickCount:c}){const{axis:l}=this,{label:h,range:u,scale:d,interval:g}=l,p=createIdsGenerator(),f={nice:e===0,interval:g.step,tickCount:r,minTickCount:a,maxTickCount:o},y={...f,nice:e===0||e===1};let m=e===0?d.niceDomain(f,t):t,x=m,b;switch(s){case 3:if(x=g.values,b=g.values,ContinuousScale.is(d)){const[A,k]=findMinMax(m.map(Number));b=b.filter(T=>Number(T)>=A&&Number(T)<=k).sort((T,j)=>Number(T)-Number(j))}break;case 1:if(ContinuousScale.is(d)){const A=calculateNiceSecondaryAxis(t.map(Number),c??0,l.reverse);b=A.ticks,m=A.domain.map(k=>d.toDomain(k))}else b=d.ticks(y,m,i)??[];break;case 2:b=this.filterTicks(n,r);break;default:b=d.ticks(y,m,i)??[]}const v=b.reduce((A,k)=>Math.max(A,typeof k=="number"?countFractionDigits(k):0),0),I={domain:x,ticks:b,fractionDigits:v,specifier:h.format},S=d.tickFormatter(I),D=d.domain;d.domain=m;const w=(d.bandwidth??0)/2,L=[];for(let A=0;A0&&!l.inRange(T,.001))continue;const j=h.enabled?l.formatTick(k,A,v,S):"";L.push({tick:k,tickId:p(j),tickLabel:j,translationY:Math.floor(T)})}return d.domain=D,{tickDomain:x,rawTicks:b,fractionDigits:v,ticks:L,niceDomain:m}}},CartesianAxisLabel=class extends AxisLabel{constructor(){super(...arguments),this.autoRotateAngle=335}};__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianAxisLabel.prototype,"autoRotate",2),__decorateClass([Validate(NUMBER)],CartesianAxisLabel.prototype,"autoRotateAngle",2);var _CartesianAxis=class ht extends Axis{constructor(e,i){super(e,i),this.lineNode=this.axisGroup.appendChild(new TranslatableLine({name:`${this.id}-Axis-line`,zIndex:1})),this.tempText=new TransformableText,this.tempCaption=new Caption,this.tickGenerator=new AxisTickGenerator(this),this.generatedTicks=void 0,this.animationManager=e.animationManager,this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:()=>this.resetSelectionNodes()},reset:"empty"},ready:{update:n=>this.animateReadyUpdate(n),resize:()=>this.resetSelectionNodes(),reset:"empty"}}),this.axisGroup.appendChild(this.title.caption.node);let s;this.destroyFns.push(e.layoutManager.addListener("layout:complete",n=>{const r=[n.chart.width,n.chart.height];s!=null&&!arraysEqual(r,s)&&this.animationState.transition("resize"),s=r}),this.title.caption.registerInteraction(this.moduleCtx,"afterend"))}static is(e){return e instanceof ht}resetAnimation(e){e==="initial"&&this.animationState.transition("reset")}get direction(){return this.position==="top"||this.position==="bottom"?"x":"y"}createAxisContext(){return{...super.createAxisContext(),position:this.position}}createLabel(){return new CartesianAxisLabel}updateDirection(){switch(this.position){case"top":this.rotation=-90,this.label.mirrored=!0,this.label.parallel=!0;break;case"right":this.rotation=0,this.label.mirrored=!0,this.label.parallel=!1;break;case"bottom":this.rotation=-90,this.label.mirrored=!1,this.label.parallel=!0;break;case"left":this.rotation=0,this.label.mirrored=!1,this.label.parallel=!1;break}this.axisContext&&(this.axisContext.position=this.position,this.axisContext.direction=this.direction)}calculateLayout(e){return this.updateDirection(),super.calculateLayout(e)}calculateTickLayout(e,i,s,n){const r=this.label.getSideFlag(),{parallelFlipRotation:a,regularFlipRotation:o}=this.calculateRotations(),c=r*(this.getTickSize()+this.label.spacing+this.seriesAreaPadding),l=this.tickGenerator.generateTicks({domain:e,niceMode:i,visibleRange:s,primaryTickCount:n,parallelFlipRotation:a,regularFlipRotation:o,labelX:c,sideFlag:r}),{tickData:h,primaryTickCount:u=n}=l,{ticks:d,tickDomain:g,rawTicks:p,fractionDigits:f,niceDomain:y=e}=h,m=d.map(b=>this.getTickLabelProps(b,l)),x=this.tickBBox(d,m);return this.generatedTicks={ticks:d,labels:m},{ticks:p,tickDomain:g,niceDomain:y,primaryTickCount:u,fractionDigits:f,bbox:x}}update(){this.updateDirection();const e=Array.from(this.tickLabelGroupSelection.nodes(),r=>r.datum.tickId);if(super.update(),this.animatable||this.moduleCtx.animationManager.skipCurrentBatch(),this.generatedTicks){const{ticks:r}=this.generatedTicks;if(this.animationManager.isSkipped())this.resetSelectionNodes();else{const a=r.map(c=>c.tickId),o=diffArrays(e,a);this.animationState.transition("update",o)}}const{enabled:i,stroke:s,width:n}=this.line;this.lineNode.setProperties({stroke:s,strokeWidth:i?n:0}),this.updateTitle(!this.generatedTicks?.ticks.length)}updatePosition(){super.updatePosition(),this.axisGroup.datum=this.getAxisTransform()}tickBBox(e,i){const s=this.label.getSideFlag(),n=[],{x:r,y1:a,y2:o}=this.getAxisLineCoordinates(),c=new BBox(r+Math.min(s*this.seriesAreaPadding,0),a,this.seriesAreaPadding,o-a);if(n.push(c),this.tick.enabled)for(const u of e){const{x1:d,x2:g,y:p}=this.getTickLineCoordinates(u),f=new BBox(d,p,g-d,0);n.push(f)}const{tempText:l}=this;if(this.label.enabled)for(const u of i){if(!u.visible)continue;l.setProperties({...u,translationY:Math.round(u.translationY)});const d=l.getBBox();d&&n.push(d)}if(this.title?.enabled){const u=BBox.merge(n).width;this.setTitleProps(this.tempCaption,{spacing:u});const d=this.tempCaption.node.getBBox();d&&n.push(d)}const h=BBox.merge(n);return this.getTransformBox(h)}getTickLabelProps(e,i){const{combinedRotation:s,textBaseline:n,textAlign:r}=i,{range:a}=this.scale,o=e.tickLabel,l=this.label.getSideFlag()*(this.getTickSize()+this.label.spacing+this.seriesAreaPadding),h=o!==""&&o!=null;return{...this.getLabelStyles({value:e.tickLabel}),tickId:e.tickId,rotation:s,rotationCenterX:l,translationY:e.translationY,text:o,textAlign:r,textBaseline:n,visible:h,x:l,y:0,range:a}}getTickLineCoordinates(e){const s=this.label.getSideFlag()*this.getTickSize(),n=Math.min(0,s),r=n+Math.abs(s),a=e.translationY;return{x1:n,x2:r,y:a}}updateSelections(){if(!this.generatedTicks)return;const e=this.getAxisLineCoordinates(),{ticks:i,labels:s}=this.generatedTicks,n=r=>r.tickId;this.lineNode.datum=e,this.gridLineGroupSelection.update(this.gridLength?i:[],void 0,n),this.tickLineGroupSelection.update(i,void 0,n),this.tickLabelGroupSelection.update(s,void 0,n)}updateTitle(e,i){const{title:s,tickLineGroup:n,tickLabelGroup:r,lineNode:a}=this;s.enabled&&!e&&i==null&&(i=Group.computeChildrenBBox([n,r,a]).width+(r.visible?0:this.seriesAreaPadding)),i??(i=0),this.setTitleProps(s.caption,{spacing:i})}updateLabels(){this.label.enabled&&this.tickLabelGroupSelection.each((e,i)=>{e.fill=i.fill,e.fontFamily=i.fontFamily,e.fontSize=i.fontSize,e.fontStyle=i.fontStyle,e.fontWeight=i.fontWeight,e.text=i.text,e.textBaseline=i.textBaseline,e.textAlign=i.textAlign??"center"})}animateReadyUpdate(e){const{animationManager:i}=this.moduleCtx,s=prepareAxisAnimationContext(this),n=prepareAxisAnimationFunctions(s);fromToMotion(this.id,"axis-group",i,[this.axisGroup],n.group),fromToMotion(this.id,"line",i,[this.lineNode],n.line),fromToMotion(this.id,"line-paths",i,[this.gridLineGroupSelection,this.tickLineGroupSelection],n.tick,(r,a)=>a.tickId,e),fromToMotion(this.id,"tick-labels",i,[this.tickLabelGroupSelection],n.label,(r,a)=>a.tickId,e)}resetSelectionNodes(){const e=prepareAxisAnimationContext(this);resetMotion([this.axisGroup],resetAxisGroupFn()),resetMotion([this.gridLineGroupSelection,this.tickLineGroupSelection],resetAxisSelectionFn(e)),resetMotion([this.tickLabelGroupSelection],resetAxisLabelSelectionFn()),resetMotion([this.lineNode],resetAxisLineSelectionFn())}};__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],_CartesianAxis.prototype,"thickness",2),__decorateClass([Validate(POSITION)],_CartesianAxis.prototype,"position",2);var CartesianAxis=_CartesianAxis,_CategoryAxis=class ut extends CartesianAxis{constructor(e,i=new CategoryScale){super(e,i),this.groupPaddingInner=.1,this.includeInvisibleDomains=!0}static is(e){return e instanceof ut}normaliseDataDomain(e){return{domain:e,clipped:!1}}updateScale(){super.updateScale();let{paddingInner:e,paddingOuter:i}=this;if(!isFiniteNumber(e)||!isFiniteNumber(i)){const s=this.reduceBandScalePadding();e??(e=s.inner),i??(i=s.outer)}this.scale.paddingInner=e??0,this.scale.paddingOuter=i??0}reduceBandScalePadding(){return this.boundSeries.reduce((e,i)=>{const s=i.getBandScalePadding?.();return s&&(e.inner>s.inner&&(e.inner=s.inner),e.outere.type===s.type&&("optionsKey"in e&&"optionsKey"in s?e.optionsKey===s.optionsKey:!0)&&e.identifier===s.identifier);if(i){if(e.packageType==="enterprise"&&i.packageType==="community"){const s=this.modules.indexOf(i);this.modules.splice(s,1,e),"optionsKey"in e&&this.modulesByOptionKey.set(e.optionsKey,e)}}else this.modules.push(e),"optionsKey"in e&&this.modulesByOptionKey.set(e.optionsKey,e)}}hasEnterpriseModules(){return this.modules.some(t=>t.packageType==="enterprise")}*byType(...t){const e=new Set,i=this.modules.filter(r=>t.includes(r.type)),s=r=>{const a=this.dependencies.get(r);return a?.flatMap(s).concat(a)??[]},n=[];for(const r of i){const a="optionsKey"in r?r.optionsKey:r.contextKey;if(!e.has(a)){for(const o of s(a)){if(e.has(o))continue;const c=this.modulesByOptionKey.get(o);if(!c){n.push(o);continue}t.includes(c.type)&&(yield c,e.add(o))}yield r,e.add(a)}}if(n.length>0)throw new Error(`Could not resolve module dependencies: ${n}`)}registerDependencies(t){if(t.dependencies==null||t.dependencies.length===0)return;const e="optionsKey"in t?t.optionsKey:t.contextKey;this.dependencies.set(e,t.dependencies)}},moduleRegistry=new ModuleRegistry2,AsyncAwaitQueue=class{constructor(){this.queue=[]}await(t=50){return new Promise(e=>{const i=()=>{clearTimeout(n),e(!0)},n=setTimeout(()=>{const r=this.queue.indexOf(i);r<0||(this.queue.splice(r,1),e(!1))},t);this.queue.push(i)})}notify(){this.queue.splice(0).forEach(t=>t())}};function pause(){return new Promise(t=>{setTimeout(t,0)})}function setElementBBox(t,e){t&&(e=BBoxValues.normalize(e),e.width==null?t.style.removeProperty("width"):t.style.width=`${e.width}px`,e.height==null?t.style.removeProperty("height"):t.style.height=`${e.height}px`,e.x==null?t.style.removeProperty("left"):t.style.left=`${e.x}px`,e.y==null?t.style.removeProperty("top"):t.style.top=`${e.y}px`)}function getElementBBox(t){const e=parseFloat(t.style.width)||t.offsetWidth,i=parseFloat(t.style.height)||t.offsetHeight,s=parseFloat(t.style.left)||t.offsetLeft,n=parseFloat(t.style.top)||t.offsetTop;return{x:s,y:n,width:e,height:i}}function isInputPending(){const t=getWindow("navigator");if("scheduling"in t){const e=t.scheduling;if("isInputPending"in e)return e.isInputPending({includeContinuous:!0})}return!1}var CLASS_INSTANCE_TYPE="class-instance";function jsonDiff(t,e,i){if(isArray(e)){if(!isArray(t)||t.length!==e.length||e.some((s,n)=>jsonDiff(t[n],s)!=null))return e}else if(isPlainObject(e)){if(!isPlainObject(t))return e;const s={},n=new Set([...Object.keys(t),...Object.keys(e)]);for(const r of n)if(!(t[r]===e[r]||i?.includes(r)))if(typeof t[r]==typeof e[r]){const a=jsonDiff(t[r],e[r]);a!==null&&(s[r]=a)}else s[r]=e[r];return Object.keys(s).length?s:null}else if(t!==e)return e;return null}function deepClone(t,e){return isArray(t)?t.map(i=>deepClone(i,e)):isPlainObject(t)?clonePlainObject(t,e):t instanceof Map?new Map(deepClone(Array.from(t))):shallowClone(t)}function clonePlainObject(t,e){const i={};for(const s of Object.keys(t))i[s]=e?.has(s)?shallowClone(t[s]):deepClone(t[s],e);return i}function shallowClone(t){return isArray(t)?t.slice(0):isPlainObject(t)?{...t}:isDate(t)?new Date(t):isRegExp(t)?new RegExp(t.source,t.flags):t}function jsonApply(t,e,i={}){const{path:s,matcherPath:n=s?.replace(/(\[[0-9+]+])/i,"[]"),skip:r=[]}=i;if(t==null)throw new Error(`AG Charts - target is uninitialised: ${s??""}`);if(e==null)return t;if(isProperties(t))return t.set(e);const a=t,o=classify(t);for(const c of Object.keys(e)){if(SKIP_JS_BUILTINS.has(c))continue;const l=`${n?n+".":""}${c}`;if(r.includes(l))continue;const h=e[c],u=`${s?s+".":""}${c}`,d=a.constructor,g=a[c];try{const p=classify(g),f=classify(h);if(o===CLASS_INSTANCE_TYPE&&!(c in t)){if(h===void 0)continue;logger_exports.warn(`unable to set [${u}] in ${d?.name} - property is unknown`);continue}if(p!=null&&f!=null&&f!==p&&(p!==CLASS_INSTANCE_TYPE||f!=="object")){logger_exports.warn(`unable to set [${u}] in ${d?.name} - can't apply type of [${f}], allowed types are: [${p}]`);continue}if(isProperties(g))a[c].set(h);else if(f==="object"){if(g==null){logger_exports.warn(`unable to set [${u}] in ${d?.name} - property is unknown`);continue}jsonApply(g,h,{...i,path:u,matcherPath:l})}else a[c]=h}catch(p){logger_exports.warn(`unable to set [${u}] in [${d?.name}]; nested error is: ${p.message}`)}}return t}function classify(t){return t==null?null:isHtmlElement(t)||isDate(t)?"primitive":isArray(t)?"array":isObject(t)?isPlainObject(t)?"object":CLASS_INSTANCE_TYPE:isFunction(t)?"function":"primitive"}var Operation=(t=>(t.Ref="$ref",t.Path="$path",t.If="$if",t.Eq="$eq",t.Not="$not",t.Or="$or",t.And="$and",t.Mul="$mul",t.Round="$round",t.Rem="$rem",t.Mix="$mix",t.ForegroundBackgroundMix="$foregroundBackgroundMix",t.ForegroundBackgroundAccentMix="$foregroundBackgroundAccentMix",t))(Operation||{}),operationKeys=new Set(Object.values(Operation)),Mutex=class{constructor(){this.available=!0,this.acquireQueue=[]}acquire(t){return new Promise(e=>{this.acquireQueue.push([t,e]),this.available&&this.dispatchNext().catch(i=>logger_exports.errorOnce(i))})}async acquireImmediately(t){return this.available?(await this.acquire(t),!0):!1}async waitForClearAcquireQueue(){return this.acquire(()=>Promise.resolve(void 0))}async dispatchNext(){this.available=!1;let[t,e]=this.acquireQueue.shift()??[];for(;t;){try{await t(),e?.()}catch(i){logger_exports.error("mutex callback error",i),e?.()}[t,e]=this.acquireQueue.shift()??[]}this.available=!0}},Observable=class{constructor(){this.eventListeners=new Map}addEventListener(t,e){if(typeof e!="function")throw new Error("AG Charts - listener must be a Function");const i=this.eventListeners.get(t);i?i.add(e):this.eventListeners.set(t,new Set([e]))}removeEventListener(t,e){this.eventListeners.get(t)?.delete(e),this.eventListeners.size===0&&this.eventListeners.delete(t)}hasEventListener(t){return this.eventListeners.has(t)}clearEventListeners(){this.eventListeners.clear()}fireEvent(t){this.eventListeners.get(t.type)?.forEach(e=>e(t))}},Padding=class extends BaseProperties{constructor(t=0,e=t,i=t,s=e){super(),this.top=t,this.right=e,this.bottom=i,this.left=s}};__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"top",2),__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"right",2),__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"bottom",2),__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"left",2);function debouncedAnimationFrame(t){return buildScheduler((e,i)=>getWindow().requestAnimationFrame(e),t)}function debouncedCallback(t){return buildScheduler((e,i=0)=>{i===0?queueMicrotask(e):setTimeout(e,i)},t)}function buildScheduler(t,e){let i=0,s=!1,n,r;const a=()=>s,o=()=>{s=!1,r?.(),r=void 0,n=void 0,i>0&&t(c)},c=()=>{const l=i;i=0,s=!0;const h=e({count:l});if(!h){o();return}h.then(o,o)};return{schedule(l){i===0&&!a()&&t(c,l),i++},async await(){if(a())for(n==null&&(n=new Promise(l=>{r=l}));a();)await n}}}function booleanParser(t){return t==="true"}function numberParser(t){return Number(t)}function stringParser(t){return t}var AttributeTypeParsers={role:stringParser,"aria-checked":booleanParser,"aria-controls":stringParser,"aria-describedby":stringParser,"aria-disabled":booleanParser,"aria-expanded":booleanParser,"aria-haspopup":booleanParser,"aria-hidden":booleanParser,"aria-label":stringParser,"aria-labelledby":stringParser,"aria-live":stringParser,"aria-orientation":stringParser,"aria-selected":booleanParser,"data-preventdefault":booleanParser,class:stringParser,id:stringParser,tabindex:numberParser,title:stringParser,placeholder:stringParser};function setAttribute(t,e,i){i==null||i===""||i===""?t?.removeAttribute(e):t?.setAttribute(e,i.toString())}function setAttributes(t,e){if(e!=null)for(const[i,s]of Object.entries(e))i!=="class"&&setAttribute(t,i,s)}function getAttribute(t,e,i){if(!(t instanceof HTMLElement))return;const s=t.getAttribute(e);return s===null?i:AttributeTypeParsers[e]?.(s)??void 0}function setElementStyle(t,e,i){t!=null&&(i==null?t.style.removeProperty(e):t.style.setProperty(e,i.toString()))}function setElementStyles(t,e){for(const[i,s]of Object.entries(e))setElementStyle(t,i,s)}var WIDGET_HTML_EVENTS=["blur","change","contextmenu","focus","keydown","keyup","click","dblclick","mouseenter","mousemove","mouseleave","wheel","touchstart","touchmove","touchend","touchcancel"];function allocMouseEvent(t,e,i){const{offsetX:s,offsetY:n,clientX:r,clientY:a}=e,{currentX:o,currentY:c}=WidgetEventUtil.calcCurrentXY(i,e);return{type:t,offsetX:s,offsetY:n,clientX:r,clientY:a,currentX:o,currentY:c,sourceEvent:e}}function allocTouchEvent(t,e,i){return{type:t,sourceEvent:e}}var WidgetAllocators={blur:t=>({type:"blur",sourceEvent:t}),change:t=>({type:"change",sourceEvent:t}),contextmenu:(t,e)=>allocMouseEvent("contextmenu",t,e),focus:t=>({type:"focus",sourceEvent:t}),keydown:t=>({type:"keydown",sourceEvent:t}),keyup:t=>({type:"keyup",sourceEvent:t}),click:(t,e)=>allocMouseEvent("click",t,e),dblclick:(t,e)=>allocMouseEvent("dblclick",t,e),mouseenter:(t,e)=>allocMouseEvent("mouseenter",t,e),mousemove:(t,e)=>allocMouseEvent("mousemove",t,e),mouseleave:(t,e)=>allocMouseEvent("mouseleave",t,e),wheel:t=>{const{offsetX:e,offsetY:i,clientX:s,clientY:n}=t,r=t.deltaMode===0?.01:1,a=t.deltaX*r,o=t.deltaY*r;return{type:"wheel",offsetX:e,offsetY:i,clientX:s,clientY:n,deltaX:a,deltaY:o,sourceEvent:t}},touchstart:(t,e)=>allocTouchEvent("touchstart",t,e),touchmove:(t,e)=>allocTouchEvent("touchmove",t,e),touchend:(t,e)=>allocTouchEvent("touchend",t,e),touchcancel:(t,e)=>allocTouchEvent("touchcancel",t,e)},WidgetEventUtil=class{static alloc(t,e,i){return WidgetAllocators[t](e,i)}static isHTMLEvent(t){return WIDGET_HTML_EVENTS.includes(t)}static calcCurrentXY(t,e){const i=t.getBoundingClientRect();return{currentX:e.clientX-i.x,currentY:e.clientY-i.y}}},WidgetListenerHTML=class{constructor(){this.widgetListeners={},this.sourceListeners={}}initSourceHandler(t,e){this.sourceListeners??(this.sourceListeners={}),this.sourceListeners[t]=e}lazyGetWidgetListeners(t,e){var i;if(!(t in(this.sourceListeners??{}))){const s=r=>{const a=WidgetEventUtil.alloc(t,r,e.getElement());for(const o of this.widgetListeners?.[t]??[])o(a,e)},n={};t.startsWith("touch")&&(n.passive=!1),this.initSourceHandler(t,s),e.getElement().addEventListener(t,s,n)}return this.widgetListeners??(this.widgetListeners={}),(i=this.widgetListeners)[t]??(i[t]=[]),this.widgetListeners[t]}add(t,e,i){this.lazyGetWidgetListeners(t,e).push(i)}remove(t,e,i){const s=this.lazyGetWidgetListeners(t,e),n=s.indexOf(i);n>-1&&s.splice(n,1)}destroy(t){for(const[e,i]of Object.entries(this.sourceListeners??{})){const s=e;t.getElement().removeEventListener(s,i)}this.widgetListeners=void 0,this.sourceListeners=void 0}},MouseDragger=class{constructor(t,e,i,s){this.glob=t,this.self=e,this.window=getWindow(),this.mousegeneral=c=>{c.stopPropagation(),c.stopImmediatePropagation()},this.mousemove=c=>{c.stopPropagation(),c.stopImmediatePropagation(),this.glob.globalMouseDragCallbacks?.mousemove(c)},this.mouseup=c=>{c.button===0&&(c.stopPropagation(),c.stopImmediatePropagation(),this.glob.globalMouseDragCallbacks?.mouseup(c),this.destroy())};const{window:n,mousegeneral:r,mousemove:a,mouseup:o}=this;n.addEventListener("mousedown",r,{capture:!0}),n.addEventListener("mouseenter",r,{capture:!0}),n.addEventListener("mouseleave",r,{capture:!0}),n.addEventListener("mouseout",r,{capture:!0}),n.addEventListener("mouseover",r,{capture:!0}),n.addEventListener("mousemove",a,{capture:!0}),n.addEventListener("mouseup",o,{capture:!0}),e.mouseDragger=this,t.globalMouseDragCallbacks=i,t.globalMouseDragCallbacks.mousedown(s)}destroy(){const{window:t,mousegeneral:e,mousemove:i,mouseup:s}=this;t.removeEventListener("mousedown",e,{capture:!0}),t.removeEventListener("mouseenter",e,{capture:!0}),t.removeEventListener("mouseleave",e,{capture:!0}),t.removeEventListener("mouseout",e,{capture:!0}),t.removeEventListener("mouseover",e,{capture:!0}),t.removeEventListener("mousemove",i,{capture:!0}),t.removeEventListener("mouseup",s,{capture:!0}),this.glob.globalMouseDragCallbacks=void 0,this.self.mouseDragger=void 0}};function startMouseDrag(t,e,i,s){if(t.globalMouseDragCallbacks==null)return new MouseDragger(t,e,i,s)}var LONG_TAP_DURATION_MS=500,LONG_TAP_INTERRUPT_MIN_TOUCHMOVE_PXPX=100;function deltaClientSquared(t,e){const i=t.clientX-e.clientX,s=t.clientY-e.clientY;return i*i+s*s}var gIsInLongTap=!1,TouchDragger=class{constructor(t,e,i,s,n){this.glob=t,this.self=e,this.initialTouch=s,this.target=n,this.longTapInterrupted=!1,this.longtap=()=>{const{target:o,initialTouch:c}=this;if(!this.longTapInterrupted){o.dispatchEvent(new TouchEvent("touchcancel",{touches:[c],bubbles:!0})),gIsInLongTap=!0;const l=p=>{p.preventDefault()},h=p=>{gIsInLongTap=!1,p.preventDefault(),o.removeEventListener("touchmove",l),o.removeEventListener("touchend",h),o.removeEventListener("touchcancel",h)};o.addEventListener("touchmove",l,{passive:!1}),o.addEventListener("touchend",h,{passive:!1}),o.addEventListener("touchcancel",h,{passive:!1});const{clientX:u,clientY:d}=c,g=new PointerEvent("contextmenu",{bubbles:!0,cancelable:!0,view:getWindow(),clientX:u,clientY:d,pointerType:"touch"});o.dispatchEvent(g)}},this.touchmove=o=>{const{glob:c,self:l,initialTouch:h}=this,u=this.findInitialFinger(o.targetTouches);u!=null&&(this.longTapInterrupted=this.longTapInterrupted||deltaClientSquared(h,u)>LONG_TAP_INTERRUPT_MIN_TOUCHMOVE_PXPX,l.dragTouchEnabled&&u!=null&&c.globalTouchDragCallbacks?.touchmove(o,u))},this.touchend=o=>{this.longTapInterrupted=!0;const c=this.findInitialFinger(o.changedTouches,o.touches);c!=null&&this.glob.globalTouchDragCallbacks?.touchend(o,c),this.destroy()},this.longtapTimer=setTimeout(this.longtap,LONG_TAP_DURATION_MS);const{touchmove:r,touchend:a}=this;n.addEventListener("touchmove",r,{passive:!1}),n.addEventListener("touchstart",a,{passive:!1}),n.addEventListener("touchend",a,{passive:!1}),n.addEventListener("touchcancel",a,{passive:!1}),e.touchDragger=this,t.globalTouchDragCallbacks=i}destroy(){const{longtapTimer:t,touchmove:e,touchend:i}=this;clearTimeout(t),this.target.removeEventListener("touchstart",i),this.target.removeEventListener("touchmove",e),this.target.removeEventListener("touchend",i),this.target.removeEventListener("touchcancel",i),this.glob.globalTouchDragCallbacks=void 0,this.self.touchDragger=void 0}findInitialFinger(...t){const e=t.map(i=>Array.from(i)).flat();return Array.from(e).find(i=>i.identifier===this.initialTouch.identifier)}};function startOneFingerTouch(t,e,i,s,n){if(!(t.globalTouchDragCallbacks!=null||gIsInLongTap))return new TouchDragger(t,e,i,s,n)}function makeMouseDrag(t,e,i,s){const{currentX:n,currentY:r}=WidgetEventUtil.calcCurrentXY(t.getElement(),s),a=s.pageX-i.pageX,o=s.pageY-i.pageY;return{type:e,device:"mouse",offsetX:i.offsetX+a,offsetY:i.offsetY+o,clientX:s.clientX,clientY:s.clientY,currentX:n,currentY:r,originDeltaX:a,originDeltaY:o,sourceEvent:s}}function getTouchOffsets(t,{pageX:e,pageY:i}){const{x:s,y:n}=t.getElement().getBoundingClientRect();return{offsetX:e-s,offsetY:i-n}}function makeTouchDrag(t,e,i,s,n){const{currentX:r,currentY:a}=WidgetEventUtil.calcCurrentXY(t.getElement(),n),o=n.pageX-i.pageX,c=n.pageY-i.pageY;return{type:e,device:"touch",offsetX:i.offsetX+o,offsetY:i.offsetY+c,clientX:n.clientX,clientY:n.clientY,currentX:r,currentY:a,originDeltaX:o,originDeltaY:c,sourceEvent:s}}var GlobalCallbacks={},WidgetListenerInternal=class{constructor(t){this.dispatchCallback=t,this.dragTouchEnabled=!0}destroy(){this.dragTriggerRemover?.(),this.dragTriggerRemover=void 0,this.dragStartListeners=void 0,this.dragMoveListeners=void 0,this.dragEndListeners=void 0,this.mouseDragger?.destroy(),this.touchDragger?.destroy()}add(t,e,i){switch(t){case"drag-start":{this.dragStartListeners??(this.dragStartListeners=[]),this.dragStartListeners.push(i),this.registerDragTrigger(e);break}case"drag-move":{this.dragMoveListeners??(this.dragMoveListeners=[]),this.dragMoveListeners.push(i),this.registerDragTrigger(e);break}case"drag-end":{this.dragEndListeners??(this.dragEndListeners=[]),this.dragEndListeners.push(i),this.registerDragTrigger(e);break}}}remove(t,e,i){switch(t){case"drag-start":return this.removeHandler(this.dragStartListeners,i);case"drag-move":return this.removeHandler(this.dragMoveListeners,i);case"drag-end":return this.removeHandler(this.dragEndListeners,i)}}removeHandler(t,e){const i=t?.indexOf(e);i!==void 0&&t?.splice(i,1)}registerDragTrigger(t){if(this.dragTriggerRemover==null){const e=s=>this.triggerMouseDrag(t,s),i=s=>this.triggerTouchDrag(t,s);t.getElement().addEventListener("mousedown",e),t.getElement().addEventListener("touchstart",i,{passive:!1}),this.dragTriggerRemover=()=>{t.getElement().removeEventListener("mousedown",e),t.getElement().removeEventListener("touchstart",i)}}}triggerMouseDrag(t,e){e.button===0&&this.startMouseDrag(t,e)}startMouseDrag(t,e){const i={pageX:NaN,pageY:NaN,offsetX:NaN,offsetY:NaN};partialAssign(["pageX","pageY","offsetX","offsetY"],i,e);const s={mousedown:n=>{const r=makeMouseDrag(t,"drag-start",i,n);this.dispatch("drag-start",t,r)},mousemove:n=>{const r=makeMouseDrag(t,"drag-move",i,n);this.dispatch("drag-move",t,r)},mouseup:n=>{const r=makeMouseDrag(t,"drag-end",i,n);this.dispatch("drag-end",t,r),this.endDrag(t,r)}};this.mouseDragger=startMouseDrag(GlobalCallbacks,this,s,e)}endDrag(t,{sourceEvent:e,clientX:i,clientY:s}){const n=t.getElement(),r=n.getBoundingClientRect();BBoxValues.containsPoint(r,i,s)||(n.dispatchEvent(new MouseEvent("mouseleave",e)),e.target?.dispatchEvent(new MouseEvent("mouseenter",e)))}triggerTouchDrag(t,e){const i=e.targetTouches.item(0);e.targetTouches.length===1&&i!=null&&this.startOneFingerTouch(t,e,i)}startOneFingerTouch(t,e,i){const s={pageX:NaN,pageY:NaN,...getTouchOffsets(t,i)};partialAssign(["pageX","pageY"],s,i);const n={touchmove:(o,c)=>{const l=makeTouchDrag(t,"drag-move",s,o,c);this.dispatch("drag-move",t,l)},touchend:(o,c)=>{const l=makeTouchDrag(t,"drag-end",s,o,c);this.dispatch("drag-end",t,l)}},r=t.getElement();this.touchDragger=startOneFingerTouch(GlobalCallbacks,this,n,i,r);const a=makeTouchDrag(t,"drag-start",s,e,i);this.dispatch("drag-start",t,a)}dispatch(t,e,i){switch(t){case"drag-start":this.dragStartListeners?.forEach(s=>s(i,e));break;case"drag-move":this.dragMoveListeners?.forEach(s=>s(i,e));break;case"drag-end":this.dragEndListeners?.forEach(s=>s(i,e));break}this.dispatchCallback(t,i)}},WidgetBounds=class{constructor(t){this.elem=t}setBounds(t){setElementBBox(this.elemContainer??this.elem,t)}getBounds(){return getElementBBox(this.elemContainer??this.elem)}static setElementContainer(t,e){const i=t.getBounds();setElementBBox(e,i),setElementStyles(t.elem,{width:"100%",height:"100%"}),t.elem.remove(),t.elemContainer=e,t.elemContainer.replaceChildren(t.elem)}},Widget=class extends WidgetBounds{constructor(t){super(t),this.elem=t,this.index=NaN,this.children=[]}getElement(){return this.elem}getBoundingClientRect(){return this.elem.getBoundingClientRect()}get clientWidth(){return this.elem.clientWidth}get clientHeight(){return this.elem.clientHeight}destroy(){this.parent?.removeChild(this),this.children.forEach(t=>{t.parent=void 0,t.destroy()}),this.children.length=0,this.destructor(),this.elem.remove(),this.elemContainer?.remove(),this.internalListener?.destroy(),this.htmlListener?.destroy(this)}setHidden(t){setElementStyle(this.elem,"display",t?"none":void 0)}isHidden(){return getWindow()?.getComputedStyle?.(this.elem).display==="none"}setCursor(t){setElementStyle(this.elem,"cursor",t)}setTextContent(t){this.elem.textContent=t??null}setAriaDescribedBy(t){setAttribute(this.elem,"aria-describedby",t)}setAriaHidden(t){setAttribute(this.elem,"aria-hidden",t)}setAriaLabel(t){setAttribute(this.elem,"aria-label",t)}setInnerHTML(t){this.elem.innerHTML=t}isDisabled(){return getAttribute(this.elem,"aria-disabled",!1)}parseFloat(t){return t===""?0:parseFloat(t)}cssLeft(){return this.parseFloat(this.elem.style.left)}cssTop(){return this.parseFloat(this.elem.style.top)}cssWidth(){return this.parseFloat(this.elem.style.width)}cssHeight(){return this.parseFloat(this.elem.style.height)}focus(){this.elem.focus()}setPreventsDefault(t){setAttribute(this.elem,"data-preventdefault",t)}setTabIndex(t){setAttribute(this.elem,"tabindex",t)}addChild(t){this.addChildToDOM(t,this.getBefore(t)),this.children.push(t),t.index=this.children.length-1,t.parent=this,this.onChildAdded(t)}removeChild(t){const e=this.children.findIndex(i=>i===t);this.children.splice(e,1),this.removeChildFromDOM(t),this.onChildRemoved(t)}moveChild(t,e){t.domIndex!==e&&(t.domIndex=e,this.removeChildFromDOM(t),this.addChildToDOM(t,this.getBefore(t)))}addClass(...t){this.elem.classList.add(...t)}removeClass(...t){this.elem.classList.remove(...t)}toggleClass(t,e){this.elem.classList.toggle(t,e)}appendOrInsert(t,e){e?e.getElement().insertAdjacentElement("beforebegin",t):this.elem.appendChild(t)}addChildToDOM(t,e){this.appendOrInsert(t.getElement(),e)}removeChildFromDOM(t){this.elem.removeChild(t.getElement())}onChildAdded(t){}onChildRemoved(t){}getBefore({domIndex:t}){if(t!==void 0)return this.children.filter(e=>e.domIndex!==void 0&&e.domIndex>t).reduce((e,i)=>!e||i.domIndexthis.removeListener(t,e)}removeListener(t,e){WidgetEventUtil.isHTMLEvent(t)?this.htmlListener?.remove(t,this,e):this.htmlListener!=null&&this.internalListener?.remove(t,this,e)}setDragTouchEnabled(t){this.internalListener??(this.internalListener=new WidgetListenerInternal(this.onDispatch.bind(this))),this.internalListener.dragTouchEnabled=t}onDispatch(t,e){if(!e.sourceEvent.bubbles)return;let{parent:i}=this;for(;i!=null;){const{internalListener:s}=i;if(s!=null){const n={...e,...WidgetEventUtil.calcCurrentXY(i.getElement(),e)};s.dispatch(t,i,n)}i=i.parent}}static addWindowEvent(t,e){const i=s=>{s.persisted||e()};return getWindow().addEventListener("pagehide",i),()=>getWindow().removeEventListener("pagehide",i)}},LayoutElement=(t=>(t[t.Caption=0]="Caption",t[t.Legend=1]="Legend",t[t.ToolbarLeft=2]="ToolbarLeft",t[t.ToolbarBottom=3]="ToolbarBottom",t[t.Navigator=4]="Navigator",t[t.Overlay=5]="Overlay",t))(LayoutElement||{}),LayoutManager=class{constructor(){this.events=new EventEmitter,this.elements=new Map}addListener(t,e){return this.events.on(t,e)}registerElement(t,e){return this.elements.has(t)?this.elements.get(t).add(e):this.elements.set(t,new Set([e])),()=>this.elements.get(t)?.delete(e)}createContext(t,e){const i=new LayoutContext(t,e);for(const s of Object.values(LayoutElement))typeof s=="number"&&this.elements.get(s)?.forEach(n=>n(i));return i}emitLayoutComplete(t,e){const i="layout:complete",{width:s,height:n}=t;this.events.emit(i,{type:i,axes:e.axes??[],chart:{width:s,height:n},clipSeries:e.clipSeries??!1,series:e.series})}},LayoutContext=class{constructor(t,e){this.width=t,this.height=e,this.layoutBox=new BBox(0,0,t,e)}},ChartCaptions=class{constructor(){this.title=new Caption,this.subtitle=new Caption,this.footnote=new Caption}positionCaptions(t){const{title:e,subtitle:i,footnote:s}=this,n=t.layoutBox.height/10;if(e.enabled){const{spacing:r=i.enabled?Caption.SMALL_PADDING:Caption.LARGE_PADDING}=e;this.positionCaption("top",e,t.layoutBox,n),this.shrinkLayoutByCaption("top",e,t.layoutBox,r)}i.enabled&&(this.positionCaption("top",i,t.layoutBox,n),this.shrinkLayoutByCaption("top",i,t.layoutBox,i.spacing)),s.enabled&&(this.positionCaption("bottom",s,t.layoutBox,n),this.shrinkLayoutByCaption("bottom",s,t.layoutBox,s.spacing))}positionAbsoluteCaptions(t){const{title:e,subtitle:i,footnote:s}=this,{rect:n}=t.series;for(const r of[e,i,s])if(r.layoutStyle==="overlay"){if(r.textAlign==="left")r.node.x=n.x+r.padding;else if(r.textAlign==="right"){const a=r.node.getBBox();r.node.x=n.x+n.width-a.width-r.padding}}}computeX(t,e){return t==="left"?e.x:t==="right"?e.x+e.width:e.x+e.width/2}positionCaption(t,e,i,s){const n=Math.max(TextUtils.getLineHeight(e.fontSize),s);e.node.x=this.computeX(e.textAlign,i)+e.padding,e.node.y=i.y+(t==="top"?0:i.height)+e.padding,e.node.textBaseline=t,e.computeTextWrap(i.width,n)}shrinkLayoutByCaption(t,e,i,s=0){if(e.layoutStyle==="block"){const n=e.node.getBBox();i.shrink(Math.ceil(t==="top"?n.y-i.y+n.height+s:i.y+i.height-n.y+s),t)}}};__decorateClass([Validate(OBJECT)],ChartCaptions.prototype,"title",2),__decorateClass([Validate(OBJECT)],ChartCaptions.prototype,"subtitle",2),__decorateClass([Validate(OBJECT)],ChartCaptions.prototype,"footnote",2);var chartTypes=["candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"],ChartTypeOriginator=class{constructor(t){this.chartService=t,this.mementoOriginatorKey="chartType"}createMemento(){let t=this.chartService.publicApi?.getOptions()?.chartType;return t==null&&(t="candlestick"),t}guardMemento(t){return t==null||chartTypes.includes(t)}restoreMemento(t,e,i){if(i==null)return;const s={chartType:i};this.chartService.publicApi?.updateDelta(s).catch(n=>logger_exports.error("error restoring state",n))}},DestroyFns=class{constructor(){this.destroyFns=[]}destroy(){this.destroyFns.forEach(t=>t()),this.destroyFns.length=0}setFns(t){this.destroy(),this.destroyFns=t}push(...t){this.destroyFns.push(...t)}},VERSION="11.1.1",NOT_FOUND=Symbol("previous-memento-not-found"),HistoryManager=class{constructor(t){this.history=[],this.historyIndex=-1,this.originators=new Map,this.clearState=new Map,this.maxHistoryLength=100,this.debug=Debug.create(!0,"history"),this.destroyFns=new DestroyFns,this.destroyFns.setFns([t.addListener("series-undo",this.undo.bind(this)),t.addListener("series-redo",this.redo.bind(this))])}destroy(){this.destroyFns.destroy()}addMementoOriginator(t){this.originators.set(t.mementoOriginatorKey,t),this.clearState.set(t.mementoOriginatorKey,t.createMemento()),this.debugEvent("History add originator:",t.mementoOriginatorKey)}clear(){this.debug("History clear:",Object.keys(this.originators)),this.history=[],this.historyIndex=-1;for(const[t,e]of this.originators.entries())this.clearState.set(t,e.createMemento())}record(t,...e){this.historyIndexthis.maxHistoryLength&&(this.history=this.history.slice(-this.maxHistoryLength));const i=new Map;for(const s of e){if(!this.originators.has(s.mementoOriginatorKey))throw new Error(`Originator [${s.mementoOriginatorKey}] has not been added to the HistoryManager.`);i.set(s.mementoOriginatorKey,s.createMemento())}this.history.push({label:t,mementos:i}),this.historyIndex=this.history.length-1,this.debugEvent(`History record: [${t}]`)}undo(){const t=this.history[this.historyIndex];if(t){for(const e of t.mementos.keys()){const i=this.findPreviousMemento(e);if(i===NOT_FOUND)throw new Error(`Could not find previous memento for [${e}].`);this.restoreMemento(e,i)}this.historyIndex-=1,this.debugEvent(`History undo: [${t.label}]`)}}redo(){const t=this.history[this.historyIndex+1];if(t){for(const[e,i]of t.mementos.entries())this.restoreMemento(e,i);this.historyIndex+=1,this.debugEvent(`History redo: [${t.label}]`)}}findPreviousMemento(t){for(let e=this.historyIndex-1;e>=0;e--)if(this.history[e].mementos.has(t))return this.history[e].mementos.get(t);return this.clearState.has(t)?this.clearState.get(t):NOT_FOUND}restoreMemento(t,e){this.originators.get(t)?.restoreMemento(VERSION,VERSION,e)}debugEvent(...t){this.debug(...t,this.history.map((e,i)=>i===this.historyIndex?`** ${e.label} **`:e.label))}},MementoCaretaker=class et{constructor(e){this.version=e.split("-")[0]}save(...e){const i={version:this.version};for(const s of Object.values(e))i[s.mementoOriginatorKey]=this.encode(s,s.createMemento());return i}restore(e,...i){if(typeof e!="object"){logger_exports.warnOnce(`Could not restore data of type [${typeof e}], expecting an object, ignoring.`);return}if(e==null){logger_exports.warnOnce("Could not restore data of type [null], expecting an object, ignoring.");return}if(!("version"in e)||typeof e.version!="string"){logger_exports.warnOnce("Could not restore data, missing [version] string in object, ignoring.");return}for(const s of i){const n=this.decode(s,e[s.mementoOriginatorKey]),r=[];if(!s.guardMemento(n,r)){const a=r.length>0?` ${r.join(` `)} `:"";logger_exports.warnOnce(`Could not restore [${s.mementoOriginatorKey}] data, value was invalid, ignoring.${a}`,n);return}s.restoreMemento(this.version,e.version,n)}}encode(e,i){try{return JSON.parse(JSON.stringify(i,et.encodeTypes))}catch(s){throw new Error(`Failed to encode [${e.mementoOriginatorKey}] value [${s}].`,{cause:s})}}decode(e,i){if(i==null)return i;try{return JSON.parse(JSON.stringify(i),et.decodeTypes)}catch(s){throw new Error(`Failed to decode [${e.mementoOriginatorKey}] value [${s}].`,{cause:s})}}static encodeTypes(e,i){return isDate(this[e])?{__type:"date",value:this[e].toISOString()}:i}static decodeTypes(e,i){return isObject(this[e])&&"__type"in this[e]&&this[e].__type==="date"?new Date(this[e].value):i}},StateManager=class{constructor(){this.caretaker=new MementoCaretaker(VERSION),this.state=new Map}setState(t,e){objectsEqual(this.state.get(t.mementoOriginatorKey),e)||this.setStateAndRestore(t,e)}setStateAndRestore(t,e){this.state.set(t.mementoOriginatorKey,e),this.restoreState(t)}restoreState(t){const{caretaker:e,state:i}=this;if(!i.has(t.mementoOriginatorKey))return;const s=i.get(t.mementoOriginatorKey);e.restore({version:e.version,[t.mementoOriginatorKey]:s},t)}},styles_default=`.ag-charts-wrapper,.ag-charts-wrapper:after,.ag-charts-wrapper:before,.ag-charts-wrapper *,.ag-charts-wrapper *:after,.ag-charts-wrapper *:before{box-sizing:border-box}.ag-charts-wrapper{--align-items: center;--justify-content: center;position:relative;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.ag-charts-wrapper--safe-horizontal{--justify-content: flex-start}.ag-charts-wrapper--safe-vertical{--align-items: flex-start}.ag-charts-tab-guard{width:0%;height:0%;position:absolute;pointer-events:none}.ag-charts-canvas-center{width:100%;height:100%;position:absolute;touch-action:auto;pointer-events:auto;display:flex;align-items:var(--align-items);justify-content:var(--justify-content)}.ag-charts-canvas-container,.ag-charts-canvas{position:relative;user-select:none;-webkit-user-select:none}.ag-charts-canvas-container>*,.ag-charts-canvas>*{display:block;pointer-events:none}.ag-charts-series-area{outline:none;pointer-events:auto;position:absolute}.ag-charts-swapchain{outline:none;opacity:0;pointer-events:none;position:absolute;width:100%;height:100%}.ag-charts-swapchain:focus-visible{opacity:1}.ag-charts-canvas-proxy,.ag-charts-canvas-overlay{inset:0;pointer-events:none;position:absolute;user-select:none;-webkit-user-select:none}.ag-charts-canvas-overlay>*{position:absolute;pointer-events:auto}.ag-charts-theme-default,.ag-charts-theme-default-dark{--ag-charts-accent-color: #2196f3;--ag-charts-background-color: #fff;--ag-charts-border-color: #dddddd;--ag-charts-foreground-color: #464646;--ag-charts-font-family: Verdana, sans-serif;--ag-charts-font-size: 12px;--ag-charts-font-weight: 400;--ag-charts-padding: 20px;--ag-charts-shadow-color: #00000080;--ag-charts-subtle-text-color: #8c8c8c;--ag-charts-text-color: #464646;--ag-charts-chrome-background-color: #fafafa;--ag-charts-chrome-font-family: Verdana, sans-serif;--ag-charts-chrome-font-size: 12px;--ag-charts-chrome-font-weight: 400;--ag-charts-chrome-subtle-text-color: #8c8c8c;--ag-charts-chrome-text-color: #181d1f;--ag-charts-input-background-color: #fff;--ag-charts-input-text-color: #464646;--ag-charts-crosshair-label-background-color: #fff;--ag-charts-crosshair-label-text-color: #464646;--ag-charts-spacing: 4px;--ag-charts-border-radius: 4px;--ag-charts-shadow: 0 2px 8px 0 color-mix(in srgb, black 8%, transparent);--ag-charts-focus-shadow: 0 0 0 3px var(--ag-charts-accent-color);--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 12%);--ag-charts-input-border-color: var(--ag-charts-border-color);--ag-charts-input-border-radius: var(--ag-charts-border-radius);--ag-charts-input-focus-border-color: var(--ag-charts-accent-color);--ag-charts-input-focus-text-color: var(--ag-charts-accent-color);--ag-charts-input-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-input-disabled-border-color: var(--ag-charts-border-color);--ag-charts-input-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-input-text-color) 50% );--ag-charts-input-placeholder-text-color: color-mix( in srgb, var(--ag-charts-input-background-color), var(--ag-charts-input-text-color) 60% );--ag-charts-button-background-color: var(--ag-charts-background-color);--ag-charts-button-border-color: var(--ag-charts-border-color);--ag-charts-button-border-radius: var(--ag-charts-border-radius);--ag-charts-button-text-color: var(--ag-charts-text-color);--ag-charts-button-focus-background-color: color-mix( in srgb, var(--ag-charts-button-background-color), var(--ag-charts-accent-color) 12% );--ag-charts-button-focus-border-color: var(--ag-charts-accent-color);--ag-charts-button-focus-text-color: var(--ag-charts-accent-color);--ag-charts-button-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-button-disabled-border-color: var(--ag-charts-border-color);--ag-charts-button-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-chrome-text-color) 50% );--ag-charts-checkbox-background-color: color-mix( in srgb, var(--ag-charts-background-color), var(--ag-charts-foreground-color) 35% );--ag-charts-checkbox-checked-background-color: var(--ag-charts-accent-color);--ag-charts-chrome-font-size-small: var(--ag-charts-chrome-font-size);--ag-charts-chrome-font-size-medium: calc(var(--ag-charts-chrome-font-size) * (13 / 12));--ag-charts-chrome-font-size-large: calc(var(--ag-charts-chrome-font-size) * (14 / 12));--ag-charts-border: solid 1px var(--ag-charts-border-color);--ag-charts-focus-border: solid 1px var(--ag-charts-accent-color);--ag-charts-focus-border-shadow: 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%);--ag-charts-layer-menu: 6;--ag-charts-layer-ui-overlay: 5;--ag-charts-layer-tooltip: 4;--ag-charts-layer-toolbar: 3;--ag-charts-layer-crosshair: 2;--ag-charts-layer-annotations: 1}.ag-charts-theme-default-dark{--ag-charts-shadow: 0 2px 12px 0 color-mix(in srgb, black 33.3%, transparent);--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 22%)}.ag-chart-canvas-wrapper .ag-charts-theme-default{--ag-charts-border-radius: var(--ag-border-radius, 4px);--ag-charts-border: var(--ag-borders-critical, solid 1px) var(--ag-charts-border-color);--ag-charts-focus-shadow: var(--ag-focus-shadow, 0 0 0 3px var(--ag-charts-accent-color));--ag-charts-focus-border-shadow: var( --ag-focus-shadow, 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%) )}.ag-charts-icon{display:block;width:20px;height:20px;speak:none;speak:never;mask:var(--icon) center / contain no-repeat;background-color:currentColor;transition:background-color .25s ease-in-out}.ag-charts-icon-align-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNyAxMGg2djFIN3pNNCA3aDEydjFINHptMSA2aDEwdjFINXoiLz48L3N2Zz4=)}.ag-charts-icon-align-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNCAxMGg2djFINHptMC0zaDEydjFINHptMCA2aDEwdjFINHoiLz48L3N2Zz4=)}.ag-charts-icon-align-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTAgMTBoNnYxaC02ek00IDdoMTJ2MUg0em0yIDZoMTB2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-arrow-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1LjI5MyA0LjVIMTIuNXYtMUgxN3Y0aC0xVjUuMjA3bC05LjY0NiA5LjY0Ny0uNzA4LS43MDh6IiBmaWxsPSIjMDAwIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03IDE2YTIuNSAyLjUgMCAxIDEtNSAwIDIuNSAyLjUgMCAwIDEgNSAwbS0yLjUgMS41YTEuNSAxLjUgMCAxIDAgMC0zIDEuNSAxLjUgMCAwIDAgMCAzIiBmaWxsPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-arrow-down-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02IDhMMS41IDhMMTAgMThMMTguNSA4TDE0IDhMMTQgM0w2IDNMNiA4Wk03IDRMNyA5SDMuNjYyNDRMMTAgMTYuNDU2TDE2LjMzNzYgOUwxMyA5TDEzIDRMNyA0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-arrow-up-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNCAxMkgxOC41TDEwIDJMMS41IDEySDZMNi4wMDAwMiAxN0gxNFYxMlpNMTMgMTZWMTFIMTYuMzM3NkwxMCAzLjU0NDA1TDMuNjYyNDQgMTFIN0w3LjAwMDAyIDE2SDEzWiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-callout-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtNC41MTRhMjYgMjYgMCAwIDAtMi4wMTcgMS41NGwtLjMxNC4yNmMtLjU1LjQ1Ny0xLjExNS45MjYtMS43NiAxLjQtLjY2OS40OTEtMS41NjItLjAxMi0xLjU2Mi0uOFYxNEg0LjVBMS41IDEuNSAwIDAgMSAzIDEyLjV6TTQuNSA0YS41LjUgMCAwIDAtLjUuNXY4YS41LjUgMCAwIDAgLjUuNWgxLjgzM3YzLjM3MmEzNiAzNiAwIDAgMCAxLjY3OC0xLjMzOGwuMzItLjI2NWEyNiAyNiAwIDAgMSAyLjIyNS0xLjY4NWwuMTI2LS4wODRIMTUuNWEuNS41IDAgMCAwIC41LS41di04YS41LjUgMCAwIDAtLjUtLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyAxdjNoMnYxMkg3djNINnYtM0g0VjRoMlYxek01IDVoM3YxMEg1ek0xMSAxNFY2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6bTEtN2gzdjZoLTN6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-close{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNSA1IDEwIDEwTTUgMTUgMTUgNSIgc3Ryb2tlPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-comment-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy41MTMgMy45OTVhNi41IDYuNSAwIDAgMSA2LjA5OCAxMS40MWMtLjU4OC4zOTMtMS4yMTcuNTM2LTEuODI5LjU4NWExMyAxMyAwIDAgMS0xLjI3LjAxN0EyNyAyNyAwIDAgMCAxMCAxNkg0LjVhLjUuNSAwIDAgMS0uNS0uNVYxMHEwLS4yNDctLjAwNy0uNTEzYy0uMDA4LS40MTYtLjAxNi0uODU3LjAxNy0xLjI2OS4wNS0uNjEyLjE5Mi0xLjI0LjU4NS0xLjgzYTYuNSA2LjUgMCAwIDEgMi45MTgtMi4zOTNtMy41Ni42MWE1LjUgNS41IDAgMCAwLTUuNjQ2IDIuMzRjLS4yNjYuMzk3LS4zNzkuODQyLS40MiAxLjM1NC0uMDMuMzYtLjAyMi43MTgtLjAxNSAxLjEwOFE1IDkuNjg5IDUgMTB2NWg1cS4zMTEuMDAxLjU5My4wMDhjLjM5LjAwNy43NDcuMDE1IDEuMTA4LS4wMTUuNTEyLS4wNDEuOTU3LS4xNTQgMS4zNTUtLjQyYTUuNSA1LjUgMCAwIDAtMS45ODMtOS45NjciIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-crosshair-add-line{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-date-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMiAyaDF2MTZIMnptMTUgMGgxdjE2aC0xeiIgZmlsbD0iIzE4MUQxRiIvPjxwYXRoIGQ9Ik0xMy4xNTcgMTFINXYtMWg3Ljc5M0wxMSA4LjIwN2wuNzA3LS43MDcgMy4xODIgMy4xODItMy4xODIgMy4xODItLjcwNy0uNzA3eiIgZmlsbD0iIzAwMCIvPjwvc3ZnPg==)}.ag-charts-icon-date-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMyAySDJ2MTZoMXptMy41MDcgNC44OUw4LjUgNC44OTVWMTBINXYxaDMuNXY3aDF2LTdoNS4wODhsLTEuOTU3IDEuOTU3LjcwNy43MDcgMy4xODItMy4xODJMMTMuMzM4IDcuM2wtLjcwNy43MDdMMTQuNjI0IDEwSDkuNVY0LjkzMmwxLjk1NyAxLjk1Ny43MDctLjcwN0w4Ljk4MiAzIDUuOCA2LjE4MnoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-delete{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTguNDk2IDguOTk2QS41LjUgMCAwIDEgOSA5LjQ5MnY0YS41LjUgMCAxIDEtMSAuMDA4di00YS41LjUgMCAwIDEgLjQ5Ni0uNTA0TTEyIDkuNWEuNS41IDAgMCAwLTEgMHY0YS41LjUgMCAwIDAgMSAweiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTYgNVYzLjVBMi41IDIuNSAwIDAgMSA4LjUgMWgzQTIuNSAyLjUgMCAwIDEgMTQgMy41VjVoMi44MzNhLjUuNSAwIDAgMSAwIDFIMTV2MTAuMjVjMCAuNDE1LS4wNjYuODYzLS4zIDEuMjIxLS4yNTcuMzk0LS42NzIuNjEyLTEuMi42MTJoLTdjLS41MjggMC0uOTQzLS4yMTgtMS4yLS42MTItLjIzNC0uMzU4LS4zLS44MDYtLjMtMS4yMjFWNkgzLjMzM2EuNS41IDAgMCAxIDAtMXptMS0xLjVBMS41IDEuNSAwIDAgMSA4LjUgMmgzQTEuNSAxLjUgMCAwIDEgMTMgMy41VjVIN3pNNiAxNi4yNVY2aDh2MTAuMjVjMCAuMzM1LS4wNTkuNTU0LS4xMzguNjc1LS4wNTUuMDg1LS4xNC4xNTgtLjM2Mi4xNThoLTdjLS4yMjIgMC0uMzA3LS4wNzMtLjM2Mi0uMTU4LS4wOC0uMTIxLS4xMzgtLjM0LS4xMzgtLjY3NSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-disjoint-channel,.ag-charts-icon-disjoint-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTkuMDI4IDE3LjQ2YTIuMjUgMi4yNSAwIDAgMC00LjA5Mi0xLjg1bC05LjUxMS0yLjM3OGEyLjI1IDIuMjUgMCAxIDAtLjIyNS45NzRsOS40NzUgMi4zNjlhMi4yNTEgMi4yNTEgMCAwIDAgNC4zNTMuODg2bS0xLjY2Mi0xLjk2NWExLjI1IDEuMjUgMCAxIDEtLjg4NSAyLjMzOCAxLjI1IDEuMjUgMCAwIDEgLjg4NS0yLjMzOE00LjM0MyAxMy42NjlhMS4yNSAxLjI1IDAgMSAwLTIuMzM4LS44ODUgMS4yNSAxLjI1IDAgMCAwIDIuMzM4Ljg4NU0zLjk3IDguNzY5YTIuMjUgMi4yNSAwIDAgMCAxLjQ1NS0yLjExbDkuNTExLTIuMzc4YTIuMjUgMi4yNSAwIDEgMC0uMjYtLjk2NUw1LjIgNS42ODVhMi4yNSAyLjI1IDAgMSAwLTEuMjMgMy4wODRtLjM3My0yLjU0N2ExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjc1LTMuNDM4YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-drag-handle{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjcuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjxjaXJjbGUgY3g9IjEzLjc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iMTMuNzUiIGN5PSIxMS43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjExLjc1IiByPSIuNzUiIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjUiLz48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iMTEuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA1aDEydjFIMnoiLz48Y2lyY2xlIGN4PSIxNS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4yNSIgY3k9IjE0LjUiIHI9IjEuNzUiIHN0cm9rZT0iIzAwMCIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik0xOCAxNUg2di0xaDEyem0wLTQuNUgydi0xaDE2eiIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-trend-based-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJtNC45OTYgMTIuNjc0IDMuMjkxLTUuNzQzLjg2OC40OTctMy4yOTEgNS43NDN6Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4zNTEiIGN5PSIxNC41IiByPSIxLjc1IiBzdHJva2U9IiMwMDAiLz48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTggNmgtN1Y1aDd6bTAgNC41aC03di0xaDd6bTAgNC41SDZ2LTFoMTJ6Ii8+PC9zdmc+)}.ag-charts-icon-fill-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtOC4wNzEgNC4wNi0uOTI0LS45MjQuNzA3LS43MDcgNy4yODggNy4yODgtNC45NSA0Ljk1YTMuNSAzLjUgMCAwIDEtNC45NSAwbC0xLjQxNC0xLjQxNGEzLjUgMy41IDAgMCAxIDAtNC45NXptLjcwNy43MDhMNC41MzYgOS4wMWEyLjUgMi41IDAgMCAwIDAgMy41MzZMNS45NSAxMy45NmEyLjUgMi41IDAgMCAwIDMuNTM1IDBsNC4yNDMtNC4yNDN6bTYuOSA3LjIwMi0uMzQ1LjM2My0uMzQ0LS4zNjNhLjUuNSAwIDAgMSAuNjg4IDBtLS4zNDUgMS4wOGE4IDggMCAwIDAtLjI4LjMyMyA0LjMgNC4zIDAgMCAwLS40MDkuNTgyYy0uMTEzLjIwMS0uMTQ0LjMyNi0uMTQ0LjM3OGEuODMzLjgzMyAwIDAgMCAxLjY2NyAwYzAtLjA1Mi0uMDMxLS4xNzctLjE0NC0uMzc4YTQuMyA0LjMgMCAwIDAtLjQxLS41ODIgOCA4IDAgMCAwLS4yOC0uMzIybS0uMzQ0LTEuMDguMzQ0LjM2My4zNDQtLjM2My4wMDIuMDAyLjAwNC4wMDQuMDEzLjAxMmE2IDYgMCAwIDEgLjIwNi4yMDhjLjEzMS4xMzYuMzA4LjMyNy40ODUuNTQ1LjE3Ni4yMTUuMzYzLjQ2Ny41MDcuNzI0LjEzNy4yNDMuMjczLjU1My4yNzMuODY4YTEuODMzIDEuODMzIDAgMSAxLTMuNjY3IDBjMC0uMzE1LjEzNi0uNjI1LjI3My0uODY4LjE0NC0uMjU3LjMzLS41MDkuNTA3LS43MjRhOSA5IDAgMCAxIC42NDUtLjcwOGwuMDQ2LS4wNDUuMDEzLS4wMTIuMDA0LS4wMDR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-hollow-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1vcGFjaXR5PSIuMTUiIGQ9Ik01IDVoM3YxMEg1eiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTcgMXYzaDJ2MTJIN3YzSDZ2LTNINFY0aDJWMXpNNSA1aDN2MTBINXptNyAyaDN2NmgtM3ptLTEgN1Y2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-horizontal-line,.ag-charts-icon-horizontal-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNLjUgOS41aDcuMzA2YTIuMjUgMi4yNSAwIDAgMSA0LjM4OCAwSDE5LjV2MWgtNy4zMDZhMi4yNSAyLjI1IDAgMCAxLTQuMzg4IDBILjV6bTkuNSAxLjc1YTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-line-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTQuMjQyIDIuNzIyYy0uNjEyIDAtMS4yLjI0My0xLjYzMi42NzVsLTEuMzQzIDEuMzQ0YS41LjUgMCAwIDAtLjExMi4xMTJMNC4wNSAxMS45NTljLS4yMDcuMjA3LS4zNi40Ni0uNDQ2Ljc0di4wMDFsLS42OSAyLjc2N3YuMDAyYS44Mi44MiAwIDAgMCAxLjAyMiAxLjAyMWguMDAybDIuNjM0LS44MjJjLjI4LS4wODUuNTM0LS4yMzcuNzQtLjQ0M2w3LjEwNy03LjEwOGEuNS41IDAgMCAwIC4xMTItLjExMmwxLjM0My0xLjM0M2EyLjMwOCAyLjMwOCAwIDAgMC0xLjYzMi0zLjk0TTE0LjEyMiA3bDEuMDQ0LTEuMDQ1YTEuMzA4IDEuMzA4IDAgMSAwLTEuODQ5LTEuODVMMTIuMjcxIDUuMTV6bS0yLjU1OC0xLjE0Mi02LjgwNyA2LjgwOWEuOC44IDAgMCAwLS4xOTYuMzI1bC0uNzUgMi40NjggMi40Ny0uNzQ5YS44LjggMCAwIDAgLjMyNS0uMTk0bDYuODA4LTYuODF6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTcuMzYyIDQuODczLTQuNTk0IDYuNjU0LTQuODUtMy4zMTctNC4yNTEgNi45NzctLjg1NC0uNTJMNy42MTIgNi43OWw0Ljg5OSAzLjM1IDQuMDI4LTUuODM2eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-line-style-dashed{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDR2MUgyem0xMiAwaDR2MWgtNHpNOCA5aDR2MUg4eiIvPjwvc3ZnPg==)}.ag-charts-icon-line-style-dotted{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSIyLjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSI4LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTAuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSIxMi41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjE0LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48L3N2Zz4=)}.ag-charts-icon-line-style-solid{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDE2djFIMnoiLz48L3N2Zz4=)}.ag-charts-icon-line-with-markers-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTk4IDQuODg4LTMuNTU2IDQuOTE4YTIuMjUgMi4yNSAwIDEgMS0zLjg2Ni43NWwtMS40MzItLjlhMi4yNCAyLjI0IDAgMCAxLTIuMDA5LjQzNWwtMy44MjggNi40MjgtLjg2LS41MTJMNi40NSA5LjYyM2EyLjI1IDIuMjUgMCAxIDEgMy41MS0uNzYxbDEuMzI5LjgzNWEyLjI0IDIuMjQgMCAwIDEgMi41NTctLjQ5N2wzLjU0Mi00Ljg5OHptLTQuOTYgNS4xNTNhMS4yNSAxLjI1IDAgMSAwLS42NCAyLjQxOSAxLjI1IDEuMjUgMCAwIDAgLjY0LTIuNDE5TTkuMSA4LjMyMXEuMDY2LS4xOTIuMDY3LS40MDRhMS4yNSAxLjI1IDAgMSAwLS4wNjcuNDA0IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-lock,.ag-charts-icon-locked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuMjA3IDMuNzY0YTIuODk0IDIuODk0IDAgMCAwLTIuODk1IDIuODk0VjloNS43ODlWNi42NThhMi44OTQgMi44OTQgMCAwIDAtMi44OTUtMi44OTRNMTQuMSA5VjYuNjU4YTMuODk0IDMuODk0IDAgMSAwLTcuNzg5IDB2Mi4zNDlBMi41IDIuNSAwIDAgMCA0IDExLjV2M0EyLjUgMi41IDAgMCAwIDYuNSAxN2g4YTIuNSAyLjUgMCAwIDAgMi41LTIuNXYtM0EyLjUgMi41IDAgMCAwIDE0LjUgOXpNNi41IDEwQTEuNSAxLjUgMCAwIDAgNSAxMS41djNBMS41IDEuNSAwIDAgMCA2LjUgMTZoOGExLjUgMS41IDAgMCAwIDEuNS0xLjV2LTNhMS41IDEuNSAwIDAgMC0xLjUtMS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-measurer-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibTQuNDYxIDEyLjcxIDEuNTMyLTEuNTMxIDEuNDE0IDEuNDE0LjcwNy0uNzA3TDYuNyAxMC40NzJsMS41MzItMS41MzMgMiAyIC43MDctLjcwNy0yLTIgNi4wMS02LjAxIDIuODMgMi44MjhMNS4wNSAxNy43NzggMi4yMjIgMTQuOTVsMS41MzItMS41MzIgMS40MTQgMS40MTQuNzA3LS43MDd6TS44MDggMTQuOTVsLjcwNy0uNzA3TDE0LjI0MyAxLjUxNWwuNzA3LS43MDcuNzA3LjcwNyAyLjgyOCAyLjgyOC43MDcuNzA3LS43MDcuNzA3TDUuNzU3IDE4LjQ4NWwtLjcwNy43MDctLjcwNy0uNzA3LTIuODI4LTIuODI4em0xMS4wNzgtNi44MzVMMTAuNDcgNi43bC43MDctLjcwNyAxLjQxNSAxLjQxNHptLjgyNC0zLjY1NCAxIDEgLjcwOC0uNzA3LTEtMXoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-note-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtMy4yMWwtMS40NjkgMi41N2ExIDEgMCAwIDEtMS42ODIuMDg1TDcuMjQzIDE0SDQuNUExLjUgMS41IDAgMCAxIDMgMTIuNXpNNC41IDRhLjUuNSAwIDAgMC0uNS41djhhLjUuNSAwIDAgMCAuNS41aDMuMjU3bDIuMTk2IDMuMDc0TDExLjcxIDEzaDMuNzlhLjUuNSAwIDAgMCAuNS0uNXYtOGEuNS41IDAgMCAwLS41LS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi41IDYuNUEuNS41IDAgMCAxIDcgNmg2YS41LjUgMCAwIDEgMCAxSDdhLjUuNSAwIDAgMS0uNS0uNU02LjUgOS41QS41LjUgMCAwIDEgNyA5aDZhLjUuNSAwIDAgMSAwIDFIN2EuNS41IDAgMCAxLS41LS41IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-ohlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTEzIDExaC0zdi0xaDNWM2gxdjJoNHYxaC00djExaC0xek02IDE3di0yaDN2LTFINlY0SDV2MUgydjFoM3YxMXoiLz48L3N2Zz4=)}.ag-charts-icon-pan-end{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0ibTYuNjQ2IDEzLjgxMy0uMzUzLjM1NC43MDcuNzA3LjM1NC0uMzU0ek0xMS4xNjYgMTBsLjM1NC4zNTQuMzU0LS4zNTQtLjM1NC0uMzU0ek03LjM1NSA1LjQ4IDcgNS4xMjZsLS43MDcuNzA3LjM1My4zNTR6bTAgOS4wNCA0LjE2Ni00LjE2Ni0uNzA3LS43MDgtNC4xNjcgNC4xNjd6bTQuMTY2LTQuODc0TDcuMzU0IDUuNDhsLS43MDguNzA3IDQuMTY3IDQuMTY3ek0xMy4wODMgNXYxMGgxVjV6Ii8+PC9zdmc+)}.ag-charts-icon-pan-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuNzkgNS44MzMgOC42MjUgMTBsNC4xNjYgNC4xNjctLjcwNy43MDdMNy4yMSAxMGw0Ljg3My00Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy4yMSAxNC4xNjcgMTEuMzc2IDEwIDcuMjEgNS44MzNsLjcwNy0uNzA3TDEyLjc5IDEwbC00Ljg3MyA0Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-start{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgNXYxMGgxVjV6TTkuNjI0IDEwbDQuMTY2LTQuMTY3LS43MDctLjcwN0w4LjIxIDEwbDQuODc0IDQuODc0LjcwNy0uNzA3eiIvPjwvc3ZnPg==)}.ag-charts-icon-parallel-channel,.ag-charts-icon-parallel-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTcuNzIgNS4zMzFBMi4yNSAyLjI1IDAgMSAwIDE0LjcwNSAzLjZsLTkuNDkgNC41NjJhMi4yNSAyLjI1IDAgMSAwIC4yMDkgMS4wMWw5LjY2Mi00LjY0NmEyLjI1IDIuMjUgMCAwIDAgMi42MzQuODA1bS4zNzMtMi41NDdhMS4yNSAxLjI1IDAgMSAxLTIuMzM4Ljg4NSAxLjI1IDEuMjUgMCAwIDEgMi4zMzgtLjg4NU00LjM0MyA4LjY3YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODVNNS4zMDcgMTYuNzI4YTIuMjUgMi4yNSAwIDEgMS0uNTI1LS44NThsOS45MjMtNC43N2EyLjI1IDIuMjUgMCAxIDEgLjM4MS45MjZ6bS0uOTY0LjI3NGExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjAyMy01LjEwNmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-position-bottom{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzem0zLTNoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgMTNoOHYxSDZ6Ii8+PC9zdmc+)}.ag-charts-icon-position-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMyAxMGgxNHYxSDN6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDdoOHYxSDZ6bTAgNmg4djFINnoiLz48L3N2Zz4=)}.ag-charts-icon-position-top{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzeiIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik02IDdoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDEzaDh2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-price-label-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNC41IDNBMS41IDEuNSAwIDAgMCAzIDQuNVYxM2ExLjUgMS41IDAgMCAwIDEuNSAxLjVoLjgzM3YuMDU3Yy4yNDItLjI5OS41OTctLjUwMyAxLS41NDhWMTMuNUg0LjVBLjUuNSAwIDAgMSA0IDEzVjQuNWEuNS41IDAgMCAxIC41LS41aDExYS41LjUgMCAwIDEgLjUuNXY4YS41LjUgMCAwIDEtLjUuNWgtNC44MThsLS4xMjYuMDg0YTI2IDI2IDAgMCAwLTIuMjI1IDEuNjg1bC0uMzIuMjY1LS4wNjguMDU2YTEuNSAxLjUgMCAwIDEtMi42MDkgMS4zNTRjLjAzMy43NjMuOTA1IDEuMjM4IDEuNTYuNzU2LjY0Ni0uNDc0IDEuMjEtLjk0MyAxLjc2MS0xLjRsLjMxMy0uMjZBMjYgMjYgMCAwIDEgMTAuOTg2IDE0SDE1LjVhMS41IDEuNSAwIDAgMCAxLjUtMS41di04QTEuNSAxLjUgMCAwIDAgMTUuNSAzeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC43MTYgMTQuODE1YTIuMjUgMi4yNSAwIDEgMS00LjIxIDEuNTkzIDIuMjUgMi4yNSAwIDAgMSA0LjIxLTEuNTkzbS0xLjY2MiAxLjk2NmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS41IDYuMjI4IDcuMTY3IDguMzc2IDYuNSA3Ljc2MiA5LjUgNWwzIDIuNzYyLS42NjcuNjE0eiIgZmlsbD0iIzAwMCIvPjxwYXRoIGQ9Ik0yIDE4di0xaDE2djF6TTIgM1YyaDE2djF6IiBmaWxsPSIjMTgxRDFGIi8+PC9zdmc+)}.ag-charts-icon-reset{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuMDQgNC40NDVhNS44MSA1LjgxIDAgMCAwLTcuMjU3IDIuNDUzLjUuNSAwIDAgMS0uODY1LS41MDJBNi44MSA2LjgxIDAgMSAxIDMgOS44MTNhLjUuNSAwIDAgMSAxIDAgNS44MSA1LjgxIDAgMSAwIDguMDQtNS4zNjgiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTQuMjg5IDMuMDAyYS41LjUgMCAwIDEgLjUuNXYyLjY1NWgyLjY1NWEuNS41IDAgMCAxIDAgMUg0LjI5YS41LjUgMCAwIDEtLjUtLjVWMy41MDJhLjUuNSAwIDAgMSAuNS0uNSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-settings{--icon: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkIj48cGF0aCBkPSJNMTAgMTNhMyAzIDAgMSAwIDAtNiAzIDMgMCAwIDAgMCA2bTAtMWEyIDIgMCAxIDEtLjAwMS0zLjk5OUEyIDIgMCAwIDEgMTAgMTIiLz48cGF0aCBkPSJNMi4zMSAxNC4zNDVjLS44MTctMS40OTEuMDI3LTIuNDk5LjQ3NC0yLjg2NS41MzEtLjQzNC45NjktLjM2NS45NzItMS40OC0uMDAzLTEuMTE1LS40NDEtMS4wNDYtLjk3Mi0xLjQ4MS0uNDU0LS4zNzEtMS4zMTctMS40MDUtLjQzNC0yLjkzNmwuMDA1LS4wMDljLjg4NC0xLjUyIDIuMjA3LTEuMjkgMi43NTUtMS4wODMuNjQxLjI0My44MDEuNjU2IDEuNzY4LjEwMS45NjQtLjU2LjY4Ni0uOTA0Ljc5Ni0xLjU4Mi4wOTQtLjU3OC41NTktMS44NDMgMi4zMjYtMS44NDNoLjAxYzEuNzU5LjAwNSAyLjIyMiAxLjI2NiAyLjMxNiAxLjg0My4xMS42NzgtLjE2OCAxLjAyMi43OTYgMS41ODIuOTY3LjU1NSAxLjEyNy4xNDIgMS43NjgtLjEwMS41NDktLjIwOCAxLjg3Ni0uNDM4IDIuNzYgMS4wOTJzLjAyIDIuNTY1LS40MzQgMi45MzZjLS41MzEuNDM1LS45NjkuMzY2LS45NzIgMS40ODEuMDAzIDEuMTE1LjQ0MSAxLjA0Ni45NzIgMS40OC40NTQuMzcyIDEuMzE3IDEuNDA2LjQzNCAyLjkzN2wtLjAwNS4wMDljLS44ODQgMS41Mi0yLjIwNyAxLjI5LTIuNzU1IDEuMDgzLS42NDEtLjI0My0uODAxLS42NTYtMS43NjgtLjEwMS0uOTY0LjU2LS42ODYuOTA0LS43OTYgMS41ODEtLjA5NC41NzktLjU1OSAxLjg0NC0yLjMyNiAxLjg0NGgtLjAxYy0xLjc1OS0uMDA1LTIuMjIyLTEuMjY2LTIuMzE2LTEuODQ0LS4xMS0uNjc3LjE2OC0xLjAyMS0uNzk2LTEuNTgxLS45NjctLjU1NS0xLjEyNy0uMTQyLTEuNzY4LjEwMS0uNTQ5LjIwOC0xLjg3Ni40MzgtMi43Ni0xLjA5MmwtLjAyLS4wMzZ6TTkuOTg0IDIuMTYySDEwYzEuMzU1IDAgMS4zNDIgMS4wMzkgMS4zNTMgMS40MjUuMDA4LjMxMi4wNCAxLjE2IDEuMjU5IDEuODcybC4wMTUuMDA4YzEuMjI1LjcgMS45NzYuMzA0IDIuMjUxLjE1NS4zMzctLjE4MyAxLjIyNi0uNzExIDEuOTAyLjQ0NWwuMDA4LjAxNGMuNjc4IDEuMTczLS4yMjkgMS42ODItLjU1OCAxLjg4NC0uMjY2LjE2My0uOTg0LjYxNS0uOTkxIDIuMDI3di4wMTZjLjAwNyAxLjQxMi43MjUgMS44NjQuOTkxIDIuMDI3LjMyOC4yMDEgMS4yMjkuNzA3LjU2NiAxLjg3bC0uMDA4LjAxNGMtLjY3NyAxLjE3NC0xLjU3MS42NDMtMS45MS40NTktLjI3NS0uMTQ5LTEuMDI2LS41NDUtMi4yNTEuMTU0bC0uMDE1LjAwOWMtMS4yMTkuNzEyLTEuMjUxIDEuNTYtMS4yNTkgMS44NzItLjAxMS4zODYuMDAyIDEuNDI1LTEuMzUzIDEuNDI1cy0xLjM0Mi0xLjAzOS0xLjM1My0xLjQyNWMtLjAwOC0uMzEyLS4wNC0xLjE2LTEuMjU5LTEuODcybC0uMDE1LS4wMDljLTEuMjI1LS42OTktMS45NzYtLjMwMy0yLjI1MS0uMTU0LS4zMzYuMTgzLTEuMjE5LjcwNi0xLjg5NC0uNDMybC0uMDE2LS4wMjdjLS42NzgtMS4xNzQuMjI5LTEuNjgyLjU1OC0xLjg4NC4yNjYtLjE2My45ODQtLjYxNS45OTEtMi4wMjd2LS4wMTZjLS4wMDctMS40MTItLjcyNS0xLjg2NC0uOTkxLTIuMDI3LS4zMjgtLjIwMS0xLjIyOS0uNzA3LS41NjYtMS44N2wuMDA4LS4wMTRjLjY3Ny0xLjE3NCAxLjU3MS0uNjQzIDEuOTEtLjQ1OS4yNzUuMTQ5IDEuMDI2LjU0NSAyLjI1MS0uMTU1bC4wMTUtLjAwOGMxLjIxOS0uNzEyIDEuMjUxLTEuNTYgMS4yNTktMS44NzIuMDEtLjM4NC0uMDAyLTEuNDE3IDEuMzM3LTEuNDI1Ii8+PC9zdmc+)}.ag-charts-icon-step-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzE4MUQxRiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNiA0aDV2OGgzVjhoNXYxaC00djRoLTVWNUg3djEwSDJ2LTFoNHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-text-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00IDRIMTZWN0gxNVY1SDEwLjVWMTVIMTRWMTZINlYxNUg5LjVWNUg1VjdINFY0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-trend-line,.ag-charts-icon-trend-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS4zMTQgMTAuOTM4YTIuMjUgMi4yNSAwIDEgMSAuMDEtMWg5LjM1MmEyLjI1IDIuMjUgMCAxIDEgLjAxIDF6bS0yLjE4OS43MjlhMS4yNSAxLjI1IDAgMSAwIDAtMi41IDEuMjUgMS4yNSAwIDAgMCAwIDIuNW0xMy43NSAwYTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-unlock,.ag-charts-icon-unlocked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNjUxIDMuNWEyLjg5NCAyLjg5NCAwIDAgMC0yLjg5NCAyLjg5NFY5SDE0LjVhMi41IDIuNSAwIDAgMSAyLjUgMi41djNhMi41IDIuNSAwIDAgMS0yLjUgMi41aC04QTIuNSAyLjUgMCAwIDEgNCAxNC41di0zQTIuNSAyLjUgMCAwIDEgNi41IDloLjI1N1Y2LjM5NGEzLjg5NCAzLjg5NCAwIDEgMSA3Ljc4OSAwIC41LjUgMCAwIDEtMSAwQTIuODk0IDIuODk0IDAgMCAwIDEwLjY1IDMuNU02LjUgMTBBMS41IDEuNSAwIDAgMCA1IDExLjV2M0ExLjUgMS41IDAgMCAwIDYuNSAxNmg4YTEuNSAxLjUgMCAwIDAgMS41LTEuNXYtM2ExLjUgMS41IDAgMCAwLTEuNS0xLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-vertical-line,.ag-charts-icon-vertical-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNSA3LjgwNmEyLjI1IDIuMjUgMCAwIDEgMCA0LjM4OFYxOS41aC0xdi03LjMwNmEyLjI1IDIuMjUgMCAwIDEgMC00LjM4OFYuNWgxem0tLjUuOTQ0YTEuMjUgMS4yNSAwIDEgMSAwIDIuNSAxLjI1IDEuMjUgMCAwIDEgMC0yLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-zoom-in{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-zoom-out{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS41IDEwYS41LjUgMCAwIDEgLjUtLjVoOGEuNS41IDAgMCAxIDAgMUg2YS41LjUgMCAwIDEtLjUtLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-high-low-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyA0aDJ2MTJINFY0aDNNNSA1aDN2MTBINXpNMTEgMTRWNmg1djhoLTVtMS03aDN2NmgtM3oiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-hlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTYzIDEuODM3LTUuMzM0IDExLjYyMUw2Ljk1NyA4LjEybC00LjE5OSA5LjYyMi0uOTE2LS40IDQuNzU2LTEwLjlMMTIuNDkgMTEuOCAxNy4yNTQgMS40MnoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjQiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuODI1IDIuNzA0LjU1IDEzLjc4NWwuOTAyLjQzIDQuNzI0LTkuOTE5IDYuMDM0IDUuMDI5IDMuMjU1LTguMTQtLjkyOC0uMzctMi43NDUgNi44NnptNy44NTIgMTQuNjM2IDUuNzgtMTMuMTM5LS45MTUtLjQwMi01LjIxOSAxMS44Ni02LjAwNS01LjUwNC0zLjI3OCA3LjY0OC45Mi4zOTQgMi43MjItNi4zNTJ6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-zoom-in-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20taW4iPjxjaXJjbGUgY3g9IjExIiBjeT0iMTEiIHI9IjgiLz48bGluZSB4MT0iMjEiIHgyPSIxNi42NSIgeTE9IjIxIiB5Mj0iMTYuNjUiLz48bGluZSB4MT0iMTEiIHgyPSIxMSIgeTE9IjgiIHkyPSIxNCIvPjxsaW5lIHgxPSI4IiB4Mj0iMTQiIHkxPSIxMSIgeTI9IjExIi8+PC9zdmc+)}.ag-charts-icon-zoom-out-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20tb3V0Ij48Y2lyY2xlIGN4PSIxMSIgY3k9IjExIiByPSI4Ii8+PGxpbmUgeDE9IjIxIiB4Mj0iMTYuNjUiIHkxPSIyMSIgeTI9IjE2LjY1Ii8+PGxpbmUgeDE9IjgiIHgyPSIxNCIgeTE9IjExIiB5Mj0iMTEiLz48L3N2Zz4=)}.ag-charts-input{--input-layer-active: 1;--input-layer-focus: 2;--input-padding: calc(var(--ag-charts-spacing) * 2);--input-padding-large: calc(var(--ag-charts-spacing) * 2.5);color:var(--ag-charts-input-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);transition-duration:.25s;transition-property:none;transition-timing-function:ease-out}.ag-charts-input:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--input-layer-focus)}.ag-charts-button{background:var(--ag-charts-button-background-color);border:1px solid var(--ag-charts-border-color);border-radius:var(--ag-charts-button-border-radius);color:var(--ag-charts-button-text-color);cursor:pointer;padding:var(--input-padding);transition-property:background,border-color}.ag-charts-button:hover{background:var(--ag-charts-focus-color)}.ag-charts-button:has(.ag-charts-icon){padding:2px}.ag-charts-checkbox{--checkbox-transition-duration: .1s;appearance:none;background:var(--ag-charts-checkbox-background-color);border-radius:calc(var(--ag-charts-border-radius) * 9);cursor:pointer;height:18px;margin:0;transition-duration:var(--checkbox-transition-duration);transition-property:margin;width:29px}.ag-charts-checkbox:before{display:block;background:var(--ag-charts-input-background-color);border-radius:calc(var(--ag-charts-border-radius) * 7);content:" ";height:14px;margin:2px;transition-duration:var(--checkbox-transition-duration);transition-property:margin;transition-timing-function:var(--ag-charts-input-transition-easing);width:14px}.ag-charts-checkbox:checked{background:var(--ag-charts-checkbox-checked-background-color)}.ag-charts-checkbox:checked:before{margin-left:13px}.ag-charts-select{background:var(--ag-charts-input-background-color);border:1px solid var(--ag-charts-input-border-color);border-radius:var(--ag-charts-input-border-radius);padding:3px 2px 4px;font-size:inherit}.ag-charts-textarea{--textarea-line-height: 1.38;background:var(--ag-charts-input-background-color);border:1px solid var(--ag-charts-border-color);border-radius:var(--ag-charts-input-border-radius);line-height:var(--textarea-line-height);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);padding:var(--input-padding-large) var(--input-padding)}.ag-charts-textarea::placeholder{color:var(--ag-charts-input-placeholder-text-color)}.ag-charts-proxy-container{pointer-events:none;position:absolute}.ag-charts-proxy-elem{-webkit-appearance:none;appearance:none;background:none;border:none;color:#0000;overflow:hidden;pointer-events:auto;position:absolute}.ag-charts-proxy-elem::-moz-range-thumb,.ag-charts-proxy-elem::-moz-range-track{opacity:0}.ag-charts-proxy-elem::-webkit-slider-runnable-track,.ag-charts-proxy-elem::-webkit-slider-thumb{opacity:0}.ag-charts-proxy-elem:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-focus-indicator{position:absolute;display:block;pointer-events:none;user-select:none;-webkit-user-select:none;width:100%;height:100%}.ag-charts-focus-indicator>div{position:absolute;outline:solid 1px var(--ag-charts-chrome-background-color);box-shadow:var(--ag-charts-focus-shadow)}.ag-charts-focus-indicator>svg{width:100%;height:100%;fill:none;overflow:visible}.ag-charts-focus-svg-outer-path{stroke:var(--ag-charts-chrome-background-color);stroke-width:4px}.ag-charts-focus-svg-inner-path{stroke:var(--ag-charts-accent-color);stroke-width:2px}.ag-charts-overlay{color:#181d1f;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay{color:#fff}.ag-charts-overlay--loading{color:#8c8c8c}.ag-charts-overlay__loading-background{background:#fff;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay .ag-charts-overlay__loading-background{background:#192232}.ag-charts-tooltip{--tooltip-arrow-size: 8px;position:fixed;inset:unset;margin:0;padding:0;overflow:visible;width:max-content;max-width:100%;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);color:var(--ag-charts-chrome-text-color);background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);border-radius:var(--ag-charts-border-radius);box-shadow:var(--ag-charts-shadow)}.ag-charts-tooltip--compact .ag-charts-tooltip-content{padding:3px 6px}.ag-charts-tooltip--arrow:before{content:"";position:absolute;top:100%;left:50%;margin:0 auto;transform:translate(-50%) translateY(calc(var(--tooltip-arrow-size) * -.5)) rotate(45deg);display:block;width:var(--tooltip-arrow-size);height:var(--tooltip-arrow-size);border:inherit;border-top:none;border-left:none;clip-path:polygon(0% 100%,100% 0%,100% 100%)}.ag-charts-tooltip--arrow:after{--tooltip-inner-size: calc(var(--tooltip-arrow-size) - 2px);content:"";position:absolute;top:100%;left:50%;margin:0 auto;transform:translate(-50%) translateY(calc(var(--tooltip-inner-size) * -.5)) rotate(45deg);display:block;width:var(--tooltip-inner-size);height:var(--tooltip-inner-size);border:inherit;border-color:transparent;background:inherit;clip-path:polygon(-10% 100%,100% -10%,100% 100%)}.ag-charts-tooltip--no-interaction{pointer-events:none;user-select:none;-webkit-user-select:none}.ag-charts-tooltip--wrap-always{overflow-wrap:break-word;word-break:break-word;hyphens:none}.ag-charts-tooltip--wrap-hyphenate{overflow-wrap:break-word;word-break:break-word;hyphens:auto}.ag-charts-tooltip--wrap-on-space{overflow-wrap:normal;word-break:normal}.ag-charts-tooltip--wrap-never{white-space:nowrap}.ag-charts-tooltip-heading,.ag-charts-tooltip-title,.ag-charts-tooltip-label,.ag-charts-tooltip-value{overflow:hidden;text-overflow:ellipsis}.ag-charts-tooltip-content{display:grid;grid:auto-flow minmax(1em,auto) / 1fr;padding:8px 12px;gap:8px}.ag-charts-tooltip-content:has(.ag-charts-tooltip-symbol){grid:auto-flow minmax(1em,auto) / auto 1fr}.ag-charts-tooltip-heading{grid-column:1 / -1}.ag-charts-tooltip-symbol{grid-column:1 / 2;align-self:center}.ag-charts-tooltip-symbol svg{display:block}.ag-charts-tooltip-title{grid-column:-2 / -1}.ag-charts-tooltip-row{grid-column:1 / -1;display:flex;gap:16px;align-items:baseline;justify-content:space-between;overflow:hidden}.ag-charts-tooltip-row--inline{grid-column:-2 / -1}.ag-charts-tooltip-label{flex:1;min-width:0}.ag-charts-tooltip-value{min-width:0}.ag-charts-popover{position:absolute;border:var(--ag-charts-border);border-radius:var(--ag-charts-border-radius);background:var(--ag-charts-chrome-background-color);color:var(--ag-charts-chrome-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);box-shadow:var(--ag-charts-shadow);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-menu{--item-padding: 6px 12px;--icon-color: var(--ag-charts-chrome-text-color);display:grid;grid:auto-flow auto / 1fr;column-gap:12px;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-menu:has(.ag-charts-menu__icon,.ag-charts-menu__row--stroke-width-visible){grid:auto-flow auto / auto 1fr}.ag-charts-menu__row--stroke-width-visible:before{content:"";height:var(--strokeWidth);width:12px;background:var(--icon-color)}.ag-charts-menu__row--stroke-width-visible[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-menu__row{display:grid;grid-column:1 / -1;grid-template-columns:subgrid;align-items:center;padding:var(--item-padding)}.ag-charts-menu__row:not(.ag-charts-menu__row--active){cursor:pointer}.ag-charts-menu__row:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.ag-charts-menu__row:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.ag-charts-menu__row:focus{background:var(--ag-charts-focus-color)}.ag-charts-menu__row:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--ag-charts-layer-menu)}.ag-charts-menu__row--active{--icon-color: var(--ag-charts-accent-color);background:var(--ag-charts-focus-color);color:var(--ag-charts-accent-color)}.ag-charts-menu__label{grid-column:-1 / span 1}.ag-charts-toolbar{--toolbar-gap: calc(var(--ag-charts-spacing) * 2);--toolbar-size: 34px;--toolbar-button-padding: 6px;align-items:center;display:flex;flex-wrap:nowrap;position:absolute}.ag-charts-toolbar__button{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);color:var(--ag-charts-chrome-text-color);cursor:pointer;display:flex;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-medium);font-weight:var(--ag-charts-chrome-font-weight);justify-content:center;min-height:var(--toolbar-size);min-width:var(--toolbar-size);padding:var(--toolbar-button-padding);position:relative;transition:background-color .25s ease-in-out,border-color .25s ease-in-out,color .25s ease-in-out;white-space:nowrap}.ag-charts-toolbar__button:hover{background:var(--ag-charts-focus-color);z-index:1}.ag-charts-toolbar__button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-toolbar__button--active{background:var(--ag-charts-focus-color);border-color:var(--ag-charts-accent-color);color:var(--ag-charts-accent-color);z-index:2}.ag-charts-toolbar__button[aria-disabled=true]{background:var(--ag-charts-button-disabled-background-color);color:var(--ag-charts-button-disabled-text-color);cursor:default}.ag-charts-toolbar--horizontal{flex-direction:row;.ag-charts-toolbar__button{margin:0 0 0 -1px}.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar--vertical{flex-direction:column;.ag-charts-toolbar__button{margin:-1px 0 0;max-width:100%}.ag-charts-toolbar__button--first{border-top-left-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-left-radius:var(--ag-charts-border-radius);border-bottom-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{margin-left:var(--toolbar-gap)}.ag-charts-toolbar__icon,.ag-charts-toolbar__label{pointer-events:none}.ag-charts-floating-toolbar{border:none;display:flex;.ag-charts-toolbar{align-items:unset;position:unset}}.ag-charts-floating-toolbar__drag-handle{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);cursor:grab;display:flex;justify-content:center;min-width:24px;padding-left:0;padding-right:0}.ag-charts-floating-toolbar__drag-handle--dragging{cursor:grabbing} `,Listeners=class{constructor(){this.registeredListeners=new Map}addListener(t,e){const i={symbol:Symbol(t),handler:e};return this.registeredListeners.has(t)?this.registeredListeners.get(t).push(i):this.registeredListeners.set(t,[i]),()=>this.removeListener(i.symbol)}removeListener(t){for(const[e,i]of this.registeredListeners.entries()){const s=i.findIndex(n=>n.symbol===t);if(s>=0){i.splice(s,1),i.length===0&&this.registeredListeners.delete(e);break}}}dispatch(t,...e){for(const i of this.getListenersByType(t))try{i.handler(...e)}catch(s){logger_exports.errorOnce(String(s))}}getListenersByType(t){return this.registeredListeners.get(t)??[]}destroy(){this.registeredListeners.clear()}},BaseManager=class{constructor(){this.listeners=new Listeners,this.destroyFns=[]}addListener(t,e){return this.listeners.addListener(t,e)}destroy(){this.listeners.destroy(),this.destroyFns.forEach(t=>t())}},GuardedElement=class V{constructor(e,i,s){this.element=e,this.topTabGuard=i,this.bottomTabGuard=s,this.destroyFns=[],this.guardTabIndex=0,this.hasFocus=!1,this.initTabGuard(this.topTabGuard,n=>this.onTab(n,!1)),this.initTabGuard(this.bottomTabGuard,n=>this.onTab(n,!0)),this.element.addEventListener("focus",()=>this.onFocus(),{capture:!0}),this.element.addEventListener("blur",n=>this.onBlur(n),{capture:!0})}set tabIndex(e){this.guardTabIndex=e,this.guardTabIndex===0?this.setGuardIndices(void 0):this.hasFocus||this.setGuardIndices(this.guardTabIndex)}destroy(){for(const e of this.destroyFns)e();this.destroyFns.length=0}initTabGuard(e,i){const s=()=>i(e);e.addEventListener("focus",s),this.destroyFns.push(()=>e.removeEventListener("focus",s))}setGuardIndices(e){const i=e;setAttribute(this.topTabGuard,"tabindex",i),setAttribute(this.bottomTabGuard,"tabindex",i)}onFocus(){this.hasFocus=!0,this.guardTabIndex!==0&&this.setGuardIndices(0)}onBlur({relatedTarget:e}){const{topTabGuard:i,bottomTabGuard:s}=this;this.hasFocus=!1,this.guardTabIndex!==0&&e!==i&&e!==s&&this.setGuardIndices(this.guardTabIndex)}onTab(e,i){if(this.guardTabIndex!==0){let s;e.tabIndex===0?(s=this.findExitTarget(!i),this.setGuardIndices(this.guardTabIndex)):s=this.findEnterTarget(i),s?.focus()}}static queryFocusable(e,i){const s=getWindow();return Array.from(e.querySelectorAll(i)).filter(n=>{if(n instanceof HTMLElement){const r=s.getComputedStyle(n);return r.display!=="none"&&r.visibility!=="none"}return!1})}findEnterTarget(e){const i=V.queryFocusable(this.element,'[tabindex="0"]'),s=e?i.length-1:0;return i[s]}findExitTarget(e){const i=V.queryFocusable(getDocument(),"[tabindex]").filter(r=>r.tabIndex>0).sort((r,a)=>r.tabIndex-a.tabIndex),{before:s,after:n}=V.findBeforeAndAfter(i,this.guardTabIndex);return e?s:n}static findBeforeAndAfter(e,i){let s=0,n=e.length-1,r,a;for(;s<=n;){const o=Math.floor((s+n)/2),c=e[o].tabIndex;if(c===i){r=e[o-1]||void 0,a=e[o+1]||void 0;break}else ct.key===s))}var PREV_NEXT_KEYS={horizontal:{nextKey:"ArrowRight",prevKey:"ArrowLeft"},vertical:{nextKey:"ArrowDown",prevKey:"ArrowUp"}};function stopPageScrolling(t){const e=i=>{if(i.defaultPrevented)return;getAttribute(i.target,"data-preventdefault",!0)&&matchesKey(i,"ArrowRight","ArrowLeft","ArrowDown","ArrowUp")&&i.preventDefault()};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)}var PixelRatioObserver=class{constructor(t){this.callback=t,this.devicePixelRatio=getWindow("devicePixelRatio")??1,this.devicePixelRatioMediaQuery=void 0,this.devicePixelRatioListener=e=>{e.matches||(this.devicePixelRatio=getWindow("devicePixelRatio")??1,this.unregisterDevicePixelRatioListener(),this.registerDevicePixelRatioListener(),this.callback(this.pixelRatio))}}get pixelRatio(){return this.devicePixelRatio}observe(){this.registerDevicePixelRatioListener()}disconnect(){this.unregisterDevicePixelRatioListener()}unregisterDevicePixelRatioListener(){this.devicePixelRatioMediaQuery?.removeEventListener("change",this.devicePixelRatioListener),this.devicePixelRatioMediaQuery=void 0}registerDevicePixelRatioListener(){const t=getWindow("matchMedia")?.(`(resolution: ${this.pixelRatio}dppx)`);t?.addEventListener("change",this.devicePixelRatioListener),this.devicePixelRatioMediaQuery=t}},SizeMonitor=class{constructor(){this.elements=new Map,this.documentReady=!1,this.queuedObserveRequests=[],this.onLoad=()=>{this.documentReady=!0,this.queuedObserveRequests.forEach(([e,i])=>this.observe(e,i)),this.queuedObserveRequests=[],this.observeWindow()},typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(e=>{for(const{target:i,contentRect:{width:s,height:n}}of e){const r=this.elements.get(i);this.checkSize(r,i,s,n)}}));let t;this.pixelRatioObserver=new PixelRatioObserver(()=>{clearTimeout(t),t=setTimeout(()=>this.checkPixelRatio(),0)}),this.documentReady=getDocument("readyState")==="complete",this.documentReady?this.observeWindow():getWindow()?.addEventListener("load",this.onLoad)}destroy(){getWindow()?.removeEventListener("load",this.onLoad),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.pixelRatioObserver?.disconnect(),this.pixelRatioObserver=void 0}observeWindow(){this.pixelRatioObserver?.observe()}checkPixelRatio(){const t=this.pixelRatioObserver?.pixelRatio??1;for(const[e,i]of this.elements)if(i.size!=null&&i.size.pixelRatio!==t){const{width:s,height:n}=i.size;i.size={width:s,height:n,pixelRatio:t},i.cb(i.size,e)}}checkSize(t,e,i,s){if(t&&(i!==t.size?.width||s!==t.size?.height)){const n=this.pixelRatioObserver?.pixelRatio??1;t.size={width:i,height:s,pixelRatio:n},t.cb(t.size,e)}}observe(t,e){if(!this.documentReady){this.queuedObserveRequests.push([t,e]);return}this.elements.has(t)?this.removeFromQueue(t):this.resizeObserver?.observe(t);const i={cb:e};this.elements.set(t,i)}unobserve(t){this.resizeObserver?.unobserve(t),this.elements.delete(t),this.removeFromQueue(t),this.elements.size||this.destroy()}removeFromQueue(t){this.queuedObserveRequests=this.queuedObserveRequests.filter(([e])=>e!==t)}},StateTracker=class extends Map{constructor(t,e){super(),this.defaultValue=t,this.defaultState=e}set(t,e){return this.delete(t),typeof e<"u"&&super.set(t,e),this}stateId(){return Array.from(this.keys()).pop()??this.defaultState}stateValue(){return Array.from(this.values()).pop()??this.defaultValue}},domLayout_default='',DOM_ELEMENT_CLASSES=["styles","canvas","canvas-center","canvas-container","canvas-overlay","canvas-proxy","series-area"],CONTAINER_MODIFIERS={safeHorizontal:"ag-charts-wrapper--safe-horizontal",safeVertical:"ag-charts-wrapper--safe-vertical"},domElementConfig=new Map([["styles",{childElementType:"style"}],["canvas",{childElementType:"canvas"}],["canvas-proxy",{childElementType:"div"}],["canvas-overlay",{childElementType:"div"}],["canvas-center",{childElementType:"div"}],["series-area",{childElementType:"div"}]]);function setupObserver(t,e){if(typeof IntersectionObserver>"u")return;const i=new IntersectionObserver(s=>{for(const n of s)n.target===t&&e(n.intersectionRatio)},{root:t});return i.observe(t),i}var NULL_DOMRECT={x:0,y:0,width:0,height:0,top:0,bottom:0,left:0,right:0,toJSON(){return NULL_DOMRECT}};function createTabGuardElement(t,e){const i=createElement("div");return i.className="ag-charts-tab-guard",t.insertAdjacentElement(e,i),i}var DOMManager=class extends BaseManager{constructor(t,e){super(),this.styles=new Map,this.container=void 0,this.containerSize=void 0,this.sizeMonitor=new SizeMonitor,this.cursorState=new StateTracker("default"),this.minWidth=0,this.minHeight=0;const i=createElement("div");i.innerHTML=domLayout_default,this.element=i.children.item(0),this.styleRootElement=e,this.rootElements=DOM_ELEMENT_CLASSES.reduce((o,c)=>{const l=`ag-charts-${c}`,h=this.element.classList.contains(l)?this.element:this.element.querySelector(`.${l}`);if(!h)throw new Error(`AG Charts - unable to find DOM element ${l}`);return o[c]={element:h,children:new Map,listeners:[]},o},{});let s=!1;this.observer=setupObserver(this.element,o=>{o===0&&!s&&this.listeners.dispatch("hidden",{type:"hidden"}),s=o===0}),this.setSizeOptions(),this.updateContainerSize(),this.addStyles("ag-charts-community",styles_default),t&&this.setContainer(t),this.destroyFns.push(stopPageScrolling(this.element));const n=this.element.querySelector(".ag-charts-canvas-center");if(n==null)throw new Error("Error initializing tab guards");const r=createTabGuardElement(n,"beforebegin"),a=createTabGuardElement(n,"afterend");this.tabGuards=new GuardedElement(n,r,a)}destroy(){super.destroy(),this.observer?.unobserve(this.element),this.container&&this.sizeMonitor.unobserve(this.container),Object.values(this.rootElements).forEach(t=>{t.children.forEach(e=>e.remove()),t.element.remove()}),this.element.remove()}setSizeOptions(t=300,e=300,i,s){const{style:n}=this.element;n.width=`${i??t}px`,n.height=`${s??e}px`,this.minWidth=i??t,this.minHeight=s??e,this.updateContainerClassName()}updateContainerSize(){const{style:t}=this.rootElements["canvas-center"].element;t.visibility=this.containerSize==null?"hidden":"",this.containerSize?(t.width=`${this.containerSize.width??0}px`,t.height=`${this.containerSize.height??0}px`):(t.width="",t.height=""),this.updateContainerClassName()}setTabGuardIndex(t){this.tabGuards.tabIndex=t}setContainer(t){if(t===this.container)return;if(this.container&&(this.container.removeChild(this.element),this.sizeMonitor.unobserve(this.container)),!(this.getShadowDocumentRoot(t)!=null))for(const i of this.rootElements.styles.children.keys())this.removeChild("styles",i);this.container=t;for(const[i,s]of this.styles)this.addStyles(i,s);t.appendChild(this.element),this.sizeMonitor.observe(t,i=>{this.containerSize=i,this.updateContainerSize(),this.listeners.dispatch("resize",{type:"resize"})}),this.listeners.dispatch("container-changed",{type:"container-changed"})}setThemeClass(t){const e="ag-charts-theme-";this.element.classList.forEach(i=>{i.startsWith(e)&&i!==t&&this.element.classList.remove(i)}),this.element.classList.add(t)}setThemeParameters(t){const e={accentColor:"accent-color",axisColor:"axis-color",backgroundColor:"background-color",borderColor:"border-color",foregroundColor:"foreground-color",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",gridLineColor:"grid-line-color",padding:"padding",subtleTextColor:"subtle-text-color",textColor:"text-color",chromeBackgroundColor:"chrome-background-color",chromeFontFamily:"chrome-font-family",chromeFontSize:"chrome-font-size",chromeFontWeight:"chrome-font-weight",chromeSubtleTextColor:"chrome-subtle-text-color",chromeTextColor:"chrome-text-color",inputBackgroundColor:"input-background-color",inputTextColor:"input-text-color",crosshairLabelBackgroundColor:"crosshair-label-background-color",crosshairLabelTextColor:"crosshair-label-text-color"},i=["fontSize","chromeFontSize"];for(const[s,n]of Object.entries(t)){let r=`${n}`;i.includes(s)&&(r=`${n}px`),this.element.style.setProperty(`--ag-charts-${e[s]}`,r)}}updateCanvasLabel(t){setAttribute(this.rootElements["canvas-proxy"].element,"aria-label",t)}getEventElement(t,e){return["focus","blur","keydown","keyup"].includes(e)?this.rootElements["series-area"].element:t}addEventListener(t,e,i){this.getEventElement(this.element,t).addEventListener(t,e,i)}removeEventListener(t,e,i){this.getEventElement(this.element,t).removeEventListener(t,e,i)}getBoundingClientRect(){return this.rootElements.canvas.element.getBoundingClientRect()}getOverlayClientRect(){const t=getWindow(),e=new BBox(0,0,t.innerWidth,t.innerHeight),i=this.getRawOverlayClientRect();return e.intersection(i)?.toDOMRect()??NULL_DOMRECT}getRawOverlayClientRect(){let t=this.element;for(;t!=null;){const r=t.computedStyleMap?.()?.get("overflow-y")?.toString();if(r==="auto"||r==="scroll")return BBox.fromDOMRect(t.getBoundingClientRect());t=t.parentElement}const e=this.getShadowDocumentRoot();if(e!=null)return BBox.fromDOMRect(e.getBoundingClientRect());const{innerWidth:i,innerHeight:s}=getWindow();return new BBox(0,0,i,s)}getShadowDocumentRoot(t=this.container){const e=t?.ownerDocument?.body??getDocument("body");for(;t!=null;){if(t===e)return;if(t.parentNode instanceof DocumentFragment)return t;t=t.parentNode}return this.container}getParent(t){return this.rootElements[t].element}getChildBoundingClientRect(t){const{children:e}=this.rootElements[t],i=[];for(const s of e.values())i.push(BBox.fromDOMRect(s.getBoundingClientRect()));return BBox.merge(i)}isManagedChildDOMElement(t,e,i){const{children:s}=this.rootElements[e],n=s?.get(i);return n!=null&&t.contains(n)}contains(t,e){return e==null?this.element.contains(t):this.rootElements[e].element.contains(t)}addStyles(t,e){const i="data-ag-charts";if(this.styles.set(t,e),this.container==null)return;const s=a=>a.getAttribute(i)===t,n=a=>{const o=new Set(["TITLE","META"]);let c=!0,l;for(const u of a.children){if(c&&o.has(u.tagName)){l=u;continue}if(c=!1,s(u))return;u.hasAttribute(i)&&(l=u)}const h=createElement("style");return l!=null?a.insertBefore(h,l.nextSibling):a.prepend(h),h};let r;this.styleRootElement?r=n(this.styleRootElement):this.getShadowDocumentRoot(this.container)!=null?r=this.addChild("styles",t):r=n(getDocument("head")),!(r==null||s(r))&&(r.setAttribute(i,t),r.innerHTML=e)}removeStyles(t){this.removeChild("styles",t)}updateCursor(t,e){this.cursorState.set(t,e),this.element.style.cursor=this.cursorState.stateValue()}getCursor(){return this.element.style.cursor}addChild(t,e,i,s){const{element:n,children:r,listeners:a}=this.rootElements[t];if(!r)throw new Error("AG Charts - unable to create DOM elements after destroy()");if(r.has(e))return r.get(e);const{childElementType:o="div"}=domElementConfig.get(t)??{};if(i&&i.tagName.toLowerCase()!==o.toLowerCase())throw new Error("AG Charts - mismatching DOM element type");const c=i??createElement(o);for(const[l,h,u]of a)c.addEventListener(l,h,u);if(r.set(e,c),s){const l=n.querySelector(s.query);if(l==null)throw new Error(`AG Charts - addChild query failed ${s.query}`);l.insertAdjacentElement(s.where,c)}else n?.appendChild(c);return c}removeChild(t,e){const{children:i}=this.rootElements[t];i&&(i.get(e)?.remove(),i.delete(e))}incrementDataCounter(t){const{dataset:e}=this.element;e[t]??(e[t]="0"),e[t]=String(Number(e[t])+1)}setDataBoolean(t,e){this.element.dataset[t]=String(e)}updateContainerClassName(){const{element:t,containerSize:e,minWidth:i,minHeight:s}=this;t.classList.toggle(CONTAINER_MODIFIERS.safeHorizontal,i>=(e?.width??1/0)),t.classList.toggle(CONTAINER_MODIFIERS.safeVertical,s>=(e?.height??1/0))}},BoundedTextWidget=class extends Widget{constructor(){super(createElement("div")),this.textElement=createSvgElement("text"),this.textElement.role="presentation",this.svgElement=createSvgElement("svg"),this.svgElement.appendChild(this.textElement),this.svgElement.style.width="100%",this.svgElement.style.opacity="0",this.svgElement.role="presentation",this.elem.appendChild(this.svgElement),this.elem.role="presentation"}set textContent(t){this.textElement.textContent=t;const i=this.textElement.getBBox?.();i&&this.svgElement.setAttribute("viewBox",`${i.x} ${i.y} ${i.width} ${i.height}`)}get textContent(){return this.textElement.textContent}destructor(){}},ButtonWidget=class extends Widget{constructor(){super(createElement("button")),this.setEnabled(!0)}destructor(){}setEnabled(t){setAttribute(this.elem,"aria-disabled",!t),setElementStyle(this.elem,"pointer-events",t?void 0:"none")}addListener(t,e){return super.addListener(t,(i,s)=>{(t==="click"||t==="dblclick")&&this.isDisabled()||e(i,s)})}},GroupWidget=class extends Widget{constructor(){super(createElement("div")),setAttribute(this.elem,"role","group")}destructor(){}},RovingTabContainerWidget=class extends Widget{constructor(t,e){super(createElement("div")),this.focusedChildIndex=0,this.onChildFocus=(i,s)=>{const n=this.children[this.focusedChildIndex];this.focusedChildIndex=s.index,n?.setTabIndex(-1),s.setTabIndex(0)},this.onChildKeyDown=(i,s)=>{const n=this.orientation,[r,a]=n==="both"?[PREV_NEXT_KEYS.horizontal,PREV_NEXT_KEYS.vertical]:[PREV_NEXT_KEYS[n],void 0];let o=-1;if(hasNoModifiers(i.sourceEvent)){const c=i.sourceEvent.key;c===r.nextKey||c===a?.nextKey?o=s.index+1:(c===r.prevKey||c===a?.prevKey)&&(o=s.index-1)}this.children[o]?.focus()},this.orientation=t,setAttribute(this.elem,"role",e)}get orientation(){return getAttribute(this.elem,"aria-orientation")??"both"}set orientation(t){setAttribute(this.elem,"aria-orientation",t!=="both"?t:void 0)}focus(){this.children[this.focusedChildIndex]?.focus()}onChildAdded(t){t.addListener("focus",this.onChildFocus),t.addListener("keydown",this.onChildKeyDown),t.setTabIndex(this.children.length===1?0:-1)}onChildRemoved(t){t.removeListener("focus",this.onChildFocus),t.removeListener("keydown",this.onChildKeyDown)}},ListWidget=class extends RovingTabContainerWidget{constructor(){super("both","list"),this.setHidden(!0)}destructor(){this.children.forEach(t=>t.getElement().parentElement.remove())}addChildToDOM(t,e){const i=createElement("div");setAttribute(i,"role","listitem"),setElementStyle(i,"position","absolute"),Widget.setElementContainer(t,i),this.appendOrInsert(i,e),this.setHidden(!1)}removeChildFromDOM(t){t.getElement().parentElement.remove(),this.setHidden(this.children.length===0)}setHidden(t){this.children.length===0&&(t=!0),super.setHidden(t)}},NativeWidget=class extends Widget{constructor(t){super(t)}destructor(){}},_SliderWidget=class _ extends Widget{constructor(){super(createElement("input")),this._step=_.STEP_ONE,this.orientation="both"}get step(){return this._step}set step(e){this._step=e,this.getElement().step=e.attributeValue}get keyboardStep(){return this._keyboardStep?.step??this._step}set keyboardStep(e){if(e!==this._keyboardStep?.step&&(this._keyboardStep!==void 0&&(this.removeListener("keydown",this._keyboardStep.onKeyDown),this.removeListener("keyup",this._keyboardStep.onKeyUp),this.removeListener("blur",this._keyboardStep.onBlur),this._keyboardStep=void 0),e!==void 0)){const i=()=>this.getElement().step=e.attributeValue,s=()=>this.getElement().step=this._step.attributeValue;this._keyboardStep={step:e,onKeyDown:i,onKeyUp:s,onBlur:s},this.addListener("keydown",this._keyboardStep.onKeyDown),this.addListener("keyup",this._keyboardStep.onKeyUp),this.addListener("blur",this._keyboardStep.onBlur)}}get orientation(){return getAttribute(this.elem,"aria-orientation")??"both"}set orientation(e){setAttribute(this.elem,"aria-orientation",e!=="both"?e:void 0),_.registerDefaultPreventers(this,e)}destructor(){}clampValueRatio(e,i){const s=this.getValueRatio(),n=clamp(e,s,i);return n!==s&&this.setValueRatio(n),n}setValueRatio(e,i){const{divider:s}=this.step,n=Math.round(e*1e4)/s,{ariaValueText:r=formatPercent(n/s)}=i??{},a=this.getElement();a.value=`${n}`,a.ariaValueText=r}getValueRatio(){return parseFloat(this.getElement().value)/this.step.divider}static registerDefaultPreventers(e,i){i==="both"?e.removeListener("keydown",_.onKeyDown):e.addListener("keydown",_.onKeyDown)}static onKeyDown(e,i){let s=[];const{orientation:n}=i;n==="horizontal"?s=["ArrowUp","ArrowDown"]:n==="vertical"&&(s=["ArrowLeft","ArrowRight"]),s.includes(e.sourceEvent.code)&&e.sourceEvent.preventDefault()}};_SliderWidget.STEP_ONE={attributeValue:"1",divider:1},_SliderWidget.STEP_HUNDRETH={attributeValue:"0.01",divider:100};var SliderWidget=_SliderWidget,SwitchWidget=class extends ButtonWidget{constructor(){super(),setAttribute(this.elem,"role","switch"),this.setChecked(!1)}setChecked(t){setAttribute(this.elem,"aria-checked",t)}},ToolbarWidget=class extends RovingTabContainerWidget{constructor(t="horizontal"){super(t,"toolbar")}destructor(){}};function checkType(t,e){return e.params?.type===t}function allocateResult(t){if(t==="button")return new ButtonWidget;if(t==="slider")return new SliderWidget;if(t==="toolbar")return new ToolbarWidget;if(t==="group")return new GroupWidget;if(t==="list")return new ListWidget;if(t==="region")return new NativeWidget(createElement("div"));if(t==="text")return new BoundedTextWidget;if(t==="listswitch")return new SwitchWidget;throw Error("AG Charts - error allocating meta")}function allocateMeta(t){const e={params:t,result:void 0};return e.result=allocateResult(e.params.type),e}var ProxyInteractionService=class{constructor(t,e){this.localeManager=t,this.domManager=e,this.destroyFns=[]}destroy(){this.destroyFns.forEach(t=>t())}addLocalisation(t){t(),this.destroyFns.push(this.localeManager.addListener("locale-changed",t))}createProxyContainer(t){const e=allocateMeta(t),{params:i,result:s}=e,n=s.getElement();return this.domManager.addChild("canvas-proxy",i.domManagerId,n),n.classList.add(...i.classList,"ag-charts-proxy-container"),n.role=i.type,"ariaOrientation"in i&&(n.ariaOrientation=i.ariaOrientation),checkType("toolbar",e)&&(e.result.orientation=e.params.orientation),this.addLocalisation(()=>{n.ariaLabel=this.localeManager.t(i.ariaLabel.id,i.ariaLabel.params)}),s}createProxyElement(t){const e=allocateMeta(t);if(checkType("button",e)){const{params:i,result:s}=e,n=s.getElement();if(this.initInteract(i,s),typeof i.textContent=="string")n.textContent=i.textContent;else{const{textContent:r}=i;this.addLocalisation(()=>{n.textContent=this.localeManager.t(r.id,r.params)})}this.setParent(e.params,e.result)}if(checkType("slider",e)){const{params:i,result:s}=e,n=s.getElement();this.initInteract(i,s),n.type="range",n.role="presentation",n.style.margin="0px",this.addLocalisation(()=>{n.ariaLabel=this.localeManager.t(i.ariaLabel.id,i.ariaLabel.params)}),this.setParent(e.params,e.result)}if(checkType("text",e)){const{params:i,result:s}=e;this.initElement(i,s),this.setParent(e.params,e.result)}if(checkType("listswitch",e)){const{params:i,result:s}=e;this.initInteract(i,s),s.setTextContent(i.textContent),s.setChecked(i.ariaChecked),s.setAriaDescribedBy(i.ariaDescribedBy),this.setParent(e.params,e.result)}if(checkType("region",e)){const{params:i,result:s}=e,n=s.getElement();this.initInteract(i,s),n.role="region",this.setParent(e.params,e.result)}return e.result}initElement(t,e){const i=e.getElement();return setAttribute(i,"id",t.id),setElementStyle(i,"cursor",t.cursor),i.classList.toggle("ag-charts-proxy-elem",!0),i}initInteract(t,e){const{tabIndex:i,domIndex:s}=t,n=this.initElement(t,e);i!==void 0&&(n.tabIndex=i),s!==void 0&&(e.domIndex=s)}setParent(t,e){if("parent"in t)t.parent?.addChild(e);else{const i={where:t.where,query:".ag-charts-series-area"};this.domManager.addChild("canvas-proxy",t.domManagerId,e.getElement(),i)}}},AG_CHARTS_LOCALE_EN_US={ariaAnnounceHoverDatum:"${datum}",ariaAnnounceChart:"chart, ${seriesCount}[number] series",ariaAnnounceHierarchyChart:"hierarchy chart, ${caption}",ariaAnnounceGaugeChart:"gauge chart, ${caption}",ariaAnnounceHierarchyDatum:"level ${level}[number], ${count}[number] children, ${description}",ariaAnnounceFlowProportionLink:"link ${index} of ${count}, from ${from} to ${to}, ${sizeName} ${size}",ariaAnnounceFlowProportionNode:"node ${index} of ${count}, ${description}",ariaDescriptionLegendItem:"Press Space or Enter to toggle visibility",ariaLabelAddHorizontalLine:"Add Horizontal Line",ariaLabelAnnotationOptionsToolbar:"Annotation Options",ariaLabelAnnotationSettingsDialog:"Annotation Settings",ariaLabelColorPicker:"Color picker",ariaLabelFinancialCharts:"Financial Charts",ariaLabelLegend:"Legend",ariaLabelLegendPagination:"Legend Pagination",ariaLabelLegendPagePrevious:"Previous Legend Page",ariaLabelLegendPageNext:"Next Legend Page",ariaLabelLegendItem:"${label}, Legend item ${index}[number] of ${count}[number]",ariaLabelLegendItemUnknown:"Unknown legend item",ariaLabelNavigator:"Navigator",ariaLabelNavigatorRange:"Range",ariaLabelNavigatorMinimum:"Minimum",ariaLabelNavigatorMaximum:"Maximum",ariaLabelRangesToolbar:"Ranges",ariaLabelSettingsTabBar:"Settings",ariaLabelZoomToolbar:"Zoom",ariaValuePanRange:"${min}[percent] to ${max}[percent]",iconAltTextLineStyleSolid:"Solid",iconAltTextLineStyleDashed:"Long-dashed",iconAltTextLineStyleDotted:"Short-dashed",iconAltTextPositionTop:"Top",iconAltTextPositionCenter:"Center",iconAltTextPositionBottom:"Bottom",iconAltTextAlignLeft:"Left",iconAltTextAlignCenter:"Center",iconAltTextAlignRight:"Right",iconAltTextClose:"Close",overlayLoadingData:"Loading data...",overlayNoData:"No data to display",overlayNoVisibleSeries:"No visible series",overlayUnsupportedBrowser:"Incompatible browser version. Please upgrade your browser.",seriesHistogramTooltipFrequency:"Frequency",seriesHistogramTooltipSum:"${yName} (sum)",seriesHistogramTooltipCount:"${yName} (count)",seriesHistogramTooltipMean:"${yName} (mean)",toolbarSeriesTypeDropdown:"Chart Type",toolbarSeriesTypeOHLC:"OHLC",toolbarSeriesTypeHLC:"HLC",toolbarSeriesTypeHighLow:"High Low",toolbarSeriesTypeCandles:"Candles",toolbarSeriesTypeHollowCandles:"Hollow Candles",toolbarSeriesTypeLine:"Line",toolbarSeriesTypeLineWithMarkers:"Line with Markers",toolbarSeriesTypeStepLine:"Step Line",toolbarAnnotationsTrendLine:"Trend Line",toolbarAnnotationsFibonacciRetracement:"Fib Retracement",toolbarAnnotationsFibonacciRetracementTrendBased:"Fib Trend Based",toolbarAnnotationsHorizontalLine:"Horizontal Line",toolbarAnnotationsVerticalLine:"Vertical Line",toolbarAnnotationsParallelChannel:"Parallel Channel",toolbarAnnotationsDisjointChannel:"Disjoint Channel",toolbarAnnotationsClearAll:"Clear All",toolbarAnnotationsFillColor:"Fill Color",toolbarAnnotationsLineColor:"Line Color",toolbarAnnotationsLineStyle:"Line Style",toolbarAnnotationsLineStrokeWidth:"Line Stroke Width",toolbarAnnotationsSettings:"Settings",toolbarAnnotationsTextColor:"Text Color",toolbarAnnotationsTextSize:"Text Size",toolbarAnnotationsLock:"Lock",toolbarAnnotationsUnlock:"Unlock",toolbarAnnotationsDelete:"Delete",toolbarAnnotationsDragHandle:"Drag Toolbar",toolbarAnnotationsLineAnnotations:"Trend Lines",toolbarAnnotationsFibonacciAnnotations:"Fibonacci",toolbarAnnotationsTextAnnotations:"Text Annotations",toolbarAnnotationsShapeAnnotations:"Arrows",toolbarAnnotationsMeasurerAnnotations:"Measurers",toolbarAnnotationsCallout:"Callout",toolbarAnnotationsComment:"Comment",toolbarAnnotationsNote:"Note",toolbarAnnotationsText:"Text",toolbarAnnotationsArrow:"Arrow",toolbarAnnotationsArrowUp:"Arrow Up",toolbarAnnotationsArrowDown:"Arrow Down",toolbarAnnotationsDateRange:"Date Range",toolbarAnnotationsPriceRange:"Price Range",toolbarAnnotationsDatePriceRange:"Date and Price",toolbarAnnotationsQuickDatePriceRange:"Measure",toolbarRange1Month:"1M",toolbarRange1MonthAria:"1 month",toolbarRange3Months:"3M",toolbarRange3MonthsAria:"3 months",toolbarRange6Months:"6M",toolbarRange6MonthsAria:"6 months",toolbarRangeYearToDate:"YTD",toolbarRangeYearToDateAria:"Year to date",toolbarRange1Year:"1Y",toolbarRange1YearAria:"1 year",toolbarRangeAll:"All",toolbarRangeAllAria:"All",toolbarZoomZoomOut:"Zoom out",toolbarZoomZoomIn:"Zoom in",toolbarZoomPanLeft:"Pan left",toolbarZoomPanRight:"Pan right",toolbarZoomPanStart:"Pan to the start",toolbarZoomPanEnd:"Pan to the end",toolbarZoomReset:"Reset the zoom",contextMenuDownload:"Download",contextMenuToggleSeriesVisibility:"Toggle Visibility",contextMenuToggleOtherSeries:"Toggle Other Series",contextMenuZoomToCursor:"Zoom to here",contextMenuPanToCursor:"Pan to here",dialogHeaderChannel:"Channel",dialogHeaderLine:"Line",dialogHeaderFibonacciRange:"Fib Retracement",dialogHeaderDateRange:"Date Range",dialogHeaderPriceRange:"Price Range",dialogHeaderDatePriceRange:"Date and Price",dialogHeaderText:"Text",dialogInputAlign:"Align",dialogInputColorPicker:"Color",dialogInputColorPickerAltText:"Text Color",dialogInputFillColorPicker:"Fill",dialogInputFillColorPickerAltText:"Fill Color",dialogInputExtendChannelStart:"Extend channel start",dialogInputExtendChannelEnd:"Extend channel end",dialogInputExtendLineStart:"Extend line start",dialogInputExtendLineEnd:"Extend line end",dialogInputExtendAbove:"Extend above",dialogInputExtendBelow:"Extend below",dialogInputExtendLeft:"Extend left",dialogInputExtendRight:"Extend right",dialogInputReverse:"Reverse",dialogInputShowFill:"Show Fill",dialogInputFontSize:"Size",dialogInputFontSizeAltText:"Font Size",dialogInputLineStyle:"Dash",dialogInputPosition:"Position",dialogInputStrokeWidth:"Weight",dialogInputStrokeWidthAltText:"Line Weight",dialogInputFibonacciBands:"Bands",dialogInputFibonacciBandsAltText:"Fibonacci Bands",inputTextareaPlaceholder:"Add Text",measurerDateRangeBars:"${value}[number] bars",measurerPriceRangeValue:"${value}[number]",measurerPriceRangePercent:"${value}[percent]",measurerVolume:"Vol ${value}"},messageRegExp=/\$\{(\w+)}(?:\[(\w+)])?/gi,formatters={number:new Intl.NumberFormat("en-US"),percent:new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}),date:new Intl.DateTimeFormat("en-US",{dateStyle:"full"}),time:new Intl.DateTimeFormat("en-US",{timeStyle:"full"}),datetime:new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeStyle:"full"})},defaultMessageFormatter=({defaultValue:t,variables:e})=>t?.replaceAll(messageRegExp,(i,s,n)=>{const r=e[s],a=n!=null?formatters[n]:null;return n!=null&&a==null&&logger_exports.warnOnce(`Format style [${n}] is not supported`),a!=null?a.format(r):typeof r=="number"?formatters.number.format(r):r instanceof Date?formatters.datetime.format(r):String(r)}),LocaleManager=class extends Listeners{constructor(){super(...arguments),this.localeText=void 0,this.getLocaleText=void 0}setLocaleText(t){this.localeText!==t&&(this.localeText=t,this.dispatch("locale-changed"))}setLocaleTextFormatter(t){this.getLocaleText=t,this.getLocaleText!==t&&(this.getLocaleText=t,this.dispatch("locale-changed"))}t(t,e={}){const{localeText:i=AG_CHARTS_LOCALE_EN_US,getLocaleText:s}=this,n=i[t];return s?.({key:t,defaultValue:n,variables:e})??defaultMessageFormatter({key:t,defaultValue:n,variables:e})??t}},HdpiCanvas=class{constructor(t){this.enabled=!0,this.width=600,this.height=300;const{width:e,height:i,canvasElement:s,willReadFrequently:n=!1}=t;this.pixelRatio=t.pixelRatio??getWindow("devicePixelRatio")??1,this.element=s??createElement("canvas"),this.element.style.display="block",this.element.style.width=(e??this.width)+"px",this.element.style.height=(i??this.height)+"px",this.element.width=Math.round((e??this.width)*this.pixelRatio),this.element.height=Math.round((i??this.height)*this.pixelRatio),this.context=this.element.getContext("2d",{willReadFrequently:n}),this.onEnabledChange(),this.resize(e??0,i??0,this.pixelRatio),debugContext(this.context)}drawImage(t,e=0,i=0){return t.drawImage(this.context.canvas,e,i)}toDataURL(t){return this.element.toDataURL(t)}resize(t,e,i){if(!(t>0&&e>0))return;const{element:s,context:n}=this;s.width=Math.round(t*i),s.height=Math.round(e*i),n.setTransform(i,0,0,i,0,0),s.style.width=t+"px",s.style.height=e+"px",this.width=t,this.height=e,this.pixelRatio=i}clear(){clearContext(this)}destroy(){this.element.remove(),this.element.width=0,this.element.height=0,this.context.clearRect(0,0,0,0),Object.freeze(this)}onEnabledChange(){this.element&&(this.element.style.display=this.enabled?"":"none")}};__decorateClass([ObserveChanges(t=>t.onEnabledChange())],HdpiCanvas.prototype,"enabled",2);var LayersManager=class{constructor(t){this.canvas=t,this.debug=Debug.create(!0,"scene"),this.layersMap=new Map,this.nextLayerId=0}get size(){return this.layersMap.size}resize(t,e,i){this.canvas.resize(t,e,i),this.layersMap.forEach(({canvas:s})=>s.resize(t,e,i))}addLayer(t){const{width:e,height:i,pixelRatio:s}=this.canvas,{name:n}=t,r=new HdpiOffscreenCanvas({width:e,height:i,pixelRatio:s});return this.layersMap.set(r,{id:this.nextLayerId++,name:n,canvas:r}),this.debug("Scene.addLayer() - layers",this.layersMap),r}removeLayer(t){this.layersMap.has(t)&&(this.layersMap.delete(t),t.destroy(),this.debug("Scene.removeLayer() - layers",this.layersMap))}clear(){for(const t of this.layersMap.values())t.canvas.destroy();this.layersMap.clear()}};function formatBytes(t){for(const e of["B","KB","MB","GB"]){if(t<1536)return`${t.toFixed(1)}${e}`;t/=1024}return`${t.toFixed(1)}TB}`}function memoryUsage(){if(!("memory"in performance))return;const{totalJSHeapSize:t,usedJSHeapSize:e,jsHeapSizeLimit:i}=performance.memory,s=[];for(const n of[e,t,i])typeof n=="number"&&s.push(formatBytes(n));return`Heap ${s.join(" / ")}`}function debugStats(t,e,i,s,n={},r=BBox.zero){if(!Debug.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:a=0,layersSkipped:o=0,nodesRendered:c=0,nodesSkipped:l=0,opsPerformed:h=0,opsSkipped:u=0}=s??{},d=performance.now(),{start:g,...p}=e,f=Object.entries(p).map(([A,k])=>time(A,k)).filter(A=>A!=null).join(" + "),y=Object.entries(n).map(([A,k])=>`${A}: ${JSON.stringify(k)}`).join(" ; "),m=Debug.check("scene:stats:verbose"),x=memoryUsage(),b=[`${time("\u23F1\uFE0F",g,d)} (${f})`,`${y}`,`Layers: ${m?pct(a,o):t.size}`,m?`Nodes: ${pct(c,l)}`:null,m?`Ops: ${pct(h,u)}`:null,m&&x?x:null].filter(isString),v=new SimpleTextMeasurer(A=>i.measureText(A)),I=new Map(b.map(A=>[A,v.measureLines(A)])),S=Math.max(...Array.from(I.values(),A=>A.width)),D=accumulate(I.values(),A=>A.height),w=2+r.x;i.save(),i.fillStyle="white",i.fillRect(w,0,S,D),i.fillStyle="black";let L=0;for(const[A,k]of I.entries())L+=k.height,i.fillText(A,w,L);i.restore()}function prepareSceneNodeHighlight(t){const e=toArray(getWindow("agChartsSceneDebug")),i=[];for(const s of e)s==="layout"?i.push("seriesRoot","legend","root",/.*Axis-\d+-axis.*/):i.push(s);t.debugNodeSearch=i}function debugSceneNodeHighlight(t,e){t.save();for(const[i,s]of Object.entries(e)){const n=Transformable.toCanvas(s);if(!n){logger_exports.log(`Scene.render() - no bbox for debugged node [${i}].`);continue}t.globalAlpha=.8,t.strokeStyle="red",t.lineWidth=1,t.strokeRect(n.x,n.y,n.width,n.height),t.fillStyle="red",t.strokeStyle="white",t.font="16px sans-serif",t.textBaseline="top",t.textAlign="left",t.lineWidth=2,t.strokeText(i,n.x,n.y,n.width),t.fillText(i,n.x,n.y,n.width)}t.restore()}var skippedProperties=new Set,allowedProperties=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function nodeProps(t){const{...e}=t;for(const i of Object.keys(e))allowedProperties.has(i)||typeof e[i]!="number"&&typeof e[i]!="string"&&typeof e[i]!="boolean"&&(skippedProperties.add(i),delete e[i]);return e}function buildTree(t,e){if(!Debug.check(!0,"scene"))return{};let i=0;return{node:e==="json"?nodeProps(t):t,name:t.name??t.id,dirty:t.dirty,...Array.from(t.children(),s=>buildTree(s,e)).reduce((s,n)=>{let{name:r}=n;const{node:{visible:a,opacity:o,zIndex:c,translationX:l,translationY:h,rotation:u,scalingX:d,scalingY:g},node:p}=n;(!a||o<=0)&&(r=`(${r})`),Group.is(p)&&p.renderToOffscreenCanvas&&(r=`*${r}*`);const f=Array.isArray(c)?`(${c.join(", ")})`:c,y=[`${(i++).toString().padStart(3,"0")}|`,`${r??""}`,`z: ${f}`,l&&`x: ${l}`,h&&`y: ${h}`,u&&`r: ${u}`,d!=null&&d!==1&&`sx: ${d}`,g!=null&&g!==1&&`sy: ${g}`].filter(b=>!!b).join(" ");let m=y,x=1;for(;s[m]!=null&&x<100;)m=`${y} (${x++})`;return s[m]=n,s},{})}}function buildDirtyTree(t){if(!t.dirty)return{dirtyTree:{},paths:[]};const e=Array.from(t.children(),n=>buildDirtyTree(n)).filter(n=>n.paths.length>0),i=Group.is(t)?t.name??t.id:t.id,s=e.length?e.flatMap(n=>n.paths).map(n=>`${i}.${n}`):[i];return{dirtyTree:{name:i,node:t,dirty:t.dirty,...e.map(n=>n.dirtyTree).filter(n=>n.dirty!=null).reduce((n,r)=>(n[r.name??""]=r,n),{})},paths:s}}function pct(t,e){const i=t+e;return`${t} / ${i} (${Math.round(100*t/i)}%)`}function time(t,e,i){const s=i!=null?i-e:e;return`${t}: ${Math.round(s*100)/100}ms`}function accumulate(t,e){let i=0;for(const s of t)i+=e(s);return i}var Scene=class{constructor(t){this.debug=Debug.create(!0,"scene"),this.id=createId(this),this.root=null,this.pendingSize=null,this.isDirty=!1,this.canvas=new HdpiCanvas(t),this.layersManager=new LayersManager(this.canvas)}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}setContainer(t){const{element:e}=this.canvas;return e.parentElement?.removeChild(e),t.appendChild(e),this}setRoot(t){return this.root===t?this:(this.isDirty=!0,this.root?._setLayerManager(),this.root=t,t&&(t.visible=!0,t._setLayerManager(this.layersManager)),this)}clear(){this.canvas.clear()}attachNode(t){return this.appendChild(t),()=>this.removeChild(t)}appendChild(t){return this.root?.appendChild(t),this}removeChild(t){return this.root?.removeChild(t),this}download(t,e){downloadUrl(this.canvas.toDataURL(e),t?.trim()??"image")}getDataURL(t){return this.canvas.toDataURL(t)}resize(t,e,i){return t=Math.round(t),e=Math.round(e),i??(i=this.pixelRatio),t>0&&e>0&&(t!==this.width||e!==this.height||i!==this.pixelRatio)?(this.pendingSize=[t,e,i],this.isDirty=!0,!0):!1}render(t){const{debugSplitTimes:e={start:performance.now()},extraDebugStats:i,seriesRect:s}=t??{},{canvas:n,canvas:{context:r}={},root:a,pendingSize:o,width:c,height:l,pixelRatio:h}=this;if(!r)return;const u=performance.now();if(o&&(this.layersManager.resize(...o),this.pendingSize=null),a&&!a.visible){this.isDirty=!1;return}if(a?.dirty===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:buildTree(a,"console")}),debugStats(this.layersManager,e,r,void 0,i,s);return}const d={ctx:r,width:c,height:l,devicePixelRatio:h,debugNodes:{}};Debug.check("scene:stats:verbose")&&(d.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),prepareSceneNodeHighlight(d);let g=!1;if(a?.dirty!==!1&&(g=!0,n.clear()),a&&Debug.check("scene:dirtyTree")){const{dirtyTree:p,paths:f}=buildDirtyTree(a);Debug.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:p,paths:f})}if(a&&g){if(a.visible&&a.preRender(d),this.debug.check()){const p=buildTree(a,"console");this.debug("Scene.render() - before",{canvasCleared:g,tree:p})}a.visible&&(r.save(),a.render(d),r.restore())}e["\u270D\uFE0F"]=performance.now()-u,r.verifyDepthZero?.(),this.isDirty=!1,debugStats(this.layersManager,e,r,d.stats,i,s),debugSceneNodeHighlight(r,d.debugNodes),a&&this.debug.check()&&this.debug("Scene.render() - after",{tree:buildTree(a,"console"),canvasCleared:g})}toSVG(){const{root:t,width:e,height:i}=this;if(t!=null)return Node.toSVG(t,e,i)}strip(){const{context:t,pixelRatio:e}=this.canvas;t.setTransform(e,0,0,e,0,0),this.layersManager.clear(),this.setRoot(null),this.isDirty=!1}destroy(){this.strip(),this.canvas.destroy(),Object.assign(this,{canvas:void 0})}};Scene.className="Scene";var CallbackCache=class{constructor(){this.cache=new WeakMap}call(t,...e){let i,s=this.cache.get(t);try{i=JSON.stringify(e)}catch{return this.invoke(t,e,s)}return s==null&&(s=new Map,this.cache.set(t,s)),s.has(i)?s.get(i):this.invoke(t,e,s,i)}invoke(t,e,i,s){try{const n=t(...e);return i&&s!=null&&i.set(s,n),n}catch(n){logger_exports.warnOnce("User callback errored, ignoring",n);return}}invalidateCache(){this.cache=new WeakMap}},AnnotationManager=class extends BaseManager{constructor(t){super(),this.annotationRoot=t,this.mementoOriginatorKey="annotations",this.annotations=[]}createMemento(){return this.annotations}guardMemento(t){return t==null||isArray(t)}restoreMemento(t,e,i){this.annotations=this.cleanData(i??[]).map(s=>{const n=this.getAnnotationTypeStyles(s.type);return mergeDefaults(s,n)}),this.listeners.dispatch("restore-annotations",{type:"restore-annotations",annotations:this.annotations})}updateData(t){this.annotations=this.cleanData(t??[])}attachNode(t){return this.annotationRoot.append(t),()=>(this.annotationRoot?.removeChild(t),this)}setAnnotationStyles(t){this.styles=t}getAnnotationTypeStyles(t){return this.styles?.[t]}cleanData(t){for(const e of t)"textAlign"in e&&delete e.textAlign;return t}},AxisManager=class{constructor(t){this.sceneRoot=t,this.axes=new Map,this.axisGridGroup=new Group({name:"Axes-Grids",zIndex:1}),this.axisGroup=new Group({name:"Axes",zIndex:2}),this.axisLabelGroup=new Group({name:"Axes-Labels",zIndex:13}),this.axisCrosslineRangeGroup=new Group({name:"Axes-Crosslines-Range",zIndex:4}),this.axisCrosslineLineGroup=new Group({name:"Axes-Crosslines-Line",zIndex:8}),this.axisCrosslineLabelGroup=new Group({name:"Axes-Crosslines-Label",zIndex:13}),this.sceneRoot.appendChild(this.axisGroup),this.sceneRoot.appendChild(this.axisGridGroup),this.sceneRoot.appendChild(this.axisLabelGroup),this.sceneRoot.appendChild(this.axisCrosslineRangeGroup),this.sceneRoot.appendChild(this.axisCrosslineLineGroup),this.sceneRoot.appendChild(this.axisCrosslineLabelGroup)}updateAxes(t,e){const i={axisNode:this.axisGroup,gridNode:this.axisGridGroup,labelNode:this.axisLabelGroup,crossLineRangeNode:this.axisCrosslineRangeGroup,crossLineLineNode:this.axisCrosslineLineGroup,crossLineLabelNode:this.axisCrosslineLabelGroup};for(const s of t)e.includes(s)||(s.detachAxis(i),s.destroy());for(const s of e)t?.includes(s)||s.attachAxis(i);this.axes.clear();for(const s of e){const n=s.createAxisContext();this.axes.has(n.direction)?this.axes.get(n.direction)?.push(n):this.axes.set(n.direction,[n])}}getAxisContext(t){return this.axes.get(t)??[]}destroy(){this.axes.clear(),this.sceneRoot.removeChild(this.axisGroup),this.sceneRoot.removeChild(this.axisGridGroup)}},DataService=class extends Listeners{constructor(t){super(),this.animationManager=t,this.dispatchOnlyLatest=!0,this.dispatchThrottle=0,this.requestThrottle=300,this.isLoadingInitialData=!1,this.isLoadingData=!1,this.freshRequests=[],this.requestCounter=0,this.debug=Debug.create(!0,"data-model","data-source"),this.throttledFetch=this.createThrottledFetch(this.requestThrottle),this.throttledDispatch=this.createThrottledDispatch(this.dispatchThrottle)}updateCallback(t){typeof t=="function"&&(this.debug("DataService - updated data source callback"),this.dataSourceCallback=t,this.isLoadingInitialData=!0,this.animationManager.skip(),this.dispatch("data-source-change"))}clearCallback(){this.dataSourceCallback=void 0}load(t){this.isLoadingData=!0,this.throttledFetch(t)}isLazy(){return this.dataSourceCallback!=null}isLoading(){return this.isLazy()&&(this.isLoadingInitialData||this.isLoadingData)}createThrottledFetch(t){return throttle(e=>this.fetch(e).catch(i=>logger_exports.error("callback failed",i)),t,{leading:!1,trailing:!0})}createThrottledDispatch(t){return throttle((e,i)=>{this.debug(`DataService - dispatching 'data-load' | ${e}`),this.dispatch("data-load",{type:"data-load",data:i})},t,{leading:!0,trailing:!0})}async fetch(t){if(!this.dataSourceCallback)throw new Error("DataService - [dataSource.getData] callback not initialised");const e=performance.now(),i=this.requestCounter++;this.debug(`DataService - requesting | ${i}`),this.freshRequests.push(i);let s;try{s=await this.dataSourceCallback(t),this.debug(`DataService - response | ${performance.now()-e}ms | ${i}`)}catch(r){this.debug(`DataService - request failed | ${i}`),logger_exports.errorOnce(`DataService - request failed | [${r}]`)}this.isLoadingInitialData=!1;const n=this.freshRequests.findIndex(r=>r===i);if(n===-1||this.dispatchOnlyLatest&&n!==this.freshRequests.length-1){this.debug(`DataService - discarding stale request | ${i}`);return}this.freshRequests=this.freshRequests.slice(n+1),this.freshRequests.length===0&&(this.isLoadingData=!1),Array.isArray(s)?this.throttledDispatch(i,s):this.dispatch("data-error")}};__decorateClass([ActionOnSet({newValue(t){this.throttledDispatch=this.createThrottledDispatch(t)}})],DataService.prototype,"dispatchThrottle",2),__decorateClass([ActionOnSet({newValue(t){this.throttledFetch=this.createThrottledFetch(t)}})],DataService.prototype,"requestThrottle",2);var AnimationBatch=class{constructor(t){this.maxAnimationTime=t,this.debug=Debug.create(!0,"animation"),this.controllers=new Map,this.stoppedCbs=new Set,this.currentPhase=0,this.phases=new Map(PHASE_ORDER.map(e=>[e,[]])),this.skipAnimations=!1,this.animationTimeConsumed=0,this.isReady=!1}get size(){return this.controllers.size}get consumedTimeMs(){return this.animationTimeConsumed}isActive(){return this.controllers.size>0}getActiveControllers(){return this.phases.get(PHASE_ORDER[this.currentPhase])??[]}checkOverlappingId(t){t!=null&&this.controllers.has(t)&&(this.controllers.get(t).stop(),this.debug(`Skipping animation batch due to update of existing animation: ${t}`),this.skip())}addAnimation(t){if(t.isComplete)return;if(PHASE_ORDER.indexOf(t.phase)=0&&e?.splice(i,1)}progress(t){if(!this.isReady)return;let e=t===0?.01:t;const i=()=>{const l=PHASE_ORDER[this.currentPhase];return{phaseControllers:[...this.getActiveControllers()],phase:l,phaseMeta:PHASE_METADATA[l]}};let{phase:s,phaseControllers:n,phaseMeta:r}=i();const a=()=>PHASE_ORDER[this.currentPhase]==null,o=()=>{for({phase:s,phaseControllers:n,phaseMeta:r}=i();!a()&&n.length===0;)this.currentPhase++,{phase:s,phaseControllers:n,phaseMeta:r}=i(),this.debug(`AnimationBatch - phase changing to ${s}`,{unusedTime:e},n)},c=this.controllers.size;this.debug(`AnimationBatch - ${t}ms; phase ${s} with ${n?.length} of ${c}`);do{const l=e,h=r.skipIfNoEarlierAnimations&&this.animationTimeConsumed===0;let u=0;for(const d of n)h?d.stop():e=Math.min(d.update(l),e),d.isComplete&&(u++,this.removeAnimation(d));this.animationTimeConsumed+=l-e,this.debug(`AnimationBatch - updated ${n.length} controllers; ${u} completed`),this.debug(`AnimationBatch - animationTimeConsumed: ${this.animationTimeConsumed}`),o()}while(e>0&&!a());this.animationTimeConsumed>this.maxAnimationTime&&(this.debug("Animation batch exceeded max animation time, skipping",[...this.controllers]),this.stop())}ready(){if(this.isReady)return;this.isReady=!0,this.debug(`AnimationBatch - ready; skipped: ${this.skipAnimations}`,[...this.controllers]);let t=!0;for(const[,e]of this.controllers)if(e.duration>0&&PHASE_METADATA[e.phase].skipIfNoEarlierAnimations!==!0){t=!1;break}if(!t)for(const[,e]of this.controllers)e.autoplay&&e.play(!0)}skip(t=!0){if(this.skipAnimations===!1&&t===!0){for(const e of this.controllers.values())e.stop();this.controllers.clear()}this.skipAnimations=t}play(){for(const t of this.controllers.values())t.play()}stop(){for(const t of this.controllers.values())try{t.stop(),this.removeAnimation(t)}catch(e){logger_exports.error("Error during animation stop",e)}this.dispatchStopped()}stopByAnimationId(t){if(t!=null&&this.controllers.has(t)){const e=this.controllers.get(t);e&&(e.stop(),this.removeAnimation(e))}}stopByAnimationGroupId(t){for(const e of this.controllers.values())e.groupId===t&&this.stopByAnimationId(e.id)}dispatchStopped(){this.stoppedCbs.forEach(t=>t()),this.stoppedCbs.clear()}isSkipped(){return this.skipAnimations}destroy(){this.stop(),this.controllers.clear()}},InteractionManager=class{constructor(){this.stateQueue=34}pushState(t){this.stateQueue|=t}popState(t){this.stateQueue&=~t}isState(t){return!!(this.stateQueue&-this.stateQueue&t)}};function validAnimationDuration(t){return t==null?!0:!isNaN(t)&&t>=0&&t<=2}var AnimationManager=class{constructor(t,e){this.interactionManager=t,this.chartUpdateMutex=e,this.defaultDuration=1e3,this.batch=new AnimationBatch(this.defaultDuration*1.5),this.debug=Debug.create(!0,"animation"),this.events=new EventEmitter,this.rafAvailable=typeof requestAnimationFrame<"u",this.isPlaying=!0,this.requestId=null,this.skipAnimations=!0,this.currentAnonymousAnimationId=0}addListener(t,e){return this.events.on(t,e)}animate(t){const e=this.batch;try{e.checkOverlappingId(t.id)}catch(o){this.failsafeOnError(o);return}let{id:i}=t;i==null&&(i=`__${this.currentAnonymousAnimationId}`,this.currentAnonymousAnimationId+=1);const s=this.isSkipped()||t.phase==="none";s&&this.debug("AnimationManager - skipping animation");const{delay:n,duration:r}=t;if(!validAnimationDuration(n))throw new Error(`Animation delay of ${n} is unsupported (${i})`);if(!validAnimationDuration(r))throw new Error(`Animation duration of ${r} is unsupported (${i})`);const a=new Animation({...t,id:i,skip:s,autoplay:this.isPlaying?t.autoplay:!1,phase:t.phase,defaultDuration:this.defaultDuration});if(!this.forceTimeJump(a,this.defaultDuration))return this.batch.addAnimation(a),a}play(){if(!this.isPlaying){this.isPlaying=!0,this.debug("AnimationManager.play()");try{this.batch.play()}catch(t){this.failsafeOnError(t)}this.requestAnimation()}}stop(){this.isPlaying=!1,this.cancelAnimation(),this.debug("AnimationManager.stop()"),this.batch.stop()}stopByAnimationId(t){try{this.batch.stopByAnimationId(t)}catch(e){this.failsafeOnError(e)}}stopByAnimationGroupId(t){try{this.batch.stopByAnimationGroupId(t)}catch(e){this.failsafeOnError(e)}}reset(){this.isPlaying?(this.stop(),this.play()):this.stop()}skip(t=!0){this.skipAnimations=t}isSkipped(){return!this.rafAvailable||this.skipAnimations||this.batch.isSkipped()}isActive(){return this.isPlaying&&this.batch.isActive()}skipCurrentBatch(){this.debug.check()&&this.debug("AnimationManager - skipCurrentBatch()",{stack:new Error().stack}),this.batch.skip()}isSkippingFrames(){return!0}scheduleAnimationFrame(t){this.requestId=getWindow().requestAnimationFrame(e=>{t(e).catch(i=>logger_exports.error(i))})}forceTimeJump(t,e){return!1}requestAnimation(){if(!this.rafAvailable||!this.batch.isActive()||this.requestId!==null)return;let t;const e=async i=>{const s=()=>{const n=i-(t??i);t=i,this.debug("AnimationManager - onAnimationFrame()",{controllersCount:this.batch.size,deltaTime:n}),this.interactionManager.pushState(2);try{this.batch.progress(n)}catch(r){this.failsafeOnError(r)}this.events.emit("animation-frame",{type:"animation-frame",deltaMs:n})};this.isSkippingFrames()?await this.chartUpdateMutex.acquireImmediately(s):await this.chartUpdateMutex.acquire(s),this.batch.isActive()?this.scheduleAnimationFrame(e):(this.batch.stop(),this.events.emit("animation-stop",{type:"animation-stop",deltaMs:this.batch.consumedTimeMs}))};this.events.emit("animation-start",{type:"animation-start",deltaMs:0}),this.scheduleAnimationFrame(e)}cancelAnimation(){this.requestId!==null&&(cancelAnimationFrame(this.requestId),this.requestId=null,this.startBatch())}failsafeOnError(t,e=!0){logger_exports.error("Error during animation, skipping animations",t),e&&this.cancelAnimation()}startBatch(t){this.debug(`AnimationManager - startBatch() with skipAnimations=${t}.`),this.reset(),this.batch.destroy(),this.batch=new AnimationBatch(this.defaultDuration*1.5),t===!0&&this.batch.skip()}endBatch(){this.batch.isActive()?(this.batch.ready(),this.requestAnimation()):(this.interactionManager.popState(2),this.batch.isSkipped()&&this.batch.skip(!1))}onBatchStop(t){this.batch.stoppedCbs.add(t)}destroy(){this.stop(),this.events.clear()}},ChartEventManager=class extends BaseManager{seriesEvent(t){this.listeners.dispatch(t,{type:t})}seriesKeyNavZoom(t,e){const i={type:"series-keynav-zoom",delta:t,widgetEvent:e};this.listeners.dispatch("series-keynav-zoom",i)}legendItemClick(t,e,i,s,n){const r={type:"legend-item-click",legendType:t,series:e,itemId:i,enabled:s,legendItemName:n};this.listeners.dispatch("legend-item-click",r)}legendItemDoubleClick(t,e,i,s,n,r){const a={type:"legend-item-double-click",legendType:t,series:e,itemId:i,enabled:s,legendItemName:r,numVisibleItems:n};this.listeners.dispatch("legend-item-double-click",a)}},ContextMenuRegistry=class{constructor(){this.defaultActions=[],this.disabledActions=new Set,this.hiddenActions=new Set,this.listeners=new Listeners}static check(t,e){return e.type===t}static checkCallback(t,e,i){return t===e}dispatchContext(t,e,i,s){const{sourceEvent:n}=e,r=s?.x??e.canvasX,a=s?.y??e.canvasY;n.stopPropagation();const o={type:t,x:r,y:a,context:i,sourceEvent:n};this.listeners.dispatch("",o)}addListener(t){return this.listeners.addListener("",t)}filterActions(t){return this.defaultActions.filter(e=>e.id!=null&&!this.hiddenActions.has(e.id)&&["all",t].includes(e.type))}registerDefaultAction(t){const e=t.id!=null&&!this.defaultActions.some(({id:i})=>i===t.id);return e&&this.defaultActions.push(t),()=>{const i=e?this.defaultActions.findIndex(({id:s})=>s===t.id):-1;i!==-1&&this.defaultActions.splice(i,1)}}enableAction(t){this.disabledActions.delete(t)}disableAction(t){this.disabledActions.add(t)}showAction(t){this.hiddenActions.add(t)}hideAction(t){this.hiddenActions.delete(t)}isDisabled(t){return this.disabledActions.has(t)}},HighlightManager=class extends BaseManager{constructor(){super(...arguments),this.highlightStates=new StateTracker}updateHighlight(t,e){const{activeHighlight:i}=this;this.highlightStates.set(t,e),this.activeHighlight=this.highlightStates.stateValue(),this.isEqual(this.activeHighlight,i)||this.listeners.dispatch("highlight-change",{type:"highlight-change",currentHighlight:this.activeHighlight,previousHighlight:i,callerId:t})}getActiveHighlight(){return this.activeHighlight}isEqual(t,e){return t===e||t!=null&&e!=null&&t?.series===e?.series&&t?.itemId===e?.itemId&&t?.datum===e?.datum}};function visibleRangeIndices(t,[e,i],s){const n=findMinIndex(0,t-1,a=>{const o=s(a)?.[1]??NaN;return!Number.isFinite(o)||o>e})??0;let r=findMaxIndex(0,t-1,a=>{const o=s(a)?.[0]??NaN;return!Number.isFinite(o)||o=0&&(o+=1),c&&o<0&&(o-=1),le){c=!0;continue}n(l)&&(a+=1)}return a}var TooltipManager=class{constructor(t,e){this.domManager=t,this.tooltip=e,this.stateTracker=new StateTracker,this.suppressState=new StateTracker(!1),this.appliedState=null,e.setup(t),t.addListener("hidden",()=>this.tooltip.hide())}updateTooltip(t,e,i){this.tooltip.enabled&&(i??(i=this.stateTracker.get(t)?.content),this.stateTracker.set(t,{content:i,meta:e}),this.applyStates())}removeTooltip(t){this.tooltip.enabled&&(this.stateTracker.delete(t),this.applyStates())}suppressTooltip(t){this.suppressState.set(t,!0)}unsuppressTooltip(t){this.suppressState.delete(t)}destroy(){this.domManager.removeStyles("tooltip")}applyStates(){const t=this.stateTracker.stateId(),e=t?this.stateTracker.get(t):null;if(this.suppressState.stateValue()||e?.meta==null||e?.content==null){this.appliedState=null,this.tooltip.hide();return}const i=this.domManager.getBoundingClientRect(),s=this.tooltip.bounds==="extended"?this.domManager.getOverlayClientRect():i;if(this.appliedState?.content===e?.content){const n=this.tooltip.isVisible();this.tooltip.show(s,i,e?.meta,null,n)}else this.tooltip.show(s,i,e?.meta,e?.content);this.appliedState=e}static makeTooltipMeta(t,e,i){const{canvasX:s,canvasY:n}=t,r=e.properties.tooltip,a={canvasX:s,canvasY:n,enableInteraction:r.interaction?.enabled??!1,lastPointerEvent:{type:t.type,canvasX:s,canvasY:n},showArrow:r.showArrow,position:{type:r.position.type,xOffset:r.position.xOffset,yOffset:r.position.yOffset}},o=getDatumRefPoint(e,i);return(r.position.type==="node"||r.position.type==="sparkline")&&o?{...a,canvasX:o.canvasX,canvasY:o.canvasY}:a}isEnteringInteractiveTooltip(t){const{tooltip:e}=this,i=t.sourceEvent.relatedTarget;return e.interactive&&e.enabled&&e.isVisible()&&e.contains(i)}},DRAG_THRESHOLD_PX=3,DOUBLE_TAP_TIMER_MS=505;function makeSynthetic(t,e,i){const{offsetX:s,offsetY:n,clientX:r,clientY:a,currentX:o,currentY:c,sourceEvent:l}=i;return{type:e,device:t,offsetX:s,offsetY:n,clientX:r,clientY:a,currentX:o,currentY:c,sourceEvent:l}}function checkDistanceSquared(t,e){const i=t*t+e*e,s=DRAG_THRESHOLD_PX*DRAG_THRESHOLD_PX;return i>=s}var DragInterpreter=class{constructor(t){this.destroyFns=[],this.listeners=new Listeners,this.isDragging=!1,this.touch={distanceTravelledX:0,distanceTravelledY:0,clientX:0,clientY:0},this.destroyFns.push(t.addListener("touchstart",this.onTouchStart.bind(this)),t.addListener("touchmove",this.onTouchMove.bind(this)),t.addListener("touchend",this.onTouchEnd.bind(this)),t.addListener("mousemove",this.onMouseMove.bind(this)),t.addListener("dblclick",this.onDblClick.bind(this)),t.addListener("drag-start",this.onDragStart.bind(this)),t.addListener("drag-move",this.onDragMove.bind(this)),t.addListener("drag-end",this.onDragEnd.bind(this)))}destroy(){this.destroyFns.forEach(t=>t()),this.listeners.destroy()}addListener(t,e){return this.listeners.addListener(t,e)}dispatch(t){this.listeners.dispatch(t.type,t)}onTouchStart(t){const{clientX:e,clientY:i}=t.sourceEvent.targetTouches.item(0)??{clientX:1/0,clientY:1/0};this.touch.distanceTravelledX=0,this.touch.distanceTravelledY=0,this.touch.clientX=e,this.touch.clientY=i}onTouchMove(t){const{clientX:e,clientY:i}=t.sourceEvent.targetTouches.item(0)??{clientX:1/0,clientY:1/0};this.touch.distanceTravelledX+=Math.abs(this.touch.clientX-e),this.touch.distanceTravelledY+=Math.abs(this.touch.clientY-i),this.touch.clientX=e,this.touch.clientY=i}onTouchEnd(t){t.sourceEvent.preventDefault()}onMouseMove(t){this.dispatch(t)}onDblClick(t){this.dispatch({device:"mouse",...t})}onDragStart(t){this.dragStartEvent=t}onDragMove(t){this.dragStartEvent!=null&&checkDistanceSquared(t.originDeltaX,t.originDeltaY)&&(this.dispatch(this.dragStartEvent),this.dispatch({...this.dragStartEvent,type:"drag-move"}),this.dragStartEvent=void 0,this.isDragging=!0),this.isDragging&&this.dispatch(t)}onDragEnd(t){if(this.isDragging){this.dispatch(t),this.isDragging=!1;return}if(t.device==="mouse"){const e=makeSynthetic("mouse","click",t);this.dispatch(e)}else if(t.sourceEvent.type==="touchend"){if(checkDistanceSquared(this.touch.distanceTravelledX,this.touch.distanceTravelledY))return;const e=makeSynthetic("touch","click",t);this.dispatch(e);const i=Date.now();if(this.lastClickTime!==void 0&&i-this.lastClickTime<=DOUBLE_TAP_TIMER_MS){const s=makeSynthetic(t.device,"dblclick",t);this.dispatch(s),this.lastClickTime=void 0}else this.lastClickTime=i}}},DOMManagerWidget=class extends NativeWidget{constructor(t){super(t)}addChildToDOM(){}removeChildFromDOM(){}},WidgetSet=class{constructor(t){this.seriesWidget=new DOMManagerWidget(t.getParent("series-area")),this.chartWidget=new DOMManagerWidget(t.getParent("canvas-proxy")),this.containerWidget=new DOMManagerWidget(t.getParent("canvas-container")),this.containerWidget.addChild(this.chartWidget),this.chartWidget.addChild(this.seriesWidget),this.seriesDragInterpreter=new DragInterpreter(this.seriesWidget)}destroy(){this.seriesDragInterpreter.destroy(),this.seriesWidget.destroy(),this.chartWidget.destroy(),this.containerWidget.destroy()}},Vec4={bottomCenter,center,clone,collides,end,from,height,round,start,topCenter,origin,width};function start(t){return{x:t.x1,y:t.y1}}function end(t){return{x:t.x2,y:t.y2}}function topCenter(t){return{x:(t.x1+t.x2)/2,y:Math.min(t.y1,t.y2)}}function center(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function bottomCenter(t){return{x:(t.x1+t.x2)/2,y:Math.max(t.y1,t.y2)}}function width(t){return Math.abs(t.x2-t.x1)}function height(t){return Math.abs(t.y2-t.y1)}function round(t){return{x1:Math.round(t.x1),y1:Math.round(t.y1),x2:Math.round(t.x2),y2:Math.round(t.y2)}}function clone(t){return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}function collides(t,e){const i=normalise(t),s=normalise(e);return i.x1<=s.x2&&i.x2>=s.x1&&i.y1<=s.y2&&i.y2>=s.y1}function normalise(t){return{x1:Math.min(t.x1,t.x2),x2:Math.max(t.x1,t.x2),y1:Math.min(t.y1,t.y2),y2:Math.max(t.y1,t.y2)}}function from(t,e,i,s){if(typeof t=="number")return{x1:t,y1:e,x2:i,y2:s};if("width"in t)return{x1:t.x,y1:t.y,x2:t.x+t.width,y2:t.y+t.height};throw new Error(`Values can not be converted into a vector4: [${JSON.stringify(t)}] [${e}] [${i}] [${s}]`)}function origin(){return{x1:0,y1:0,x2:0,y2:0}}function normalize2(t,e,i,s,n){return e+(s-e)*((n-t)/(i-t))}function unnormalize(t,e,i,s,n){return t+(n-e)*((i-t)/(s-e))}function calcWorldAxis(t,e,i){return[unnormalize(t,i.min,e,i.max,0),unnormalize(t,i.min,e,i.max,1)]}function calcWorldVec4(t,e,i){const[s,n]=calcWorldAxis(t.x1,t.x2,e),[r,a]=calcWorldAxis(t.y1,t.y2,i);return{x1:s,x2:n,y1:r,y2:a}}function panAxesUnnormalized(t,e,i,s,n,r){if(i<=n&&r<=s)return i;const a=n-i,o=r-s,c=Math.abs(a)attachDescription((e,i)=>!ContinuousScale.is(t?.scale)&&!OrdinalTimeScale.is(t?.scale)||e==null||i.end==null?!0:e<=i.end,"to be less than end"),ZoomManager=class extends BaseManager{constructor(t,e){super(),this.fireChartEvent=t,this.mementoOriginatorKey="zoom",this.axisZoomManagers=new Map,this.state=new StateTracker(void 0,"initial"),this.axes=[],this.didLayoutAxes=!1,this.autoScaleYAxis=new ZoomManagerAutoScaleAxis,this.lastRestoredState=void 0,this.independentAxes=!1,this.navigatorModule=!1,this.zoomModule=!1,this.pendingMemento=void 0,this.destroyFns.push(e.addListener("layout:complete",()=>{const{pendingMemento:i}=this,s=!this.didLayoutAxes;this.didLayoutAxes=!0,i?this.restoreMemento(i.version,i.mementoVersion,i.memento):s&&this.autoScaleYZoom("zoom-manager")}))}createMemento(){return this.getMementoRanges()}guardMemento(t,e){if(t==null)return!0;if(!isObject(t))return!1;for(const a of Object.keys(t))if(!expectedMementoKeys.includes(a))return!1;const i=this.getPrimaryAxis("x"),s=this.getPrimaryAxis("y"),n={rangeX:{start:and(or(number,date),rangeValidator(i)),end:or(number,date)},rangeY:{start:and(or(number,date),rangeValidator(s)),end:or(number,date)},ratioX:{start:and(ratio,lessThan("end")),end:ratio},ratioY:{start:and(ratio,lessThan("end")),end:ratio},autoScaledAxes:arrayOf(union("y"))},r=validate(t,n);return r.errors.length>0?(e.push(...r.errors.map(a=>a.message)),!1):!0}restoreMemento(t,e,i){const{independentAxes:s}=this;if(!this.axes||!this.didLayoutAxes){this.pendingMemento={version:t,mementoVersion:e,memento:i};return}this.pendingMemento=void 0;const n=this.getDefinedZoom();if(i?.rangeX?n.x=this.rangeToRatio(i.rangeX,"x")??{min:0,max:1}:i?.ratioX?n.x={min:i.ratioX.start??0,max:i.ratioX.end??1}:n.x={min:0,max:1},!this.navigatorModule||this.zoomModule){let o=i?.autoScaledAxes?.includes("y");i?.rangeY?(n.y=this.rangeToRatio(i.rangeY,"y")??{min:0,max:1},o??(o=!1)):i?.ratioY?(n.y={min:i.ratioY.start??0,max:i.ratioY.end??1},o??(o=!1)):(n.y={min:0,max:1},o??(o=!0)),n.autoScaleYAxis=o}if(this.lastRestoredState=n,s!==!0){this.updateZoom("zoom-manager",n);return}const r=this.getPrimaryAxis("x"),a=this.getPrimaryAxis("y");for(const o of[r,a])o&&this.updateAxisZoom("zoom-manager",o.id,n[o.direction])}updateAxes(t){this.axes=t;const e=new Map(t.map(i=>[i.id,this.axisZoomManagers.get(i.id)]));this.axisZoomManagers.clear();for(const i of t)this.axisZoomManagers.set(i.id,e.get(i.id)??new AxisZoomManager(i));this.state.size>0&&t.length>0&&this.updateZoom(this.state.stateId(),this.state.stateValue())}setIndependentAxes(t=!0){this.independentAxes=t}setAutoScaleYAxis(t,e){this.autoScaleYAxis.enabled=t,this.autoScaleYAxis.padding=e}setNavigatorEnabled(t=!0){this.navigatorModule=t}setZoomModuleEnabled(t=!0){this.zoomModule=t}isZoomEnabled(){return this.zoomModule}updateZoom(t,e){if(e?.x&&(e.x.min<0||e.x.max>1)&&(logger_exports.warnOnce(`Attempted to update x-axis zoom to an invalid ratio of [{ min: ${e.x.min}, max: ${e.x.max} }], expecting a ratio of 0 to 1, ignoring.`),e.x=void 0),e?.y&&(e.y.min<0||e.y.max>1)&&(logger_exports.warnOnce(`Attempted to update y-axis zoom to an invalid ratio of [{ min: ${e.y.min}, max: ${e.y.max} }], expecting a ratio of 0 to 1, ignoring.`),e.y=void 0),this.axisZoomManagers.size===0){const s=this.state.stateId();(s==="initial"||s===t)&&this.state.set(t,e);return}this.state.set(t,e);const i=e?.autoScaleYAxis;i!=null&&(this.autoScaleYAxis.manuallyAdjusted=!i),this.axisZoomManagers.forEach(s=>{s.updateZoom(t,e?.[s.getDirection()])}),this.applyChanges(t)}updateAxisZoom(t,e,i){this.axisZoomManagers.get(e)?.updateZoom(t,i),this.applyChanges(t)}resetZoom(t){this.autoScaleYAxis.manuallyAdjusted=!1;const e=this.getRestoredZoom();this.updateZoom(t,{x:{min:e?.x?.min??0,max:e?.x?.max??1},y:{min:e?.y?.min??0,max:e?.y?.max??1},autoScaleYAxis:e?.autoScaleYAxis??!0})}resetAxisZoom(t,e){const s=this.axisZoomManagers.get(e)?.getDirection();if(s==null)return;const n=this.getRestoredZoom();if(s==="y"){const r=n?.autoScaleYAxis??!0;this.autoScaleYAxis.manuallyAdjusted=!r}this.updateAxisZoom(t,e,n?.[s]??{min:0,max:1})}setAxisManuallyAdjusted(t,e){this.axisZoomManagers.get(e)?.getDirection()==="y"&&(this.autoScaleYAxis.manuallyAdjusted=!0)}updatePrimaryAxisZoom(t,e,i){const s=this.getPrimaryAxis(e);s&&this.updateAxisZoom(t,s.id,i)}panToBBox(t,e,i){if(!this.isZoomEnabled())return!1;const s=this.getZoom();if(s===void 0||!s.x&&!s.y)return!1;if(!(e.width>0&&e.height>0&&Math.abs(i.width)<=Math.abs(e.width)&&Math.abs(i.height)<=Math.abs(e.height)))return logger_exports.warnOnce("cannot pan to target BBox - chart too small?"),!1;const r=calcPanToBBoxRatios(e,s,i);return this.independentAxes?(this.updatePrimaryAxisZoom(t,"x",r.x),this.updatePrimaryAxisZoom(t,"y",r.y)):this.updateZoom(t,r),!0}fireZoomPanStartEvent(t){this.listeners.dispatch("zoom-pan-start",{type:"zoom-pan-start",callerId:t})}extendToEnd(t,e,i){return this.extendWith(t,e,s=>Number(s)-i)}extendWith(t,e,i){const s=this.getPrimaryAxis(e);if(!s)return;const n=this.getDomainExtents(s);if(!n)return;const[,r]=n,a=i(r),o=this.rangeToRatio({start:a,end:r},e);o&&this.updateZoom(t,{[e]:o})}updateWith(t,e,i){const s=this.getPrimaryAxis(e);if(!s)return;const n=this.getDomainExtents(s);if(!n)return;let[r,a]=n;[r,a]=i(r,a);const o=this.rangeToRatio({start:r,end:a},e);o&&this.updateZoom(t,{[e]:o})}getZoom(){let t,e;if(this.axisZoomManagers.forEach(i=>{i.getDirection()==="x"?t??(t=i.getZoom()):i.getDirection()==="y"&&(e??(e=i.getZoom()))}),t||e)return{x:t,y:e}}getAxisZoom(t){return this.axisZoomManagers.get(t)?.getZoom()??{min:0,max:1}}getAxisZooms(){const t={};for(const[e,i]of this.axisZoomManagers.entries())t[e]={direction:i.getDirection(),zoom:i.getZoom()};return t}getRestoredZoom(){return this.lastRestoredState}getPrimaryAxisId(t){return this.getPrimaryAxis(t)?.id}isVisibleItemsCountAtLeast(t,e){const i=this.getPrimaryAxis("x"),s=this.getPrimaryAxis("y"),n=new Set;let r=0;const a=[t.x.min,t.x.max],o=[t.y.min,t.y.max];for(const c of i?.boundSeries??[]){n.add(c.id);const l=e-(r??0),h=c.getVisibleItems(a,o,l);if(r+=h,r>=e)return!0}for(const c of s?.boundSeries??[]){if(n.has(c.id))continue;const l=e-(r??0),h=c.getVisibleItems(a,o,l);if(r+=h,r>=e)return!0}return n.size===0}getMementoRanges(){const t=this.getDefinedZoom();let e;return this.autoScaleYAxis.enabled&&(e=this.autoScaleYAxis.manuallyAdjusted?[]:["y"]),{rangeX:this.getRangeDirection(t.x,"x"),rangeY:this.getRangeDirection(t.y,"y"),ratioX:{start:t.x.min,end:t.x.max},ratioY:{start:t.y.min,end:t.y.max},autoScaledAxes:e}}autoScaleYZoom(t,e=!0){if(!this.isZoomEnabled())return;const{independentAxes:i,autoScaleYAxis:s}=this,n=this.getZoom();if(n?.x==null||!s.enabled||s.manuallyAdjusted)return;const{padding:r}=s;let a;if(n.x?.min===0&&n.x?.max===1?a={min:0,max:1}:i?a=this.primaryAxisZoom("y",n.x,{padding:r}):a=this.combinedAxisZoom("y",n.x,{padding:r}),a!=null){if(i){const o=this.getPrimaryAxis("y");(o==null?void 0:this.axisZoomManagers.get(o.id))?.updateZoom("zoom-manager",a)}else for(const o of this.axisZoomManagers.values())o.getDirection()==="y"&&o.updateZoom("zoom-manager",a);e&&this.applyChanges(t)}}applyChanges(t){if(this.autoScaleYZoom(t,!1),!Array.from(this.axisZoomManagers.values(),s=>s.applyChanges()).includes(!0))return;const i={};for(const[s,n]of this.axisZoomManagers.entries())i[s]=n.getZoom();this.listeners.dispatch("zoom-change",{type:"zoom-change",...this.getZoom(),axes:i,callerId:t}),this.fireChartEvent({type:"zoom",...this.getMementoRanges()})}getRangeDirection(t,e){const i=this.getPrimaryAxis(e);if(!i||!ContinuousScale.is(i.scale)&&!OrdinalTimeScale.is(i.scale))return;const s=this.getDomainPixelExtents(i);if(!s)return;const[n,r]=s;let a,o;return n<=r?(a=i.scale.invert(0),o=i.scale.invert(n+(r-n)*t.max)):(a=i.scale.invert(n-(n-r)*t.min),o=i.scale.invert(0)),{start:a,end:o}}rangeToRatio(t,e){const i=this.getPrimaryAxis(e);if(!i)return;const s=this.getDomainPixelExtents(i);if(!s)return;const[n,r]=s;let a=t.start==null?n:i.scale.convert?.(t.start),o=t.end==null?r:i.scale.convert?.(t.end);if(!isFiniteNumber(a)||!isFiniteNumber(o))return;const[c,l]=[Math.min(n,r),Math.max(n,r)];if(al){logger_exports.warnOnce(`Invalid range start [${t.start}], expecting a value between [${i.scale.invert?.(n)}] and [${i.scale.invert?.(r)}], ignoring.`);return}if(ol){logger_exports.warnOnce(`Invalid range end [${t.end}], expecting a value between [${i.scale.invert?.(n)}] and [${i.scale.invert?.(r)}], ignoring.`);return}a=Math.min(l,Math.max(c,a)),o=Math.min(l,Math.max(c,o));const h=r-n,u=Math.abs((a-n)/h),d=Math.abs((o-n)/h);return{min:u,max:d}}getPrimaryAxis(t){return this.axes?.find(e=>e.direction===t)}getDomainExtents(t){const{domain:e}=t.scale,i=e.at(0),s=e.at(-1);if(!(i==null||s==null))return[i,s]}getDomainPixelExtents(t){const{domain:e}=t.scale,i=t.scale.convert?.(e.at(0)),s=t.scale.convert?.(e.at(-1));if(!(!isFiniteNumber(i)||!isFiniteNumber(s)))return[i,s]}getDefinedZoom(){const t=this.getZoom();return{x:{min:t?.x?.min??0,max:t?.x?.max??1},y:{min:t?.y?.min??0,max:t?.y?.max??1}}}zoomBounds(t,e,i,s){const n=t.scale,r=n.range;n.range=[0,1];const a=e.scale,o=a.range;a.range=[0,1];let c=1,l=!1,h=0,u=!1;for(const p of e.boundSeries){const{connectsToYAxis:f}=p,y=p.getRange("y",[i.min,i.max]);for(const m of y){const x=a.convert(m);Number.isFinite(x)&&(xh&&(h=x,u=!f||m>0))}}if(isFiniteNumber(e.min)&&(c=0),isFiniteNumber(e.max)&&(h=1),n.range=r,a.range=o,c>=h)return;const d=(l?s:0)+(u?s:0),g=Math.min((h-c)*(1+d),1);if(!(g<=0)){if(l&&u){const p=(h+c)/2;c=p-g/2,h=p+g/2}else!l&&u?h=c+g:l&&!u&&(c=h-g);return c<0?(h+=-c,c=0):h>1&&(c-=h-1,h=1),{min:c,max:h}}}primaryAxisZoom(t,e,{padding:i=0}={}){const s=t==="x"?"y":"x",n=this.getPrimaryAxis(s),r=this.getPrimaryAxis(t);if(!(n==null||r==null))return this.zoomBounds(n,r,e,i)}combinedAxisZoom(t,e,{padding:i=0}={}){const s=t==="x"?"y":"x",n=new Map;for(const c of this.axes)if(c.direction===s)for(const l of c.boundSeries)n.set(l,c);let r=1,a=0;for(const c of this.axes)if(c.direction===t)for(const l of c.boundSeries){const h=n.get(l);if(h==null)continue;const u=this.zoomBounds(h,c,e,i);if(u==null)return;r=Math.min(r,u.min),a=Math.max(a,u.max)}const o=1e-6;if(r1-o&&(a=1),!(r>a))return{min:r,max:a}}},AxisZoomManager=class{constructor(t){this.axis=t;const[e=0,i=1]=t.visibleRange;this.state=new StateTracker({min:e,max:i}),this.currentZoom=this.state.stateValue()}getDirection(){return this.axis.direction}updateZoom(t,e){this.state.set(t,e)}getZoom(){return deepClone(this.state.stateValue())}hasChanges(){const t=this.currentZoom,e=this.state.stateValue();return t.min!==e.min||t.max!==e.max}applyChanges(){const t=this.hasChanges();return this.currentZoom=this.state.stateValue(),t}},SeriesLabelLayoutManager=class{constructor(){this.labelData=new Map}updateLabels(t,e,i=BBox.zero){const s={x:-e.left,y:-e.top,width:i.width+e.left+e.right,height:i.height+e.top+e.bottom},n=new Set(t.map(a=>a.id));for(const a of this.labelData.keys())n.has(a)||this.labelData.delete(a);for(const a of t){const o=a.getLabelData();o.every(isPointLabelDatum)&&this.labelData.set(a.id,o)}const r=placeLabels(this.labelData,s,5);for(const a of t)a.updatePlacedLabelData?.(r.get(a.id)??[])}},LegendManager=class extends BaseManager{constructor(){super(...arguments),this.mementoOriginatorKey="legend",this.legendDataMap=new Map}createMemento(){return this.getData().filter(({hideInLegend:t,isFixed:e})=>!t&&!e).map(({enabled:t,seriesId:e,itemId:i,legendItemName:s})=>({visible:t,seriesId:e,itemId:i,legendItemName:s}))}guardMemento(t){return t==null||isArray(t)}restoreMemento(t,e,i){i?.forEach(s=>{const{seriesId:n,data:r}=this.getRestoredData(s)??{};!n||!r||this.updateData(n,r)}),this.update()}getRestoredData(t){const{seriesId:e,itemId:i,legendItemName:s,visible:n}=t;if(e){const a=(this.legendDataMap.get(e)??[]).map(o=>{const c=o.seriesId===e&&(!i||o.itemId===i);return c&&o.isFixed&&this.warnFixed(o.seriesId,o.itemId),!o.isFixed&&c?{...o,enabled:n}:o});return{seriesId:e,data:a}}if(!(i==null&&s==null))for(const r of this.getData()){if(i!=null&&r.itemId!==i||s!=null&&r.legendItemName!==s)continue;if(r.isFixed){this.warnFixed(r.seriesId,i);return}const a=(this.legendDataMap.get(r.seriesId)??[]).map(o=>o.itemId===i||o.legendItemName===s?{...o,enabled:n}:o);return{seriesId:r.seriesId,data:a}}}warnFixed(t,e){logger_exports.warnOnce(`The legend item with seriesId [${t}] and itemId [${e}] is not configurable, this series item cannot be toggled through the legend.`)}update(t){this.listeners.dispatch("legend-change",{type:"legend-change",legendData:t??this.getData()})}updateData(t,e=[]){this.legendDataMap.set(t,e)}clearData(){this.legendDataMap.clear()}toggleItem({enabled:t,seriesId:e,itemId:i,legendItemName:s}){if(s){this.getData().forEach(o=>{const c=(this.legendDataMap.get(o.seriesId)??[]).map(l=>l.legendItemName===s?{...l,enabled:t}:l);this.updateData(o.seriesId,c)});return}const n=this.getData(e),r=n.length===1,a=n.map(o=>i==null&&r||o.itemId===i?{...o,enabled:t}:o);this.updateData(e,a)}getData(t){return t?this.legendDataMap.get(t)??[]:[...this.legendDataMap].reduce((e,[i,s])=>e.concat(s),[])}getDatum({seriesId:t,itemId:e}={}){return this.getData(t).find(i=>i.itemId===e)}getSeriesEnabled(t){const e=this.getData(t);if(e.length>0)return e.some(i=>i.enabled)}getItemEnabled({seriesId:t,itemId:e}={}){return this.getDatum({seriesId:t,itemId:e})?.enabled??!0}},SeriesStateManager=class{constructor(){this.groups={}}registerSeries({internalId:t,seriesGrouping:e,visible:i,type:s}){var n;e&&((n=this.groups)[s]??(n[s]={}),this.groups[s][t]={grouping:e,visible:i})}updateSeries({internalId:t,seriesGrouping:e,visible:i,type:s}){if(!e)return;const n=this.groups[s]?.[t];n&&(n.grouping=e,n.visible=i)}deregisterSeries({internalId:t,type:e}){this.groups[e]&&delete this.groups[e][t],this.groups[e]&&Object.keys(this.groups[e]).length===0&&delete this.groups[e]}getVisiblePeerGroupIndex({type:t,seriesGrouping:e,visible:i}){if(!e)return{visibleGroupCount:i?1:0,visibleSameStackCount:i?1:0,index:0};const s=new Set,n=new Set;for(const a of Object.values(this.groups[t]??{}))a.visible&&(s.add(a.grouping.groupIndex),a.grouping.groupIndex===e.groupIndex&&n.add(a.grouping.stackIndex));const r=Array.from(s);return r.sort((a,o)=>a-o),{visibleGroupCount:r.length,visibleSameStackCount:n.size,index:r.indexOf(e.groupIndex)}}},ChartUpdateType=(t=>(t[t.FULL=0]="FULL",t[t.UPDATE_DATA=1]="UPDATE_DATA",t[t.PROCESS_DATA=2]="PROCESS_DATA",t[t.PERFORM_LAYOUT=3]="PERFORM_LAYOUT",t[t.SERIES_UPDATE=4]="SERIES_UPDATE",t[t.PRE_SCENE_RENDER=5]="PRE_SCENE_RENDER",t[t.SCENE_RENDER=6]="SCENE_RENDER",t[t.NONE=7]="NONE",t))(ChartUpdateType||{}),UpdateService=class{constructor(t){this.updateCallback=t,this.events=new EventEmitter}addListener(t,e){return this.events.on(t,e)}removeListener(t,e){return this.events.on(t,e)}destroy(){this.events.clear()}update(t=0,e){this.updateCallback(t,e)}dispatchUpdateComplete(){this.events.emit("update-complete",{type:"update-complete"})}dispatchPreDomUpdate(){this.events.emit("pre-dom-update",{type:"pre-dom-update"})}dispatchPreSceneRender(){this.events.emit("pre-scene-render",{type:"pre-scene-render"})}dispatchProcessData({series:t}){this.events.emit("process-data",{type:"process-data",series:t})}},ChartContext=class{constructor(t,e){this.callbackCache=new CallbackCache,this.chartEventManager=new ChartEventManager,this.highlightManager=new HighlightManager,this.layoutManager=new LayoutManager,this.localeManager=new LocaleManager,this.seriesStateManager=new SeriesStateManager,this.stateManager=new StateManager,this.seriesLabelLayoutManager=new SeriesLabelLayoutManager,this.contextModules=[];const{scene:i,root:s,syncManager:n,container:r,fireEvent:a,updateCallback:o,updateMutex:c,styleContainer:l,chartType:h}=e;this.chartService=t,this.syncManager=n,this.domManager=new DOMManager(r,l),this.widgets=new WidgetSet(this.domManager);const u=this.domManager.addChild("canvas","scene-canvas",i?.canvas.element);this.scene=i??new Scene({canvasElement:u}),this.scene.setRoot(s),this.axisManager=new AxisManager(s),this.legendManager=new LegendManager,this.annotationManager=new AnnotationManager(t.annotationRoot),this.chartTypeOriginator=new ChartTypeOriginator(t),this.interactionManager=new InteractionManager,this.contextMenuRegistry=new ContextMenuRegistry,this.updateService=new UpdateService(o),this.proxyInteractionService=new ProxyInteractionService(this.localeManager,this.domManager),this.historyManager=new HistoryManager(this.chartEventManager),this.animationManager=new AnimationManager(this.interactionManager,c),this.dataService=new DataService(this.animationManager),this.tooltipManager=new TooltipManager(this.domManager,t.tooltip),this.zoomManager=new ZoomManager(a,this.layoutManager);for(const d of moduleRegistry.byType("context")){if(!d.chartTypes.includes(h))continue;const g=d.moduleFactory(this);this.contextModules.push(g),this[d.contextKey]=g}}destroy(){this.animationManager.destroy(),this.highlightManager.destroy(),this.axisManager.destroy(),this.callbackCache.invalidateCache(),this.chartEventManager.destroy(),this.domManager.destroy(),this.highlightManager.destroy(),this.proxyInteractionService.destroy(),this.syncManager.destroy(),this.tooltipManager.destroy(),this.zoomManager.destroy(),this.widgets.destroy(),this.contextModules.forEach(t=>t.destroy())}},ChartHighlight=class extends BaseProperties{constructor(){super(...arguments),this.range="tooltip"}};__decorateClass([Validate(UNION(["tooltip","node"],"a range"))],ChartHighlight.prototype,"range",2);function setsEqual(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function idsMapEqual(t,e){if(t==null||e==null)return t===e;if(t.size!==e.size)return!1;for(const[i,s]of t){const n=e.get(i);if(n==null||!setsEqual(s,n))return!1}return!0}function propsEqual(t,e){if(t.length!==e.length)return!1;for(let i=0;is&&(i[0]=s),i[1]e&&(this.domain[0]=e),this.domain[1]Math.max(r,a.length),0);let s=1<<32-Math.clz32(e);e===s/2&&(s=s>>>1),this.maxLevelSize=s;const n=new Float64Array((s*2-1)*2).fill(NaN);for(const r of t)for(let a=0;ad)&&(n[h]=o)}for(let r=s/2|0;r>=1;r=r/2|0){const a=r-1|0,o=a+r|0;for(let c=0;cf?p:f}}this.buffer=n}computeRangeInto(t,e,i,s,n,r,a){const o=n+r-1;if(o=i)return a;if(n>=e&&o1&&(s=s*2|0,r=r/2|0,this.computeRangeInto(t,e,i,s+1|0,n,r,a),this.computeRangeInto(t,e,i,s+2|0,n+r,r,a));return a}rangeBetween(t,e){if(t>e)return[NaN,NaN];const{maxLevelSize:i,buffer:s}=this,n=[1/0,-1/0];return this.computeRangeInto(s,t,e,0,0,i,n),n}get range(){const{buffer:t}=this;return[t[MIN],t[MAX]]}},DOMAIN_RANGES=Symbol("domain-ranges");function toKeyString(t){return t.map(e=>isObject(e)?JSON.stringify(e):e).join("-")}function round2(t){return Number.isInteger(t)?t:Math.abs(t)>1e4?Math.trunc(t):Math.round(t*1e4)/1e4}function isScoped(t){return"scopes"in t&&Array.isArray(t.scopes)}var INVALID_VALUE=Symbol("invalid");function createArray(t,e){const i=[];for(let s=0;s{let i=e;for(const s of t)i=i[s];return i}}var DataModel=class{constructor(t,e="standalone",i=!1){this.opts=t,this.mode=e,this.suppressFieldDotNotation=i,this.debug=Debug.create(!0,"data-model"),this.scopeCache=new Map,this.keys=[],this.values=[],this.aggregates=[],this.groupProcessors=[],this.propertyProcessors=[],this.reducers=[],this.processors=[],this.markScopeDatumInvalid=function(o,c,l,h){for(const u of o)h.has(u)||h.set(u,createArray(c.length,!1)),h.get(u)[l]=!0};let s=!0;for(const o of t.props){if(o.type==="key"&&!s)throw new Error("AG Charts - internal config error: keys must come before values.");o.type==="value"&&s&&(s=!1)}const n=({matchGroupIds:o=[]})=>{for(const c of o)if(this.values.every(l=>l.groupId!==c))throw new Error(`AG Charts - internal config error: matchGroupIds properties must match defined groups (${c}).`)},r=new Set,a=new Set;for(const o of t.props){const c=o.type==="key"?r:a;switch(isScoped(o)&&o.scopes?.forEach(l=>c.add(l)),o.type){case"key":this.keys.push({...o,index:this.keys.length,missing:new Map});break;case"value":if(o.property==null)throw new Error(`AG Charts - internal config error: no properties specified for value definitions: ${JSON.stringify(o)}`);this.values.push({...o,index:this.values.length,missing:new Map});break;case"aggregate":n(o),this.aggregates.push({...o,index:this.aggregates.length});break;case"group-value-processor":n(o),this.groupProcessors.push({...o,index:this.groupProcessors.length});break;case"property-value-processor":this.propertyProcessors.push({...o,index:this.propertyProcessors.length});break;case"reducer":this.reducers.push({...o,index:this.reducers.length});break;case"processor":this.processors.push({...o,index:this.processors.length});break}}if(this.opts.groupByKeys||this.opts.groupByFn!=null){const o=new Set(a.values());if(r.forEach(c=>o.delete(c)),o.size>0)throw new Error(`AG Charts - scopes missing key for grouping, illegal configuration: ${[...o.values()]}`)}}resolveProcessedDataDefById(t,e){const i=this.scopeCache.get(t.id)?.get(e);if(!i)throw new Error(`AG Charts - didn't find property definition for [${e}, ${t.id}]`);return{index:i.index,def:i}}resolveProcessedDataIndexById(t,e){return this.resolveProcessedDataDefById(t,e).index}resolveKeysById(t,e,i){const s=this.resolveProcessedDataIndexById(t,e),n=i.keys[s];if(n==null)throw new Error(`AG Charts - didn't find keys for [${e}, ${t.id}]`);return n.get(t.id)}hasColumnById(t,e){return this.scopeCache.get(t.id)?.get(e)!=null}resolveColumnById(t,e,i){const s=this.resolveProcessedDataIndexById(t,e),n=i.columns?.[s];if(n==null)throw new Error(`AG Charts - didn't find column for [${e}, ${t.id}]`);return n}*forEachDatum(t,e,i){const s=e.columnScopes.findIndex(n=>n.has(t.id));for(const n of i.datumIndices[s]??[])yield e.columns[s][n]}*forEachGroupDatum(t,e){const i=e.columnScopes.findIndex(r=>r.has(t.id)),s={groupIndex:0,columnIndex:i},n=[];for(const r of e.groups){s.group=r;let a=0;for(const o of r.datumIndices[i]??n)s.datumIndex=o,s.valueIndex=a++,yield s;s.groupIndex++}}*forEachGroupDatumTuple(t,e){const s={columnIndex:e.columnScopes.findIndex(n=>n.has(t.id)),datumIndexes:[void 0,void 0,void 0]};for(const n of this.forEachGroupDatum(t,e))s.group=s.nextGroup,s.groupIndex=s.nextGroupIndex,s.nextGroup=n.group,s.nextGroupIndex=n.groupIndex,s.datumIndexes[0]=s.datumIndexes[1],s.datumIndexes[1]=s.datumIndexes[2],s.datumIndexes[2]=n.datumIndex,s.group!=null&&s.datumIndexes[1]!=null&&(yield s);s.group=s.nextGroup,s.groupIndex=s.nextGroupIndex,s.nextGroup=void 0,s.nextGroupIndex=void 0,s.datumIndexes[0]=s.datumIndexes[1],s.datumIndexes[1]=s.datumIndexes[2],s.datumIndexes[2]=void 0,s.group!=null&&s.datumIndexes[1]!=null&&(yield s)}getDomain(t,e,i,s){return this.getDomainsByType(i??"value",s)?.[this.resolveProcessedDataIndexById(t,e)]??[]}getDomainBetweenRange(t,e,[i,s],n){const r=e.map(l=>this.resolveProcessedDataIndexById(t,l)),a=r.join(":"),o=n[DOMAIN_RANGES];let c=o.get(a);if(c==null){const l=r.map(h=>n.columns[h]);c=new RangeLookup(l),o.set(a,c)}return c.rangeBetween(i,s)}getDomainsByType(t,e){switch(t){case"key":return e.domain.keys;case"value":return e.domain.values;case"aggregate":return e.domain.aggValues;case"group-value-processor":return e.domain.groups;default:return null}}processData(t){const{opts:{groupByKeys:e,groupByFn:i},aggregates:s,groupProcessors:n,reducers:r,processors:a,propertyProcessors:o}=this,c=performance.now();if(e&&this.keys.length===0)return;let l=this.extractData(t);e?l=this.groupData(l):i&&(l=this.groupData(l,i(l))),n.length>0&&l.type==="grouped"&&this.postProcessGroups(l),s.length>0&&l.type==="ungrouped"?this.aggregateUngroupedData(l):s.length>0&&l.type==="grouped"&&this.aggregateGroupedData(l),o.length>0&&this.postProcessProperties(l),r.length>0&&this.reduceData(l),a.length>0&&this.postProcessData(l),this.warnDataMissingProperties(t);const h=performance.now();return l.time=h-c,this.debug.check()&&logProcessedData(l),this.processScopeCache(),l}warnDataMissingProperties(t){if(t.size!==0)for(const e of iterate(this.keys,this.values))for(const[i,s]of e.missing){if(s<(t.get(i)?.length??1/0))continue;const n=i==null?"":` for ${i}`;logger_exports.warnOnce(`the key '${e.property}' was not found in any data element${n}.`)}}processScopeCache(){this.scopeCache.clear();for(const t of iterate(this.keys,this.values,this.aggregates))if(t.idsMap)for(const[e,i]of t.idsMap)for(const s of i)if(!this.scopeCache.has(e))this.scopeCache.set(e,new Map([[s,t]]));else{if(this.scopeCache.get(e)?.has(s))throw new Error("duplicate definition ids on the same scope are not allowed.");this.scopeCache.get(e).set(s,t)}}valueGroupIdxLookup({matchGroupIds:t}){const e=[];for(const[i,s]of this.values.entries())(!t||s.groupId&&t.includes(s.groupId))&&e.push(i);return e}valueIdxLookup(t,e){const i=t==null||t.length===0,s=typeof e=="string"?e:e.id,n=a=>{if(a.idsMap){for(const[o,c]of a.idsMap)if(t?.includes(o)&&c.has(s))return!0}return!1},r=this.values.reduce((a,o,c)=>((o.scopes==null||i&&!o.scopes.length||o.scopes.some(h=>t?.includes(h)))&&(o.property===s||o.id===s||n(o))&&a.push(c),a),[]);if(r.length===0)throw new Error(`AG Charts - configuration error, unknown property ${JSON.stringify(e)} in scope(s) ${JSON.stringify(t)}`);return r}extractData(t){const{dataDomain:e,processValue:i,allScopesHaveSameDefs:s}=this.initDataDomainProcessor(),{keys:n,values:r}=this,{invalidData:a,invalidKeys:o,allKeyMappings:c}=this.extractKeys(n,t,i),{columns:l,columnScopes:h,partialValidDataCount:u,maxDataLength:d}=this.extractValues(a,r,t,o,i),g=p=>{const f=e.get(p),y=f.getDomain();return ContinuousDomain.is(f)&&y[0]>y[1]?[]:y};return{type:"ungrouped",input:{count:d},scopes:new Set(t.keys()),dataSources:t,aggregation:void 0,keys:[...c.values()],columns:l,columnScopes:h,invalidKeys:o,invalidData:a,domain:{keys:n.map(g),values:r.map(g)},defs:{allScopesHaveSameDefs:s,keys:n,values:r},partialValidDataCount:u,time:0,[DOMAIN_RANGES]:new Map}}extractKeys(t,e,i){const s=new Map,n=new Map,r=new Map;let a,o;const c=(l,h)=>{const u=o.get(l);a.set(h,a.get(u)),s.has(u)&&(s.set(h,s.get(u)),n.set(h,n.get(u)))};for(const l of t){const{invalidValue:h,scopes:u}=l;a=new Map,o=new Map,r.set(l,a);for(const d of u??[]){const g=e.get(d)??[];if(o.has(g)){c(g,d);continue}const p=[];a.set(d,p),o.set(g,d);let f,y;for(let m=0;mi.get(y))).size>1)throw new Error(`AG Charts - more than one data source for: ${JSON.stringify(l)}`);const d=new Set(l.scopes),g=first(l.scopes),p=i.get(g),f=p.map((y,m)=>{const x=s.get(g)?.[m];let b=n(l,y,m,l.scopes);return(x||b===INVALID_VALUE)&&this.markScopeDatumInvalid(l.scopes,p,m,t),x?b=h:b===INVALID_VALUE&&(r+=1,b=h),b});a.push(f),o.push(d),c=Math.max(c,f.length)}return{columns:a,columnScopes:o,partialValidDataCount:r,maxDataLength:c}}groupData(t,e){var i;const s=new Map,{keys:n,columns:r,columnScopes:a,invalidKeys:o,invalidData:c}=t,l=t.scopes,h=new Set;for(const g of l){const p=r.map((v,I)=>I).filter(v=>!h.has(v)&&a[v].has(g));if(p.length===0)continue;for(const v of p)h.add(v);const f=new Set;for(const v of p)for(const I of a[v])f.add(I);const y=n.map(v=>v.get(g)).filter(v=>v!=null),m=r[first(p)],x=c?.get(g),b=o?.get(g);for(let v=0;vL[v]);if(I==null||I.length===0)throw new Error("AG Charts - no keys found for scope: "+g);const S=e?.(I)??I,D=toKeyString(S),w=s.get(D)??{keys:S,datumIndices:[],validScopes:l};if(s.has(D)||s.set(D,w),x?.[v]===!0){w.validScopes===l&&(w.validScopes=new Set(l.values()));for(const L of f)w.validScopes.delete(L)}if(w.validScopes.size!==0)for(const L of p)(i=w.datumIndices)[L]??(i[L]=[]),w.datumIndices[L].push(v)}}const u=[],d=[];for(const{keys:g,datumIndices:p,validScopes:f}of s.values())f?.size!==0&&(u.push(g),d.push({datumIndices:p,keys:g,aggregation:[],validScopes:f}));return{...t,type:"grouped",domain:{...t.domain,groups:u},groups:d}}aggregateUngroupedData(t){const e=this.aggregates.map(()=>[1/0,-1/0]);t.domain.aggValues=e;const{keys:i,columns:s,dataSources:n}=t,r=first(n.keys()),a=n.get(r);t.aggregation=a?.map((o,c)=>{const l=[];for(const[h,u]of this.aggregates.entries()){const d=this.valueGroupIdxLookup(u);let g=u.groupAggregateFunction?.()??[1/0,-1/0];const p=d.map(x=>s[x][c]),f=datumKeys(i,r,c),y=f!=null?u.aggregateFunction(p,f):void 0;y&&(g=u.groupAggregateFunction?.(y,g)??ContinuousDomain.extendDomain(y,g));const m=u.finalFunction?.(g)??g;if(u.round===!0)for(const x in m)m[x]=round2(m[x]);l[h]=m,ContinuousDomain.extendDomain(m,e[h])}return l})}aggregateGroupedData(t){const e=this.aggregates.map(()=>[1/0,-1/0]);t.domain.aggValues=e;const{columns:i}=t;for(const[s,n]of this.aggregates.entries()){const r=this.valueGroupIdxLookup(n);for(const a of t.groups){if(a.aggregation??(a.aggregation=[]),a.validScopes?.size===0)continue;const o=a.keys;let c=n.groupAggregateFunction?.()??[1/0,-1/0];const l=Math.max(...r.map(u=>a.datumIndices[u]?.length??0));for(let u=0;ui[p][a.datumIndices[p]?.[u]]),g=n.aggregateFunction(d,o);g&&(c=n.groupAggregateFunction?.(g,c)??ContinuousDomain.extendDomain(g,c))}const h=n.finalFunction?.(c)??c;if(n.round===!0)for(const u in h)h[u]=round2(h[u]);a.aggregation[s]=h,ContinuousDomain.extendDomain(h,e[s])}}}postProcessGroups(t){const{groupProcessors:e}=this,{columnScopes:i,columns:s,invalidData:n,scopes:r}=t;for(const a of e){const o=this.valueGroupIdxLookup(a),c=a.adjust()();for(const l of t.groups)l.validScopes===r&&c(s,o,l);for(const l of o){const u=this.values[l].valueType==="category",d=s[l],g=first(i[l]),p=n?.get(g),f=u?new DiscreteDomain:new ContinuousDomain;for(let y=0;yh.get(a)).filter(h=>h!=null),c=o.map(()=>{}),l=e.get(a);for(let h=0;h{for(const l of iterate(t,e))l.valueType==="category"?s.set(l,new DiscreteDomain):(s.set(l,new ContinuousDomain),r&&(r=(l.scopes??[]).length===i.size))};a();const o=this.buildAccessors(iterate(t,e));return{dataDomain:s,processValue:(l,h,u,d)=>{let g,p;if(o.has(l.property)){try{p=o.get(l.property)(h)}catch{}g=p!=null}else g=l.property in h,p=g?h[l.property]:l.missingValue;l.forceValue!=null&&(p=g&&isNegative(p)?-1*l.forceValue:l.forceValue,g=!0);const f="missingValue"in l;if(!g&&!f)if(typeof d=="string"){const y=l.missing.get(d)??0;l.missing.set(d,y+1)}else for(const y of d){const m=l.missing.get(y)??0;l.missing.set(y,m+1)}if(s.has(l)||a(),g&&l.validation?.(p,h,u)===!1)if("invalidValue"in l)p=l.invalidValue;else return this.mode!=="integrated"&&logger_exports.warnOnce(`invalid value of type [${typeof p}] for [${l.scopes} / ${l.id}] ignored:`,`[${p}]`),INVALID_VALUE;return l.processor&&(n.has(l)||n.set(l,l.processor()),p=n.get(l)?.(p)),s.get(l)?.extend(p),p},initDataDomain:a,scopes:i,allScopesHaveSameDefs:r}}buildAccessors(t){const e=new Map;if(this.suppressFieldDotNotation)return e;for(const i of t){if(!(i.property.includes(".")||i.property.includes("[")))continue;const n=getPathComponents(i.property);if(n==null){logger_exports.warnOnce("Invalid property path [%s]",i.property);continue}const r=createPathAccessor(n);e.set(i.property,r)}return e}};function logProcessedData(t){const e=(i,s)=>{s.length>0&&(logger_exports.log(`DataModel.processData() - ${i}`),logger_exports.table(s))};logger_exports.log("DataModel.processData() - processedData",t),e("Key Domains",t.domain.keys),e("Group Domains",t.domain.groups??[]),e("Value Domains",t.domain.values),e("Aggregate Domains",t.domain.aggValues??[])}var _DataController=class O{constructor(e,i){this.mode=e,this.suppressFieldDotNotation=i,this.debug=Debug.create(!0,"data-model"),this.requested=[],this.status="setup"}async request(e,i,s){if(this.status!=="setup")throw new Error("AG Charts - data request after data setup phase.");return new Promise((n,r)=>{this.requested.push({id:e,opts:s,data:i,resolve:n,reject:r})})}execute(e){if(this.status!=="setup")throw new Error("AG Charts - data request after data setup phase.");this.status="executed",this.debug("DataController.execute() - requested",this.requested);const i=this.validateRequests(this.requested);this.debug("DataController.execute() - validated",i);const s=this.mergeRequested(i);this.debug("DataController.execute() - merged",s),this.debug.check()&&(getWindow().processedData=[]);const n=[];for(const{data:r,ids:a,opts:o,resolves:c,rejects:l}of s){const h=e?.find(g=>canReuseCachedData(g,r,a,o));let u,d;if(h==null)try{u=new DataModel(o,this.mode,this.suppressFieldDotNotation);const g=new Map(i.map(p=>[p.id,p.data]));d=u.processData(g)}catch(g){l.forEach(p=>p(g));continue}else({dataModel:u,processedData:d}=h);n.push({opts:o,data:r,ids:a,dataModel:u,processedData:d}),this.debug.check()&&getWindow("processedData").push(d),d?.partialValidDataCount===0?c.forEach(g=>g({dataModel:u,processedData:d})):d?this.splitResult(u,d,a,c):l.forEach(g=>g(new Error("AG Charts - no processed data generated")))}return n}validateRequests(e){const i=[];for(const[s,n]of e.entries())s>0&&n.data.length!==e[0].data.length&&n.opts.groupByData===!1&&n.opts.groupByKeys===!1?n.reject(new Error("all series[].data arrays must be of the same length and have matching keys.")):i.push(n);return i}mergeRequested(e){const i=[];for(const s of e){const n=i.find(O.groupMatch(s));n?n.push(s):i.push([s])}return i.map(O.mergeRequests)}splitResult(e,i,s,n){for(let r=0;rh.type==="key").map(h=>h.property).join(";")}const{groupByData:n,groupByKeys:r=!1,groupByFn:a,props:o}=i,c=s(o);return([l])=>(n===!1||l.data===e)&&(l.opts.groupByKeys??!1)===r&&l.opts.groupByFn===a&&s(l.opts.props)===c}static mergeRequests(e){const i=new Set(["key","group-value-processor"]);return e.reduce((s,{id:n,data:r,resolve:a,reject:o,opts:{props:c,...l}})=>{s.ids.push(n),s.rejects.push(o),s.resolves.push(a),s.data??(s.data=r),s.opts??(s.opts={...l,props:[]});for(const h of c){const u={...h,scopes:[n],data:r};O.createIdsMap(n,u);const d=s.opts.props.find(g=>g.type===u.type&&(i.has(g.type)||g.data===u.data)&&O.deepEqual(g,u));if(!d){s.opts.props.push(u);continue}d.scopes??(d.scopes=[]),d.scopes.push(...u.scopes??[]),(d.type==="key"||d.type==="value")&&u.idsMap?.size&&O.mergeIdsMap(u.idsMap,d.idsMap)}return s},{ids:[],rejects:[],resolves:[],data:null,opts:null})}static mergeIdsMap(e,i){for(const[s,n]of e){const r=i.get(s);if(r==null)i.set(s,new Set(n));else for(const a of n)r.add(a)}}static createIdsMap(e,i){i.id!=null&&(i.idsMap??(i.idsMap=new Map),i.idsMap.has(e)?i.idsMap.get(e).add(i.id):i.idsMap.set(e,new Set([i.id])))}static deepEqual(e,i){if(e===i)return!0;if(e&&i&&typeof e=="object"&&typeof i=="object"){if(e.constructor!==i.constructor)return!1;let s,n;if(Array.isArray(e)){if(n=e.length,n!==i.length)return!1;for(s=n-1;s>=0;s--)if(!O.deepEqual(e[s],i[s]))return!1;return!0}const r=Object.keys(e);if(n=r.length,n!==Object.keys(i).length)return!1;for(s=n-1;s>=0;s--){const a=r[s];if(!O.skipKeys.has(a)&&(!Object.hasOwn(i,a)||!O.deepEqual(e[a],i[a])))return!1}return!0}return!1}};_DataController.skipKeys=new Set(["id","idsMap","type","scopes","data"]);var DataController=_DataController,AxisRegistry=class{constructor(){this.axesMap=new Map,this.themeTemplates=new Map}register(t,e){this.axesMap.set(t,e.moduleFactory),e.themeTemplate&&this.setThemeTemplate(t,e.themeTemplate)}create(t,e){const i=this.axesMap.get(t);if(i)return i(e);throw new Error(`AG Charts - unknown axis type: ${t}`)}has(t){return this.axesMap.has(t)}keys(){return this.axesMap.keys()}setThemeTemplate(t,e){return this.themeTemplates.set(t,e),this}getThemeTemplate(t){return this.themeTemplates.get(t)}},axisRegistry=new AxisRegistry,EXPECTED_ENTERPRISE_MODULES=[{type:"root",optionsKey:"animation",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"]},{type:"root",optionsKey:"annotations",chartTypes:["cartesian"]},{type:"root",optionsKey:"background",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],optionsInnerKey:"image"},{type:"root",optionsKey:"foreground",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],optionsInnerKey:"image"},{type:"root",optionsKey:"chartToolbar",chartTypes:["cartesian"]},{type:"root",optionsKey:"contextMenu",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"]},{type:"root",optionsKey:"statusBar",chartTypes:["cartesian"],identifier:"status-bar"},{type:"root",optionsKey:"dataSource",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"]},{type:"root",optionsKey:"sync",chartTypes:["cartesian"]},{type:"root",optionsKey:"zoom",chartTypes:["cartesian","topology"]},{type:"root",optionsKey:"ranges",chartTypes:["cartesian"]},{type:"legend",optionsKey:"gradientLegend",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],identifier:"gradient"},{type:"root",optionsKey:"navigator",chartTypes:["cartesian"]},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"angle-category"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"angle-number"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"radius-category"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"radius-number"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"bar",community:!0},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"line",community:!0},{type:"axis",optionsKey:"axes[]",chartTypes:["cartesian"],identifier:"ordinal-time"},{type:"axis-option",optionsKey:"crosshair",chartTypes:["cartesian"]},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"box-plot"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"candlestick"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"cone-funnel"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"funnel"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"ohlc"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"heatmap"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"range-area"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"range-bar"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"waterfall"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"nightingale"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radar-area"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radar-line"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radial-bar"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radial-column"},{type:"series",optionsKey:"series[]",chartTypes:["hierarchy"],identifier:"sunburst"},{type:"series",optionsKey:"series[]",chartTypes:["hierarchy"],identifier:"treemap"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-shape"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-line"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-marker"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-shape-background"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-line-background"},{type:"series",optionsKey:"series[]",chartTypes:["flow-proportion"],identifier:"chord"},{type:"series",optionsKey:"series[]",chartTypes:["flow-proportion"],identifier:"sankey"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"pyramid"},{type:"series",optionsKey:"series[]",chartTypes:["gauge"],identifier:"linear-gauge"},{type:"series",optionsKey:"series[]",chartTypes:["gauge"],identifier:"radial-gauge"},{type:"series-option",optionsKey:"errorBar",chartTypes:["cartesian"],identifier:"error-bars"},{type:"context",contextKey:"sharedToolbar",chartTypes:["cartesian"]}];function getEnterpriseSeriesChartTypes(t){return EXPECTED_ENTERPRISE_MODULES.find(e=>e.type==="series"&&e.identifier===t)?.chartTypes}function isEnterpriseCartesian(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="cartesian")==="cartesian"}function isEnterprisePolar(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="polar")==="polar"}var LegendRegistry=class{constructor(){this.legendMap=new Map,this.themeTemplates=new Map}register(t,{optionsKey:e,moduleFactory:i,themeTemplate:s}){this.legendMap.set(t,{optionsKey:e,moduleFactory:i}),this.themeTemplates.set(e,s)}create(t,e){const i=this.legendMap.get(t)?.moduleFactory;if(i)return i(e);throw new Error(`AG Charts - unknown legend type: ${t}`)}getThemeTemplates(){return Object.fromEntries(this.themeTemplates)}getKeys(){return Array.from(this.legendMap.entries()).reduce((t,[e,i])=>(t[e]=i.optionsKey,t),{})}},legendRegistry=new LegendRegistry,ChartTypes=class extends Map{get(t){return super.get(t)??"unknown"}isCartesian(t){return this.get(t)==="cartesian"}isPolar(t){return this.get(t)==="polar"}isHierarchy(t){return this.get(t)==="hierarchy"}isTopology(t){return this.get(t)==="topology"}isFlowProportion(t){return this.get(t)==="flow-proportion"}isStandalone(t){return this.get(t)==="standalone"}isGauge(t){return this.get(t)==="gauge"}get seriesTypes(){return Array.from(this.keys())}get cartesianTypes(){return this.seriesTypes.filter(t=>this.isCartesian(t))}get polarTypes(){return this.seriesTypes.filter(t=>this.isPolar(t))}get hierarchyTypes(){return this.seriesTypes.filter(t=>this.isHierarchy(t))}get topologyTypes(){return this.seriesTypes.filter(t=>this.isTopology(t))}get flowProportionTypes(){return this.seriesTypes.filter(t=>this.isFlowProportion(t))}get standaloneTypes(){return this.seriesTypes.filter(t=>this.isStandalone(t))}get gaugeTypes(){return this.seriesTypes.filter(t=>this.isGauge(t))}},ChartDefaults=class extends Map{set(t,e){return super.set(t,mergeDefaults(e,this.get(t)))}},chartTypes2=new ChartTypes,publicChartTypes=new ChartTypes,chartDefaults=new ChartDefaults,SeriesRegistry=class{constructor(){this.seriesMap=new Map,this.themeTemplates=new Map}register(t,{chartTypes:[e],moduleFactory:i,tooltipDefaults:s,defaultAxes:n,themeTemplate:r,paletteFactory:a,solo:o,stackable:c,groupable:l,stackedByDefault:h,hidden:u}){this.setThemeTemplate(t,r),this.seriesMap.set(t,{moduleFactory:i,tooltipDefaults:s,defaultAxes:n,paletteFactory:a,solo:o,stackable:c,groupable:l,stackedByDefault:h}),chartTypes2.set(t,e),u||publicChartTypes.set(t,e)}create(t,e){const i=this.seriesMap.get(t)?.moduleFactory;if(i)return i(e);throw new Error(`AG Charts - unknown series type: ${t}`)}cloneDefaultAxes(t,e){const i=this.seriesMap.get(t)?.defaultAxes;if(i==null)return null;const s=typeof i=="function"?i(e):i;return{axes:deepClone(s)}}isDerivedDefaultAxes(t){return typeof this.seriesMap.get(t)?.defaultAxes=="function"}setThemeTemplate(t,e){const i=this.themeTemplates.get(t);this.themeTemplates.set(t,mergeDefaults(e,i))}getThemeTemplate(t){return this.themeTemplates.get(t)}getPaletteFactory(t){return this.seriesMap.get(t)?.paletteFactory}getTooltipDefauls(t){return this.seriesMap.get(t)?.tooltipDefaults}isSolo(t){return this.seriesMap.get(t)?.solo??!1}isGroupable(t){return this.seriesMap.get(t)?.groupable??!1}isStackable(t){return this.seriesMap.get(t)?.stackable??!1}isStackedByDefault(t){return this.seriesMap.get(t)?.stackedByDefault??!1}},seriesRegistry=new SeriesRegistry,_SyncManager=class B extends BaseManager{constructor(e){super(),this.chart=e}subscribe(e=B.DEFAULT_GROUP){let i=this.get(e);return i||(i=new Set,B.chartsGroups.set(e,i)),i.add(this.chart),this}unsubscribe(e=B.DEFAULT_GROUP){return this.get(e)?.delete(this.chart),this}getChart(){return this.chart}getGroup(e=B.DEFAULT_GROUP){const i=this.get(e);return i?Array.from(i):[]}getGroupSiblings(e=B.DEFAULT_GROUP){return this.getGroup(e).filter(i=>i!==this.chart)}get(e){return B.chartsGroups.get(e)}};_SyncManager.chartsGroups=new Map,_SyncManager.DEFAULT_GROUP=Symbol("sync-group-default");var SyncManager=_SyncManager,Keyboard=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!1}};__decorateClass([Validate(BOOLEAN)],Keyboard.prototype,"enabled",2),__decorateClass([Validate(NUMBER)],Keyboard.prototype,"tabIndex",2);var CartesianAxisPositions=["top","right","bottom","left"];function isAxisPosition(t){return typeof t=="string"&&CartesianAxisPositions.includes(t)}function guessInvalidPositions(t){const e=[],i=[],s=[...CartesianAxisPositions];for(const n of t)n instanceof CartesianAxis&&(isAxisPosition(n.position)?i.push(n.position):e.push(n));for(const n of e){let r;do r=s.pop();while(r&&i.includes(r));if(r==null)break;n.position=r}}var MATCHING_KEYS=["direction","xKey","yKey","sizeKey","angleKey","radiusKey","normalizedTo"];function matchSeriesOptions(t,e,i){const s=(l,h,u)=>{const d=[l];for(const g of MATCHING_KEYS)g in h&&h[g]!=null&&d.push(`${g}=${h[g]}`);return u?.seriesGrouping&&d.push(`seriesGrouping.groupId=${u?.seriesGrouping.groupId}`),d.join(";")},n=new Map;let r=0;for(const l of t){const h=s(l.type,l.properties,i?.[r]);n.has(h)||n.set(h,[]),n.get(h)?.push([l,r++])}const a=new Map;r=0;for(const l of e){const h=s(l.type,l,l);a.has(h)||a.set(h,[]),a.get(h)?.push([l,r++])}if(![...n.keys()].some(l=>a.has(l)))return{status:"no-overlap",oldKeys:n.keys(),newKeys:a.keys()};const c=[];for(const[l,h]of a.entries())for(const[u,d]of h){const g=n.get(l);if(g==null||g.length<1){c.push({opts:u,targetIdx:d,idx:d,status:"add"}),n.delete(l);continue}const[p,f]=g.shift(),y=i?.[f]??{},m=jsonDiff(y,u??{}),{groupIndex:x,stackIndex:b}=m?.seriesGrouping??{};x!=null||b!=null?c.push({opts:u,series:p,diff:m,targetIdx:d,idx:f,status:"series-grouping"}):m?c.push({opts:u,series:p,diff:m,targetIdx:d,idx:f,status:"update"}):c.push({opts:u,series:p,targetIdx:d,idx:f,status:"no-op"}),g.length===0&&n.delete(l)}for(const l of n.values())for(const[h,u]of l)c.push({series:h,idx:u,targetIdx:-1,status:"remove"});return{status:"overlap",changes:c}}function optionsType(t){const{series:e}=t;if(e)return e[0]?.type??"line"}function isAgCartesianChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isCartesian(e)||isEnterpriseCartesian(e)}function isAgPolarChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isPolar(e)||isEnterprisePolar(e)}var ModulesManager=class extends ModuleMap{applyOptions(t){for(const e of this.moduleMap.values())e.module.optionsKey in t&&isProperties(e.moduleInstance)&&e.moduleInstance.set(t[e.module.optionsKey])}*legends(){for(const{module:t,moduleInstance:e}of this.moduleMap.values())t.type==="legend"&&(yield{legendType:t.identifier,legend:e})}},DEFAULT_OVERLAY_CLASS="ag-charts-overlay",DEFAULT_OVERLAY_DARK_CLASS="ag-charts-dark-overlay",Overlay=class extends BaseProperties{constructor(t,e){super(),this.className=t,this.defaultMessageId=e,this.enabled=!0}getText(t){return t.t(this.text??this.defaultMessageId)}getElement(t,e,i){if(this.content?.remove(),this.focusBox=i,this.renderer){const s=this.renderer();if(s instanceof HTMLElement)this.content=s;else{const n=createElement("div");n.innerHTML=s,this.content=n.firstElementChild}}else{const s=createElement("div",{display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",height:"100%",margin:"8px",fontFamily:"var(--ag-charts-font-family)",fontSize:"var(--ag-charts-font-size)",fontWeight:"var(--ag-charts-font-weight)"});s.innerText=this.getText(e),this.content=s,t?.animate({from:0,to:1,id:"overlay",phase:"add",groupId:"opacity",onUpdate(n){s.style.opacity=String(n)},onStop(){s.style.opacity="1"}})}return this.content}removeElement(t=()=>this.content?.remove(),e){if(this.content){if(e){const{content:i}=this;e.animate({from:1,to:0,phase:"remove",id:"overlay",groupId:"opacity",onUpdate(s){i.style.opacity=String(s)},onStop(){t?.()}})}else t?.();this.content=void 0,this.focusBox=void 0}}};__decorateClass([Validate(BOOLEAN)],Overlay.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0})],Overlay.prototype,"text",2),__decorateClass([Validate(FUNCTION,{optional:!0})],Overlay.prototype,"renderer",2);var ChartOverlays=class extends BaseProperties{constructor(){super(...arguments),this.darkTheme=!1,this.loading=new Overlay("ag-charts-loading-overlay","overlayLoadingData"),this.noData=new Overlay("ag-charts-no-data-overlay","overlayNoData"),this.noVisibleSeries=new Overlay("ag-charts-no-visible-series","overlayNoVisibleSeries"),this.unsupportedBrowser=new Overlay("ag-charts-unsupported-browser","overlayUnsupportedBrowser")}getFocusInfo(t){for(const e of[this.loading,this.noData,this.noVisibleSeries,this.unsupportedBrowser])if(e.focusBox!==void 0)return{text:e.getText(t),rect:e.focusBox}}destroy(){this.loading.removeElement(),this.noData.removeElement(),this.noVisibleSeries.removeElement(),this.unsupportedBrowser.removeElement()}};__decorateClass([Validate(BOOLEAN)],ChartOverlays.prototype,"darkTheme",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"loading",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"noData",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"noVisibleSeries",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"unsupportedBrowser",2);function getLoadingSpinner(t,e){const{animationDuration:i}=PHASE_METADATA.add,s=i*e,n=createElement("div",`${DEFAULT_OVERLAY_CLASS}--loading`,{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",height:"100%",boxSizing:"border-box",font:"13px Verdana, sans-serif",userSelect:"none",animation:`ag-charts-loading ${s}ms linear 50ms both`}),r=createElement("span",{width:"45px",height:"40px",backgroundImage:["linear-gradient(#0000 calc(1 * 100% / 6), #ccc 0 calc(3 * 100% / 6), #0000 0), ","linear-gradient(#0000 calc(2 * 100% / 6), #ccc 0 calc(4 * 100% / 6), #0000 0), ","linear-gradient(#0000 calc(3 * 100% / 6), #ccc 0 calc(5 * 100% / 6), #0000 0)"].join(""),backgroundSize:"10px 400%",backgroundRepeat:"no-repeat",animation:"ag-charts-loading-matrix 1s infinite linear"}),a=createElement("p",{marginTop:"1em"});a.innerText=t;const o=createElement("div",`${DEFAULT_OVERLAY_CLASS}__loading-background`,{position:"absolute",inset:"0",opacity:"0.5",zIndex:"-1"}),c=createElement("style");return c.innerText=["@keyframes ag-charts-loading { from { opacity: 0 } to { opacity: 1 } }","@keyframes ag-charts-loading-matrix {","0% { background-position: 0% 0%, 50% 0%, 100% 0%; }","100% { background-position: 0% 100%, 50% 100%, 100% 100%; }","}"].join(" "),n.replaceChildren(c,r,a,o),n}var CROSS_FILTER_MARKER_FILL_OPACITY_FACTOR=.25,CROSS_FILTER_MARKER_STROKE_OPACITY_FACTOR=.125,SeriesNodeEvent=class{constructor(t,e,{datum:i},s){this.type=t,this.event=e,this.datum=i,this.seriesId=s.id}},SeriesGroupingChangedEvent=class{constructor(t,e,i){this.series=t,this.seriesGrouping=e,this.oldGrouping=i,this.type="groupingChanged"}},Series=class extends Observable{constructor(t){super(),this.destroyFns=[],this.usesPlacedLabels=!1,this.seriesGrouping=void 0,this.NodeEvent=SeriesNodeEvent,this.internalId=createId(this),this.contentGroup=new TranslatableGroup({name:`${this.internalId}-content`,zIndex:1}),this.highlightGroup=new TranslatableGroup({name:`${this.internalId}-highlight`,zIndex:1}),this.annotationGroup=new TranslatableGroup({name:`${this.internalId}-annotation`}),this.labelGroup=new TranslatableGroup({name:`${this.internalId}-series-labels`}),this.axes={x:void 0,y:void 0},this.directions=["x","y"],this.nodeDataRefresh=!0,this.moduleMap=new ModuleMap,this.datumCallbackCache=new Map,this.connectsToYAxis=!1,this._declarationOrder=-1,this.seriesListeners=new Listeners,this._pickNodeCache=new LRUCache;const{moduleCtx:e,pickModes:i,directionKeys:s={},directionNames:n={},canHaveAxes:r=!1,usesPlacedLabels:a=!1}=t;this.ctx=e,this.directionKeys=s,this.directionNames=n,this.canHaveAxes=r,this.usesPlacedLabels=a,this.highlightGroup=new TranslatableGroup({name:`${this.internalId}-highlight`}),this.highlightNode=this.highlightGroup.appendChild(new Group({name:"highlightNode",zIndex:0})),this.highlightLabel=this.highlightGroup.appendChild(new Group({name:"highlightLabel",zIndex:10})),this.pickModes=i}get pickModeAxis(){return"main"}get id(){return this.properties?.id??this.internalId}get type(){return this.constructor.type??""}get focusable(){return!0}get data(){return this._data??this._chartData}set visible(t){this.properties.visible=t,this.ctx.legendManager.toggleItem({enabled:t,seriesId:this.id}),this.ctx.legendManager.update(),this.visibleMaybeChanged()}get visible(){return this.ctx.legendManager.getSeriesEnabled(this.id)??this.properties.visible}get hasData(){return this.data!=null&&this.data.length>0}get tooltipEnabled(){return this.properties.tooltip?.enabled??!1}onDataChange(){this.nodeDataRefresh=!0,this._pickNodeCache.clear()}setOptionsData(t){this._data=t,this.onDataChange()}setChartData(t){this._chartData=t,this.data===t&&this.onDataChange()}onSeriesGroupingChange(t,e){const{internalId:i,type:s,visible:n}=this;t&&this.ctx.seriesStateManager.deregisterSeries(this),e&&this.ctx.seriesStateManager.registerSeries({internalId:i,type:s,visible:n,seriesGrouping:e}),this.fireEvent(new SeriesGroupingChangedEvent(this,e,t))}getBandScalePadding(){return{inner:1,outer:0}}attachSeries(t,e,i){t.appendChild(this.contentGroup),e.appendChild(this.highlightGroup),e.appendChild(this.labelGroup),i?.appendChild(this.annotationGroup)}detachSeries(t,e,i){t?.removeChild(this.contentGroup),e.removeChild(this.highlightGroup),e.removeChild(this.labelGroup),i?.removeChild(this.annotationGroup)}setSeriesIndex(t){return t===this._declarationOrder?!1:(this._declarationOrder=t,this.contentGroup.zIndex=[1,t,0],this.highlightGroup.zIndex=[1,t,1],this.labelGroup.zIndex=[1,t,2],this.annotationGroup.zIndex=t,!0)}renderToOffscreenCanvas(){return!1}addEventListener(t,e){return super.addEventListener(t,e)}addListener(t,e){return this.seriesListeners.addListener(t,e)}dispatch(t,e){this.seriesListeners.dispatch(t,e)}addChartEventListeners(){}destroy(){this.destroyFns.forEach(t=>t()),this.destroyFns=[],this.resetDatumCallbackCache(),this.ctx.seriesStateManager.deregisterSeries(this)}getDirectionValues(t,e){const i=this.resolveKeyDirection(t),s=e?.[i],n=[];if(!s)return n;const r=(...a)=>{for(const o of a)Array.isArray(o)?r(...o):typeof o=="object"?r(...Object.values(o)):n.push(o)};return r(...s.map(a=>this.properties[a])),n}getKeys(t){return this.getDirectionValues(t,this.directionKeys)}getKeyProperties(t){return this.directionKeys[this.resolveKeyDirection(t)]??[]}getNames(t){return this.getDirectionValues(t,this.directionNames)}resolveKeyDirection(t){return t}getDomain(t){const e=this.getSeriesDomain(t),i=this.moduleMap.mapModules(s=>s.getDomain(t)).flat();return i.length!==0?e.concat(i):e}getRange(t,e){return this.getSeriesRange(t,e)}getVisibleItems(t,e,i){return 1/0}getGradientFillOptions({bounds:t},e){const{axes:i}=this,s=i.x,n=i.y,r=s?.range??[0,1],a=n?.range??[0,1],[o,c]=findMinMax(r),[l,h]=findMinMax(a),u=c-o,d=h-l;let g=[0,1];return t==="series"?g=this.getSeriesDomain("y"):t==="axes"&&(g=n?.scale.domain??[0,1]),{bbox:new BBox(o,l,u,d),domain:g,defaultColorRange:e}}markNodeDataDirty(){this.nodeDataRefresh=!0,this._pickNodeCache.clear(),this.visibleMaybeChanged()}visibleMaybeChanged(){this.ctx.seriesStateManager.updateSeries(this)}getOpacity(){const{dimOpacity:e=1,enabled:i=!0}=this.properties.highlightStyle.series;if(!i||e===1)return 1;switch(this.isItemIdHighlighted()){case 0:case 1:return 1;case 2:default:return e}}getStrokeWidth(t){const{strokeWidth:e,enabled:i=!0}=this.properties.highlightStyle.series;if(!i||e===void 0)return t;switch(this.isItemIdHighlighted()){case 1:return e;case 0:case 2:return t}}isItemIdHighlighted(){const t=this.ctx.highlightManager?.getActiveHighlight()?.series;return t==null?0:t!==this?2:1}getModuleTooltipParams(){return this.moduleMap.mapModules(t=>t.getTooltipParams()).reduce((t,e)=>Object.assign(t,e),{})}pickNode(t,e,i=!1){const{pickModes:s,pickModeAxis:n,visible:r,contentGroup:a}=this;if(!r||!a.visible||e==="highlight"&&!this.properties.highlight.enabled||e==="highlight-tooltip"&&!this.properties.highlight.enabled)return;let o=1/0;if(e==="tooltip"||e==="highlight-tooltip"){const{tooltip:d}=this.properties;o=typeof d.range=="number"?d.range:1/0,i||(i=d.range==="exact")}else if(e==="event"||e==="context-menu"){const{nodeClickRange:d}=this.properties;o=typeof d=="number"?d:1/0,i||(i=d==="exact")}const c=s.filter(d=>!i||d===0),{x:l,y:h}=t,u=JSON.stringify({x:l,y:h,maxDistance:o,selectedPickModes:c});if(this._pickNodeCache.has(u))return this._pickNodeCache.get(u);for(const d of c){let g;switch(d){case 0:g=this.pickNodeExactShape(t);break;case 1:g=this.pickNodeClosestDatum(t);break;case 2:g=n!=null?this.pickNodeMainAxisFirst(t,n==="main-category"):void 0;break}if(g&&g.distance<=o)return this._pickNodeCache.set(u,{pickMode:d,match:g.datum,distance:g.distance})}return this._pickNodeCache.set(u,void 0)}pickNodeExactShape(t){const e=this.contentGroup.pickNode(t.x,t.y);if(e&&e.datum.missing!==!0)return{datum:e.datum,distance:0}}pickNodeClosestDatum(t){throw new Error("AG Charts - Series.pickNodeClosestDatum() not implemented")}pickNodeNearestDistantObject(t,e){const i=nearestSquared(t.x,t.y,e);if(i.nearest!==void 0&&i.nearest.datum.missing!==!0)return{datum:i.nearest.datum,distance:Math.sqrt(i.distanceSquared)}}pickNodeMainAxisFirst(t,e){throw new Error("AG Charts - Series.pickNodeMainAxisFirst() not implemented")}getLabelData(){return[]}updatePlacedLabelData(t){}fireNodeClickEvent(t,e){this.fireEvent(new this.NodeEvent("nodeClick",t,e,this))}fireNodeDoubleClickEvent(t,e){this.fireEvent(new this.NodeEvent("nodeDoubleClick",t,e,this))}createNodeContextMenuActionEvent(t,e){return new this.NodeEvent("nodeContextMenuAction",t,e,this)}onLegendInitialState(t,e){const{visible:i=!0,itemId:s,legendItemName:n}=e??{};this.toggleSeriesItem(i,t,s,n)}onLegendItemClick(t){const{enabled:e,itemId:i,series:s,legendType:n}=t,r="legendItemName"in this.properties?this.properties.legendItemName:void 0,a="legendItemKey"in this.properties?this.properties.legendItemKey:void 0,o=r!=null&&r===t.legendItemName;(s.id===this.id||o||a!=null)&&this.toggleSeriesItem(e,n,i,r,t)}onLegendItemDoubleClick(t){const{enabled:e,itemId:i,series:s,numVisibleItems:n,legendType:r}=t,a="legendItemName"in this.properties?this.properties.legendItemName:void 0,o="legendItemKey"in this.properties?this.properties.legendItemKey:void 0,c=a!=null&&a===t.legendItemName;s.id===this.id||c||o!=null?this.toggleSeriesItem(!0,r,i,a,t):e&&n===1?this.toggleSeriesItem(!0,r,void 0,a):this.toggleSeriesItem(!1,r,void 0,a)}toggleSeriesItem(t,e,i,s,n){const r=this.id;(t||e!=="category")&&(this.visible=t),this.nodeDataRefresh=!0,this._pickNodeCache.clear();const a={type:"seriesVisibilityChange",seriesId:r,itemId:i,legendItemName:n?.legendItemName??s,visible:t};this.fireEvent(a),this.ctx.legendManager.toggleItem({enabled:t,seriesId:r,itemId:i,legendItemName:s})}isEnabled(){return this.visible}getModuleMap(){return this.moduleMap}createModuleContext(){return{...this.ctx,series:this}}getLabelText(t,e,i=formatValue){return t.formatter?this.ctx.callbackCache.call(t.formatter,{seriesId:this.id,...e})??i(e.value):i(e.value)}getMarkerStyle(t,e,i=t.getStyle()){const s={size:e.datum.point?.size??0},n=mergeDefaults(s,i);if(t.itemStyler){const r=this.ctx.callbackCache.call(t.itemStyler,{seriesId:this.id,...n,...e,datum:e.datum.datum});return mergeDefaults(r,n)}return n}updateMarkerStyle(t,e,i,s=e.getStyle(),{applyTranslation:n=!0,selected:r=!0}={}){const{point:a}=i.datum,o=this.getMarkerStyle(e,i,s),c=this.visible&&o.size>0&&a&&!isNaN(a.x)&&!isNaN(a.y);if(n?t.setProperties({visible:c,...o,translationX:a?.x,translationY:a?.y}):t.setProperties({visible:c,...o}),r||(t.fillOpacity*=CROSS_FILTER_MARKER_FILL_OPACITY_FACTOR,t.strokeOpacity*=CROSS_FILTER_MARKER_STROKE_OPACITY_FACTOR),typeof e.shape=="function"&&!t.dirtyPath){t.path.clear(!0),t.updatePath(),t.checkPathDirty();const l=t.getBBox();if(a!==void 0&&l.isFinite()){const h=l.computeCenter(),[u,d]=["x","y"].map(g=>(o.strokeWidth??0)+Math.abs(h[g]-a[g]));a.focusSize=Math.max(l.width+u,l.height+d)}}}get nodeDataDependencies(){return this._nodeDataDependencies??{seriesRectWidth:NaN,seriesRectHeight:NaN}}checkResize(t){const{width:e,height:i}=t??{width:NaN,height:NaN},s=t?{seriesRectWidth:e,seriesRectHeight:i}:void 0,n=jsonDiff(this.nodeDataDependencies,s)!=null;return n&&(this._nodeDataDependencies=s,this.markNodeDataDirty()),n}pickFocus(t){}resetDatumCallbackCache(){this.datumCallbackCache.clear()}cachedDatumCallback(t,e){const{datumCallbackCache:i}=this,s=i.get(t);if(s!=null)return s;const n=e();return i.set(t,n),n}};__decorateClass([ActionOnSet({changeValue:function(t,e){this.onSeriesGroupingChange(e,t)}})],Series.prototype,"seriesGrouping",2);function linearRoot(t,e){const i=-e/t;return t!==0&&i>=0&&i<=1?[i]:[]}function quadraticRoots(t,e,i){if(t===0)return linearRoot(e,i);const s=e*e-4*t*i,n=[];if(s===0){const r=-e/(2*t);r>=0&&r<=1&&n.push(r)}else if(s>0){const r=Math.sqrt(s),a=(-e-r)/(2*t),o=(-e+r)/(2*t);a>=0&&a<=1&&n.push(a),o>=0&&o<=1&&n.push(o)}return n}function cubicRoots(t,e,i,s){if(t===0)return quadraticRoots(e,i,s);const n=e/t,r=i/t,a=s/t,o=(3*r-n*n)/9,c=(9*n*r-27*a-2*n*n*n)/54,l=o*o*o+c*c,h=1/3,u=[];if(l>=0){const d=Math.sqrt(l),g=Math.sign(c+d)*Math.pow(Math.abs(c+d),h),p=Math.sign(c-d)*Math.pow(Math.abs(c-d),h),f=Math.abs(Math.sqrt(3)*(g-p)/2),y=-h*n+(g+p);if(y>=0&&y<=1&&u.push(y),f===0){const m=-h*n-(g+p)/2;m>=0&&m<=1&&u.push(m)}}else{const d=Math.acos(c/Math.sqrt(-o*o*o)),g=h*n,p=2*Math.sqrt(-o),f=p*Math.cos(h*d)-g,y=p*Math.cos(h*(d+2*Math.PI))-g,m=p*Math.cos(h*(d+4*Math.PI))-g;f>=0&&f<=1&&u.push(f),y>=0&&y<=1&&u.push(y),m>=0&&m<=1&&u.push(m)}return u}function segmentIntersection(t,e,i,s,n,r,a,o){const c=(i-t)*(o-r)-(s-e)*(a-n);if(c===0)return 0;const l=((a-n)*(e-r)-(t-n)*(o-r))/c,h=((i-t)*(e-r)-(s-e)*(t-n))/c;return l>=0&&l<=1&&h>=0&&h<=1?1:0}function cubicSegmentIntersections(t,e,i,s,n,r,a,o,c,l,h,u){let d=0;const g=l-u,p=h-c,f=c*(u-l)-l*(h-c),y=bezierCoefficients(t,i,n,a),m=bezierCoefficients(e,s,r,o),x=g*y[0]+p*m[0],b=g*y[1]+p*m[1],v=g*y[2]+p*m[2],I=g*y[3]+p*m[3]+f,S=cubicRoots(x,b,v,I);for(const D of S){const w=D*D,L=D*w,A=y[0]*L+y[1]*w+y[2]*D+y[3],k=m[0]*L+m[1]*w+m[2]*D+m[3];let T;c===h?T=(k-l)/(u-l):T=(A-c)/(h-c),T>=0&&T<=1&&d++}return d}function bezierCoefficients(t,e,i,s){return[-t+3*e-3*i+s,3*t-6*e+3*i,-3*t+3*e,t]}function arcIntersections(t,e,i,s,n,r,a,o,c,l){if(isNaN(t)||isNaN(e))return 0;r&&([n,s]=[s,n]);const h=(l-o)/(c-a),u=o-h*a,d=Math.pow(h,2)+1,g=2*(h*(u-e)-t),p=Math.pow(t,2)+Math.pow(u-e,2)-Math.pow(i,2),f=Math.pow(g,2)-4*d*p;if(f<0)return 0;const y=(-g+Math.sqrt(f))/2/d,m=(-g-Math.sqrt(f))/2/d;let x=0;return[y,m].forEach(b=>{if(!(b>=Math.min(a,c)&&b<=Math.max(a,c)))return;const I=h*b+u,S=b-t,D=I-e,w=Math.atan2(D,S);isBetweenAngles(w,s,n)&&x++}),x}function evaluateBezier(t,e,i,s,n){return(1-n)**3*t+3*(1-n)**2*n*e+3*(1-n)*n**2*i+n**3*s}function calculateDerivativeExtrema(t,e,i,s){const n=-t+3*e-3*i+s,r=3*t-6*e+3*i,a=-3*t+3*e;if(n===0){if(r!==0){const c=-a/r;if(c>0&&c<1)return[c]}return[]}const o=r*r-4*n*a;if(o>=0){const c=Math.sqrt(o),l=(-r+c)/(2*n),h=(-r-c)/(2*n);return[l,h].filter(u=>u>0&&u<1)}return[]}function calculateDerivativeExtremaXY(t,e,i,s,n,r,a,o){const c=calculateDerivativeExtrema(t,i,n,a),l=calculateDerivativeExtrema(e,s,r,o);return[...c,...l]}var ExtendedPath2D=class{constructor(){this.path2d=new Path2D,this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],this.openedPath=!1,this.closedPath=!1}isEmpty(){return this.commands.length===0}isDirty(){return this.closedPath!==this.previousClosedPath||this.previousCommands.length!==this.commands.length||this.previousParams.length!==this.params.length||this.previousCommands.toString()!==this.commands.toString()||this.previousParams.toString()!==this.params.toString()}getPath2D(){return this.path2d}moveTo(t,e){this.openedPath=!0,this.path2d.moveTo(t,e),this.commands.push(0),this.params.push(t,e)}lineTo(t,e){this.openedPath?(this.path2d.lineTo(t,e),this.commands.push(1),this.params.push(t,e)):this.moveTo(t,e)}rect(t,e,i,s){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+s),this.lineTo(t,e+s),this.closePath()}roundRect(t,e,i,s,n){n=Math.min(n,i/2,s/2),this.moveTo(t,e+n),this.arc(t+n,e+n,n,Math.PI,1.5*Math.PI),this.lineTo(t+n,e),this.lineTo(t+i-n,e),this.arc(t+i-n,e+n,n,1.5*Math.PI,2*Math.PI),this.lineTo(t+i,e+n),this.lineTo(t+i,e+s-n),this.arc(t+i-n,e+s-n,n,0,Math.PI/2),this.lineTo(t+i-n,e+s),this.lineTo(t+n,e+s),this.arc(t+ +n,e+s-n,n,Math.PI/2,Math.PI),this.lineTo(t,e+s-n),this.closePath()}arc(t,e,i,s,n,r){this.openedPath=!0,this.path2d.arc(t,e,i,s,n,r),this.commands.push(2),this.params.push(t,e,i,s,n,r?1:0)}cubicCurveTo(t,e,i,s,n,r){this.openedPath||this.moveTo(t,e),this.path2d.bezierCurveTo(t,e,i,s,n,r),this.commands.push(3),this.params.push(t,e,i,s,n,r)}closePath(){this.openedPath&&(this.path2d.closePath(),this.commands.push(4),this.openedPath=!1,this.closedPath=!0)}clear(t){t&&(this.previousCommands=this.commands,this.previousParams=this.params,this.previousClosedPath=this.closedPath),this.path2d=new Path2D,this.openedPath=!1,this.closedPath=!1,this.commands=[],this.params=[]}isPointInPath(t,e){const i=this.commands,s=this.params,n=i.length,r=-1e4,a=-1e4;let o=NaN,c=NaN,l=0,h=0,u=0;for(let d=0,g=0;d({x:e,y:i})){const e=[],{commands:i,params:s}=this,n=(a,...o)=>{e.push(a);for(let c=0;c{i=Math.min(g,i),s=Math.min(d,s),n=Math.max(d,n),r=Math.max(g,r),p&&([a,o]=[d,g])};let u=0;for(const d of t)switch(d){case 0:h(e[u++],e[u++],!0),[c,l]=[a,o];break;case 1:h(e[u++],e[u++],!0);break;case 3:{const g=e[u++],p=e[u++],f=e[u++],y=e[u++],m=e[u++],x=e[u++];h(m,x,!0),calculateDerivativeExtremaXY(a,o,g,p,f,y,m,x).forEach(v=>{const I=evaluateBezier(a,g,f,m,v),S=evaluateBezier(o,p,y,x,v);h(I,S)});break}case 2:{const g=e[u++],p=e[u++],f=e[u++];let y=normalizeAngle360(e[u++]),m=normalizeAngle360(e[u++]);e[u++]&&([y,m]=[m,y]);const b=(I,S)=>{const D=g+f*Math.cos(I),w=p+f*Math.sin(I);h(D,w,S)};b(y),b(m,!0);const v=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const I of v)(ym&&(y<=I||I<=m))&&b(I);break}case 4:[a,o]=[c,l];break}return new BBox(s,i,n-s,r-i)}};function ScenePathChangeDetection(t){const{changeCb:e,convertor:i}=t??{};return SceneChangeDetection({type:"path",convertor:i,changeCb:e})}var Path=class extends Shape{constructor(){super(...arguments),this.path=new ExtendedPath2D,this._clipX=NaN,this._clipY=NaN,this.clip=!1,this._dirtyPath=!0,this.lastPixelRatio=NaN}set clipX(t){this._clipX=t,this.dirtyPath=!0}set clipY(t){this._clipY=t,this.dirtyPath=!0}set dirtyPath(t){this._dirtyPath!==t&&(this._dirtyPath=t,t&&this.markDirty())}get dirtyPath(){return this._dirtyPath}checkPathDirty(){this._dirtyPath||(this.dirtyPath=this.path.isDirty()||(this.fillShadow?.isDirty()??!1)||(this._clipPath?.isDirty()??!1))}isPointInPath(t,e){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(t,e)}distanceSquared(t,e){return this.distanceSquaredTransformedPoint(t,e)}svgPathData(t){return this.updatePathIfDirty(),this.path.toSVG(t)}distanceSquaredTransformedPoint(t,e){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(t,e)?0:this.path.distanceSquared(t,e)}isDirtyPath(){return!1}updatePath(){}updatePathIfDirty(){(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1)}preRender(t){return t.devicePixelRatio!==this.lastPixelRatio&&(this.dirtyPath=!0),this.lastPixelRatio=t.devicePixelRatio,this.updatePathIfDirty(),super.preRender(t,this.path.commands.length)}render(t){const{ctx:e}=t;if(this.clip&&!isNaN(this._clipX)&&!isNaN(this._clipY)){e.save();const i=this.strokeWidth/2;this._clipPath??(this._clipPath=new ExtendedPath2D),this._clipPath.clear(),this._clipPath.rect(-i,-i,this._clipX+i,this._clipY+i+i),e.clip(this._clipPath?.getPath2D()),this._clipX>0&&this._clipY>0&&this.drawPath(e),e.restore()}else this._clipPath=void 0,this.drawPath(e);this.fillShadow?.markClean(),super.render(t)}drawPath(t){this.fillStroke(t,this.path.getPath2D())}toSVG(){if(!this.visible)return;const t=createSvgElement("path");return t.setAttribute("d",this.svgPathData()),this.applySvgFillAttributes(t),this.applySvgStrokeAttributes(t),{elements:[t]}}};Path.className="Path",__decorateClass([ScenePathChangeDetection()],Path.prototype,"clip",2),__decorateClass([ScenePathChangeDetection()],Path.prototype,"clipX",1),__decorateClass([ScenePathChangeDetection()],Path.prototype,"clipY",1);var FocusIndicator=class{constructor(t){this.swapChain=t,this.div=createElement("div"),this.svg=createSvgElement("svg"),this.outerPath=createSvgElement("path"),this.innerPath=createSvgElement("path"),this.svg.append(this.outerPath),this.svg.append(this.innerPath),this.outerPath.classList.add("ag-charts-focus-svg-outer-path"),this.innerPath.classList.add("ag-charts-focus-svg-inner-path"),this.element=createElement("div","ag-charts-focus-indicator"),this.element.ariaHidden="true",this.element.append(this.svg),this.swapChain.addListener("swap",e=>this.onSwap(e))}clear(){}update(t,e,i){if(e!=null)if(t instanceof Path){const s=(r,a)=>{let{x:o,y:c}=Transformable.toCanvasPoint(t,r,a);return o-=e.x??0,c-=e.y??0,{x:o,y:c}},n=t.svgPathData(s);this.outerPath.setAttribute("d",n),this.innerPath.setAttribute("d",n),this.show(this.svg)}else{let s;if(i){const n=Math.max(t.x-e.x,0),r=Math.max(t.y-e.y,0),a=Math.min(t.x+t.width-e.x,e.width),o=Math.min(t.y+t.height-e.y,e.height);s=new BBox(n,r,a-n,o-r)}else s=new BBox(t.x-e.x,t.y-e.y,t.width,t.height);setElementBBox(this.div,s),this.show(this.div)}}onSwap(t){t!==this.element.parentElement&&(this.element.remove(),t.appendChild(this.element),this.overrideFocusVisible(this.focusVisible))}show(t){this.element.innerHTML="",this.element.append(t)}overrideFocusVisible(t){this.focusVisible=t;const e={true:"1",false:"0",undefined:""};this.element.parentElement?.style.setProperty("opacity",e[`${t}`])}isFocusVisible(){const t=this.element.parentElement;return t!=null&&getWindow().getComputedStyle(t).opacity==="1"}},FocusSwapChain=class{constructor(t,e,i,s){this.label1=t,this.label2=e,this.hasFocus=!1,this.skipDispatch=!1,this.listeners={blur:[],focus:[],swap:[]},this.onBlur=n=>(setElementStyle(n.target,"pointer-events",void 0),!this.skipDispatch&&this.dispatch("blur",n)),this.onFocus=n=>(setElementStyle(n.target,"pointer-events","auto"),!this.skipDispatch&&this.dispatch("focus",n)),setAttribute(this.label1,"id",`${i}-label1`),setAttribute(this.label2,"id",`${i}-label2`),setElementStyle(this.label1,"display","none"),setElementStyle(this.label2,"display","none"),this.activeAnnouncer=this.createAnnouncer(s),this.inactiveAnnouncer=this.createAnnouncer(s),setAttribute(this.activeAnnouncer,"tabindex",0),this.label2.insertAdjacentElement("afterend",this.activeAnnouncer),this.label2.insertAdjacentElement("afterend",this.inactiveAnnouncer),this.swap("")}createAnnouncer(t){const e=createElement("div");return e.role=t,e.className="ag-charts-swapchain",e.addEventListener("blur",this.onBlur),e.addEventListener("focus",this.onFocus),e}destroy(){for(const t of[this.activeAnnouncer,this.inactiveAnnouncer])t.removeEventListener("blur",this.onBlur),t.removeEventListener("focus",this.onFocus),t.remove()}focus(t){this.focusOptions=t,this.activeAnnouncer.focus(t),this.focusOptions=void 0}update(t){this.skipDispatch=!0,this.swap(t),this.hasFocus&&this.activeAnnouncer.focus(this.focusOptions),this.skipDispatch=!1}addListener(t,e){this.listeners[t].push(e),t==="swap"&&e(this.activeAnnouncer)}dispatch(t,e){t==="focus"?this.hasFocus=!0:t==="blur"&&(this.hasFocus=!1),this.listeners[t].forEach(i=>i(e))}swap(t){const e=this.activeAnnouncer.tabIndex;this.label2.textContent=t,[this.inactiveAnnouncer,this.activeAnnouncer]=[this.activeAnnouncer,this.inactiveAnnouncer],[this.label1,this.label2]=[this.label2,this.label1],setAttributes(this.inactiveAnnouncer,{"aria-labelledby":this.label1.id,"aria-hidden":!0,tabindex:void 0}),setAttributes(this.activeAnnouncer,{"aria-labelledby":this.label1.id,"aria-hidden":!1,tabindex:e}),this.dispatch("swap",this.activeAnnouncer)}},KEY_BINDINGS={arrowdown:{bindings:[{code:"ArrowDown"}]},arrowleft:{bindings:[{code:"ArrowLeft"}]},arrowright:{bindings:[{code:"ArrowRight"}]},arrowup:{bindings:[{code:"ArrowUp"}]},delete:{bindings:[{key:"Backspace"},{key:"Delete"}],activatesFocusIndicator:!1},redo:{bindings:[{key:"y",ctrlOrMeta:!0},{key:"z",ctrlOrMeta:!0,shift:!0}],activatesFocusIndicator:!1},undo:{bindings:[{key:"z",ctrlOrMeta:!0}],activatesFocusIndicator:!1},submit:{bindings:[{key:"Enter"},{code:"Enter"},{code:"Space"}]},zoomin:{bindings:[{key:"+"},{code:"ZoomIn"},{code:"Add"}],activatesFocusIndicator:!1},zoomout:{bindings:[{key:"-"},{code:"ZoomOut"},{code:"Substract"}],activatesFocusIndicator:!1}};function matchesKeyBinding(t,e){for(const i of e)if("code"in i){if(i.code===t.code)return!0}else if(i.key===t.key&&(i.shift===void 0||i.shift===t.shiftKey)&&(i.ctrlOrMeta===void 0||i.ctrlOrMeta===t.ctrlKey||i.ctrlOrMeta===t.metaKey))return!0;return!1}function mapKeyboardEventToAction(t){for(const[e,{activatesFocusIndicator:i=!0,bindings:s}]of Object.entries(KEY_BINDINGS))if(matchesKeyBinding(t,s))return{name:e,activatesFocusIndicator:i}}function computeCenter(t,e,i){const s=getDatumRefPoint(t,i.datum);if(s!=null)return{x:s.canvasX,y:s.canvasY};const n=i.bounds;if(n!=null){if(n instanceof BBox){const{x:r,y:a}=n.computeCenter();return{x:e.x+r,y:e.y+a}}return Transformable.toCanvas(n).computeCenter()}}function getPickedFocusBBox({bounds:t}){return t instanceof BBox?t:t!=null?Transformable.toCanvas(t):BBox.NaN}function makeKeyboardPointerEvent(t,e,i){const{x:s,y:n}=computeCenter(t,e,i)??{};if(s!==void 0&&n!==void 0)return{type:"keyboard",canvasX:s,canvasY:n}}function calculatePlacement(t,e,i,s){let{top:n,right:r,bottom:a,left:o,width:c,height:l}=s;return o!=null?c!=null?r=i.width-o+c:r!=null&&(c=i.width-o-r):r!=null&&c!=null&&(o=i.width-r-c),n!=null?l!=null?a=i.height-n-l:a!=null&&(l=i.height-a-n):a!=null&&l!=null&&(n=i.height-a-l),c==null?l==null?(c=t,l=e):c=Math.ceil(t*l/e):l==null&&(l=Math.ceil(e*c/t)),o==null&&(r==null?o=Math.floor((i.width-c)/2):o=i.width-r-c),n==null&&(a==null?n=Math.floor((i.height-l)/2):n=i.height-l-a),{x:o,y:n,width:c,height:l}}var element=null;function sanitizeHtml(t){if(t!=null)return t===""?"":(element??(element=createElement("div")),element.textContent=String(t),element.innerHTML)}function drawMarkerUnitPolygon(t,e){const{path:i,size:s}=t,{x:n,y:r}=t;i.clear();let a=!1;for(const[o,c]of e){const l=n+(o-.5)*s,h=r+(c-.5)*s;a?i.lineTo(l,h):i.moveTo(l,h),a=!0}i.closePath()}var MARKER_SHAPES={circle({path:t,x:e,y:i,size:s}){const n=s/2;t.clear(),t.arc(e,i,n,0,Math.PI*2),t.closePath()},cross(t){drawMarkerUnitPolygon(t,[[.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(t){drawMarkerUnitPolygon(t,[[.5,0],[1,.5],[.5,1],[0,.5]])},heart({path:t,x:e,y:i,size:s}){const n=s/4;i=i+n/2,t.clear(),t.arc(e-n,i-n,n,toRadians(130),toRadians(330)),t.arc(e+n,i-n,n,toRadians(220),toRadians(50)),t.lineTo(e,i+n),t.closePath()},pin({path:t,x:e,y:i,size:s}){t.moveTo(e+(.15625-.5)*s,i+(.34375-.5)*s),t.cubicCurveTo(e+(.15625-.5)*s,i+(.151491-.5)*s,e+(.307741-.5)*s,i+(0-.5)*s,e+(.5-.5)*s,i+(0-.5)*s),t.cubicCurveTo(e+(.692259-.5)*s,i+(0-.5)*s,e+(.84375-.5)*s,i+(.151491-.5)*s,e+(.84375-.5)*s,i+(.34375-.5)*s),t.cubicCurveTo(e+(.84375-.5)*s,i+(.493824-.5)*s,e+(.784625-.5)*s,i+(.600181-.5)*s,e+(.716461-.5)*s,i+(.695393-.5)*s),t.cubicCurveTo(e+(.699009-.5)*s,i+(.719769-.5)*s,e+(.681271-.5)*s,i+(.743104-.5)*s,e+(.663785-.5)*s,i+(.766105-.5)*s),t.cubicCurveTo(e+(.611893-.5)*s,i+(.834367-.5)*s,e+(.562228-.5)*s,i+(.899699-.5)*s,e+(.528896-.5)*s,i+(.980648-.5)*s),t.cubicCurveTo(e+(.524075-.5)*s,i+(.992358-.5)*s,e+(.512663-.5)*s,i+(1-.5)*s,e+(.5-.5)*s,i+(1-.5)*s),t.cubicCurveTo(e+(.487337-.5)*s,i+(1-.5)*s,e+(.475925-.5)*s,i+(.992358-.5)*s,e+(.471104-.5)*s,i+(.980648-.5)*s),t.cubicCurveTo(e+(.487337-.5)*s,i+(1-.5)*s,e+(.475925-.5)*s,i+(.992358-.5)*s,e+(.471104-.5)*s,i+(.980648-.5)*s),t.cubicCurveTo(e+(.437772-.5)*s,i+(.899699-.5)*s,e+(.388107-.5)*s,i+(.834367-.5)*s,e+(.336215-.5)*s,i+(.766105-.5)*s),t.cubicCurveTo(e+(.318729-.5)*s,i+(.743104-.5)*s,e+(.300991-.5)*s,i+(.719769-.5)*s,e+(.283539-.5)*s,i+(.695393-.5)*s),t.cubicCurveTo(e+(.215375-.5)*s,i+(.600181-.5)*s,e+(.15625-.5)*s,i+(.493824-.5)*s,e+(.15625-.5)*s,i+(.34375-.5)*s),t.closePath()},plus(t){drawMarkerUnitPolygon(t,[[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:t,x:e,y:i,size:s,pixelRatio:n}){const r=s/2;t.clear(),t.moveTo(align(n,e-r),align(n,i-r)),t.lineTo(align(n,e+r),align(n,i-r)),t.lineTo(align(n,e+r),align(n,i+r)),t.lineTo(align(n,e-r),align(n,i+r)),t.closePath()},star({path:t,x:e,y:i,size:s}){const r=s/2,a=r/2,o=Math.PI/2;for(let c=0;c<5*2;c++){const l=c%2===0?r:a,h=c*Math.PI/5-o,u=e+Math.cos(h)*l,d=i+Math.sin(h)*l;t.lineTo(u,d)}t.closePath()},triangle(t){drawMarkerUnitPolygon(t,[[.5,0],[1,.87],[0,.87]])}},InternalMarker=class extends Path{constructor(){super(...arguments),this.shape="square",this.x=0,this.y=0,this.size=12}updatePath(){const{path:t,shape:e,x:i,y:s,size:n}=this,r=this.layerManager?.canvas?.pixelRatio??1,a=Marker.anchor(e),o={path:t,x:i-(a.x-.5)*n,y:s-(a.y-.5)*n,size:n,pixelRatio:r};t.clear(),typeof e=="string"?MARKER_SHAPES[e](o):typeof e=="function"&&e(o)}computeBBox(){const{x:t,y:e,size:i}=this,s=Marker.anchor(this.shape);return new BBox(t-i*s.x,e-i*s.y,i,i)}executeFill(t,e){if(e)return super.executeFill(t,e)}executeStroke(t,e){if(e)return super.executeStroke(t,e)}};__decorateClass([ScenePathChangeDetection()],InternalMarker.prototype,"shape",2),__decorateClass([ScenePathChangeDetection()],InternalMarker.prototype,"x",2),__decorateClass([ScenePathChangeDetection()],InternalMarker.prototype,"y",2),__decorateClass([ScenePathChangeDetection({convertor:Math.abs})],InternalMarker.prototype,"size",2);var Marker=class extends Rotatable(Scalable(Translatable(InternalMarker))){static anchor(t){return t==="pin"?{x:.5,y:1}:typeof t=="function"&&"anchor"in t?t.anchor:{x:.5,y:.5}}constructor(t){super(t),t?.shape!=null&&(this.shape=t.shape)}};function legendSymbolSvg(t,e,i=e*(5/3)){const s=new Group,n=Math.min(t.marker.strokeWidth,2),r=Math.min(t.line?.strokeWidth??0,2),a=Math.max(t.marker.enabled===!1?0:e,t.line==null?0:i),o=Math.max(t.marker.enabled===!1?0:e,r);if(t.line!=null){const{stroke:c,strokeOpacity:l,lineDash:h}=t.line,u=new Line;u.x1=0,u.y1=o/2,u.x2=a,u.y2=o/2,u.stroke=c,u.strokeOpacity=l,u.strokeWidth=r,u.lineDash=h,s.append(u)}if(t.marker.enabled!==!1){const{shape:c,fill:l,fillOpacity:h,stroke:u,strokeOpacity:d,lineDash:g,lineDashOffset:p}=t.marker,f=new Marker;f.shape=c??"square",f.size=e,f.fill=l,f.fillOpacity=h,f.stroke=u,f.strokeOpacity=d,f.strokeWidth=n,f.lineDash=g,f.lineDashOffset=p;const y=Marker.anchor(c),m=a/2+(y.x-.5)*e,x=o/2+(y.y-.5)*e,b=e/(e+n);f.x=0,f.y=0,f.translationX=m,f.translationY=x,f.scalingX=b,f.scalingY=b,s.append(f)}return Group.toSVG(s,a,o)}var M=.1,K=200,C=12,DELTA=.5,SpringAnimation=class extends Listeners{constructor(){super(...arguments),this.x1=NaN,this.y1=NaN,this.x=NaN,this.y=NaN,this.vx=0,this.vy=0,this.t0=NaN,this.animationFrameHandle=void 0}reset(){this.x=NaN,this.y=NaN,this.animationFrameHandle!=null&&(cancelAnimationFrame(this.animationFrameHandle),this.animationFrameHandle=void 0)}update(t,e){if(Number.isNaN(this.x)||Number.isNaN(this.y)){this.x=t,this.y=e,this.vx=0,this.vy=0,this.emitUpdate(),this.animationFrameHandle!=null&&(cancelAnimationFrame(this.animationFrameHandle),this.animationFrameHandle=void 0);return}this.x1=t,this.y1=e,this.t0=Date.now(),this.animationFrameHandle==null&&(this.animationFrameHandle=requestAnimationFrame(this.onFrame.bind(this)))}onFrame(){this.animationFrameHandle=void 0;const{x1:t,y1:e,t0:i}=this,s=Date.now(),n=s-i;this.t0=s;const r=.001,a=Math.ceil(n/(r*1e3))|0;let{x:o,y:c,vx:l,vy:h}=this;for(let u=0;u{e.push(i.label??i.fallbackLabel,i.value)}),e.join("; "))}function dataHtml(t,e,i){let s="";t==null?s+=`${sanitizeHtml(e)}`:(s+=`${sanitizeHtml(t)}`,s+=" ",s+=`${sanitizeHtml(e)}`);const n=[`${DEFAULT_TOOLTIP_CLASS}-row`];return i&&n.push(`${DEFAULT_TOOLTIP_CLASS}-row--inline`),s=`
${s}
`,s}function tooltipContentHtml(t){if(t.type==="raw")return t.rawHtmlString;let e="";if((t.heading==null||t.title==null)&&t.data?.length===1&&t.data[0].label==null&&t.data[0].value!=null){const i=t.data[0];e+=dataHtml(t.heading??t.title,i.value,!1)}else{const i=t.title==null&&t.data?.length===1;t.heading!=null&&(e+=`${sanitizeHtml(t.heading)}`,e+=" ");const s=t.symbol==null?void 0:legendSymbolSvg(t.symbol,12);s!=null&&(t.title!=null||t.data?.length)&&(e+=`${s}`),t.title!=null&&(e+=`${sanitizeHtml(t.title)}`,e+=" "),t.data?.forEach(n=>{e+=dataHtml(n.label??n.fallbackLabel,n.value,i),e+=" "})}return e=`
${e.trimEnd()}
`,e}var TooltipPosition=class extends BaseProperties{constructor(){super(...arguments),this.type="pointer",this.xOffset=0,this.yOffset=0}};__decorateClass([Validate(UNION(["pointer","node","top","right","bottom","left","top-left","top-right","bottom-right","bottom-left",{value:"sparkline",undocumented:!0},{value:"sparkline-",undocumented:!0}],"a position type"))],TooltipPosition.prototype,"type",2),__decorateClass([Validate(NUMBER)],TooltipPosition.prototype,"xOffset",2),__decorateClass([Validate(NUMBER)],TooltipPosition.prototype,"yOffset",2);var Tooltip=class extends BaseProperties{constructor(){super(),this.enabled=!0,this.delay=0,this.range=void 0,this.wrapping="hyphenate",this.position=new TooltipPosition,this.darkTheme=!1,this.bounds="extended",this.destroyFns=[],this.springAnimation=new SpringAnimation,this.enableInteraction=!1,this.wrapTypes=["always","hyphenate","on-space","never"],this.showTimeout=0,this._showArrow=!0,this._compact=!1,this._visible=!1,this.positionParams=void 0,this.destroyFns.push(this.springAnimation.addListener("update",this.updateTooltipPosition.bind(this)))}get interactive(){return this.enableInteraction}setup(t){"togglePopover"in getWindow().HTMLElement.prototype&&(this.element=t.addChild("canvas-overlay",DEFAULT_TOOLTIP_CLASS),this.element.setAttribute("popover","manual"),this.element.className=DEFAULT_TOOLTIP_CLASS)}destroy(t){t.removeChild("canvas-overlay",DEFAULT_TOOLTIP_CLASS),this.destroyFns.forEach(e=>e())}isVisible(){return this._visible}contains(t){return this.element?.contains(t)??!1}updateTooltipPosition(){const{element:t,positionParams:e}=this;if(t==null||e==null)return;const{canvasRect:i,relativeRect:s,meta:n}=e,{x:r,y:a}=this.springAnimation,o=n.position?.type??this.position.type,c=n.position?.xOffset??0,l=n.position?.yOffset??0,h=s.x,u=s.y,d=s.width-t.clientWidth-1+h,g=s.height-t.clientHeight+u;let p=this.getTooltipBounds({positionType:o,canvasX:r,canvasY:a,yOffset:l,xOffset:c,canvasRect:i}),f=calculatePlacement(t.clientWidth,t.clientHeight,s,p);o==="sparkline"&&(f.x<=h||f.x>=d)&&(p=this.getTooltipBounds({positionType:"sparkline-constrained",canvasX:r,canvasY:a,yOffset:l,xOffset:c,canvasRect:i}),f=calculatePlacement(t.clientWidth,t.clientHeight,s,p));const y=clamp(h,f.x,d),m=clamp(u,f.y,g),x=y!==f.x||m!==f.y,b=(o==="node"||o==="pointer")&&!x&&!c&&!l,v=n.showArrow??this.showArrow??b;this.updateShowArrow(v),this.updateCompact(o==="sparkline"||o==="sparkline-constrained"),t.style.transform=`translate(${y}px, ${m}px)`}show(t,e,i,s,n=!1){const{element:r}=this;if(r!=null&&s!=null)r.innerHTML=tooltipContentHtml(s);else if(r==null||r.innerHTML===""){this.toggle(!1);return}const a={x:t.x-e.x,y:t.y-e.y,width:t.width,height:t.height};this.positionParams={canvasRect:e,relativeRect:a,meta:i},this.springAnimation.update(i.canvasX,i.canvasY),r.style.top=`${e.top}px`,r.style.left=`${e.left}px`,i.enableInteraction?(this.enableInteraction=!0,r.style.pointerEvents="auto",r.removeAttribute("aria-hidden")):(this.enableInteraction=!1,r.style.pointerEvents="none",r.setAttribute("aria-hidden","true")),this.delay>0&&!n?(this.toggle(!1),this.showTimeout=setTimeout(()=>{this.toggle(!0)},this.delay)):this.toggle(!0)}hide(){this.springAnimation.reset(),this.toggle(!1)}toggle(t){if(!this.element?.isConnected)return;this._visible=t;const{classList:e}=this.element,i=(s,n)=>e.toggle(`${DEFAULT_TOOLTIP_CLASS}--${s}`,n);t||clearTimeout(this.showTimeout),i("no-interaction",!this.enableInteraction),i("arrow",this._showArrow),i("compact",this._compact),e.toggle(DEFAULT_TOOLTIP_DARK_CLASS,this.darkTheme),this.element.togglePopover(t),t&&this.updateTooltipPosition();for(const s of this.wrapTypes)e.toggle(`${DEFAULT_TOOLTIP_CLASS}--wrap-${s}`,s===this.wrapping)}updateShowArrow(t){this._showArrow=t}updateCompact(t){this._compact=t}getTooltipBounds(t){if(!this.element)return{};const{positionType:e,canvasX:i,canvasY:s,yOffset:n,xOffset:r,canvasRect:a}=t,{clientWidth:o,clientHeight:c}=this.element,l={width:o,height:c};switch(e){case"node":case"pointer":return l.top=s+n-c-8,l.left=i+r-o/2,l;case"top":return l.top=n,l.left=a.width/2-o/2+r,l;case"right":return l.top=a.height/2-c/2+n,l.left=a.width-o/2+r,l;case"left":return l.top=a.height/2-c/2+n,l.left=r,l;case"bottom":return l.top=a.height-c+n,l.left=a.width/2-o/2+r,l;case"top-left":return l.top=n,l.left=r,l;case"top-right":return l.top=n,l.left=a.width-o+r,l;case"bottom-right":return l.top=a.height-c+n,l.left=a.width-o+r,l;case"bottom-left":return l.top=a.height-c+n,l.left=r,l;case"sparkline":return l.top=s+n-c/2,l.left=i+r+8,l;case"sparkline-constrained":return l.top=s+n-c/2,l.left=i+r-8-o,l}}};__decorateClass([Validate(BOOLEAN)],Tooltip.prototype,"enabled",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],Tooltip.prototype,"showArrow",2),__decorateClass([Validate(POSITIVE_NUMBER)],Tooltip.prototype,"delay",2),__decorateClass([Validate(INTERACTION_RANGE,{optional:!0})],Tooltip.prototype,"range",2),__decorateClass([Validate(TEXT_WRAP)],Tooltip.prototype,"wrapping",2),__decorateClass([Validate(OBJECT)],Tooltip.prototype,"position",2),__decorateClass([Validate(BOOLEAN)],Tooltip.prototype,"darkTheme",2),__decorateClass([Validate(UNION(["extended","canvas"]))],Tooltip.prototype,"bounds",2);var SeriesAreaManager=class extends BaseManager{constructor(t){super(),this.chart=t,this.id=createId(this),this.series=[],this.highlight={pendingHoverEvent:void 0,appliedHoverEvent:void 0,stashedHoverEvent:void 0},this.tooltip={lastHover:void 0},this.hoverDevice="pointer",this.previousInputDevice="keyboard",this.focus={sortedSeries:[],series:void 0,seriesIndex:0,datumIndex:0,datum:void 0},this.hoverScheduler=debouncedAnimationFrame(()=>{if(!(!this.tooltip.lastHover&&!this.highlight.pendingHoverEvent)){if(this.chart.getUpdateType()<=4){this.hoverScheduler.schedule();return}this.highlight.pendingHoverEvent&&this.handleHoverHighlight(!1),this.tooltip.lastHover&&this.handleHoverTooltip(this.tooltip.lastHover,!1)}});const e=t.ctx.domManager.addChild("series-area","series-area-aria-label1"),i=t.ctx.domManager.addChild("series-area","series-area-aria-label2");this.swapChain=new FocusSwapChain(e,i,this.id,"img"),this.swapChain.addListener("blur",()=>this.onBlur()),this.swapChain.addListener("focus",()=>this.onFocus()),this.focusIndicator=new FocusIndicator(this.swapChain),this.focusIndicator.overrideFocusVisible(t.mode==="integrated"?!1:void 0);const{seriesDragInterpreter:s,seriesWidget:n,containerWidget:r}=t.ctx.widgets;n.setTabIndex(-1),this.destroyFns.push(()=>t.ctx.domManager.removeChild("series-area","series-area-aria-label1"),()=>t.ctx.domManager.removeChild("series-area","series-area-aria-label2"),n.addListener("focus",()=>this.swapChain.focus()),n.addListener("mousemove",a=>this.onHover(a)),n.addListener("wheel",a=>this.onWheel(a)),n.addListener("mouseleave",a=>this.onLeave(a)),n.addListener("keydown",a=>this.onKeyDown(a)),n.addListener("contextmenu",(a,o)=>this.onContextMenu(a,o)),s.addListener("drag-move",a=>this.onDragMove(a)),s.addListener("click",a=>this.onClick(a,n)),s.addListener("dblclick",a=>this.onClick(a,n)),r.addListener("contextmenu",(a,o)=>this.onContextMenu(a,o)),r.addListener("click",(a,o)=>this.onClick(a,o)),r.addListener("dblclick",(a,o)=>this.onClick(a,o)),t.ctx.animationManager.addListener("animation-start",()=>this.clearAll()),t.ctx.domManager.addListener("resize",()=>this.clearAll()),t.ctx.highlightManager.addListener("highlight-change",a=>this.changeHighlightDatum(a)),t.ctx.layoutManager.addListener("layout:complete",a=>this.layoutComplete(a)),t.ctx.updateService.addListener("pre-scene-render",()=>this.preSceneRender()),t.ctx.updateService.addListener("update-complete",()=>this.updateComplete()),t.ctx.zoomManager.addListener("zoom-change",()=>this.clearAll()),t.ctx.zoomManager.addListener("zoom-pan-start",()=>this.clearAll()))}isState(t){return this.chart.ctx.interactionManager.isState(t)}isIgnoredTouch(t){return!(t.device!=="touch"||t.type==="click"||this.chart.ctx.chartService.touch.dragAction==="hover"||this.chart.ctx.chartService.touch.dragAction==="drag"&&this.isState(9))}dataChanged(){var t;(t=this.highlight).stashedHoverEvent??(t.stashedHoverEvent=this.highlight.appliedHoverEvent),this.chart.ctx.tooltipManager.removeTooltip(this.id),this.focusIndicator.clear(),this.clearHighlight()}preSceneRender(){this.highlight.stashedHoverEvent!=null&&(this.highlight.pendingHoverEvent=this.highlight.stashedHoverEvent,this.highlight.stashedHoverEvent=void 0,this.handleHoverHighlight(!0)),this.tooltip.lastHover!=null&&this.handleHoverTooltip(this.tooltip.lastHover,!0)}updateComplete(){this.focusIndicator.isFocusVisible()&&this.isState(34)&&this.handleSeriesFocus(0,0,!0)}update(t,e){this.chart.ctx.updateService.update(t,e)}seriesChanged(t){this.focus.sortedSeries=[...t].sort((e,i)=>{let s=e.properties.focusPriority??1/0,n=i.properties.focusPriority??1/0;return s===n&&([s,n]=[e._declarationOrder,i._declarationOrder]),sn?1:0}),this.series=t}layoutComplete(t){this.seriesRect=t.series.rect,this.hoverRect=t.series.paddedRect,this.chart.ctx.widgets.seriesWidget.setBounds(t.series.paddedRect),this.chart.ctx.widgets.chartWidget.setBounds(t.chart)}onContextMenu(t,e){const{sourceEvent:i}=t;if(i.currentTarget!=e.getElement())return;if(i.target==this.chart.ctx.widgets.containerWidget.getElement()){if(this.isState(36)){const{currentX:c,currentY:l}=t;this.chart.ctx.contextMenuRegistry.dispatchContext("all",{sourceEvent:i,canvasX:c,canvasY:l},{})}return}let s,n;if(this.focusIndicator.isFocusVisible())s=this.chart.ctx.highlightManager.getActiveHighlight(),s&&this.seriesRect&&s.midPoint&&(n=Transformable.toCanvasPoint(s.series.contentGroup,s.midPoint.x,s.midPoint.y));else if(this.isState(36)){const c=this.pickNode({x:t.currentX,y:t.currentY},"context-menu");c&&(this.chart.ctx.highlightManager.updateHighlight(this.id),s=c.datum)}const r=s?.series;this.clearAll();const a=t.currentX+e.cssLeft(),o=t.currentY+e.cssTop();this.chart.ctx.contextMenuRegistry.dispatchContext("series-area",{sourceEvent:i,canvasX:a,canvasY:o},{pickedSeries:r,pickedNode:s},n)}onLeave(t){!this.isState(41)||t.sourceEvent.relatedTarget?.className==="ag-charts-text-input__textarea"||this.chart.ctx.tooltipManager.isEnteringInteractiveTooltip(t)||(this.chart.ctx.domManager.updateCursor(this.id),this.focusIndicator.isFocusVisible()||this.clearAll())}onWheel(t){this.isState(41)&&(this.focusIndicator?.overrideFocusVisible(!1),this.previousInputDevice="pointer")}onDragMove(t){this.isState(41)&&(this.focusIndicator?.overrideFocusVisible(!1),this.onHoverLikeEvent(t))}onHover(t){this.isState(41)&&this.onHoverLikeEvent(t)}onHoverLikeEvent(t){if(!this.isIgnoredTouch(t)&&((t.device==="touch"||excludesType(t,"drag-move"))&&(this.tooltip.lastHover=t),t.device==="touch"&&this.chart.ctx.chartService.touch.dragAction==="hover"&&t.sourceEvent.preventDefault(),this.hoverDevice="pointer",this.previousInputDevice="pointer",this.highlight.pendingHoverEvent=t,this.hoverScheduler.schedule(),this.isState(32))){const{currentX:e,currentY:i}=t,s=this.pickNode({x:e,y:i},"event");s?.series.hasEventListener("nodeClick")||s?.series.hasEventListener("nodeDoubleClick")?this.chart.ctx.domManager.updateCursor(this.id,"pointer"):this.chart.ctx.domManager.updateCursor(this.id)}}onClick(t,e){if(t.device==="touch"&&e===this.chart.ctx.widgets.seriesWidget&&this.swapChain.focus({preventScroll:!0}),!this.isState(41))return;if(e===this.chart.ctx.widgets.seriesWidget){if(!e.getElement().contains(t.sourceEvent.target))return}else if(t.sourceEvent.target!=e.getElement())return;if(this.focusIndicator.overrideFocusVisible(!1),this.onHoverLikeEvent(t),!this.isState(32))return;if(e==this.chart.ctx.widgets.seriesWidget&&this.checkSeriesNodeClick(t)){this.update(4),t.sourceEvent.preventDefault();return}const i={type:t.type==="click"?"click":"doubleClick",event:t.sourceEvent};this.chart.fireEvent(i)}onFocus(){this.isState(34)&&(this.hoverDevice=this.focusIndicator.isFocusVisible()?"keyboard":"pointer",this.handleFocus(0,0))}onBlur(){this.isState(34)&&(this.hoverDevice="pointer",this.clearAll(),this.focusIndicator.overrideFocusVisible(void 0))}onKeyDown(t){if(!this.isState(43))return;const e=mapKeyboardEventToAction(t.sourceEvent);switch(e?.activatesFocusIndicator===!1&&this.focusIndicator.overrideFocusVisible(this.previousInputDevice==="keyboard"),e?.name){case"redo":return this.chart.ctx.chartEventManager.seriesEvent("series-redo");case"undo":return this.chart.ctx.chartEventManager.seriesEvent("series-undo");case"zoomin":return this.chart.ctx.chartEventManager.seriesKeyNavZoom(1,t);case"zoomout":return this.chart.ctx.chartEventManager.seriesKeyNavZoom(-1,t);case"arrowup":return this.onArrow(-1,0,t);case"arrowdown":return this.onArrow(1,0,t);case"arrowleft":return this.onArrow(0,-1,t);case"arrowright":return this.onArrow(0,1,t);case"submit":return this.onSubmit(t)}}onArrow(t,e,i){this.isState(34)&&(this.hoverDevice="keyboard",this.previousInputDevice="keyboard",this.focusIndicator.overrideFocusVisible(!0),this.focus.seriesIndex+=t,this.focus.datumIndex+=e,this.handleFocus(t,e),i.sourceEvent.preventDefault(),this.chart.ctx.chartEventManager.seriesEvent("series-focus-change"))}onSubmit(t){if(!this.isState(34))return;const{series:e,datum:i}=this.focus,s=t.sourceEvent;e!==void 0&&i!==void 0?e.fireNodeClickEvent(s,i):this.chart.fireEvent({type:"click",event:s}),s.preventDefault()}checkSeriesNodeClick(t){const e=this.pickNode({x:t.currentX,y:t.currentY},"event");return e==null?!1:t.type==="click"?(e.series.fireNodeClickEvent(t.sourceEvent,e.datum),!0):t.type==="dblclick"?(t.preventZoomDblClick=e.distance===0,e.series.fireNodeDoubleClickEvent(t.sourceEvent,e.datum),!0):!1}handleFocus(t,e){const i=this.chart.overlays.getFocusInfo(this.chart.ctx.localeManager);i==null?this.handleSeriesFocus(t,e):this.focusIndicator.update(i.rect,this.seriesRect,!1)}handleSeriesFocus(t,e,i=!1){if(this.chart.chartType==="hierarchy"||this.chart.chartType==="gauge"){this.handleSoloSeriesFocus(t,e,i);return}const{focus:s,seriesRect:n}=this,r=s.sortedSeries.filter(h=>h.visible&&h.focusable);if(r.length===0)return;const a={datumIndex:s.datumIndex-e,otherIndex:s.seriesIndex-t};s.seriesIndex=clamp(0,s.seriesIndex,r.length-1),s.series=r[s.seriesIndex];const{datumIndex:o,seriesIndex:c}=s,l=s.series.pickFocus({datumIndex:o,datumIndexDelta:e,otherIndex:c,otherIndexDelta:t,seriesRect:n});this.updatePickedFocus(t,e,a,l,i)}handleSoloSeriesFocus(t,e,i){this.focus.series=this.focus.sortedSeries[0];const{focus:{series:s,seriesIndex:n,datumIndex:r},seriesRect:a}=this;if(s==null)return;const o={datumIndex:this.focus.datumIndex-e,otherIndex:this.focus.seriesIndex-t},c=s.pickFocus({datumIndex:r,datumIndexDelta:e,otherIndex:n,otherIndexDelta:t,seriesRect:a});this.updatePickedFocus(t,e,o,c,i)}updatePickedFocus(t,e,i,s,n){const{focus:r,hoverRect:a}=this;if(s===void 0||r.series===void 0||a===void 0)return;const{datum:o,datumIndex:c,otherIndex:l}=s;if(l!==void 0&&(r.seriesIndex=l),r.datumIndex=c,r.datum=o,this.focusIndicator.isFocusVisible()&&this.chart.ctx.animationManager.reset(),this.focusIndicator.isFocusVisible()){const u=getPickedFocusBBox(s),{x:d,y:g}=u.computeCenter();if(!a.containsPoint(d,g)&&this.chart.ctx.zoomManager.panToBBox(this.id,a,u))return}this.focusIndicator.update(s.bounds,this.seriesRect,s.clipFocusBox);const h=makeKeyboardPointerEvent(r.series,a,s);if(h!==void 0&&this.hoverDevice==="keyboard"){this.tooltip.lastHover=void 0,this.highlight.appliedHoverEvent=void 0,this.highlight.pendingHoverEvent=void 0,this.highlight.stashedHoverEvent=void 0;const u=r.series.getTooltipContent(o),d=TooltipManager.makeTooltipMeta(h,r.series,o);this.chart.ctx.highlightManager.updateHighlight(this.id,o),this.chart.tooltip.enabled&&r.series.tooltipEnabled?this.chart.ctx.tooltipManager.updateTooltip(this.id,d,u):this.chart.ctx.tooltipManager.removeTooltip(this.id),n||(e===0&&t===0||i.datumIndex!==s.datumIndex||i.otherIndex!==(s.otherIndex??r.seriesIndex))&&this.swapChain.update(this.getDatumAriaText(o,u))}}getDatumAriaText(t,e){const i=e==null?"":tooltipContentAriaLabel(e);return this.chart.ctx.localeManager.t("ariaAnnounceHoverDatum",{datum:t.series.getDatumAriaText?.(t,i)??i})}clearHighlight(){this.highlight.pendingHoverEvent=void 0,this.highlight.appliedHoverEvent=void 0,this.chart.ctx.highlightManager.updateHighlight(this.id)}clearTooltip(){this.chart.ctx.tooltipManager.removeTooltip(this.id),this.tooltip.lastHover=void 0}clearAll(){this.clearHighlight(),this.clearTooltip(),this.focusIndicator.clear()}handleHoverHighlight(t){this.highlight.appliedHoverEvent=this.highlight.pendingHoverEvent,this.highlight.pendingHoverEvent=void 0;const e=this.highlight.appliedHoverEvent;if(!e||!this.isState(41))return;const{currentX:i,currentY:s}=e,n=e.currentX+(this.hoverRect?.x??0),r=e.currentY+(this.hoverRect?.y??0);if(t?this.chart.ctx.animationManager.isActive():!this.hoverRect?.containsPoint(n,r)){this.clearHighlight();return}const{range:a}=this.chart.highlight,o=a==="tooltip"?"highlight-tooltip":"highlight",c=this.pickNode({x:i,y:s},o);if(c){this.chart.ctx.highlightManager.updateHighlight(this.id,c.datum),this.hoverDevice="pointer";return}this.chart.ctx.highlightManager.updateHighlight(this.id)}handleHoverTooltip(t,e){if(!this.isState(41))return;const{currentX:i,currentY:s}=t,n=i+(this.hoverRect?.x??0),r=s+(this.hoverRect?.y??0),a=t.sourceEvent.target;if(e?this.chart.ctx.animationManager.isActive():!this.hoverRect?.containsPoint(n,r)){this.hoverDevice=="pointer"&&this.clearTooltip();return}if(a&&this.chart.tooltip.interactive&&this.chart.ctx.domManager.isManagedChildDOMElement(a,"canvas-overlay",DEFAULT_TOOLTIP_CLASS))return;const o=this.pickNode({x:t.currentX,y:t.currentY},"tooltip");if(!o){this.hoverDevice=="pointer"&&this.clearTooltip();return}this.hoverDevice="pointer";const c=o.series.getTooltipContent(o.datum);if(this.chart.tooltip.enabled&&o.series.tooltipEnabled&&c!=null){const u=TooltipManager.makeTooltipMeta({type:"pointermove",canvasX:n,canvasY:r},o.series,o.datum);this.chart.ctx.tooltipManager.updateTooltip(this.id,u,c)}else this.chart.ctx.tooltipManager.removeTooltip(this.id)}changeHighlightDatum(t){const e=new Set,{series:i=void 0,datum:s}=t.currentHighlight??{},{series:n=void 0,datum:r}=t.previousHighlight??{};n&&e.add(n),i&&e.add(i),n?.properties.cursor&&r&&this.chart.ctx.domManager.updateCursor(n.id),i?.properties.cursor&&i?.properties.cursor!=="default"&&s&&this.chart.ctx.domManager.updateCursor(i.id,i.properties.cursor),i==null||n==null?this.update(4):this.update(4,{seriesToUpdate:e})}pickNode(t,e,i){const s=[...this.series].reverse();let n;for(const r of s){if(!r.visible||!r.contentGroup.visible)continue;const{match:a,distance:o}=r.pickNode(t,e,i)??{};if(!(!a||o==null)&&((!n||n.distance>o)&&(n={series:r,distance:o,datum:a}),o===0))break}return n}};function excludesType(t,e){return t.type!==e}var SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION=30,SeriesLayerManager=class{constructor(t){this.seriesRoot=t,this.groups=new Map,this.series=new Map,this.expectedSeriesCount=1,this.mode="normal"}setSeriesCount(t){this.expectedSeriesCount=t}requestGroup(t){const{internalId:e,type:i,contentGroup:s,seriesGrouping:n}=t,{groupIndex:r=e}=n??{},a=this.series.get(e);if(a!=null)throw new Error(`AG Charts - series already has an allocated layer: ${JSON.stringify(a)}`);this.series.size===0&&(this.mode=this.expectedSeriesCount>=SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION?"aggressive-grouping":"normal");let o=this.groups.get(i);o==null&&(o=new Map,this.groups.set(i,o));const c=this.lookupIdx(r);let l=o.get(c);return l==null&&(l={type:i,id:c,seriesIds:[],group:this.seriesRoot.appendChild(new Group({name:`${t.contentGroup.name??i}-managed-layer`,zIndex:t.contentGroup.zIndex,renderToOffscreenCanvas:!1}))},o.set(c,l)),this.series.set(e,{layerState:l,seriesConfig:t}),l.seriesIds.push(e),l.group.appendChild(s),l.group}changeGroup(t){const{internalId:e,seriesGrouping:i,type:s,contentGroup:n,oldGrouping:r}=t,{groupIndex:a=e}=i??{};this.groups.get(s)?.get(a)?.seriesIds.includes(e)||(this.series.has(e)&&this.releaseGroup({internalId:e,seriesGrouping:r,type:s,contentGroup:n}),this.requestGroup(t))}releaseGroup(t){const{internalId:e,contentGroup:i,type:s}=t;if(!this.series.has(e))throw new Error(`AG Charts - series doesn't have an allocated layer: ${e}`);const n=this.series.get(e)?.layerState;n&&(n.seriesIds=n.seriesIds.filter(r=>r!==e),n.group.removeChild(i)),n?.seriesIds.length===0?(this.seriesRoot.removeChild(n.group),this.groups.get(n.type)?.delete(n.id),this.groups.get(s)?.delete(e)):n!=null&&n.seriesIds.length>0&&(n.group.zIndex=this.getLowestSeriesZIndex(n.seriesIds)),this.series.delete(e)}updateLayerCompositing(){this.groups.forEach(t=>{t.forEach(e=>{const{group:i,seriesIds:s}=e;let n;s.length===0?n=!1:s.length>1?n=!0:n=this.series.get(s[0])?.seriesConfig.renderToOffscreenCanvas()===!0,i.renderToOffscreenCanvas=n,i.zIndex=this.getLowestSeriesZIndex(s)})})}lookupIdx(t){return this.mode==="normal"?t:typeof t=="string"&&(t=Number(t.split("-").at(-1)),!t)?0:Math.floor(clamp(0,t/this.expectedSeriesCount,1)*SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION)}destroy(){this.groups.forEach(t=>{t.forEach(e=>{this.seriesRoot.removeChild(e.group)})}),this.groups.clear(),this.series.clear()}getLowestSeriesZIndex(t){return t.reduce((i,s)=>{const r=this.series.get(s)?.seriesConfig.contentGroup.zIndex;return i==null||r==null?r:compareZIndex(i,r)<=0?i:r},void 0)??1}},Touch=class extends BaseProperties{constructor(){super(...arguments),this.dragAction="drag"}};__decorateClass([Validate(UNION(["none","drag","hover"]))],Touch.prototype,"dragAction",2);var DataWindowProcessor=class{constructor(t,e,i,s,n){this.chart=t,this.dataService=e,this.updateService=i,this.zoomManager=s,this.animationManager=n,this.dirtyZoom=!1,this.dirtyDataSource=!1,this.lastAxisZooms=new Map,this.destroyFns=[],this.destroyFns.push(this.dataService.addListener("data-source-change",()=>this.onDataSourceChange()),this.dataService.addListener("data-load",()=>this.onDataLoad()),this.dataService.addListener("data-error",()=>this.onDataError()),this.updateService.addListener("update-complete",()=>this.onUpdateComplete()),this.zoomManager.addListener("zoom-change",()=>this.onZoomChange()))}destroy(){this.destroyFns.forEach(t=>t())}onDataLoad(){this.animationManager.skip(),this.updateService.update(1)}onDataError(){this.updateService.update(3)}onDataSourceChange(){this.dirtyDataSource=!0}onUpdateComplete(){!this.dirtyZoom&&!this.dirtyDataSource||this.updateWindow()}onZoomChange(){this.dirtyZoom=!0}updateWindow(){if(!this.dataService.isLazy())return;const t=this.getValidAxis();let e,i=!0;if(t){const s=this.zoomManager.getAxisZoom(t.id);e=this.getAxisWindow(t,s),i=this.shouldRefresh(t,s)}this.dirtyZoom=!1,this.dirtyDataSource=!1,i&&this.dataService.load({windowStart:e?.min,windowEnd:e?.max})}getValidAxis(){return this.chart.axes.find(t=>t.type==="time")}shouldRefresh(t,e){if(this.dirtyDataSource)return!0;if(!this.dirtyZoom)return!1;const i=this.lastAxisZooms.get(t.id);return i&&e.min===i.min&&e.max===i.max?!1:(this.lastAxisZooms.set(t.id,e),!0)}getAxisWindow(t,e){const{domain:i}=t.scale;if(!e||i.length===0||isNaN(Number(i[0])))return;const s=Number(i[1])-Number(i[0]),n=new Date(Number(i[0])+s*e.min),r=new Date(Number(i[0])+s*e.max);return{min:n,max:r}}},isSafariRegexp=/^((?!chrome|android).)*safari/i,safariVersionRegexp=/Version\/(\d+(\.\d+)?)/,isChromeRegexp=/Chrome/,chromeVersionRegexp=/Chrome\/(\d+)/,isEdge=/Edg/,isOpera=/OPR/;function isUnsupportedBrowser(){const{userAgent:t}=getWindow("navigator");if(isSafariRegexp.test(t)){const e=parseFloat(safariVersionRegexp.exec(t)?.[1]??"0"),i=Math.floor(e)>16;return i||logger_exports.warnOnce(`Unsupported Safari version: ${e}; ${t}`),!i}else if(isChromeRegexp.test(t)&&!isEdge.test(t)&&!isOpera.test(t)){const e=parseInt(chromeVersionRegexp.exec(t)?.[1]??"0",10),i=e>126;return i||logger_exports.warnOnce(`Unsupported Chrome version: ${e}; ${t}`),!i}return!1}var visibleIgnoredSeries=new Set(["map-shape-background","map-line-background"]),OverlaysProcessor=class{constructor(t,e,i,s,n,r,a){this.chartLike=t,this.overlays=e,this.dataService=i,this.layoutManager=s,this.localeManager=n,this.animationManager=r,this.domManager=a,this.destroyFns=[],this.overlayElem=this.domManager.addChild("canvas-overlay","overlay"),this.overlayElem.role="status",this.overlayElem.ariaAtomic="false",this.overlayElem.ariaLive="polite",this.overlayElem.classList.toggle(DEFAULT_OVERLAY_CLASS),this.destroyFns.push(this.layoutManager.addListener("layout:complete",o=>this.onLayoutComplete(o)))}destroy(){this.destroyFns.forEach(t=>t()),this.domManager.removeStyles("overlays"),this.domManager.removeChild("canvas-overlay","overlay")}onLayoutComplete({series:{rect:t}}){const e=this.dataService.isLoading(),i=this.chartLike.series.some(l=>l.hasData),s=this.chartLike.series.some(l=>l.visible&&!visibleIgnoredSeries.has(l.type));this.overlays.darkTheme?this.overlayElem.classList.add(DEFAULT_OVERLAY_DARK_CLASS):this.overlayElem.classList.remove(DEFAULT_OVERLAY_DARK_CLASS),this.overlayElem.style.left=`${t.x}px`,this.overlayElem.style.top=`${t.y}px`,this.overlayElem.style.width=`${t.width}px`,this.overlayElem.style.height=`${t.height}px`;const n=e,r=!e&&!i,a=i&&!s,o=this.overlays.unsupportedBrowser.enabled&&isUnsupportedBrowser();n?this.showOverlay(this.overlays.loading,t):this.hideOverlay(this.overlays.loading),r?this.showOverlay(this.overlays.noData,t):this.hideOverlay(this.overlays.noData),a?this.showOverlay(this.overlays.noVisibleSeries,t):this.hideOverlay(this.overlays.noVisibleSeries),o?this.showOverlay(this.overlays.unsupportedBrowser,t):this.hideOverlay(this.overlays.unsupportedBrowser);const c=n||r||a||o;setAttribute(this.overlayElem,"aria-hidden",!c)}showOverlay(t,e){if(!t.enabled)return;const i=t.getElement(this.animationManager,this.localeManager,e);this.overlayElem.appendChild(i)}hideOverlay(t){t.removeElement(()=>{this.overlayElem.innerText="\xA0"},this.animationManager)}},debug=Debug.create(!0,"opts"),SeriesArea=class extends BaseProperties{constructor(){super(...arguments),this.padding=new Padding(0)}};__decorateClass([Validate(BOOLEAN,{optional:!0})],SeriesArea.prototype,"clip",2),__decorateClass([Validate(OBJECT)],SeriesArea.prototype,"padding",2);var _Chart=class pt extends Observable{constructor(e,i){var s;super(),this.id=createId(this),this.seriesRoot=new TranslatableGroup({name:`${this.id}-series-root`,zIndex:5}),this.annotationRoot=new TranslatableGroup({name:`${this.id}-annotation-root`,zIndex:9}),this.titleGroup=new Group({name:"titles",zIndex:13}),this.debug=Debug.create(),this.extraDebugStats={},this.data=[],this._firstAutoSize=!0,this._autoSizeNotify=new AsyncAwaitQueue,this.padding=new Padding(20),this.seriesArea=new SeriesArea,this.keyboard=new Keyboard,this.touch=new Touch,this.mode="standalone",this.chartCaptions=new ChartCaptions,this.suppressFieldDotNotation=!1,this.destroyed=!1,this._destroyFns=[],this.skipSync=!1,this.chartAnimationPhase="initial",this.modulesManager=new ModulesManager,this.processors=[],this.queuedUserOptions=[],this.queuedChartOptions=[],this.firstApply=!0,this._pendingFactoryUpdatesCount=0,this._performUpdateSkipAnimations=!1,this._performUpdateNotify=new AsyncAwaitQueue,this.performUpdateType=7,this.runningUpdateType=7,this.updateShortcutCount=0,this.seriesToUpdate=new Set,this.updateMutex=new Mutex,this.updateRequestors={},this.performUpdateTrigger=debouncedCallback(({count:h})=>{this.destroyed||this.updateMutex.acquire(async()=>{try{await this.performUpdate(h)}catch(u){logger_exports.error("update error",u)}}).catch(u=>logger_exports.errorOnce(u))}),this._performUpdateSplits={},this.axes=[],this.series=[],this._cachedData=void 0,this.onSeriesNodeClick=h=>{this.fireEvent({...h,type:"seriesNodeClick"})},this.onSeriesNodeDoubleClick=h=>{this.fireEvent({...h,type:"seriesNodeDoubleClick"})},this.onSeriesVisibilityChange=h=>{this.fireEvent(h)},this.seriesGroupingChanged=h=>{if(!(h instanceof SeriesGroupingChangedEvent))return;const{series:u,seriesGrouping:d,oldGrouping:g}=h;u.contentGroup.isRoot()||this.seriesLayerManager.changeGroup({internalId:u.internalId,type:u.type,contentGroup:u.contentGroup,renderToOffscreenCanvas:()=>u.renderToOffscreenCanvas(),seriesGrouping:d,oldGrouping:g})},this.chartOptions=e;const n=i?.scene,r=i?.container??e.processedOptions.container??void 0,a=i?.styleContainer??e.specialOverrides.styleContainer;n&&(this._firstAutoSize=!1,this._lastAutoSize=[n.width,n.height,n.pixelRatio]);const o=new Group({name:"root"});o.visible=!1,o.append(this.seriesRoot),o.append(this.annotationRoot),o.append(this.titleGroup),this.titleGroup.append(this.title.node),this.titleGroup.append(this.subtitle.node),this.titleGroup.append(this.footnote.node),this.tooltip=new Tooltip,this.seriesLayerManager=new SeriesLayerManager(this.seriesRoot),this.mode=e.userOptions.mode??this.mode;const c=this.ctx=new ChartContext(this,{chartType:this.getChartType(),scene:n,root:o,container:r,styleContainer:a,syncManager:new SyncManager(this),fireEvent:h=>this.fireEvent(h),updateCallback:(h,u)=>this.update(h,u),updateMutex:this.updateMutex});this._destroyFns.push(c.domManager.addListener("resize",()=>this.parentResize(c.domManager.containerSize))),this.overlays=new ChartOverlays,(s=this.overlays.loading).renderer??(s.renderer=()=>getLoadingSpinner(this.overlays.loading.getText(c.localeManager),c.animationManager.defaultDuration)),this.processors=[new DataWindowProcessor(this,c.dataService,c.updateService,c.zoomManager,c.animationManager),new OverlaysProcessor(this,this.overlays,c.dataService,c.layoutManager,c.localeManager,c.animationManager,c.domManager)],this.highlight=new ChartHighlight,this.container=r;const l=this.getModuleContext();c.domManager.setDataBoolean("animating",!1),this.seriesAreaManager=new SeriesAreaManager(this.initSeriesAreaDependencies()),this._destroyFns.push(c.layoutManager.registerElement(0,h=>{h.layoutBox.shrink(this.padding.toJson()),this.chartCaptions.positionCaptions(h)}),c.layoutManager.addListener("layout:complete",h=>this.chartCaptions.positionAbsoluteCaptions(h)),c.dataService.addListener("data-load",h=>{this.data=h.data}),this.title.registerInteraction(l,"beforebegin"),this.subtitle.registerInteraction(l,"beforebegin"),this.footnote.registerInteraction(l,"afterend"),Widget.addWindowEvent("page-left",()=>this.destroy()),c.animationManager.addListener("animation-frame",()=>{this.update(6)}),c.animationManager.addListener("animation-start",()=>c.domManager.setDataBoolean("animating",!0)),c.animationManager.addListener("animation-stop",()=>c.domManager.setDataBoolean("animating",!1)),c.zoomManager.addListener("zoom-change",()=>{this.series.forEach(u=>u.animationState?.transition("updateData"));const h=this.chartAnimationPhase!=="initial";this.update(3,{forceNodeDataRefresh:!0,skipAnimations:h})})),this.parentResize(c.domManager.containerSize)}static getInstance(e){return pt.chartsInstances.get(e)}get canvasElement(){return this.ctx.scene.canvas.element}download(e,i){this.ctx.scene.download(e,i)}getCanvasDataURL(e){return this.ctx.scene.getDataURL(e)}toSVG(){return this.ctx.scene.toSVG()}getOptions(){return this.queuedUserOptions.at(-1)??this.chartOptions.userOptions}getChartOptions(){return this.queuedChartOptions.at(-1)??this.chartOptions}overrideFocusVisible(e){this.seriesAreaManager.focusIndicator.overrideFocusVisible(e)}initSeriesAreaDependencies(){const{ctx:e,tooltip:i,highlight:s,overlays:n,seriesRoot:r,mode:a}=this,o=this.getChartType();return{fireEvent:this.fireEvent.bind(this),getUpdateType:()=>this.performUpdateType,chartType:o,ctx:e,tooltip:i,highlight:s,overlays:n,seriesRoot:r,mode:a}}getModuleContext(){return this.ctx}getCaptionText(){return[this.title,this.subtitle,this.footnote].filter(e=>e.enabled&&e.text).map(e=>e.text).join(". ")}getAriaLabel(){return this.ctx.localeManager.t("ariaAnnounceChart",{seriesCount:this.series.length})}resetAnimations(){this.chartAnimationPhase="initial";for(const e of this.series)e.resetAnimation(this.chartAnimationPhase);for(const e of this.axes)e.resetAnimation(this.chartAnimationPhase);this.animationRect=void 0,this.ctx.animationManager.reset()}skipAnimations(){this.ctx.animationManager.skipCurrentBatch(),this._performUpdateSkipAnimations=!0}detachAndClear(){this.container=void 0,this.ctx.scene.clear()}destroy(e){if(this.destroyed)return;const i=e?.keepTransferableResources;let s;return this.performUpdateType=7,this._destroyFns.forEach(n=>n()),this.processors.forEach(n=>n.destroy()),this.tooltip.destroy(this.ctx.domManager),this.overlays.destroy(),this.modulesManager.destroy(),i?(this.ctx.scene.strip(),s={container:this.container,scene:this.ctx.scene}):(this.ctx.scene.destroy(),this.container=void 0),this.destroySeries(this.series),this.seriesLayerManager.destroy(),this.axes.forEach(n=>n.destroy()),this.axes=[],this.animationRect=void 0,this.ctx.destroy(),this.destroyed=!0,Object.freeze(this),s}requestFactoryUpdate(e){this.destroyed||(this._pendingFactoryUpdatesCount++,this.updateMutex.acquire(async()=>{if(!this.destroyed)try{await e(this)}finally{this.destroyed||this._pendingFactoryUpdatesCount--}}).catch(i=>logger_exports.errorOnce(i)))}update(e=0,i){if(this.destroyed)return;const{forceNodeDataRefresh:s=!1,skipAnimations:n,seriesToUpdate:r=this.series,newAnimationBatch:a}=i??{};this.ctx.widgets.seriesWidget.setDragTouchEnabled(this.touch.dragAction!=="none"),s&&this.series.forEach(o=>o.markNodeDataDirty());for(const o of r)this.seriesToUpdate.add(o);if(n&&(this.ctx.animationManager.skipCurrentBatch(),this._performUpdateSkipAnimations=!0),a&&this.ctx.animationManager.isActive()&&(this._performUpdateSkipAnimations=!0),this.skipSync=i?.skipSync??!1,this.debug.check()){let o=new Error().stack??"";o=o.replace(/\([^)]*/g,""),this.updateRequestors[o]=e}ethis.chartAnimationPhase="ready")),this.debug("Chart.performUpdate() - start",ChartUpdateType[i]);let o=performance.now();n.start??(n.start=o);const c=h=>{n[h]??(n[h]=0),n[h]+=performance.now()-o,o=performance.now()};switch(i){case 0:if(this.checkUpdateShortcut(0))break;this.ctx.updateService.dispatchPreDomUpdate(),this.updateDOM();case 1:if(this.checkUpdateShortcut(1))break;await this.updateData(),c("\u2B07\uFE0F");case 2:if(this.checkUpdateShortcut(2))break;await this.processData(),this.seriesAreaManager.dataChanged(),c("\u{1F3ED}");case 3:if(await this.checkFirstAutoSize(),this.checkUpdateShortcut(3))break;await this.processLayout(),c("\u2316");case 4:{if(this.checkUpdateShortcut(4))break;await this.updateSeries(a),c("\u{1F914}"),this.updateAriaLabels(),this.seriesLayerManager.updateLayerCompositing()}case 5:if(this.checkUpdateShortcut(5))break;r.updateService.dispatchPreSceneRender(),c("\u2196");case 6:if(this.checkUpdateShortcut(6))break;r.animationManager.endBatch(),s.updateShortcutCount=this.updateShortcutCount,r.scene.render({debugSplitTimes:n,extraDebugStats:s,seriesRect:this.seriesRect}),this.extraDebugStats={};for(const h of Object.keys(n))delete n[h];this.ctx.domManager.incrementDataCounter("sceneRenders");case 7:this.updateShortcutCount=0,this.updateRequestors={},this._performUpdateSkipAnimations=!1,r.animationManager.endBatch()}this.destroyed||(r.updateService.dispatchUpdateComplete(),this.ctx.domManager.setDataBoolean("updatePending",!1),this.runningUpdateType=7),this._performUpdateNotify.notify();const l=performance.now();this.debug("Chart.performUpdate() - end",{chart:this,durationMs:Math.round((l-n.start)*100)/100,count:e,performUpdateType:ChartUpdateType[i]})}updateThemeClassName(){const e="ag-charts-theme-",i=[`${e}default`,`${e}default-dark`];let s=i[0],n=!1,{theme:r}=this.chartOptions.processedOptions;for(;typeof r!="string"&&r!=null;)r=r.baseTheme;typeof r=="string"&&(s=r.replace("ag-",e),n=r.includes("-dark")),i.includes(s)||(s=n?i[1]:i[0]),this.ctx.domManager.setThemeClass(s)}updateDOM(){this.updateThemeClassName();const{enabled:e,tabIndex:i}=this.keyboard;this.ctx.domManager.setTabGuardIndex(e?i??0:-1),this.ctx.domManager.setThemeParameters(this.chartOptions.themeParameters)}updateAriaLabels(){this.ctx.domManager.updateCanvasLabel(this.getAriaLabel())}checkUpdateShortcut(e){return this.destroyed?!0:this.updateShortcutCount>3?(logger_exports.warn("exceeded the maximum number of simultaneous updates (4), discarding changes and rendering",this.updateRequestors),!1):this.performUpdateType<=e?(this.updateShortcutCount++,!0):!1}async checkFirstAutoSize(){this.width!=null&&this.height!=null||this._lastAutoSize||await this._autoSizeNotify.await(500)||this.debug("Chart.checkFirstAutoSize() - timeout for first size update.")}onAxisChange(e,i){i==null&&e.length===0||this.ctx.axisManager.updateAxes(i??[],e)}onSeriesChange(e,i){const s=i?.filter(n=>!e.includes(n))??[];this.destroySeries(s),this.seriesLayerManager?.setSeriesCount(e.length);for(const n of e){if(i?.includes(n))continue;const r=this.seriesLayerManager.requestGroup(n);n.attachSeries(r,this.seriesRoot,this.annotationRoot);const a=this;n.chart={get mode(){return a.mode},get isMiniChart(){return!1},get seriesRect(){return a.seriesRect}},n.resetAnimation(this.chartAnimationPhase),this.addSeriesListeners(n),n.addChartEventListeners()}this.seriesAreaManager?.seriesChanged(e)}destroySeries(e){e?.forEach(i=>{i.removeEventListener("nodeClick",this.onSeriesNodeClick),i.removeEventListener("nodeDoubleClick",this.onSeriesNodeDoubleClick),i.removeEventListener("groupingChanged",this.seriesGroupingChanged),i.destroy(),this.seriesLayerManager.releaseGroup(i),i.detachSeries(void 0,this.seriesRoot,this.annotationRoot),i.chart=void 0})}addSeriesListeners(e){this.hasEventListener("seriesNodeClick")&&e.addEventListener("nodeClick",this.onSeriesNodeClick),this.hasEventListener("seriesNodeDoubleClick")&&e.addEventListener("nodeDoubleClick",this.onSeriesNodeDoubleClick),this.hasEventListener("seriesVisibilityChange")&&e.addEventListener("seriesVisibilityChange",this.onSeriesVisibilityChange),e.addEventListener("groupingChanged",this.seriesGroupingChanged)}assignSeriesToAxes(){for(const e of this.axes)e.boundSeries=this.series.filter(i=>i.axes[e.direction]===e)}assignAxesToSeries(){const e=groupBy(this.axes,i=>i.direction);for(const i of this.series)for(const s of i.directions){const n=e[s];if(!n){logger_exports.warnOnce(`no available axis for direction [${s}]; check series and axes configuration.`);return}const r=i.getKeys(s),a=n.find(o=>!o.keys.length||r.some(c=>o.keys.includes(c)));if(!a){logger_exports.warnOnce(`no matching axis for direction [${s}] and keys [${r}]; check series and axes configuration.`);return}i.axes[s]=a}}parentResize(e){if(e==null||this.width!=null&&this.height!=null)return;let{width:i,height:s}=e;const{pixelRatio:n}=e;if(i=Math.floor(i),s=Math.floor(s),i===0&&s===0)return;const[r=0,a=0,o=1]=this._lastAutoSize??[];r===i&&a===s&&o===n||(this._lastAutoSize=[i,s,n],this.resize("SizeMonitor",{}))}resize(e,i){const{scene:s,animationManager:n}=this.ctx,{inWidth:r,inHeight:a,inMinWidth:o,inMinHeight:c,inOverrideDevicePixelRatio:l}=i;this.ctx.domManager.setSizeOptions(o??this.minWidth,c??this.minHeight,r??this.width,a??this.height);const h=r??this.width??this._lastAutoSize?.[0],u=a??this.height??this._lastAutoSize?.[1],d=l??this.overrideDevicePixelRatio??this._lastAutoSize?.[2];if(this.debug(`Chart.resize() from ${e}`,{width:h,height:u,pixelRatio:d,stack:new Error().stack}),!(h==null||u==null||!isFiniteNumber(h)||!isFiniteNumber(u))&&s.resize(h,u,d)){n.reset();let g=!0;(this.width==null||this.height==null)&&this._firstAutoSize&&(g=!1,this._firstAutoSize=!1),this.update(3,{forceNodeDataRefresh:!0,skipAnimations:g}),this._autoSizeNotify.notify()}}async updateData(){this.series.forEach(i=>i.setChartData(this.data));const e=this.modulesManager.mapModules(i=>i.updateData?.(this.data));await Promise.all(e)}async processData(){this.series.some(n=>n.canHaveAxes)&&(this.assignAxesToSeries(),this.assignSeriesToAxes());const e=new DataController(this.mode,this.suppressFieldDotNotation),i=this.series.map(n=>(n.resetDatumCallbackCache(),n.processData(e))),s=this.modulesManager.mapModules(n=>n.processData?.(e));this._cachedData=e.execute(this._cachedData),await Promise.all([...i,...s]);for(const n of this.axes)n.processData();this.updateLegends()}updateLegends(e){for(const{legend:i,legendType:s}of this.modulesManager.legends())s==="category"?this.setCategoryLegendData(e):this.setLegendData(s,i)}setCategoryLegendData(e){var i;const{ctx:{legendManager:s,stateManager:n}}=this;e&&this.series.forEach(a=>{const o=e.find(c=>c.seriesId===a.id);a.onLegendInitialState("category",o)});const r=this.series.flatMap(a=>{const o=a.getLegendData("category");return s.updateData(a.id,o),o});if(e){n.setStateAndRestore(s,e);return}if(this.mode!=="integrated"){const a={},o=new Map(this.series.map(c=>[c.id,c.type]));for(const{seriesId:c,symbol:{marker:l},label:h}of r.filter(u=>!u.hideInLegend)){if(l.fill==null)continue;const u=o.get(c),d=a[u]??(a[u]={});d[i=h.text]??(d[i]=l.fill),d[h.text]!==l.fill&&logger_exports.warnOnce(`legend item '${h.text}' has multiple fill colors, this may cause unexpected behaviour.`)}}s.update()}setLegendData(e,i){i.data=this.series.filter(s=>s.properties.showInLegend).flatMap(s=>s.getLegendData(e))}async processLayout(){const e=this.animationRect,{width:i,height:s}=this.ctx.scene,n=this.ctx.layoutManager.createContext(i,s);await this.performLayout(n),e&&!this.animationRect?.equals(e)&&this.ctx.animationManager.skipCurrentBatch(),this.debug("Chart.performUpdate() - seriesRect",this.seriesRect)}async updateSeries(e){const{seriesRect:i}=this;await Promise.all(e.map(s=>s.update({seriesRect:i}))),this.ctx.seriesLabelLayoutManager.updateLabels(this.series.filter(s=>s.visible&&s.usesPlacedLabels),this.padding,this.seriesRect)}async waitForUpdate(e=1e4,i=!1){const s=performance.now();for(;(this._pendingFactoryUpdatesCount>0||this.performUpdateType!==7||this.runningUpdateType!==7)&&!this.destroyed;){if(this._pendingFactoryUpdatesCount>0&&await this.updateMutex.waitForClearAcquireQueue(),(this.performUpdateType!==7||this.runningUpdateType!==7)&&await this._performUpdateNotify.await(),performance.now()-s>e){const n=`Chart.waitForUpdate() timeout of ${e} reached - first chart update taking too long.`;if(i)throw new Error(n);logger_exports.warnOnce(n)}isInputPending()&&await pause()}}filterMiniChartSeries(e){return e?.filter(i=>i.showInMiniChart!==!1)}applyOptions(e){const i=this.firstApply?e.processedOptions:e.diffOptions(this.chartOptions);if(i==null||Object.keys(i).length===0)return;const s=this.firstApply?{}:this.chartOptions.processedOptions,n=e.processedOptions;debug("Chart.applyOptions() - applying delta",i);const r=this.applyModules(n),a=["type","data","series","listeners","preset","theme","legend.listeners","navigator.miniChart.series","navigator.miniChart.label","locale.localeText","axes","topology","nodes","initialState","styleContainer"];i.listeners&&this.registerListeners(this,i.listeners),jsonApply(this,i,{skip:a});let o=!1,c="no-op";i.series!=null&&(c=this.applySeries(this,i.series,s?.series),o=!0),c==="replaced"&&this.resetAnimations(),this.applyAxes(this,n,s,c,[])&&(o=!0),i.data&&(this.data=i.data),i.legend?.listeners&&this.modulesManager.isEnabled("legend")&&Object.assign(this.legend.listeners,i.legend.listeners),i.locale?.localeText&&(this.modulesManager.getModule("locale").localeText=i.locale?.localeText),this.chartOptions=e;const l=this.modulesManager.getModule("navigator"),h=this.modulesManager.getModule("zoom");!l?.enabled&&!h?.enabled&&this.ctx.zoomManager.updateZoom("chart");const u=l?.miniChart,d=n.navigator?.miniChart?.series??n.series;u?.enabled===!0&&d!=null?this.applyMiniChartOptions(u,d,n,s):u?.enabled===!1&&(u.series=[],u.axes=[]),this.ctx.annotationManager.setAnnotationStyles(e.annotationThemes),o||(o=this.shouldForceNodeDataRefresh(i,c));const p=o||r?0:3;this.maybeResetAnimations(c),this.shouldClearLegendData(n,s,c)&&this.ctx.legendManager.clearData(),this.applyInitialState(n),debug("Chart.applyOptions() - update type",ChartUpdateType[p],{seriesStatus:c,forceNodeDataRefresh:o}),this.update(p,{forceNodeDataRefresh:o,newAnimationBatch:!0}),this.firstApply=!1}applyInitialState(e){const{annotationManager:i,chartTypeOriginator:s,historyManager:n,stateManager:r,zoomManager:a}=this.ctx,{initialState:o}=e;if("annotations"in e&&e.annotations?.enabled&&o?.annotations!=null){const c=o.annotations.map(l=>{const h=i.getAnnotationTypeStyles(l.type);return mergeDefaults(l,h)});r.setState(i,c)}o?.chartType!=null&&r.setState(s,o.chartType),(e.navigator?.enabled||e.zoom?.enabled)&&o?.zoom!=null&&r.setState(a,o.zoom),o?.legend!=null&&this.updateLegends(o.legend),o!=null&&n.clear()}maybeResetAnimations(e){if(this.mode==="standalone")switch(e){case"series-grouping-change":case"replaced":this.resetAnimations();break;default:}}shouldForceNodeDataRefresh(e,i){const s=!!e.data||i==="data-change"||i==="replaced",n=legendRegistry.getKeys(),r=Object.values(n).some(o=>e[o]!=null),a=e.title!=null&&e.subtitle!=null;return s||r||a}shouldClearLegendData(e,i,s){const n=s==="replaced"||s==="series-grouping-change"||s==="updated",r=i.legend!=null&&e.legend==null;return n||r}applyMiniChartOptions(e,i,s,n){const r=n?.navigator?.miniChart?.series??n?.series,a=this.applySeries(e,this.filterMiniChartSeries(i),this.filterMiniChartSeries(r));this.applyAxes(e,s,n,a,["axes[].tick","axes[].thickness","axes[].title","axes[].crosshair","axes[].gridLine","axes[].label"]);const o=e.series;for(const h of o)h.properties.id=void 0;const c=e.axes,l=c.find(h=>h.direction==="x");for(const h of c)h.nice=!1,h.gridLine.enabled=!1,h.label.enabled=h===l,h.tick.enabled=!1,h.interactionEnabled=!1;if(l!=null){const h=s.navigator?.miniChart,u=h?.label,d=h?.label?.interval;if(l.line.enabled=!1,l.label.set(without(u,["interval","rotation","minSpacing","autoRotate","autoRotateAngle"])),l.tick.set(without(d,["enabled","width","size","color","interval","step"])),l.type==="grouped-category"){l.label.enabled=!1,l.label.rotation=0;const{depthOptions:p}=l;if(p.length===0)p.set([{label:{enabled:!0}}]);else for(let f=1;fo.moduleFactory(this.getModuleContext())),n.type==="legend"&&this.modulesManager.getModule(n)?.attachLegend(this.ctx.scene),this[n.optionsKey]=this.modulesManager.getModule(n)):(this.modulesManager.removeModule(n),delete this[n.optionsKey]),s=!0)}return s}initSeriesDeclarationOrder(e){for(let i=0;ithis.createSeries(u));return this.initSeriesDeclarationOrder(h),e.series=h,"replaced"}debug("Chart.applySeries() - matchResult",n);const r=[];let a=!1,o=!1,c=!1;const l=n.changes.toSorted((h,u)=>h.targetIdx-u.targetIdx);for(const h of l)switch(o||(o=h.status==="series-grouping"),a||(a=h.diff?.data!=null),c||(c=h.status!=="no-op"),h.status){case"add":{const u=this.createSeries(h.opts);r.push(u),debug("Chart.applySeries() - created new series",u);break}case"remove":debug(`Chart.applySeries() - removing series at previous idx ${h.idx}`,h.series);break;case"no-op":r.push(h.series),debug(`Chart.applySeries() - no change to series at previous idx ${h.idx}`,h.series);break;case"series-grouping":case"update":default:{const{series:u,diff:d,idx:g}=h;debug(`Chart.applySeries() - applying series diff previous idx ${g}`,d,u),this.applySeriesValues(u,d),u.markNodeDataDirty(),r.push(u)}}return this.initSeriesDeclarationOrder(r),debug("Chart.applySeries() - final series instances",r),e.series=r,o?"series-grouping-change":a?"data-change":c?"updated":"no-op"}applyAxes(e,i,s,n,r=[]){if(!("axes"in i)||!i.axes)return!1;r=["axes[].type",...r];const{axes:a}=i;return!(n==="replaced")&&e.axes.length===a.length&&e.axes.every((l,h)=>l.type===a[h].type)&&isAgCartesianChartOptions(s)?(e.axes.forEach((l,h)=>{const u=s.axes?.[h]??{},d=jsonDiff(u,a[h]);debug(`Chart.applyAxes() - applying axis diff idx ${h}`,d);const g=`axes[${h}]`;jsonApply(l,d,{path:g,skip:r})}),!0):(debug(`Chart.applyAxes() - creating new axes instances; seriesStatus: ${n}`),e.axes=this.createAxis(a,r),!0)}createSeries(e){const i=seriesRegistry.create(e.type,this.getModuleContext());return this.applySeriesOptionModules(i,e),this.applySeriesValues(i,e),i}applySeriesOptionModules(e,i){const s=e.createModuleContext(),n=e.getModuleMap();for(const r of moduleRegistry.byType("series-option"))r.optionsKey in i&&r.seriesTypes.includes(e.type)&&n.addModule(r,a=>a.moduleFactory(s))}applySeriesValues(e,i){const s=e.getModuleMap(),{type:n,data:r,listeners:a,seriesGrouping:o,showInMiniChart:c,...l}=i;for(const h of EXPECTED_ENTERPRISE_MODULES)if(h.type==="series-option"&&h.optionsKey in l){const u=s.getModule(h.optionsKey);if(u){const d=l[h.optionsKey];delete l[h.optionsKey],u.properties.set(d)}}e.properties.set(l),"data"in i&&e.setOptionsData(r),a&&this.registerListeners(e,a),"seriesGrouping"in i&&(o==null?e.seriesGrouping=void 0:e.seriesGrouping={...e.seriesGrouping,...o})}createAxis(e,i){const s=[],n=this.getModuleContext();for(let r=0;ro.moduleFactory(s)),e[r.optionsKey]=n.getModule(r)):(n.removeModule(r),delete e[r.optionsKey]))}}registerListeners(e,i){e.clearEventListeners();for(const[s,n]of Object.entries(i))isFunction(n)&&e.addEventListener(s,n)}};_Chart.chartsInstances=new WeakMap,__decorateClass([ActionOnSet({newValue(t){this.destroyed||(this.ctx.domManager.setContainer(t),_Chart.chartsInstances.set(t,this))},oldValue(t){_Chart.chartsInstances.delete(t)}})],_Chart.prototype,"container",2),__decorateClass([ActionOnSet({newValue(t){this.resize("width option",{inWidth:t})}})],_Chart.prototype,"width",2),__decorateClass([ActionOnSet({newValue(t){this.resize("height option",{inHeight:t})}})],_Chart.prototype,"height",2),__decorateClass([ActionOnSet({newValue(t){this.resize("minWidth option",{inMinWidth:t})}})],_Chart.prototype,"minWidth",2),__decorateClass([ActionOnSet({newValue(t){this.resize("minHeight option",{inMinHeight:t})}})],_Chart.prototype,"minHeight",2),__decorateClass([ActionOnSet({newValue(t){this.resize("overrideDevicePixelRatio option",{inOverrideDevicePixelRatio:t})}})],_Chart.prototype,"overrideDevicePixelRatio",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"padding",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"seriesArea",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"keyboard",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"touch",2),__decorateClass([Validate(UNION(["standalone","integrated"],"a chart mode"))],_Chart.prototype,"mode",2),__decorateClass([ProxyProperty("chartCaptions.title")],_Chart.prototype,"title",2),__decorateClass([ProxyProperty("chartCaptions.subtitle")],_Chart.prototype,"subtitle",2),__decorateClass([ProxyProperty("chartCaptions.footnote")],_Chart.prototype,"footnote",2),__decorateClass([Validate(BOOLEAN)],_Chart.prototype,"suppressFieldDotNotation",2),__decorateClass([ActionOnSet({changeValue(t,e){this.onAxisChange(t,e)}})],_Chart.prototype,"axes",2),__decorateClass([ActionOnSet({changeValue(t,e){this.onSeriesChange(t,e)}})],_Chart.prototype,"series",2);var Chart=_Chart,logFunctions={2:(t,e)=>Math.log2(e),[Math.E]:(t,e)=>Math.log(e),10:(t,e)=>Math.log10(e)},DEFAULT_LOG=(t,e)=>Math.log(e)/Math.log(t);function log2(t,e,i){const s=Math.min(...e),n=logFunctions[t]??DEFAULT_LOG;return s>=0?n(t,i):-n(t,-i)}var powFunctions={[Math.E]:(t,e)=>Math.exp(e),10:(t,e)=>e>=0?10**e:1/10**-e},DEFAULT_POW=(t,e)=>t**e;function pow(t,e,i){const s=Math.min(...e),n=powFunctions[t]??DEFAULT_POW;return s>=0?n(t,i):-n(t,-i)}var LogScale=class extends ContinuousScale{constructor(t=[1,10],e=[0,1]){super(t,e),this.type="log",this.defaultClamp=!0,this.base=10,this.log=i=>log2(this.base,this.domain,i),this.pow=i=>pow(this.base,this.domain,i)}toDomain(t){return t}transform(t){const[e,i]=findMinMax(this.domain);return e>=0!=i>=0?NaN:e>=0?Math.log(t):-Math.log(-t)}transformInvert(t){const[e,i]=findMinMax(this.domain);return e>=0!=i>=0?NaN:e>=0?Math.exp(t):-Math.exp(-t)}niceDomain(t,e=this.domain){if(e.length<2)return[];const{base:i}=this,[s,n]=e,r=s>n?Math.ceil:Math.floor,a=s>n?Math.floor:Math.ceil,o=pow(i,e,r(log2(i,e,s))),c=pow(i,e,a(log2(i,e,n)));return[o,c]}ticks({interval:t,tickCount:e=ContinuousScale.defaultTickCount},i=this.domain,s){if(!i||i.length<2||e<1)return[];const n=this.base,[r,a]=i,o=Math.min(r,a),c=Math.max(r,a);let l=this.log(o),h=this.log(c);if(t){const f=x=>x>=o&&x<=c,y=Math.min(Math.abs(t),Math.abs(h-l)),m=range(l,h,y).map(this.pow).filter(f);if(!isDenseInterval(m.length,this.getPixelRange()))return m}if(!isInteger(n)||h-l>=e)return createTicks(l,h,Math.min(h-l,e)).map(this.pow);let u=[];const d=o>0;l=Math.floor(l)-1,h=Math.round(h)+1;const g=findRangeExtent(this.range)/e;let p=1/0;for(let f=l;f<=h;f++){const y=this.convert(this.pow(f+1));for(let m=1;m=g&&S>=g;b>=o&&b<=c&&(m===1||D||u.length===0)&&(u.push(b),p=v)}}return u=filterVisibleTicks(u,d,s),u}tickFormatter({specifier:t}){return t!=null?numberFormat(t):String}datumFormatter(t){return this.tickFormatter(t)}},QuadtreeNearest=class{constructor(t,e,i){this.root=new QuadtreeNodeNearest(t,e,i)}clear(t){this.root.clear(t)}addValue(t,e){const i={hitTester:t,value:e,distanceSquared:(s,n)=>t.distanceSquared(s,n)};this.root.addElem(i)}find(t,e){const i={best:{nearest:void 0,distanceSquared:1/0}};return this.root.find(t,e,i),i.best}},QuadtreeSubdivisions=class{constructor(t,e,i,s){this.nw=t,this.ne=e,this.sw=i,this.se=s}addElem(t){this.nw.addElem(t),this.ne.addElem(t),this.sw.addElem(t),this.se.addElem(t)}find(t,e,i){this.nw.find(t,e,i),this.ne.find(t,e,i),this.sw.find(t,e,i),this.se.find(t,e,i)}},QuadtreeNode=class{constructor(t,e,i){this.capacity=t,this.maxdepth=e,this.boundary=i??BBox.NaN,this.elems=[],this.subdivisions=void 0}clear(t){this.elems.length=0,this.boundary=t,this.subdivisions=void 0}addElem(t){this.addCondition(t)&&(this.subdivisions===void 0?this.maxdepth===0||this.elems.length1){const a=n>r?Math.ceil:Math.floor,o=n>r?Math.floor:Math.ceil,c=4;for(let l=0;lformatValue(n,i)}datumFormatter({ticks:e,fractionDigits:i,specifier:s}){return s!=null?tickFormat(e,s):n=>formatValue(n,i+1)}};function extent(t){if(t.length===0)return null;let e=1/0,i=-1/0;for(const n of t){const r=n instanceof Date?n.getTime():n;typeof r=="number"&&(ri&&(i=r))}const s=[e,i];return s.every(isFinite)?s:null}function normalisedExtentWithMetadata(t,e,i){let s=!1;return t.length>2&&(t=extent(t)??[NaN,NaN]),isNaN(e)||(s||(s=e>t[0]),t=[e,t[1]]),isNaN(i)||(s||(s=it[1]&&(t=[]),{extent:t,clipped:s}}var NumberAxis=class extends CartesianAxis{constructor(t,e=new LinearScale){super(t,e),this.min=NaN,this.max=NaN}normaliseDataDomain(t){const{min:e,max:i}=this,{extent:s,clipped:n}=normalisedExtentWithMetadata(t,e,i);return{domain:s,clipped:n}}};NumberAxis.className="NumberAxis",NumberAxis.type="number",__decorateClass([Validate(AND(NUMBER_OR_NAN,LESS_THAN("max"))),Default(NaN)],NumberAxis.prototype,"min",2),__decorateClass([Validate(AND(NUMBER_OR_NAN,GREATER_THAN("min"))),Default(NaN)],NumberAxis.prototype,"max",2);var TimeAxis=class extends CartesianAxis{constructor(t){super(t,new TimeScale),this.min=void 0,this.max=void 0}normaliseDataDomain(t){let{min:e,max:i}=this,s=!1;return typeof e=="number"&&(e=new Date(e)),typeof i=="number"&&(i=new Date(i)),t.length>2&&(t=extent(t)?.map(n=>new Date(n))??[]),e instanceof Date&&(s||(s=e>t[0]),t=[e,t[1]]),i instanceof Date&&(s||(s=it[1]&&(t=[]),{domain:t,clipped:s}}};TimeAxis.className="TimeAxis",TimeAxis.type="time",__decorateClass([Validate(AND(DATE_OR_DATETIME_MS,LESS_THAN("max")),{optional:!0})],TimeAxis.prototype,"min",2),__decorateClass([Validate(AND(DATE_OR_DATETIME_MS,GREATER_THAN("min")),{optional:!0})],TimeAxis.prototype,"max",2);var DataModelSeries=class extends Series{constructor(){super(...arguments),this.clipFocusBox=!0}getScaleInformation({xScale:t,yScale:e}){const i=ContinuousScale.is(t),s=ContinuousScale.is(e);return{isContinuousX:i,isContinuousY:s,xScaleType:t?.type,yScaleType:e?.type}}getModulePropertyDefinitions(){const t=this.axes.x?.scale,e=this.axes.y?.scale;return this.moduleMap.mapModules(i=>i.getPropertyDefinitions(this.getScaleInformation({xScale:t,yScale:e}))).flat()}async requestDataModel(t,e,i){i.props.push(...this.getModulePropertyDefinitions());const{dataModel:s,processedData:n}=await t.request(this.id,e??[],i);return this.dataModel=s,this.processedData=n,this.dispatch("data-processed",{dataModel:s,processedData:n}),{dataModel:s,processedData:n}}isProcessedDataAnimatable(){const t=this.processedData?.reduced?.animationValidation;if(!t)return!0;const{orderedKeys:e,uniqueKeys:i}=t;return e&&i}checkProcessedDataAnimatable(){this.isProcessedDataAnimatable()||this.ctx.animationManager.skipCurrentBatch()}pickFocus(t){const e=this.getNodeData();if(e===void 0||e.length===0)return;const i=this.computeFocusDatumIndex(t,e);if(i===void 0)return;const{clipFocusBox:s}=this,n=e[i],r={...t,datumIndex:i},a=this.computeFocusBounds(r);if(a!==void 0)return{bounds:a,clipFocusBox:s,datum:n,datumIndex:i}}computeFocusDatumIndex(t,e){const i=o=>{const{missing:c=!1,enabled:l=!0,focusable:h=!0}=e[o];return!c&&l&&h},s=(o,c)=>{for(;o>=0&&!i(o);)o+=c;return o===-1?void 0:o},n=(o,c)=>{for(;o0?r=n(a,t.datumIndexDelta):r=n(a,1)??s(a,-1),r===void 0?t.datumIndexDelta===0?void 0:t.datumIndex-t.datumIndexDelta:r}},SeriesItemHighlightStyle=class extends BaseProperties{constructor(){super(...arguments),this.fill="rgba(255,255,255, 0.33)",this.stroke="rgba(0, 0, 0, 0.4)",this.strokeWidth=2}};__decorateClass([Validate(COLOR_STRING,{optional:!0})],SeriesItemHighlightStyle.prototype,"fill",2),__decorateClass([Validate(RATIO,{optional:!0})],SeriesItemHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],SeriesItemHighlightStyle.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],SeriesItemHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO,{optional:!0})],SeriesItemHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH,{optional:!0})],SeriesItemHighlightStyle.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],SeriesItemHighlightStyle.prototype,"lineDashOffset",2);var SeriesHighlightStyle=class extends BaseProperties{};__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],SeriesHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO,{optional:!0})],SeriesHighlightStyle.prototype,"dimOpacity",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],SeriesHighlightStyle.prototype,"enabled",2);var TextHighlightStyle=class extends BaseProperties{constructor(){super(...arguments),this.color="black"}};__decorateClass([Validate(COLOR_STRING,{optional:!0})],TextHighlightStyle.prototype,"color",2);var HighlightProperties=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0}};__decorateClass([Validate(BOOLEAN,{optional:!0})],HighlightProperties.prototype,"enabled",2);var HighlightStyle=class extends BaseProperties{constructor(){super(...arguments),this.item=new SeriesItemHighlightStyle,this.series=new SeriesHighlightStyle,this.text=new TextHighlightStyle}};__decorateClass([Validate(OBJECT)],HighlightStyle.prototype,"item",2),__decorateClass([Validate(OBJECT)],HighlightStyle.prototype,"series",2),__decorateClass([Validate(OBJECT)],HighlightStyle.prototype,"text",2);var SeriesProperties=class extends BaseProperties{constructor(){super(...arguments),this.visible=!0,this.focusPriority=1/0,this.showInLegend=!0,this.cursor="default",this.nodeClickRange="exact",this.highlight=new HighlightProperties,this.highlightStyle=new HighlightStyle}};__decorateClass([Validate(STRING,{optional:!0})],SeriesProperties.prototype,"id",2),__decorateClass([Validate(BOOLEAN)],SeriesProperties.prototype,"visible",2),__decorateClass([Validate(REAL_NUMBER,{optional:!0})],SeriesProperties.prototype,"focusPriority",2),__decorateClass([Validate(BOOLEAN)],SeriesProperties.prototype,"showInLegend",2),__decorateClass([Validate(STRING)],SeriesProperties.prototype,"cursor",2),__decorateClass([Validate(INTERACTION_RANGE)],SeriesProperties.prototype,"nodeClickRange",2),__decorateClass([Validate(OBJECT)],SeriesProperties.prototype,"highlight",2),__decorateClass([Validate(OBJECT)],SeriesProperties.prototype,"highlightStyle",2);var DEFAULT_CARTESIAN_DIRECTION_KEYS={x:["xKey"],y:["yKey"]},DEFAULT_CARTESIAN_DIRECTION_NAMES={x:["xName"],y:["yName"]},CartesianSeriesNodeEvent=class extends SeriesNodeEvent{constructor(t,e,i,s){super(t,e,i,s),this.xKey=s.properties.xKey,this.yKey=s.properties.yKey}},CartesianSeriesProperties=class extends SeriesProperties{constructor(){super(...arguments),this.pickOutsideVisibleMinorAxis=!1}};__decorateClass([Validate(STRING,{optional:!0})],CartesianSeriesProperties.prototype,"legendItemName",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianSeriesProperties.prototype,"pickOutsideVisibleMinorAxis",2);var RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD=100,CartesianSeries=class extends DataModelSeries{constructor({pathsPerSeries:t=["path"],hasMarkers:e=!1,hasHighlightedLabels:i=!1,pathsZIndexSubOrderOffset:s=[],datumSelectionGarbageCollection:n=!0,markerSelectionGarbageCollection:r=!0,animationAlwaysUpdateSelections:a=!1,animationResetFns:o,directionKeys:c,directionNames:l,...h}){if(super({directionKeys:c,directionNames:l,canHaveAxes:!0,...h}),this.NodeEvent=CartesianSeriesNodeEvent,this.dataNodeGroup=this.contentGroup.appendChild(new Group({name:`${this.id}-series-dataNodes`,zIndex:0})),this.markerGroup=this.contentGroup.appendChild(new Group({name:`${this.id}-series-markers`,zIndex:1})),this.labelGroup=this.contentGroup.appendChild(new TranslatableGroup({name:`${this.id}-series-labels`})),this.labelSelection=Selection.select(this.labelGroup,Text),this.highlightSelection=Selection.select(this.highlightNode,()=>this.opts.hasMarkers?new Marker:this.nodeFactory()),this.highlightLabelSelection=Selection.select(this.highlightLabel,Text),this.annotationSelections=new Set,this.debug=Debug.create(),!c||!l)throw new Error(`Unable to initialise series type ${this.type}`);this.opts={pathsPerSeries:t,hasMarkers:e,hasHighlightedLabels:i,pathsZIndexSubOrderOffset:s,directionKeys:c,directionNames:l,animationResetFns:o,animationAlwaysUpdateSelections:a,datumSelectionGarbageCollection:n,markerSelectionGarbageCollection:r},this.paths=t.map(u=>new Path({name:`${this.id}-${u}`})),this.datumSelection=Selection.select(this.dataNodeGroup,()=>this.nodeFactory(),n),this.markerSelection=Selection.select(this.markerGroup,Marker,r),this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:u=>this.animateEmptyUpdateReady(u)},reset:"empty",skip:"ready",disable:"disabled"},ready:{updateData:"waiting",clear:"clearing",highlight:u=>this.animateReadyHighlight(u),highlightMarkers:u=>this.animateReadyHighlightMarkers(u),resize:u=>this.animateReadyResize(u),reset:"empty",skip:"ready",disable:"disabled"},waiting:{update:{target:"ready",action:u=>{this.ctx.animationManager.isSkipped()?this.resetAllAnimation(u):this.animateWaitingUpdateReady(u)}},reset:"empty",skip:"ready",disable:"disabled"},disabled:{update:u=>this.resetAllAnimation(u),reset:"empty"},clearing:{update:{target:"empty",action:u=>this.animateClearingUpdateEmpty(u)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}get contextNodeData(){return this._contextNodeData}getNodeData(){return this.contextNodeData?.nodeData}attachSeries(t,e,i){super.attachSeries(t,e,i),this.attachPaths(this.paths,e,i)}detachSeries(t,e,i){super.detachSeries(t,e,i),this.detachPaths(this.paths,e,i)}attachPaths(t,e,i){for(const s of t)this.contentGroup.appendChild(s)}detachPaths(t,e,i){for(const s of t)this.contentGroup.removeChild(s)}renderToOffscreenCanvas(){const t=this.getNodeData();return t!=null&&t.length>RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"?this.animationState.transition("skip"):t==="disabled"&&this.animationState.transition("disable")}addChartEventListeners(){this.destroyFns.push(this.ctx.chartEventManager.addListener("legend-item-click",t=>this.onLegendItemClick(t)),this.ctx.chartEventManager.addListener("legend-item-double-click",t=>this.onLegendItemDoubleClick(t)))}destroy(){super.destroy(),this._contextNodeData=void 0}update({seriesRect:t}){const{visible:e,_contextNodeData:i}=this,n=this.ctx.highlightManager?.getActiveHighlight()?.series===this,r=this.checkResize(t),a=this.updateHighlightSelection(n);this.updateSelections(e),this.updateNodes(a,n,e);const o=this.getAnimationData(t,i);o&&(r&&this.animationState.transition("resize",o),this.animationState.transition("update",o))}updateSelections(t){var e;const i=!this.opts.animationAlwaysUpdateSelections&&this.ctx.animationManager.isSkipped();if(!(!t&&i)&&!(!this.nodeDataRefresh&&!this.isPathOrSelectionDirty())){if(this.nodeDataRefresh){this.nodeDataRefresh=!1,this.debug("CartesianSeries.updateSelections() - calling createNodeData() for",this.id),this.markQuadtreeDirty(),this._contextNodeData=this.createNodeData();const s=this.isProcessedDataAnimatable();this._contextNodeData&&((e=this._contextNodeData).animationValid??(e.animationValid=s));const{dataModel:n,processedData:r}=this;n!==void 0&&r!==void 0&&this.dispatch("data-update",{dataModel:n,processedData:r})}this.updateSeriesSelections()}}updateSeriesSelections(t){const{datumSelection:e,labelSelection:i,markerSelection:s,paths:n}=this,r=this._contextNodeData;if(!r)return;const{nodeData:a,labelData:o,itemId:c}=r;this.updatePaths({seriesHighlighted:t,itemId:c,contextData:r,paths:n}),this.datumSelection=this.updateDatumSelection({nodeData:a,datumSelection:e}),this.labelSelection=this.updateLabelSelection({labelData:o,labelSelection:i})??i,this.opts.hasMarkers&&(this.markerSelection=this.updateMarkerSelection({nodeData:a,markerSelection:s}))}updateNodes(t,e,i){const{highlightSelection:s,highlightLabelSelection:n,opts:{hasMarkers:r,hasHighlightedLabels:a}}=this,o=!this.ctx.animationManager.isSkipped(),c=this.visible&&this._contextNodeData!=null&&i;this.contentGroup.visible=o||c,this.highlightGroup.visible=(o||c)&&e;const l=this.getOpacity();r?(this.updateMarkerNodes({markerSelection:s,isHighlight:!0}),this.animationState.transition("highlightMarkers",s)):(this.updateDatumNodes({datumSelection:s,isHighlight:!0}),this.animationState.transition("highlight",s)),a&&this.updateLabelNodes({labelSelection:n});const{dataNodeGroup:h,markerGroup:u,datumSelection:d,labelSelection:g,markerSelection:p,paths:f,labelGroup:y}=this,{itemId:m}=this.contextNodeData??{};h.opacity=l,h.visible=o||c,y.visible=c,r&&(u.opacity=l,u.visible=c),y&&(y.opacity=l),this.updatePathNodes({seriesHighlighted:e,itemId:m,paths:f,opacity:l,visible:c,animationEnabled:o}),h.visible&&(this.updateDatumNodes({datumSelection:d,highlightedItems:t,isHighlight:!1}),this.usesPlacedLabels||this.updateLabelNodes({labelSelection:g}),r&&this.updateMarkerNodes({markerSelection:p,isHighlight:!1}))}getHighlightLabelData(t,e){const i=t.filter(s=>s.datum===e.datum&&s.itemId===e.itemId);return i.length===0?void 0:i}getHighlightData(t,e){return e?[e]:void 0}updateHighlightSelection(t){const{highlightSelection:e,highlightLabelSelection:i,_contextNodeData:s}=this;if(!s)return;const n=this.ctx.highlightManager?.getActiveHighlight(),r=t&&n?.datum?n:void 0;let a,o;if(r!=null){const c=this.isLabelEnabled(),{labelData:l,nodeData:h}=s;o=this.getHighlightData(h,r),a=c?this.getHighlightLabelData(l,r):void 0}return this.highlightSelection=this.updateHighlightSelectionItem({items:o,highlightSelection:e}),this.highlightLabelSelection=this.updateHighlightSelectionLabel({items:a,highlightLabelSelection:i}),o}markQuadtreeDirty(){this.quadtree=void 0}*datumNodesIter(){for(const{node:t}of this.datumSelection)t.datum.missing!==!0&&(yield t)}getQuadTree(){if(this.quadtree===void 0){const{width:t,height:e}=this.ctx.scene.canvas,i=new BBox(0,0,t,e);this.quadtree=new QuadtreeNearest(100,10,i),this.initQuadTree(this.quadtree)}return this.quadtree}initQuadTree(t){}pickNodeExactShape(t){const e=super.pickNodeExactShape(t);if(e)return e;const{x:i,y:s}=t,{opts:{hasMarkers:n}}=this;let r;const{dataNodeGroup:a,markerGroup:o}=this;if(r=a.pickNode(i,s),!r&&n&&(r=o?.pickNode(i,s)),r&&r.datum.missing!==!0)return{datum:r.datum,distance:0};for(const c of this.moduleMap.modules()){const{datum:l}=c.pickNodeExact(t)??{};if(l!=null&&l?.missing!==!0)return{datum:l,distance:0}}}pickNodeClosestDatum(t){const{x:e,y:i}=t,{axes:s,_contextNodeData:n}=this;if(!n)return;const r=s.x,a=s.y,o={x:e,y:i};let c=1/0,l;for(const h of n.nodeData){const{point:{x:u=NaN,y:d=NaN}={}}=h;if(isNaN(u)||isNaN(d)||!(r?.inRange(u)&&a?.inRange(d)))continue;const p=Math.max((o.x-u)**2+(o.y-d)**2,0);pp.direction);if(e&&l.length===0)return;const[h="x"]=l,u=[i,s];h!=="x"&&u.reverse();const d=[1/0,1/0];let g;for(const p of r.nodeData){const{x:f=NaN,y=NaN}=p.point??p.midPoint??{};if(isNaN(f)||isNaN(y)||p.missing===!0)continue;const m=[o?.inRange(f),c?.inRange(y)];if(h!=="x"&&m.reverse(),!m[0]||!a&&!m[1])continue;const x=[f,y];h!=="x"&&x.reverse();let b=!0;for(let v=0;vd[v]){b=!1;break}else I{const a=i?.[r]??r;return this.xCoordinateRange(s[a],n,a)})}domainForVisibleRange(t,e,i,s,n,r){const{processedData:a,dataModel:o}=this,[c,l]=s,h=this.keysOrValues(i);if(n){const p=this.visibleRange(i,s,r);return o.getDomainBetweenRange(this,e,p,a)}const u=e.map(p=>this.keysOrValues(p));let d=1/0,g=-1/0;return h.forEach((p,f)=>{const[y,m]=this.xCoordinateRange(p,0,f);if(!(ml))for(let x=0;xg?[NaN,NaN]:[d,g]}domainForClippedRange(t,e,i,s){const{processedData:n,dataModel:r,axes:a}=this,c=axisExtent(a[t==="x"?"y":"x"]);if(!c)return e.flatMap(p=>r.getDomain(this,p,"value",n));const l=this.keysOrValues(i);if(s){const p=clippedRangeIndices(l.length,c,f=>l[f]);return r.getDomainBetweenRange(this,e,p,n)}const h=e.map(p=>this.keysOrValues(p)),u=c[0].valueOf(),d=c[1].valueOf(),g=[];return l.forEach((p,f)=>{const y=p.valueOf();if(yd)return;const m=h.map(x=>x[f]);y>=u&&g.push(...m),y<=d&&g.push(...m)}),g}countVisibleItems(t,e,i,s,n){const{dataModel:r,processedData:a}=this;if(!r||!a)return 1/0;const o=this.keysOrValues(t),c=e.map(I=>r.resolveColumnById(this,I,a)),l=this.axes.x,h=this.axes.y,u=this.shouldFlipXY(),d=l.range,g=h.range,p=(I,S,D)=>I[0]+(D-S[0])/(S[1]-S[0])*(I[1]-I[0]),f=p(d,l.visibleRange,i[0]),y=p(d,l.visibleRange,i[1]),m=p(g,h.visibleRange,u?s[0]:s[1]),x=p(g,h.visibleRange,u?s[1]:s[0]),b=Math.round((i[0]+(i[1]-i[0])/2)*o.length),v=0;return countExpandingSearch(0,o.length-1,b,n,I=>{let[S,D]=this.xCoordinateRange(o[I],v,I),[w,L]=this.yCoordinateRange(c.map(A=>A[I]),v,I);return!isFiniteNumber(S)||!isFiniteNumber(D)||!isFiniteNumber(w)||!isFiniteNumber(L)?!1:(u&&([S,D,w,L]=[w,L,S,D]),S>=f&&D<=y&&w>=m&&L<=x)})}updateHighlightSelectionItem(t){const{opts:{hasMarkers:e}}=this,{items:i,highlightSelection:s}=t,n=i??[];if(e){const r=s;return this.updateMarkerSelection({nodeData:n,markerSelection:r})}else return this.updateDatumSelection({nodeData:n,datumSelection:s})}updateHighlightSelectionLabel(t){return this.updateLabelSelection({labelData:t.items??[],labelSelection:t.highlightLabelSelection})}updateDatumSelection(t){return t.datumSelection}updateDatumNodes(t){}updateMarkerSelection(t){return t.markerSelection}updateMarkerNodes(t){}updatePaths(t){t.paths.forEach(e=>e.visible=!1)}updatePathNodes(t){const{paths:e,opacity:i,visible:s}=t;for(const n of e)n.opacity=i,n.visible=s}resetPathAnimation(t){const{path:e}=this.opts?.animationResetFns??{};e&&t.paths.forEach(i=>{resetMotion([i],e)})}resetDatumAnimation(t){const{datum:e}=this.opts?.animationResetFns??{};e&&resetMotion([t.datumSelection],e)}resetLabelAnimation(t){const{label:e}=this.opts?.animationResetFns??{};e&&resetMotion([t.labelSelection],e)}resetMarkerAnimation(t){const{marker:e}=this.opts?.animationResetFns??{};e&&this.opts.hasMarkers&&resetMotion([t.markerSelection],e)}resetAllAnimation(t){this.ctx.animationManager.stopByAnimationGroupId(this.id),this.resetPathAnimation(t),this.resetDatumAnimation(t),this.resetLabelAnimation(t),this.resetMarkerAnimation(t),t.contextData?.animationValid===!1&&this.ctx.animationManager.skipCurrentBatch()}animateEmptyUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation(t)}animateWaitingUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation(t)}animateReadyHighlight(t){const{datum:e}=this.opts?.animationResetFns??{};e&&resetMotion([t],e)}animateReadyHighlightMarkers(t){const{marker:e}=this.opts?.animationResetFns??{};e&&resetMotion([t],e)}animateReadyResize(t){this.resetAllAnimation(t)}animateClearingUpdateEmpty(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation(t)}getAnimationData(t,e){const{_contextNodeData:i}=this;return i?{datumSelection:this.datumSelection,markerSelection:this.markerSelection,labelSelection:this.labelSelection,annotationSelections:[...this.annotationSelections],contextData:i,previousContextData:e,paths:this.paths,seriesRect:t}:void 0}updateLabelSelection(t){return t.labelSelection}getScaling(t){if(t instanceof LogScale){const{range:e,domain:i}=t;return{type:"log",convert:s=>t.convert(s),domain:[i[0],i[1]],range:[e[0],e[1]]}}else if(t instanceof ContinuousScale){const{range:e,domain:i}=t;return{type:"continuous",domain:[i[0],i[1]],range:[e[0],e[1]]}}else if(t instanceof BandScale){const{domain:e}=t;return{type:"category",domain:e,inset:t.inset,step:t.step}}}calculateScaling(){const t={};for(const e of Object.values(ChartAxisDirection)){const i=this.axes[e];if(!i)continue;const s=this.getScaling(i.scale);s!=null&&(t[e]=s)}return t}};function axisExtent(t){let e,i;if(t instanceof NumberAxis&&(Number.isFinite(t.min)||Number.isFinite(t.max))?(e=Number.isFinite(t.min)?t.min:void 0,i=Number.isFinite(t.max)?t.max:void 0):t instanceof TimeAxis&&(t.min!=null||t.max!=null)&&({min:e,max:i}=t),!(e==null&&i==null))return e??(e=-1/0),i??(i=1/0),[e,i]}function clippedRangeIndices(t,e,i){const s=e[0].valueOf(),n=e[1].valueOf(),r=findMinIndex(0,t-1,o=>{const c=i(o)?.valueOf();return!Number.isFinite(c)||c>=s});let a=findMaxIndex(0,t-1,o=>{const c=i(o)?.valueOf();return!Number.isFinite(c)||c<=n});return r==null||a==null?[0,0]:(a=Math.min(a+1,t),[r,a])}var directions=["top","right","bottom","left"],_CartesianChart=class yt extends Chart{constructor(e,i){super(e,i),this.paired=!0,this.lastUpdateClipRect=void 0,this.lastLayoutWidth=NaN,this.lastLayoutHeight=NaN}onAxisChange(e,i){super.onAxisChange(e,i),this.ctx!=null&&this.ctx.zoomManager.updateAxes(e)}destroySeries(e){super.destroySeries(e),this.lastLayoutWidth=NaN,this.lastLayoutHeight=NaN}getChartType(){return"cartesian"}setRootClipRects(e){const{seriesRoot:i,annotationRoot:s}=this;i.setClipRect(e),s.setClipRect(e)}async processData(){await super.processData();for(const e of this.axes){const i=this.getSyncedDomain(e);i!=null&&e.setDomains(i)}this.ctx.updateService.dispatchProcessData({series:{shouldFlipXY:this.shouldFlipXY()}})}performLayout(e){const{seriesRoot:i,annotationRoot:s}=this,{clipSeries:n,seriesRect:r,visible:a}=this.updateAxes(e.layoutBox);this.seriesRoot.visible=a,this.seriesRect=r,this.animationRect=e.layoutBox;const{x:o,y:c}=r;if(e.width!==this.lastLayoutWidth||e.height!==this.lastLayoutHeight)for(const d of[i,s])d.translationX=Math.floor(o),d.translationY=Math.floor(c);else{const{translationX:d,translationY:g}=i;staticFromToMotion(this.id,"seriesRect",this.ctx.animationManager,[i,s],{translationX:d,translationY:g},{translationX:Math.floor(o),translationY:Math.floor(c)},{phase:"update"})}this.lastLayoutWidth=e.width,this.lastLayoutHeight=e.height;const l=r.clone().grow(this.seriesArea.padding),h=this.seriesArea.clip||n?l:void 0,{lastUpdateClipRect:u}=this;this.lastUpdateClipRect=h,this.ctx.animationManager.isActive()&&u!=null?this.ctx.animationManager.animate({id:this.id,groupId:"clip-rect",phase:"update",from:u,to:l,onUpdate:d=>this.setRootClipRects(d),onComplete:()=>this.setRootClipRects(h)}):this.setRootClipRects(h),this.ctx.layoutManager.emitLayoutComplete(e,{axes:this.axes.map(d=>d.getLayoutState()),series:{visible:a,rect:r,paddedRect:l},clipSeries:n})}updateAxes(e){const{clipSeries:i,seriesRect:s,overflows:n}=this.resolveAxesLayout(e);for(const r of this.axes)r.update(),r.setCrossLinesVisible(!n),this.clipAxis(r,s,e);return{clipSeries:i,seriesRect:s,visible:!n}}resolveAxesLayout(e){let i,s,n=0;const r=10;do if(s=i??this.getDefaultState(),i=this.updateAxesPass(new Map(s.axisAreaWidths),e.clone()),n++>r){logger_exports.warn("Max iterations reached. Unable to stabilize axes layout.");break}while(!this.isLayoutStable(i,s));return this.lastAreaWidths=i.axisAreaWidths,i}updateAxesPass(e,i){const s=new Map,n={};let r=!1,a=!1;for(const m of directions){const x=this.seriesArea.padding[m],b=this.axes.findLast(v=>v.position===m);b?b.seriesAreaPadding=x:i.shrink(x,m)}const o=(e.get("left")??0)+(e.get("right")??0),c=(e.get("top")??0)+(e.get("bottom")??0),l=this.buildCrossLinePadding(e);i.width<=o+l.hPadding||i.height<=c+l.vPadding?r=!0:i.shrink(l);const h=i.clone().shrink(Object.fromEntries(e));for(const m of this.axes){const{position:x="left",direction:b}=m;this.sizeAxis(m,h,x);const v=b==="y",{primaryTickCount:I,bbox:S}=m.calculateLayout(m.nice?n[b]:void 0);n[b]??(n[b]=I),a||(a=m.dataDomain.clipped||m.visibleRange[0]>0||m.visibleRange[1]<1),s.set(m.id,Math.ceil(m.thickness??(v?S?.width:S?.height)??0))}const u=Object.entries(groupBy(this.axes,m=>m.position??"left")),{width:d,height:g,pixelRatio:p}=this.ctx.scene,f=new Map,y=new Map;for(const[m,x]of u){let v=m==="left"||m==="right"?g%p:d%p,I=0;for(const S of x){y.set(S.id,v);const D=s.get(S.id)??0;I=Math.max(I,v+D),S.layoutConstraints.stacked&&(v+=D+yt.AxesPadding)}f.set(m,Math.ceil(I))}for(const[m,x]of u)this.positionAxes({axes:x,position:m,axisWidths:s,axisOffsets:y,axisAreaWidths:f,axisBound:i,seriesRect:h});return{clipSeries:a,seriesRect:h,axisAreaWidths:f,overflows:r}}buildCrossLinePadding(e){const i={top:0,right:0,bottom:0,left:0,hPadding:0,vPadding:0};this.axes.forEach(s=>{s.crossLines?.forEach(n=>{n.calculatePadding?.(i)})});for(const[s,n=0]of Object.entries(i))i[s]=Math.max(n-(e.get(s)??0),0);return i.hPadding=i.left+i.right,i.vPadding=i.top+i.bottom,i}clampToOutsideSeriesRect(e,i,s,n){const r=s==="x"?e.x:e.y,a=s==="x"?e.width:e.height;return n===1?Math.min(i,r+a):Math.max(i,r)}getSyncedDomain(e){const i=this.modulesManager.getModule("sync");if(!i?.enabled)return;const s=i.getSyncedDomain(e);if(s&&e.dataDomain.domain.length){let n;const{domain:r}=e.scale;if(ContinuousScale.is(e.scale)){const[a,o]=findMinMax(s);n=a!==r[0]||o!==r[1]}else n=!arraysEqual(s,r);n&&!this.skipSync&&i.updateSiblings()}return s}sizeAxis(e,i,s){const n=e instanceof CategoryAxis,r=s==="left"||s==="right",{width:a,height:o}=i,c=r?o:a;let l=0,h=c,{min:u,max:d}=this.ctx.zoomManager.getAxisZoom(e.id);const{width:g,unit:p,align:f}=e.layoutConstraints;p==="px"?h=l+g:h=h*g/100,f==="end"&&(l=c-(h-l),h=c),r&&(n?[u,d]=[1-d,1-u]:[l,h]=[h,l]),e.range=[l,h],e.visibleRange=[u,d],e.gridLength=r?a:o}positionAxes(e){const{axes:i,axisBound:s,axisWidths:n,axisOffsets:r,axisAreaWidths:a,seriesRect:o,position:c}=e,l=a.get(c)??0;let h="x",u="y",d=1;(c==="top"||c==="bottom")&&(h="y",u="x");let g=s[h];(c==="right"||c==="bottom")&&(d=-1,g+=h==="x"?s.width:s.height);for(const p of i){const f=a.get(u==="x"?"left":"top")??0,y=n.get(p.id)??0,m=r.get(p.id)??0;p.gridPadding=l-m-y,p.translation[u]=s[u]+f,p.translation[h]=this.clampToOutsideSeriesRect(o,g+d*(m+y),h,d)}}shouldFlipXY(){return this.series.every(e=>e instanceof CartesianSeries&&e.shouldFlipXY())}getDefaultState(){const e=new Map;if(this.lastAreaWidths)for(const{position:i="left"}of this.axes){const s=this.lastAreaWidths.get(i);s!=null&&e.set(i,s)}return{axisAreaWidths:e,clipSeries:!1,overflows:!1}}isLayoutStable(e,i){if(i.overflows!==e.overflows||i.clipSeries!==e.clipSeries)return!1;for(const s of e.axisAreaWidths.keys())if(!i.axisAreaWidths.has(s))return!1;for(const[s,n]of i.axisAreaWidths.entries()){const r=e.axisAreaWidths.get(s);if((n!=null||r!=null)&&n!==r)return!1}return!0}clipAxis(e,i,s){const n=Math.ceil(e.gridLine?.width??0),r=Math.ceil(e.line?.width??0);let{width:a,height:o}=i;switch(a+=e.direction==="x"?n:r,o+=e.direction==="y"?n:r,e.clipGrid(i.x,i.y,a,o),e.position){case"left":case"right":e.clipTickLines(s.x,i.y-n,s.width+n,i.height+n*2);break;case"top":case"bottom":e.clipTickLines(i.x-n,s.y,i.width+n*2,s.height+n);const{label:c,labelNodes:l,scale:h}=e;if(ContinuousScale.is(h)&&c.enabled&&c.avoidCollisions&&l.length>1){const u=l.toSorted((f,y)=>f.translationY-y.translationY),d=u.at(-1),g=d.getBBox(),p=i.x+g.y+g.height<=s.x+s.width+this.padding.right;if(d.visible=p,p||e.visibleRange[0]>0||e.visibleRange[1]<1)u[0].visible=!0;else{const f=u[0].getBBox();u[0].visible=f.y>=0}}break}}};_CartesianChart.className="CartesianChart",_CartesianChart.type="cartesian",_CartesianChart.AxesPadding=15;var CartesianChart=_CartesianChart,CartesianChartModule={type:"chart",name:"cartesian",detect:isAgCartesianChartOptions,create(t,e){return new CartesianChart(t,e)}},PolarAxis=class extends Axis{constructor(){super(...arguments),this.shape="polygon",this.innerRadiusRatio=0,this.defaultTickMinSpacing=20}updatePosition(){super.updatePosition();const t=prepareAxisAnimationContext(this),e=resetAxisSelectionFn(t);this.axisGroup.setProperties(this.getAxisTransform()),this.gridLineGroupSelection.each(e),this.tickLineGroupSelection.each(e),this.tickLabelGroupSelection.each(resetAxisLabelSelectionFn())}computeLabelsBBox(t,e){return null}computeRange(){}getAxisLinePoints(){}};__decorateClass([Validate(UNION(["polygon","circle"],"a polar axis shape"))],PolarAxis.prototype,"shape",2),__decorateClass([Validate(RATIO)],PolarAxis.prototype,"innerRadiusRatio",2);var PolarSeries=class extends DataModelSeries{constructor({useLabelLayer:t=!1,pickModes:e=[1,0],canHaveAxes:i=!1,animationResetFns:s,...n}){super({...n,useLabelLayer:t,pickModes:e,directionKeys:{x:["angleKey"],y:["radiusKey"]},directionNames:{x:["angleName"],y:["radiusName"]},canHaveAxes:i}),this.itemGroup=this.contentGroup.appendChild(new Group),this.nodeData=[],this.itemSelection=Selection.select(this.itemGroup,()=>this.nodeFactory(),!1),this.labelSelection=Selection.select(this.labelGroup,()=>this.labelFactory(),!1),this.highlightSelection=Selection.select(this.highlightGroup,()=>this.nodeFactory()),this.highlightLabelSelection=Selection.select(this.highlightLabel,()=>this.labelFactory()),this.centerX=0,this.centerY=0,this.radius=0,this.animationResetFns=s,this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:r=>this.animateEmptyUpdateReady(r)},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",highlight:r=>this.animateReadyHighlight(r),highlightMarkers:r=>this.animateReadyHighlightMarkers(r),resize:r=>this.animateReadyResize(r),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:r=>this.animateWaitingUpdateReady(r)},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:r=>this.animateClearingUpdateEmpty(r)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getItemNodes(){return[...this.itemGroup.children()]}getNodeData(){return this.nodeData}setSeriesIndex(t){return super.setSeriesIndex(t)?(this.contentGroup.zIndex=[t,1],this.highlightGroup.zIndex=[t,2],this.labelGroup.zIndex=[t,3],!0):!1}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"&&this.animationState.transition("skip")}labelFactory(){const t=new Text;return t.pointerEvents=1,t}addChartEventListeners(){this.destroyFns.push(this.ctx.chartEventManager?.addListener("legend-item-click",t=>this.onLegendItemClick(t)))}getInnerRadius(){return 0}computeLabelsBBox(t,e){return null}resetAllAnimation(){const{item:t,label:e}=this.animationResetFns??{};this.ctx.animationManager.stopByAnimationGroupId(this.id),t&&resetMotion([this.itemSelection,this.highlightSelection],t),e&&resetMotion([this.labelSelection,this.highlightLabelSelection],e),this.itemSelection.cleanup(),this.labelSelection.cleanup(),this.highlightSelection.cleanup(),this.highlightLabelSelection.cleanup()}animateEmptyUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}animateWaitingUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}animateReadyHighlight(t){const{item:e,label:i}=this.animationResetFns??{};e&&resetMotion([this.highlightSelection],e),i&&resetMotion([this.highlightLabelSelection],i)}animateReadyHighlightMarkers(t){}animateReadyResize(t){this.resetAllAnimation()}animateClearingUpdateEmpty(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}computeFocusBounds(t){const e=this.getNodeData()?.[t.datumIndex];if(e!==void 0)return this.itemSelection.select(i=>i instanceof Path&&i.datum===e)[0]}getSeriesRange(t,e){return[NaN,NaN]}},PolarChart=class extends Chart{constructor(t,e){super(t,e),this.padding=new Padding(40),this.ctx.axisManager.axisGroup.zIndex=6}getChartType(){return"polar"}async performLayout(t){const{layoutBox:e}=t;e.shrink(this.seriesArea.padding.toJson());const i=e.clone();this.seriesRect=i,this.animationRect=i,this.seriesRoot.translationX=i.x,this.seriesRoot.translationY=i.y,await this.computeCircle(i),this.axes.forEach(s=>s.update()),this.ctx.layoutManager.emitLayoutComplete(t,{series:{visible:!0,rect:i,paddedRect:i}})}updateAxes(t,e,i,s){const n=this.axes.find(c=>c.direction==="x"),r=this.axes.find(c=>c.direction==="y");if(!(n instanceof PolarAxis)||!(r instanceof PolarAxis))return;const a=n.scale,o=r.innerRadiusRatio;n.innerRadiusRatio=o,n.computeRange(),n.gridLength=s,r.gridAngles=a.ticks({nice:n.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.map(c=>a.convert(c)),r.gridRange=n.range,r.range=[s,s*o],[n,r].forEach(c=>{c.translation.x=t.x+e,c.translation.y=t.y+i,c.calculateLayout()})}async computeCircle(t){const e=this.series.filter(isPolarSeries),i=this.axes.filter(isPolarAxis),s=(l,h,u)=>{this.updateAxes(t,l,h,u),e.forEach(g=>{g.centerX=l,g.centerY=h,g.radius=u});const d=e.filter(g=>g.type==="donut"||g.type==="pie");if(d.length>1){const g=d.map(p=>{const f=p.getInnerRadius();return{series:p,innerRadius:f}}).sort((p,f)=>p.innerRadius-f.innerRadius);g.at(-1).series.surroundingRadius=void 0;for(let p=0;p{const h=[];for(const g of iterate(i,e)){const p=await g.computeLabelsBBox({hideWhenNecessary:l},t);p&&h.push(p)}if(h.length===0){s(n,r,a);return}const u=BBox.merge(h),d=this.refineCircle(u,o,t);s(d.centerX,d.centerY,d.radius),o=d.radius};await c(),await c(),await c(),await c({hideWhenNecessary:!0}),await c({hideWhenNecessary:!0});for(const l of iterate(i,e))await l.computeLabelsBBox({hideWhenNecessary:!0},t);return{radius:o,centerX:n,centerY:r}}refineCircle(t,e,i){const n=-e,r=-e,a=e,o=e;let c=Math.max(0,n-t.x),l=Math.max(0,r-t.y),h=Math.max(0,t.x+t.width-a),u=Math.max(0,t.y+t.height-o);c=h=Math.max(c,h),l=u=Math.max(l,u);const d=i.width-c-h,g=i.height-l-u;let p=Math.min(d,g)/2;const f=.5*i.width/2,y=.5*i.height/2,m=Math.min(f,y);if(pi.height){const S=i.height-2*p;Math.min(l,u)*2>S?(l=S/2,u=S/2):l>u?l=S-u:u=S-l}if(2*p+v>i.width){const S=i.width-2*p;Math.min(c,h)*2>S?(c=S/2,h=S/2):c>h?c=S-h:h=S-c}}const x=c+2*p+h,b=l+2*p+u;return{centerX:(i.width-x)/2+c+p,centerY:(i.height-b)/2+l+p,radius:p}}};PolarChart.className="PolarChart",PolarChart.type="polar";function isPolarSeries(t){return t instanceof PolarSeries}function isPolarAxis(t){return t instanceof PolarAxis}var PolarChartModule={type:"chart",name:"polar",detect:isAgPolarChartOptions,create(t,e){return new PolarChart(t,e)}};