UNPKG

@lightningchart/lcjs

Version:

A high-performance charting library.

2 lines 1.37 MB
/* LightningChart JS v8.0.2 */ "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 r=e(t),h=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}),c=(t,i,s)=>({position:t,high:i,low:s}),u=(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 x extends m{constructor(t){super(t)}toUint32(){return void 0!==this.F||(this.F=F(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 x({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 x({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 x({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).toFixed(0)},${(255*this.g).toFixed(0)},${(255*this.b).toFixed(0)},${this.a})`}}const S=t=>!(!t||"object"!=typeof t||!("type"in t)||"color"!==t.type),b=(t,i,s,e=255)=>new x({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 x({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 x({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 x({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 x({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,r,h;t/=360;const n=Math.floor(6*t),o=6*t-n,a=s*(1-i),l=s*(1-o*i),c=s*(1-(1-o)*i);switch(n%6){case 0:e=s,r=c,h=a;break;case 1:e=l,r=s,h=a;break;case 2:e=a,r=s,h=c;break;case 3:e=a,r=l,h=s;break;case 4:e=c,r=a,h=s;break;default:e=s,r=a,h=l}return new x({r:e,g:r,b:h})},_=t=>b(255&t,255&(t>>=8),255&(t>>=8),255&(t>>=8)),k={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 x({}),T=b(0,0,0,0),F=(t,i,s,e=255)=>(e<<24|s<<16|i<<8|t)>>>0;var I,P;exports.GradientShape=void 0,(I=exports.GradientShape||(exports.GradientShape={})).circle="circle",I.ellipse="ellipse",exports.GradientExtent=void 0,(P=exports.GradientExtent||(exports.GradientExtent={})).closestSide="closest-side",P.closestCorner="closest-corner",P.farthestSide="farthest-side",P.farthestCorner="farthest-corner";const L=t.Record({type:"fillstyle",fillType:"radial-gradient",ditheringEnabled:!0,stops:[{color:M("#f00"),offset:0},{color:M("#0f0"),offset:1}],position:a(.5,.5),shape:exports.GradientShape.ellipse,extent:exports.GradientExtent.farthestCorner});class B extends L{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.ditheringEnabled},${this.extent},${this.position.x},${this.position.y},${this.stops.map((t=>`${t.offset},${t.color.toString()}`)).join(",")}`}toCSS(){return`radial-gradient(${this.shape} ${this.extent} at ${100*this.position.x}% ${100*this.position.y}%, ${this.stops.map((t=>`${t.color.toString()} ${100*t.offset}%`)).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")}setDitheringEnabled(t){return this.set("ditheringEnabled",t)}getDitheringEnabled(){return this.get("ditheringEnabled")}}const D=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"radial-gradient"===t.fillType),R=t.Record({type:"fillstyle",fillType:"linear-gradient",stops:[{color:M("#f00"),offset:0},{color:M("#0f0"),offset:1}],angle:0});class E extends R{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(",")}`}toCSS(){return`linear-gradient(${this.angle}deg, ${this.stops.map((t=>`${t.color.toString()} ${100*t.offset}%`)).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?Fs(this.get("angle")):this.get("angle")}}const O=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"linear-gradient"===t.fillType);class z{constructor(t,i,s,e){this.D=new At,this.cellIndex=t,this.cellSpan=i,this.cellsAmount=s,this.observedAmount=e,this.x=new V,this.y=new V,this.z=new V;const r={...t},h={...i};if(e){const t=t=>{const i=t.value;this.cellsAmount.x=i.reduce(rs,0),this.cellIndex.x=i.reduce(((t,i,s)=>s>=r.x?t:t+i),0),this.cellSpan.x=i.reduce(((t,i,s)=>s>=r.x&&s<r.x+h.x?t+i:t),0),this.D.R("cellresize",{})};e.x.O("change",t),t({value:e.x.T()});const i=t=>{const i=t.value;this.cellsAmount.y=i.reduce(rs,0),this.cellIndex.y=i.reduce(((t,i,s)=>s>=r.y?t:t+i),0),this.cellSpan.y=i.reduce(((t,i,s)=>s>=r.y&&s<r.y+h.y?t+i:t),0),this.D.R("cellresize",{})};e.y.O("change",i),i({value:e.y.T()}),this.V=()=>{e.x.N("change",t),e.y.N("change",i)}}}G(){return this.V&&(this.V(),this.V=void 0),this}addEventListener(t,i,s){this.D.addEventListener(t,i,s)}removeEventListener(t,i){this.D.removeEventListener(t,i)}}class V extends n{constructor(){super(...arguments),this.$=0,this.U=10,this.j=1}Y(){return this.u=!1,this}H(){return this.u=!0,this}getInnerStart(){return this.$}getInnerEnd(){return this.U}getInnerInterval(){return Math.abs(this.getInnerEnd()-this.getInnerStart())}W(t,i){return this.$=t,this.U=i,this.X(),this}Z(t){return this.j=t,this.X(),this}J(t){return t/this.j}X(){const t=this.J(this.U-this.$),i=this.j;void 0!==this.K&&!1!==$t(t,this.K)||(this.u=!0,this.q=i,this.K=t)}tt(){return this.K}it(){return this.q}st(){return this.U<this.$}et(t,i){return!0}}class N{constructor(){this.rt=!0}getInnerStart(){return this.$}getInnerEnd(){return this.U}getInnerInterval(){return Math.abs(this.U-this.$)}W(t,i){return this.rt=t!==this.$||i!==this.U,this.$=t,this.U=i,this}Y(){return this.rt=!1,this}H(){return this.rt=!0,this}}class G extends N{constructor(t,i,s,e){if(super(),this.ht=!0,this.nt=!0,this.ot=[0,0],this.ct=!0,this.ut=t,this.dt=i,this.ft=s,this.At=t,this.vt=i,e){const t=t=>{this.yt(t.value)};e.O("change",t),this.yt(e.T()),this.xt=()=>e.N("change",t)}}Z(t){return this.j=t,this.nt=!0,this}St(t){return this.ot=t.map(Math.abs),this.ct=!0,this}bt(){return this.ut/this.ft*this.j+this.ot[0]}Mt(){return(this.ut+this.dt)/this.ft*this.j-this.ot[1]}wt(){return this.getCellSize()-this._t()}kt(){return this.j}getCellSize(){return this.Ct(this.j)}_t(){return this.ot[0]+this.ot[1]}Tt(){return this.ot}yt(t){this.ft=t.reduce(rs,0),this.ut=t.reduce(((t,i,s)=>s>=this.At?t:t+i),0),this.dt=t.reduce(((t,i,s)=>s>=this.At&&s<this.At+this.vt?t+i:t),0),this.ht=!0,this.Ft()}Ct(t){return t*this.dt/this.ft}Y(){return super.Y(),this.nt=!1,this.ct=!1,this.ht=!1,this}H(){return super.H(),this.nt=!0,this.ct=!0,this.ht=!0,this}}class $ extends G{constructor(t,i,s,e){super(t,i,s,e),this.It=!1,this.Pt=!1,this.Lt=0,this.j=1e3,this.W(0,10),this.X()}Bt(){return this.Pt}et(t,i,s,e,r){if(t===i)return!1;const h=Math.abs(e-s),n=Math.abs(i-t);if(!this.It){const s=fi(t,i,this.getCellSize());if(void 0===s)return!1;if(n>s)return!0;const e=(i+t)/2,o=(r?s/2:h/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=(r?o/2:h/2)*(t>i?-1:1);return{start:a-l,end:a+l}}Ft(){this.X()}Dt(t){return this.bt()+(t-this.$)/(this.U-this.$)*(this.Mt()-this.bt())}Rt(t){return this.$+(t-this.bt())/(this.Mt()-this.bt())*(this.U-this.$)}W(t,i){return super.W(t,i),this.X(),this}St(t){return super.St(t),this.X(),this}Z(t){return super.Z(t),this.Et=U(this.U-this.$,this.ot,this.j,this.dt,this.ft),this.X(),this}Ot(){return this.It=!0,this}zt(){return this.It}Vt(){return Math.abs(this.Nt)}Gt(){return this.Vt()/this.Et}$t(){return this.Ut}jt(){return this.Yt}getPixelSize(){return this.Et}Ht(){return this.Wt}H(){return super.H(),this.Pt=!0,this}Y(){return super.Y(),this.Pt=!1,this}Xt(t,i=Ns.Numeric){return i(t,{start:this.$,end:this.U})}Zt(){const t=Math.abs(this.getInnerEnd()).toString().length,i=Math.abs(this.getInnerStart()).toString().length;return t>i?t:i}Jt(t){return U(t,this.ot,this.j,this.dt,this.ft)}X(){let t=this.$,i=this.U,s=0;this.It&&(t=0,i=this.U-this.$,s=this.$);const e=i-t,r=U(e,this.ot,this.j,this.dt,this.ft);this.Yt=t-this.ot[0]*r,this.Ut=i+this.ot[1]*r;const h=this.Ut-this.Yt,n=h-this.Nt,o=Math.abs(n/r),a=e-this.Lt,l=Math.abs(a/r);(!this.Wt||o>=.4||l>=.4)&&(this.Lt=e,this.Nt=h,this.Et=r,this.Pt=!0);const c=this.Nt*this.ft/(2*this.dt),u=-(this.Yt-this.Nt*this.ut/this.dt)-c,d=2*this.bt()/this.j-1,f=2*this.Mt()/this.j-1-d;this.Wt={displacement:u,scaling:c,highPrecisionOffset:s,viewportStart:d,viewportSize:f,scaleStartLog:0,scaleIntervalLog:0}}Qt(t,i){return t+this.Et*i}}const U=(t,i,s,e=1,r=1)=>t/(s*e/r-(i[0]+i[1]));class j{Kt(t,i){return"x"in t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=i),this}Y(){return this.x.Y(),this.y.Y(),this}H(){return this.x.H(),this.y.H(),this}Z(t,i){return"object"==typeof t?(this.x.Z(t.x),this.y.Z(t.y)):(this.x.Z(t),this.y.Z(i)),this}kt(){return a(this.x.kt(),this.y.kt())}qt(t){return this.x.St(t),this}ti(t){return this.y.St(t),this}_t(){return a(this.x._t(),this.y._t())}ii(t,i){return this.x.W(t,i),this}si(t,i){return this.y.W(t,i),this}getInnerIntervalPixels(){const t=this.x.getCellSize(),i=this.y.getCellSize();return{x:t-this.x._t(),y:i-this.y._t()}}ei(){return this.x.Bt()||this.y.Bt()}}class Y extends j{constructor(){super(...arguments),this.ri="LinearScaleXY"}hi(t,i,s,e){return this.x=new $(t.x,i.x,s.x,e?e.x:void 0),this.y=new $(t.y,i.y,s.y,e?e.y:void 0),this}zt(){return this.x.zt()||this.y.zt()}ni(){return a(this.x.getPixelSize(),this.y.getPixelSize())}Ht(){return{x:this.x.Ht(),y:this.y.Ht()}}Qt(t,i){const s=this.ni();return{x:t.x+i.x*s.x,y:t.y+i.y*s.y}}oi(t,i,s,e){const r=this.ni(),h=ms(t,i);return h.x*=e,h.y*=e,{x:t.x+s*r.x*h.x,y:t.y+s*r.y*h.y}}}class H extends j{constructor(){super(...arguments),this.ri="MixedScaleXY"}zt(){return!1}Qt(t,i){const s=this.x.Dt(t.x),e=this.y.Dt(t.y),r={x:s+i.x,y:e+i.y};return{x:this.x.Rt(r.x),y:this.y.Rt(r.y)}}oi(t,i,s,e){const r={x:this.x.Dt(t.x),y:this.y.Dt(t.y)},h={x:this.x.Dt(i.x),y:this.y.Dt(i.y)},n=ys(Ms(h,r)),o=ms(h,r),a={x:r.x+n.x*e+o.x*s,y:r.y+n.y*e+o.y*s};return{x:this.x.Rt(a.x),y:this.y.Rt(a.y)}}Ht(){const t=this.x.Ht(),i=this.y.Ht();return{uScaleStart:[this.x.$,this.y.$],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 W={d1:t=>new t.scale1DConstructor(0,1,1,void 0),d2:t=>(new t.scaleXYConstructor).hi({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0),d3:()=>new z({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0)},X=(t,i,s)=>i===s?t:s.Rt(i.Dt(t)),Z=(t,i,s)=>{if(i===s)return t;const e=i instanceof j?i.x:i.x instanceof j?i.x.x:i.x.ai,r=i instanceof j?i.y:i.y instanceof j?i.y.y:i.y.ai,h=s instanceof j?s.x:s.x instanceof j?s.x.x:s.x.ai,n=s instanceof j?s.y:s.y instanceof j?s.y.y:s.y.ai;return{...t,x:X(t.x,e,h),y:X(t.y,r,n)}},J=(...t)=>{if(0===t.length)return{remove:Gt};let i=!1;const s=t.map((s=>{const e=e=>{((s,e,r)=>{i||(i=!0,t.filter((t=>t!==s)).forEach((t=>t.li(e,r,!1,s.getStopped(),"synchronizedAxis"))),i=!1)})(s,e.start,e.end)};return s.addEventListener("intervalchange",e),e}));let e=!1;const r=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",r[i])}))}}},Q=t=>t&&"object"==typeof t&&"column"in t&&"row"in t,K=t=>t&&"object"==typeof t&&"z"in t&&"column"in t&&"row"in t,q=t=>t&&"object"==typeof t&&"annulus"in t&&"sector"in t,tt=t=>t&&"object"==typeof t&&"index"in t,it=t=>t&&"object"==typeof t&&"x"in t&&"y"in t,st=(t,i,s,e)=>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()),void 0===e?t.getA()+s*(i.getA()-t.getA()):e);var et;!function(t){t[t.Nearest=0]="Nearest",t[t.NearestX=1]="NearestX",t[t.NearestY=2]="NearestY"}(et||(et={}));const rt=(t,i,s,e,r,h,n,o,a,l)=>{const c=t.length;if(0===c)return;const u=e?1:0,d=c-(r?2:1);if(s===et.Nearest)return ht(t,i,h,n,u,d);if(s===et.NearestX||s===et.NearestY){if("boolean"==typeof l&&("x"===a&&s===et.NearestX||"y"===a&&s===et.NearestY))return at(t,Z(i,n,h),a,l,u,d);if(s===et.NearestX)return nt(t,Z(i,n,h),o,u,d);if(s===et.NearestY)return ot(t,Z(i,n,h),o,u,d)}},ht=(t,i,s,e,r,h)=>{let n,o=Number.MAX_VALUE;for(let a=r;a<=h;a+=1){const r=t[a];if(!Number.isNaN(r.x)&&!Number.isNaN(r.y)){const t=Z(r,s,e),h=(t.x-i.x)**2+(t.y-i.y)**2;h<o&&(o=h,n=a)}}return n},nt=(t,i,s,e,r)=>{if(i.x<s.min.x||i.x>s.max.x)return;let h,n=Number.MAX_VALUE;for(let s=e;s<=r;s+=1){const e=t[s],r=e.x>i.x?e.x-i.x:i.x-e.x;r<n&&!Number.isNaN(e.x)&&!Number.isNaN(e.y)&&(n=r,h=s)}return h},ot=(t,i,s,e,r)=>{if(i.y<s.min.y||i.y>s.max.y)return;let h,n=Number.MAX_VALUE;for(let s=e;s<=r;s+=1){const e=t[s],r=e.y>i.y?e.y-i.y:i.y-e.y;r<n&&!Number.isNaN(e.x)&&!Number.isNaN(e.y)&&(n=r,h=s)}return h},at=(t,i,s,e,r,h)=>{const n="x"===s,o=n?i.x:i.y,a=t[r],l=t[h],c=a.x<l.x?a.x:l.x,u=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<c||o>d)||!n&&(o<u||o>f))return;let A=r,g=Math.floor((r+h)/2),p=h,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>r?Math.abs(o-(n?t[g-1].x:t[g-1].y)):Zi,e=g<h?Math.abs(o-(n?t[g+1].x:t[g+1].y)):Zi,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}},lt=(t,i,s,e,r,h)=>{const n="x"===s,o=n?i.x:i.y,a=t[r],l=t[h],c=a.x<l.x?a.x:l.x,u=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<c||o>d)||!n&&(o<u||o>f))return;let A=r,g=Math.floor((r+h)/2),p=h,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>r){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<h){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 ct=0;class ut{constructor(t,i,s){this.ci=g(!0),this.ui=!1,this.di=!0,this.fi=!1,this.Ai=void 0,this.gi=0,this.D=new At,this.pi=t,this.yi=i,this.mi=s,this.xi=ct,ct+=1,this.Si=t.bi.highlightColorOffset}Mi(){let t;return this.wi("DataPattern",(i=>(t=i.pattern,!0))),"ProgressiveX"===t||"RegressiveX"===t?et.NearestX:"ProgressiveY"===t||"RegressiveY"===t?et.NearestY:et.Nearest}_i(){}addEventListener(t,i,s){this.D.addEventListener(t,i,s)}R(t,i,s,e){this.D.R(t,i,{collectionMember:s,info:e})}removeEventListener(t,i){this.D.removeEventListener(t,i)}ki(t){return void 0!==this.mi.find((i=>i.type===t))}wi(t,i){var s;return!!this.ki(t)&&!0===i(null===(s=this.mi.find((i=>i.type===t)))||void 0===s?void 0:s.args)}dispose(){return this.ui||(this.pi.Ci(this),this.ui=!0,this.yi(this),this.D.R("dispose",{})),this}isDisposed(){return this.ui}setVisible(t){const i=this.di;return this.di=t,!t&&i&&this.ci.T()&&this.pi.Ci(this),this}getVisible(){return this.di}setPointerEvents(t){const i=this.ci.T();return this.ci.C(t),t||i&&this.pi.Ci(this),this}getPointerEvents(){return this.ci.T()}Ti(t){return this.Ai=t,this}Fi(){return this.Ai?this.Ai:dt}Ii(t){return this.gi=t,this}Pi(){return this.gi}Li(t){return this.Si=t,this}Bi(){return this.Si}}const dt=f(a(0,0),a(0,0)),ft={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 At{constructor(){this.Di=new Array,this.Ri=[],this.ci=!0,this.Ei=!1,this.Oi=new Map}setPointerEvents(t){this.ci=t,this.Ri.forEach((i=>i.setPointerEvents(t)))}getPointerEvents(){return this.ci}addEventListener(t,i,s){this.Di.push({listener:i,key:t,options:s||{}})}removeEventListener(t,i){const s=this.Di.findIndex((t=>t.listener===i));s>=0&&this.Di.splice(s,1)}set draggable(t){this.Ei=t,this.Ri.forEach((i=>{i.fi=t}))}get draggable(){return this.Ei}R(t,i,s=void 0){const e=this.Di.slice();for(let r=e.length-1;r>=0;r-=1){const h=e[r];h.key===t&&(h.listener(i,s),!0===h.options.once&&this.removeEventListener(t,h.listener))}}zi(t,i){const s=[];Object.keys(ft).forEach((e=>{const r=(t,s)=>{const r=gt(t)?{clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY}:t,h=(null==i?void 0:i.getExtraData)&&void 0!==r.clientX?i.getExtraData(r,s.collectionMember,s.info):{};this.R(e,t,h),!t.defaultPrevented&&(null==i?void 0:i.continueIfNotPrevented)&&i.continueIfNotPrevented(e,t,h)};t.addEventListener(e,r),s.push((()=>t.removeEventListener(e,r)))})),this.Ri.push(t);const e=()=>{const i=this.Ri.indexOf(t);i>=0&&this.Ri.splice(i,1)};t.addEventListener("dispose",e),s.push((()=>t.removeEventListener("dispose",e))),this.Oi.set(t,(()=>{s.forEach((t=>t()))})),t.fi=this.Ei,t.setPointerEvents(this.ci)}Vi(){this.Oi.forEach((t=>t())),this.Oi.clear(),this.Ri.length=0}Ni(t,i){const s=[];Object.keys(ft).forEach((e=>{const r=(t,s)=>{const r=i(s.collectionMember);r&&this.R(e,t,r)};t.addEventListener(e,r),s.push((()=>t.removeEventListener(e,r)))})),this.Ri.push(t);const e=()=>{const i=this.Ri.indexOf(t);i>=0&&this.Ri.splice(i,1)};t.addEventListener("dispose",e),s.push((()=>t.removeEventListener("dispose",e))),this.Oi.set(t,(()=>{s.forEach((t=>t()))})),t.setPointerEvents(this.ci),t.fi=this.Ei}Gi(t){Object.keys(ft).forEach((i=>{t.addEventListener(i,((t,s)=>{this.R(i,t,s)}))})),t.setPointerEvents(this.ci),t.draggable=this.Ei}}const gt=t=>!(!t||"object"!=typeof t||!("touches"in t)),pt={linear:(t,i,s)=>{const e=i-t;return r=>r<s?t+e/s*r: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=gi(t);return(s,e,r)=>{const h=i(s),n=i(e);return i=>i<r?t**(h+Math.abs(1-2*(Math.sqrt(.5)*(1-i/r))**2)*(n-h)):e}}};class vt{constructor(t,i,s,e=pt.linear,r){this.delta=0,this.nextAnimations=new Array,this.$i=!1,this.easing=pt.linear,this.isOver=()=>(this.delta===this.duration||this.$i)&&0===this.nextAnimations.length,this.D=new At,this.values=t,this.action=i,this.duration=s,this.easing=e,this.Ui=r,this.eases=t.map((([t,i])=>e(t,i,s)))}ji(){this.D.R("start",{})}start(){return this.Ui.includes(this)||this.Ui.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 r=new vt(t,i,s,e,this.Ui);return this.nextAnimations.push(r),r}finish(t=!0){if(this.$i=!0,this.Ui.splice(this.Ui.indexOf(this),1),this.nextAnimations.length>0){const i=this.nextAnimations[0];return t&&this.D.Di.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.D.R("end",{nextAnimation:i}),this.D.R("everyAnimationEnd",{nextAnimation:i})),i}t&&(this.D.R("end",{nextAnimation:void 0}),this.D.R("everyAnimationEnd",{nextAnimation:void 0}),this.D.R("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(Vt):this.values.map(Vt)}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.D.addEventListener(t,i,s)}removeEventListener(t,i){this.D.removeEventListener(t,i)}}const yt=(t,i=60)=>{i>60&&console.log("Note: Animator FPS is usually capped at 60 by the browser!");const s=[];let e,r,h=0;const n=()=>{e=void 0;const o=Date.now();r=r||o,h=o-r,h/1e3>=1/i&&(r=Date.now()-h%(1e3/i),s.forEach((t=>{0===t.delta&&t.ji(),t.delta+=h-h%(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=Et.requestAnimationFrame(n):(e=void 0,r=void 0)};return(t=1e3,i=pt.linear)=>(r,h,o=t)=>{const a=new vt(r,h,o,i,s).start();return e||(e=Et.requestAnimationFrame(n)),a}};var mt;exports.ImageFitMode=void 0,(mt=exports.ImageFitMode||(exports.ImageFitMode={}))[mt.Fill=0]="Fill",mt[mt.Fit=1]="Fit",mt[mt.Stretch=2]="Stretch",mt[mt.Center=3]="Center",mt[mt.Tile=4]="Tile";const xt=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 St extends xt{constructor(t){super(t)}setSource(t){return this.set("source",t)}getSource(){return this.get("source")}setSurroundingColor(t){return S(t)?this.set("surroundingColor",t):this.set("surroundingColor",t(this.get("surroundingColor")))}getSurroundingColor(){return this.get("surroundingColor")}setSourceMissingColor(t){return S(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}`}toCSS(){return`url(${this.getSource().src})`}}const bt=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"image"===t.fillType),Mt=t.Record({type:"linestyle",lineType:"empty"}),wt=new class extends Mt{constructor(){super(...arguments),this.thickness=0}setThickness(t){return this}getThickness(){return 0}Yi(){return 0}setFillStyle(t){return this}getFillStyle(){return Js}},_t=t=>!(!t||"object"!=typeof t||!("lineType"in t)||"empty"!==t.lineType),kt=-34028234663852886e22,Ct="-340282346638528859811704183484516925440.0";var Tt,Ft,It,Pt;exports.UISpace=void 0,(Tt=exports.UISpace||(exports.UISpace={}))[Tt.Content=0]="Content",Tt[Tt.PaddedContent=1]="PaddedContent",Tt[Tt.PaddedBackground=2]="PaddedBackground",Tt[Tt.Everything=3]="Everything",exports.UIVisibilityModes=void 0,(Ft=exports.UIVisibilityModes||(exports.UIVisibilityModes={}))[Ft.never=0]="never",Ft[Ft.always=1]="always",Ft[Ft.whenHovered=2]="whenHovered",Ft[Ft.whenDragged=3]="whenDragged",Ft[Ft.whenNotDragged=4]="whenNotDragged",Ft[Ft.whenHoveredOrDragged=5]="whenHoveredOrDragged",exports.UIDraggingModes=void 0,(It=exports.UIDraggingModes||(exports.UIDraggingModes={}))[It.notDraggable=0]="notDraggable",It[It.draggable=1]="draggable",It[It.onlyHorizontal=2]="onlyHorizontal",It[It.onlyVertical=3]="onlyVertical",exports.UIDirections=void 0,(Pt=exports.UIDirections||(exports.UIDirections={}))[Pt.Up=0]="Up",Pt[Pt.Right=1]="Right",Pt[Pt.Down=2]="Down",Pt[Pt.Left=3]="Left";const Lt=t=>"getHighlight"in t&&"setHighlight"in t,Bt=(t,i,s)=>void 0===t||"number"==typeof t?t:Array.isArray(t)?t.slice(i,s):t.subarray(i,s),Dt=(...t)=>{const i=t=>t&&"object"==typeof t&&!Array.isArray(t);return t.reduce(((t,s)=>s?(Object.keys(s).forEach((e=>{const r=t[e],h=s[e];i(r)&&i(h)?t[e]=Dt(r,h):t[e]=h})),t):t),{})},Rt=t=>{if(t.resourcesBaseUrl){const i=t.styleFactory(t.resourcesBaseUrl),s=bt(i)&&i.getSource(),e=s&&s instanceof Image?s:void 0;return null==e||e.addEventListener("error",(()=>{Ei(t.resourcesBaseUrl,e.src,"Theme resource",{shouldCrash:!1})})),i}const i=`${Et.location.origin}/resources`,s=t.styleFactory(i);if(bt(s)){const i=s.getSource();i instanceof Image&&i.addEventListener("error",(()=>{const s=t.styleFactory("https://lcjs-resources.lightningchart.com/v1"),e=bt(s)&&s.getSource(),r=e&&e instanceof Image?e:void 0;Et.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==r||r.addEventListener("load",(()=>{t.apply(s)})),null==r||r.addEventListener("error",(()=>{Ei(t.resourcesBaseUrl,i.src,"Theme resource",{shouldCrash:!1})}))}))}return s},Et="undefined"!=typeof window?window:"undefined"!=typeof global&&global._lcjs?global._lcjs:{},Ot=(t,i)=>t.x===i.x&&t.y===i.y,zt=t=>t!==Zi&&t!==Ji&&!Number.isNaN(t)&&Number.isFinite(t)&&t!==1/0&&t!==-1/0,Vt=t=>t[1],Nt=t=>t.dispose(),Gt=()=>{},$t=(t,i)=>t===i,Ut=(t,i,s)=>s>i?Math.min(Math.max(t,i),s):Math.min(Math.max(t,s),i),jt=t=>Array.prototype.concat.apply([],t),Yt=(t,i)=>void 0===t||Number.isNaN(t)?i:t,Ht=t=>t.Hi(),Wt=t=>t.Wi(),Xt=t=>t.Xi(),Zt=t=>t.Zi(),Jt=t=>t.min.x,Qt=t=>t.max.x,Kt=t=>t.min.y,qt=t=>t.max.y,ti=(t,i,s,e,r)=>{if(t.length>0){let h=r?e(r):void 0;for(let e=0;e<t.length;e+=1){const r=i(t[e]);void 0!==r&&(h=void 0!==h?s(h,r):r)}return h}if(r)return e(r)},ii=a(0,1),si=a(1,0),ei=a(0,-1),ri=a(-1,0),hi=a(0,0),ni=t=>{switch(t){case exports.UIDirections.Up:return ii;case exports.UIDirections.Right:return si;case exports.UIDirections.Down:return ei;case exports.UIDirections.Left:return ri;default:return hi}},oi=t=>t===exports.UIDirections.Left||t===exports.UIDirections.Right,ai=t=>{t.stopPropagation(),t.preventDefault()},li=(t,i)=>{if(!i)return t;const s=t.length,e=new Float32Array(2*s);let r=0;for(let i=0;i<s;i+=1){const s=t[i],h=Math.fround(s);e[r+0]=h,e[r+1]=s-h,r+=2}return e},ci=(t,i,s=Float32Array)=>{if(!i){const i=t.length,e=new s(2*i);let r=0;for(let s=0;s<i;s+=1){const i=t[s];e[r+0]=i.x,e[r+1]=i.y,r+=2}return e}const e=t.length,r=new s(4*e);let h=0;for(let i=0;i<e;i+=1){const s=t[i],e=Math.fround(s.x),n=Math.fround(s.y);r[h+0]=e,r[h+1]=n,r[h+2]=s.x-e,r[h+3]=s.y-n,h+=4}return r},ui=t=>{const i=t.length,s=new Float32Array(3*i);let e=0;for(let r=0;r<i;r+=1){const i=t[r];s[e+0]=i.x,s[e+1]=i.y,s[e+2]=i.z,e+=3}return s},di=t=>i=>{const s=t.indexOf(i);s>=0&&t.splice(s,1)},fi=(t,i,s)=>{const e=((t,i)=>{if(i<Zi&&i>Ji&&t<Zi&&t>Ji){const s=Math.abs(t/2**23),e=Math.abs(i/2**23),r=Math.min(s,e);return 10**Math.floor(Math.log10(r))}})(t,i);if(void 0!==e)return e*s},Ai=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},gi=t=>{const i=Math.log(t);return t=>Math.log(t)/i},pi=gi(Math.E),vi=(t,i)=>{const s=i[t];return s?s():void 0},yi=(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)=>Is(Ms(t,s))-Is(Ms(i,s))))},mi=(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},xi=t=>255===t.getA()?t:t.setA(255),Si=(()=>{const t=b(0,0,0);return i=>(i=xi(i),new E({angle:180,stops:[{offset:0,color:i},{offset:1,color:st(i,t,.5)}]}))})(),bi=(()=>{const t=(t,i)=>{var s;if(t){if(ie(t)){if(0===t.getColor().getA())return;return t.getColor()}if(D(t)||O(t)){const i=t.getColorStops();return 2===i.length?i[1].color:null===(s=i[0])||void 0===s?void 0:s.color}return ne(t)&&void 0!==i?t.lut.getColors(i,void 0):void 0}};return(i,s,e)=>{var r;const h=[];if(e.fill&&h.push(e.fill),e.fill2&&h.push(e.fill2),e.stroke){const t=e.stroke.getFillStyle();t!==Js&&("stroke"===(null===(r=e.behavior)||void 0===r?void 0:r.priority)?h.unshift(t):h.push(t))}if(e.point3D){const t=e.point3D;h.push(t.getFillStyle())}let n;if(e.behavior&&!0===e.behavior.colorStep){const[s,r]=h.reduce(((i,s)=>{if(i[0]&&i[1])return i;const r=t(s,e.lutValue);return r&&(void 0===i[0]?i[0]=r:i[1]=r),i}),[void 0,void 0]);n=s&&r?(o=s)===(a=r)||o.getR()===a.getR()&&o.getG()===a.getG()&&o.getB()===a.getB()?Si(o):(o=xi(o),a=xi(a),new E({angle:0,stops:[{offset:0,color:a},{offset:.5,color:a},{offset:.5,color:o},{offset:1,color:o}]})):i.uiButtonFillStyle}else{const r=h.reduce(((i,s)=>i||t(s,e.lutValue)),void 0);n=r?s?new te({color:r}):Si(r):i.uiButtonFillStyle}var o,a;return n}})(),Mi=(t,i)=>{const s=t;if(ne(s))return{lut:s.getPalette(),lookUpProperty:s.getLookUpProperty(),valueRange:i}},wi=t=>{let i=0;return()=>(i+=1,`${t}-${i}`)},_i=(t,i)=>{let s="string"==typeof t?t:String(t);const e=s.indexOf(".");let r=e>=0?e:s.length;for(;r<i;r+=1)s=`0${s}`;return s},ki=(t,i)=>"function"==typeof t?t(i):t,Ci=(t,i)=>i(),Ti=()=>new Error("LightningChart JS encountered an unexpected error.\nPlease report this issue to https://lightningchart.com/js-charts/docs/contact"),Fi=t=>t===Qi||t.min.x===Qi.min.x&&t.max.x===Qi.max.x&&t.min.y===Qi.min.y&&t.max.y===Qi.max.y,Ii=t=>Array.from(new Set(t)),Pi=t=>t.filter((t=>void 0!==t)),Li=t=>"boolean"==typeof t?t?1:0:t>1?1:t<0?0:t,Bi=(t,i)=>{throw new Error(i)},Di=t=>{let i;return()=>i||(i=t(),i)},Ri=t=>{if(t===wt)return 0;const i=t.getThickness();return i<0?1:1*i},Ei=(t,i,s,e)=>{const r=`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 Et.alert(r),new Error(r);Et.console.warn(r)},Oi=(t,i,s,e=0)=>{if(t<s(e)||s(i)<t)return;const r=i;for(;e!==i;){const r=Math.ceil((e+i)/2);t<s(r)?i=r-1:e=r}const h=Math.abs(t-s(e));return e<r&&Math.abs(t-s(e+1))<h?e+1:e},zi=()=>{const t=new Map;return{Ji:i=>(Object.keys(ft).forEach((s=>{i.addEventListener(s,((i,e)=>{const r=e.collectionMember&&t.get(e.collectionMember);if(!r)return;const h=gt(i)?{clientX:i.changedTouches[0].clientX,clientY:i.changedTouches[0].clientY}:i,n=r.Qi(e.info,h,e.collectionMember);r.D.R(s,i,n)}))})),i),Ki:(i,s)=>{t.set(i,s)},Vi:()=>{t.clear()}}},Vi={left:0,right:0,top:0,bottom:0},Ni=()=>Math.round(Math.random()*Number.MAX_SAFE_INTEGER),Gi=(t,i,s)=>{i&&i.qi();const e=s();return Object.keys(e).forEach((i=>{const s=i,r=e[s];t.addEventListener(s,r)})),{ts:t,qi:()=>{Object.entries(e).forEach((([i,s])=>{const e=i,r=s;t.removeEventListener(e,r)}))}}},$i=(t,i,s)=>{let e;const r=()=>(e=s(),e),h={...t,resolve:()=>e||r()};for(const t of Object.keys(i))Object.defineProperty(h,t,{get:function(){return e?e[t]:r()[t]}});return h},Ui=t=>{if(t)return"resolve"in t?t.resolve():t},ji=t=>{let i=t;return{ss:t=>{const s=i;return i=s+t,[s,t]}}},Yi=t=>{Et.document.body.addEventListener(t,(t=>{t.stopPropagation(),t.preventDefault()}),{once:!0,capture:!0})},Hi=()=>{const t=Et.performance.now();Et.document.body.addEventListener("contextmenu",(i=>{Et.performance.now()-t>5e3||i.preventDefault()}),{once:!0})},Wi=()=>{const t=Et.performance.now();Et.document.body.addEventListener("touchstart",(i=>{Et.performance.now()-t>5e3||i.preventDefault()}),{once:!0})},Xi={add:(t,i)=>u(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)=>u(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)=>u(t.x*i,t.y*i,t.z*i),divide:(t,i)=>u(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=>Xi.divide(t,Xi.length(t)),dot:(t,i)=>t.x*i.x+t.y*i.y+t.z*i.z,cross:(t,i)=>u(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(Xi.dot(t,i)/(Xi.length(t)*Xi.length(i))),rotateAroundAxis(t,i,s){const e=Math.cos(s),r=Math.sin(s),h=Xi.dot(i,t),n=Xi.cross(i,t);return Xi.addVec(Xi.multiply(t,e),Xi.addVec(Xi.multiply(i,(1-e)*h),Xi.multiply(n,r)))},lerp:(t,i,s)=>(s=Ut(s,0,1),Xi.addVec(Xi.multiply(t,1-s),Xi.multiply(i,s))),equals:(t,i)=>$t(t.x,i.x)&&$t(t.y,i.y)&&$t(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)})},Zi=Number.MAX_VALUE,Ji=-Number.MAX_VALUE,Qi=f(a(Zi,Zi),a(Ji,Ji)),Ki=f(u(Zi,Zi,Zi),u(Ji,Ji,Ji)),qi=(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))},ts=(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),is=(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),ss=(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)}}),es=t=>{const i=t.length;for(let s=0;s<i;s+=1)for(let e=s+1;e<i;e+=1)if(ts(t[s],t[e]))return!0;return!1},rs=(t,i)=>i+t,hs=(t,i,s)=>{const e=Ms(i,t),r=e.x*e.x+e.y*e.y;if(0===r)return t;const h=Ms(s,t),n=(h.x*e.x+h.y*e.y)/r;return n<=0?t:n>=1?i:a(t.x+n*e.x,t.y+n*e.y)},ns=(t,i,s)=>s>i?t>=i&&t<=s:t>=s&&t<=i,os=(t,i)=>{const s=t.x-i.x,e=t.y-i.y;return Math.sqrt(s*s+e*e)},as=(t,i)=>{const s=t.x-i.x,e=t.y-i.y;return s*s+e*e},ls=(t,i,s)=>bs(t,Ss(Ms(i,t),s)),cs=(t,i,s)=>Xi.addVec(t,Xi.multiply(Xi.subtractVec(i,t),s));function us(t){const i=t.length;if(i>0){let s=t[0].x,e=t[0].x,r=t[0].y,h=t[0].y;for(let n=1;n<i;n+=1){const i=t[n];i.x>s&&(s=i.x),i.x<e&&(e=i.x),i.y>r&&(r=i.y),i.y<h&&(h=i.y)}return f(a(e,h),a(s,r))}return Qi}function ds(t){const i=t.length;if(i>0){let s=t[0].x,e=t[0].x,r=t[0].y,h=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>r&&(r=i.y),i.y<h&&(h=i.y),i.z>n&&(n=i.z),i.z<o&&(o=i.z)}return f(u(e,h,o),u(s,r,n))}return Ki}const fs=(...t)=>{const i={min:{x:Zi,y:Zi},max:{x:Ji,y:Ji}};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},As=(t,i)=>f(u(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),u(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 gs(t,i,s,e){const r=t.x-e.x,h=t.y-e.y,n=e.x-s.x,o=s.y-e.y,a=o*r+n*h,l=(e.y-i.y)*r+(i.x-e.x)*h,c=o*(i.x-e.x)+n*(i.y-e.y);return c<0?a<=0&&l<=0&&a+l>=c:a>=0&&l>=0&&a+l<=c}function ps(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 vs(t,i){return a(t.x-i.x,t.y-i.y)}function ys(t){const i=xs(t);return 0===i?a(0,0):a(t.x/i,t.y/i)}function ms(t,i){let s={x:i.x-t.x,y:i.y-t.y};s=ys(s);const e=Math.PI/2,r=s.x;return s.x=-Math.sin(e)*s.y,s.y=r*Math.sin(e),s}function xs(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function Ss(t,i){return a(t.x*i,t.y*i)}function bs(t,i){return a(t.x+i.x,t.y+i.y)}function Ms(t,i){return a(t.x-i.x,t.y-i.y)}function ws(t,i){return a(t.x*i.x,t.y*i.y)}function _s(t,i){return a(t.x/i.x,t.y/i.y)}function ks(t){return Ss(t,-1)}function Cs(t,i){return t.x*i.x+t.y*i.y}const Ts=(t,i,s)=>{const e=(s.y-i.y)/(s.x-i.x),r=i.y+(t-i.x)*e;return a(t,r)};function Fs(t){return t*Math.PI/180}function Is(t){return 180*Math.atan2(t.y,t.x)/Math.PI}function Ps(t){return a(Math.cos(t),Math.sin(t))}const Ls=(t,i)=>{const s=t.length,e=i.length,r=new Uint16Array(s+e);return r.set(t,0),r.set(i,s),r};class Bs extends G{constructor(t,i,s,e){super(t,i,s,e),this.es={internal:10,function:Ds(10),number:10},this.j=1e3,this.W(1,1e3),this.Wt=this.rs()}et(t,i,s,e,r){if(t===i)return!1;const h=Math.min(t,i)<Es,n=Math.max(t,i)>Os;return!h&&!n||!!r&&(i>t?{start:h?Es:t,end:n?Os:i}:{start:n?Os:t,end:h?Es:i})}Dt(t){const i=this.bt(),s=this.Mt(),e=Math.max(t,Es);return i+(this.es.function(e)-this.Wt.scaleStartLog)/this.Wt.scaleIntervalLog*(s-i)}Rt(t){const i=this.bt(),s=(t-i)/(this.Mt()-i),e=this.Wt.scaleStartLog+s*this.Wt.scaleIntervalLog;return this.es.number**e}Ft(){this.es&&this.rs()}W(t,i){return super.W(t,i),this.es&&this.rs(),this}St(t){return super.St(t),this.es&&this.rs(),this}Z(t){return super.Z(t),this.es&&this.rs(),this}hs(t){return this.es={internal:t,function:Ds(t),number:Rs(t)},this}ns(){return this.es.internal}Qt(t,i){const s=this.Dt(t)+i;return this.Rt(s)}Bt(){return this.nt||this.rt||this.ct||this.ht}rs(){const t=this.es.function(this.$),i=this.es.function(this.U)-t,s=2*this.bt()/this.j-1,e=2*this.Mt()/this.j-1-s;return this.Wt={scaleStartLog:t,scaleIntervalLog:i,viewportStart:s,viewportSize:e},this.Wt}Ht(){return this.Wt}}const Ds=t=>"e"===t?pi:gi(t),Rs=t=>"e"===t?Math.E:t,Es=.9*10**-20,Os=1.1*10**25,zs=[{prefix:"T",unit:10**12},{prefix:"B",unit:10**9},{prefix:"M",unit:1e6},{prefix:"K",unit:1e3}],Vs=(t,i,s)=>{const e=Math.abs(s-i);if(0===e)return t.toFixed(0);const r=Math.max(2-qi(e,10),0);return t.toFixed(r)},Ns={Numeric:(t,i)=>{const{start:s,end:e}=i;return Vs(t,s,e)},NumericUnits:(t,i)=>{const{start:s,end:e}=i,r=Math.abs(e-s),h=t<0;t=Math.abs(t);let n="",o="";if(r>=1e3&&t>1e3){let i="";for(const s of zs){const e=Math.round(1e3*t/s.unit)/1e3;if(e>=1){i=e.toString(),o=s.prefix;break}}n=(h?"-":"")+i}else{let i=String(Math.floor(t));const s=qi(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=(h?"-":"")+i+(r<=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-qi(r,10)):"")}return n+=o,n},LogarithmicExponentsRounded:(t,i,s,e=10)=>{const r=Ds(e)(t);return`${e}${Gs(r)}`},LogarithmicExponents:(t,i,s,e=10)=>{const r=Ds(e),h=Math.floor(r(t)),n=t/Rs(e)**h;return`${Math.round(n)}×${e}${Gs(h)}`},LogarithmicExtreme:(t,i,s,e=10)=>{const r=Ds(e),h=Math.floor(r(t));return`${(t/Rs(e)**h).toFixed(2)}×${e}${Gs(h)}`},LogarithmicNoExponents:(t,i,s,e=10)=>{const r=Ds(e);if("e"===e)return`${Math.floor(r(t))}e`;const h=t.toString();if(t>1)return h;const n=Math.floor(r(t));return t.toFixed(Math.abs(n))},Scientific:(t,i)=>{const{start:s,end:e}=i,r=Math.max(Math.abs(s),Math.abs(e)),h=Math.floor(Math.log10(r));return 0===t?`0.00e${h<0?"":"+"}${h}`:t.toExponential(2)}},Gs=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(""),$s=(t,i)=>t.value-i.value,Us=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,formatter:(t,i)=>Vs(t,i.min,i.max)}),js=t=>{const{steps:i}=t,s=i.length;i.sort($s);const[e,r]=s>0?[i[0].value,i[s-1].value]:[0,0],h=s>0?s-1:0,n=Array(h);for(let t=0;t<h;t+=1)n[t]={min:i[t],max:i[t+1]};return{min:e,max:r,length:s,steps:i,subranges:n,isValid:s>0&&e!==r}};class Ys extends Us{constructor(t){super(((t,i)=>({steps:t.steps,title:t.title,units:t.units,interpolate:t.interpolate,percentageValues:t.percentageValues,color:t.color,formatter:t.formatter,length:i.length,min:i.min,max:i.max,subranges:i.subranges,isValid:i.isValid}))(t,js(t)))}toString(){return`LUT:interpolate=${this.interpolate},steps=${this.steps.length},percentage=${this.percentageValues}`}setSteps(t){return this.merge(js({...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")}setFormatter(t){return this.set("formatter",t)}getFormatter(){return this.get("formatter")}getColors(t,i){if(Array.isArray(t)){if(Array.isArray(t[0])){const s=t,e=s.length,r=s[0].length,h=[...Array(e)].map((()=>Array(r)));for(let t=0;t<e;t+=1)for(let e=0;e<r;e+=1)h[t][e]=this.ls(s[t][e],i);return h}const s=t,e=s.length,r=Array(e);for(let t=0;t<e;t+=1)r[t]=this.ls(s[t],i);return r}return this.ls(t,i)}ls(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 r=e.color,h=o.color,n=i,new x({r:r.r+(h.r-r.r)*n,g:r.g+(h.g-r.g)*n,b:r.b+(h.b-r.b)*n,a:r.a+(h.a-r.a)*n})}}return t<s[0].value?s[0].color:s[e-1].color}var r,h,n;for(let i=e-1;i>=0;i-=1)if(t>=s[i].value)return s[i].color;return s[0].color}}const Hs=t=>!(!t||"object"!=typeof t||!("type"in t)||"lut"!==t.type),Ws=(t,i)=>t.formatter(i,{min:t.min,max:t.max,percentageValues:t.percentageValues}),Xs=t.Record({type:"fillstyle",fillType:"empty"});class Zs extends Xs{toString(){return"emptyFill"}toCSS(){return"transparent"}}const Js=new Zs,Qs=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"empty"===t.fillType),Ks=t.Record({type:"fillstyle",fillType:"solid",color:b(255,255,255)});class qs extends Ks{}class te extends qs{constructor(t){super({...t,fillType:"solid"})}toString(){return`solidFill:${this.color.toString()}`}toCSS(){return this.color.toRGBAString()}setColor(t){return S(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 ie=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"solid"===t.fillType);class se extends qs{constructor(t){super({...t,fillType:"individual"})}toString(){return`individualPointFill:${this.color.toString()}`}toCSS(){return this.getFallbackColor().toRGBAString()}setFallbackColor(t){return S(t)?this.set("color",t):this.set("color",t(this.get("color")))}getFallbackColor(){return this.get("color")}}const ee=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"individual"===t.fillType),re=t.Record({type:"fillstyle",fillType:"palette",lut:new Ys({steps:[]}),lookUpProperty:"value"});class he extends re{constructor(t){super({...t,fillType:"palette"})}toString(){return`palettedFill:lut=${this.lut.toString()},lookUpProperty=${this.lookUpProperty}`}toCSS(){return`linear-gradient(${this.lut.getSteps().map((t=>t.color.toRGBAString())).join(", ")})`}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 ne=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"palette"===t.fillType),oe=(t,i)=>t instanceof Bs||i instanceof Bs?(new H).Kt(t,i):(new Y).Kt(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),ce=t=>"relative"===t,ue=t=>!!(t&&"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y),de=(t,i,s,e)=>{let r,h,n=Number.MAX_VALUE;for(let o=0;o<i.length;o+=1){const a=i[o],l=s(a,t);if(l){const i=e(t,l);(void 0===r||i<n)&&(r=l,h=a,n=i)}}return r&&h?[r,h]:void 0},fe=(t,i,s,e,r,h)=>{if(!t)return;let n=t;const o="button"in s?s:void 0;if(o)if(0===o.button){if(!1===t.lmb)return;void 0!==t.lmb&&(n=Dt(n,t.lmb))}else if(1===o.button){if(!1===t.mmb)return;void 0!==t.mmb&&(n=Dt(n,t.mmb))}else if(2===o.button){if(!1===t.rmb)return;void 0!==t.rmb&&(n=Dt(n,t.rmb))}if(e){if(!1===t.shift)return;n=Dt(n,t.shift)}if(r){if(!1===t.ctrl)return;n=Dt(n,t.ctrl)}if(h){if(!1===t.alt)return;n=Dt(n,t.alt)}if(!i)return n;const a=n[i];return a?!0===a?n:Dt(n,a):void 0},Ae=t=>{const i=[];return{push:t=>{i.push(t)},end:()=>{i.length>1&&t&&Et.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()))}}},ge=(t,i,s)=>{if(t){const t={x:s.x.bt(),y:s.y.bt(),width:s.x.wt(),height:s.y.wt()};i.forEach((i=>{i.cs=t}))}else i.forEach((t=>{t.cs=void 0}))},pe=(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},ve=t=>{let i=!1,s={type:"linear"};if(t&&(void 0!==t.opposite&&(i=t.opposite),t.type&&"linear-hi