@jigonzalez930209/scichart-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,130 @@
1
+ (function(b,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(b=typeof globalThis<"u"?globalThis:b||self,w(b.SciChartEngine={},b.React))})(this,function(b,w){"use strict";var it=Object.defineProperty;var nt=(b,w,I)=>w in b?it(b,w,{enumerable:!0,configurable:!0,writable:!0,value:I}):b[w]=I;var u=(b,w,I)=>nt(b,typeof w!="symbol"?w+"":w,I);class I{constructor(){u(this,"listeners",new Map)}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){const n=this.listeners.get(e);n&&n.delete(t)}emit(e,t){const n=this.listeners.get(e);n&&n.forEach(i=>{try{i(t)}catch(o){console.error(`[EventEmitter] Error in handler for "${String(e)}":`,o)}})}once(e,t){const n=i=>{this.off(e,n),t(i)};this.on(e,n)}clear(){this.listeners.clear()}listenerCount(e){var t;return((t=this.listeners.get(e))==null?void 0:t.size)??0}}const Ee={color:"#ff0055",width:1.5,opacity:1,pointSize:4};function O(c){return c?c instanceof Float32Array||c instanceof Float64Array?c:new Float32Array(c):new Float32Array(0)}class le{constructor(e){u(this,"id");u(this,"type");u(this,"data");u(this,"style");u(this,"visible");u(this,"cycle");u(this,"cachedBounds",null);u(this,"boundsNeedsUpdate",!0);u(this,"_needsBufferUpdate",!0);u(this,"smoothedData",null);u(this,"smoothingNeedsUpdate",!0);var t,n;if(!e)throw new Error("[Series] Options are required");this.id=e.id,this.type=e.type,this.data={x:O((t=e.data)==null?void 0:t.x),y:O((n=e.data)==null?void 0:n.y)},this.style={...Ee,...e.style},e.color&&(this.style.color=e.color),e.width&&(this.style.width=e.width),e.pointSize&&(this.style.pointSize=e.pointSize),this.visible=e.visible??!0,this.cycle=e.cycle,this.data.x.length!==this.data.y.length&&console.warn(`[Series "${this.id}"] X and Y arrays have different lengths:`,this.data.x.length,"vs",this.data.y.length)}getId(){return this.id}getType(){return this.type}getData(){return this.style.smoothing&&this.style.smoothing>0?this.getSmoothedData():this.data}getSmoothedData(){return(this.smoothingNeedsUpdate||!this.smoothedData)&&(this.smoothedData=this.applySmoothing(this.data,5),this.smoothingNeedsUpdate=!1),this.smoothedData}applySmoothing(e,t){const{x:n,y:i}=e,o=n.length;if(o<t)return{...e};const s=new Float32Array(o),r=Math.floor(t/2);for(let a=0;a<o;a++){let l=0,h=0;for(let f=a-r;f<=a+r;f++)f>=0&&f<o&&(l+=i[f],h++);s[a]=l/h}return{x:n,y:s}}getStyle(){return this.style}isVisible(){return this.visible}getCycle(){return this.cycle}getPointCount(){return this.data.x.length}getBounds(){return this.data.x.length===0?null:((this.boundsNeedsUpdate||this.cachedBounds===null)&&(this.cachedBounds=this.calculateBounds(),this.boundsNeedsUpdate=!1),this.cachedBounds)}calculateBounds(){const{x:e,y:t}=this.data;let n=1/0,i=-1/0,o=1/0,s=-1/0;for(let a=0;a<e.length;a++){const l=e[a],h=t[a];!isFinite(l)||!isFinite(h)||(l<n&&(n=l),l>i&&(i=l),h<o&&(o=h),h>s&&(s=h))}return{xMin:n,xMax:i,yMin:o,yMax:s}}updateData(e){if(e){if(e.append){const t=O(e.x),n=O(e.y);t.length>0&&n.length>0&&(this.data={x:this.appendArray(this.data.x,t),y:this.appendArray(this.data.y,n)})}else e.x&&(this.data.x=O(e.x)),e.y&&(this.data.y=O(e.y));this.boundsNeedsUpdate=!0,this.smoothingNeedsUpdate=!0,this._needsBufferUpdate=!0}}appendArray(e,t){const n=new e.constructor(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}setData(e,t){this.data={x:e,y:t},this.boundsNeedsUpdate=!0,this.smoothingNeedsUpdate=!0,this._needsBufferUpdate=!0}setStyle(e){const t=this.style.smoothing;this.style={...this.style,...e},this.style.smoothing!==t&&(this.smoothingNeedsUpdate=!0,this._needsBufferUpdate=!0)}get needsBufferUpdate(){return this._needsBufferUpdate}set needsBufferUpdate(e){this._needsBufferUpdate=e}setVisible(e){this.visible=e}setType(e){this.type=e}destroy(){this.data={x:new Float32Array(0),y:new Float32Array(0)},this.cachedBounds=null}}const ke=`
2
+ precision highp float;
3
+ attribute vec2 position;
4
+ uniform vec2 uScale;
5
+ uniform vec2 uTranslate;
6
+
7
+ void main() {
8
+ vec2 pos = position * uScale + uTranslate;
9
+ gl_Position = vec4(pos, 0.0, 1.0);
10
+ }
11
+ `,Re=`
12
+ precision highp float;
13
+ uniform vec4 uColor;
14
+
15
+ void main() {
16
+ gl_FragColor = uColor;
17
+ }
18
+ `,Be=`
19
+ precision highp float;
20
+ attribute vec2 position;
21
+ uniform vec2 uScale;
22
+ uniform vec2 uTranslate;
23
+ uniform float uPointSize;
24
+
25
+ void main() {
26
+ vec2 pos = position * uScale + uTranslate;
27
+ gl_Position = vec4(pos, 0.0, 1.0);
28
+ gl_PointSize = uPointSize;
29
+ }
30
+ `,Pe=`
31
+ precision highp float;
32
+ uniform vec4 uColor;
33
+
34
+ void main() {
35
+ vec2 coord = gl_PointCoord - vec2(0.5);
36
+ float dist = length(coord);
37
+ if (dist > 0.5) discard;
38
+ float alpha = 1.0 - smoothstep(0.4, 0.5, dist);
39
+ gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);
40
+ }
41
+ `;class W{constructor(e){u(this,"canvas");u(this,"gl");u(this,"dpr");u(this,"lineProgram");u(this,"pointProgram");u(this,"buffers",new Map);u(this,"bufferSizes",new Map);u(this,"isInitialized",!1);this.canvas=e,this.dpr=window.devicePixelRatio||1;const t=e.getContext("webgl",{alpha:!0,antialias:!0,preserveDrawingBuffer:!0,powerPreference:"high-performance"});if(!t)throw new Error("WebGL not supported");this.gl=t,this.lineProgram=this.createProgram(ke,Re,!1),this.pointProgram=this.createProgram(Be,Pe,!0),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),this.isInitialized=!0,console.log("[NativeWebGL] Initialized successfully")}createShader(e,t){const{gl:n}=this,i=n.createShader(t);if(!i)throw new Error("Failed to create shader");if(n.shaderSource(i,e),n.compileShader(i),!n.getShaderParameter(i,n.COMPILE_STATUS)){const o=n.getShaderInfoLog(i);throw n.deleteShader(i),new Error(`Shader compilation error: ${o}`)}return i}createProgram(e,t,n){const{gl:i}=this,o=this.createShader(e,i.VERTEX_SHADER),s=this.createShader(t,i.FRAGMENT_SHADER),r=i.createProgram();if(!r)throw new Error("Failed to create program");if(i.attachShader(r,o),i.attachShader(r,s),i.linkProgram(r),!i.getProgramParameter(r,i.LINK_STATUS)){const m=i.getProgramInfoLog(r);throw new Error(`Program link error: ${m}`)}i.deleteShader(o),i.deleteShader(s);const a=i.getAttribLocation(r,"position"),l=i.getUniformLocation(r,"uScale"),h=i.getUniformLocation(r,"uTranslate"),f=i.getUniformLocation(r,"uColor");if(l===null||h===null||f===null)throw new Error("Failed to get uniform locations");const y={program:r,attributes:{position:a},uniforms:{uScale:l,uTranslate:h,uColor:f}};return n&&(y.uniforms.uPointSize=i.getUniformLocation(r,"uPointSize")??void 0),y}get available(){return this.isInitialized}createBuffer(e,t){const{gl:n}=this;let i=this.buffers.get(e);const o=this.bufferSizes.get(e)||0;if(i&&t.byteLength<=o)n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferSubData(n.ARRAY_BUFFER,0,t);else{if(i&&n.deleteBuffer(i),i=n.createBuffer(),!i)throw new Error("Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,t,n.DYNAMIC_DRAW),this.buffers.set(e,i),this.bufferSizes.set(e,t.byteLength)}}getBuffer(e){return this.buffers.get(e)}deleteBuffer(e){const t=this.buffers.get(e);t&&(this.gl.deleteBuffer(t),this.buffers.delete(e),this.bufferSizes.delete(e))}calculateUniforms(e){const t=e.xMax-e.xMin,n=e.yMax-e.yMin,i=t>0?2/t:1,o=n>0?2/n:1,s=-1-e.xMin*i,r=-1-e.yMin*o;return{scale:[i,o],translate:[s,r]}}render(e,t){if(!this.isInitialized)return;const{gl:n}=this,{bounds:i,backgroundColor:o=[.1,.1,.18,1]}=t,s=this.calculateUniforms(i);n.clearColor(o[0],o[1],o[2],o[3]),n.clear(n.COLOR_BUFFER_BIT);for(const r of e){if(!r.visible||r.count===0)continue;const a=V(r.style.color??"#ff0055");a[3]=r.style.opacity??1,r.type==="scatter"?this.renderPoints(r.buffer,r.count,s,a,(r.style.pointSize??4)*this.dpr):r.type==="line"?this.renderLine(r.buffer,r.count,s,a):r.type==="line+scatter"&&(this.renderLine(r.buffer,r.count,s,a),this.renderPoints(r.buffer,r.count,s,a,(r.style.pointSize??4)*this.dpr))}}renderLine(e,t,n,i){const{gl:o}=this,s=this.lineProgram;o.useProgram(s.program),o.bindBuffer(o.ARRAY_BUFFER,e),o.enableVertexAttribArray(s.attributes.position),o.vertexAttribPointer(s.attributes.position,2,o.FLOAT,!1,0,0),o.uniform2f(s.uniforms.uScale,n.scale[0],n.scale[1]),o.uniform2f(s.uniforms.uTranslate,n.translate[0],n.translate[1]),o.uniform4f(s.uniforms.uColor,i[0],i[1],i[2],i[3]),o.drawArrays(o.LINE_STRIP,0,t),o.disableVertexAttribArray(s.attributes.position)}renderPoints(e,t,n,i,o){const{gl:s}=this,r=this.pointProgram;s.useProgram(r.program),s.bindBuffer(s.ARRAY_BUFFER,e),s.enableVertexAttribArray(r.attributes.position),s.vertexAttribPointer(r.attributes.position,2,s.FLOAT,!1,0,0),s.uniform2f(r.uniforms.uScale,n.scale[0],n.scale[1]),s.uniform2f(r.uniforms.uTranslate,n.translate[0],n.translate[1]),s.uniform4f(r.uniforms.uColor,i[0],i[1],i[2],i[3]),r.uniforms.uPointSize&&s.uniform1f(r.uniforms.uPointSize,o),s.drawArrays(s.POINTS,0,t),s.disableVertexAttribArray(r.attributes.position)}resize(){const e=this.canvas.getBoundingClientRect(),t=e.width*this.dpr,n=e.height*this.dpr;(this.canvas.width!==t||this.canvas.height!==n)&&(this.canvas.width=t,this.canvas.height=n,this.gl.viewport(0,0,t,n))}getLimits(){const{gl:e}=this;return{maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxViewportDims:e.getParameter(e.MAX_VIEWPORT_DIMS),renderer:e.getParameter(e.RENDERER),vendor:e.getParameter(e.VENDOR)}}destroy(){const{gl:e}=this;this.buffers.forEach(t=>e.deleteBuffer(t)),this.buffers.clear(),this.bufferSizes.clear(),e.deleteProgram(this.lineProgram.program),e.deleteProgram(this.pointProgram.program),this.isInitialized=!1,console.log("[NativeWebGL] Destroyed")}}function V(c){if(c.startsWith("#")){const e=c.slice(1);if(e.length===3){const t=parseInt(e[0]+e[0],16)/255,n=parseInt(e[1]+e[1],16)/255,i=parseInt(e[2]+e[2],16)/255;return[t,n,i,1]}else if(e.length===6){const t=parseInt(e.slice(0,2),16)/255,n=parseInt(e.slice(2,4),16)/255,i=parseInt(e.slice(4,6),16)/255;return[t,n,i,1]}else if(e.length===8){const t=parseInt(e.slice(0,2),16)/255,n=parseInt(e.slice(2,4),16)/255,i=parseInt(e.slice(4,6),16)/255,o=parseInt(e.slice(6,8),16)/255;return[t,n,i,o]}}return[1,0,1,1]}function ce(c,e){const t=Math.min(c.length,e.length),n=new Float32Array(t*2);for(let i=0;i<t;i++)n[i*2]=c[i],n[i*2+1]=e[i];return n}class H{constructor(){u(this,"domain",[0,1]);u(this,"range",[0,100]);u(this,"type","linear")}setDomain(e,t){if(!isFinite(e)||!isFinite(t)){this.domain=[0,1];return}if(e===t){this.domain=[e-.5,t+.5];return}this.domain=[e,t]}setRange(e,t){this.range=[e,t]}transform(e){const[t,n]=this.domain,[i,o]=this.range,s=(e-t)/(n-t);return i+s*(o-i)}invert(e){const[t,n]=this.domain,[i,o]=this.range,s=(e-i)/(o-i);return t+s*(n-t)}ticks(e=10){const[t,n]=this.domain;if(!isFinite(t)||!isFinite(n)||t===n)return[];const i=Ae(t,n,e),o=Math.ceil(t/i)*i,s=[],r=100;let a=o;for(;a<=n+i*.5&&s.length<r;)s.push(Math.round(a*1e12)/1e12),a+=i;return s}}class ${constructor(){u(this,"domain",[1,1e3]);u(this,"range",[0,100]);u(this,"type","log");u(this,"base",10)}setDomain(e,t){const n=Math.max(e,1e-12),i=Math.max(t,1e-12*10);if(n===i){this.domain=[n/10,i*10];return}this.domain=[n,i]}setRange(e,t){this.range=[e,t]}transform(e){const[t,n]=this.domain,[i,o]=this.range;if(e<=0)return i;const s=Math.log(t)/Math.log(this.base),r=Math.log(n)/Math.log(this.base),l=(Math.log(e)/Math.log(this.base)-s)/(r-s);return i+l*(o-i)}invert(e){const[t,n]=this.domain,[i,o]=this.range,s=Math.log(t)/Math.log(this.base),r=Math.log(n)/Math.log(this.base),a=(e-i)/(o-i),l=s+a*(r-s);return Math.pow(this.base,l)}ticks(e=10){const[t,n]=this.domain,i=Math.floor(Math.log10(t)),o=Math.ceil(Math.log10(n)),s=[];for(let r=i;r<=o&&s.length<e;r++){const a=Math.pow(10,r);a>=t&&a<=n&&s.push(a)}return s}}function Ae(c,e,t){const n=e-c;if(n<=0||!isFinite(n))return 1;const i=n/t,o=Math.pow(10,Math.floor(Math.log10(i))),s=i/o;let r;return s<1.5?r=1:s<3?r=2:s<7?r=5:r=10,r*o}function Le(c){return c==="log"?new $:new H}const F={lineColor:"#666666",lineWidth:1,tickColor:"#888888",tickLength:6,labelColor:"#cccccc",labelSize:12,titleColor:"#ffffff",titleSize:14,fontFamily:"Inter, system-ui, sans-serif"},G={visible:!0,majorColor:"rgba(255, 255, 255, 0.12)",minorColor:"rgba(255, 255, 255, 0.05)",majorWidth:1,minorWidth:.5,majorDash:[4,4],minorDash:[2,4],showMinor:!0,minorDivisions:5},Z={visible:!0,position:"top-right",backgroundColor:"rgba(20, 20, 30, 0.9)",borderColor:"rgba(255, 255, 255, 0.15)",borderRadius:6,textColor:"#ffffff",fontSize:11,fontFamily:"Inter, system-ui, sans-serif",padding:10,itemGap:6,swatchSize:12},q={lineColor:"rgba(255, 255, 255, 0.5)",lineWidth:1,lineDash:[5,5],tooltipBackground:"rgba(20, 20, 30, 0.95)",tooltipBorder:"rgba(255, 255, 255, 0.2)",tooltipColor:"#ffffff",tooltipSize:11},J={name:"dark",backgroundColor:"#0b0e14",plotBorderColor:"#444c56",grid:{...G,majorColor:"rgba(255, 255, 255, 0.12)",minorColor:"rgba(255, 255, 255, 0.04)"},xAxis:{...F,labelColor:"#adbac7",titleColor:"#cdd9e5",lineColor:"#444c56",tickColor:"#444c56"},yAxis:{...F,labelColor:"#adbac7",titleColor:"#cdd9e5",lineColor:"#444c56",tickColor:"#444c56"},legend:Z,cursor:q},he={name:"midnight",backgroundColor:"#05050a",plotBorderColor:"#3a3a5a",grid:{...G,majorColor:"rgba(150, 150, 255, 0.2)",minorColor:"rgba(150, 150, 255, 0.08)"},xAxis:{...F,lineColor:"#5a5a8a",labelColor:"#b0b0e0",titleColor:"#d0d0f0",tickColor:"#5a5a8a"},yAxis:{...F,lineColor:"#5a5a8a",labelColor:"#b0b0e0",titleColor:"#d0d0f0",tickColor:"#5a5a8a"},legend:{...Z,backgroundColor:"rgba(15, 15, 30, 0.95)",borderColor:"rgba(100, 100, 255, 0.4)"},cursor:{...q,lineColor:"rgba(150, 150, 255, 0.7)"}},de={name:"light",backgroundColor:"#ffffff",plotBorderColor:"#cccccc",grid:{...G,majorColor:"rgba(0, 0, 0, 0.1)",minorColor:"rgba(0, 0, 0, 0.04)"},xAxis:{...F,lineColor:"#888888",tickColor:"#888888",labelColor:"#444444",titleColor:"#222222"},yAxis:{...F,lineColor:"#888888",tickColor:"#888888",labelColor:"#444444",titleColor:"#222222"},legend:{...Z,backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"rgba(0, 0, 0, 0.15)",textColor:"#222222"},cursor:{...q,lineColor:"rgba(0, 0, 0, 0.4)",tooltipBackground:"rgba(50, 50, 60, 0.95)"}},ue={name:"electrochemistry",backgroundColor:"#0a1628",plotBorderColor:"#1e3a5f",grid:{...G,majorColor:"rgba(30, 136, 229, 0.15)",minorColor:"rgba(30, 136, 229, 0.06)",showMinor:!0,minorDivisions:2},xAxis:{...F,lineColor:"#1e88e5",tickColor:"#42a5f5",labelColor:"#90caf9",titleColor:"#bbdefb"},yAxis:{...F,lineColor:"#1e88e5",tickColor:"#42a5f5",labelColor:"#90caf9",titleColor:"#bbdefb"},legend:{...Z,backgroundColor:"rgba(10, 22, 40, 0.95)",borderColor:"rgba(30, 136, 229, 0.3)"},cursor:{...q,lineColor:"rgba(100, 180, 255, 0.6)"}};function _e(c,e){return{...c,...e,grid:{...c.grid,...e.grid},xAxis:{...c.xAxis,...e.xAxis},yAxis:{...c.yAxis,...e.yAxis},legend:{...c.legend,...e.legend},cursor:{...c.cursor,...e.cursor}}}function Q(c){switch(c){case"dark":return J;case"midnight":return he;case"light":return de;case"electrochemistry":case"electrochem":return ue;default:return console.warn(`[Theme] Unknown theme "${c}", using dark`),J}}const ee=J;class fe{constructor(e,t){u(this,"ctx");u(this,"theme");this.ctx=e,this.theme=t}setTheme(e){this.theme=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}drawGrid(e,t,n){if(!this.theme.grid.visible)return;const{ctx:i}=this,o=this.theme.grid,s=t.ticks(8),r=n.ticks(6);if(i.strokeStyle=o.majorColor,i.lineWidth=o.majorWidth,i.setLineDash(o.majorDash),s.forEach(a=>{const l=t.transform(a);l>=e.x&&l<=e.x+e.width&&(i.beginPath(),i.moveTo(l,e.y),i.lineTo(l,e.y+e.height),i.stroke())}),r.forEach(a=>{const l=n.transform(a);l>=e.y&&l<=e.y+e.height&&(i.beginPath(),i.moveTo(e.x,l),i.lineTo(e.x+e.width,l),i.stroke())}),o.showMinor){i.strokeStyle=o.minorColor,i.lineWidth=o.minorWidth,i.setLineDash(o.minorDash);const a=this.generateMinorTicks(s,o.minorDivisions),l=this.generateMinorTicks(r,o.minorDivisions);a.forEach(h=>{const f=t.transform(h);f>=e.x&&f<=e.x+e.width&&(i.beginPath(),i.moveTo(f,e.y),i.lineTo(f,e.y+e.height),i.stroke())}),l.forEach(h=>{const f=n.transform(h);f>=e.y&&f<=e.y+e.height&&(i.beginPath(),i.moveTo(e.x,f),i.lineTo(e.x+e.width,f),i.stroke())})}i.setLineDash([])}drawXAxis(e,t,n){const{ctx:i}=this,o=this.theme.xAxis,s=t.ticks(8),r=e.y+e.height;i.strokeStyle=o.lineColor,i.lineWidth=o.lineWidth,i.beginPath(),i.moveTo(e.x,r),i.lineTo(e.x+e.width,r),i.stroke(),i.fillStyle=o.labelColor,i.font=`${o.labelSize}px ${o.fontFamily}`,i.textAlign="center",i.textBaseline="top",s.forEach(a=>{const l=t.transform(a);l>=e.x&&l<=e.x+e.width&&(i.strokeStyle=o.tickColor,i.beginPath(),i.moveTo(l,r),i.lineTo(l,r+o.tickLength),i.stroke(),i.fillText(this.formatXTick(a),l,r+o.tickLength+3))}),n&&(i.fillStyle=o.titleColor,i.font=`${o.titleSize}px ${o.fontFamily}`,i.textAlign="center",i.textBaseline="bottom",i.fillText(n,e.x+e.width/2,e.y+e.height+45))}drawYAxis(e,t,n){const{ctx:i}=this,o=this.theme.yAxis,s=t.ticks(6),r=e.x;i.strokeStyle=o.lineColor,i.lineWidth=o.lineWidth,i.beginPath(),i.moveTo(r,e.y),i.lineTo(r,e.y+e.height),i.stroke(),i.fillStyle=o.labelColor,i.font=`${o.labelSize}px ${o.fontFamily}`,i.textAlign="right",i.textBaseline="middle",s.forEach(a=>{const l=t.transform(a);l>=e.y&&l<=e.y+e.height&&(i.strokeStyle=o.tickColor,i.beginPath(),i.moveTo(r,l),i.lineTo(r-o.tickLength,l),i.stroke(),i.fillText(this.formatYTick(a),r-o.tickLength-3,l))}),n&&(i.save(),i.fillStyle=o.titleColor,i.font=`${o.titleSize}px ${o.fontFamily}`,i.textAlign="center",i.textBaseline="top",i.translate(15,e.y+e.height/2),i.rotate(-Math.PI/2),i.fillText(n,0,0),i.restore())}drawPlotBorder(e){const{ctx:t}=this;t.strokeStyle=this.theme.plotBorderColor,t.lineWidth=1,t.strokeRect(e.x,e.y,e.width,e.height)}drawLegend(e,t){if(t.length===0)return;const{ctx:n}=this,i=this.theme.legend;n.font=`${i.fontSize}px ${i.fontFamily}`;let o=0;const s=t.map(y=>{const m=y.getId(),g=n.measureText(m).width;return o=Math.max(o,g),{id:y.getId(),color:y.getStyle().color??"#ff0055",label:m}}),r=i.swatchSize+8+o+i.padding*2,a=s.length*(i.swatchSize+i.itemGap)-i.itemGap+i.padding*2;let l,h;switch(i.position){case"top-left":l=e.x+10,h=e.y+10;break;case"bottom-left":l=e.x+10,h=e.y+10;break;case"bottom-right":l=e.x+e.width-r-10,h=e.y+e.height-a-10;break;case"top-right":default:l=e.x+e.width-r-10,h=e.y+10;break}n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=1,n.beginPath();const f=i.borderRadius;n.moveTo(l+f,h),n.lineTo(l+r-f,h),n.arcTo(l+r,h,l+r,h+f,f),n.lineTo(l+r,h+a-f),n.arcTo(l+r,h+a,l+r-f,h+a,f),n.lineTo(l+f,h+a),n.arcTo(l,h+a,l,h+a-f,f),n.lineTo(l,h+f),n.arcTo(l,h,l+f,h,f),n.closePath(),n.fill(),n.stroke(),n.textAlign="left",n.textBaseline="middle",s.forEach((y,m)=>{const g=h+i.padding+m*(i.swatchSize+i.itemGap);n.fillStyle=y.color,n.fillRect(l+i.padding,g,i.swatchSize,i.swatchSize),n.fillStyle=i.textColor,n.fillText(y.label,l+i.padding+i.swatchSize+8,g+i.swatchSize/2)})}drawCursor(e,t){if(!t.enabled)return;const{ctx:n}=this,i=this.theme.cursor;t.x<e.x||t.x>e.x+e.width||t.y<e.y||t.y>e.y+e.height||(n.save(),n.beginPath(),n.rect(e.x,e.y,e.width,e.height),n.clip(),n.strokeStyle=i.lineColor,n.lineWidth=i.lineWidth,n.setLineDash(i.lineDash),t.crosshair?(n.beginPath(),n.moveTo(t.x,e.y),n.lineTo(t.x,e.y+e.height),n.stroke(),n.beginPath(),n.moveTo(e.x,t.y),n.lineTo(e.x+e.width,t.y),n.stroke()):(n.beginPath(),n.moveTo(t.x,e.y),n.lineTo(t.x,e.y+e.height),n.stroke()),n.restore(),t.tooltipText&&this.drawTooltip(t.x,t.y,t.tooltipText,e))}drawTooltip(e,t,n,i){const{ctx:o}=this,s=this.theme.cursor,r=n.split(`
42
+ `),a=s.tooltipSize+5,l=8;o.font=`${s.tooltipSize}px ${this.theme.xAxis.fontFamily}`;let h=0;r.forEach(p=>{h=Math.max(h,o.measureText(p).width)});const f=h+l*2,y=r.length*a+l*2-5;let m=e+15,g=t-y-10;m+f>i.x+i.width&&(m=e-f-15),g<i.y&&(g=t+15),o.fillStyle=s.tooltipBackground,o.strokeStyle=s.tooltipBorder,o.lineWidth=1,o.beginPath();const x=4;o.moveTo(m+x,g),o.lineTo(m+f-x,g),o.arcTo(m+f,g,m+f,g+x,x),o.lineTo(m+f,g+y-x),o.arcTo(m+f,g+y,m+f-x,g+y,x),o.lineTo(m+x,g+y),o.arcTo(m,g+y,m,g+y-x,x),o.lineTo(m,g+x),o.arcTo(m,g,m+x,g,x),o.closePath(),o.fill(),o.stroke(),o.fillStyle=s.tooltipColor,o.textAlign="left",o.textBaseline="top",r.forEach((p,M)=>{o.fillText(p,m+l,g+l+M*a)})}drawSelectionRect(e){const{ctx:t}=this,n=this.theme.name.toLowerCase().includes("dark")||this.theme.name.toLowerCase().includes("midnight");t.save(),t.fillStyle=n?"rgba(0, 170, 255, 0.15)":"rgba(0, 100, 255, 0.1)",t.strokeStyle="#00aaff",t.lineWidth=1,t.setLineDash([5,5]),t.beginPath(),t.rect(e.x,e.y,e.width,e.height),t.fill(),t.stroke(),t.restore()}generateMinorTicks(e,t){if(e.length<2)return[];const n=[];for(let i=0;i<e.length-1;i++){const o=(e[i+1]-e[i])/t;for(let s=1;s<t;s++)n.push(e[i]+o*s)}return n}formatXTick(e){return Math.abs(e)<.001&&e!==0?this.toScientificUnicode(e,1):e.toFixed(3).replace(/\.?0+$/,"")}formatYTick(e){if(e===0)return"0";const t=Math.abs(e);return t<1e-4||t>=1e4?this.toScientificUnicode(e,1):e.toPrecision(3)}toScientificUnicode(e,t){const n=e.toExponential(t),[i,o]=n.split("e"),s={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹","-":"⁻","+":"⁺"},r=o.replace(/[0-9\-+]/g,a=>s[a]||a);return`${i} × 10${r}`}}class De{constructor(e,t,n,i){u(this,"container");u(this,"callbacks");u(this,"getPlotArea");u(this,"getBounds");u(this,"isDragging",!1);u(this,"isBoxSelecting",!1);u(this,"selectionStart",{x:0,y:0});u(this,"lastMousePos",{x:0,y:0});u(this,"isPanMode",!0);u(this,"boundWheel");u(this,"boundMouseDown");u(this,"boundMouseMove");u(this,"boundMouseUp");u(this,"boundMouseLeave");u(this,"boundTouchStart");u(this,"boundTouchMove");u(this,"boundTouchEnd");this.container=e,this.callbacks=t,this.getPlotArea=n,this.getBounds=i,this.boundWheel=this.handleWheel.bind(this),this.boundMouseDown=this.handleMouseDown.bind(this),this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.boundMouseLeave=this.handleMouseLeave.bind(this),this.boundTouchStart=this.handleTouchStart.bind(this),this.boundTouchMove=this.handleTouchMove.bind(this),this.boundTouchEnd=this.handleTouchEnd.bind(this),this.attachListeners()}attachListeners(){this.container.addEventListener("wheel",this.boundWheel,{passive:!1}),this.container.addEventListener("mousedown",this.boundMouseDown),this.container.addEventListener("mousemove",this.boundMouseMove),this.container.addEventListener("mouseup",this.boundMouseUp),this.container.addEventListener("mouseleave",this.boundMouseLeave),this.container.addEventListener("touchstart",this.boundTouchStart),this.container.addEventListener("touchmove",this.boundTouchMove),this.container.addEventListener("touchend",this.boundTouchEnd)}detachListeners(){this.container.removeEventListener("wheel",this.boundWheel),this.container.removeEventListener("mousedown",this.boundMouseDown),this.container.removeEventListener("mousemove",this.boundMouseMove),this.container.removeEventListener("mouseup",this.boundMouseUp),this.container.removeEventListener("mouseleave",this.boundMouseLeave),this.container.removeEventListener("touchstart",this.boundTouchStart),this.container.removeEventListener("touchmove",this.boundTouchMove),this.container.removeEventListener("touchend",this.boundTouchEnd)}setPanMode(e){this.isPanMode=e}handleWheel(e){const t=this.getPlotArea();if(t.width<=1||t.height<=1)return;e.preventDefault();const n=this.container.getBoundingClientRect(),i=e.clientX-n.left,o=e.clientY-n.top,s=this.getBounds();let r=!1,a=!1;if(i<t.x&&o>=t.y&&o<=t.y+t.height)a=!0;else if(o>t.y+t.height&&i>=t.x&&i<=t.x+t.width)r=!0;else if(i>=t.x&&i<=t.x+t.width&&o>=t.y&&o<=t.y+t.height)r=!0,a=!0;else return;const l=e.deltaY>0?1.1:.9,h=(i-t.x)/t.width,f=1-(o-t.y)/t.height,y=s.xMin+h*(s.xMax-s.xMin),m=s.yMin+f*(s.yMax-s.yMin),g=1e-12,x=1e15;let p=r?y-(y-s.xMin)*l:s.xMin,M=r?y+(s.xMax-y)*l:s.xMax,C=a?m-(m-s.yMin)*l:s.yMin,R=a?m+(s.yMax-m)*l:s.yMax;const A=M-p,_=R-C;(A<g||A>x)&&(p=s.xMin,M=s.xMax),(_<g||_>x)&&(C=s.yMin,R=s.yMax);const S={xMin:p,xMax:M,yMin:C,yMax:R};this.callbacks.onZoom(S)}handleMouseDown(e){const t=this.getPlotArea();if(t.width<=1||t.height<=1)return;const n=this.container.getBoundingClientRect(),i=e.clientX-n.left,o=e.clientY-n.top;i>=t.x&&i<=t.x+t.width&&o>=t.y&&o<=t.y+t.height&&(this.isPanMode?(this.isDragging=!0,this.lastMousePos={x:e.clientX,y:e.clientY},this.container.style.cursor="grabbing"):(this.isBoxSelecting=!0,this.selectionStart={x:i,y:o},this.container.style.cursor="crosshair"))}handleMouseMove(e){const t=this.container.getBoundingClientRect(),n=e.clientX-t.left,i=e.clientY-t.top;if(this.callbacks.onCursorMove(n,i),this.isDragging){const o=e.clientX-this.lastMousePos.x,s=e.clientY-this.lastMousePos.y;this.callbacks.onPan(o,s),this.lastMousePos={x:e.clientX,y:e.clientY}}else if(this.isBoxSelecting){const o=Math.min(this.selectionStart.x,n),s=Math.min(this.selectionStart.y,i),r=Math.abs(n-this.selectionStart.x),a=Math.abs(i-this.selectionStart.y);this.callbacks.onBoxZoom({x:o,y:s,width:r,height:a})}}handleMouseUp(){this.isBoxSelecting&&this.callbacks.onBoxZoom(null),this.isDragging=!1,this.isBoxSelecting=!1,this.container.style.cursor=""}handleMouseLeave(){this.isDragging=!1,this.container.style.cursor="",this.callbacks.onCursorLeave()}handleTouchStart(e){if(e.touches.length===1){const t=e.touches[0];this.isDragging=!0,this.lastMousePos={x:t.clientX,y:t.clientY}}}handleTouchMove(e){if(!this.isDragging||e.touches.length!==1)return;e.preventDefault();const t=e.touches[0],n=t.clientX-this.lastMousePos.x,i=t.clientY-this.lastMousePos.y;this.callbacks.onPan(n,i),this.lastMousePos={x:t.clientX,y:t.clientY}}handleTouchEnd(){this.isDragging=!1}destroy(){this.detachListeners()}}const L={PAN:'<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M18 11V6a2 2 0 0 0-2-2v0a2 2 0 0 0-2 2v0"></path><path d="M14 10V4a2 2 0 0 0-2-2v0a2 2 0 0 0-2 2v0"></path><path d="M10 10.5V6a2 2 0 0 0-2-2v0a2 2 0 0 0-2 2v0"></path><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"></path></svg>',RESET:'<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg>',LINE:'<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M3 3v18h18"></path><path d="M18.7 8l-5.1 5.2-2.8-2.7L7 14.3"></path></svg>',SCATTER:'<svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><circle cx="7" cy="14" r="2"></circle><circle cx="11" cy="10" r="2"></circle><circle cx="15" cy="13" r="2"></circle><circle cx="19" cy="8" r="2"></circle><path d="M3 3v18h18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>',BOTH:'<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M3 3v18h18"></path><path d="M18.7 8l-5.1 5.2-2.8-2.7L7 14.3"></path><circle cx="7" cy="14.3" r="1" fill="currentColor"></circle><circle cx="10.8" cy="10.5" r="1" fill="currentColor"></circle><circle cx="13.6" cy="13.2" r="1" fill="currentColor"></circle><circle cx="18.7" cy="8" r="1" fill="currentColor"></circle></svg>',SMOOTH:'<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12c.5 0 .9-.3 1.2-.7l1.6-2.6c.3-.4.7-.7 1.2-.7h2c.5 0 .9.3 1.2.7l1.6 2.6c.3.4.7.7 1.2.7h2c.5 0 .9-.3 1.2-.7l1.6-2.6c.3-.4.7-.7 1.2-.7h2"></path></svg>',AUTOSCALE:'<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" y1="3" x2="14" y2="10"></line><line x1="3" y1="21" x2="10" y2="14"></line></svg>',EXPORT:'<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>'};class Fe{constructor(e,t,n){u(this,"container");u(this,"toolbar");u(this,"callbacks");u(this,"theme");u(this,"isSmoothing",!1);u(this,"isPanMode",!0);u(this,"currentType","line");this.callbacks=n,this.theme=t,this.container=document.createElement("div"),this.container.style.cssText=`
43
+ position: absolute;
44
+ top: 8px;
45
+ right: 8px;
46
+ z-index: 100;
47
+ pointer-events: auto;
48
+ display: flex;
49
+ flex-direction: column;
50
+ align-items: flex-end;
51
+ gap: 8px;
52
+ `,this.toolbar=document.createElement("div"),this.toolbar.className="scichart-modebar",this.updateToolbarStyle(),this.createButtons(),this.container.appendChild(this.toolbar),e.appendChild(this.container)}isDarkTheme(){const e=this.theme.name.toLowerCase();return e.includes("dark")||e.includes("midnight")||e.includes("electro")}updateToolbarStyle(){const e=this.isDarkTheme(),t=e?"rgba(15, 23, 42, 0.85)":"rgba(255, 255, 255, 0.95)",n=e?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)",i=e?"0 4px 12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 4px 12px rgba(0, 0, 0, 0.15)";this.toolbar.style.cssText=`
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 4px;
56
+ padding: 4px;
57
+ background: ${t};
58
+ backdrop-filter: blur(12px) saturate(180%);
59
+ -webkit-backdrop-filter: blur(12px) saturate(180%);
60
+ border: 1px solid ${n};
61
+ border-radius: 8px;
62
+ box-shadow: ${i};
63
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
64
+ `}createButtons(){this.createButton(L.PAN,"Pan Mode",()=>{this.isPanMode=!this.isPanMode,this.updateButtonStates(),this.callbacks.onTogglePan(this.isPanMode)},"pan"),this.createButton(L.RESET,"Reset Zoom",()=>this.callbacks.onResetZoom(),"reset"),this.createButton(L.AUTOSCALE,"Auto Scale",()=>this.callbacks.onAutoScale(),"autoscale");const e=document.createElement("div"),t=this.isDarkTheme();e.style.cssText=`width: 1px; height: 20px; background: ${t?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.2)"}; margin: 0 6px;`,this.toolbar.appendChild(e),this.createButton(L.LINE,"Toggle Line/Scatter/Both",()=>{const i=["line","scatter","line+scatter"],o=(i.indexOf(this.currentType)+1)%i.length;this.currentType=i[o],this.callbacks.onSetType(this.currentType),this.updateButtonStates()},"type"),this.createButton(L.SMOOTH,"Automated Smoothing",()=>{this.isSmoothing=!this.isSmoothing,this.updateButtonStates(),this.callbacks.onToggleSmoothing()},"smooth");const n=document.createElement("div");n.style.cssText=`width: 1px; height: 20px; background: ${t?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.2)"}; margin: 0 6px;`,this.toolbar.appendChild(n),this.createButton(L.EXPORT,"Export as PNG",()=>this.callbacks.onExport(),"export"),this.updateButtonStates()}enforceSVGVisibility(e){const t=e.querySelector(".scichart-control-icon");t&&(t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="100%",t.style.height="100%",t.style.pointerEvents="none");const n=e.querySelector("svg");n&&(n.setAttribute("width","14"),n.setAttribute("height","14"),n.style.display="block",n.style.overflow="visible",n.style.color="inherit",n.style.stroke="currentColor",n.getAttribute("fill")||(n.style.fill="none"))}createButton(e,t,n,i){const o=document.createElement("button");o.innerHTML=`<span class="scichart-control-icon">${e}</span>`,o.title=t,o.dataset.id=i;const s=this.isDarkTheme(),r=s?"#ffffff":"#1e293b";return o.style.cssText=`
65
+ width: 24px;
66
+ height: 24px;
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ border: none;
71
+ background: transparent;
72
+ color: ${r};
73
+ cursor: pointer;
74
+ border-radius: 6px;
75
+ transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
76
+ opacity: 0.9;
77
+ `,o.onmouseenter=()=>{o.style.opacity="1",o.style.background=s?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.1)",o.style.transform="translateY(-1px)",o.style.boxShadow=s?"0 2px 4px rgba(0,0,0,0.4)":"0 2px 4px rgba(0,0,0,0.1)"},o.onmouseleave=()=>{o.style.transform="none",o.style.boxShadow="none",this.updateButtonStates()},o.onclick=n,this.enforceSVGVisibility(o),this.toolbar.appendChild(o),o}updateButtonStates(){const e=this.toolbar.querySelectorAll("button"),t=this.isDarkTheme(),n="#38bdf8",i="#fb7185",o=t?"#f1f5f9":"#334155";e.forEach(s=>{const r=s.dataset.id,a=s.matches(":hover");r==="pan"?(s.style.color=this.isPanMode?n:o,s.style.opacity=a||this.isPanMode?"1":"0.8",this.isPanMode&&(s.style.background=t?"rgba(56, 189, 248, 0.15)":"rgba(56, 189, 248, 0.1)")):r==="smooth"?(s.style.color=this.isSmoothing?i:o,s.style.opacity=a||this.isSmoothing?"1":"0.8",this.isSmoothing&&(s.style.background=t?"rgba(251, 113, 133, 0.15)":"rgba(251, 113, 133, 0.1)")):r==="type"?(s.innerHTML=this.currentType==="line"?L.LINE:this.currentType==="scatter"?L.SCATTER:L.BOTH,this.enforceSVGVisibility(s),s.style.color=o,s.style.opacity=a?"1":"0.8"):(r==="reset"||r==="autoscale"||r==="export")&&(s.style.color=o,s.style.opacity=a?"1":"0.8"),!a&&!(r==="pan"&&this.isPanMode||r==="smooth"&&this.isSmoothing)&&(s.style.background="transparent")})}updateTheme(e){this.theme=e,this.updateToolbarStyle(),this.updateButtonStates()}destroy(){this.container.remove()}}class Ie{constructor(e,t,n,i){u(this,"container");u(this,"header");u(this,"content");u(this,"theme");u(this,"series",[]);u(this,"callbacks");u(this,"isDragging",!1);u(this,"startX",0);u(this,"startY",0);u(this,"initialX",0);u(this,"initialY",0);this.theme=t,this.callbacks=i,this.container=document.createElement("div"),this.container.className="scichart-legend";const o=n.x??e.clientWidth-150,s=n.y??55;this.container.style.cssText=`
78
+ position: absolute;
79
+ left: ${o}px;
80
+ top: ${s}px;
81
+ z-index: 90;
82
+ pointer-events: auto;
83
+ min-width: 120px;
84
+ border-radius: ${t.legend.borderRadius}px;
85
+ overflow: hidden;
86
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
87
+ user-select: none;
88
+ transition: box-shadow 0.2s ease;
89
+ `,this.updateStyle(),this.header=document.createElement("div"),this.header.style.cssText=`
90
+ height: 8px;
91
+ cursor: move;
92
+ background: rgba(255,255,255,0.05);
93
+ border-bottom: 1px solid rgba(255,255,255,0.05);
94
+ `,this.content=document.createElement("div"),this.content.style.padding=`${t.legend.padding}px`,this.container.appendChild(this.header),this.container.appendChild(this.content),e.appendChild(this.container),this.initDragging()}updateStyle(){const e=this.theme.name.toLowerCase().includes("dark")||this.theme.name.toLowerCase().includes("midnight")||this.theme.name.toLowerCase().includes("electro"),t=e?"rgba(15, 23, 42, 0.85)":"rgba(255, 255, 255, 0.95)",n=e?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.1)",i=e?"0 4px 12px rgba(0, 0, 0, 0.6)":"0 4px 12px rgba(0, 0, 0, 0.15)";this.container.style.background=t,this.container.style.backdropFilter="blur(12px) saturate(180%)",this.container.style.webkitBackdropFilter="blur(12px) saturate(180%)",this.container.style.border=`1px solid ${n}`,this.container.style.boxShadow=i}initDragging(){let e=null;const t=s=>{s.button===0&&(s.stopPropagation(),s.preventDefault(),this.isDragging=!0,this.startX=s.clientX,this.startY=s.clientY,this.initialX=this.container.offsetLeft,this.initialY=this.container.offsetTop,this.container.style.transition="none",this.container.style.willChange="transform",this.container.style.boxShadow="0 8px 24px rgba(0,0,0,0.3)",this.container.style.cursor="grabbing",document.addEventListener("mousemove",i),document.addEventListener("mouseup",o))},n=(s,r)=>{const a=s-this.startX,l=r-this.startY;let h=this.initialX+a,f=this.initialY+l;const y=this.container.parentElement;y&&(h=Math.max(0,Math.min(h,y.clientWidth-this.container.clientWidth)),f=Math.max(0,Math.min(f,y.clientHeight-this.container.clientHeight)));const m=h-this.initialX,g=f-this.initialY;this.container.style.transform=`translate3d(${m}px, ${g}px, 0)`},i=s=>{this.isDragging&&(e&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>n(s.clientX,s.clientY)))},o=()=>{var s;if(this.isDragging){this.isDragging=!1,e&&cancelAnimationFrame(e);const r=this.container.getBoundingClientRect(),a=(s=this.container.parentElement)==null?void 0:s.getBoundingClientRect();if(a){const l=r.left-a.left,h=r.top-a.top;this.container.style.transform="none",this.container.style.left=`${l}px`,this.container.style.top=`${h}px`,this.callbacks.onMove(l,h)}this.container.style.willChange="auto",this.container.style.transition="box-shadow 0.2s ease",this.container.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)",this.container.style.cursor="auto"}document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o)};this.container.addEventListener("mousedown",t),this.container.addEventListener("wheel",s=>s.stopPropagation()),this.container.addEventListener("click",s=>s.stopPropagation()),this.container.addEventListener("dblclick",s=>s.stopPropagation())}update(e){this.series=e,this.render()}render(){this.content.innerHTML="";const e=this.theme.legend;this.series.forEach(t=>{const n=document.createElement("div");n.style.cssText=`
95
+ display: flex;
96
+ align-items: center;
97
+ gap: 8px;
98
+ margin-bottom: ${e.itemGap}px;
99
+ font-family: ${e.fontFamily};
100
+ font-size: ${e.fontSize}px;
101
+ color: ${e.textColor};
102
+ `;const i=document.createElement("div");i.style.cssText=`
103
+ width: ${e.swatchSize}px;
104
+ height: ${e.swatchSize}px;
105
+ background: ${t.getStyle().color||"#ff0055"};
106
+ border-radius: 2px;
107
+ `;const o=document.createElement("span");o.textContent=t.getId(),n.appendChild(i),n.appendChild(o),this.content.appendChild(n)})}draw(e,t){if(this.series.length===0)return;const n=this.theme.legend,i=n.padding*t,o=n.itemGap*t,s=n.swatchSize*t,r=8*t,a=this.container.offsetLeft*t,l=this.container.offsetTop*t,h=this.container.clientWidth*t,f=this.container.clientHeight*t;e.save();const y=this.theme.name.toLowerCase().includes("dark")||this.theme.name.toLowerCase().includes("midnight");e.fillStyle=y?n.backgroundColor:"rgba(255, 255, 255, 0.85)",e.strokeStyle=n.borderColor,e.lineWidth=1*t;const m=n.borderRadius*t;e.beginPath(),e.moveTo(a+m,l),e.lineTo(a+h-m,l),e.arcTo(a+h,l,a+h,l+m,m),e.lineTo(a+h,l+f-m),e.arcTo(a+h,l+f,a+h-m,l+f,m),e.lineTo(a+m,l+f),e.arcTo(a,l+f,a,l+f-m,m),e.lineTo(a,l+m),e.arcTo(a,l,a+m,l,m),e.closePath(),e.fill(),e.stroke(),e.textAlign="left",e.textBaseline="middle",e.font=`${n.fontSize*t}px ${n.fontFamily}`,this.series.forEach((g,x)=>{const p=l+r+i+x*(s+o)+s/2;e.fillStyle=g.getStyle().color||"#ff0055",e.fillRect(a+i,p-s/2,s,s),e.fillStyle=n.textColor,e.fillText(g.getId(),a+i+s+8*t,p)}),e.restore()}updateTheme(e){this.theme=e,this.updateStyle(),this.render()}destroy(){this.container.remove()}}const P={top:20,right:30,bottom:55,left:75};class ze{constructor(e){u(this,"container");u(this,"webglCanvas");u(this,"overlayCanvas");u(this,"overlayCtx");u(this,"series",new Map);u(this,"events",new I);u(this,"viewBounds",{xMin:-.5,xMax:.5,yMin:-1e-5,yMax:1e-5});u(this,"xAxisOptions");u(this,"yAxisOptions");u(this,"dpr");u(this,"backgroundColor");u(this,"renderer");u(this,"overlay");u(this,"interaction");u(this,"xScale");u(this,"yScale");u(this,"theme");u(this,"cursorOptions",null);u(this,"cursorPosition",null);u(this,"showLegend");u(this,"legend",null);u(this,"showControls");u(this,"controls",null);u(this,"animationFrameId",null);u(this,"needsRender",!1);u(this,"isDestroyed",!1);u(this,"selectionRect",null);const t=e.container;if(!t)throw new Error("[SciChart] Container element is required");this.container=t,this.dpr=e.devicePixelRatio??window.devicePixelRatio,this.theme=typeof e.theme=="string"?Q(e.theme):e.theme??ee;const n=V(e.background??this.theme.backgroundColor);for(this.backgroundColor=[n[0],n[1],n[2],n[3]],this.showLegend=e.showLegend??this.theme.legend.visible,this.showControls=e.showControls??!1,this.xAxisOptions={scale:"linear",auto:!0,...e.xAxis},this.yAxisOptions={scale:"linear",auto:!0,...e.yAxis},this.xScale=this.xAxisOptions.scale==="log"?new $:new H,this.yScale=this.yAxisOptions.scale==="log"?new $:new H,this.container.style.position="relative",this.container.style.overflow="hidden",this.container.style.backgroundColor=e.background??this.theme.backgroundColor,this.webglCanvas=this.createCanvas("webgl"),this.overlayCanvas=this.createCanvas("overlay");this.container.firstChild;)this.container.removeChild(this.container.firstChild);this.container.appendChild(this.webglCanvas),this.container.appendChild(this.overlayCanvas);const i=this.overlayCanvas.getContext("2d");if(!i)throw new Error("Failed to get 2D context");this.overlayCtx=i,this.renderer=new W(this.webglCanvas),this.overlay=new fe(this.overlayCtx,this.theme),this.interaction=new De(this.container,{onZoom:o=>this.zoom({x:[o.xMin,o.xMax],y:[o.yMin,o.yMax]}),onPan:(o,s)=>this.pan(o,s),onBoxZoom:o=>this.handleBoxZoom(o),onCursorMove:(o,s)=>{this.cursorPosition={x:o,y:s},this.requestRender()},onCursorLeave:()=>{this.cursorPosition=null,this.requestRender()}},()=>this.getPlotArea(),()=>this.viewBounds),new ResizeObserver(()=>!this.isDestroyed&&this.resize()).observe(this.container),this.showControls&&(this.controls=new Fe(this.container,this.theme,{onResetZoom:()=>this.resetZoom(),onSetType:o=>{this.series.forEach(s=>s.setType(o)),this.requestRender()},onToggleSmoothing:()=>{this.series.forEach(o=>{const s=o.getStyle();o.setStyle({smoothing:(s.smoothing||0)===0?.5:0})}),this.requestRender()},onTogglePan:o=>{this.interaction.setPanMode(o)},onExport:()=>{const o=this.exportImage(),s=document.createElement("a");s.download=`scichart-export-${Date.now()}.png`,s.href=o,s.click()},onAutoScale:()=>{this.autoScale(),this.requestRender(),this.events.emit("autoScale",void 0)}})),this.showLegend&&(this.legend=new Ie(this.container,this.theme,e.legendPosition||{},{onMove:(o,s)=>this.events.emit("legendMove",{x:o,y:s})}),this.legend.update(this.getAllSeries())),this.resize(),this.startRenderLoop(),setTimeout(()=>!this.isDestroyed&&this.resize(),100),console.log("[SciChart] Initialized",{dpr:this.dpr,theme:this.theme.name})}setTheme(e){if(this.isDestroyed)return;this.theme=typeof e=="string"?Q(e):e??ee;const t=V(this.theme.backgroundColor);this.backgroundColor=[t[0],t[1],t[2],t[3]],this.container.style.backgroundColor=this.theme.backgroundColor,this.overlay.setTheme(this.theme),this.controls&&this.controls.updateTheme(this.theme),this.legend&&this.legend.updateTheme(this.theme),this.resize(),this.requestRender(),setTimeout(()=>{this.isDestroyed||(this.resize(),this.render())},50)}createCanvas(e){const t=document.createElement("canvas");return t.style.cssText=e==="webgl"?`position:absolute;top:${P.top}px;left:${P.left}px;width:calc(100% - ${P.left+P.right}px);height:calc(100% - ${P.top+P.bottom}px)`:"position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none",t}getPlotArea(){const e=this.container.getBoundingClientRect(),t=Math.max(10,e.width-P.left-P.right),n=Math.max(10,e.height-P.top-P.bottom);return{x:P.left,y:P.top,width:t,height:n}}exportImage(e="png"){const t=document.createElement("canvas");t.width=this.overlayCanvas.width,t.height=this.overlayCanvas.height;const n=t.getContext("2d");if(!n)return"";const i=this.backgroundColor;n.fillStyle=`rgba(${Math.round(i[0]*255)}, ${Math.round(i[1]*255)}, ${Math.round(i[2]*255)}, ${i[3]})`,n.fillRect(0,0,t.width,t.height);const o=P.left*this.dpr,s=P.top*this.dpr;return n.drawImage(this.webglCanvas,o,s),n.drawImage(this.overlayCanvas,0,0),this.legend&&this.showLegend&&this.legend.draw(n,this.dpr),t.toDataURL(`image/${e}`)}addSeries(e){this.series.has(e.id)&&this.removeSeries(e.id);const t=new le(e);this.series.set(e.id,t),this.updateSeriesBuffer(t),(this.xAxisOptions.auto||this.yAxisOptions.auto)&&this.autoScale(),this.legend&&this.legend.update(this.getAllSeries()),this.requestRender()}removeSeries(e){const t=this.series.get(e);t&&(this.renderer.deleteBuffer(e),t.destroy(),this.series.delete(e),this.legend&&this.legend.update(this.getAllSeries()),this.requestRender())}updateSeries(e,t){const n=this.series.get(e);n&&(n.updateData(t),this.updateSeriesBuffer(n),(this.xAxisOptions.auto||this.yAxisOptions.auto)&&this.autoScale(),this.requestRender())}updateSeriesBuffer(e){const t=e.getData();!t||t.x.length===0||this.renderer.createBuffer(e.getId(),ce(t.x,t.y))}getSeries(e){return this.series.get(e)}getAllSeries(){return Array.from(this.series.values())}zoom(e){e.x&&(this.viewBounds.xMin=e.x[0],this.viewBounds.xMax=e.x[1]),e.y&&(this.viewBounds.yMin=e.y[0],this.viewBounds.yMax=e.y[1]),this.events.emit("zoom",{x:[this.viewBounds.xMin,this.viewBounds.xMax],y:[this.viewBounds.yMin,this.viewBounds.yMax]}),this.requestRender()}pan(e,t){const n=this.getPlotArea(),i=e/n.width*(this.viewBounds.xMax-this.viewBounds.xMin),o=t/n.height*(this.viewBounds.yMax-this.viewBounds.yMin);this.viewBounds.xMin-=i,this.viewBounds.xMax-=i,this.viewBounds.yMin+=o,this.viewBounds.yMax+=o,this.events.emit("pan",{deltaX:i,deltaY:o}),this.requestRender()}resetZoom(){this.autoScale(),this.events.emit("zoom",{x:[this.viewBounds.xMin,this.viewBounds.xMax],y:[this.viewBounds.yMin,this.viewBounds.yMax]}),this.requestRender()}getViewBounds(){return{...this.viewBounds}}autoScale(){if(this.series.size===0)return;let e=1/0,t=-1/0,n=1/0,i=-1/0,o=!1;if(this.series.forEach(m=>{const g=m.getBounds();g&&isFinite(g.xMin)&&isFinite(g.xMax)&&isFinite(g.yMin)&&isFinite(g.yMax)&&(e=Math.min(e,g.xMin),t=Math.max(t,g.xMax),n=Math.min(n,g.yMin),i=Math.max(i,g.yMax),o=!0)}),!o){console.warn("[SciChart] No valid data bounds found for autoScale");return}let s=t-e,r=i-n;(s<=0||!isFinite(s))&&(s=Math.abs(e)*.1||1),(r<=0||!isFinite(r))&&(r=Math.abs(n)*.1||1);const a=1e15,l=-1e15;e=Math.max(l,Math.min(a,e)),t=Math.max(l,Math.min(a,t)),n=Math.max(l,Math.min(a,n)),i=Math.max(l,Math.min(a,i));const h=Math.min(s*.05,1e10),f=Math.min(r*.05,1e10),y={xMin:Math.max(l,e-h),xMax:Math.min(a,t+h),yMin:Math.max(l,n-f),yMax:Math.min(a,i+f)};this.xAxisOptions.auto&&(this.viewBounds.xMin=y.xMin,this.viewBounds.xMax=y.xMax),this.yAxisOptions.auto&&(this.viewBounds.yMin=y.yMin,this.viewBounds.yMax=y.yMax),this.requestRender()}enableCursor(e){this.cursorOptions={enabled:!0,...e}}disableCursor(){this.cursorOptions=null,this.cursorPosition=null}resize(){const e=this.container.getBoundingClientRect();e.width===0||e.height===0||(this.overlayCanvas.width=e.width*this.dpr,this.overlayCanvas.height=e.height*this.dpr,this.overlayCtx.setTransform(1,0,0,1,0,0),this.overlayCtx.scale(this.dpr,this.dpr),this.renderer.resize(),this.events.emit("resize",{width:e.width,height:e.height}),this.requestRender())}requestRender(){this.needsRender=!0}render(){var s;if(this.isDestroyed)return;const e=performance.now();this.xScale.setDomain(this.viewBounds.xMin,this.viewBounds.xMax),this.yScale.setDomain(this.viewBounds.yMin,this.viewBounds.yMax);const t=[],n=this.getPlotArea();if(this.webglCanvas.width===0||this.webglCanvas.height===0){console.warn("[SciChart] Canvas has zero size, skipping render");return}this.xScale.setRange(n.x,n.x+n.width),this.yScale.setRange(n.y+n.height,n.y),this.series.forEach(r=>{r.needsBufferUpdate&&(this.updateSeriesBuffer(r),r.needsBufferUpdate=!1);const a=this.renderer.getBuffer(r.getId());a&&t.push({id:r.getId(),buffer:a,count:r.getPointCount(),style:r.getStyle(),visible:r.isVisible(),type:r.getType()})}),t.length===0&&this.series.size>0&&console.warn("[SciChart] No series data to render despite having series",{count:this.series.size,rendererAvailable:this.renderer.available}),this.renderer.render(t,{bounds:this.viewBounds,backgroundColor:this.backgroundColor});const i=this.container.getBoundingClientRect();if(i.width===0||i.height===0){console.warn("[SciChart] Container has zero size in render, skipping overlay");return}if(this.overlay.clear(i.width,i.height),this.overlay.drawGrid(n,this.xScale,this.yScale),this.overlay.drawXAxis(n,this.xScale,this.xAxisOptions.label),this.overlay.drawYAxis(n,this.yScale,this.yAxisOptions.label),this.overlay.drawPlotBorder(n),this.selectionRect&&this.overlay.drawSelectionRect(this.selectionRect),(s=this.cursorOptions)!=null&&s.enabled&&this.cursorPosition){const r={enabled:!0,x:this.cursorPosition.x,y:this.cursorPosition.y,crosshair:this.cursorOptions.crosshair??!1,tooltipText:this.cursorOptions.formatter?this.cursorOptions.formatter(this.pixelToDataX(this.cursorPosition.x),this.pixelToDataY(this.cursorPosition.y),""):`X: ${this.pixelToDataX(this.cursorPosition.x).toFixed(3)}
108
+ Y: ${this.pixelToDataY(this.cursorPosition.y).toExponential(2)}`};this.overlay.drawCursor(n,r)}const o=performance.now()-e;this.events.emit("render",{fps:o>0?1e3/o:999,frameTime:o})}pixelToDataX(e){const t=this.getPlotArea();return this.viewBounds.xMin+(e-t.x)/t.width*(this.viewBounds.xMax-this.viewBounds.xMin)}pixelToDataY(e){const t=this.getPlotArea();return this.viewBounds.yMin+(1-(e-t.y)/t.height)*(this.viewBounds.yMax-this.viewBounds.yMin)}startRenderLoop(){const e=()=>{this.isDestroyed||(this.needsRender&&(this.render(),this.needsRender=!1),this.animationFrameId=requestAnimationFrame(e))};this.animationFrameId=requestAnimationFrame(e)}on(e,t){this.events.on(e,t)}off(e,t){this.events.off(e,t)}destroy(){for(this.isDestroyed=!0,this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.interaction.destroy(),this.series.forEach(e=>{this.renderer.deleteBuffer(e.getId()),e.destroy()}),this.series.clear(),this.renderer.destroy(),this.controls&&this.controls.destroy(),this.legend&&this.legend.destroy();this.container.firstChild;)this.container.removeChild(this.container.firstChild);console.log("[SciChart] Destroyed")}handleBoxZoom(e){if(e===null){if(this.selectionRect&&this.selectionRect.width>5&&this.selectionRect.height>5){const t=this.getPlotArea(),n=this.viewBounds,i=(this.selectionRect.x-t.x)/t.width,o=(this.selectionRect.x+this.selectionRect.width-t.x)/t.width,s=1-(this.selectionRect.y-t.y)/t.height,r=1-(this.selectionRect.y+this.selectionRect.height-t.y)/t.height,a=n.xMin+i*(n.xMax-n.xMin),l=n.xMin+o*(n.xMax-n.xMin),h=n.yMin+r*(n.yMax-n.yMin),f=n.yMin+s*(n.yMax-n.yMin);this.zoom({x:[a,l],y:[h,f]})}this.selectionRect=null}else this.selectionRect=e;this.requestRender()}}function ge(c){return new ze(c)}function Oe(c){return new W(c)}function Ye(c,e,t){const n=c.length;if(t>=n||t<=2)return{x:new Float32Array(c),y:new Float32Array(e),indices:new Uint32Array(Array.from({length:n},(h,f)=>f))};const i=new Float32Array(t),o=new Float32Array(t),s=new Uint32Array(t);i[0]=c[0],o[0]=e[0],s[0]=0;const r=(n-2)/(t-2);let a=0,l=1;for(let h=0;h<t-2;h++){const f=Math.floor((h+1)*r)+1,y=Math.floor((h+2)*r)+1,m=Math.min(y,n-1),g=Math.min(Math.floor((h+3)*r)+1,n);let x=0,p=0,M=0;for(let S=m;S<g;S++)x+=c[S],p+=e[S],M++;M>0&&(x/=M,p/=M);let C=-1,R=f;const A=c[a],_=e[a];for(let S=f;S<y&&S<n;S++){const z=Math.abs((A-x)*(e[S]-_)-(A-c[S])*(p-_));z>C&&(C=z,R=S)}i[l]=c[R],o[l]=e[R],s[l]=R,a=R,l++}return i[t-1]=c[n-1],o[t-1]=e[n-1],s[t-1]=n-1,{x:i,y:o,indices:s}}function Ne(c,e,t){const n=c.length;if(t>=n/2)return{x:new Float32Array(c),y:new Float32Array(e),indices:new Uint32Array(Array.from({length:n},(a,l)=>l))};const i=n/t,o=[],s=[],r=[];for(let a=0;a<t;a++){const l=Math.floor(a*i),h=Math.floor((a+1)*i);let f=1/0,y=-1/0,m=l,g=l;for(let x=l;x<h&&x<n;x++)e[x]<f&&(f=e[x],m=x),e[x]>y&&(y=e[x],g=x);m<=g?(o.push(c[m],c[g]),s.push(e[m],e[g]),r.push(m,g)):(o.push(c[g],c[m]),s.push(e[g],e[m]),r.push(g,m))}return{x:new Float32Array(o),y:new Float32Array(s),indices:new Uint32Array(r)}}function Ue(c,e,t=2){const n=e*t;return Math.min(c,n)}const me=[{symbol:"p",factor:1e-12},{symbol:"n",factor:1e-9},{symbol:"µ",factor:1e-6},{symbol:"m",factor:.001},{symbol:"",factor:1},{symbol:"k",factor:1e3},{symbol:"M",factor:1e6},{symbol:"G",factor:1e9}];function ye(c){const e=Math.abs(c);if(e===0)return{symbol:"",factor:1};for(let t=me.length-1;t>=0;t--){const n=me[t],i=e/n.factor;if(i>=1&&i<1e3)return n}return{symbol:"",factor:1}}function te(c,e,t=2){const n=ye(c);return`${(c/n.factor).toFixed(t)} ${n.symbol}${e}`}function Xe(c,e=3){return Math.abs(c)<.001||Math.abs(c)>=1e6?c.toExponential(e):c.toFixed(e)}function je(c,e=2){return c.toExponential(e)}function We(c,e=.001){const t=c instanceof Array?new Float32Array(c):c;if(t.length<3)return[];const n=[];let i=0,o=1,s=Math.sign(t[1]-t[0]),r=0;for(let a=2;a<t.length;a++){const l=Math.sign(t[a]-t[a-1]);if(l!==0&&l!==s){if(r++,r>=2){const h=t[i],f=t[a];Math.abs(f-h)<e&&(n.push({number:o,startIndex:i,endIndex:a,direction:t[i+1]>t[i]?1:-1}),o++,i=a,r=0)}s=l}}return i<t.length-1&&n.push({number:o,startIndex:i,endIndex:t.length-1,direction:t[i+1]>t[i]?1:-1}),n}function Ve(c){const e=[],t=360/Math.max(c,1);for(let n=0;n<c;n++){const i=n*t%360;e.push(`hsl(${i}, 70%, 55%)`)}return e}function He(c,e,t={}){const{minProminence:n=0,type:i="both"}=t,o=[],s=c instanceof Array?new Float32Array(c):c,r=e instanceof Array?new Float32Array(e):e;for(let a=1;a<r.length-1;a++){const l=r[a-1],h=r[a],f=r[a+1];if(h>l&&h>f){const y=Math.min(h-l,h-f);y>=n&&(i==="both"||i==="max")&&o.push({index:a,x:s[a],y:h,type:"max",prominence:y})}if(h<l&&h<f){const y=Math.min(l-h,f-h);y>=n&&(i==="both"||i==="min")&&o.push({index:a,x:s[a],y:h,type:"min",prominence:y})}}return o}function $e(c){let e=0,t=-1;const n=c instanceof Array?c:Array.from(c);for(let i=0;i<n.length;i++)isFinite(n[i])||(e++,t===-1&&(t=i));return{valid:e===0,invalidCount:e,firstInvalidIndex:t}}function Ge(c){const e=c instanceof Array?c:Array.from(c),t=e.length;if(t===0)return{min:0,max:0,mean:0,stdDev:0,count:0};let n=e[0],i=e[0],o=0;for(let l=0;l<t;l++){const h=e[l];h<n&&(n=h),h>i&&(i=h),o+=h}const s=o/t;let r=0;for(let l=0;l<t;l++){const h=e[l]-s;r+=h*h}const a=Math.sqrt(r/t);return{min:n,max:i,mean:s,stdDev:a,count:t}}function Ze(c,e){const t=c instanceof Array?new Float32Array(c):c,n=new Float32Array(t.length),i=Math.floor(e/2);for(let o=0;o<t.length;o++){let s=0,r=0;for(let a=Math.max(0,o-i);a<=Math.min(t.length-1,o+i);a++)s+=t[a],r++;n[o]=s/r}return n}function qe(c,e,t){const n=c.length;if(t>=n||t<3)return{x:new Float32Array(c),y:new Float32Array(e)};const i=new Float32Array(t),o=new Float32Array(t);i[0]=c[0],o[0]=e[0];const s=(n-2)/(t-2);let r=0,a=1;for(let l=0;l<t-2;l++){const h=Math.floor((l+1)*s)+1,f=Math.floor((l+2)*s)+1,y=Math.min(Math.floor((l+3)*s)+1,n);let m=0,g=0,x=0;for(let C=f;C<y;C++)m+=c[C],g+=e[C],x++;x>0&&(m/=x,g/=x);let p=-1,M=h;for(let C=h;C<f&&C<n;C++){const R=Math.abs((c[r]-m)*(e[C]-e[r])-(c[r]-c[C])*(g-e[r]));R>p&&(p=R,M=C)}i[a]=c[M],o[a]=e[M],a++,r=M}return i[t-1]=c[n-1],o[t-1]=e[n-1],{x:i,y:o}}var ie={exports:{}},N={};/**
109
+ * @license React
110
+ * react-jsx-runtime.production.js
111
+ *
112
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
113
+ *
114
+ * This source code is licensed under the MIT license found in the
115
+ * LICENSE file in the root directory of this source tree.
116
+ */var xe;function Je(){if(xe)return N;xe=1;var c=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,o){var s=null;if(o!==void 0&&(s=""+o),i.key!==void 0&&(s=""+i.key),"key"in i){o={};for(var r in i)r!=="key"&&(o[r]=i[r])}else o=i;return i=o.ref,{$$typeof:c,type:n,key:s,ref:i!==void 0?i:null,props:o}}return N.Fragment=e,N.jsx=t,N.jsxs=t,N}var U={};/**
117
+ * @license React
118
+ * react-jsx-runtime.development.js
119
+ *
120
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
121
+ *
122
+ * This source code is licensed under the MIT license found in the
123
+ * LICENSE file in the root directory of this source tree.
124
+ */var be;function Ke(){return be||(be=1,process.env.NODE_ENV!=="production"&&function(){function c(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===ne?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case p:return"Fragment";case C:return"Profiler";case M:return"StrictMode";case S:return"Suspense";case z:return"SuspenseList";case j:return"Activity"}if(typeof d=="object")switch(typeof d.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),d.$$typeof){case x:return"Portal";case A:return d.displayName||"Context";case R:return(d._context.displayName||"Context")+".Consumer";case _:var v=d.render;return d=d.displayName,d||(d=v.displayName||v.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case B:return v=d.displayName||null,v!==null?v:c(d.type)||"Memo";case D:v=d._payload,d=d._init;try{return c(d(v))}catch{}}return null}function e(d){return""+d}function t(d){try{e(d);var v=!1}catch{v=!0}if(v){v=console;var T=v.error,E=typeof Symbol=="function"&&Symbol.toStringTag&&d[Symbol.toStringTag]||d.constructor.name||"Object";return T.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),e(d)}}function n(d){if(d===p)return"<>";if(typeof d=="object"&&d!==null&&d.$$typeof===D)return"<...>";try{var v=c(d);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function i(){var d=oe.A;return d===null?null:d.getOwner()}function o(){return Error("react-stack-top-frame")}function s(d){if(ve.call(d,"key")){var v=Object.getOwnPropertyDescriptor(d,"key").get;if(v&&v.isReactWarning)return!1}return d.key!==void 0}function r(d,v){function T(){we||(we=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",v))}T.isReactWarning=!0,Object.defineProperty(d,"key",{get:T,configurable:!0})}function a(){var d=c(this.type);return Me[d]||(Me[d]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),d=this.props.ref,d!==void 0?d:null}function l(d,v,T,E,K,re){var k=T.ref;return d={$$typeof:g,type:d,key:v,props:T,_owner:E},(k!==void 0?k:null)!==null?Object.defineProperty(d,"ref",{enumerable:!1,get:a}):Object.defineProperty(d,"ref",{enumerable:!1,value:null}),d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(d,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(d,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(d,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d}function h(d,v,T,E,K,re){var k=v.children;if(k!==void 0)if(E)if(et(k)){for(E=0;E<k.length;E++)f(k[E]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(k);if(ve.call(v,"key")){k=c(d);var Y=Object.keys(v).filter(function(tt){return tt!=="key"});E=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",Te[k+E]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
125
+ let props = %s;
126
+ <%s {...props} />
127
+ React keys must be passed directly to JSX without using spread:
128
+ let props = %s;
129
+ <%s key={someKey} {...props} />`,E,k,Y,k),Te[k+E]=!0)}if(k=null,T!==void 0&&(t(T),k=""+T),s(v)&&(t(v.key),k=""+v.key),"key"in v){T={};for(var ae in v)ae!=="key"&&(T[ae]=v[ae])}else T=v;return k&&r(T,typeof d=="function"?d.displayName||d.name||"Unknown":d),l(d,k,T,i(),K,re)}function f(d){y(d)?d._store&&(d._store.validated=1):typeof d=="object"&&d!==null&&d.$$typeof===D&&(d._payload.status==="fulfilled"?y(d._payload.value)&&d._payload.value._store&&(d._payload.value._store.validated=1):d._store&&(d._store.validated=1))}function y(d){return typeof d=="object"&&d!==null&&d.$$typeof===g}var m=w,g=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),A=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),ne=Symbol.for("react.client.reference"),oe=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=Object.prototype.hasOwnProperty,et=Array.isArray,se=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(d){return d()}};var we,Me={},Se=m.react_stack_bottom_frame.bind(m,o)(),Ce=se(n(o)),Te={};U.Fragment=p,U.jsx=function(d,v,T){var E=1e4>oe.recentlyCreatedOwnerStacks++;return h(d,v,T,!1,E?Error("react-stack-top-frame"):Se,E?se(n(d)):Ce)},U.jsxs=function(d,v,T){var E=1e4>oe.recentlyCreatedOwnerStacks++;return h(d,v,T,!0,E?Error("react-stack-top-frame"):Se,E?se(n(d)):Ce)}}()),U}process.env.NODE_ENV==="production"?ie.exports=Je():ie.exports=Ke();var X=ie.exports;function pe(c,e={}){const[t,n]=w.useState(null),[i,o]=w.useState(!1),[s,r]=w.useState(null),[a,l]=w.useState(null),h=w.useRef(e);h.current=e,w.useEffect(()=>{const p=c.current;if(p){try{const M=ge({...h.current,container:p});M.on("zoom",()=>{l(M.getViewBounds())}),n(M),o(!0),l(M.getViewBounds()),r(null),console.log("[useSciChart] Chart initialized")}catch(M){console.error("[useSciChart] Failed to initialize chart:",M),r(M instanceof Error?M:new Error(String(M))),o(!1)}return()=>{t&&(t.destroy(),n(null),o(!1))}}},[c]);const f=w.useCallback(p=>{t&&(t.addSeries(p),l(t.getViewBounds()))},[t]),y=w.useCallback((p,M)=>{t&&t.updateSeries(p,M)},[t]),m=w.useCallback(p=>{t&&t.removeSeries(p)},[t]),g=w.useCallback(p=>{t&&t.zoom(p)},[t]),x=w.useCallback(()=>{t&&(t.resetZoom(),l(t.getViewBounds()))},[t]);return{chart:t,isReady:i,error:s,bounds:a,addSeries:f,updateSeries:y,removeSeries:m,zoom:g,resetZoom:x}}const Qe=w.forwardRef(function({series:e=[],zoom:t,onZoomChange:n,cursor:i,width:o="100%",height:s=400,className:r="",style:a={},debug:l=!1,...h},f){const y=w.useRef(null),m=w.useRef(new Map),{chart:g,isReady:x,bounds:p,addSeries:M,updateSeries:C,removeSeries:R,resetZoom:A}=pe(y,h);w.useImperativeHandle(f,()=>({getChart:()=>g,resetZoom:A,getBounds:()=>p}),[g,A,p]),w.useEffect(()=>{if(!x||!g)return;const S=new Map(e.map(B=>[B.id,B])),z=m.current;z.forEach((B,D)=>{S.has(D)||R(D)}),S.forEach((B,D)=>{const j=z.get(D);if(j)(j.x!==B.x||j.y!==B.y)&&C(D,{x:B.x,y:B.y});else{const ne={id:B.id,type:"line",data:{x:B.x,y:B.y},style:{color:B.color??"#ff0055",width:B.width??1.5},visible:B.visible??!0};M(ne),S.size===1&&g.autoScale()}}),m.current=S},[e,x,g,M,C,R]),w.useEffect(()=>{!x||!g||!t||g.zoom(t)},[x,g,t]),w.useEffect(()=>{!x||!g||!n||g.on("zoom",S=>{n({xMin:S.x[0],xMax:S.x[1],yMin:S.y[0],yMax:S.y[1]})})},[x,g,n]),w.useEffect(()=>{!x||!g||(i!=null&&i.enabled?g.enableCursor(i):g.disableCursor())},[x,g,i]);const _=w.useMemo(()=>({position:"relative",width:typeof o=="number"?`${o}px`:o,height:typeof s=="number"?`${s}px`:s,...a}),[o,s,a]);return X.jsx("div",{ref:y,className:`scichart-container ${r}`,style:_,children:l&&p&&X.jsxs("div",{style:{position:"absolute",top:8,right:8,background:"rgba(0,0,0,0.7)",color:"#0f0",padding:"4px 8px",borderRadius:4,fontSize:11,fontFamily:"monospace"},children:[X.jsxs("div",{children:["X: [",p.xMin.toFixed(3),", ",p.xMax.toFixed(3),"]"]}),X.jsxs("div",{children:["Y: [",p.yMin.toExponential(2),", ",p.yMax.toExponential(2),"]"]}),X.jsxs("div",{children:["Series: ",e.length]})]})})});b.DARK_THEME=J,b.DEFAULT_THEME=ee,b.ELECTROCHEM_THEME=ue,b.EventEmitter=I,b.LIGHT_THEME=de,b.LinearScale=H,b.LogScale=$,b.MIDNIGHT_THEME=he,b.NativeWebGLRenderer=W,b.OverlayRenderer=fe,b.SciChart=Qe,b.Series=le,b.calculateStats=Ge,b.calculateTargetPoints=Ue,b.createChart=ge,b.createNativeRenderer=W,b.createRenderer=Oe,b.createScale=Le,b.createTheme=_e,b.detectCycles=We,b.detectPeaks=He,b.downsampleLTTB=qe,b.formatCurrent=te,b.formatPotential=te,b.formatScientific=je,b.formatValue=Xe,b.formatWithPrefix=te,b.generateCycleColors=Ve,b.getBestPrefix=ye,b.getThemeByName=Q,b.interleaveData=ce,b.lttbDownsample=Ye,b.minMaxDownsample=Ne,b.movingAverage=Ze,b.parseColor=V,b.useSciChart=pe,b.validateData=$e,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
130
+ //# sourceMappingURL=scichart-engine.umd.js.map