@lightningchart/lcjs
Version:
A high-performance charting library.
2 lines • 1.34 MB
JavaScript
/* LightningChart JS v7.0.3 */
"use strict";Object.defineProperty(exports,"o",{value:!0});var t=require("immutable"),i=require("earcut");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function e(t){if(t&&t.o)return t;var i=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var e=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,e.get?e:{enumerable:!0,get:function(){return t[s]}})}})),i.default=t,Object.freeze(i)}var h=e(t),r=s(i);class n{constructor(){this.u=!0}S(){return this.u}}class o extends n{constructor(t,i){super(),this.M=t,this._=t,this.u=i}C(t){return t!==this.M&&(this._=this.M,this.M=t,this.u=!0),this}T(){return this.M}S(){return super.S()}}const a=(t,i)=>({x:t,y:i}),l=(t,i)=>({x:t,y:i}),u=(t,i,s)=>({position:t,high:i,low:s}),c=(t,i,s)=>({x:t,y:i,z:s}),d=t=>{const i=Array(0),s=Array(0);return t.length>0&&t.forEach((t=>{i.push(a(t.position,t.high)),s.push(a(t.position,t.low))})),[i,s]},f=(t,i)=>({min:t,max:i}),A=(t,i,s,e)=>({x:t,y:i,width:s,height:e}),g=(t,i=!0)=>new o(t,i),p=(t=0,i=0,s=0,e=0)=>({left:t,top:i,right:s,bottom:e}),v=p,y=(t,i)=>({left:void 0!==i.left?i.left:t.left,top:void 0!==i.top?i.top:t.top,right:void 0!==i.right?i.right:t.right,bottom:void 0!==i.bottom?i.bottom:t.bottom}),m=t.Record({type:"color",r:1,g:1,b:1,a:1});class S extends m{constructor(t){super(t)}toUint32(){return void 0!==this.F||(this.F=T(this.getR(),this.getG(),this.getB(),this.getA())),this.F}toString(){return`color:${this.r},${this.g},${this.b},${this.a}`}setA(t){return this.set("a",t/255)}setR(t){return this.set("r",t/255)}setG(t){return this.set("g",t/255)}setB(t){return this.set("b",t/255)}getA(){return 255*this.get("a")}getR(){return 255*this.get("r")}getG(){return 255*this.get("g")}getB(){return 255*this.get("b")}getHighlight(){return this.I||(this.I=new S({r:this.r+.45*(1-this.r),g:this.g+.45*(1-this.g),b:this.b+.45*(1-this.b),a:this.a<1?this.a+.45*(1-this.a):1})),this.I}getLighter(){return this.P||(this.P=new S({r:this.r+.4*(1-this.r),g:this.g+.4*(1-this.g),b:this.b+.4*(1-this.b),a:this.a})),this.P}getDarker(){return this.L||(this.L=new S({r:this.r-.4*(1-this.r),g:this.g-.4*(1-this.g),b:this.b-.4*(1-this.b),a:this.a})),this.L}toRGBAString(){return`rgba( ${255*this.r}, ${255*this.g}, ${255*this.b}, ${255*this.a} )`}}const x=t=>!(!t||"object"!=typeof t||!("type"in t)||"color"!==t.type),b=(t,i,s,e=255)=>new S({r:t/255,g:i/255,b:s/255,a:e/255}),M=t=>{const i=t.startsWith("#")?t.substring(1):t.startsWith("0x")?t.substr(2):t;switch(i.length){case 8:return new S({r:Number(`0x${i.substring(0,2)}`)/255,g:Number(`0x${i.substring(2,4)}`)/255,b:Number(`0x${i.substring(4,6)}`)/255,a:Number(`0x${i.substring(6,8)}`)/255});case 6:return new S({r:Number(`0x${i.substring(0,2)}`)/255,g:Number(`0x${i.substring(2,4)}`)/255,b:Number(`0x${i.substring(4,6)}`)/255});case 4:return new S({r:Number(`0x${i.charAt(0)}${i.charAt(0)}`)/255,g:Number(`0x${i.charAt(1)}${i.charAt(1)}`)/255,b:Number(`0x${i.charAt(2)}${i.charAt(2)}`)/255,a:Number(`0x${i.charAt(3)}${i.charAt(3)}`)/255});case 3:return new S({r:Number(`0x${i.charAt(0)}${i.charAt(0)}`)/255,g:Number(`0x${i.charAt(1)}${i.charAt(1)}`)/255,b:Number(`0x${i.charAt(2)}${i.charAt(2)}`)/255});default:throw new Error(`ColorHEX parsing error | input: ${t}`)}},w=(t,i=1,s=1)=>{let e,h,r;t/=360;const n=Math.floor(6*t),o=6*t-n,a=s*(1-i),l=s*(1-o*i),u=s*(1-(1-o)*i);switch(n%6){case 0:e=s,h=u,r=a;break;case 1:e=l,h=s,r=a;break;case 2:e=a,h=s,r=u;break;case 3:e=a,h=l,r=s;break;case 4:e=u,h=a,r=s;break;default:e=s,h=a,r=l}return new S({r:e,g:h,b:r})},_={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",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#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",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",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",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:"#d87093",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",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},C=new S({}),k=b(0,0,0,0),T=(t,i,s,e=255)=>(e<<24|s<<16|i<<8|t)>>>0,F=(t,i)=>t.value-i.value,I=t.Record({type:"lut",steps:[],title:"",units:"",interpolate:!0,color:b(0,0,0,255),length:0,min:0,max:0,subranges:[],isValid:!1,percentageValues:!1}),P=t=>{const{steps:i}=t,s=i.length;i.sort(F);const[e,h]=s>0?[i[0].value,i[s-1].value]:[0,0],r=s>0?s-1:0,n=Array(r);for(let t=0;t<r;t+=1)n[t]={min:i[t],max:i[t+1]};return{min:e,max:h,length:s,steps:i,subranges:n,isValid:s>0&&e!==h}};class L extends I{constructor(t){super(((t,i)=>({steps:t.steps,title:t.title,units:t.units,interpolate:t.interpolate,percentageValues:t.percentageValues,color:t.color,length:i.length,min:i.min,max:i.max,subranges:i.subranges,isValid:i.isValid}))(t,P(t)))}toString(){return`LUT:interpolate=${this.interpolate},steps=${this.steps.length},percentage=${this.percentageValues}`}setSteps(t){return this.merge(P({...this,steps:t}))}getSteps(){return this.get("steps")}setTitle(t){return this.set("title",t)}getTitle(){return this.get("title")}setUnits(t){return this.set("units",t)}getUnits(){return this.get("units")}setInterpolation(t){return this.set("interpolate",t)}getInterpolation(){return this.get("interpolate")}setFallbackColor(t){return this.set("color",t)}getFallbackColor(){return this.get("color")}setPercentageValues(t){return this.set("percentageValues",t)}getPercentageValues(){return this.get("percentageValues")}getColors(t,i){if(Array.isArray(t)){if(Array.isArray(t[0])){const s=t,e=s.length,h=s[0].length,r=[...Array(e)].map((()=>Array(h)));for(let t=0;t<e;t+=1)for(let e=0;e<h;e+=1)r[t][e]=this.D(s[t][e],i);return r}const s=t,e=s.length,h=Array(e);for(let t=0;t<e;t+=1)h[t]=this.D(s[t],i);return h}return this.D(t,i)}D(t,i){const{steps:s}=this,e=s.length;if(0===e)return this.getFallbackColor();if(1===e)return s[0].color||this.color;if(this.percentageValues,this.percentageValues&&i&&(t=Math.max(Math.min((t-i.min)/(i.max-i.min),1),0)),this.interpolate){for(let i=0;i<e-1;i+=1){const e=s[i],o=s[i+1],a=Math.min(e.value,o.value),l=Math.max(e.value,o.value);if(t>=a&&t<=l){if(a===l)return e.color;const i=(t-e.value)/(o.value-e.value);return h=e.color,r=o.color,n=i,new S({r:h.r+(r.r-h.r)*n,g:h.g+(r.g-h.g)*n,b:h.b+(r.b-h.b)*n,a:h.a+(r.a-h.a)*n})}}return t<s[0].value?s[0].color:s[e-1].color}var h,r,n;for(let i=e-1;i>=0;i-=1)if(t>=s[i].value)return s[i].color;return s[0].color}}const B=t.Record({type:"fillstyle",fillType:"empty"});class D extends B{toString(){return"emptyFill"}}const E=new D,R=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"empty"===t.fillType),z=t.Record({type:"fillstyle",fillType:"solid",color:b(255,255,255)});class O extends z{}class V extends O{constructor(t){super({...t,fillType:"solid"})}toString(){return`solidFill:${this.color.toString()}`}setColor(t){return x(t)?this.set("color",t):this.set("color",t(this.get("color")))}getColor(){return this.get("color")}setA(t){return this.setColor(this.getColor().setA(t))}setR(t){return this.setColor(this.getColor().setR(t))}setG(t){return this.setColor(this.getColor().setG(t))}setB(t){return this.setColor(this.getColor().setB(t))}}const N=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"solid"===t.fillType);class G extends O{constructor(t){super({...t,fillType:"individual"})}toString(){return`individualPointFill:${this.color.toString()}`}setFallbackColor(t){return x(t)?this.set("color",t):this.set("color",t(this.get("color")))}getFallbackColor(){return this.get("color")}}const $=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"individual"===t.fillType),U=t.Record({type:"fillstyle",fillType:"palette",lut:new L({steps:[]}),lookUpProperty:"value"});class Y extends U{constructor(t){super({...t,fillType:"palette"})}toString(){return`palettedFill:lut=${this.lut.toString()},lookUpProperty=${this.lookUpProperty}`}getPalette(){return this.get("lut")}setLookUpProperty(t){return"function"==typeof t?this.set("lookUpProperty",t(this.get("lookUpProperty"))):this.set("lookUpProperty",t)}getLookUpProperty(){return this.get("lookUpProperty")}}const H=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"palette"===t.fillType);var X,W;exports.GradientShape=void 0,(X=exports.GradientShape||(exports.GradientShape={})).circle="circle",X.ellipse="ellipse",exports.GradientExtent=void 0,(W=exports.GradientExtent||(exports.GradientExtent={})).closestSide="closest-side",W.closestCorner="closest-corner",W.farthestSide="farthest-side",W.farthestCorner="farthest-corner";const j=t.Record({type:"fillstyle",fillType:"radial-gradient",stops:[{color:M("#f00"),offset:0},{color:M("#0f0"),offset:1}],position:a(.5,.5),shape:exports.GradientShape.ellipse,extent:exports.GradientExtent.farthestCorner});class Z extends j{constructor(t){if(super(t),null===t||t&&null===t.stops||t&&t.stops&&!Array.isArray(t.stops)||t&&t.stops&&Array.isArray(t.stops)&&t.stops.length<2)throw new Error("RadialGradientFill requires minimum two color stops to be defined.")}toString(){return`radialGradientFill:${this.shape},${this.extent},${this.position.x},${this.position.y},${this.stops.map((t=>`${t.offset},${t.color.toString()}`)).join(",")}`}setColorStops(t){if(t.length<2)throw new Error("Minimum of two color stops required");return this.set("stops",t)}getColorStops(){return this.get("stops")}setPosition(t){return this.set("position",t)}getPosition(){return this.get("position")}setShape(t){return this.set("shape",t)}getShape(){return this.get("shape")}setExtent(t){return this.set("extent",t)}getExtent(){return this.get("extent")}}const Q=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"radial-gradient"===t.fillType),J=t.Record({type:"fillstyle",fillType:"linear-gradient",stops:[{color:M("#f00"),offset:0},{color:M("#0f0"),offset:1}],angle:0});class K extends J{constructor(t){if(super(t),null===t||t&&null===t.stops||t&&t.stops&&!Array.isArray(t.stops)||t&&t.stops&&Array.isArray(t.stops)&&t.stops.length<2)throw new Error("LinearGradientFill requires minimum two color stops to be defined.")}toString(){return`linearGradientFill:${this.angle},${this.stops.map((t=>`${t.offset},${t.color.toString()}`)).join(",")}`}setColorStops(t){if(t.length<2)throw new Error("Minimum of two color stops required");const i=t.sort(((t,i)=>t.offset-i.offset));return this.set("stops",i)}getColorStops(){return this.get("stops")}setAngle(t,i){return this.set("angle",i?function(t){return 180*t/Math.PI}(t):t)}getAngle(t){return t?Ns(this.get("angle")):this.get("angle")}}const q=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"linear-gradient"===t.fillType);class tt{constructor(t,i,s,e){this.R=new xt,this.cellIndex=t,this.cellSpan=i,this.cellsAmount=s,this.observedAmount=e,this.x=new it,this.y=new it,this.z=new it;const h={...t},r={...i};if(e){const t=t=>{const i=t.value;this.cellsAmount.x=i.reduce(As,0),this.cellIndex.x=i.reduce(((t,i,s)=>s>=h.x?t:t+i),0),this.cellSpan.x=i.reduce(((t,i,s)=>s>=h.x&&s<h.x+r.x?t+i:t),0),this.R.O("cellresize",{})};e.x.V("change",t),t({value:e.x.T()});const i=t=>{const i=t.value;this.cellsAmount.y=i.reduce(As,0),this.cellIndex.y=i.reduce(((t,i,s)=>s>=h.y?t:t+i),0),this.cellSpan.y=i.reduce(((t,i,s)=>s>=h.y&&s<h.y+r.y?t+i:t),0),this.R.O("cellresize",{})};e.y.V("change",i),i({value:e.y.T()}),this.N=()=>{e.x.G("change",t),e.y.G("change",i)}}}$(){return this.N&&(this.N(),this.N=void 0),this}addEventListener(t,i,s){this.R.addEventListener(t,i,s)}removeEventListener(t,i){this.R.removeEventListener(t,i)}}class it extends n{constructor(){super(...arguments),this.U=0,this.Y=10,this.H=1}X(){return this.u=!1,this}W(){return this.u=!0,this}getInnerStart(){return this.U}getInnerEnd(){return this.Y}getInnerInterval(){return Math.abs(this.getInnerEnd()-this.getInnerStart())}j(t,i){return this.U=t,this.Y=i,this.Z(),this}J(t){return this.H=t,this.Z(),this}K(t){return t/this.H}Z(){const t=this.K(this.Y-this.U),i=this.H;void 0!==this.q&&!1!==Qt(t,this.q)||(this.u=!0,this.tt=i,this.q=t)}it(){return this.q}st(){return this.tt}et(){return this.Y<this.U}ht(t,i){return!0}}const st={d1:t=>new t.scale1DConstructor(0,1,1,void 0),d2:t=>(new t.scaleXYConstructor).rt({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0),d3:()=>new tt({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0)},et=(t,i,s)=>i===s?t:s.nt(i.ot(t)),ht=(t,i,s)=>{if(i===s)return t;const e=i instanceof he?i.x:i.x instanceof he?i.x.x:i.x.ut,h=i instanceof he?i.y:i.y instanceof he?i.y.y:i.y.ut,r=s instanceof he?s.x:s.x instanceof he?s.x.x:s.x.ut,n=s instanceof he?s.y:s.y instanceof he?s.y.y:s.y.ut;return{...t,x:et(t.x,e,r),y:et(t.y,h,n)}},rt=(...t)=>{if(0===t.length)return{remove:Zt};let i=!1;const s=t.map((s=>{const e=e=>{((s,e,h)=>{i||(i=!0,t.filter((t=>t!==s)).forEach((t=>t.ct(e,h,!1,s.getStopped(),"synchronizedAxis"))),i=!1)})(s,e.start,e.end)};return s.addEventListener("intervalchange",e),e}));let e=!1;const h=t.map((i=>{const s=s=>{((i,s)=>{e||(e=!0,t.filter((t=>t!==i)).forEach((t=>t.setStopped(s))),e=!1)})(i,s.isStopped)};return i.addEventListener("stoppedchange",s),s}));return{remove:()=>{t.forEach(((t,i)=>{t.removeEventListener("intervalchange",s[i]),t.removeEventListener("stoppedchange",h[i])}))}}},nt=t=>t&&"object"==typeof t&&"column"in t&&"row"in t,ot=t=>t&&"object"==typeof t&&"z"in t&&"column"in t&&"row"in t,at=t=>t&&"object"==typeof t&&"annulus"in t&&"sector"in t,lt=t=>t&&"object"==typeof t&&"index"in t;var ut;!function(t){t[t.Nearest=0]="Nearest",t[t.NearestX=1]="NearestX",t[t.NearestY=2]="NearestY"}(ut||(ut={}));const ct=(t,i,s,e,h,r,n,o,a,l)=>{const u=t.length;if(0===u)return;const c=e?1:0,d=u-(h?2:1);if(s===ut.Nearest)return dt(t,i,r,n,c,d);if(s===ut.NearestX||s===ut.NearestY){if("boolean"==typeof l&&("x"===a&&s===ut.NearestX||"y"===a&&s===ut.NearestY))return gt(t,ht(i,n,r),a,l,c,d);if(s===ut.NearestX)return ft(t,ht(i,n,r),o,c,d);if(s===ut.NearestY)return At(t,ht(i,n,r),o,c,d)}},dt=(t,i,s,e,h,r)=>{let n,o=Number.MAX_VALUE;for(let a=h;a<=r;a+=1){const h=t[a];if(!Number.isNaN(h.x)&&!Number.isNaN(h.y)){const t=ht(h,s,e),r=(t.x-i.x)**2+(t.y-i.y)**2;r<o&&(o=r,n=a)}}return n},ft=(t,i,s,e,h)=>{if(i.x<s.min.x||i.x>s.max.x)return;let r,n=Number.MAX_VALUE;for(let s=e;s<=h;s+=1){const e=t[s],h=e.x>i.x?e.x-i.x:i.x-e.x;h<n&&!Number.isNaN(e.x)&&!Number.isNaN(e.y)&&(n=h,r=s)}return r},At=(t,i,s,e,h)=>{if(i.y<s.min.y||i.y>s.max.y)return;let r,n=Number.MAX_VALUE;for(let s=e;s<=h;s+=1){const e=t[s],h=e.y>i.y?e.y-i.y:i.y-e.y;h<n&&!Number.isNaN(e.x)&&!Number.isNaN(e.y)&&(n=h,r=s)}return r},gt=(t,i,s,e,h,r)=>{const n="x"===s,o=n?i.x:i.y,a=t[h],l=t[r],u=a.x<l.x?a.x:l.x,c=a.y<l.y?a.y:l.y,d=a.x>l.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(n&&(o<u||o>d)||!n&&(o<c||o>f))return;let A=h,g=Math.floor((h+r)/2),p=r,v=-1;for(;;){const i=o-(n?t[g].x:t[g].y);if(i*(e?-1:1)>0)A=Math.min(g+1,p),v=Math.floor((A+p)/2);else{if(0===Math.abs(i))return g;p=Math.max(g-1,A),v=Math.floor((A+p)/2)}if(v===g){const s=g>h?Math.abs(o-(n?t[g-1].x:t[g-1].y)):rs,e=g<r?Math.abs(o-(n?t[g+1].x:t[g+1].y)):rs,a=Math.abs(i);switch(Math.min(a,s,e)){case s:return g-1;case e:return g+1;default:return g}}else g=v}},pt=(t,i,s,e,h,r)=>{const n="x"===s,o=n?i.x:i.y,a=t[h],l=t[r],u=a.x<l.x?a.x:l.x,c=a.y<l.y?a.y:l.y,d=a.x>l.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(n&&(o<u||o>d)||!n&&(o<c||o>f))return;let A=h,g=Math.floor((h+r)/2),p=r,v=-1;for(;;){const s=o-(n?t[g].x:t[g].y);if(s*(e?-1:1)>0)A=Math.min(g+1,p),v=Math.floor((A+p)/2);else{if(0===Math.abs(s))return{a:g,b:g,lerpAmount:0};p=Math.max(g-1,A),v=Math.floor((A+p)/2)}if(v===g){if(s*(e?-1:1)<0&&g>h){const s=t[g-1],e=t[g];return{a:g-1,b:g,lerpAmount:n?(i.x-s.x)/(e.x-s.x):(i.y-s.y)/(e.y-s.y)}}if(g<r){const s=t[g],e=t[g+1];return{a:g,b:g+1,lerpAmount:n?(i.x-s.x)/(e.x-s.x):(i.y-s.y)/(e.y-s.y)}}return{a:g,b:g,lerpAmount:0}}g=v}};let vt=0;class yt{constructor(t,i,s){this.dt=g(!0),this.ft=!1,this.At=!0,this.vt=!1,this.yt=void 0,this.St=0,this.R=new xt,this.xt=t,this.bt=i,this.Mt=s,this.wt=vt,vt+=1,this._t=t.Ct.highlightColorOffset}kt(){let t;return this.Tt("DataPattern",(i=>(t=i.pattern,!0))),"ProgressiveX"===t||"RegressiveX"===t?ut.NearestX:"ProgressiveY"===t||"RegressiveY"===t?ut.NearestY:ut.Nearest}Ft(){}addEventListener(t,i,s){this.R.addEventListener(t,i,s)}O(t,i,s,e){this.R.O(t,i,{collectionMember:s,info:e})}removeEventListener(t,i){this.R.removeEventListener(t,i)}It(t){return void 0!==this.Mt.find((i=>i.type===t))}Tt(t,i){var s;return!!this.It(t)&&!0===i(null===(s=this.Mt.find((i=>i.type===t)))||void 0===s?void 0:s.args)}dispose(){return this.ft||(this.xt.Pt(this),this.ft=!0,this.bt(this),this.R.O("dispose",{})),this}isDisposed(){return this.ft}setVisible(t){const i=this.At;return this.At=t,!t&&i&&this.dt.T()&&this.xt.Pt(this),this}getVisible(){return this.At}setPointerEvents(t){const i=this.dt.T();return this.dt.C(t),t||i&&this.xt.Pt(this),this}getPointerEvents(){return this.dt.T()}Lt(t){return this.yt=t,this}Bt(){return this.yt?this.yt:mt}Dt(t){return this.St=t,this}Et(){return this.St}Rt(t){return this._t=t,this}zt(){return this._t}}const mt=f(a(0,0),a(0,0)),St={click:!0,contextmenu:!0,dblclick:!0,gotpointercapture:!0,lostpointercapture:!0,pointercancel:!0,pointerdown:!0,pointerenter:!0,pointerleave:!0,pointermove:!0,pointerout:!0,pointerover:!0,pointerup:!0,touchcancel:!0,touchend:!0,touchmove:!0,touchstart:!0,wheel:!0,drag:!0,dragend:!0,dragenter:!0,dragleave:!0,dragover:!0,dragstart:!0,drop:!0};class xt{constructor(){this.Ot=new Array,this.Vt=[],this.dt=!0,this.Nt=!1}setPointerEvents(t){this.dt=t,this.Vt.forEach((i=>i.setPointerEvents(t)))}getPointerEvents(){return this.dt}addEventListener(t,i,s){this.Ot.push({listener:i,key:t,options:s||{}})}removeEventListener(t,i){const s=this.Ot.findIndex((t=>t.listener===i));s>=0&&this.Ot.splice(s,1)}set draggable(t){this.Nt=t,this.Vt.forEach((i=>{i.vt=t}))}get draggable(){return this.Nt}O(t,i,s=void 0){this.Ot.slice().reverse().forEach((e=>{e.key===t&&(e.listener(i,s),!0===e.options.once&&this.removeEventListener(t,e.listener))}))}Gt(t,i){Object.keys(St).forEach((s=>{t.addEventListener(s,((t,e)=>{const h=bt(t)?{clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY}:t,r=(null==i?void 0:i.getExtraData)&&void 0!==h.clientX?i.getExtraData(h,e.collectionMember,e.info):{};this.O(s,t,r),!t.defaultPrevented&&(null==i?void 0:i.continueIfNotPrevented)&&i.continueIfNotPrevented(s,t,r)}))})),this.Vt.push(t),t.addEventListener("dispose",(()=>{const i=this.Vt.indexOf(t);i>=0&&this.Vt.splice(i,1)})),t.vt=this.Nt,t.setPointerEvents(this.dt)}$t(t,i){Object.keys(St).forEach((s=>{t.addEventListener(s,((t,e)=>{const h=i(e.collectionMember);h&&this.O(s,t,h)}))})),this.Vt.push(t),t.addEventListener("dispose",(()=>{const i=this.Vt.indexOf(t);i>=0&&this.Vt.splice(i,1)})),t.setPointerEvents(this.dt),t.vt=this.Nt}Ut(t){Object.keys(St).forEach((i=>{t.addEventListener(i,((t,s)=>{this.O(i,t,s)}))})),t.setPointerEvents(this.dt),t.draggable=this.Nt}}const bt=t=>!(!t||"object"!=typeof t||!("touches"in t)),Mt={linear:(t,i,s)=>{const e=i-t;return h=>h<s?t+e/s*h:i},easeIn:(t,i,s)=>e=>e<s?t+Math.abs(2*(Math.sqrt(.5)*e/s)**2)*(i-t):i,easeOut:(t,i,s)=>e=>e<s?t+Math.abs(1-2*(Math.sqrt(.5)*(1-e/s))**2)*(i-t):i,ease:(t,i,s)=>e=>e<s?t+(e<s/2?.5*(e/s*2)**2.5:.5+.5*(1-(1-2*(e/s-.5))**2.5))*(i-t):i,logarithmic:t=>{const i=Mi(t);return(s,e,h)=>{const r=i(s),n=i(e);return i=>i<h?t**(r+Math.abs(1-2*(Math.sqrt(.5)*(1-i/h))**2)*(n-r)):e}}};class wt{constructor(t,i,s,e=Mt.linear,h){this.delta=0,this.nextAnimations=new Array,this.Yt=!1,this.easing=Mt.linear,this.isOver=()=>(this.delta===this.duration||this.Yt)&&0===this.nextAnimations.length,this.R=new xt,this.values=t,this.action=i,this.duration=s,this.easing=e,this.Ht=h,this.eases=t.map((([t,i])=>e(t,i,s)))}Xt(){this.R.O("start",{})}start(){return this.Ht.includes(this)||this.Ht.push(this),this}addNextAnimations(t){return t instanceof Array?t.forEach((t=>this.nextAnimations.push(t))):this.nextAnimations.push(t),this}NextAnimation(t,i,s=this.duration,e=this.easing){const h=new wt(t,i,s,e,this.Ht);return this.nextAnimations.push(h),h}finish(t=!0){if(this.Yt=!0,this.Ht.splice(this.Ht.indexOf(this),1),this.nextAnimations.length>0){const i=this.nextAnimations[0];return t&&this.R.Ot.forEach((t=>{"allAnimationEnd"===t.key&&i.addEventListener("allAnimationEnd",t.listener),"everyAnimationEnd"===t.key&&i.addEventListener("everyAnimationEnd",t.listener)})),i.addNextAnimations(this.nextAnimations.slice(1)),i.start(),t&&(this.R.O("end",{nextAnimation:i}),this.R.O("everyAnimationEnd",{nextAnimation:i})),i}t&&(this.R.O("end",{nextAnimation:void 0}),this.R.O("everyAnimationEnd",{nextAnimation:void 0}),this.R.O("allAnimationEnd",{}))}finishAll(t=!0){let i=this;for(;i;)i=i.finish(t)}getFinalValues(){return this.nextAnimations.length>0?this.nextAnimations[this.nextAnimations.length-1].values.map(Wt):this.values.map(Wt)}getTimeUntilFinish(){let t=this.duration-this.delta;for(let i=0;i<this.nextAnimations.length;i+=1)t+=this.nextAnimations[i].duration-this.nextAnimations[i].delta;return t}addEventListener(t,i,s){this.R.addEventListener(t,i,s)}removeEventListener(t,i){this.R.removeEventListener(t,i)}}const _t=(t,i=60)=>{i>60&&console.log("Note: Animator FPS is usually capped at 60 by the browser!");const s=[];let e,h,r=0;const n=()=>{e=void 0;const o=Date.now();h=h||o,r=o-h,r/1e3>=1/i&&(h=Date.now()-r%(1e3/i),s.forEach((t=>{0===t.delta&&t.Xt(),t.delta+=r-r%(1e3/i),t.delta>t.duration&&(t.delta=t.duration),t.action(t.eases.map((i=>i(t.delta)))),t.delta===t.duration&&t.finish()})),t()),s.length>0?e=Yt.requestAnimationFrame(n):(e=void 0,h=void 0)};return(t=1e3,i=Mt.linear)=>(h,r,o=t)=>{const a=new wt(h,r,o,i,s).start();return e||(e=Yt.requestAnimationFrame(n)),a}};var Ct;exports.ImageFitMode=void 0,(Ct=exports.ImageFitMode||(exports.ImageFitMode={}))[Ct.Fill=0]="Fill",Ct[Ct.Fit=1]="Fit",Ct[Ct.Stretch=2]="Stretch",Ct[Ct.Center=3]="Center",Ct[Ct.Tile=4]="Tile";const kt=t.Record({type:"fillstyle",fillType:"image",source:void 0,surroundingColor:b(0,0,0,0),sourceMissingColor:b(0,0,0,0),fitMode:exports.ImageFitMode.Fill});class Tt extends kt{constructor(t){super(t)}setSource(t){return this.set("source",t)}getSource(){return this.get("source")}setSurroundingColor(t){return x(t)?this.set("surroundingColor",t):this.set("surroundingColor",t(this.get("surroundingColor")))}getSurroundingColor(){return this.get("surroundingColor")}setSourceMissingColor(t){return x(t)?this.set("sourceMissingColor",t):this.set("sourceMissingColor",t(this.get("sourceMissingColor")))}getSourceMissingColor(){return this.get("sourceMissingColor")}setFitMode(t){return this.set("fitMode",t)}getFitMode(){return this.get("fitMode")}toString(){return`imagefill:${this.fitMode}`}}const Ft=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"image"===t.fillType),It=t.Record({type:"linestyle",lineType:"empty"}),Pt=new class extends It{constructor(){super(...arguments),this.thickness=0}setThickness(t){return this}getThickness(){return 0}Wt(){return 0}setFillStyle(t){return this}getFillStyle(){return E}},Lt=t=>!(!t||"object"!=typeof t||!("lineType"in t)||"empty"!==t.lineType),Bt=-34028234663852886e22,Dt="-340282346638528859811704183484516925440.0";class Et extends Error{constructor(t,i){super(`ChartError: ${t} ${i?`in ${i.constructor.name}`:""}`),Object.setPrototypeOf(this,Et.prototype)}}class Rt extends Error{constructor(t,i,s=!1){const e=`EngineError: ${t} ${i?`in ${i.constructor.name}`:""}`;super(e),s&&Yt.alert(e),Object.setPrototypeOf(this,Rt.prototype)}}class zt extends Rt{constructor(t){super(t),Object.setPrototypeOf(this,zt.prototype)}}var Ot,Vt,Nt,Gt;exports.UISpace=void 0,(Ot=exports.UISpace||(exports.UISpace={}))[Ot.Content=0]="Content",Ot[Ot.PaddedContent=1]="PaddedContent",Ot[Ot.PaddedBackground=2]="PaddedBackground",Ot[Ot.Everything=3]="Everything",exports.UIVisibilityModes=void 0,(Vt=exports.UIVisibilityModes||(exports.UIVisibilityModes={}))[Vt.never=0]="never",Vt[Vt.always=1]="always",Vt[Vt.whenHovered=2]="whenHovered",Vt[Vt.whenDragged=3]="whenDragged",Vt[Vt.whenNotDragged=4]="whenNotDragged",Vt[Vt.whenHoveredOrDragged=5]="whenHoveredOrDragged",exports.UIDraggingModes=void 0,(Nt=exports.UIDraggingModes||(exports.UIDraggingModes={}))[Nt.notDraggable=0]="notDraggable",Nt[Nt.draggable=1]="draggable",Nt[Nt.onlyHorizontal=2]="onlyHorizontal",Nt[Nt.onlyVertical=3]="onlyVertical",exports.UIDirections=void 0,(Gt=exports.UIDirections||(exports.UIDirections={}))[Gt.Up=0]="Up",Gt[Gt.Right=1]="Right",Gt[Gt.Down=2]="Down",Gt[Gt.Left=3]="Left";const $t=(...t)=>{const i=t=>t&&"object"==typeof t&&!Array.isArray(t);return t.reduce(((t,s)=>s?(Object.keys(s).forEach((e=>{const h=t[e],r=s[e];i(h)&&i(r)?t[e]=$t(h,r):t[e]=r})),t):t),{})},Ut=t=>{if(t.resourcesBaseUrl){const i=t.styleFactory(t.resourcesBaseUrl),s=Ft(i)&&i.getSource(),e=s&&s instanceof Image?s:void 0;return null==e||e.addEventListener("error",(()=>{Xi(t.resourcesBaseUrl,e.src,"Theme resource",{shouldCrash:!1})})),i}const i=`${Yt.location.origin}/resources`,s=t.styleFactory(i);if(Ft(s)){const i=s.getSource();i instanceof Image&&i.addEventListener("error",(()=>{const s=t.styleFactory("https://lcjs-resources.lightningchart.com/v1"),e=Ft(s)&&s.getSource(),h=e&&e instanceof Image?e:void 0;Yt.console.warn("LightningChart JS warning | fallbacking to publicly hosted asset resources.\nFor more information, please see https://lightningchart.com/js-charts/docs/troubleshooting/warning-using-publicly-hosted-resources/"),null==h||h.addEventListener("load",(()=>{t.apply(s)})),null==h||h.addEventListener("error",(()=>{Xi(t.resourcesBaseUrl,i.src,"Theme resource",{shouldCrash:!1})}))}))}return s},Yt="undefined"!=typeof window?window:"undefined"!=typeof global&&global._lcjs?global._lcjs:{},Ht=(t,i)=>t.x===i.x&&t.y===i.y,Xt=t=>t!==rs&&t!==ns&&!Number.isNaN(t)&&Number.isFinite(t)&&t!==1/0&&t!==-1/0,Wt=t=>t[1],jt=t=>t.dispose(),Zt=()=>{},Qt=(t,i)=>t===i,Jt=(t,i,s)=>s>i?Math.min(Math.max(t,i),s):Math.min(Math.max(t,s),i),Kt=t=>Array.prototype.concat.apply([],t),qt=(t,i)=>void 0===t||Number.isNaN(t)?i:t,ti=t=>t.jt(),ii=t=>t.Zt(),si=t=>t.Qt(),ei=t=>t.Jt(),hi=t=>t.min.x,ri=t=>t.max.x,ni=t=>t.min.y,oi=t=>t.max.y,ai=(t,i,s,e,h)=>{if(t.length>0){let r=h?e(h):void 0;for(let e=0;e<t.length;e+=1){const h=i(t[e]);void 0!==h&&(r=void 0!==r?s(r,h):h)}return r}if(h)return e(h)},li=(t,i)=>t.position===i.position&&t.high===i.high&&t.low===i.low,ui=a(0,1),ci=a(1,0),di=a(0,-1),fi=a(-1,0),Ai=a(0,0),gi=t=>{switch(t){case exports.UIDirections.Up:return ui;case exports.UIDirections.Right:return ci;case exports.UIDirections.Down:return di;case exports.UIDirections.Left:return fi;default:return Ai}},pi=t=>t===exports.UIDirections.Left||t===exports.UIDirections.Right,vi=t=>{t.stopPropagation(),t.preventDefault()},yi=(t,i)=>{if(!i)return t;const s=t.length,e=new Float32Array(2*s);let h=0;for(let i=0;i<s;i+=1){const s=t[i],r=Math.fround(s);e[h+0]=r,e[h+1]=s-r,h+=2}return e},mi=(t,i,s=Float32Array)=>{if(!i){const i=t.length,e=new s(2*i);let h=0;for(let s=0;s<i;s+=1){const i=t[s];e[h+0]=i.x,e[h+1]=i.y,h+=2}return e}const e=t.length,h=new s(4*e);let r=0;for(let i=0;i<e;i+=1){const s=t[i],e=Math.fround(s.x),n=Math.fround(s.y);h[r+0]=e,h[r+1]=n,h[r+2]=s.x-e,h[r+3]=s.y-n,r+=4}return h},Si=t=>{const i=t.length,s=new Float32Array(3*i);let e=0;for(let h=0;h<i;h+=1){const i=t[h];s[e+0]=i.x,s[e+1]=i.y,s[e+2]=i.z,e+=3}return s},xi=t=>i=>{const s=t.indexOf(i);s>=0&&t.splice(s,1)},bi=t=>{let i=t.length;for(let s=0;s<i-1;s+=1)t[s].x===t[s+1].x&&t[s].y===t[s+1].y&&(t.splice(s,1),s-=1,i-=1);return t},Mi=t=>{const i=Math.log(t);return t=>Math.log(t)/i},wi=Mi(Math.E),_i=(t,i)=>{const s=i[t];return s?s():void 0},Ci=(t,i)=>{let s;if(i)s=i;else{const i={x:0,y:0};for(let s=0;s<t.length;s+=1)i.x+=t[s].x/t.length,i.y+=t[s].y/t.length;s=i}return t.sort(((t,i)=>Gs(Bs(t,s))-Gs(Bs(i,s))))},ki=(t,i,s)=>{if(0===t.length)return!1===s.canReturnB?i.slice():i;const e=i.length;if(e<1e5)return t.push.apply(t,i),t;for(let s=0;s<e;s+=1)t.push(i[s]);return t},Ti=(t,i,s)=>s<0?t:s>1?i:b(t.getR()+s*(i.getR()-t.getR()),t.getG()+s*(i.getG()-t.getG()),t.getB()+s*(i.getB()-t.getB()),t.getA()+s*(i.getA()-t.getA())),Fi=t=>255===t.getA()?t:t.setA(255),Ii=(()=>{const t=b(0,0,0);return i=>(i=Fi(i),new K({angle:180,stops:[{offset:0,color:i},{offset:1,color:Ti(i,t,.5)}]}))})(),Pi=(()=>{const t=t=>{var i;if(t){if(N(t)){if(0===t.getColor().getA())return;return t.getColor()}if(Q(t)||q(t)){const s=t.getColorStops();return 3===s.length?s[1].color:null===(i=s[0])||void 0===i?void 0:i.color}H(t)}};return(i,s,e,h)=>{var r;const n=[];if(h.fill&&n.push(h.fill),h.fill2&&n.push(h.fill2),h.stroke){const t=h.stroke.getFillStyle();t!==E&&("stroke"===(null===(r=h.behavior)||void 0===r?void 0:r.priority)?n.unshift(t):n.push(t))}if(h.point3D){const t=h.point3D;n.push(t.getFillStyle())}let o;if(h.behavior&&!0===h.behavior.colorStep){const[i,e]=n.reduce(((i,s)=>{if(i[0]&&i[1])return i;const e=t(s);return e&&(void 0===i[0]?i[0]=e:i[1]=e),i}),[void 0,void 0]);o=i&&e?(a=i)===(l=e)||a.getR()===l.getR()&&a.getG()===l.getG()&&a.getB()===l.getB()?Ii(a):(a=Fi(a),l=Fi(l),new K({angle:0,stops:[{offset:0,color:l},{offset:.5,color:l},{offset:.5,color:a},{offset:1,color:a}]})):s.uiButtonFillStyle}else{const i=n.reduce(((i,s)=>i||t(s)),void 0);o=i?e?new V({color:i}):Ii(i):s.uiButtonFillStyle}var a,l;i.setButtonOnFillStyle(o)}})(),Li=(t,i)=>{const s=t;if(H(s))return{lut:s.getPalette(),lookUpProperty:s.getLookUpProperty(),valueRange:i}},Bi=t=>{let i=0;return()=>(i+=1,`${t}-${i}`)},Di=(t,i)=>{let s="string"==typeof t?t:String(t);const e=s.indexOf(".");let h=e>=0?e:s.length;for(;h<i;h+=1)s=`0${s}`;return s},Ei=(t,i)=>"function"==typeof t?t(i):t,Ri=(t,i)=>i(),zi=()=>new Error("LightningChart JS encountered an unexpected error.\nPlease report this issue to https://lightningchart.com/js-charts/docs/contact");new V({color:b(255,255,255,1)});const Oi=t=>t===os||t.min.x===os.min.x&&t.max.x===os.max.x&&t.min.y===os.min.y&&t.max.y===os.max.y,Vi=t=>Array.from(new Set(t)),Ni=t=>t.filter((t=>void 0!==t)),Gi=t=>"boolean"==typeof t?t?1:0:t>1?1:t<0?0:t,$i=(t,i,s)=>{i.length<=0||(t.setText(s.label).setOn(i[0].getVisible()),s.style&&t.setButtonOnFillStyle(s.style),s.toggleVisibilityOnClick&&t.addEventListener("switch",(t=>{i.forEach((i=>i.setVisible(t.state)))})),t.addEventListener("pointerenter",(()=>{i.forEach((t=>t.setHighlight(!0)))})),t.addEventListener("pointerleave",(()=>{i.forEach((t=>t.setHighlight(!1)))})),i.forEach((i=>i.addEventListener("pointerenter",(()=>t.setHighlight(!0))))),i.forEach((i=>i.addEventListener("pointerleave",(()=>t.setHighlight(!1))))))},Ui=(t,i)=>{throw new Error(i)},Yi=t=>{let i;return()=>i||(i=t(),i)},Hi=t=>{if(t===Pt)return 0;const i=t.getThickness();return i<0?1:1*i},Xi=(t,i,s,e)=>{const h=`LightningChart JS Resources not found.\nresourcesBaseUrl: "${t}"\ninitiator: ${s}\nresource url: ${i}\nFor more information, please see https://lightningchart.com/js-charts/docs/troubleshooting/error-resources-not-found/`;if(e.shouldCrash)throw Yt.alert(h),new Error(h);Yt.console.warn(h)},Wi=(t,i,s,e=0)=>{if(t<s(e)||s(i)<t)return;const h=i;for(;e!==i;){const h=Math.ceil((e+i)/2);t<s(h)?i=h-1:e=h}const r=Math.abs(t-s(e));return e<h&&Math.abs(t-s(e+1))<r?e+1:e},ji=()=>{const t=new Map;return{Kt:i=>(Object.keys(St).forEach((s=>{i.addEventListener(s,((i,e)=>{const h=e.collectionMember&&t.get(e.collectionMember);if(!h)return;const r=bt(i)?{clientX:i.changedTouches[0].clientX,clientY:i.changedTouches[0].clientY}:i,n=h.qt(e.info,r);h.R.O(s,i,n)}))})),i),ti:(i,s)=>{t.set(i,s)},ii:()=>{t.clear()}}},Zi={left:0,right:0,top:0,bottom:0},Qi=()=>Math.round(Math.random()*Number.MAX_SAFE_INTEGER),Ji=(t,i,s)=>{i&&i.si();const e=s();return Object.keys(e).forEach((i=>{const s=i,h=e[s];t.addEventListener(s,h)})),{ei:t,si:()=>{Object.entries(e).forEach((([i,s])=>{const e=i,h=s;t.removeEventListener(e,h)}))}}},Ki=(t,i,s)=>{let e;const h=()=>(e=s(),e),r={...t,resolve:()=>e||h()};for(const t of Object.keys(i))Object.defineProperty(r,t,{get:function(){return e?e[t]:h()[t]}});return r},qi=t=>{if(t)return"resolve"in t?t.resolve():t},ts=t=>{let i=t;return{hi:t=>{const s=i;return i=s+t,[s,t]}}},is=t=>{Yt.document.body.addEventListener(t,(t=>{t.stopPropagation(),t.preventDefault()}),{once:!0,capture:!0})},ss=()=>{const t=Yt.performance.now();Yt.document.body.addEventListener("contextmenu",(i=>{Yt.performance.now()-t>5e3||i.preventDefault()}),{once:!0})},es=()=>{const t=Yt.performance.now();Yt.document.body.addEventListener("touchstart",(i=>{Yt.performance.now()-t>5e3||i.preventDefault()}),{once:!0})},hs={add:(t,i)=>c(t.x+i,t.y+i,t.z+i),addVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x+=t.x,s.y+=t.y,s.z+=t.z;return s},subtract:(t,i)=>c(t.x-i,t.y-i,t.z-i),subtractVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x-=t.x,s.y-=t.y,s.z-=t.z;return s},multiply:(t,i)=>c(t.x*i,t.y*i,t.z*i),divide:(t,i)=>c(t.x/i,t.y/i,t.z/i),multiplyVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x*=t.x,s.y*=t.y,s.z*=t.z;return s},divideVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x/=t.x,s.y/=t.y,s.z/=t.z;return s},length:t=>Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z),normalize:t=>hs.divide(t,hs.length(t)),dot:(t,i)=>t.x*i.x+t.y*i.y+t.z*i.z,cross:(t,i)=>c(t.y*i.z-t.z*i.y,t.z*i.x-t.x*i.z,t.x*i.y-t.y*i.x),angle:(t,i)=>Math.acos(hs.dot(t,i)/(hs.length(t)*hs.length(i))),rotateAroundAxis(t,i,s){const e=Math.cos(s),h=Math.sin(s),r=hs.dot(i,t),n=hs.cross(i,t);return hs.addVec(hs.multiply(t,e),hs.addVec(hs.multiply(i,(1-e)*r),hs.multiply(n,h)))},lerp:(t,i,s)=>(s=Jt(s,0,1),hs.addVec(hs.multiply(t,1-s),hs.multiply(i,s))),equals:(t,i)=>Qt(t.x,i.x)&&Qt(t.y,i.y)&&Qt(t.z,i.z),abs:t=>({x:Math.abs(t.x),y:Math.abs(t.y),z:Math.abs(t.z)}),sign:t=>({x:Math.sign(t.x),y:Math.sign(t.y),z:Math.sign(t.z)})},rs=Number.MAX_SAFE_INTEGER,ns=-Number.MAX_SAFE_INTEGER,os=f(a(rs,rs),a(ns,ns)),as=f(c(rs,rs,rs),c(ns,ns,ns)),ls=(t,i)=>{const s=Math.log(t)/Math.log(i);return Math.floor((t=>(Math.ceil(t)-t<1e-4?t=Math.ceil(t):t-Math.floor(t)<1e-4&&(t=Math.floor(t)),t))(s))},us=(t,i)=>!(i.min.x>t.max.x||i.max.x<t.min.x||i.min.y>t.max.y||i.max.y<t.min.y),cs=(t,i)=>!(t[1].x<i[0].x||t[0].x>i[1].x||t[3].y<i[0].y||t[0].y>i[3].y),ds=(t,i)=>({min:{x:Math.min(t[0].x,i[0].x),y:Math.min(t[0].y,i[0].y)},max:{x:Math.max(t[2].x,i[2].x),y:Math.max(t[2].y,i[2].y)}}),fs=t=>{const i=t.length;for(let s=0;s<i;s+=1)for(let e=s+1;e<i;e+=1)if(us(t[s],t[e]))return!0;return!1},As=(t,i)=>i+t,gs=(t,i,s)=>{const e=Bs(i,t),h=e.x*e.x+e.y*e.y;if(0===h)return t;const r=Bs(s,t),n=(r.x*e.x+r.y*e.y)/h;return n<=0?t:n>=1?i:a(t.x+n*e.x,t.y+n*e.y)},ps=(t,i,s)=>s>i?t>=i&&t<=s:t>=s&&t<=i,vs=(t,i)=>{const s=t.x-i.x,e=t.y-i.y;return Math.sqrt(s*s+e*e)},ys=(t,i)=>{const s=t.x-i.x,e=t.y-i.y;return s*s+e*e},ms=(t,i,s)=>Ls(t,Ps(Bs(i,t),s)),Ss=(t,i,s)=>hs.addVec(t,hs.multiply(hs.subtractVec(i,t),s));function xs(t){const i=t.length;if(i>0){let s=t[0].x,e=t[0].x,h=t[0].y,r=t[0].y;for(let n=0;n<i;n+=1){const i=t[n];i.x>s&&(s=i.x),i.x<e&&(e=i.x),i.y>h&&(h=i.y),i.y<r&&(r=i.y)}return f(a(e,r),a(s,h))}return os}function bs(t){const i=t.length;if(i>0){let s=t[0].x,e=t[0].x,h=t[0].y,r=t[0].y,n=t[0].z,o=t[0].z;for(let a=0;a<i;a+=1){const i=t[a];i.x>s&&(s=i.x),i.x<e&&(e=i.x),i.y>h&&(h=i.y),i.y<r&&(r=i.y),i.z>n&&(n=i.z),i.z<o&&(o=i.z)}return f(c(e,r,o),c(s,h,n))}return as}const Ms=(...t)=>{const i={min:{x:rs,y:rs},max:{x:ns,y:ns}};for(const s of t)i.min.x=i.min.x<s.min.x?i.min.x:s.min.x,i.max.x=i.max.x>s.max.x?i.max.x:s.max.x,i.min.y=i.min.y<s.min.y?i.min.y:s.min.y,i.max.y=i.max.y>s.max.y?i.max.y:s.max.y;return i},ws=(t,i)=>f(c(t.min.x<i.min.x?t.min.x:i.min.x,t.min.y<i.min.y?t.min.y:i.min.y,t.min.z<i.min.z?t.min.z:i.min.z),c(t.max.x>i.max.x?t.max.x:i.max.x,t.max.y>i.max.y?t.max.y:i.max.y,t.max.z>i.max.z?t.max.z:i.max.z));function _s(t,i,s,e){const h=t.x-e.x,r=t.y-e.y,n=e.x-s.x,o=s.y-e.y,a=o*h+n*r,l=(e.y-i.y)*h+(i.x-e.x)*r,u=o*(i.x-e.x)+n*(i.y-e.y);return u<0?a<=0&&l<=0&&a+l>=u:a>=0&&l>=0&&a+l<=u}function Cs(t,i,s){return a(Math.cos(s)*(t.x-i.x)+Math.sin(s)*(t.y-i.y)+i.x,-Math.sin(s)*(t.x-i.x)+Math.cos(s)*(t.y-i.y)+i.y)}function ks(t,i){return a(t.x-i.x,t.y-i.y)}function Ts(t){const i=Is(t);return 0===i?a(0,0):a(t.x/i,t.y/i)}function Fs(t,i){let s={x:i.x-t.x,y:i.y-t.y};s=Ts(s);const e=Math.PI/2,h=s.x;return s.x=-Math.sin(e)*s.y,s.y=h*Math.sin(e),s}function Is(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function Ps(t,i){return a(t.x*i,t.y*i)}function Ls(t,i){return a(t.x+i.x,t.y+i.y)}function Bs(t,i){return a(t.x-i.x,t.y-i.y)}function Ds(t,i){return a(t.x*i.x,t.y*i.y)}function Es(t,i){return a(t.x/i.x,t.y/i.y)}function Rs(t){return Ps(t,-1)}function zs(t,i){return t.x*i.x+t.y*i.y}const Os=(t,i,s)=>{const e=(s.y-i.y)/(s.x-i.x),h=i.y+(t-i.x)*e;return a(t,h)},Vs=(t,i,s)=>{const e=(s.y-i.y)/(s.x-i.x),h=i.x+(t-i.y)/e;return a(h,t)};function Ns(t){return t*Math.PI/180}function Gs(t){return 180*Math.atan2(t.y,t.x)/Math.PI}function $s(t){return a(Math.cos(t),Math.sin(t))}const Us=(t,i,s,e)=>{let h,r,n,o;if(i.x-t.x!=0||e.x-s.x!=0)return i.x-t.x==0?(n=i.x,r=(e.y-s.y)/(e.x-s.x),o=r*(n-s.x)+s.y):e.x-s.x==0?(n=e.x,h=(i.y-t.y)/(i.x-t.x),o=h*(n-t.x)+t.y):(h=(i.y-t.y)/(i.x-t.x),r=(e.y-s.y)/(e.x-s.x),n=(s.y-r*s.x+h*t.x-t.y)/(h-r),o=h*(n-t.x)+t.y),a(n,o)},Ys=(t,i)=>{const s=t.length,e=i.length,h=new Uint16Array(s+e);return h.set(t,0),h.set(i,s),h};class Hs{constructor(){this.ri=!0}getInnerStart(){return this.U}getInnerEnd(){return this.Y}getInnerInterval(){return Math.abs(this.Y-this.U)}j(t,i){return this.ri=t!==this.U||i!==this.Y,this.U=t,this.Y=i,this}X(){return this.ri=!1,this}W(){return this.ri=!0,this}}class Xs extends Hs{constructor(t,i,s,e){if(super(),this.ni=!0,this.oi=!0,this.ai=[0,0],this.li=!0,this.ui=t,this.ci=i,this.di=s,this.fi=t,this.Ai=i,e){const t=t=>{this.gi(t.value)};e.V("change",t),this.gi(e.T()),this.pi=()=>e.G("change",t)}}J(t){return this.H=t,this.oi=!0,this}yi(t){return this.ai=t.map(Math.abs),this.li=!0,this}mi(){return this.ui/this.di*this.H+this.ai[0]}Si(){return(this.ui+this.ci)/this.di*this.H-this.ai[1]}xi(){return this.getCellSize()-this.bi()}Mi(){return this.H}getCellSize(){return this.wi(this.H)}bi(){return this.ai[0]+this.ai[1]}_i(){return this.ai}gi(t){this.di=t.reduce(As,0),this.ui=t.reduce(((t,i,s)=>s>=this.fi?t:t+i),0),this.ci=t.reduce(((t,i,s)=>s>=this.fi&&s<this.fi+this.Ai?t+i:t),0),this.ni=!0,this.Ci()}wi(t){return t*this.ci/this.di}X(){return super.X(),this.oi=!1,this.li=!1,this.ni=!1,this}W(){return super.W(),this.oi=!0,this.li=!0,this.ni=!0,this}}class Ws extends Xs{constructor(t,i,s,e){super(t,i,s,e),this.ki={internal:10,function:js(10),number:10},this.H=1e3,this.j(1,1e3),this.Ti=this.Fi()}ht(t,i,s,e,h){if(t===i)return!1;const r=Math.min(t,i)<Qs,n=Math.max(t,i)>Js;return!r&&!n||!!h&&(i>t?{start:r?Qs:t,end:n?Js:i}:{start:n?Js:t,end:r?Qs:i})}ot(t){const i=this.mi(),s=this.Si(),e=Math.max(t,Qs);return i+(this.ki.function(e)-this.Ti.scaleStartLog)/this.Ti.scaleIntervalLog*(s-i)}nt(t){const i=this.mi(),s=(t-i)/(this.Si()-i),e=this.Ti.scaleStartLog+s*this.Ti.scaleIntervalLog;return this.ki.number**e}Ci(){this.ki&&this.Fi()}j(t,i){return super.j(t,i),this.ki&&this.Fi(),this}yi(t){return super.yi(t),this.ki&&this.Fi(),this}J(t){return super.J(t),this.ki&&this.Fi(),this}Ii(t){return this.ki={internal:t,function:js(t),number:Zs(t)},this}Pi(){return this.ki.internal}Li(t,i){const s=this.ot(t)+i;return this.nt(s)}Bi(){return this.oi||this.ri||this.li||this.ni}Fi(){const t=this.ki.function(this.U),i=this.ki.function(this.Y)-t,s=2*this.mi()/this.H-1,e=2*this.Si()/this.H-1-s;return this.Ti={scaleStartLog:t,scaleIntervalLog:i,viewportStart:s,viewportSize:e},this.Ti}Di(){return this.Ti}}const js=t=>"e"===t?wi:Mi(t),Zs=t=>"e"===t?Math.E:t,Qs=.9*10**-20,Js=1.1*10**25,Ks=[{prefix:"T",unit:10**12},{prefix:"B",unit:10**9},{prefix:"M",unit:1e6},{prefix:"K",unit:1e3}],qs=(t,i,s)=>{const e=Math.abs(s-i);if(0===e)return t.toFixed(0);const h=Math.max(2-ls(e,10),0);return t.toFixed(h)},te={Numeric:(t,i)=>{const{start:s,end:e}=i;return qs(t,s,e)},NumericUnits:(t,i)=>{const{start:s,end:e}=i,h=Math.abs(e-s),r=t<0;t=Math.abs(t);let n="",o="";if(h>=1e3&&t>1e3){let i="";for(const s of Ks){const e=Math.round(1e3*t/s.unit)/1e3;if(e>=1){i=e.toString(),o=s.prefix;break}}n=(r?"-":"")+i}else{let i=String(Math.floor(t));const s=ls(t,1e3);for(let t=1;t<=s;t+=1){const s=i.length-(3*t+(t-1));i=`${i.substring(0,s)} ${i.substring(s,i.length)}`}n=(r?"-":"")+i+(h<=10?((t,i)=>{if(0===i)return"";let s=(Math.abs(t)-Math.abs(Math.floor(t))).toString().substring(1);return s.length>i&&(s=s.substring(0,i+1)),s})(t,2-ls(h,10)):"")}return n+=o,n},LogarithmicExponentsRounded:(t,i,s,e=10)=>{const h=js(e)(t);return`${e}${ie(h)}`},LogarithmicExponents:(t,i,s,e=10)=>{const h=js(e),r=Math.floor(h(t)),n=t/Zs(e)**r;return`${Math.round(n)}×${e}${ie(r)}`},LogarithmicExtreme:(t,i,s,e=10)=>{const h=js(e),r=Math.floor(h(t));return`${(t/Zs(e)**r).toFixed(2)}×${e}${ie(r)}`},LogarithmicNoExponents:(t,i,s,e=10)=>{const h=js(e);if("e"===e)return`${Math.floor(h(t))}e`;const r=t.toString();if(t>1)return r;const n=Math.floor(h(t));return t.toFixed(Math.abs(n))},Scientific:(t,i)=>{const{start:s,end:e}=i,h=Math.max(Math.abs(s),Math.abs(e)),r=Math.floor(Math.log10(h));return 0===t?`0.00e${r<0?"":"+"}${r}`:t.toExponential(2)}},ie=t=>Math.round(t).toString().split("").map((t=>{switch(t){case"0":return"⁰";case"1":return"¹";case"2":return"²";case"3":return"³";case"4":return"⁴";case"5":return"⁵";case"6":return"⁶";case"7":return"⁷";case"8":return"⁸";case"9":return"⁹";case"-":return"⁻";default:return t}})).join("");class se extends Xs{constructor(t,i,s,e){super(t,i,s,e),this.Ei=!1,this.Ri=!1,this.zi=0,this.H=1e3,this.j(0,10),this.Z()}Bi(){return this.Ri}ht(t,i,s,e,h){if(t===i)return!1;const r=Math.abs(e-s),n=Math.abs(i-t);if(!this.Ei){const s=((t,i,s)=>{const e=((t,i)=>{if(i<rs&&i>ns&&t<rs&&t>ns){const s=Math.abs(t/2**23),e=Math.abs(i/2**23),h=Math.min(s,e);return 10**Math.floor(Math.log10(h))}})(t,i);if(void 0!==e)return e*s})(t,i,this.getCellSize());if(void 0===s)return!1;if(n>s)return!0;const e=(i+t)/2,o=(h?s/2:r/2)*(t>i?-1:1);return{start:e-o,end:e+o}}const o=10**-(12-Math.log10(Math.max(Math.abs(t),1)));if(n>o)return!0;const a=(i+t)/2,l=(h?o/2:r/2)*(t>i?-1:1);return{start:a-l,end:a+l}}Ci(){this.Z()}ot(t){return this.mi()+(t-this.U)/(this.Y-this.U)*(this.Si()-this.mi())}nt(t){return this.U+(t-this.mi())/(this.Si()-this.mi())*(this.Y-this.U)}j(t,i){return super.j(t,i),this.Z(),this}yi(t){return super.yi(t),this.Z(),this}J(t){return super.J(t),this.Oi=ee(this.Y-this.U,this.ai,this.H,this.ci,this.di),this.Z(),this}Vi(){return this.Ei=!0,this}Ni(){return this.Ei}Gi(){return Math.abs(this.$i)}Ui(){return this.Gi()/this.Oi}Yi(){return this.Hi}Xi(){return this.Wi}getPixelSize(){return this.Oi}Di(){return this.Ti}W(){return super.W(),this.Ri=!0,this}X(){return super.X(),this.Ri=!1,this}ji(t,i=te.Numeric){return i(t,{start:this.U,end:this.Y})}Zi(){const t=Math.abs(this.getInnerEnd()).toString().length,i=Math.abs(this.getInnerStart()).toString().length;return t>i?t:i}Qi(t){return ee(t,this.ai,this.H,this.ci,this.di)}Z(){let t=this.U,i=this.Y,s=0;this.Ei&&(t=0,i=this.Y-this.U,s=this.U);const e=i-t,h=ee(e,this.ai,this.H,this.ci,this.di);this.Wi=t-this.ai[0]*h,this.Hi=i+this.ai[1]*h;const r=this.Hi-this.Wi,n=r-this.$i,o=Math.abs(n/h),a=e-this.zi,l=Math.abs(a/h);(!this.Ti||o>=.4||l>=.4)&&(this.zi=e,this.$i=r,this.Oi=h,this.Ri=!0);const u=this.$i*this.di/(2*this.ci),c=-(this.Wi-this.$i*this.ui/this.ci)-u,d=2*this.mi()/this.H-1,f=2*this.Si()/this.H-1-d;this.Ti={displacement:c,scaling:u,highPrecisionOffset:s,viewportStart:d,viewportSize:f,scaleStartLog:0,scaleIntervalLog:0}}Li(t,i){return t+this.Oi*i}}const ee=(t,i,s,e=1,h=1)=>t/(s*e/h-(i[0]+i[1]));class he{Ji(t,i){return"x"in t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=i),this}X(){return this.x.X(),this.y.X(),this}W(){return this.x.W(),this.y.W(),this}J(t,i){return"object"==typeof t?(this.x.J(t.x),this.y.J(t.y)):(this.x.J(t),this.y.J(i)),this}Mi(){return a(this.x.Mi(),this.y.Mi())}Ki(t){return this.x.yi(t),this}qi(t){return this.y.yi(t),this}bi(){return a(this.x.bi(),this.y.bi())}ts(t,i){return this.x.j(t,i),this}ss(t,i){return this.y.j(t,i),this}getInnerIntervalPixels(){const t=this.x.getCellSize(),i=this.y.getCellSize();return{x:t-this.x.bi(),y:i-this.y.bi()}}es(){return this.x.Bi()||this.y.Bi()}}class re extends he{constructor(){super(...arguments),this.hs="LinearScaleXY"}rt(t,i,s,e){return this.x=new se(t.x,i.x,s.x,e?e.x:void 0),this.y=new se(t.y,i.y,s.y,e?e.y:void 0),this}Ni(){return this.x.Ni()||this.y.Ni()}rs(){return a(this.x.getPixelSize(),this.y.getPixelSize())}Di(){return{x:this.x.Di(),y:this.y.Di()}}Li(t,i){const s=this.rs();return{x:t.x+i.x*s.x,y:t.y+i.y*s.y}}ns(t,i,s,e){const h=this.rs(),r=Fs(t,i);return r.x*=e,r.y*=e,{x:t.x+s*h.x*r.x,y:t.y+s*h.y*r.y}}}class ne extends he{constructor(){super(...arguments),this.hs="MixedScaleXY"}Ni(){return!1}Li(t,i){const s=this.x.ot(t.x),e=this.y.ot(t.y),h={x:s+i.x,y:e+i.y};return{x:this.x.nt(h.x),y:this.y.nt(h.y)}}ns(t,i,s,e){const h={x:this.x.ot(t.x),y:this.y.ot(t.y)},r={x:this.x.ot(i.x),y:this.y.ot(i.y)},n=Ts(Bs(r,h)),o=Fs(r,h),a={x:h.x+n.x*e+o.x*s,y:h.y+n.y*e+o.y*s};return{x:this.x.nt(a.x),y:this.y.nt(a.y)}}Di(){const t=this.x.Di(),i=this.y.Di();return{uScaleStart:[this.x.U,this.y.U],uScaleInterval:[this.x.getInnerInterval(),this.y.getInnerInterval()],uScaleStartLog:[t.scaleStartLog,i.scaleStartLog],uScaleIntervalLog:[t.scaleIntervalLog,i.scaleIntervalLog],uViewportStart:[t.viewportStart,i.viewportStart],uViewportSize:[t.viewportSize,i.viewportSize]}}}const oe=(t,i)=>t instanceof Ws||i instanceof Ws?(new ne).Ji(t,i):(new re).Ji(t,i),ae=t=>"client"===t,le=t=>!!(t&&"object"==typeof t&&"clientX"in t&&"number"==typeof t.clientX&&"clientY"in t&&"number"==typeof t.clientY),ue=t=>"relative"===t,ce=t=>!!(t&&"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y),de=(t,i,s,e,h,r)=>{if(!t)return;let n=t;if(s instanceof PointerEvent&&"mouse"===s.pointerType)if(0===s.button){if(!1===t.lmb)return;void 0!==t.lmb&&(n=$t(n,t.lmb))}else if(1===s.button){if(!1===t.mmb)return;void 0!==t.mmb&&(n=$t(n,t.mmb))}else if(2===s.button){if(!1===t.rmb)return;void 0!==t.rmb&&(n=$t(n,t.rmb))}if(e){if(!1===t.shift)return;n=$t(n,t.shift)}if(h){if(!1===t.ctrl)return;n=$t(n,t.ctrl)}if(r){if(!1===t.alt)return;n=$t(n,t.alt)}if(!i)return n;const o=n[i];return o?!0===o?n:$t(n,o):void 0},fe=t=>{const i=[];return{push:t=>{i.push(t)},end:()=>{i.length>1&&t&&Yt.console.warn("LightningChart JS warning | event handler triggered more than 1 interaction.\nThis likely means that your `chart.setUserInteractions` configuration either enables conflicting interactions or more likely doesn't disable conflicting default interactions."),i.forEach((t=>t()))}}},Ae=(t,i,s)=>{if(t){const t={x:s.x.mi(),y:s.y.mi(),width:s.x.xi(),height:s.y.xi()};i.forEach((i=>{i.ls=t}))}else i.forEach((t=>{t.ls=void 0}))},ge=(t,i)=>{var s;return i?"string"==typeof i?`${t} ${i}`:!1!==(null===(s=i.us)||void 0===s?void 0:s.displayInCursor)&&i.getUnits()?`${t} ${i.getUnits()}`:t:t},pe=t=>{let i=!1,s={type:"linear"};if(t&&(void 0!==t.opposite&&(i=t.opposite),t.type&&"linear-highPrecision"===t.type&&(s={type:"linear-highPrecision"}),t.type&&"logarithmic"===t.type)){let i=10;if(t.base)if("E"===t.base||"e"===t.base||"natural"===t.base)i="e";else if("number"==typeof t.base)i=t.base;else if("string"==typeof t.base)try{i=Number(t.base)}catch(i){console.warn(`Unidentified logarithmic base "${t.base}"`)}s={base:i,type:"logarithmic"}}return{opposite:i,type:s}},ve=(t,i,s,e=1)=>Jt(t+.1*e*(i-t)+.5*e*Math.abs(s.getPixelSize())*Math.sign(i-t),t,i),ye=(t,i,s,e=1)=>{const h=s.ot(t),r=s.ot(i);return Jt(s.nt(h+.1*e*(r-h)+.5*e*Math.sign(r-h)),t,i)};var me;exports