ml-time-graph 1.9.0 → 1.9.1

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.
package/CHANGELOG.md CHANGED
@@ -19,6 +19,17 @@ release notes, and every change is in `git log` in full.
19
19
 
20
20
  ---
21
21
 
22
+ ## [1.9.1] - 2026-09-23
23
+
24
+ ### Fixed
25
+ - Axis titles set through `axes.y[]` were never drawn, and are now placed clear of the tick
26
+ labels and of each other. `axes.left` / `axes.right` unaffected.
27
+ - `axes.left` / `axes.right` are no longer discarded when `axes.y[]` is also present; the
28
+ array form now wins per field instead of replacing the whole side configuration.
29
+ - Threshold labels no longer leave the plot area and overlap the time axis.
30
+ - Highlights and gap bands are clamped to the plot instead of overflowing it.
31
+ - A lone reading between two gaps is drawn as a point. It vanished in 1.9.0.
32
+
22
33
  ## [1.9.0] - 2026-09-23
23
34
 
24
35
  ### Added
@@ -1,4 +1,4 @@
1
- var k=class{static interpolateDataPoint(n,u,l){return {time:n.time+Math.round(l*(u.time-n.time)),value:(n.value??0)+l*((u.value??0)-(n.value??0))}}static interpolateAggregatedPoint(n,u,l){let i=(e,t)=>e!==null&&t!==null?e+l*(t-e):null;return {time:n.time+l*(u.time-n.time),min:i(n.min,u.min),max:i(n.max,u.max),avg:i(n.avg,u.avg),count:Math.round(n.count+l*(u.count-n.count))}}static getRuns(n,u,l=0){let i=[...n].sort((r,o)=>r.time-o.time),e=[],t=[],a=null;for(let r of i){let o=u(r),m=l>0&&a&&r.time-a.time>l;(o||m)&&t.length&&(e.push(t),t=[]),o||t.push(r),a=r;}return t.length&&e.push(t),e}static splitByBoundaries(n,u,l,i){if(n.length===0)return [];if(u.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let e=[...u].sort((m,s)=>m-s),t=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:e[m-1],r=m=>{let s=0;for(let f=0;f<e.length&&m>=e[f];f++)s=f+1;return s},o=[n[0]];for(let m=1;m<n.length;m++){let s=n[m-1],f=n[m],g=l(s),d=l(f),p;d>g?p=e.filter(v=>v>g&&v<=d):d<g?p=e.filter(v=>v>=d&&v<g).reverse():p=[];let b=g;for(let v of p){let x=(v-g)/(d-g),h=i(s,f,x);o.push(h);let c=r((b+v)/2);t.push({data:o,zoneIndex:c,zoneLow:a(c)}),o=[h],b=v;}(p.length===0||p[p.length-1]!==d)&&o.push(f);}if(o.length>1){let m=l(o[0]),s=l(o[o.length-1]),f=r((m+s)/2);t.push({data:o,zoneIndex:f,zoneLow:a(f)});}return t}static splitByThreshold(n,u,l,i){let e=this.splitByBoundaries(n,[u],l,i),t={above:[],below:[]};for(let a of e)a.zoneIndex===0?t.below.push(a.data):t.above.push(a.data);return t}},H={pharma_cold:{limitLow:2,limitHigh:8,activationEnergy:83144},pharma_ambient:{limitLow:15,limitHigh:25,activationEnergy:83144},blood:{limitLow:2,limitHigh:6,activationEnergy:83144},food_chilled:{limitLow:0,limitHigh:4},frozen:{limitLow:-40,limitHigh:-18}},D=8.314462618,N=273.15;function y(n,u,l,i=1){let e=u.filter(h=>h.value!==null&&h.value!==void 0&&!Number.isNaN(h.value)).map(h=>h.value);if(!e.length)return {time:n,min:null,max:null,avg:null,mkt:null,deltaMkt:null,stdDev:null,minutesAboveHigh:l?0:null,minutesBelowLow:l?0:null,count:0};let t=1/0,a=-1/0,r=0;for(let h of e)h<t&&(t=h),h>a&&(a=h),r+=h;let o=r/e.length,m=l?0:null,s=l?0:null;if(l)for(let h=0;h<u.length;h++){let c=u[h];if(c.value!==null&&c.value!==void 0){let M=u[h+1],w=(M?M.time-c.time:0)/(1e3*60);c.value>l.limitHigh&&(m+=w),c.value<l.limitLow&&(s+=w);}}let f=0,g=0,d=(l?.activationEnergy??83144)/D;for(let h of e){f+=Math.pow(h-o,2);let c=h+N;g+=Math.exp(-d/c);}let p=f/e.length,b=Math.sqrt(p),v=null,x=null;if(e.length>=i){let h=g/e.length,c=d/-Math.log(h);v=Number((c-N).toFixed(2)),x=Number((v-o).toFixed(2));}return {time:n,min:Number(t.toFixed(2)),max:Number(a.toFixed(2)),avg:Number(o.toFixed(2)),mkt:v,deltaMkt:x,stdDev:Number(b.toFixed(2)),minutesAboveHigh:m!==null?Number(m.toFixed(1)):null,minutesBelowLow:s!==null?Number(s.toFixed(1)):null,count:e.length}}function A(n,u="hourly",l,i,e=1){if(!n.length)return [];let t=u==="hourly"?36e5:u==="daily"?864e5:l??3600*1e3,a=[...n].sort((s,f)=>s.time-f.time),r=[],o=a[0].time,m=[];for(let s of a){for(;s.time-o>=t;)r.push(y(o,m,i,e)),o+=t,m=[];m.push(s);}return r.push(y(o,m,i,e)),r}function S(n,u){let l=1/0,i=-1/0,e=0;for(let a of u)a<l&&(l=a),a>i&&(i=a),e+=a;let t=e/u.length;return {time:n,min:l,max:i,avg:t,count:u.length}}function z(n,u=6e4){if(n.length<2)return [];let l=[...n].sort((e,t)=>e.time-t.time),i=[];for(let e=1;e<l.length;e++)l[e].time-l[e-1].time>u&&i.push({startTime:l[e-1].time,endTime:l[e].time});return i}function B(n){let u=[],l=0,i=0,e=0,t=0;for(let a of n)a.count>0&&(e++,a.minutesAboveHigh&&(l+=a.minutesAboveHigh),a.stdDev&&a.stdDev>i&&(i=a.stdDev),a.deltaMkt&&a.deltaMkt>2&&t++);return e===0?[]:(l>120&&u.push({type:"critical",message:`Kritische Gesamtbelastung: Das Produkt war im gesamten Zeitraum insgesamt ${Math.round(l)} Minuten zu warm.`,metric:"Total Excursion Time"}),t>e*.15&&u.push({type:"warning",message:"Frequent thermal shocks detected. The kinetic temperature deviates strongly from the average (possible regular door openings).",metric:"Delta MKT Instability"}),i>4&&u.push({type:"warning",message:`High instability measured. Maximum standard deviation was ${i}\xB0C. The cooling system controls imprecisely.`,metric:"Standard Deviation Peak"}),u)}function P(n,u){if(n.length<=u)return n;let l=[],i=Math.ceil(n.length/u);l.push(n[0]);for(let e=1;e<n.length;e+=i)l.push(n[Math.min(e,n.length-1)]);return l}function _(n,u="hourly",l){let i={limitLow:l.low,limitHigh:l.high,activationEnergy:l.activationEnergy};return A(n,u,l.interval,i,l.minCountForMkt??1)}var C=class{static compute(n){let u=n.map(r=>r.value).filter(r=>r!==null).sort((r,o)=>r-o);if(u.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let l=u.length,i=u.reduce((r,o)=>r+o,0)/l,e=l%2===1?u[Math.floor(l/2)]:(u[l/2-1]+u[l/2])/2,t=u.reduce((r,o)=>r+Math.pow(o-i,2),0)/l,a=Math.sqrt(t);return {min:u[0],max:u[l-1],avg:i,mean:i,median:e,stdDev:a,count:l}}static computeInRange(n,u,l){let i=n.filter(e=>e.time>=u&&e.time<=l);return this.compute(i)}};function q(n,u){let l=typeof n=="number"?n:n.mean,i=typeof n=="number"?u??NaN:n.stdDev;return !Number.isFinite(l)||!Number.isFinite(i)||l===0?null:Math.abs(i/l)*100}var G=83144;function L(n,u=83144){let l=u/8.314,i=0,e=0;for(let a of n)a!==null&&(i+=Math.exp(-l/(a+273.15)),e++);if(e===0)return null;let t=i/e;return l/-Math.log(t)-273.15}function R(n,u,l=83144){let i=new Array(n.length),e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=a-u;for(;e<t&&n[e].time<r;)e++;let o=n.slice(e,t+1).map(s=>s.value),m=L(o,l);i[t]={time:a,value:m,synthetic:true};}return i}function E(n){let u=0,l=0;for(let t of n)t!==null&&(u+=t,l++);if(l===0)return null;let i=u/l,e=0;for(let t of n){if(t===null)continue;let a=t-i;e+=a*a;}return Math.sqrt(e/l)}function F(n){let u=0,l=0;for(let t of n)t!==null&&(u+=t,l++);if(l<2)return null;let i=u/l,e=0;for(let t of n){if(t===null)continue;let a=t-i;e+=a*a;}return Math.sqrt(e/(l-1))}function V(n,u,l=false){let i=new Array(n.length),e=0,t=l?F:E;for(let a=0;a<n.length;a++){let r=n[a].time,o=r-u;for(;e<a&&n[e].time<o;)e++;let m=n.slice(e,a+1).map(f=>f.value),s=t(m);i[a]={time:r,value:s,synthetic:true};}return i}function K(n,u){let l=new Array(n.length),i=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-u;for(;i<e&&n[i].time<a;)i++;let r=0,o=0;for(let m=i;m<=e;m++){let s=n[m].value;s!==null&&(r+=s,o++);}l[e]={time:t,value:o===0?null:r/o,synthetic:true};}return l}function O(n,u){let l=new Array(n.length),i=null,e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=n[t].value;if(r===null){l[t]={time:a,value:i,synthetic:true};continue}if(i===null||u<=0)i=r;else {let o=1-Math.exp(-(a-e)/u);i=r*o+i*(1-o);}e=a,l[t]={time:a,value:i,synthetic:true};}return l}function U(n,u){let{high:l,low:i}=u,e={msAboveHigh:0,msBelowLow:0,globalMax:null,globalMin:null,excursions:[]},t=null;for(let a=0;a<n.length;a++){let r=n[a];if(r.value===null){t&&(e.excursions.push(t),t=null);continue}(e.globalMax===null||r.value>e.globalMax)&&(e.globalMax=r.value),(e.globalMin===null||r.value<e.globalMin)&&(e.globalMin=r.value);let o=l!==void 0&&r.value>l,m=i!==void 0&&r.value<i,s=o?"above":m?"below":null,f=n[a-1];if(f&&f.value!==null&&s!==null){let g=r.time-f.time;s==="above"?e.msAboveHigh+=g:e.msBelowLow+=g;}if(s===null){t&&(e.excursions.push(t),t=null);continue}t&&t.side===s?(t.endTime=r.time,t.durationMs=t.endTime-t.startTime,(s==="above"&&r.value>t.extremum||s==="below"&&r.value<t.extremum)&&(t.extremum=r.value)):(t&&e.excursions.push(t),t={startTime:r.time,endTime:r.time,side:s,extremum:r.value,durationMs:0});}return t&&e.excursions.push(t),e}function Y(n){if(n.length===0)return [];let u=new Map;for(let i of n)for(let e of i.data){if(e.value===null)continue;let t=u.get(e.time);t||(t=[],u.set(e.time,t)),t.push({name:i.name,value:e.value});}let l=[];for(let i of [...u.keys()].sort((e,t)=>e-t)){let e=u.get(i);if(e.length===0){l.push({time:i,min:null,max:null,delta:null,minSensor:null,maxSensor:null});continue}let t=e[0],a=e[0];for(let r=1;r<e.length;r++)e[r].value<t.value&&(t=e[r]),e[r].value>a.value&&(a=e[r]);l.push({time:i,min:t.value,max:a.value,delta:e.length<2?null:a.value-t.value,minSensor:t.name,maxSensor:a.name});}return l}function $(n){let u=[];for(let e of n){let t=0,a=0,r=1/0,o=-1/0;for(let m of e.data)m.value!==null&&(t+=m.value,a++,m.value<r&&(r=m.value),m.value>o&&(o=m.value));a!==0&&u.push({name:e.name,mean:t/a,min:r,max:o,count:a});}if(u.length===0)return {sensors:[],hottest:null,coldest:null,meanDelta:null};let l=u[0],i=u[0];for(let e=1;e<u.length;e++)u[e].mean>l.mean&&(l=u[e]),u[e].mean<i.mean&&(i=u[e]);return {sensors:u,hottest:l,coldest:i,meanDelta:l.mean-i.mean}}function T(n){let u=0,l=0,i=0,e=0,t=0;for(let m of n)m.value!==null&&(u++,l+=m.time,i+=m.value,e+=m.time*m.value,t+=m.time*m.time);if(u<2)return null;let a=u*t-l*l;if(a===0)return null;let r=(u*e-l*i)/a,o=(i-r*l)/u;return {slope:r,intercept:o,n:u}}function I(n,u){if(n.length===0)return null;let l=n[n.length-1].time,i=l-u,e=n.filter(t=>t.time>=i&&t.time<=l);return T(e)}function W(n,u){let l=[],i=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-u;for(;i<n.length&&n[i].time<a;)i++;let r=T(n.slice(i,e+1));l.push({time:t,fit:r});}return l}function Z(n,u,l={}){let i=l.lookbackMs??9e5,e=l.side??"either";if(n.length===0)return null;let t=n[n.length-1];if(t.value===null)return null;let a=I(n,i);if(!a||a.slope===0)return null;let r=a.slope>0&&t.value<u,o=a.slope<0&&t.value>u;if(e==="above"&&!r||e==="below"&&!o||e==="either"&&!r&&!o)return null;let m=(u-a.intercept)/a.slope,s=m-t.time;return s<=0?null:{msUntil:s,eta:m,fit:a,currentValue:t.value}}function j(n,u={}){let l=u.refTempCelsius??121.11,i=u.zValueKelvin??10,e=0;for(let t=0;t<n.length-1;t++){let a=n[t],r=n[t+1];if(a.value===null||r.value===null)continue;let o=(r.time-a.time)/6e4;if(o<=0)continue;let m=Math.pow(10,(a.value-l)/i),s=Math.pow(10,(r.value-l)/i);e+=(m+s)/2*o;}return e}/*!
1
+ var k=class{static interpolateDataPoint(n,i,l){return {time:n.time+Math.round(l*(i.time-n.time)),value:(n.value??0)+l*((i.value??0)-(n.value??0))}}static interpolateAggregatedPoint(n,i,l){let u=(e,t)=>e!==null&&t!==null?e+l*(t-e):null;return {time:n.time+l*(i.time-n.time),min:u(n.min,i.min),max:u(n.max,i.max),avg:u(n.avg,i.avg),count:Math.round(n.count+l*(i.count-n.count))}}static getRuns(n,i,l=0){let u=[...n].sort((r,o)=>r.time-o.time),e=[],t=[],a=null;for(let r of u){let o=i(r),m=l>0&&a&&r.time-a.time>l;(o||m)&&t.length&&(e.push(t),t=[]),o||t.push(r),a=r;}return t.length&&e.push(t),e}static splitByBoundaries(n,i,l,u){if(n.length===0)return [];if(i.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let e=[...i].sort((m,s)=>m-s),t=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:e[m-1],r=m=>{let s=0;for(let f=0;f<e.length&&m>=e[f];f++)s=f+1;return s},o=[n[0]];for(let m=1;m<n.length;m++){let s=n[m-1],f=n[m],g=l(s),d=l(f),p;d>g?p=e.filter(v=>v>g&&v<=d):d<g?p=e.filter(v=>v>=d&&v<g).reverse():p=[];let b=g;for(let v of p){let x=(v-g)/(d-g),h=u(s,f,x);o.push(h);let c=r((b+v)/2);t.push({data:o,zoneIndex:c,zoneLow:a(c)}),o=[h],b=v;}(p.length===0||p[p.length-1]!==d)&&o.push(f);}if(o.length>1||n.length===1){let m=l(o[0]),s=l(o[o.length-1]),f=r((m+s)/2);t.push({data:o,zoneIndex:f,zoneLow:a(f)});}return t}static splitByThreshold(n,i,l,u){let e=this.splitByBoundaries(n,[i],l,u),t={above:[],below:[]};for(let a of e)a.zoneIndex===0?t.below.push(a.data):t.above.push(a.data);return t}},H={pharma_cold:{limitLow:2,limitHigh:8,activationEnergy:83144},pharma_ambient:{limitLow:15,limitHigh:25,activationEnergy:83144},blood:{limitLow:2,limitHigh:6,activationEnergy:83144},food_chilled:{limitLow:0,limitHigh:4},frozen:{limitLow:-40,limitHigh:-18}},D=8.314462618,N=273.15;function y(n,i,l,u=1){let e=i.filter(h=>h.value!==null&&h.value!==void 0&&!Number.isNaN(h.value)).map(h=>h.value);if(!e.length)return {time:n,min:null,max:null,avg:null,mkt:null,deltaMkt:null,stdDev:null,minutesAboveHigh:l?0:null,minutesBelowLow:l?0:null,count:0};let t=1/0,a=-1/0,r=0;for(let h of e)h<t&&(t=h),h>a&&(a=h),r+=h;let o=r/e.length,m=l?0:null,s=l?0:null;if(l)for(let h=0;h<i.length;h++){let c=i[h];if(c.value!==null&&c.value!==void 0){let M=i[h+1],w=(M?M.time-c.time:0)/(1e3*60);c.value>l.limitHigh&&(m+=w),c.value<l.limitLow&&(s+=w);}}let f=0,g=0,d=(l?.activationEnergy??83144)/D;for(let h of e){f+=Math.pow(h-o,2);let c=h+N;g+=Math.exp(-d/c);}let p=f/e.length,b=Math.sqrt(p),v=null,x=null;if(e.length>=u){let h=g/e.length,c=d/-Math.log(h);v=Number((c-N).toFixed(2)),x=Number((v-o).toFixed(2));}return {time:n,min:Number(t.toFixed(2)),max:Number(a.toFixed(2)),avg:Number(o.toFixed(2)),mkt:v,deltaMkt:x,stdDev:Number(b.toFixed(2)),minutesAboveHigh:m!==null?Number(m.toFixed(1)):null,minutesBelowLow:s!==null?Number(s.toFixed(1)):null,count:e.length}}function A(n,i="hourly",l,u,e=1){if(!n.length)return [];let t=i==="hourly"?36e5:i==="daily"?864e5:l??3600*1e3,a=[...n].sort((s,f)=>s.time-f.time),r=[],o=a[0].time,m=[];for(let s of a){for(;s.time-o>=t;)r.push(y(o,m,u,e)),o+=t,m=[];m.push(s);}return r.push(y(o,m,u,e)),r}function S(n,i){let l=1/0,u=-1/0,e=0;for(let a of i)a<l&&(l=a),a>u&&(u=a),e+=a;let t=e/i.length;return {time:n,min:l,max:u,avg:t,count:i.length}}function z(n,i=6e4){if(n.length<2)return [];let l=[...n].sort((e,t)=>e.time-t.time),u=[];for(let e=1;e<l.length;e++)l[e].time-l[e-1].time>i&&u.push({startTime:l[e-1].time,endTime:l[e].time});return u}function B(n){let i=[],l=0,u=0,e=0,t=0;for(let a of n)a.count>0&&(e++,a.minutesAboveHigh&&(l+=a.minutesAboveHigh),a.stdDev&&a.stdDev>u&&(u=a.stdDev),a.deltaMkt&&a.deltaMkt>2&&t++);return e===0?[]:(l>120&&i.push({type:"critical",message:`Kritische Gesamtbelastung: Das Produkt war im gesamten Zeitraum insgesamt ${Math.round(l)} Minuten zu warm.`,metric:"Total Excursion Time"}),t>e*.15&&i.push({type:"warning",message:"Frequent thermal shocks detected. The kinetic temperature deviates strongly from the average (possible regular door openings).",metric:"Delta MKT Instability"}),u>4&&i.push({type:"warning",message:`High instability measured. Maximum standard deviation was ${u}\xB0C. The cooling system controls imprecisely.`,metric:"Standard Deviation Peak"}),i)}function P(n,i){if(n.length<=i)return n;let l=[],u=Math.ceil(n.length/i);l.push(n[0]);for(let e=1;e<n.length;e+=u)l.push(n[Math.min(e,n.length-1)]);return l}function _(n,i="hourly",l){let u={limitLow:l.low,limitHigh:l.high,activationEnergy:l.activationEnergy};return A(n,i,l.interval,u,l.minCountForMkt??1)}var C=class{static compute(n){let i=n.map(r=>r.value).filter(r=>r!==null).sort((r,o)=>r-o);if(i.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let l=i.length,u=i.reduce((r,o)=>r+o,0)/l,e=l%2===1?i[Math.floor(l/2)]:(i[l/2-1]+i[l/2])/2,t=i.reduce((r,o)=>r+Math.pow(o-u,2),0)/l,a=Math.sqrt(t);return {min:i[0],max:i[l-1],avg:u,mean:u,median:e,stdDev:a,count:l}}static computeInRange(n,i,l){let u=n.filter(e=>e.time>=i&&e.time<=l);return this.compute(u)}};function q(n,i){let l=typeof n=="number"?n:n.mean,u=typeof n=="number"?i??NaN:n.stdDev;return !Number.isFinite(l)||!Number.isFinite(u)||l===0?null:Math.abs(u/l)*100}var G=83144;function L(n,i=83144){let l=i/8.314,u=0,e=0;for(let a of n)a!==null&&(u+=Math.exp(-l/(a+273.15)),e++);if(e===0)return null;let t=u/e;return l/-Math.log(t)-273.15}function R(n,i,l=83144){let u=new Array(n.length),e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=a-i;for(;e<t&&n[e].time<r;)e++;let o=n.slice(e,t+1).map(s=>s.value),m=L(o,l);u[t]={time:a,value:m,synthetic:true};}return u}function E(n){let i=0,l=0;for(let t of n)t!==null&&(i+=t,l++);if(l===0)return null;let u=i/l,e=0;for(let t of n){if(t===null)continue;let a=t-u;e+=a*a;}return Math.sqrt(e/l)}function F(n){let i=0,l=0;for(let t of n)t!==null&&(i+=t,l++);if(l<2)return null;let u=i/l,e=0;for(let t of n){if(t===null)continue;let a=t-u;e+=a*a;}return Math.sqrt(e/(l-1))}function V(n,i,l=false){let u=new Array(n.length),e=0,t=l?F:E;for(let a=0;a<n.length;a++){let r=n[a].time,o=r-i;for(;e<a&&n[e].time<o;)e++;let m=n.slice(e,a+1).map(f=>f.value),s=t(m);u[a]={time:r,value:s,synthetic:true};}return u}function K(n,i){let l=new Array(n.length),u=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-i;for(;u<e&&n[u].time<a;)u++;let r=0,o=0;for(let m=u;m<=e;m++){let s=n[m].value;s!==null&&(r+=s,o++);}l[e]={time:t,value:o===0?null:r/o,synthetic:true};}return l}function O(n,i){let l=new Array(n.length),u=null,e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=n[t].value;if(r===null){l[t]={time:a,value:u,synthetic:true};continue}if(u===null||i<=0)u=r;else {let o=1-Math.exp(-(a-e)/i);u=r*o+u*(1-o);}e=a,l[t]={time:a,value:u,synthetic:true};}return l}function U(n,i){let{high:l,low:u}=i,e={msAboveHigh:0,msBelowLow:0,globalMax:null,globalMin:null,excursions:[]},t=null;for(let a=0;a<n.length;a++){let r=n[a];if(r.value===null){t&&(e.excursions.push(t),t=null);continue}(e.globalMax===null||r.value>e.globalMax)&&(e.globalMax=r.value),(e.globalMin===null||r.value<e.globalMin)&&(e.globalMin=r.value);let o=l!==void 0&&r.value>l,m=u!==void 0&&r.value<u,s=o?"above":m?"below":null,f=n[a-1];if(f&&f.value!==null&&s!==null){let g=r.time-f.time;s==="above"?e.msAboveHigh+=g:e.msBelowLow+=g;}if(s===null){t&&(e.excursions.push(t),t=null);continue}t&&t.side===s?(t.endTime=r.time,t.durationMs=t.endTime-t.startTime,(s==="above"&&r.value>t.extremum||s==="below"&&r.value<t.extremum)&&(t.extremum=r.value)):(t&&e.excursions.push(t),t={startTime:r.time,endTime:r.time,side:s,extremum:r.value,durationMs:0});}return t&&e.excursions.push(t),e}function Y(n){if(n.length===0)return [];let i=new Map;for(let u of n)for(let e of u.data){if(e.value===null)continue;let t=i.get(e.time);t||(t=[],i.set(e.time,t)),t.push({name:u.name,value:e.value});}let l=[];for(let u of [...i.keys()].sort((e,t)=>e-t)){let e=i.get(u);if(e.length===0){l.push({time:u,min:null,max:null,delta:null,minSensor:null,maxSensor:null});continue}let t=e[0],a=e[0];for(let r=1;r<e.length;r++)e[r].value<t.value&&(t=e[r]),e[r].value>a.value&&(a=e[r]);l.push({time:u,min:t.value,max:a.value,delta:e.length<2?null:a.value-t.value,minSensor:t.name,maxSensor:a.name});}return l}function $(n){let i=[];for(let e of n){let t=0,a=0,r=1/0,o=-1/0;for(let m of e.data)m.value!==null&&(t+=m.value,a++,m.value<r&&(r=m.value),m.value>o&&(o=m.value));a!==0&&i.push({name:e.name,mean:t/a,min:r,max:o,count:a});}if(i.length===0)return {sensors:[],hottest:null,coldest:null,meanDelta:null};let l=i[0],u=i[0];for(let e=1;e<i.length;e++)i[e].mean>l.mean&&(l=i[e]),i[e].mean<u.mean&&(u=i[e]);return {sensors:i,hottest:l,coldest:u,meanDelta:l.mean-u.mean}}function T(n){let i=0,l=0,u=0,e=0,t=0;for(let m of n)m.value!==null&&(i++,l+=m.time,u+=m.value,e+=m.time*m.value,t+=m.time*m.time);if(i<2)return null;let a=i*t-l*l;if(a===0)return null;let r=(i*e-l*u)/a,o=(u-r*l)/i;return {slope:r,intercept:o,n:i}}function I(n,i){if(n.length===0)return null;let l=n[n.length-1].time,u=l-i,e=n.filter(t=>t.time>=u&&t.time<=l);return T(e)}function W(n,i){let l=[],u=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-i;for(;u<n.length&&n[u].time<a;)u++;let r=T(n.slice(u,e+1));l.push({time:t,fit:r});}return l}function Z(n,i,l={}){let u=l.lookbackMs??9e5,e=l.side??"either";if(n.length===0)return null;let t=n[n.length-1];if(t.value===null)return null;let a=I(n,u);if(!a||a.slope===0)return null;let r=a.slope>0&&t.value<i,o=a.slope<0&&t.value>i;if(e==="above"&&!r||e==="below"&&!o||e==="either"&&!r&&!o)return null;let m=(i-a.intercept)/a.slope,s=m-t.time;return s<=0?null:{msUntil:s,eta:m,fit:a,currentValue:t.value}}function j(n,i={}){let l=i.refTempCelsius??121.11,u=i.zValueKelvin??10,e=0;for(let t=0;t<n.length-1;t++){let a=n[t],r=n[t+1];if(a.value===null||r.value===null)continue;let o=(r.time-a.time)/6e4;if(o<=0)continue;let m=Math.pow(10,(a.value-l)/u),s=Math.pow(10,(r.value-l)/u);e+=(m+s)/2*o;}return e}/*!
2
2
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
3
3
  * MIT with Attribution: free use incl. commercial requires visible credit to
4
4
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
package/dist/index.d.ts CHANGED
@@ -1047,6 +1047,6 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
1047
1047
  * Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
1048
1048
  * kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
1049
1049
  */
1050
- declare const VERSION = "1.9.0";
1050
+ declare const VERSION = "1.9.1";
1051
1051
 
1052
1052
  export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnySeries, type AxesConfig, type AxisLabelsStyle, type AxisStyle, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, type GridLineStyle, type GridStyle, HatchVariant, Highlight, HighlightBuilder, LegendItem, type LegendOptions, LegendOrientation, type LegendPosition, type LimitStatsPoint, LineVariant, MLTimeGraph, type MLTimeGraphOptions, type Margin, Marker, MarkerBuilder, type MktPoint, type OptionsLayer, PointStyleType, SVGRenderer, SeriesStyle, type StatsAggregatedPoint, type StdDevPoint, Threshold, ThresholdBuilder, ThresholdLabelPosition, type TickConfig, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, type XAxisConfig, type YAxisConfig, attachTooltip, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
package/dist/index.js CHANGED
@@ -1,46 +1,46 @@
1
- var se=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};function ee(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var Lt=(()=>{let i=new Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;i[e]=t>>>0;}return i})();function Fe(i){let e=new TextEncoder().encode(i),t=4294967295;for(let n of e)t=Lt[(t^n)&255]^t>>>8;return (t^4294967295)>>>0}function Z(i,e){return e||"s-"+Fe(i??"").toString(16).padStart(8,"0")}var Je=new Map;function Mt(i,e){return `${i}|${JSON.stringify(e??{})}`}function Qe(i,e){let t=Mt(i,e),n=Je.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Je.set(t,n)),n}var U=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,s]=this.#t;return r===n?o:o+(t-n)/(r-n)*(s-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},q=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],te=class{#e;#t;#n;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),s=o-r;if(s<=0)return {interval:q[0].ms};let a=s/e,l=q[0].ms;for(let u of q)if(u.ms>=a){l=u.ms;break}let h=l,m=Math.round(s/h);for(;m>n&&h<q[q.length-1].ms;){let u=q.findIndex(d=>d.ms===h);h=q[Math.min(u+1,q.length-1)].ms,m=Math.round(s/h);}for(;m<t&&h>q[0].ms;){let u=q.findIndex(d=>d.ms===h);h=q[Math.max(u-1,0)].ms,m=Math.round(s/h);}return {interval:h}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,s]=this.#e.domain(),a=[],l=Math.ceil(o/r)*r;for(let h=l;h<=s;h+=r)a.push(h);return a}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return Qe(this.#t,n).format(new Date(e))}};var Re={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var de={...Re};function Pt(i){de={...de,...i};}function ne(){return de}function Ft(){de={...Re};}function Rt(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function Bt(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Be(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=Rt(t),s=Bt(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ var pe=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};function le(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var It=(()=>{let i=new Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;i[e]=t>>>0;}return i})();function He(i){let e=new TextEncoder().encode(i),t=4294967295;for(let n of e)t=It[(t^n)&255]^t>>>8;return (t^4294967295)>>>0}function ee(i,e){return e||"s-"+He(i??"").toString(16).padStart(8,"0")}var ot=new Map;function Ot(i,e){return `${i}|${JSON.stringify(e??{})}`}function st(i,e){let t=Ot(i,e),n=ot.get(t);return n||(n=new Intl.DateTimeFormat(i,e),ot.set(t,n)),n}var te=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,s]=this.#t;return r===n?o:o+(t-n)/(r-n)*(s-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},Z=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],he=class{#e;#t;#n;constructor(e){this.#e=new te({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),s=o-r;if(s<=0)return {interval:Z[0].ms};let a=s/e,h=Z[0].ms;for(let u of Z)if(u.ms>=a){h=u.ms;break}let l=h,m=Math.round(s/l);for(;m>n&&l<Z[Z.length-1].ms;){let u=Z.findIndex(c=>c.ms===l);l=Z[Math.min(u+1,Z.length-1)].ms,m=Math.round(s/l);}for(;m<t&&l>Z[0].ms;){let u=Z.findIndex(c=>c.ms===l);l=Z[Math.max(u-1,0)].ms,m=Math.round(s/l);}return {interval:l}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,s]=this.#e.domain(),a=[],h=Math.ceil(o/r)*r;for(let l=h;l<=s;l+=r)a.push(l);return a}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return st(this.#t,n).format(new Date(e))}};var Ee={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var xe={...Ee};function Wt(i){xe={...xe,...i};}function me(){return xe}function Ht(){xe={...Ee};}function Et(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function Nt(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Ne(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=Et(t),s=Nt(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
2
  <pattern id="${i}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${t}" />
4
4
  </pattern>
5
- `.trim();let a=12,l=12,h="rotate(0)",m="";switch(e){case "classic-diagonal":a=12,l=12,h="rotate(45)",m=`<line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":a=6,l=6,h="rotate(30)",m=`<line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":a=14,l=14,h="rotate(45)",m=`
6
- <line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
5
+ `.trim();let a=12,h=12,l="rotate(0)",m="";switch(e){case "classic-diagonal":a=12,h=12,l="rotate(45)",m=`<line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":a=6,h=6,l="rotate(30)",m=`<line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":a=14,h=14,l="rotate(45)",m=`
6
+ <line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
7
7
  <line x1="0" y1="0" x2="${a}" y2="0" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
8
- `;break;case "dots":a=12,l=12,m=`<circle cx="${a/2}" cy="${l/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":a=16,l=16,m=`
9
- <path d="M 0 ${l/2} Q ${a/4} 0, ${a/2} ${l/2} T ${a} ${l/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
- `;break;case "dashed":a=12,l=12,h="rotate(45)",m=`<line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":a=16,l=16,m=`
11
- <path d="M 0 0 L ${a/2} ${l/2} L 0 ${l} M ${a} 0 L ${a/2} ${l/2} L ${a} ${l}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
- `;break;case "brick":a=20,l=20,m=`
13
- <path d="M 0 ${l/2} L ${a} ${l/2} M 0 ${l} L ${a} ${l} M ${a/2} 0 L ${a/2} ${l/2} M 0 ${l/2} L 0 ${l}" fill="none" stroke="${o}" stroke-width="${r}" />
14
- `;break;case "double-stripe":a=16,l=16,h="rotate(45)",m=`
15
- <line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
16
- <line x1="${a/2}" y1="0" x2="${a/2}" y2="${l}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
- `;break;case "honeycomb":a=18,l=32,m=`
8
+ `;break;case "dots":a=12,h=12,m=`<circle cx="${a/2}" cy="${h/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":a=16,h=16,m=`
9
+ <path d="M 0 ${h/2} Q ${a/4} 0, ${a/2} ${h/2} T ${a} ${h/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
+ `;break;case "dashed":a=12,h=12,l="rotate(45)",m=`<line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":a=16,h=16,m=`
11
+ <path d="M 0 0 L ${a/2} ${h/2} L 0 ${h} M ${a} 0 L ${a/2} ${h/2} L ${a} ${h}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
+ `;break;case "brick":a=20,h=20,m=`
13
+ <path d="M 0 ${h/2} L ${a} ${h/2} M 0 ${h} L ${a} ${h} M ${a/2} 0 L ${a/2} ${h/2} M 0 ${h/2} L 0 ${h}" fill="none" stroke="${o}" stroke-width="${r}" />
14
+ `;break;case "double-stripe":a=16,h=16,l="rotate(45)",m=`
15
+ <line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
16
+ <line x1="${a/2}" y1="0" x2="${a/2}" y2="${h}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
+ `;break;case "honeycomb":a=18,h=32,m=`
18
18
  <path d="M 0 0 L ${a/2} 5 L ${a} 0 M 0 16 L ${a/2} 11 L ${a} 16 M 0 16 L 0 32 M ${a/2} 5 L ${a/2} 11 M ${a} 16 L ${a} 32 M 0 32 L ${a/2} 27 L ${a} 32 M ${a/2} 27 L ${a/2} 32" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
19
- `;break}let u=`<rect width="${a}" height="${l}" fill="${t}"${s} />`;return `
20
- <pattern id="${i}" width="${a}" height="${l}" patternTransform="${h}" patternUnits="userSpaceOnUse">
19
+ `;break}let u=`<rect width="${a}" height="${h}" fill="${t}"${s} />`;return `
20
+ <pattern id="${i}" width="${a}" height="${h}" patternTransform="${l}" patternUnits="userSpaceOnUse">
21
21
  ${u}
22
22
  ${m}
23
23
  </pattern>
24
- `.trim()}function je(i,e=2,t=false){return i==="dashed"||!i&&t?{strokeDasharray:"4,4"}:i==="dotted"?{strokeDasharray:"2,4"}:!i||i==="solid"?null:et(i,e)}function et(i,e=2){let t=e;switch(i){case "dotted":return {strokeDasharray:`0, ${t*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${t*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${t*3}, ${t*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${t*6}, ${t*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${t*1.5}, ${t*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${t*4}, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${t*5}, ${t*2}, 0, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${t*3}, ${t*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var p=new Proxy({},{get:(i,e)=>ne()[e],has:(i,e)=>e in ne(),ownKeys:()=>Reflect.ownKeys(ne()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(ne(),e)});var ae={axisColor:p.axisColor,tickColor:p.tickColor,textColor:p.textColor,textSize:p.textSize},ie=class{#e;#t;constructor(e){this.#e=new te({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??ae).axisColor}get tickColor(){return (this.#t.colors??ae).tickColor}get textColor(){return (this.#t.colors??ae).textColor}get textSize(){return (this.#t.colors??ae).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??ae,n=this.#t.y??0,r=[],[o,s]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let a of e)r.push({type:"line",x1:a.x,y1:n,x2:a.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:a.label,x:a.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}};var le={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function jt(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function It(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var ce=class{#e;#t;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??le).axisColor}get tickColor(){return (this.#t.colors??le).tickColor}get textColor(){return (this.#t.colors??le).textColor}get textSize(){return (this.#t.colors??le).textSize}generateTicks(){let e=this.#t.format??jt,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,r]=this.#e.domain(),o=Math.min(n,r),s=Math.max(n,r),a=s-o;if(a===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let l=a/t,h=Math.pow(10,Math.floor(Math.log10(l))),m=l/h,u;if(m<=1.5?u=h:m<=3?u=2*h:m<=7?u=5*h:u=10*h,u<=0||!Number.isFinite(u))return [{value:n,position:this.#e.map(n),label:e(n)}];let d=[],c=Math.ceil(o/u)*u;for(let y=c;y<=s;y+=u)d.push({value:y,position:this.#e.map(y),label:e(y)});return d}render(){let e=this.generateTicks(),t=this.#t.colors??le,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],a=this.#t.suppressTolerancePx??8,l=m=>s.some(u=>Math.abs(u-m)<=a),h=[];if(r==="vertical"){let[m,u]=this.#e.range();h.push({type:"line",x1:n,y1:m,x2:n,y2:u,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=It(e);e.forEach((c,y)=>{let g=l(c.position),x=d[y]?{opacity:0}:{};o==="left"?(h.push({type:"line",x1:n-4,y1:c.position,x2:n,y2:c.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||h.push({type:"text",content:c.label,x:n-8,y:c.position+4,anchor:"end",fontSize:11,fill:t.textColor,...x})):(h.push({type:"line",x1:n,y1:c.position,x2:n+4,y2:c.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||h.push({type:"text",content:c.label,x:n+8,y:c.position+4,anchor:"start",fontSize:11,fill:t.textColor,...x}));});}else {let[m,u]=this.#e.range();h.push({type:"line",x1:m,y1:n,x2:u,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)h.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),h.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return h}};var V=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0))}}static interpolateAggregatedPoint(i,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((a,l)=>a.time-l.time),r=[],o=[],s=null;for(let a of n){let l=e(a),h=t>0&&s&&a.time-s.time>t;(l||h)&&o.length&&(r.push(o),o=[]),l||o.push(a),s=a;}return o.length&&r.push(o),r}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((h,m)=>h-m),o=[],s=h=>h<=0?Number.NEGATIVE_INFINITY:r[h-1],a=h=>{let m=0;for(let u=0;u<r.length&&h>=r[u];u++)m=u+1;return m},l=[i[0]];for(let h=1;h<i.length;h++){let m=i[h-1],u=i[h],d=t(m),c=t(u),y;c>d?y=r.filter(x=>x>d&&x<=c):c<d?y=r.filter(x=>x>=c&&x<d).reverse():y=[];let g=d;for(let x of y){let k=(x-d)/(c-d),D=n(m,u,k);l.push(D);let R=a((g+x)/2);o.push({data:l,zoneIndex:R,zoneLow:s(R)}),l=[D],g=x;}(y.length===0||y[y.length-1]!==c)&&l.push(u);}if(l.length>1){let h=t(l[0]),m=t(l[l.length-1]),u=a((h+m)/2);o.push({data:l,zoneIndex:u,zoneLow:s(u)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let s of r)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};function tt(i,e=6e4){if(i.length<2)return [];let t=[...i].sort((r,o)=>r.time-o.time),n=[];for(let r=1;r<t.length;r++)t[r].time-t[r-1].time>e&&n.push({startTime:t[r-1].time,endTime:t[r].time});return n}function Ot(i,e=83144){let t=e/8.314,n=0,r=0;for(let s of i)s!==null&&(n+=Math.exp(-t/(s+273.15)),r++);if(r===0)return null;let o=n/r;return t/-Math.log(o)-273.15}function nt(i,e,t=83144){let n=new Array(i.length),r=0;for(let o=0;o<i.length;o++){let s=i[o].time,a=s-e;for(;r<o&&i[r].time<a;)r++;let l=i.slice(r,o+1).map(m=>m.value),h=Ot(l,t);n[o]={time:s,value:h,synthetic:true};}return n}function Wt(i){let e=0,t=0;for(let o of i)o!==null&&(e+=o,t++);if(t===0)return null;let n=e/t,r=0;for(let o of i){if(o===null)continue;let s=o-n;r+=s*s;}return Math.sqrt(r/t)}function Ht(i){let e=0,t=0;for(let o of i)o!==null&&(e+=o,t++);if(t<2)return null;let n=e/t,r=0;for(let o of i){if(o===null)continue;let s=o-n;r+=s*s;}return Math.sqrt(r/(t-1))}function it(i,e,t=false){let n=new Array(i.length),r=0,o=t?Ht:Wt;for(let s=0;s<i.length;s++){let a=i[s].time,l=a-e;for(;r<s&&i[r].time<l;)r++;let h=i.slice(r,s+1).map(u=>u.value),m=o(h);n[s]={time:a,value:m,synthetic:true};}return n}function Ie(i,e){let t=new Array(i.length),n=0;for(let r=0;r<i.length;r++){let o=i[r].time,s=o-e;for(;n<r&&i[n].time<s;)n++;let a=0,l=0;for(let h=n;h<=r;h++){let m=i[h].value;m!==null&&(a+=m,l++);}t[r]={time:o,value:l===0?null:a/l,synthetic:true};}return t}function rt(i,e){let t=new Array(i.length),n=null,r=0;for(let o=0;o<i.length;o++){let s=i[o].time,a=i[o].value;if(a===null){t[o]={time:s,value:n,synthetic:true};continue}if(n===null||e<=0)n=a;else {let l=1-Math.exp(-(s-r)/e);n=a*l+n*(1-l);}r=s,t[o]={time:s,value:n,synthetic:true};}return t}function ot(i){return {id:i.id,line:{stroke:i.stroke??p.stroke,strokeWidth:i.strokeWidth??p.strokeWidth,smoothing:i.smoothing??false,dashed:i.dashed??false},fill:i.fill??p.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??p.pointSize,stroke:i.stroke??p.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function pe(i,e,t){let n=[],r=i.reduce((s,a)=>s+a.data.length,0),o=ot(t);for(let s=0;s<i.length;s++){let a=i[s];a.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${s}`:void 0,points:a.data.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})),stroke:a.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:o.line.smoothing,dashed:o.line.dashed,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur,shadowOffsetX:o.shadow.offsetX,shadowOffsetY:o.shadow.offsetY,fill:"none"}):a.data.length===1&&r===1&&n.push({type:"circle",cx:e.timeScale.map(a.data[0].time),cy:e.valueScale.map(a.data[0].value),r:Math.max(o.markers.size,o.line.strokeWidth),fill:a.color??o.line.stroke,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur});}return n}function re(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function Oe(i,e,t,n){if(i.length<2)return [];let r=V.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<r.length;s++){let a=r[s];if(a.data.length<2)continue;let l=t.getColor(a.zoneIndex);if(!l)continue;let h=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yLow(u))})),m=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yHigh(u))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...h,...m],fill:l,hatch:t.getHatch?.(a.zoneIndex),stroke:"none"});}return o}function st(i,e,t,n){let r=ot(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let s=0;s<i.length;s++){let a=i[s],l=e.timeScale.map(a.time),h=e.valueScale.map(a.value),m=n(a),u=t.pointStroke??m,d=t.pointFill??m,c=t.pointStrokeWidth??1.5,y=t.id?`${t.id}-marker-${s}`:void 0;fe(o,y,r.markers.type,l,h,r.markers.size,u,d,c);}return o}function fe(i,e,t,n,r,o,s,a,l){switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:a,stroke:s,strokeWidth:l,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:a,stroke:s,strokeWidth:l,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:s,strokeWidth:l,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:s,strokeWidth:l,id:e});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break;case "star":{let h=[];for(let m=0;m<10;m++){let u=m%2===0?o:o*.5,d=Math.PI/2*3+m*Math.PI/5;h.push({x:n+u*Math.cos(d),y:r+u*Math.sin(d)});}i.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:s,strokeWidth:l,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:l,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:s,strokeWidth:l,id:e});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break;case "hexagon":{let h=[];for(let m=0;m<6;m++){let u=m*(Math.PI/3);h.push({x:n+o*Math.cos(u),y:r+o*Math.sin(u)});}i.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:l,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:a,stroke:s,strokeWidth:l,id:e});}}var oe=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var ge=class extends oe{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??p.minColor,n=e.maxColor??p.maxColor,r=e.avgColor??p.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.strokeWidth??p.strokeWidth,l=V.getRuns(this.data,c=>c.min===null||c.max===null||c.avg===null);if(l.length===0)return [];let h={timeScale:this.timeScale,valueScale:e.valueScale},m=[];l.forEach((c,y)=>{c.length<2||(e.fillToMax&&m.push(...Oe(c,h,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:V.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${y}`:void 0})),e.fillToMin&&m.push(...Oe(c,h,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:V.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${y}`:void 0})));});let u=l.filter(c=>c.length>=2),d=c=>u.map(y=>({data:y.map(g=>({time:g.time,value:c(g)}))}));return m.push(...pe(d(c=>c.max),h,{stroke:n,strokeWidth:a,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...pe(d(c=>c.min),h,{stroke:t,strokeWidth:a,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...pe(d(c=>c.avg),h,{stroke:r,strokeWidth:a,smoothing:s,dashed:o,id:this.id?`${this.id}-avg`:void 0})),m}};var ye=class extends oe{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??p.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??p.bandAvgLine,s=e.bandWidth??10,a=[];for(let l of this.data){if(l.min===null||l.max===null)continue;let h=this.timeScale.map(l.time),m=e.valueScale.map(l.max),u=e.valueScale.map(l.min),d=s,c=this.data.indexOf(l);if(a.push({type:"rect",x:h-d/2,y:m,w:d,h:u-m,fill:t,hatch:n,opacity:this.opacity(l.count),id:this.id?`${this.id}-slot-${c}`:void 0}),r&&l.avg!==null){let y=e.valueScale.map(l.avg);a.push({type:"line",x1:h-d/2,y1:y,x2:h+d/2,y2:y,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${c}`:void 0});}}return a}};function Et(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function at(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[s,a]=t.range(),l=Math.min(s,a),h=Math.max(s,a),m=[],u=[];for(let d of e){let c=d.color??p.thresholdColor,y=t.map(d.value);d.fill==="above"?m.push({type:"rect",x:r,y:l,w:o-r,h:Math.max(0,y-l),fill:c,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&m.push({type:"rect",x:r,y,w:o-r,h:Math.max(0,h-y),fill:c,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??p.thresholdLine;if(g!=="none"){let x=Et(g),k={type:"line",x1:r,y1:y,x2:o,y2:y,stroke:c,strokeWidth:1,...x,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(k.shadowColor=d.shadowColor,k.shadowBlur=d.shadowBlur??4,k.shadowOffsetX=d.shadowOffsetX??0,k.shadowOffsetY=d.shadowOffsetY??2),m.push(k);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let x=typeof d.label=="object"?d.label:void 0,k=typeof d.label=="string"?d.label:x?.text??d.name,D=x?.position??"right";u.push({...Nt(k,D,r,o,y,c,x),id:d.id?`${d.id}-label`:void 0});}}return {inside:m,labels:u}}function Nt(i,e,t,n,r,o,s){let a=(t+n)/2,l={type:"text",content:i,fontSize:p.thresholdFontSize,fill:o},h=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...l,...h,x:t+4,y:r-4,anchor:"start"};case "above":return {...l,...h,x:a,y:r-6,anchor:"middle"};case "below":return {...l,...h,x:a,y:r+14,anchor:"middle"};case "center":return {...l,...h,x:a,y:r-4,anchor:"middle"};case "outside-left":return {...l,...h,x:t-6,y:r+3,anchor:"end",textBaseline:h.textBaseline??"middle"};case "outside-right":return {...l,...h,x:n+6,y:r+3,anchor:"start",textBaseline:h.textBaseline??"middle"};default:return {...l,...h,x:n-4,y:r-4,anchor:"end"}}}function lt(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function be(i){let{ranges:e,timeScale:t,yRange:n,height:r}=i,[o,s]=n,a=[];for(let l of e){let h=t.map(l.startTime),m=t.map(l.endTime);if(l.fill!==void 0&&a.push({type:"rect",x:h,y:o,w:m-h,h:s-o,fill:l.fill,hatch:l.hatch,opacity:l.opacity}),l.edges)for(let u of [h,m])a.push({type:"line",x1:u,y1:o,x2:u,y2:s,stroke:l.edges.stroke,strokeWidth:l.edges.strokeWidth,dash:"dashed"});l.label&&a.push({type:"text",content:l.label,x:(h+m)/2,y:lt(l.labelPosition??"middle",o,s,r),anchor:"middle",fontSize:l.fontSize,fill:l.labelColor,rotate:l.rotate});}return a}function We(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=p.gapFill,hatch:s,fillOpacity:a=p.gapFillOpacity??.15,stroke:l=p.gapStroke,strokeWidth:h=p.gapStrokeWidth,dashed:m=true,fontSize:u=p.gapFontSize,fontFill:d=p.gapFontColor,labelBaseline:c="middle",labelRotate:y}=i;return be({timeScale:t,yRange:n,height:r,ranges:e.map(g=>{let x=g.style??"dashed_border",k=x==="filled"||x==="dashed_border",D=x==="dashed_border"&&m!==false;return {startTime:g.startTime,endTime:g.endTime,...k&&{fill:g.fill??o,hatch:g.hatch??s,opacity:g.fillOpacity??a},...D&&{edges:{stroke:l,strokeWidth:h}},label:g.label,labelPosition:g.labelBaseline??c,labelColor:d,fontSize:u,rotate:g.rotate??y}})})}var Gt=1,xe=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:s,y:a,height:l}=this.#e,h=[];n&&h.push({type:"rect",x:s[0],y:a,w:s[1]-s[0],h:l,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let m of e){let u=t.map(m.startTime),d=t.map(m.endTime);if(d<s[0]||u>s[1])continue;let c=Math.max(s[0],Math.min(s[1],u)),y=Math.max(s[0],Math.min(s[1],d)),g=Math.max(y-c,Gt);c+g>s[1]&&(c=Math.max(s[0],s[1]-g));let x=c+g/2;if(h.push({type:"rect",x:c,y:a,w:g,h:l,hatch:m.hatch??r,fill:m.fill??"#6b728044",stroke:m.stroke,strokeWidth:m.strokeWidth??0,title:m.title}),m.label){let k=m.labelFontSize??10;h.push({type:"text",content:m.label,x,y:this.#t(m.labelBaseline,k),anchor:"middle",fontSize:k,fill:m.labelFill??"#333"});}}if(o){let m=new ie({domain:t.domain(),xRange:s,y:a+l+4});h.push({type:"group",cssClass:"annotation-band-axis",commands:m.render()});}return h}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};function ht(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return be({timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??p.highlightColor,opacity:o.opacity??p.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??p.highlightLabelColor,fontSize:p.annotationFontSize,rotate:o.rotate}))})}function mt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,s]=r,a=[];for(let l of e){let h=t.map(l.time),m=l.color??p.markerColor,u=l.pointStyle??(l.value!==void 0?"circle":"none"),d=l.lineStyle??"full";if(l.value!==void 0){let c=n.map(l.value);if(d==="to-value"?a.push({type:"line",x1:h,y1:s,x2:h,y2:c,stroke:m,strokeWidth:1,dashed:true}):d==="to-top"?a.push({type:"line",x1:h,y1:o,x2:h,y2:c,stroke:m,strokeWidth:1,dashed:true}):d==="full"&&a.push({type:"line",x1:h,y1:o,x2:h,y2:s,stroke:m,strokeWidth:1}),u!=="none"&&fe(a,void 0,u,h,c,p.markerSize,m,m,1.5),l.label){let y=d==="to-value"?c-10:o-6;a.push({type:"text",content:l.label,x:h,y,anchor:"middle",fontSize:11,fill:m});}}else d!=="none"&&a.push({type:"line",x1:h,y1:o,x2:h,y2:s,stroke:m,strokeWidth:1}),l.label&&a.push({type:"text",content:l.label,x:h,y:o-6,anchor:"middle",fontSize:11,fill:m});}return a}function ut(i){let{annotations:e,timeScale:t,valueScales:n}=i,r=[],o=s=>{let a=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:a?a.map(s.value):0}};for(let s of e){let a=[],l=h=>a.push(h);switch(s.type){case "line":{let h=o(s.from),m=o(s.to);l({type:"line",x1:h.x,y1:h.y,x2:m.x,y2:m.y,stroke:s.color??p.annotationColor,strokeWidth:s.width??p.annotationWidth,dash:s.dash});break}case "arrow":{let h=o(s.from),m=o(s.to),u=s.color??p.annotationColor,d=s.headSize??p.annotationHead;l({type:"line",x1:h.x,y1:h.y,x2:m.x,y2:m.y,stroke:u,strokeWidth:s.width??p.annotationWidth});let c=Math.hypot(m.x-h.x,m.y-h.y)||1,y=(m.x-h.x)/c,g=(m.y-h.y)/c,x=m.x-y*d,k=m.y-g*d;l({type:"path",points:[{x:m.x,y:m.y},{x:x-g*d*.5,y:k+y*d*.5},{x:x+g*d*.5,y:k-y*d*.5}],fill:u,stroke:"none"});break}case "rect":{let h=o(s.from),m=o(s.to);l({type:"rect",x:Math.min(h.x,m.x),y:Math.min(h.y,m.y),w:Math.abs(m.x-h.x),h:Math.abs(m.y-h.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let h=o(s.at),m=s.color??"#334155",u=s.radius??p.annotationRadius,d=s.shape??"circle";d==="circle"?l({type:"circle",cx:h.x,cy:h.y,r:u,fill:m}):d==="square"?l({type:"rect",x:h.x-u,y:h.y-u,w:u*2,h:u*2,fill:m}):(l({type:"line",x1:h.x-u,y1:h.y-u,x2:h.x+u,y2:h.y+u,stroke:m,strokeWidth:1.5}),l({type:"line",x1:h.x-u,y1:h.y+u,x2:h.x+u,y2:h.y-u,stroke:m,strokeWidth:1.5}));break}case "label":{let h=o(s.at);l({type:"text",content:s.text,x:h.x+(s.dx??0),y:h.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:p.annotationFontSize,fill:s.color??p.annotationColor,rotate:s.rotate});break}}if(s.id&&a.length>0){let h=ee(s.id);r.push({type:"group",cssClass:`annotation annotation--${h}`,commands:a});}else r.push(...a);}return r}var K=12,Se=8,He=20,Vt=11,Ee=18,Ne=i=>[...i].length*Vt*.6;function dt(i,e="vertical"){if(e==="horizontal"){let n=0;for(let r of i)n+=K+Se+Ne(r.name)+Ee;return {width:Math.max(0,n-Ee),height:He}}let t=0;for(let n of i)t=Math.max(t,Ne(n.name));return {width:K+Se+t,height:i.length*He}}function ct(i){let{items:e,x:t,y:n,orientation:r="vertical"}=i,o=[],s=t;return e.forEach((a,l)=>{let h=r==="horizontal"?s:t,m=r==="horizontal"?n:n+l*He;o.push({type:"rect",x:h,y:m,w:K,h:K,fill:a.color,stroke:p.legendStroke,strokeWidth:1},{type:"text",content:a.name,x:h+K+Se,y:m+K-2,fontSize:p.legendFont,fill:p.legendText}),r==="horizontal"&&(s+=K+Se+Ne(a.name)+Ee);}),{type:"group",cssClass:"chart-legend",commands:o}}function pt(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=p.gridStroke,strokeWidth:s=p.gridStrokeWidth,dashed:a=false,opacity:l=p.gridOpacity}=i,h=[];if(t)for(let m of t)h.push({type:"line",x1:n[0],y1:m,x2:n[1],y2:m,stroke:o,strokeWidth:s,dashed:a,opacity:l});if(e)for(let m of e)h.push({type:"line",x1:m,y1:r[0],x2:m,y2:r[1],stroke:o,strokeWidth:s,dashed:a,opacity:l});return h}function Ge(i){return i!==void 0&&typeof i=="object"&&"series"in i?i.series:null}function ft(i){let e=[...i].sort((n,r)=>n.time-r.time),t=0;return n=>{for(;t>0&&e[t].time>n;)t--;for(;t<e.length-1&&e[t+1].time<=n;)t++;let r=e[t];if(!r||n<r.time)return null;if(r.time===n)return r.value??null;let o=e[t+1];if(!o||n>o.time||r.value===null||o.value===null)return null;let s=o.time-r.time;return s===0?r.value:r.value+(o.value-r.value)*(n-r.time)/s}}function gt(i,e,t){let n=i??e;if(n==="series")return null;if(n==="chartTop")return t.chartTop;if(n==="chartBottom")return t.chartBottom;if(typeof n=="object"&&"threshold"in n){let r=t.thresholds.get(n.threshold);if(!r)throw new Error(`fillSpec region references unknown threshold '${n.threshold}'`);return t.valueScale.map(r.value)}return typeof n=="object"&&"value"in n?t.valueScale.map(n.value):null}function zt(i){return typeof i=="string"?{color:i}:{color:i.color,hatch:i.hatch}}function yt(i,e,t){let n=gt(i.from,"chartBottom",e),r=gt(i.to,"series",e),{color:o,hatch:s}=zt(i.fill),a={type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},l=x=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${x}`}:{},h=Ge(i.from),m=Ge(i.to);if(h!==null||m!==null){if(!e.fremdeSerie)throw new Error(`fillSpec region references series '${h??m}', but no series lookup was provided`);let x=(R,T,B)=>{let j=R??T,M=Ge(j);if(M!==null){let $=e.fremdeSerie(M);if(!$)throw new Error(`fillSpec region references unknown series '${M}'`);let F=$.shape==="step"?re($.data):$.data;return {bei:ft(F),zeiten:F.map(_=>_.time)}}if(j==="series")return {bei:ft(B),zeiten:B.map($=>$.time)};let E=Ve(j,e),z=e.valueScale.domain(),S=E??(j==="chartBottom"?z[0]:z[1]);return {bei:()=>S,zeiten:[]}},k=e.shape==="step",D=[];for(let R of e.runs){if(R.length<2)continue;let T=k?re(R):R,B=x(i.from,"chartBottom",T),j=x(i.to,"series",T),M=T[0].time,E=T[T.length-1].time,z=[...new Set([...B.zeiten,...j.zeiten,...T.map(_=>_.time)])].filter(_=>_>=M&&_<=E).sort((_,L)=>_-L),S=[],$=[],F=()=>{if(S.length>=2){let _=[...$].reverse();D.push({...a,...l(D.length),smoothing:k?false:e.smoothing,smoothCount:S.length,points:[...S,..._]});}S=[],$=[];};for(let _ of z){let L=B.bei(_),O=j.bei(_);if(L===null||O===null){F();continue}let C=e.timeScale.map(_);S.push({x:C,y:e.valueScale.map(O)}),$.push({x:C,y:e.valueScale.map(L)});}F();}return D}if(n!==null&&r!==null){let x=e.timeScale.range(),k=x[0],D=x[1],R=Math.min(n,r),T=Math.max(n,r);return [{...a,...l(0),points:[{x:k,y:R},{x:D,y:R},{x:D,y:T},{x:k,y:T}]}]}let u=n??r,d=[],c=Yt(i,e);if(c===null){let x=e.valueScale.domain();c=(n??r)===e.chartBottom?x[0]:x[1];}let y=Ve(i.outer,e),g=e.shape==="step";for(let x of e.runs){if(x.length<2)continue;let k=g?re(x):x,D=V.splitByThreshold(k,c,T=>T.value??c,V.interpolateDataPoint),R=i.side==="above"?D.above:i.side==="below"?D.below:[...D.above,...D.below];if(y!==null&&i.side){let T=y,B=i.side==="above"?j=>Math.min(j,T):j=>Math.max(j,T);R=R.map(j=>j.map(M=>({...M,value:B(M.value??T)})));}for(let T of R){if(T.length<2)continue;let B=T.map(M=>({x:e.timeScale.map(M.time),y:e.valueScale.map(M.value)})),j=[];for(let M of [...B].reverse()){let E=j[j.length-1];g&&E&&E.x===M.x||j.push({x:M.x,y:u});}d.push({...a,...l(d.length),smoothing:g?false:e.smoothing,smoothCount:B.length,points:[...B,...j]});}}return d}function Yt(i,e){let t=i.from==="series"?i.to:i.from;return Ve(t,e)}function Ve(i,e){return i===void 0||i==="series"||i==="chartTop"||i==="chartBottom"?null:typeof i=="object"&&"threshold"in i?e.thresholds.get(i.threshold)?.value??null:typeof i=="object"&&"value"in i?i.value:null}function bt(i,e){if(typeof i=="string"||!("regions"in i))return yt({fill:i},e,0);let t=[];return i.regions.forEach((n,r)=>{t.push(...yt(n,e,r));}),t}function St(i){let e=i.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??p.stroke,width:t?.width??p.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false}}function xt(i,e,t,n,r){let o=i.filter(h=>h.value!==null);if(o.length<2)return [];let s=o.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(h.value)})),a=St(t);return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${r}-${n}`:`overlay-${r}-${n}`,points:s,stroke:a.color,strokeWidth:a.width,smoothing:a.smoothing,dash:a.dash,fill:"none"}]}function wt(i,e,t=0){switch(i.kind){case "movingAverage":{let n=i.type==="exponential"?rt(e.data,i.window):Ie(e.data,i.window);return xt(n,e,i,"movingAvg",t)}case "movingMkt":{let n=nt(e.data,i.window,i.activationEnergy);return xt(n,e,i,"movingMkt",t)}case "limits":{let n=[],r=e.timeScale.range(),o=r[0],s=r[1],a=St(i),l=a.color,h=a.width,m=a.dash??"dashed",u=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return i.high!==void 0&&n.push({type:"line",id:`${u}limit-high`,x1:o,y1:e.valueScale.map(i.high),x2:s,y2:e.valueScale.map(i.high),stroke:l,strokeWidth:h,dash:m}),i.low!==void 0&&n.push({type:"line",id:`${u}limit-low`,x1:o,y1:e.valueScale.map(i.low),x2:s,y2:e.valueScale.map(i.low),stroke:l,strokeWidth:h,dash:m}),n}case "stdDevBand":{let n=i.multiplier??1,r=Ie(e.data,i.window),o=it(e.data,i.window),s=[],a=[];for(let x=0;x<r.length;x++){let k=r[x].value,D=o[x].value;if(k===null||D===null)continue;let R=e.timeScale.map(r[x].time);s.push({x:R,y:e.valueScale.map(k+n*D)}),a.push({x:R,y:e.valueScale.map(k-n*D)});}if(s.length<2)return [];let l=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,h=[],u=(typeof i.style?.fill=="string"||i.style?.fill&&!("regions"in i.style.fill)?i.style.fill:void 0)??"#94a3b833",{color:d,hatch:c}=qt(u);h.push({type:"path",cssClass:"series-fill",id:`${l}stdDevBand`,points:[...s,...[...a].reverse()],fill:d,hatch:c,stroke:"none"});let y=i.style?.line,g=y&&!Array.isArray(y)?y:void 0;if(g){let x=r.filter(k=>k.value!==null).map(k=>({x:e.timeScale.map(k.time),y:e.valueScale.map(k.value)}));x.length>=2&&h.push({type:"path",cssClass:"series-line",id:`${l}stdDevBand-mean`,points:x,stroke:g.color??p.stroke,strokeWidth:g.width??1.5,smoothing:g.smoothing,dash:g.style,fill:"none"});}return h}}}function qt(i){return typeof i=="string"?{color:i}:{color:i.color,hatch:i.hatch}}function Xt(i){if(!i)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(i))return {gaps:i,autoDetect:false,minGapMs:6e4};let e=i.regions??[],t=i.style;return {gaps:e.map(r=>{let o={...t,...r.style},s=o.fill,a,l;return typeof s=="string"?a=s:s&&(a=s.color,l=s.hatch),{startTime:r.startTime,endTime:r.endTime,label:r.label,fill:a,hatch:l,fillOpacity:o.opacity,labelBaseline:o.label?.baseline,rotate:o.label?.rotate,style:o.display==="bridge_line"?void 0:o.display}}),autoDetect:i.autoDetect??false,minGapMs:i.minGapMs??6e4}}function Zt(i,e,t,n){if(n===void 0)return [i,e];let r=typeof n=="number"?n:n.top??0,o=typeof n=="number"?n:n.bottom??0;if(r<=0&&o<=0)return [i,e];let s=t-r-o,a=e-i;if(s<=0||a<=0)return [i,e];let l=a/s;return [i-o*l,e+r*l]}function he(i){return "showAs"in i&&!!i.showAs}function _t(i,e){if(e)for(let t of i)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&_t(t.commands,e);}var J=class{_layout;_renderer;_locale;_timeZone;_fontFamily;_legend;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsAutoDetect;_gapsMinGapMs;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;readonly_annotationBandHeight=0;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new se({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._legend=e.legend,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=Xt(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let n=t.height??12,r=t.spacing??0;(t.showAxis??false)&&(e+=26+r),e+=n+r;}return e}setData(e){this._series=e.filter(t=>Array.isArray(t.data));}addAnnotation(e){let t=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:t}),t}removeAnnotation(e){let t=this._annotations.length;return this._annotations=this._annotations.filter(n=>n.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<t}setAnnotations(e){this._annotations=[...e],this._disabledAnnotations.clear();}clearAnnotations(){this._annotations=[],this._disabledAnnotations.clear();}getAnnotations(){return this._annotations}disableAnnotation(e){this._disabledAnnotations.add(e);}enableAnnotation(e){this._disabledAnnotations.delete(e);}_axisIndexOf(e){return e.yAxisIndex??0}_timesOf(e){return e.data.map(t=>t.time)}_valuesOf(e){if(he(e)){let t=[];for(let n of e.data)n.min!==null&&t.push(n.min),n.max!==null&&t.push(n.max);return t}return e.data.map(t=>t.value).filter(t=>t!==null)}renderCommands(){if(this._series.length===0)return [];let e=this._legendItems(),t=(this._legend?.show??false)&&e.length>0,n=this._legend?.position??"inside-right",r=this._legend?.orientation??"vertical",o=t?dt(e,r):{width:0},s=this._layout;if(t&&(n==="outside-right"||n==="outside-left")){let f=o.width+16,w={...this._layout.margin};n==="outside-right"?w.right+=f:w.left+=f,s=new se({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:w}).compute();}let{chartX:a,chartY:l,chartWidth:h,chartHeight:m}=s,u=[a,a+h],d=[l,l+m],c=[];for(let f of this._series)f.data.sort((w,v)=>w.time-v.time);let y=new Map,g=1/0,x=-1/0,k=false;for(let f of this._series){let w=this._axisIndexOf(f),v=y.get(w);v?v.push(f):y.set(w,[f]);for(let P of this._timesOf(f))P<g&&(g=P),P>x&&(x=P),k=true;}if(!k)return [];let D=this._axes?.x?.domain,R=D&&D!=="auto"?D:[g,x];this._timeScale=new te({domain:R,range:u,locale:this._locale,timeZone:this._timeZone});let T=f=>({axisColor:f?.color??p.axisColor,tickColor:f?.color??p.tickColor,textColor:p.textColor,textSize:p.textSize,axisWidth:f?.width??1}),B=new ie({domain:R,xRange:u,y:l+m,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,colors:T(this._axes?.x?.axis)});this._valueScales.clear();let j=Array.from(y.keys()).sort((f,w)=>f-w),M,E=0,z=0;for(let f of j){let w=y.get(f),v=1/0,P=-1/0,W=false;for(let N of w)for(let ue of this._valuesOf(N))ue<v&&(v=ue),ue>P&&(P=ue),W=true;if(!W)continue;v===P&&(v-=1,P+=1);let H;this._axes?.y&&this._axes.y.length>f?H=this._axes.y[f]:f===0?H=this._axes?.left:f===1&&(H=this._axes?.right);let Le=H?.domain,Q=Le&&Le!=="auto"?Le:Zt(v,P,m,H?.padding),Ze=new U({domain:Q,range:[l+m,l]});this._valueScales.set(f,Ze);let Ue=this._thresholds.filter(N=>(N.axisIndex??0)===f&&N.label!==void 0&&N.label!==null&&N.label!==false&&N.value>=Math.min(Q[0],Q[1])&&N.value<=Math.max(Q[0],Q[1])).map(N=>Ze.map(N.value)),Me=H?.position??(f===0?"left":"right"),Pe;if(Me==="right"){let N=H?.offset??z*50;Pe=a+h+N,z++;}else {let N=H?.offset??E*50;Pe=a-N,E++;}let Ke=new ce({domain:Q,range:[l+m,l],x:Pe,position:Me,format:H?.format,ticks:H?.ticks?.major,colors:T(H?.axis),suppressLabelsNear:Ue.length?Ue:void 0});f===0&&(M=Ke),c.push({type:"group",cssClass:`value-axis ${Me}`,commands:Ke.render()});}let S=this._valueScales.get(0)??this._valueScales.get(j[0]);c.push({type:"group",cssClass:"time-axis",commands:B.render()});let $=null,F=this._axes?.x?.grid?.major,_=this._axes?.left?.grid?.major;if(F!==void 0||_!==void 0){let f=F!==false,w=_!==false&&!!M,v=f?B.generateTicks().map(W=>W.x):void 0,P=w?M.generateTicks().map(W=>W.position):void 0;if(v||P){let W=(F&&typeof F=="object"?F:void 0)??(_&&typeof _=="object"?_:void 0);$={type:"group",cssClass:"chart-grid",commands:pt({xTicks:v,yTicks:P,xRange:u,yRange:d,stroke:W?.color,opacity:W?.opacity,dashed:W?.style==="dashed"})};}}if(this._highlights.length>0&&c.push({type:"group",cssClass:"highlights",commands:ht({highlights:this._highlights,timeScale:this._timeScale,yRange:d,height:s.totalHeight})}),this._thresholds.length>0&&S){let f=[],w=[];for(let v of this._thresholds){let P=v.id??ee(v.name),W=this._valueScales.get(v.axisIndex??0)??S,H=at({thresholds:[v],valueScale:W,xRange:u});H.inside.length&&f.push({type:"group",cssClass:`threshold threshold--${P}`,id:`threshold-${P}`,commands:H.inside}),H.labels.length&&w.push({type:"group",cssClass:`threshold-label threshold-label--${P}`,commands:H.labels});}f.length&&c.push({type:"group",cssClass:"thresholds",commands:f,clipRect:{x:a,y:l,w:h,h:m}}),w.length&&c.push({type:"group",cssClass:"threshold-labels",commands:w});}let L=this._gaps;if(this._gapsAutoDetect){let f=[];for(let w of this._series){if(he(w))continue;let v=w.data.filter(P=>P.value!==null);f.push(...tt(v,this._gapsMinGapMs));}f.length>0&&(L=[...this._gaps,...f]);}L.length>0&&c.push({type:"group",cssClass:"gaps",commands:We({gaps:L,timeScale:this._timeScale,yRange:d,height:s.totalHeight})});let O=new Map(this._thresholds.map(f=>[f.id??f.name,f]));for(let f of this._series){if(f.data.length===0)continue;let w=this._valueScales.get(this._axisIndexOf(f));if(!w)continue;let v=ee(f.id??f.name);c.push({type:"group",cssClass:`series series--${v}`,id:`series-${v}`,commands:this._renderSeries(f,w,O),...this._clipSeries?{clipRect:{x:a,y:l,w:h,h:m}}:{}});}$&&c.push($);let C=this._markers.map(f=>({...f}));for(let f of C)if(f.value===void 0&&(f.lineStyle==="to-value"||f.lineStyle==="to-top")){let w=this._series[f.seriesIndex??0];w&&!he(w)&&w.data.length>=2&&(f.value=this._interpolateValue(f.time,w.data));}if(C.length>0&&S){let f=[];for(let w of C){let v=S,P=this._series[w.seriesIndex??0];P&&(v=this._valueScales.get(this._axisIndexOf(P))??S),f.push(...mt({markers:[w],timeScale:this._timeScale,valueScale:v,yRange:d}));}c.push({type:"group",cssClass:"markers",commands:f});}let A=this._annotations.filter(f=>!f.id||!this._disabledAnnotations.has(f.id));if(A.length>0&&c.push({type:"group",cssClass:"annotations",commands:ut({annotations:A,timeScale:this._timeScale,valueScales:this._valueScales})}),this._annotationBands.length>0){let f=l+m+this._layout.margin.bottom,w=0;this._annotationBands.forEach(v=>{let P=v.height??12,W=v.spacing??0,H=f+w;(v.showAxis??false)&&(w+=26+W),w+=P+W,c.push({type:"group",cssClass:"annotation-band",commands:new xe({name:v.name,showAxis:v.showAxis??false,items:v.items,timeScale:this._timeScale,background:v.background,hatch:v.hatch},[a,a+h],H,P).render()});});}if(t&&n!=="separate"){let f,w;n==="inside-right"?(f=a+h-o.width-8,w=l+8):n==="inside-left"?(f=a+8,w=l+8):n==="outside-right"?(f=a+h+16,w=l):(f=8,w=l),c.push(ct({items:e,x:f,y:w,orientation:r}));}let I=this._axes?.left?.label,Y=this._axes?.right?.label,G=this._axes?.x?.label;if(I||Y||G){let f=[],w=l+m/2,v=this._axes?.left?.labels,P=this._axes?.right?.labels,W=this._axes?.x?.labels;I&&f.push({type:"text",content:I,x:14,y:w,anchor:"middle",fontSize:v?.fontSize??p.axisLabelSize,fill:v?.color??p.axisLabelColor,rotate:-90}),Y&&f.push({type:"text",content:Y,x:s.totalWidth-14,y:w,anchor:"middle",fontSize:P?.fontSize??p.axisLabelSize,fill:P?.color??p.axisLabelColor,rotate:90}),G&&f.push({type:"text",content:G,x:a+h/2,y:s.totalHeight-6,anchor:"middle",fontSize:W?.fontSize??p.axisLabelSize,fill:W?.color??p.axisLabelColor}),f.length&&c.push({type:"group",cssClass:"axis-labels",commands:f});}return _t(c,this._fontFamily??p.fontFamily),c}_renderSeries(e,t,n){let r=this._timeScale,o={timeScale:r,valueScale:t};if(he(e)){let S=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,$=typeof e.style?.fill=="string"?e.style.fill:void 0;return e.showAs==="minmaxavg"?new ge({data:e.data,timeScale:r,valueScale:t,minColor:e.minColor,maxColor:e.maxColor,avgColor:e.avgColor,avgDashed:e.avgDashed,fillToMax:e.fillToMax,fillToMaxHatch:e.fillToMaxHatch,fillToMin:e.fillToMin,fillToMinHatch:e.fillToMinHatch,smoothing:S?.smoothing,strokeWidth:S?.width,id:Z(e.name,e.id)}).render():new ye({data:e.data,timeScale:r,valueScale:t,fill:$??S?.color,avgLine:e.avgLine,countOpacity:e.countOpacity,id:Z(e.name,e.id)}).render()}let s=e,a=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,l=this._gapsAutoDetect?this._gapsMinGapMs:void 0,h=a?.gapThreshold??l??p.gapThreshold,m=V.getRuns(e.data,S=>S.value===null,h),u=m.reduce((S,$)=>S+$.length,0);if(u===0)return [];let d=[],c=e.style?.markers,y=e.style?.shadow,g={stroke:a?.color??p.stroke,strokeWidth:a?.width??p.strokeWidth,smoothing:a?.smoothing,dashed:a?.style==="dashed",pointStyle:c?.type,pointSize:c?.size,pointStroke:c?.stroke,pointFill:c?.fill,pointStrokeWidth:c?.strokeWidth,shadowColor:y?.color,shadowBlur:y?.blur,shadowOffsetX:y?.offsetX,shadowOffsetY:y?.offsetY,id:Z(e.name,e.id)},x=e.style?.line,D=((Array.isArray(x)?x[0]:a)?.shape??s.seriesType)==="step",R=e.style?.fill;if(R!==void 0){let S=t.range(),$=Math.min(S[0],S[1]),F=Math.max(S[0],S[1]);d.push(...bt(R,{runs:m,timeScale:r,valueScale:t,thresholds:n,chartTop:$,chartBottom:F,smoothing:a?.smoothing,shape:D?"step":"line",fremdeSerie:_=>{let L=this._series.find(G=>(G.id??G.name)===_||G.name===_);if(!L||!("data"in L))return;let O=L.data;if(O.length===0||!("value"in O[0]))return;let C=L.style?.line,A=Array.isArray(C)?C[0]:C,Y=(typeof A=="object"&&A!==null?A.shape:void 0)==="step"||L.seriesType==="step";return {data:O,shape:Y?"step":"line"}},idPrefix:Z(e.name,e.id)}));}let T=s.colorByThresholds??[],B=T.map(S=>n.get(S)).filter(S=>!!S).map(S=>S.value).sort((S,$)=>S-$),j=(S,$,F)=>{let _=F??g.stroke,L=Number.NEGATIVE_INFINITY;for(let O of $){let C=n.get(O);!C||S<C.value||C.value<L||(L=C.value,_=C.color??_);}return _},M=new Map;for(let S of m){let _=function(C){return V.splitByBoundaries(C==="step"?re(S):S,B,A=>A.value,V.interpolateDataPoint)};if(S.length<2)continue;let $=Z(s.name,s.id),F=new Map,L=C=>{let A=F.get(C);return A||(A=_(C),F.set(C,A)),A},O=(C,A,I)=>{let Y=L(C);for(let G=0;G<Y.length;G++){let f=Y[G],w=M.get(I)??0;if(M.set(I,w+1),f.data.length<2)continue;let v=f.zoneLow;d.push({type:"path",cssClass:"series-line",id:$?`${$}-line-${w}${I}`:void 0,points:f.data.map(P=>({x:r.map(P.time),y:t.map(P.value)})),stroke:j(v,T,A.color),strokeWidth:A.width??g.strokeWidth,smoothing:C==="step"?false:A.smoothing??g.smoothing,dash:A.style,opacity:A.opacity,fill:"none",shadowColor:g.shadowColor,shadowBlur:g.shadowBlur,shadowOffsetX:g.shadowOffsetX,shadowOffsetY:g.shadowOffsetY});}};x===false||(Array.isArray(x)?x.forEach((C,A)=>{O(C.shape??(s.seriesType==="step"?"step":"line"),C,`-${A}`);}):O(D?"step":"line",x??{},"")),g.pointStyle&&g.pointStyle!=="none"&&u<=(c?.threshold??p.pointThreshold)&&d.push(...st(S,o,g,C=>j(C.value,T)));}let E=e.overlays;if(E&&E.length>0){let S=t.range(),$={data:e.data,timeScale:r,valueScale:t,chartTop:Math.min(S[0],S[1]),chartBottom:Math.max(S[0],S[1]),idPrefix:Z(e.name,e.id)};E.forEach((F,_)=>{d.push(...wt(F,$,_));});}if(e.style?.gap&&m.length>1){let S=e.style.gap,$=S.bridge,F=[];for(let _=1;_<m.length;_++){let L=m[_-1][m[_-1].length-1],O=m[_][0];if(S.display==="bridge_line"){if(L.value===null||O.value===null)continue;d.push({type:"line",x1:r.map(L.time),y1:t.map(L.value),x2:r.map(O.time),y2:t.map(O.value),stroke:$?.color??(typeof e.style?.line=="object"&&!Array.isArray(e.style.line)?e.style.line.color:void 0)??p.stroke,strokeWidth:$?.width??1.5,dash:$?.style??"dotted"});}else F.push({startTime:L.time,endTime:O.time});}if(F.length>0){let _=S.display&&S.display!=="bridge_line"?S.display:"dashed_border",L=S.fill,O=typeof L=="string"?L:L?.color,C=t.range();d.push(...We({gaps:F.map(A=>({...A,style:_})),timeScale:r,yRange:[Math.min(C[0],C[1]),Math.max(C[0],C[1])],fill:O,hatch:typeof L=="object"?L.hatch:void 0,fillOpacity:S.opacity??.15,labelBaseline:S.label?.baseline,labelRotate:S.label?.rotate}));}}return d}_interpolateValue(e,t){for(let n=1;n<t.length;n++){let r=t[n-1],o=t[n];if(!(r.value===null||o.value===null)&&e>=r.time&&e<=o.time){if(o.time===r.time)return r.value;let s=(e-r.time)/(o.time-r.time);return r.value+s*(o.value-r.value)}}}legendItems(){return this._legendItems()}_legendItems(){return this._series.map(e=>{let t=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,n=e.style?.markers,r=n?.type&&n.type!=="none"&&(n.threshold===void 0||(e.data?.length??0)<=n.threshold),o=he(e)?e.avgColor??p.avgColor:p.stroke;return {name:e.name,color:t?.color??o,line:t?.style,marker:r?n.type:void 0}})}get renderer(){return this._renderer}get layout(){return this._layout}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let n=this._valueScales.get(t);return n?n.invert(e):0}project(e,t,n=0){let r=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(n);return {x:r,y:o?o.map(t):0}}};var we=class{};var ze="1.9.0";var Ut=` <!-- MLTimeGraph ${ze} -->`,kt=1e3;function b(i){return String(Math.round(i*kt)/kt)}function Ye(i){return Fe(i).toString(16).padStart(8,"0")}function Kt(i){switch(i){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var X=class extends we{#e="100%";#t="100%";#n;#i=new Map;#r=new Map;#o=new Map;constructor(e){super(),e?.width!==void 0&&(this.#e=e.width),e?.height!==void 0&&(this.#t=e.height),e?.background!==void 0&&(this.#n=e.background);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#r.clear(),this.#o.clear();let t=e.map(h=>this._toSVG(h));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let n=t.join(`
25
- `),r="",o=[];for(let[,h]of this.#i)o.push(h);for(let[,h]of this.#r)o.push(h);for(let[,h]of this.#o)o.push(h);o.length>0&&(r=` <defs>
24
+ `.trim()}function Ge(i,e=2,t=false){return i==="dashed"||!i&&t?{strokeDasharray:"4,4"}:i==="dotted"?{strokeDasharray:"2,4"}:!i||i==="solid"?null:at(i,e)}function at(i,e=2){let t=e;switch(i){case "dotted":return {strokeDasharray:`0, ${t*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${t*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${t*3}, ${t*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${t*6}, ${t*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${t*1.5}, ${t*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${t*4}, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${t*5}, ${t*2}, 0, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${t*3}, ${t*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var f=new Proxy({},{get:(i,e)=>me()[e],has:(i,e)=>e in me(),ownKeys:()=>Reflect.ownKeys(me()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(me(),e)});var fe={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},ue=class{#e;#t;constructor(e){this.#e=new he({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??fe).axisColor}get tickColor(){return (this.#t.colors??fe).tickColor}get textColor(){return (this.#t.colors??fe).textColor}get textSize(){return (this.#t.colors??fe).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??fe,n=this.#t.y??0,r=[],[o,s]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let a of e)r.push({type:"line",x1:a.x,y1:n,x2:a.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:a.label,x:a.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}};var ge={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Gt(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function Vt(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var Se=class{#e;#t;constructor(e){this.#e=new te({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??ge).axisColor}get tickColor(){return (this.#t.colors??ge).tickColor}get textColor(){return (this.#t.colors??ge).textColor}get textSize(){return (this.#t.colors??ge).textSize}generateTicks(){let e=this.#t.format??Gt,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,r]=this.#e.domain(),o=Math.min(n,r),s=Math.max(n,r),a=s-o;if(a===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let h=a/t,l=Math.pow(10,Math.floor(Math.log10(h))),m=h/l,u;if(m<=1.5?u=l:m<=3?u=2*l:m<=7?u=5*l:u=10*l,u<=0||!Number.isFinite(u))return [{value:n,position:this.#e.map(n),label:e(n)}];let c=[],d=Math.ceil(o/u)*u;for(let g=d;g<=s;g+=u)c.push({value:g,position:this.#e.map(g),label:e(g)});return c}render(){let e=this.generateTicks(),t=this.#t.colors??ge,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],a=this.#t.suppressTolerancePx??8,h=m=>s.some(u=>Math.abs(u-m)<=a),l=[];if(r==="vertical"){let[m,u]=this.#e.range();l.push({type:"line",x1:n,y1:m,x2:n,y2:u,stroke:t.axisColor,strokeWidth:t.axisWidth});let c=Vt(e);e.forEach((d,g)=>{let p=h(d.position),b=c[g]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),p||l.push({type:"text",content:d.label,x:n-8,y:d.position+4,anchor:"end",fontSize:11,fill:t.textColor,...b})):(l.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),p||l.push({type:"text",content:d.label,x:n+8,y:d.position+4,anchor:"start",fontSize:11,fill:t.textColor,...b}));});}else {let[m,u]=this.#e.range();l.push({type:"line",x1:m,y1:n,x2:u,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let c of e)l.push({type:"line",x1:c.position,y1:n,x2:c.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),l.push({type:"text",content:c.label,x:c.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return l}};var V=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0))}}static interpolateAggregatedPoint(i,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((a,h)=>a.time-h.time),r=[],o=[],s=null;for(let a of n){let h=e(a),l=t>0&&s&&a.time-s.time>t;(h||l)&&o.length&&(r.push(o),o=[]),h||o.push(a),s=a;}return o.length&&r.push(o),r}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((l,m)=>l-m),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:r[l-1],a=l=>{let m=0;for(let u=0;u<r.length&&l>=r[u];u++)m=u+1;return m},h=[i[0]];for(let l=1;l<i.length;l++){let m=i[l-1],u=i[l],c=t(m),d=t(u),g;d>c?g=r.filter(b=>b>c&&b<=d):d<c?g=r.filter(b=>b>=d&&b<c).reverse():g=[];let p=c;for(let b of g){let _=(b-c)/(d-c),C=n(m,u,_);h.push(C);let A=a((p+b)/2);o.push({data:h,zoneIndex:A,zoneLow:s(A)}),h=[C],p=b;}(g.length===0||g[g.length-1]!==d)&&h.push(u);}if(h.length>1||i.length===1){let l=t(h[0]),m=t(h[h.length-1]),u=a((l+m)/2);o.push({data:h,zoneIndex:u,zoneLow:s(u)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let s of r)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};function lt(i,e=6e4){if(i.length<2)return [];let t=[...i].sort((r,o)=>r.time-o.time),n=[];for(let r=1;r<t.length;r++)t[r].time-t[r-1].time>e&&n.push({startTime:t[r-1].time,endTime:t[r].time});return n}function zt(i,e=83144){let t=e/8.314,n=0,r=0;for(let s of i)s!==null&&(n+=Math.exp(-t/(s+273.15)),r++);if(r===0)return null;let o=n/r;return t/-Math.log(o)-273.15}function ht(i,e,t=83144){let n=new Array(i.length),r=0;for(let o=0;o<i.length;o++){let s=i[o].time,a=s-e;for(;r<o&&i[r].time<a;)r++;let h=i.slice(r,o+1).map(m=>m.value),l=zt(h,t);n[o]={time:s,value:l,synthetic:true};}return n}function Yt(i){let e=0,t=0;for(let o of i)o!==null&&(e+=o,t++);if(t===0)return null;let n=e/t,r=0;for(let o of i){if(o===null)continue;let s=o-n;r+=s*s;}return Math.sqrt(r/t)}function Xt(i){let e=0,t=0;for(let o of i)o!==null&&(e+=o,t++);if(t<2)return null;let n=e/t,r=0;for(let o of i){if(o===null)continue;let s=o-n;r+=s*s;}return Math.sqrt(r/(t-1))}function mt(i,e,t=false){let n=new Array(i.length),r=0,o=t?Xt:Yt;for(let s=0;s<i.length;s++){let a=i[s].time,h=a-e;for(;r<s&&i[r].time<h;)r++;let l=i.slice(r,s+1).map(u=>u.value),m=o(l);n[s]={time:a,value:m,synthetic:true};}return n}function Ve(i,e){let t=new Array(i.length),n=0;for(let r=0;r<i.length;r++){let o=i[r].time,s=o-e;for(;n<r&&i[n].time<s;)n++;let a=0,h=0;for(let l=n;l<=r;l++){let m=i[l].value;m!==null&&(a+=m,h++);}t[r]={time:o,value:h===0?null:a/h,synthetic:true};}return t}function ut(i,e){let t=new Array(i.length),n=null,r=0;for(let o=0;o<i.length;o++){let s=i[o].time,a=i[o].value;if(a===null){t[o]={time:s,value:n,synthetic:true};continue}if(n===null||e<=0)n=a;else {let h=1-Math.exp(-(s-r)/e);n=a*h+n*(1-h);}r=s,t[o]={time:s,value:n,synthetic:true};}return t}function dt(i){return {id:i.id,line:{stroke:i.stroke??f.stroke,strokeWidth:i.strokeWidth??f.strokeWidth,smoothing:i.smoothing??false,dashed:i.dashed??false},fill:i.fill??f.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??f.pointSize,stroke:i.stroke??f.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function we(i,e,t){let n=[];i.reduce((s,a)=>s+a.data.length,0);let o=dt(t);for(let s=0;s<i.length;s++){let a=i[s];a.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${s}`:void 0,points:a.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(h.value)})),stroke:a.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:o.line.smoothing,dashed:o.line.dashed,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur,shadowOffsetX:o.shadow.offsetX,shadowOffsetY:o.shadow.offsetY,fill:"none"}):a.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${s}`:void 0,cx:e.timeScale.map(a.data[0].time),cy:e.valueScale.map(a.data[0].value),r:Math.max(o.markers.size,o.line.strokeWidth),fill:a.color??o.line.stroke,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur});}return n}function de(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function ze(i,e,t,n){if(i.length<2)return [];let r=V.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<r.length;s++){let a=r[s];if(a.data.length<2)continue;let h=t.getColor(a.zoneIndex);if(!h)continue;let l=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yLow(u))})),m=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yHigh(u))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...l,...m],fill:h,hatch:t.getHatch?.(a.zoneIndex),stroke:"none"});}return o}function ct(i,e,t,n){let r=dt(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let s=0;s<i.length;s++){let a=i[s],h=e.timeScale.map(a.time),l=e.valueScale.map(a.value),m=n(a),u=t.pointStroke??m,c=t.pointFill??m,d=t.pointStrokeWidth??1.5,g=t.id?`${t.id}-marker-${s}`:void 0;_e(o,g,r.markers.type,h,l,r.markers.size,u,c,d);}return o}function _e(i,e,t,n,r,o,s,a,h){switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:a,stroke:s,strokeWidth:h,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:a,stroke:s,strokeWidth:h,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:s,strokeWidth:h,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:s,strokeWidth:h,id:e});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:a,stroke:s,strokeWidth:h,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:a,stroke:s,strokeWidth:h,id:e});break;case "star":{let l=[];for(let m=0;m<10;m++){let u=m%2===0?o:o*.5,c=Math.PI/2*3+m*Math.PI/5;l.push({x:n+u*Math.cos(c),y:r+u*Math.sin(c)});}i.push({type:"path",points:l,closed:true,fill:a,stroke:s,strokeWidth:h,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:s,strokeWidth:h,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:h,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:s,strokeWidth:h,id:e});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:a,stroke:s,strokeWidth:h,id:e});break;case "hexagon":{let l=[];for(let m=0;m<6;m++){let u=m*(Math.PI/3);l.push({x:n+o*Math.cos(u),y:r+o*Math.sin(u)});}i.push({type:"path",points:l,closed:true,fill:a,stroke:s,strokeWidth:h,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:a,stroke:s,strokeWidth:h,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:h,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:a,stroke:s,strokeWidth:h,id:e});}}var ce=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var ke=class extends ce{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,r=e.avgColor??f.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.strokeWidth??f.strokeWidth,h=V.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(h.length===0)return [];let l={timeScale:this.timeScale,valueScale:e.valueScale},m=[];h.forEach((d,g)=>{d.length<2||(e.fillToMax&&m.push(...ze(d,l,{boundaries:[],yLow:p=>p.avg,yHigh:p=>p.max,getValue:p=>p.avg,interpolate:V.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${g}`:void 0})),e.fillToMin&&m.push(...ze(d,l,{boundaries:[],yLow:p=>p.avg,yHigh:p=>p.min,getValue:p=>p.avg,interpolate:V.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${g}`:void 0})));});let u=h.filter(d=>d.length>=2),c=d=>u.map(g=>({data:g.map(p=>({time:p.time,value:d(p)}))}));return m.push(...we(c(d=>d.max),l,{stroke:n,strokeWidth:a,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...we(c(d=>d.min),l,{stroke:t,strokeWidth:a,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...we(c(d=>d.avg),l,{stroke:r,strokeWidth:a,smoothing:s,dashed:o,id:this.id?`${this.id}-avg`:void 0})),m}};var ve=class extends ce{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??f.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??f.bandAvgLine,s=e.bandWidth??10,a=[];for(let h of this.data){if(h.min===null||h.max===null)continue;let l=this.timeScale.map(h.time),m=e.valueScale.map(h.max),u=e.valueScale.map(h.min),c=s,d=this.data.indexOf(h);if(a.push({type:"rect",x:l-c/2,y:m,w:c,h:u-m,fill:t,hatch:n,opacity:this.opacity(h.count),id:this.id?`${this.id}-slot-${d}`:void 0}),r&&h.avg!==null){let g=e.valueScale.map(h.avg);a.push({type:"line",x1:l-c/2,y1:g,x2:l+c/2,y2:g,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${d}`:void 0});}}return a}};function Ut(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function pt(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[s,a]=t.range(),h=Math.min(s,a),l=Math.max(s,a),m=[],u=[];for(let c of e){let d=c.color??f.thresholdColor,g=t.map(c.value);c.fill==="above"?m.push({type:"rect",x:r,y:h,w:o-r,h:Math.max(0,g-h),fill:d,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&m.push({type:"rect",x:r,y:g,w:o-r,h:Math.max(0,l-g),fill:d,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let p=c.line??f.thresholdLine;if(p!=="none"){let b=Ut(p),_={type:"line",x1:r,y1:g,x2:o,y2:g,stroke:d,strokeWidth:1,...b,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(_.shadowColor=c.shadowColor,_.shadowBlur=c.shadowBlur??4,_.shadowOffsetX=c.shadowOffsetX??0,_.shadowOffsetY=c.shadowOffsetY??2),m.push(_);}if(c.label!==void 0&&c.label!==null&&c.label!==false){let b=typeof c.label=="object"?c.label:void 0,_=typeof c.label=="string"?c.label:b?.text??c.name,C=b?.position??"right",A=Zt(_,C,r,o,g,d,b);u.push({...A,y:qt(A.y,Math.min(s,a),Math.max(s,a),f.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:m,labels:u}}function qt(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function Zt(i,e,t,n,r,o,s){let a=(t+n)/2,h={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},l=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...h,...l,x:t+4,y:r-4,anchor:"start"};case "above":return {...h,...l,x:a,y:r-6,anchor:"middle"};case "below":return {...h,...l,x:a,y:r+14,anchor:"middle"};case "center":return {...h,...l,x:a,y:r-4,anchor:"middle"};case "outside-left":return {...h,...l,x:t-6,y:r+3,anchor:"end",textBaseline:l.textBaseline??"middle"};case "outside-right":return {...h,...l,x:n+6,y:r+3,anchor:"start",textBaseline:l.textBaseline??"middle"};default:return {...h,...l,x:n-4,y:r-4,anchor:"end"}}}function ft(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Te(i){let{ranges:e,timeScale:t,yRange:n,height:r}=i,[o,s]=n,a=[],[h,l]=t.range(),m=Math.min(h,l),u=Math.max(h,l),c=d=>Math.max(m,Math.min(u,d));for(let d of e){let g=c(t.map(d.startTime)),p=c(t.map(d.endTime));if(d.fill!==void 0&&a.push({type:"rect",x:g,y:o,w:p-g,h:s-o,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let b of [g,p])a.push({type:"line",x1:b,y1:o,x2:b,y2:s,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});d.label&&a.push({type:"text",content:d.label,x:(g+p)/2,y:ft(d.labelPosition??"middle",o,s,r),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:d.rotate});}return a}function Ye(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=f.gapFill,hatch:s,fillOpacity:a=f.gapFillOpacity??.15,stroke:h=f.gapStroke,strokeWidth:l=f.gapStrokeWidth,dashed:m=true,fontSize:u=f.gapFontSize,fontFill:c=f.gapFontColor,labelBaseline:d="middle",labelRotate:g}=i;return Te({timeScale:t,yRange:n,height:r,ranges:e.map(p=>{let b=p.style??"dashed_border",_=b==="filled"||b==="dashed_border",C=b==="dashed_border"&&m!==false;return {startTime:p.startTime,endTime:p.endTime,..._&&{fill:p.fill??o,hatch:p.hatch??s,opacity:p.fillOpacity??a},...C&&{edges:{stroke:h,strokeWidth:l}},label:p.label,labelPosition:p.labelBaseline??d,labelColor:c,fontSize:u,rotate:p.rotate??g}})})}var Kt=1,Ce=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:s,y:a,height:h}=this.#e,l=[];n&&l.push({type:"rect",x:s[0],y:a,w:s[1]-s[0],h,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let m of e){let u=t.map(m.startTime),c=t.map(m.endTime);if(c<s[0]||u>s[1])continue;let d=Math.max(s[0],Math.min(s[1],u)),g=Math.max(s[0],Math.min(s[1],c)),p=Math.max(g-d,Kt);d+p>s[1]&&(d=Math.max(s[0],s[1]-p));let b=d+p/2;if(l.push({type:"rect",x:d,y:a,w:p,h,hatch:m.hatch??r,fill:m.fill??"#6b728044",stroke:m.stroke,strokeWidth:m.strokeWidth??0,title:m.title}),m.label){let _=m.labelFontSize??10;l.push({type:"text",content:m.label,x:b,y:this.#t(m.labelBaseline,_),anchor:"middle",fontSize:_,fill:m.labelFill??"#333"});}}if(o){let m=new ue({domain:t.domain(),xRange:s,y:a+h+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:m.render()});}return l}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};function gt(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Te({timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function yt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,s]=r,a=[];for(let h of e){let l=t.map(h.time),m=h.color??f.markerColor,u=h.pointStyle??(h.value!==void 0?"circle":"none"),c=h.lineStyle??"full";if(h.value!==void 0){let d=n.map(h.value);if(c==="to-value"?a.push({type:"line",x1:l,y1:s,x2:l,y2:d,stroke:m,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:d,stroke:m,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:m,strokeWidth:1}),u!=="none"&&_e(a,void 0,u,l,d,f.markerSize,m,m,1.5),h.label){let g=c==="to-value"?d-10:o-6;a.push({type:"text",content:h.label,x:l,y:g,anchor:"middle",fontSize:11,fill:m});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:m,strokeWidth:1}),h.label&&a.push({type:"text",content:h.label,x:l,y:o-6,anchor:"middle",fontSize:11,fill:m});}return a}function bt(i){let{annotations:e,timeScale:t,valueScales:n}=i,r=[],o=s=>{let a=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:a?a.map(s.value):0}};for(let s of e){let a=[],h=l=>a.push(l);switch(s.type){case "line":{let l=o(s.from),m=o(s.to);h({type:"line",x1:l.x,y1:l.y,x2:m.x,y2:m.y,stroke:s.color??f.annotationColor,strokeWidth:s.width??f.annotationWidth,dash:s.dash});break}case "arrow":{let l=o(s.from),m=o(s.to),u=s.color??f.annotationColor,c=s.headSize??f.annotationHead;h({type:"line",x1:l.x,y1:l.y,x2:m.x,y2:m.y,stroke:u,strokeWidth:s.width??f.annotationWidth});let d=Math.hypot(m.x-l.x,m.y-l.y)||1,g=(m.x-l.x)/d,p=(m.y-l.y)/d,b=m.x-g*c,_=m.y-p*c;h({type:"path",points:[{x:m.x,y:m.y},{x:b-p*c*.5,y:_+g*c*.5},{x:b+p*c*.5,y:_-g*c*.5}],fill:u,stroke:"none"});break}case "rect":{let l=o(s.from),m=o(s.to);h({type:"rect",x:Math.min(l.x,m.x),y:Math.min(l.y,m.y),w:Math.abs(m.x-l.x),h:Math.abs(m.y-l.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let l=o(s.at),m=s.color??"#334155",u=s.radius??f.annotationRadius,c=s.shape??"circle";c==="circle"?h({type:"circle",cx:l.x,cy:l.y,r:u,fill:m}):c==="square"?h({type:"rect",x:l.x-u,y:l.y-u,w:u*2,h:u*2,fill:m}):(h({type:"line",x1:l.x-u,y1:l.y-u,x2:l.x+u,y2:l.y+u,stroke:m,strokeWidth:1.5}),h({type:"line",x1:l.x-u,y1:l.y+u,x2:l.x+u,y2:l.y-u,stroke:m,strokeWidth:1.5}));break}case "label":{let l=o(s.at);h({type:"text",content:s.text,x:l.x+(s.dx??0),y:l.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:f.annotationFontSize,fill:s.color??f.annotationColor,rotate:s.rotate});break}}if(s.id&&a.length>0){let l=le(s.id);r.push({type:"group",cssClass:`annotation annotation--${l}`,commands:a});}else r.push(...a);}return r}var ne=12,$e=8,Xe=20,Jt=11,Ue=18,qe=i=>[...i].length*Jt*.6;function xt(i,e="vertical"){if(e==="horizontal"){let n=0;for(let r of i)n+=ne+$e+qe(r.name)+Ue;return {width:Math.max(0,n-Ue),height:Xe}}let t=0;for(let n of i)t=Math.max(t,qe(n.name));return {width:ne+$e+t,height:i.length*Xe}}function St(i){let{items:e,x:t,y:n,orientation:r="vertical"}=i,o=[],s=t;return e.forEach((a,h)=>{let l=r==="horizontal"?s:t,m=r==="horizontal"?n:n+h*Xe;o.push({type:"rect",x:l,y:m,w:ne,h:ne,fill:a.color,stroke:f.legendStroke,strokeWidth:1},{type:"text",content:a.name,x:l+ne+$e,y:m+ne-2,fontSize:f.legendFont,fill:f.legendText}),r==="horizontal"&&(s+=ne+$e+qe(a.name)+Ue);}),{type:"group",cssClass:"chart-legend",commands:o}}function wt(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=f.gridStroke,strokeWidth:s=f.gridStrokeWidth,dashed:a=false,opacity:h=f.gridOpacity}=i,l=[];if(t)for(let m of t)l.push({type:"line",x1:n[0],y1:m,x2:n[1],y2:m,stroke:o,strokeWidth:s,dashed:a,opacity:h});if(e)for(let m of e)l.push({type:"line",x1:m,y1:r[0],x2:m,y2:r[1],stroke:o,strokeWidth:s,dashed:a,opacity:h});return l}function Ze(i){return i!==void 0&&typeof i=="object"&&"series"in i?i.series:null}function _t(i){let e=[...i].sort((n,r)=>n.time-r.time),t=0;return n=>{for(;t>0&&e[t].time>n;)t--;for(;t<e.length-1&&e[t+1].time<=n;)t++;let r=e[t];if(!r||n<r.time)return null;if(r.time===n)return r.value??null;let o=e[t+1];if(!o||n>o.time||r.value===null||o.value===null)return null;let s=o.time-r.time;return s===0?r.value:r.value+(o.value-r.value)*(n-r.time)/s}}function kt(i,e,t){let n=i??e;if(n==="series")return null;if(n==="chartTop")return t.chartTop;if(n==="chartBottom")return t.chartBottom;if(typeof n=="object"&&"threshold"in n){let r=t.thresholds.get(n.threshold);if(!r)throw new Error(`fillSpec region references unknown threshold '${n.threshold}'`);return t.valueScale.map(r.value)}return typeof n=="object"&&"value"in n?t.valueScale.map(n.value):null}function Qt(i){return typeof i=="string"?{color:i}:{color:i.color,hatch:i.hatch}}function vt(i,e,t){let n=kt(i.from,"chartBottom",e),r=kt(i.to,"series",e),{color:o,hatch:s}=Qt(i.fill),a={type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},h=b=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${b}`}:{},l=Ze(i.from),m=Ze(i.to);if(l!==null||m!==null){if(!e.fremdeSerie)throw new Error(`fillSpec region references series '${l??m}', but no series lookup was provided`);let b=(A,k,B)=>{let F=A??k,P=Ze(F);if(P!==null){let L=e.fremdeSerie(P);if(!L)throw new Error(`fillSpec region references unknown series '${P}'`);let j=L.shape==="step"?de(L.data):L.data;return {bei:_t(j),zeiten:j.map(v=>v.time)}}if(F==="series")return {bei:_t(B),zeiten:B.map(L=>L.time)};let W=Ke(F,e),X=e.valueScale.domain(),S=W??(F==="chartBottom"?X[0]:X[1]);return {bei:()=>S,zeiten:[]}},_=e.shape==="step",C=[];for(let A of e.runs){if(A.length<2)continue;let k=_?de(A):A,B=b(i.from,"chartBottom",k),F=b(i.to,"series",k),P=k[0].time,W=k[k.length-1].time,X=[...new Set([...B.zeiten,...F.zeiten,...k.map(v=>v.time)])].filter(v=>v>=P&&v<=W).sort((v,M)=>v-M),S=[],L=[],j=()=>{if(S.length>=2){let v=[...L].reverse();C.push({...a,...h(C.length),smoothing:_?false:e.smoothing,smoothCount:S.length,points:[...S,...v]});}S=[],L=[];};for(let v of X){let M=B.bei(v),I=F.bei(v);if(M===null||I===null){j();continue}let T=e.timeScale.map(v);S.push({x:T,y:e.valueScale.map(I)}),L.push({x:T,y:e.valueScale.map(M)});}j();}return C}if(n!==null&&r!==null){let b=e.timeScale.range(),_=b[0],C=b[1],A=Math.min(n,r),k=Math.max(n,r);return [{...a,...h(0),points:[{x:_,y:A},{x:C,y:A},{x:C,y:k},{x:_,y:k}]}]}let u=n??r,c=[],d=en(i,e);if(d===null){let b=e.valueScale.domain();d=(n??r)===e.chartBottom?b[0]:b[1];}let g=Ke(i.outer,e),p=e.shape==="step";for(let b of e.runs){if(b.length<2)continue;let _=p?de(b):b,C=V.splitByThreshold(_,d,k=>k.value??d,V.interpolateDataPoint),A=i.side==="above"?C.above:i.side==="below"?C.below:[...C.above,...C.below];if(g!==null&&i.side){let k=g,B=i.side==="above"?F=>Math.min(F,k):F=>Math.max(F,k);A=A.map(F=>F.map(P=>({...P,value:B(P.value??k)})));}for(let k of A){if(k.length<2)continue;let B=k.map(P=>({x:e.timeScale.map(P.time),y:e.valueScale.map(P.value)})),F=[];for(let P of [...B].reverse()){let W=F[F.length-1];p&&W&&W.x===P.x||F.push({x:P.x,y:u});}c.push({...a,...h(c.length),smoothing:p?false:e.smoothing,smoothCount:B.length,points:[...B,...F]});}}return c}function en(i,e){let t=i.from==="series"?i.to:i.from;return Ke(t,e)}function Ke(i,e){return i===void 0||i==="series"||i==="chartTop"||i==="chartBottom"?null:typeof i=="object"&&"threshold"in i?e.thresholds.get(i.threshold)?.value??null:typeof i=="object"&&"value"in i?i.value:null}function Tt(i,e){if(typeof i=="string"||!("regions"in i))return vt({fill:i},e,0);let t=[];return i.regions.forEach((n,r)=>{t.push(...vt(n,e,r));}),t}function $t(i){let e=i.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??f.stroke,width:t?.width??f.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false}}function Ct(i,e,t,n,r){let o=i.filter(l=>l.value!==null);if(o.length<2)return [];let s=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})),a=$t(t);return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${r}-${n}`:`overlay-${r}-${n}`,points:s,stroke:a.color,strokeWidth:a.width,smoothing:a.smoothing,dash:a.dash,fill:"none"}]}function At(i,e,t=0){switch(i.kind){case "movingAverage":{let n=i.type==="exponential"?ut(e.data,i.window):Ve(e.data,i.window);return Ct(n,e,i,"movingAvg",t)}case "movingMkt":{let n=ht(e.data,i.window,i.activationEnergy);return Ct(n,e,i,"movingMkt",t)}case "limits":{let n=[],r=e.timeScale.range(),o=r[0],s=r[1],a=$t(i),h=a.color,l=a.width,m=a.dash??"dashed",u=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return i.high!==void 0&&n.push({type:"line",id:`${u}limit-high`,x1:o,y1:e.valueScale.map(i.high),x2:s,y2:e.valueScale.map(i.high),stroke:h,strokeWidth:l,dash:m}),i.low!==void 0&&n.push({type:"line",id:`${u}limit-low`,x1:o,y1:e.valueScale.map(i.low),x2:s,y2:e.valueScale.map(i.low),stroke:h,strokeWidth:l,dash:m}),n}case "stdDevBand":{let n=i.multiplier??1,r=Ve(e.data,i.window),o=mt(e.data,i.window),s=[],a=[];for(let b=0;b<r.length;b++){let _=r[b].value,C=o[b].value;if(_===null||C===null)continue;let A=e.timeScale.map(r[b].time);s.push({x:A,y:e.valueScale.map(_+n*C)}),a.push({x:A,y:e.valueScale.map(_-n*C)});}if(s.length<2)return [];let h=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,l=[],u=(typeof i.style?.fill=="string"||i.style?.fill&&!("regions"in i.style.fill)?i.style.fill:void 0)??"#94a3b833",{color:c,hatch:d}=tn(u);l.push({type:"path",cssClass:"series-fill",id:`${h}stdDevBand`,points:[...s,...[...a].reverse()],fill:c,hatch:d,stroke:"none"});let g=i.style?.line,p=g&&!Array.isArray(g)?g:void 0;if(p){let b=r.filter(_=>_.value!==null).map(_=>({x:e.timeScale.map(_.time),y:e.valueScale.map(_.value)}));b.length>=2&&l.push({type:"path",cssClass:"series-line",id:`${h}stdDevBand-mean`,points:b,stroke:p.color??f.stroke,strokeWidth:p.width??1.5,smoothing:p.smoothing,dash:p.style,fill:"none"});}return l}}}function tn(i){return typeof i=="string"?{color:i}:{color:i.color,hatch:i.hatch}}function nn(i){if(!i)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(i))return {gaps:i,autoDetect:false,minGapMs:6e4};let e=i.regions??[],t=i.style;return {gaps:e.map(r=>{let o={...t,...r.style},s=o.fill,a,h;return typeof s=="string"?a=s:s&&(a=s.color,h=s.hatch),{startTime:r.startTime,endTime:r.endTime,label:r.label,fill:a,hatch:h,fillOpacity:o.opacity,labelBaseline:o.label?.baseline,rotate:o.label?.rotate,style:o.display==="bridge_line"?void 0:o.display}}),autoDetect:i.autoDetect??false,minGapMs:i.minGapMs??6e4}}function rn(i,e,t,n){if(n===void 0)return [i,e];let r=typeof n=="number"?n:n.top??0,o=typeof n=="number"?n:n.bottom??0;if(r<=0&&o<=0)return [i,e];let s=t-r-o,a=e-i;if(s<=0||a<=0)return [i,e];let h=a/s;return [i-o*h,e+r*h]}function ye(i){return "showAs"in i&&!!i.showAs}function Lt(i,e){if(e)for(let t of i)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&Lt(t.commands,e);}function on(i,e,t){let r=new Array(i.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));for(let s of ["left","right"]){let a=s==="left",h=i.map((l,m)=>({t:l,i:m})).filter(l=>l.t.position===s).sort((l,m)=>a?m.t.achseX-l.t.achseX:l.t.achseX-m.t.achseX);for(let{t:l,i:m}of h){let u=l.schrift/2,c=o.filter(p=>p.position===s),d=l.kante,g=a?d-1-u:d+1+u;for(let p=0;p<=c.length;p++){let b=g-u-1,_=g+u+1,C=c.find(A=>b<A.bis&&A.von<_);if(!C)break;d=a?C.von:C.bis,g=a?d-1-u:d+1+u;}if(a?g-u<2:g+u>t-2){let p=o.filter(b=>b.position===s&&b.titel);g=a?u+2:t-u-2;for(let b=0;b<=p.length;b++){let _=g-u-1,C=g+u+1,A=p.find(k=>_<k.bis&&k.von<C);if(!A)break;g=a?A.bis+1+u:A.von-1-u;}}o.push({position:s,von:g-u-1,bis:g+u+1,titel:true}),r[m]=g;}}return r}var ie=class{_layout;_renderer;_locale;_timeZone;_fontFamily;_legend;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsAutoDetect;_gapsMinGapMs;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;readonly_annotationBandHeight=0;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new pe({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._legend=e.legend,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=nn(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let n=t.height??12,r=t.spacing??0;(t.showAxis??false)&&(e+=26+r),e+=n+r;}return e}setData(e){this._series=e.filter(t=>Array.isArray(t.data));}addAnnotation(e){let t=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:t}),t}removeAnnotation(e){let t=this._annotations.length;return this._annotations=this._annotations.filter(n=>n.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<t}setAnnotations(e){this._annotations=[...e],this._disabledAnnotations.clear();}clearAnnotations(){this._annotations=[],this._disabledAnnotations.clear();}getAnnotations(){return this._annotations}disableAnnotation(e){this._disabledAnnotations.add(e);}enableAnnotation(e){this._disabledAnnotations.delete(e);}_axisIndexOf(e){return e.yAxisIndex??0}_timesOf(e){return e.data.map(t=>t.time)}_valuesOf(e){if(ye(e)){let t=[];for(let n of e.data)n.min!==null&&t.push(n.min),n.max!==null&&t.push(n.max);return t}return e.data.map(t=>t.value).filter(t=>t!==null)}renderCommands(){if(this._series.length===0)return [];let e=this._legendItems(),t=(this._legend?.show??false)&&e.length>0,n=this._legend?.position??"inside-right",r=this._legend?.orientation??"vertical",o=t?xt(e,r):{width:0},s=this._layout;if(t&&(n==="outside-right"||n==="outside-left")){let y=o.width+16,w={...this._layout.margin};n==="outside-right"?w.right+=y:w.left+=y,s=new pe({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:w}).compute();}let{chartX:a,chartY:h,chartWidth:l,chartHeight:m}=s,u=[a,a+l],c=[h,h+m],d=[];for(let y of this._series)y.data.sort((w,$)=>w.time-$.time);let g=new Map,p=1/0,b=-1/0,_=false;for(let y of this._series){let w=this._axisIndexOf(y),$=g.get(w);$?$.push(y):g.set(w,[y]);for(let R of this._timesOf(y))R<p&&(p=R),R>b&&(b=R),_=true;}if(!_)return [];let C=this._axes?.x?.domain,A=C&&C!=="auto"?C:[p,b];this._timeScale=new he({domain:A,range:u,locale:this._locale,timeZone:this._timeZone});let k=y=>({axisColor:y?.color??f.axisColor,tickColor:y?.color??f.tickColor,textColor:f.textColor,textSize:f.textSize,axisWidth:y?.width??1}),B=new ue({domain:A,xRange:u,y:h+m,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,colors:k(this._axes?.x?.axis)});this._valueScales.clear();let F=Array.from(g.keys()).sort((y,w)=>y-w),P,W=[],X=[],S=(this._axes?.y?.length??0)>0,L=0,j=0;for(let y of F){let w=g.get(y),$=1/0,R=-1/0,H=false;for(let E of w)for(let ae of this._valuesOf(E))ae<$&&($=ae),ae>R&&(R=ae),H=true;if(!H)continue;$===R&&($-=1,R+=1);let Y=y===0?this._axes?.left:y===1?this._axes?.right:void 0,N=this._axes?.y&&this._axes.y.length>y?this._axes.y[y]:void 0,G=N&&Y?{...Y,...N}:N??Y,Ie=G?.domain,oe=Ie&&Ie!=="auto"?Ie:rn($,R,m,G?.padding),nt=new te({domain:oe,range:[h+m,h]});this._valueScales.set(y,nt);let it=this._thresholds.filter(E=>(E.axisIndex??0)===y&&E.label!==void 0&&E.label!==null&&E.label!==false&&E.value>=Math.min(oe[0],oe[1])&&E.value<=Math.max(oe[0],oe[1])).map(E=>nt.map(E.value)),se=G?.position??(y===0?"left":"right"),K;if(se==="right"){let E=G?.offset??j*50;K=a+l+E,j++;}else {let E=G?.offset??L*50;K=a-E,L++;}let Oe=new Se({domain:oe,range:[h+m,h],x:K,position:se,format:G?.format,ticks:G?.ticks?.major,colors:k(G?.axis),suppressLabelsNear:it.length?it:void 0}),rt=8+Oe.generateTicks().reduce((E,ae)=>Math.max(E,ae.label.length),0)*11*.6,We=se==="right"?K+rt:K-rt;X.push({position:se,von:Math.min(K,We),bis:Math.max(K,We)}),S&&G?.label&&W.push({text:G.label,achseX:K,kante:We,position:se,style:G.labels}),y===0&&(P=Oe),d.push({type:"group",cssClass:`value-axis ${se}`,commands:Oe.render()});}let v=this._valueScales.get(0)??this._valueScales.get(F[0]);d.push({type:"group",cssClass:"time-axis",commands:B.render()});let M=null,I=this._axes?.x?.grid?.major,T=this._axes?.left?.grid?.major;if(I!==void 0||T!==void 0){let y=I!==false,w=T!==false&&!!P,$=y?B.generateTicks().map(H=>H.x):void 0,R=w?P.generateTicks().map(H=>H.position):void 0;if($||R){let H=(I&&typeof I=="object"?I:void 0)??(T&&typeof T=="object"?T:void 0);M={type:"group",cssClass:"chart-grid",commands:wt({xTicks:$,yTicks:R,xRange:u,yRange:c,stroke:H?.color,opacity:H?.opacity,dashed:H?.style==="dashed"})};}}if(this._highlights.length>0&&d.push({type:"group",cssClass:"highlights",commands:gt({highlights:this._highlights,timeScale:this._timeScale,yRange:c,height:s.totalHeight})}),this._thresholds.length>0&&v){let y=[],w=[];for(let $ of this._thresholds){let R=$.id??le($.name),H=this._valueScales.get($.axisIndex??0)??v,Y=pt({thresholds:[$],valueScale:H,xRange:u});Y.inside.length&&y.push({type:"group",cssClass:`threshold threshold--${R}`,id:`threshold-${R}`,commands:Y.inside}),Y.labels.length&&w.push({type:"group",cssClass:`threshold-label threshold-label--${R}`,commands:Y.labels});}y.length&&d.push({type:"group",cssClass:"thresholds",commands:y,clipRect:{x:a,y:h,w:l,h:m}}),w.length&&d.push({type:"group",cssClass:"threshold-labels",commands:w});}let D=this._gaps;if(this._gapsAutoDetect){let y=[];for(let w of this._series){if(ye(w))continue;let $=w.data.filter(R=>R.value!==null);y.push(...lt($,this._gapsMinGapMs));}y.length>0&&(D=[...this._gaps,...y]);}D.length>0&&d.push({type:"group",cssClass:"gaps",commands:Ye({gaps:D,timeScale:this._timeScale,yRange:c,height:s.totalHeight})});let O=new Map(this._thresholds.map(y=>[y.id??y.name,y]));for(let y of this._series){if(y.data.length===0)continue;let w=this._valueScales.get(this._axisIndexOf(y));if(!w)continue;let $=le(y.id??y.name);d.push({type:"group",cssClass:`series series--${$}`,id:`series-${$}`,commands:this._renderSeries(y,w,O),...this._clipSeries?{clipRect:{x:a,y:h,w:l,h:m}}:{}});}M&&d.push(M);let U=this._markers.map(y=>({...y}));for(let y of U)if(y.value===void 0&&(y.lineStyle==="to-value"||y.lineStyle==="to-top")){let w=this._series[y.seriesIndex??0];w&&!ye(w)&&w.data.length>=2&&(y.value=this._interpolateValue(y.time,w.data));}if(U.length>0&&v){let y=[];for(let w of U){let $=v,R=this._series[w.seriesIndex??0];R&&($=this._valueScales.get(this._axisIndexOf(R))??v),y.push(...yt({markers:[w],timeScale:this._timeScale,valueScale:$,yRange:c}));}d.push({type:"group",cssClass:"markers",commands:y});}let z=this._annotations.filter(y=>!y.id||!this._disabledAnnotations.has(y.id));if(z.length>0&&d.push({type:"group",cssClass:"annotations",commands:bt({annotations:z,timeScale:this._timeScale,valueScales:this._valueScales})}),this._annotationBands.length>0){let y=h+m+this._layout.margin.bottom,w=0;this._annotationBands.forEach($=>{let R=$.height??12,H=$.spacing??0,Y=y+w;($.showAxis??false)&&(w+=26+H),w+=R+H,d.push({type:"group",cssClass:"annotation-band",commands:new Ce({name:$.name,showAxis:$.showAxis??false,items:$.items,timeScale:this._timeScale,background:$.background,hatch:$.hatch},[a,a+l],Y,R).render()});});}if(t&&n!=="separate"){let y,w;n==="inside-right"?(y=a+l-o.width-8,w=h+8):n==="inside-left"?(y=a+8,w=h+8):n==="outside-right"?(y=a+l+16,w=h):(y=8,w=h),d.push(St({items:e,x:y,y:w,orientation:r}));}let q=S?void 0:this._axes?.left?.label,Q=S?void 0:this._axes?.right?.label,re=this._axes?.x?.label;if(q||Q||re||W.length){let y=[],w=h+m/2,$=this._axes?.left?.labels,R=this._axes?.right?.labels,H=this._axes?.x?.labels;q&&y.push({type:"text",content:q,x:14,y:w,anchor:"middle",fontSize:$?.fontSize??f.axisLabelSize,fill:$?.color??f.axisLabelColor,rotate:-90}),Q&&y.push({type:"text",content:Q,x:s.totalWidth-14,y:w,anchor:"middle",fontSize:R?.fontSize??f.axisLabelSize,fill:R?.color??f.axisLabelColor,rotate:90});let Y=on(W.map(N=>({achseX:N.achseX,kante:N.kante,position:N.position,schrift:N.style?.fontSize??f.axisLabelSize})),X,s.totalWidth);W.forEach((N,G)=>{y.push({type:"text",content:N.text,x:Y[G],y:w,anchor:"middle",fontSize:N.style?.fontSize??f.axisLabelSize,fill:N.style?.color??f.axisLabelColor,rotate:N.position==="right"?90:-90});}),re&&y.push({type:"text",content:re,x:a+l/2,y:s.totalHeight-6,anchor:"middle",fontSize:H?.fontSize??f.axisLabelSize,fill:H?.color??f.axisLabelColor}),y.length&&d.push({type:"group",cssClass:"axis-labels",commands:y});}return Lt(d,this._fontFamily??f.fontFamily),d}_renderSeries(e,t,n){let r=this._timeScale,o={timeScale:r,valueScale:t};if(ye(e)){let S=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,L=typeof e.style?.fill=="string"?e.style.fill:void 0;return e.showAs==="minmaxavg"?new ke({data:e.data,timeScale:r,valueScale:t,minColor:e.minColor,maxColor:e.maxColor,avgColor:e.avgColor,avgDashed:e.avgDashed,fillToMax:e.fillToMax,fillToMaxHatch:e.fillToMaxHatch,fillToMin:e.fillToMin,fillToMinHatch:e.fillToMinHatch,smoothing:S?.smoothing,strokeWidth:S?.width,id:ee(e.name,e.id)}).render():new ve({data:e.data,timeScale:r,valueScale:t,fill:L??S?.color,avgLine:e.avgLine,countOpacity:e.countOpacity,id:ee(e.name,e.id)}).render()}let s=e,a=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,h=this._gapsAutoDetect?this._gapsMinGapMs:void 0,l=a?.gapThreshold??h??f.gapThreshold,m=V.getRuns(e.data,S=>S.value===null,l),u=m.reduce((S,L)=>S+L.length,0);if(u===0)return [];let c=[],d=e.style?.markers,g=e.style?.shadow,p={stroke:a?.color??f.stroke,strokeWidth:a?.width??f.strokeWidth,smoothing:a?.smoothing,dashed:a?.style==="dashed",pointStyle:d?.type,pointSize:d?.size,pointStroke:d?.stroke,pointFill:d?.fill,pointStrokeWidth:d?.strokeWidth,shadowColor:g?.color,shadowBlur:g?.blur,shadowOffsetX:g?.offsetX,shadowOffsetY:g?.offsetY,id:ee(e.name,e.id)},b=e.style?.line,C=((Array.isArray(b)?b[0]:a)?.shape??s.seriesType)==="step",A=e.style?.fill;if(A!==void 0){let S=t.range(),L=Math.min(S[0],S[1]),j=Math.max(S[0],S[1]);c.push(...Tt(A,{runs:m,timeScale:r,valueScale:t,thresholds:n,chartTop:L,chartBottom:j,smoothing:a?.smoothing,shape:C?"step":"line",fremdeSerie:v=>{let M=this._series.find(z=>(z.id??z.name)===v||z.name===v);if(!M||!("data"in M))return;let I=M.data;if(I.length===0||!("value"in I[0]))return;let T=M.style?.line,D=Array.isArray(T)?T[0]:T,U=(typeof D=="object"&&D!==null?D.shape:void 0)==="step"||M.seriesType==="step";return {data:I,shape:U?"step":"line"}},idPrefix:ee(e.name,e.id)}));}let k=s.colorByThresholds??[],B=k.map(S=>n.get(S)).filter(S=>!!S).map(S=>S.value).sort((S,L)=>S-L),F=(S,L,j)=>{let v=j??p.stroke,M=Number.NEGATIVE_INFINITY;for(let I of L){let T=n.get(I);!T||S<T.value||T.value<M||(M=T.value,v=T.color??v);}return v},P=new Map;for(let S of m){let v=function(T){return V.splitByBoundaries(T==="step"?de(S):S,B,D=>D.value,V.interpolateDataPoint)};if(S.length<1)continue;let L=ee(s.name,s.id),j=new Map,M=T=>{let D=j.get(T);return D||(D=v(T),j.set(T,D)),D},I=(T,D,O)=>{let U=M(T);for(let z=0;z<U.length;z++){let q=U[z],Q=P.get(O)??0;if(P.set(O,Q+1),q.data.length<1)continue;let re=q.zoneLow;if(q.data.length===1){let y=F(re,k,D.color);c.push({type:"circle",id:L?`${L}-dot-${Q}${O}`:void 0,cx:r.map(q.data[0].time),cy:t.map(q.data[0].value),r:Math.max(p.pointSize??f.pointSize,D.width??p.strokeWidth??f.strokeWidth),fill:y,shadowColor:p.shadowColor,shadowBlur:p.shadowBlur});continue}c.push({type:"path",cssClass:"series-line",id:L?`${L}-line-${Q}${O}`:void 0,points:q.data.map(y=>({x:r.map(y.time),y:t.map(y.value)})),stroke:F(re,k,D.color),strokeWidth:D.width??p.strokeWidth,smoothing:T==="step"?false:D.smoothing??p.smoothing,dash:D.style,opacity:D.opacity,fill:"none",shadowColor:p.shadowColor,shadowBlur:p.shadowBlur,shadowOffsetX:p.shadowOffsetX,shadowOffsetY:p.shadowOffsetY});}};b===false||(Array.isArray(b)?b.forEach((T,D)=>{I(T.shape??(s.seriesType==="step"?"step":"line"),T,`-${D}`);}):I(C?"step":"line",b??{},"")),p.pointStyle&&p.pointStyle!=="none"&&u<=(d?.threshold??f.pointThreshold)&&c.push(...ct(S,o,p,T=>F(T.value,k)));}let W=e.overlays;if(W&&W.length>0){let S=t.range(),L={data:e.data,timeScale:r,valueScale:t,chartTop:Math.min(S[0],S[1]),chartBottom:Math.max(S[0],S[1]),idPrefix:ee(e.name,e.id)};W.forEach((j,v)=>{c.push(...At(j,L,v));});}if(e.style?.gap&&m.length>1){let S=e.style.gap,L=S.bridge,j=[];for(let v=1;v<m.length;v++){let M=m[v-1][m[v-1].length-1],I=m[v][0];if(S.display==="bridge_line"){if(M.value===null||I.value===null)continue;c.push({type:"line",x1:r.map(M.time),y1:t.map(M.value),x2:r.map(I.time),y2:t.map(I.value),stroke:L?.color??(typeof e.style?.line=="object"&&!Array.isArray(e.style.line)?e.style.line.color:void 0)??f.stroke,strokeWidth:L?.width??1.5,dash:L?.style??"dotted"});}else j.push({startTime:M.time,endTime:I.time});}if(j.length>0){let v=S.display&&S.display!=="bridge_line"?S.display:"dashed_border",M=S.fill,I=typeof M=="string"?M:M?.color,T=t.range();c.push(...Ye({gaps:j.map(D=>({...D,style:v})),timeScale:r,yRange:[Math.min(T[0],T[1]),Math.max(T[0],T[1])],fill:I,hatch:typeof M=="object"?M.hatch:void 0,fillOpacity:S.opacity??.15,labelBaseline:S.label?.baseline,labelRotate:S.label?.rotate}));}}return c}_interpolateValue(e,t){for(let n=1;n<t.length;n++){let r=t[n-1],o=t[n];if(!(r.value===null||o.value===null)&&e>=r.time&&e<=o.time){if(o.time===r.time)return r.value;let s=(e-r.time)/(o.time-r.time);return r.value+s*(o.value-r.value)}}}legendItems(){return this._legendItems()}_legendItems(){return this._series.map(e=>{let t=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,n=e.style?.markers,r=n?.type&&n.type!=="none"&&(n.threshold===void 0||(e.data?.length??0)<=n.threshold),o=ye(e)?e.avgColor??f.avgColor:f.stroke;return {name:e.name,color:t?.color??o,line:t?.style,marker:r?n.type:void 0}})}get renderer(){return this._renderer}get layout(){return this._layout}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let n=this._valueScales.get(t);return n?n.invert(e):0}project(e,t,n=0){let r=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(n);return {x:r,y:o?o.map(t):0}}};var Ae=class{};var Je="1.9.1";var sn=` <!-- MLTimeGraph ${Je} -->`,Dt=1e3;function x(i){return String(Math.round(i*Dt)/Dt)}function Qe(i){return He(i).toString(16).padStart(8,"0")}function an(i){switch(i){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var J=class extends Ae{#e="100%";#t="100%";#n;#i=new Map;#r=new Map;#o=new Map;constructor(e){super(),e?.width!==void 0&&(this.#e=e.width),e?.height!==void 0&&(this.#t=e.height),e?.background!==void 0&&(this.#n=e.background);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#r.clear(),this.#o.clear();let t=e.map(l=>this._toSVG(l));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let n=t.join(`
25
+ `),r="",o=[];for(let[,l]of this.#i)o.push(l);for(let[,l]of this.#r)o.push(l);for(let[,l]of this.#o)o.push(l);o.length>0&&(r=` <defs>
26
26
  ${o.join(`
27
27
  `)}
28
28
  </defs>
29
- `);let s=typeof this.#e=="number"?`${this.#e}`:this.#e,a=typeof this.#t=="number"?`${this.#t}`:this.#t,l=typeof this.#e=="number"&&typeof this.#t=="number"?` viewBox="0 0 ${this.#e} ${this.#t}"`:"";return {type:"svg",content:`<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${a}"${l}>
30
- ${Ut}
29
+ `);let s=typeof this.#e=="number"?`${this.#e}`:this.#e,a=typeof this.#t=="number"?`${this.#t}`:this.#t,h=typeof this.#e=="number"&&typeof this.#t=="number"?` viewBox="0 0 ${this.#e} ${this.#t}"`:"";return {type:"svg",content:`<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${a}"${h}>
30
+ ${sn}
31
31
  ${r} ${n}
32
- </svg>`}}_toSVG(e){switch(e.type){case "path":return this._path(e);case "line":return this._line(e);case "rect":return this._rect(e);case "circle":return this._circle(e);case "text":return this.#m(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#l(e,t,n){if(e.length===0)return "";if(!t||e.length<3)return e.map((s,a)=>`${a===0?"M":"L"}${b(s.x)},${b(s.y)}`).join(" ");let r=n!=null&&n<e.length?Math.max(n,2):e.length,o=`M${b(e[0].x)},${b(e[0].y)}`;for(let s=0;s<r-1;s++){let a=e[s-1]??e[s],l=e[s],h=e[s+1],m=e[s+2]&&s+2<r?e[s+2]:h,u=l.x+(h.x-a.x)/6,d=l.y+(h.y-a.y)/6,c=h.x-(m.x-l.x)/6,y=h.y-(m.y-l.y)/6;o+=` C${b(u)},${b(d)} ${b(c)},${b(y)} ${b(h.x)},${b(h.y)}`;}for(let s=r;s<e.length;s++)o+=` L${b(e[s].x)},${b(e[s].y)}`;return o}_hatchPattern(e,t){let n=`hatch-${e}-${Ye(t??"")}`;if(this.#o.has(n))return n;let r=Be(n,e,t??"rgba(200,220,255,0.3)");return this.#o.set(n,r),n}_path(e){let t=this.#l(e.points,e.smoothing,e.smoothCount)+(e.closed?" Z":""),n=[];if(e.hatch){let s=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${s})"`);}else n.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);e.stroke&&n.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&n.push(`stroke-width="${b(e.strokeWidth)}"`);let r=this.#a(e.dash,e.dashed,e.strokeWidth);r&&(n.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&n.push(`stroke-linecap="${r.strokeLinecap}"`)),e.opacity!==void 0&&n.push(`opacity="${b(e.opacity)}"`),e.cssClass&&n.push(`class="${this._esc(e.cssClass)}"`),e.id&&n.push(`id="${this._esc(e.id)}"`);let o=this.#s(e);return o&&n.push(`filter="url(#${o})"`),`<path d="${t}" ${n.join(" ")} />`}_line(e){let t=[];e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${b(e.strokeWidth)}"`);let n=this.#a(e.dash,e.dashed,e.strokeWidth);n&&(t.push(`stroke-dasharray="${n.strokeDasharray}"`),n.strokeLinecap&&t.push(`stroke-linecap="${n.strokeLinecap}"`)),e.opacity!==void 0&&t.push(`opacity="${b(e.opacity)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),`<line x1="${b(e.x1)}" y1="${b(e.y1)}" x2="${b(e.x2)}" y2="${b(e.y2)}" ${t.join(" ")} />`}_rect(e){let t=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${r})"`);}else e.fill!==void 0&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${b(e.strokeWidth)}"`),e.opacity!==void 0&&t.push(`opacity="${b(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#s(e);return n&&t.push(`filter="url(#${n})"`),e.title?`<rect x="${b(e.x)}" y="${b(e.y)}" width="${b(e.w)}" height="${b(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${b(e.x)}" y="${b(e.y)}" width="${b(e.w)}" height="${b(e.h)}" ${t.join(" ")} />`}_circle(e){let t=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${r})"`);}else e.fill&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${b(e.strokeWidth)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#s(e);return n&&t.push(`filter="url(#${n})"`),`<circle cx="${b(e.cx)}" cy="${b(e.cy)}" r="${b(e.r)}" ${t.join(" ")} />`}#a(e,t,n){return je(e,n??2,t)}#s(e){if(!e.shadowColor)return null;let t=e.shadowBlur??0,n=e.shadowOffsetX??0,r=e.shadowOffsetY??0;if(!t&&!n&&!r)return null;let o=`shadow-${Ye(`${e.shadowColor}|${b(t)}|${b(n)}|${b(r)}`)}`;if(this.#i.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
33
- <feDropShadow dx="${b(n)}" dy="${b(r)}" stdDeviation="${b(t/2)}" flood-color="${this._esc(e.shadowColor)}" />
32
+ </svg>`}}_toSVG(e){switch(e.type){case "path":return this._path(e);case "line":return this._line(e);case "rect":return this._rect(e);case "circle":return this._circle(e);case "text":return this.#m(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#l(e,t,n){if(e.length===0)return "";if(!t||e.length<3)return e.map((s,a)=>`${a===0?"M":"L"}${x(s.x)},${x(s.y)}`).join(" ");let r=n!=null&&n<e.length?Math.max(n,2):e.length,o=`M${x(e[0].x)},${x(e[0].y)}`;for(let s=0;s<r-1;s++){let a=e[s-1]??e[s],h=e[s],l=e[s+1],m=e[s+2]&&s+2<r?e[s+2]:l,u=h.x+(l.x-a.x)/6,c=h.y+(l.y-a.y)/6,d=l.x-(m.x-h.x)/6,g=l.y-(m.y-h.y)/6;o+=` C${x(u)},${x(c)} ${x(d)},${x(g)} ${x(l.x)},${x(l.y)}`;}for(let s=r;s<e.length;s++)o+=` L${x(e[s].x)},${x(e[s].y)}`;return o}_hatchPattern(e,t){let n=`hatch-${e}-${Qe(t??"")}`;if(this.#o.has(n))return n;let r=Ne(n,e,t??"rgba(200,220,255,0.3)");return this.#o.set(n,r),n}_path(e){let t=this.#l(e.points,e.smoothing,e.smoothCount)+(e.closed?" Z":""),n=[];if(e.hatch){let s=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${s})"`);}else n.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);e.stroke&&n.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&n.push(`stroke-width="${x(e.strokeWidth)}"`);let r=this.#a(e.dash,e.dashed,e.strokeWidth);r&&(n.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&n.push(`stroke-linecap="${r.strokeLinecap}"`)),e.opacity!==void 0&&n.push(`opacity="${x(e.opacity)}"`),e.cssClass&&n.push(`class="${this._esc(e.cssClass)}"`),e.id&&n.push(`id="${this._esc(e.id)}"`);let o=this.#s(e);return o&&n.push(`filter="url(#${o})"`),`<path d="${t}" ${n.join(" ")} />`}_line(e){let t=[];e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${x(e.strokeWidth)}"`);let n=this.#a(e.dash,e.dashed,e.strokeWidth);n&&(t.push(`stroke-dasharray="${n.strokeDasharray}"`),n.strokeLinecap&&t.push(`stroke-linecap="${n.strokeLinecap}"`)),e.opacity!==void 0&&t.push(`opacity="${x(e.opacity)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),`<line x1="${x(e.x1)}" y1="${x(e.y1)}" x2="${x(e.x2)}" y2="${x(e.y2)}" ${t.join(" ")} />`}_rect(e){let t=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${r})"`);}else e.fill!==void 0&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${x(e.strokeWidth)}"`),e.opacity!==void 0&&t.push(`opacity="${x(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#s(e);return n&&t.push(`filter="url(#${n})"`),e.title?`<rect x="${x(e.x)}" y="${x(e.y)}" width="${x(e.w)}" height="${x(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${x(e.x)}" y="${x(e.y)}" width="${x(e.w)}" height="${x(e.h)}" ${t.join(" ")} />`}_circle(e){let t=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${r})"`);}else e.fill&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${x(e.strokeWidth)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#s(e);return n&&t.push(`filter="url(#${n})"`),`<circle cx="${x(e.cx)}" cy="${x(e.cy)}" r="${x(e.r)}" ${t.join(" ")} />`}#a(e,t,n){return Ge(e,n??2,t)}#s(e){if(!e.shadowColor)return null;let t=e.shadowBlur??0,n=e.shadowOffsetX??0,r=e.shadowOffsetY??0;if(!t&&!n&&!r)return null;let o=`shadow-${Qe(`${e.shadowColor}|${x(t)}|${x(n)}|${x(r)}`)}`;if(this.#i.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
33
+ <feDropShadow dx="${x(n)}" dy="${x(r)}" stdDeviation="${x(t/2)}" flood-color="${this._esc(e.shadowColor)}" />
34
34
  </filter>`;return this.#i.set(o,s),o}#h(e,t,n,r,o){this.#r.has(e)||this.#r.set(e,`<clipPath id="${e}">
35
- <rect x="${b(t)}" y="${b(n)}" width="${b(r)}" height="${b(o)}" />
36
- </clipPath>`);}#m(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${b(e.fontSize)}"`),e.fontFamily&&t.push(`font-family="${this._esc(e.fontFamily)}"`),e.fill&&t.push(`fill="${this._esc(e.fill)}"`),e.opacity!=null&&t.push(`opacity="${b(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${b(e.rotate)} ${b(e.x)} ${b(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${Kt(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${b(e.x)}" y="${b(e.y)}" ${t.join(" ")}>${this._esc(e.content)}</text>`}_gap(e){if(e.style==="empty")return "";let t=[`stroke="${this._esc("#999")}"`,'stroke-dasharray="4,4"','fill="none"'];return e.style==="label"&&e.label?`<g class="gap">
37
- <rect x="${b(e.x1)}" y="${b(e.y1)}" width="${b(e.x2-e.x1)}" height="${b(e.y2-e.y1)}" ${t.join(" ")} />
38
- <text x="${b(e.x1)}" y="${b(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
39
- </g>`:`<rect x="${b(e.x1)}" y="${b(e.y1)}" width="${b(e.x2-e.x1)}" height="${b(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:l,y:h,w:m,h:u}=e.clipRect;t=`clip-plot-${Ye(`${b(l)},${b(h)},${b(m)},${b(u)}`)}`,this.#h(t,l,h,m,u);}let n=e.commands.map(l=>` ${this._toSVG(l).replaceAll(/\n {3}/g,`
35
+ <rect x="${x(t)}" y="${x(n)}" width="${x(r)}" height="${x(o)}" />
36
+ </clipPath>`);}#m(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${x(e.fontSize)}"`),e.fontFamily&&t.push(`font-family="${this._esc(e.fontFamily)}"`),e.fill&&t.push(`fill="${this._esc(e.fill)}"`),e.opacity!=null&&t.push(`opacity="${x(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${x(e.rotate)} ${x(e.x)} ${x(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${an(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${x(e.x)}" y="${x(e.y)}" ${t.join(" ")}>${this._esc(e.content)}</text>`}_gap(e){if(e.style==="empty")return "";let t=[`stroke="${this._esc("#999")}"`,'stroke-dasharray="4,4"','fill="none"'];return e.style==="label"&&e.label?`<g class="gap">
37
+ <rect x="${x(e.x1)}" y="${x(e.y1)}" width="${x(e.x2-e.x1)}" height="${x(e.y2-e.y1)}" ${t.join(" ")} />
38
+ <text x="${x(e.x1)}" y="${x(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
39
+ </g>`:`<rect x="${x(e.x1)}" y="${x(e.y1)}" width="${x(e.x2-e.x1)}" height="${x(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:h,y:l,w:m,h:u}=e.clipRect;t=`clip-plot-${Qe(`${x(h)},${x(l)},${x(m)},${x(u)}`)}`,this.#h(t,h,l,m,u);}let n=e.commands.map(h=>` ${this._toSVG(h).replaceAll(/\n {3}/g,`
40
40
  `)}`).join(`
41
41
  `),r=e.cssClass?` class="${this._esc(e.cssClass)}"`:"",o=e.id?` id="${this._esc(e.id)}"`:"",s=e.plotClipId||t,a=s?` clip-path="url(#${this._esc(s)})"`:"";return `<g${r}${o}${a}>
42
42
  ${n}
43
- </g>`}_esc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}};function Jt(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(i):setTimeout(()=>i(0),16)}function Qt(i){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(i):clearTimeout(i);}function vt(){let i=0,e=false;return {schedule:t=>{e||(e=true,i=Jt(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,Qt(i));}}}var Tt="http://www.w3.org/2000/svg";function en(i){let e=i.style?.line;return e&&!Array.isArray(e)&&e.color?e.color:p.stroke}function Ct(i){return i.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function tn(i){if(i.length===0)return "";let e=new Date(i[0].time).toLocaleString(),t=i.map(n=>`<div><span class="mlc-tooltip__name">${Ct(n.series.name)}:</span> ${n.value.toFixed(2)}</div>`);return `<div class="mlc-tooltip__time">${Ct(e)}</div>${t.join("")}`}function nn(i,e){if(i.length===0)return;let t=0,n=i.length-1;for(;t<n;){let s=t+n>>1;i[s].time<e?t=s+1:n=s;}let r=i[Math.max(0,t-1)],o=i[t];return Math.abs(r.time-e)<=Math.abs(o.time-e)?r:o}function rn(i){return "value"in i?i.value:i.avg}function me(i,e,t={}){let n=i.querySelector("svg");if(!n)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let r=t.format??tn,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,l=t.pickRadius??5,h=t.picksClassName??"mlc-tooltip-picks",m=document.createElement("div");m.className=s,m.style.position="absolute",m.style.pointerEvents="none",m.style.display="none",getComputedStyle(i).position==="static"&&(i.style.position="relative"),i.appendChild(m);let u=null;a&&(u=document.createElementNS(Tt,"g"),u.setAttribute("class",h),u.setAttribute("pointer-events","none"),n.appendChild(u));let d=()=>{u&&u.replaceChildren();},c=e.series.map((T,B)=>({data:T.data.map(M=>({time:M.time,value:rn(M)})).filter(M=>M.value!==null).sort((M,E)=>M.time-E.time),series:T,index:B})),y=vt(),g=null,x=T=>{let B=n.getBoundingClientRect(),j=e.getWidth?.()??B.width,M=(T.clientX-B.left)*j/Math.max(1,B.width);e.getHeight?.()??B.height;let z=e.invertTime(M);if(!Number.isFinite(z)){m.style.display="none";return}let S=[];for(let A of c){let I=nn(A.data,z);if(!I)continue;let Y=e.project(I.time,I.value,A.series.yAxisIndex??0).x,G=e.project(I.time,I.value,A.series.yAxisIndex??0).y;Math.abs(Y-M)>o||S.push({seriesIndex:A.index,series:A.series,time:I.time,value:I.value,x:Y,y:G});}if(S.length===0){m.style.display="none",d();return}m.innerHTML=r(S);let $=i.getBoundingClientRect(),F=12,_=(T.clientX-B.left)/Math.max(1,B.width),L=(T.clientY-B.top)/Math.max(1,B.height),O=_<.5?`${F}px`:`calc(-100% - ${F}px)`,C=L<.5?`${F}px`:`calc(-100% - ${F}px)`;if(m.style.left=`${T.clientX-$.left}px`,m.style.top=`${T.clientY-$.top}px`,m.style.transform=`translate(${O}, ${C})`,m.style.display="",u){u.replaceChildren();for(let A of S){let I=document.createElementNS(Tt,"circle");I.setAttribute("cx",String(A.x)),I.setAttribute("cy",String(A.y)),I.setAttribute("r",String(l)),I.setAttribute("fill","#ffffff"),I.setAttribute("stroke",en(A.series)),I.setAttribute("stroke-width","2"),I.setAttribute("class",`${h}__dot`),u.appendChild(I);}}},k=T=>{g=T,y.schedule(()=>{g&&x(g);});},D=()=>{g=null,y.cancel(),m.style.display="none",d();};n.addEventListener("mousemove",k),n.addEventListener("mouseleave",D);let R=false;return ()=>{R||(R=true,g=null,y.cancel(),n.removeEventListener("mousemove",k),n.removeEventListener("mouseleave",D),m.remove(),u&&u.remove());}}function on(i,e={}){let t=typeof i=="string"?document.querySelector(i):i;if(!t)throw new Error(`mount: target ${typeof i=="string"?`'${i}'`:""} not found`);let{tooltip:n,...r}=e,o=r.width??t.clientWidth??800,s=r.height??350,a=new J({...r,width:o,height:s}),{content:l}=new X().render(a.renderCommands());t.innerHTML=l;let h=t.querySelector("svg");return h&&(h.setAttribute("viewBox",`0 0 ${o} ${a.getHeight()}`),h.setAttribute("width","100%"),h.setAttribute("height",String(a.getHeight()))),n?.show&&me(t,a,n),a}var _e=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,n,r){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:n??0,left:r??0},this}setLocale(e){return this._opts.locale=e,this}setAxes(e){return this._opts.axes=e,this}setXAxis(e){return this._opts.axes={...this._opts.axes,x:{...this._opts.axes?.x,...e}},this}setLeftAxis(e){return this._opts.axes={...this._opts.axes,left:{...this._opts.axes?.left,...e}},this}setRightAxis(e){return this._opts.axes={...this._opts.axes,right:{...this._opts.axes?.right,...e}},this}setYAxis(e,t){this._opts.axes??={},this._opts.axes.y??=[];let n=[...this._opts.axes.y];for(;n.length<=e;)n.push({});return n[e]={...n[e],...t},this._opts.axes.y=n,this}setLegend(e,t,n){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:n},this}setGaps(e){return this._opts.gaps=e,this}setTooltip(e){return this._tooltip={show:true,...e},this}addSeries(e){return this._series.push(e),this}addSeriesAll(e){return this._series.push(...e),this}addThreshold(e){return this._thresholds.push(e),this}addThresholds(e){return this._thresholds.push(...e),this}addAnnotation(e){return this._annotations.push(e),this}addAnnotations(e){return this._annotations.push(...e),this}addHighlight(e){return this._highlights.push(e),this}addMarker(e){return this._markers.push(e),this}addAnnotationBand(e){return this._bands.push(e),this}clear(e){return (!e||e==="series")&&(this._series=[]),(!e||e==="thresholds")&&(this._thresholds=[]),(!e||e==="annotations")&&(this._annotations=[]),(!e||e==="highlights")&&(this._highlights=[]),(!e||e==="markers")&&(this._markers=[]),(!e||e==="bands")&&(this._bands=[]),this}toOptions(){return {...this._opts,series:this._series.length?this._series:this._opts.series,thresholds:this._thresholds.length?this._thresholds:this._opts.thresholds,annotations:this._annotations.length?this._annotations:this._opts.annotations,highlights:this._highlights.length?this._highlights:this._opts.highlights,markers:this._markers.length?this._markers:this._opts.markers,annotationBands:this._bands.length?this._bands:this._opts.annotationBands}}build(){return new J(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new X().render(e.renderCommands());return t}mount(e){let t=typeof e=="string"?document.querySelector(e):e;if(!t){let s=typeof e=="string"?`'${e}'`:"";throw new Error(`GraphBuilder.mount: target ${s} not found`)}this._opts.width||(this._opts.width=t.clientWidth||800);let n=this.build(),{content:r}=new X().render(n.renderCommands());t.innerHTML=r;let o=t.querySelector("svg");if(o){let s=this._opts.width??800;o.setAttribute("viewBox",`0 0 ${s} ${n.getHeight()}`),o.setAttribute("width","100%"),o.setAttribute("height",String(n.getHeight()));}return this._tooltip?.show&&me(t,n,this._tooltip),n}};var ke=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)this._series.data.push({time:e[r],value:t[r]});return this}addNullPoint(e){return this._series.data.push({time:e,value:null}),this}setYAxisIndex(e){return this._series.yAxisIndex=e,this}setColor(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={color:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{color:e}]:this._series.style.line[0].color=e:this._series.style.line.color=e,this}setStyle(e){return this._series.style=e,this}setLineStyle(e,t,n){return this._series.style??={},this._series.style.line={color:e,width:t,style:n},this}setSmoothing(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e}]:this._series.style.line[0].smoothing=e:this._series.style.line.smoothing=e,this}setFill(e){return this._series.style??={},this._series.style.fill=e,this}setID(e){return this._series.id=e,this}setColorByThresholds(e){return this._series.colorByThresholds=e,this}build(){return this._series}};var ve=class{_threshold;constructor(e,t){this._threshold={name:e,value:t};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,t){return this._threshold.fill=e,this._threshold.fillOpacity=t,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,t){return this._threshold.label={text:e,position:t},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var Te=class{_marker;constructor(e){this._marker={time:e};}setValue(e){return this._marker.value=e,this}setLabel(e){return this._marker.label=e,this}setColor(e){return this._marker.color=e,this}setPointStyle(e){return this._marker.pointStyle=e,this}setLineStyle(e){return e==="none"?delete this._marker.lineStyle:this._marker.lineStyle=e,this}setSeriesIndex(e){return this._marker.seriesIndex=e,this}build(){return this._marker}};var Ce=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var $e=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,n){return this._ann.from={time:e,value:t,axis:n},this}setTo(e,t,n){return this._ann.to={time:e,value:t,axis:n},this}setAt(e,t,n){return this._ann.at={time:e,value:t,axis:n},this}setColor(e){return this._ann.color=e,this}setWidth(e){return this._ann.width=e,this}setDash(e){return this._ann.dash=e,this}setHeadSize(e){return this._ann.headSize=e,this}setFill(e){return this._ann.fill=e,this}setHatch(e){return this._ann.hatch=e,this}setStroke(e){return this._ann.stroke=e,this}setOpacity(e){return this._ann.opacity=e,this}setRadius(e){return this._ann.radius=e,this}setShape(e){return this._ann.shape=e,this}setText(e){return this._ann.text=e,this}setAnchor(e){return this._ann.anchor=e,this}setDx(e){return this._ann.dx=e,this}setDy(e){return this._ann.dy=e,this}setRotate(e){return this._ann.rotate=e,this}build(){return this._ann}};var Ae=class{_band;constructor(e){this._band={name:e,items:[]};}setHeight(e){return this._band.height=e,this}setSpacing(e){return this._band.spacing=e,this}setHatch(e){return this._band.hatch=e,this}setShowAxis(e){return this._band.showAxis=e,this}setShowInLegend(e){return this._band.showInLegend=e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},De=class{_item;constructor(e,t){this._item={startTime:e,endTime:t};}setFill(e){return this._item.fill=e,this}setHatch(e){return this._item.hatch=e,this}setStroke(e){return this._item.stroke=e,this}setStrokeWidth(e){return this._item.strokeWidth=e,this}setLabel(e,t,n,r){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),n!==void 0&&(this._item.labelFill=n),r!==void 0&&(this._item.labelBaseline=r),this}build(){return this._item}};function sn(i){let{thresholds:e,colors:t,hatches:n}=i;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(n!==void 0&&n.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${n.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let a=n?.[s],l=a?{color:o,hatch:a}:o;return s===0?{to:{threshold:e[0]},fill:l}:s===t.length-1?{from:{threshold:e[e.length-1]},fill:l}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:l}})}}function qe(i){if(!i||typeof i!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:n}=i;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(t!==null&&(typeof t!="number"||Number.isNaN(t)))throw new Error(`DataPoint: invalid value=${t}`);return {time:e,value:t,annotation:n&&typeof n=="string"?n:void 0}}function an(i){if(Array.isArray(i))return i.map(qe);if(i&&typeof i=="object"){let e=i,t=e.name,n=e.data,r=e.sensorType,o=e.enumMap,s=e.color,a=e.lineWidth,l=e.smoothing,h=e.seriesType;if(!t||!t.length)throw new Error("Series: name required");if(!Array.isArray(n))throw new Error("Series: data must be an array");let m=s!==void 0||a!==void 0||l!==void 0?{color:s,width:a,smoothing:l}:void 0;return {name:t,data:n.map(qe),sensorType:r??"numeric",enumMap:o,seriesType:h,...m&&{style:{line:m}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function ln(i){if(!i||typeof i!="object")throw new Error("parseAggregated: object expected");let e=i,t=e.name,n=e.data,r=e.showAs,o=e.avgLine,s=e.countOpacity,a=e.color;if(!t?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(n))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:hn(n),showAs:r,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function hn(i){let e=t=>typeof t=="number"?t:null;return i.map(t=>{let n=t;return {time:n.time??0,min:e(n.min),max:e(n.max),avg:e(n.avg),count:typeof n.count=="number"?n.count:0}})}function Xe(i,e,t){return typeof e=="function"?e(i):i[e??t]}function mn(i,e,t){if(i instanceof Date){let n=i.getTime();if(Number.isNaN(n))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return n}if(typeof i=="string"){let n=Date.parse(i);if(Number.isNaN(n))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${i}`);return n}if(typeof i=="number"&&Number.isFinite(i))return e==="s"||e==="auto"&&Math.abs(i)>=1e8&&Math.abs(i)<1e11?i*1e3:i;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(i)}`)}function un(i,e){if(i==null)return null;if(typeof i=="number")return Number.isNaN(i)?null:i;if(typeof i=="string"){let t=i.trim();if(t==="")return null;let n=Number(t);if(Number.isNaN(n))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${i}`);return n}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(i)}`)}function $t(i,e={}){let t=e.timeUnit??"ms",n=[];for(let r=0;r<i.length;r++){let o=i[r];if(o==null)throw new TypeError(`toDataPoints: empty row at ${r}`);let s=Array.isArray(o),a=s&&e.time===void 0?o[0]:Xe(o,e.time,"time"),l=s&&e.value===void 0?o[1]:Xe(o,e.value,"value"),h={time:mn(a,t,r),value:un(l,r)};if(e.annotation!==void 0){let m=Xe(o,e.annotation,"annotation");typeof m=="string"&&m!==""&&(h.annotation=m);}n.push(h);}return (e.sort??true)&&n.sort((r,o)=>r.time-o.time),n}function dn(i,e,t={}){return {name:i,data:$t(e,t)}}function At(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Dt(i,e){if(!At(i)||!At(e))return e;let t={...i};for(let[n,r]of Object.entries(e))t[n]=Dt(t[n],r);return t}function cn(...i){let e;for(let t of i)t!==void 0&&(e=Dt(e,t));return e??{}}/*!
43
+ </g>`}_esc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}};function ln(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(i):setTimeout(()=>i(0),16)}function hn(i){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(i):clearTimeout(i);}function Mt(){let i=0,e=false;return {schedule:t=>{e||(e=true,i=ln(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,hn(i));}}}var Pt="http://www.w3.org/2000/svg";function mn(i){let e=i.style?.line;return e&&!Array.isArray(e)&&e.color?e.color:f.stroke}function Ft(i){return i.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function un(i){if(i.length===0)return "";let e=new Date(i[0].time).toLocaleString(),t=i.map(n=>`<div><span class="mlc-tooltip__name">${Ft(n.series.name)}:</span> ${n.value.toFixed(2)}</div>`);return `<div class="mlc-tooltip__time">${Ft(e)}</div>${t.join("")}`}function dn(i,e){if(i.length===0)return;let t=0,n=i.length-1;for(;t<n;){let s=t+n>>1;i[s].time<e?t=s+1:n=s;}let r=i[Math.max(0,t-1)],o=i[t];return Math.abs(r.time-e)<=Math.abs(o.time-e)?r:o}function cn(i){return "value"in i?i.value:i.avg}function be(i,e,t={}){let n=i.querySelector("svg");if(!n)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let r=t.format??un,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,h=t.pickRadius??5,l=t.picksClassName??"mlc-tooltip-picks",m=document.createElement("div");m.className=s,m.style.position="absolute",m.style.pointerEvents="none",m.style.display="none",getComputedStyle(i).position==="static"&&(i.style.position="relative"),i.appendChild(m);let u=null;a&&(u=document.createElementNS(Pt,"g"),u.setAttribute("class",l),u.setAttribute("pointer-events","none"),n.appendChild(u));let c=()=>{u&&u.replaceChildren();},d=e.series.map((k,B)=>({data:k.data.map(P=>({time:P.time,value:cn(P)})).filter(P=>P.value!==null).sort((P,W)=>P.time-W.time),series:k,index:B})),g=Mt(),p=null,b=k=>{let B=n.getBoundingClientRect(),F=e.getWidth?.()??B.width,P=(k.clientX-B.left)*F/Math.max(1,B.width);e.getHeight?.()??B.height;let X=e.invertTime(P);if(!Number.isFinite(X)){m.style.display="none";return}let S=[];for(let D of d){let O=dn(D.data,X);if(!O)continue;let U=e.project(O.time,O.value,D.series.yAxisIndex??0).x,z=e.project(O.time,O.value,D.series.yAxisIndex??0).y;Math.abs(U-P)>o||S.push({seriesIndex:D.index,series:D.series,time:O.time,value:O.value,x:U,y:z});}if(S.length===0){m.style.display="none",c();return}m.innerHTML=r(S);let L=i.getBoundingClientRect(),j=12,v=(k.clientX-B.left)/Math.max(1,B.width),M=(k.clientY-B.top)/Math.max(1,B.height),I=v<.5?`${j}px`:`calc(-100% - ${j}px)`,T=M<.5?`${j}px`:`calc(-100% - ${j}px)`;if(m.style.left=`${k.clientX-L.left}px`,m.style.top=`${k.clientY-L.top}px`,m.style.transform=`translate(${I}, ${T})`,m.style.display="",u){u.replaceChildren();for(let D of S){let O=document.createElementNS(Pt,"circle");O.setAttribute("cx",String(D.x)),O.setAttribute("cy",String(D.y)),O.setAttribute("r",String(h)),O.setAttribute("fill","#ffffff"),O.setAttribute("stroke",mn(D.series)),O.setAttribute("stroke-width","2"),O.setAttribute("class",`${l}__dot`),u.appendChild(O);}}},_=k=>{p=k,g.schedule(()=>{p&&b(p);});},C=()=>{p=null,g.cancel(),m.style.display="none",c();};n.addEventListener("mousemove",_),n.addEventListener("mouseleave",C);let A=false;return ()=>{A||(A=true,p=null,g.cancel(),n.removeEventListener("mousemove",_),n.removeEventListener("mouseleave",C),m.remove(),u&&u.remove());}}function pn(i,e={}){let t=typeof i=="string"?document.querySelector(i):i;if(!t)throw new Error(`mount: target ${typeof i=="string"?`'${i}'`:""} not found`);let{tooltip:n,...r}=e,o=r.width??t.clientWidth??800,s=r.height??350,a=new ie({...r,width:o,height:s}),{content:h}=new J().render(a.renderCommands());t.innerHTML=h;let l=t.querySelector("svg");return l&&(l.setAttribute("viewBox",`0 0 ${o} ${a.getHeight()}`),l.setAttribute("width","100%"),l.setAttribute("height",String(a.getHeight()))),n?.show&&be(t,a,n),a}var Le=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,n,r){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:n??0,left:r??0},this}setLocale(e){return this._opts.locale=e,this}setAxes(e){return this._opts.axes=e,this}setXAxis(e){return this._opts.axes={...this._opts.axes,x:{...this._opts.axes?.x,...e}},this}setLeftAxis(e){return this._opts.axes={...this._opts.axes,left:{...this._opts.axes?.left,...e}},this}setRightAxis(e){return this._opts.axes={...this._opts.axes,right:{...this._opts.axes?.right,...e}},this}setYAxis(e,t){this._opts.axes??={},this._opts.axes.y??=[];let n=[...this._opts.axes.y];for(;n.length<=e;)n.push({});return n[e]={...n[e],...t},this._opts.axes.y=n,this}setLegend(e,t,n){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:n},this}setGaps(e){return this._opts.gaps=e,this}setTooltip(e){return this._tooltip={show:true,...e},this}addSeries(e){return this._series.push(e),this}addSeriesAll(e){return this._series.push(...e),this}addThreshold(e){return this._thresholds.push(e),this}addThresholds(e){return this._thresholds.push(...e),this}addAnnotation(e){return this._annotations.push(e),this}addAnnotations(e){return this._annotations.push(...e),this}addHighlight(e){return this._highlights.push(e),this}addMarker(e){return this._markers.push(e),this}addAnnotationBand(e){return this._bands.push(e),this}clear(e){return (!e||e==="series")&&(this._series=[]),(!e||e==="thresholds")&&(this._thresholds=[]),(!e||e==="annotations")&&(this._annotations=[]),(!e||e==="highlights")&&(this._highlights=[]),(!e||e==="markers")&&(this._markers=[]),(!e||e==="bands")&&(this._bands=[]),this}toOptions(){return {...this._opts,series:this._series.length?this._series:this._opts.series,thresholds:this._thresholds.length?this._thresholds:this._opts.thresholds,annotations:this._annotations.length?this._annotations:this._opts.annotations,highlights:this._highlights.length?this._highlights:this._opts.highlights,markers:this._markers.length?this._markers:this._opts.markers,annotationBands:this._bands.length?this._bands:this._opts.annotationBands}}build(){return new ie(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new J().render(e.renderCommands());return t}mount(e){let t=typeof e=="string"?document.querySelector(e):e;if(!t){let s=typeof e=="string"?`'${e}'`:"";throw new Error(`GraphBuilder.mount: target ${s} not found`)}this._opts.width||(this._opts.width=t.clientWidth||800);let n=this.build(),{content:r}=new J().render(n.renderCommands());t.innerHTML=r;let o=t.querySelector("svg");if(o){let s=this._opts.width??800;o.setAttribute("viewBox",`0 0 ${s} ${n.getHeight()}`),o.setAttribute("width","100%"),o.setAttribute("height",String(n.getHeight()));}return this._tooltip?.show&&be(t,n,this._tooltip),n}};var De=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)this._series.data.push({time:e[r],value:t[r]});return this}addNullPoint(e){return this._series.data.push({time:e,value:null}),this}setYAxisIndex(e){return this._series.yAxisIndex=e,this}setColor(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={color:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{color:e}]:this._series.style.line[0].color=e:this._series.style.line.color=e,this}setStyle(e){return this._series.style=e,this}setLineStyle(e,t,n){return this._series.style??={},this._series.style.line={color:e,width:t,style:n},this}setSmoothing(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e}]:this._series.style.line[0].smoothing=e:this._series.style.line.smoothing=e,this}setFill(e){return this._series.style??={},this._series.style.fill=e,this}setID(e){return this._series.id=e,this}setColorByThresholds(e){return this._series.colorByThresholds=e,this}build(){return this._series}};var Me=class{_threshold;constructor(e,t){this._threshold={name:e,value:t};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,t){return this._threshold.fill=e,this._threshold.fillOpacity=t,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,t){return this._threshold.label={text:e,position:t},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var Pe=class{_marker;constructor(e){this._marker={time:e};}setValue(e){return this._marker.value=e,this}setLabel(e){return this._marker.label=e,this}setColor(e){return this._marker.color=e,this}setPointStyle(e){return this._marker.pointStyle=e,this}setLineStyle(e){return e==="none"?delete this._marker.lineStyle:this._marker.lineStyle=e,this}setSeriesIndex(e){return this._marker.seriesIndex=e,this}build(){return this._marker}};var Fe=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var Re=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,n){return this._ann.from={time:e,value:t,axis:n},this}setTo(e,t,n){return this._ann.to={time:e,value:t,axis:n},this}setAt(e,t,n){return this._ann.at={time:e,value:t,axis:n},this}setColor(e){return this._ann.color=e,this}setWidth(e){return this._ann.width=e,this}setDash(e){return this._ann.dash=e,this}setHeadSize(e){return this._ann.headSize=e,this}setFill(e){return this._ann.fill=e,this}setHatch(e){return this._ann.hatch=e,this}setStroke(e){return this._ann.stroke=e,this}setOpacity(e){return this._ann.opacity=e,this}setRadius(e){return this._ann.radius=e,this}setShape(e){return this._ann.shape=e,this}setText(e){return this._ann.text=e,this}setAnchor(e){return this._ann.anchor=e,this}setDx(e){return this._ann.dx=e,this}setDy(e){return this._ann.dy=e,this}setRotate(e){return this._ann.rotate=e,this}build(){return this._ann}};var Be=class{_band;constructor(e){this._band={name:e,items:[]};}setHeight(e){return this._band.height=e,this}setSpacing(e){return this._band.spacing=e,this}setHatch(e){return this._band.hatch=e,this}setShowAxis(e){return this._band.showAxis=e,this}setShowInLegend(e){return this._band.showInLegend=e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},je=class{_item;constructor(e,t){this._item={startTime:e,endTime:t};}setFill(e){return this._item.fill=e,this}setHatch(e){return this._item.hatch=e,this}setStroke(e){return this._item.stroke=e,this}setStrokeWidth(e){return this._item.strokeWidth=e,this}setLabel(e,t,n,r){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),n!==void 0&&(this._item.labelFill=n),r!==void 0&&(this._item.labelBaseline=r),this}build(){return this._item}};function fn(i){let{thresholds:e,colors:t,hatches:n}=i;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(n!==void 0&&n.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${n.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let a=n?.[s],h=a?{color:o,hatch:a}:o;return s===0?{to:{threshold:e[0]},fill:h}:s===t.length-1?{from:{threshold:e[e.length-1]},fill:h}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:h}})}}function et(i){if(!i||typeof i!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:n}=i;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(t!==null&&(typeof t!="number"||Number.isNaN(t)))throw new Error(`DataPoint: invalid value=${t}`);return {time:e,value:t,annotation:n&&typeof n=="string"?n:void 0}}function gn(i){if(Array.isArray(i))return i.map(et);if(i&&typeof i=="object"){let e=i,t=e.name,n=e.data,r=e.sensorType,o=e.enumMap,s=e.color,a=e.lineWidth,h=e.smoothing,l=e.seriesType;if(!t||!t.length)throw new Error("Series: name required");if(!Array.isArray(n))throw new Error("Series: data must be an array");let m=s!==void 0||a!==void 0||h!==void 0?{color:s,width:a,smoothing:h}:void 0;return {name:t,data:n.map(et),sensorType:r??"numeric",enumMap:o,seriesType:l,...m&&{style:{line:m}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function yn(i){if(!i||typeof i!="object")throw new Error("parseAggregated: object expected");let e=i,t=e.name,n=e.data,r=e.showAs,o=e.avgLine,s=e.countOpacity,a=e.color;if(!t?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(n))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:bn(n),showAs:r,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function bn(i){let e=t=>typeof t=="number"?t:null;return i.map(t=>{let n=t;return {time:n.time??0,min:e(n.min),max:e(n.max),avg:e(n.avg),count:typeof n.count=="number"?n.count:0}})}function tt(i,e,t){return typeof e=="function"?e(i):i[e??t]}function xn(i,e,t){if(i instanceof Date){let n=i.getTime();if(Number.isNaN(n))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return n}if(typeof i=="string"){let n=Date.parse(i);if(Number.isNaN(n))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${i}`);return n}if(typeof i=="number"&&Number.isFinite(i))return e==="s"||e==="auto"&&Math.abs(i)>=1e8&&Math.abs(i)<1e11?i*1e3:i;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(i)}`)}function Sn(i,e){if(i==null)return null;if(typeof i=="number")return Number.isNaN(i)?null:i;if(typeof i=="string"){let t=i.trim();if(t==="")return null;let n=Number(t);if(Number.isNaN(n))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${i}`);return n}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(i)}`)}function Rt(i,e={}){let t=e.timeUnit??"ms",n=[];for(let r=0;r<i.length;r++){let o=i[r];if(o==null)throw new TypeError(`toDataPoints: empty row at ${r}`);let s=Array.isArray(o),a=s&&e.time===void 0?o[0]:tt(o,e.time,"time"),h=s&&e.value===void 0?o[1]:tt(o,e.value,"value"),l={time:xn(a,t,r),value:Sn(h,r)};if(e.annotation!==void 0){let m=tt(o,e.annotation,"annotation");typeof m=="string"&&m!==""&&(l.annotation=m);}n.push(l);}return (e.sort??true)&&n.sort((r,o)=>r.time-o.time),n}function wn(i,e,t={}){return {name:i,data:Rt(e,t)}}function Bt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function jt(i,e){if(!Bt(i)||!Bt(e))return e;let t={...i};for(let[n,r]of Object.entries(e))t[n]=jt(t[n],r);return t}function _n(...i){let e;for(let t of i)t!==void 0&&(e=jt(e,t));return e??{}}/*!
44
44
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
45
45
  * MIT with Attribution: free use incl. commercial requires visible credit to
46
46
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
@@ -59,4 +59,4 @@ ${n}
59
59
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
60
60
  * MIT with Attribution: free use incl. commercial must have visible credit to
61
61
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
62
- */export{Ae as AnnotationBandBuilder,De as AnnotationBandItemBuilder,$e as AnnotationBuilder,_e as GraphBuilder,Ce as HighlightBuilder,J as MLTimeGraph,Te as MarkerBuilder,X as SVGRenderer,ve as ThresholdBuilder,ke as TimeSeriesBuilder,ze as VERSION,me as attachTooltip,fe as drawMarker,sn as fillBetweenThresholds,ne as getDefaultTheme,et as getLineStyle,cn as mergeOptions,on as mount,ln as parseAggregated,qe as parseDataPoint,an as parseSeries,Ft as resetDefaultTheme,je as resolveDash,Pt as setDefaultTheme,ee as slugify,$t as toDataPoints,dn as toSeries};
62
+ */export{Be as AnnotationBandBuilder,je as AnnotationBandItemBuilder,Re as AnnotationBuilder,Le as GraphBuilder,Fe as HighlightBuilder,ie as MLTimeGraph,Pe as MarkerBuilder,J as SVGRenderer,Me as ThresholdBuilder,De as TimeSeriesBuilder,Je as VERSION,be as attachTooltip,_e as drawMarker,fn as fillBetweenThresholds,me as getDefaultTheme,at as getLineStyle,_n as mergeOptions,pn as mount,yn as parseAggregated,et as parseDataPoint,gn as parseSeries,Ht as resetDefaultTheme,Ge as resolveDash,Wt as setDefaultTheme,le as slugify,Rt as toDataPoints,wn as toSeries};
package/dist/internals.js CHANGED
@@ -1,30 +1,30 @@
1
- var N=class{};var x=class{static interpolateDataPoint(a,e,t){return {time:a.time+Math.round(t*(e.time-a.time)),value:(a.value??0)+t*((e.value??0)-(a.value??0))}}static interpolateAggregatedPoint(a,e,t){let n=(o,r)=>o!==null&&r!==null?o+t*(r-o):null;return {time:a.time+t*(e.time-a.time),min:n(a.min,e.min),max:n(a.max,e.max),avg:n(a.avg,e.avg),count:Math.round(a.count+t*(e.count-a.count))}}static getRuns(a,e,t=0){let n=[...a].sort((l,i)=>l.time-i.time),o=[],r=[],s=null;for(let l of n){let i=e(l),m=t>0&&s&&l.time-s.time>t;(i||m)&&r.length&&(o.push(r),r=[]),i||r.push(l),s=l;}return r.length&&o.push(r),o}static splitByBoundaries(a,e,t,n){if(a.length===0)return [];if(e.length===0)return [{data:a,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let o=[...e].sort((m,u)=>m-u),r=[],s=m=>m<=0?Number.NEGATIVE_INFINITY:o[m-1],l=m=>{let u=0;for(let c=0;c<o.length&&m>=o[c];c++)u=c+1;return u},i=[a[0]];for(let m=1;m<a.length;m++){let u=a[m-1],c=a[m],d=t(u),p=t(c),f;p>d?f=o.filter(y=>y>d&&y<=p):p<d?f=o.filter(y=>y>=p&&y<d).reverse():f=[];let g=d;for(let y of f){let b=(y-d)/(p-d),S=n(u,c,b);i.push(S);let O=l((g+y)/2);r.push({data:i,zoneIndex:O,zoneLow:s(O)}),i=[S],g=y;}(f.length===0||f[f.length-1]!==p)&&i.push(c);}if(i.length>1){let m=t(i[0]),u=t(i[i.length-1]),c=l((m+u)/2);r.push({data:i,zoneIndex:c,zoneLow:s(c)});}return r}static splitByThreshold(a,e,t,n){let o=this.splitByBoundaries(a,[e],t,n),r={above:[],below:[]};for(let s of o)s.zoneIndex===0?r.below.push(s.data):r.above.push(s.data);return r}};var ue=class{static compute(a){let e=a.map(l=>l.value).filter(l=>l!==null).sort((l,i)=>l-i);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((l,i)=>l+i,0)/t,o=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,r=e.reduce((l,i)=>l+Math.pow(i-n,2),0)/t,s=Math.sqrt(r);return {min:e[0],max:e[t-1],avg:n,mean:n,median:o,stdDev:s,count:t}}static computeInRange(a,e,t){let n=a.filter(o=>o.time>=e&&o.time<=t);return this.compute(n)}};var ce={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var ve={...ce};function C(){return ve}function ke(a){let e=a.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function we(a){let e=a.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function de(a,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,o=2){let r=n??ke(t),s=we(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
- <pattern id="${a}" width="10" height="10" patternUnits="userSpaceOnUse">
1
+ var N=class{};var x=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0))}}static interpolateAggregatedPoint(i,e,t){let n=(o,r)=>o!==null&&r!==null?o+t*(r-o):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((l,a)=>l.time-a.time),o=[],r=[],s=null;for(let l of n){let a=e(l),m=t>0&&s&&l.time-s.time>t;(a||m)&&r.length&&(o.push(r),r=[]),a||r.push(l),s=l;}return r.length&&o.push(r),o}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let o=[...e].sort((m,u)=>m-u),r=[],s=m=>m<=0?Number.NEGATIVE_INFINITY:o[m-1],l=m=>{let u=0;for(let c=0;c<o.length&&m>=o[c];c++)u=c+1;return u},a=[i[0]];for(let m=1;m<i.length;m++){let u=i[m-1],c=i[m],d=t(u),h=t(c),f;h>d?f=o.filter(y=>y>d&&y<=h):h<d?f=o.filter(y=>y>=h&&y<d).reverse():f=[];let g=d;for(let y of f){let b=(y-d)/(h-d),S=n(u,c,b);a.push(S);let T=l((g+y)/2);r.push({data:a,zoneIndex:T,zoneLow:s(T)}),a=[S],g=y;}(f.length===0||f[f.length-1]!==h)&&a.push(c);}if(a.length>1||i.length===1){let m=t(a[0]),u=t(a[a.length-1]),c=l((m+u)/2);r.push({data:a,zoneIndex:c,zoneLow:s(c)});}return r}static splitByThreshold(i,e,t,n){let o=this.splitByBoundaries(i,[e],t,n),r={above:[],below:[]};for(let s of o)s.zoneIndex===0?r.below.push(s.data):r.above.push(s.data);return r}};var ue=class{static compute(i){let e=i.map(l=>l.value).filter(l=>l!==null).sort((l,a)=>l-a);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((l,a)=>l+a,0)/t,o=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,r=e.reduce((l,a)=>l+Math.pow(a-n,2),0)/t,s=Math.sqrt(r);return {min:e[0],max:e[t-1],avg:n,mean:n,median:o,stdDev:s,count:t}}static computeInRange(i,e,t){let n=i.filter(o=>o.time>=e&&o.time<=t);return this.compute(n)}};var ce={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var ve={...ce};function C(){return ve}function ke(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function we(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function de(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,o=2){let r=n??ke(t),s=we(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
+ <pattern id="${i}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${t}" />
4
4
  </pattern>
5
- `.trim();let l=12,i=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "dense-steep":l=6,i=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "crosshatch":l=14,i=14,m="rotate(45)",u=`
6
- <line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
5
+ `.trim();let l=12,a=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":l=12,a=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "dense-steep":l=6,a=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "crosshatch":l=14,a=14,m="rotate(45)",u=`
6
+ <line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
7
7
  <line x1="0" y1="0" x2="${l}" y2="0" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
8
- `;break;case "dots":l=12,i=12,u=`<circle cx="${l/2}" cy="${i/2}" r="${o*1.2}" fill="${r}" />`;break;case "waves":l=16,i=16,u=`
9
- <path d="M 0 ${i/2} Q ${l/4} 0, ${l/2} ${i/2} T ${l} ${i/2}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linecap="round" />
10
- `;break;case "dashed":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-dasharray="3,3" />`;break;case "herringbone":l=16,i=16,u=`
11
- <path d="M 0 0 L ${l/2} ${i/2} L 0 ${i} M ${l} 0 L ${l/2} ${i/2} L ${l} ${i}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linejoin="round" stroke-linecap="round" />
12
- `;break;case "brick":l=20,i=20,u=`
13
- <path d="M 0 ${i/2} L ${l} ${i/2} M 0 ${i} L ${l} ${i} M ${l/2} 0 L ${l/2} ${i/2} M 0 ${i/2} L 0 ${i}" fill="none" stroke="${r}" stroke-width="${o}" />
14
- `;break;case "double-stripe":l=16,i=16,m="rotate(45)",u=`
15
- <line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
16
- <line x1="${l/2}" y1="0" x2="${l/2}" y2="${i}" stroke="${r}" stroke-width="${o/2}" stroke-linecap="square" />
17
- `;break;case "honeycomb":l=18,i=32,u=`
8
+ `;break;case "dots":l=12,a=12,u=`<circle cx="${l/2}" cy="${a/2}" r="${o*1.2}" fill="${r}" />`;break;case "waves":l=16,a=16,u=`
9
+ <path d="M 0 ${a/2} Q ${l/4} 0, ${l/2} ${a/2} T ${l} ${a/2}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linecap="round" />
10
+ `;break;case "dashed":l=12,a=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-dasharray="3,3" />`;break;case "herringbone":l=16,a=16,u=`
11
+ <path d="M 0 0 L ${l/2} ${a/2} L 0 ${a} M ${l} 0 L ${l/2} ${a/2} L ${l} ${a}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linejoin="round" stroke-linecap="round" />
12
+ `;break;case "brick":l=20,a=20,u=`
13
+ <path d="M 0 ${a/2} L ${l} ${a/2} M 0 ${a} L ${l} ${a} M ${l/2} 0 L ${l/2} ${a/2} M 0 ${a/2} L 0 ${a}" fill="none" stroke="${r}" stroke-width="${o}" />
14
+ `;break;case "double-stripe":l=16,a=16,m="rotate(45)",u=`
15
+ <line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
16
+ <line x1="${l/2}" y1="0" x2="${l/2}" y2="${a}" stroke="${r}" stroke-width="${o/2}" stroke-linecap="square" />
17
+ `;break;case "honeycomb":l=18,a=32,u=`
18
18
  <path d="M 0 0 L ${l/2} 5 L ${l} 0 M 0 16 L ${l/2} 11 L ${l} 16 M 0 16 L 0 32 M ${l/2} 5 L ${l/2} 11 M ${l} 16 L ${l} 32 M 0 32 L ${l/2} 27 L ${l} 32 M ${l/2} 27 L ${l/2} 32" fill="none" stroke="${r}" stroke-width="${o}" stroke-linejoin="round" stroke-linecap="round" />
19
- `;break}let c=`<rect width="${l}" height="${i}" fill="${t}"${s} />`;return `
20
- <pattern id="${a}" width="${l}" height="${i}" patternTransform="${m}" patternUnits="userSpaceOnUse">
19
+ `;break}let c=`<rect width="${l}" height="${a}" fill="${t}"${s} />`;return `
20
+ <pattern id="${i}" width="${l}" height="${a}" patternTransform="${m}" patternUnits="userSpaceOnUse">
21
21
  ${c}
22
22
  ${u}
23
23
  </pattern>
24
- `.trim()}var h=new Proxy({},{get:(a,e)=>C()[e],has:(a,e)=>e in C(),ownKeys:()=>Reflect.ownKeys(C()),getOwnPropertyDescriptor:(a,e)=>Reflect.getOwnPropertyDescriptor(C(),e)});function H(a){return {id:a.id,line:{stroke:a.stroke??h.stroke,strokeWidth:a.strokeWidth??h.strokeWidth,smoothing:a.smoothing??false,dashed:a.dashed??false},fill:a.fill??h.areaFillAlpha,markers:{type:a.pointStyle??"none",size:a.pointSize??h.pointSize,stroke:a.stroke??h.stroke,fill:"#ffffff"},shadow:{color:a.shadowColor??"transparent",blur:a.shadowBlur??0,offsetX:a.shadowOffsetX??0,offsetY:a.shadowOffsetY??0}}}function w(a,e,t){let n=[],o=a.reduce((s,l)=>s+l.data.length,0),r=H(t);for(let s=0;s<a.length;s++){let l=a[s];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${s}`:void 0,points:l.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&o===1&&n.push({type:"circle",cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function he(a){let e=[];for(let t of a)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function Ce(a){let e=[];for(let t of a)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function z(a,e,t){let n=[],o=H(t);for(let r=0;r<a.length;r++){let s=a[r];if(s.data.length<2)continue;let l=he(s.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${r}`:void 0,points:l,stroke:s.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Te(a,e,t,n,o){let r=[],s=H(t);for(let l=0;l<a.length;l++){let i=a[l];if(i.data.length<2)continue;let m=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(o(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${l}`:void 0,points:[...m,...u],fill:i.color??s.fill,hatch:t.hatch,stroke:"none"});}return r}function B(a,e,t,n){if(a.length<2)return [];let o=x.splitByBoundaries(a,t.boundaries,t.getValue,t.interpolate),r=[];for(let s=0;s<o.length;s++){let l=o[s];if(l.data.length<2)continue;let i=t.getColor(l.zoneIndex);if(!i)continue;let m=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...m,...u],fill:i,hatch:t.getHatch?.(l.zoneIndex),stroke:"none"});}return r}function Le(a,e,t,n){let o=x.splitByThreshold(a,e,s=>s.value,x.interpolateDataPoint),r=[];return n.below&&r.push(...w(o.below.map(s=>({data:s})),t,n.below)),n.above&&r.push(...w(o.above.map(s=>({data:s})),t,n.above)),r}function $(a,e,t,n){let o=H(t);if(!o.markers.type||o.markers.type==="none")return [];let r=[];for(let s=0;s<a.length;s++){let l=a[s],i=e.timeScale.map(l.time),m=e.valueScale.map(l.value),u=n(l),c=t.pointStroke??u,d=t.pointFill??u,p=t.pointStrokeWidth??1.5,f=t.id?`${t.id}-marker-${s}`:void 0;G(r,f,o.markers.type,i,m,o.markers.size,c,d,p);}return r}function G(a,e,t,n,o,r,s,l,i){switch(t){case "circle":a.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:i,id:e});break;case "square":a.push({type:"rect",x:n-r,y:o-r,w:r*2,h:r*2,fill:l,stroke:s,strokeWidth:i,id:e});break;case "cross":a.push({type:"line",x1:n-r,y1:o-r,x2:n+r,y2:o+r,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n-r,y1:o+r,x2:n+r,y2:o-r,stroke:s,strokeWidth:i,id:e});break;case "diamond":a.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o},{x:n,y:o+r},{x:n-r,y:o}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "triangle":a.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o+r},{x:n-r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?r:r*.5,d=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(d),y:o+c*Math.sin(d)});}a.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break}case "arrow":a.push({type:"path",points:[{x:n-r,y:o+r},{x:n,y:o-r},{x:n+r,y:o+r}],stroke:s,strokeWidth:i,fill:"none",id:e});break;case "plus":a.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n,y1:o-r,x2:n,y2:o+r,stroke:s,strokeWidth:i,id:e});break;case "triangle-down":a.push({type:"path",points:[{x:n,y:o+r},{x:n+r,y:o-r},{x:n-r,y:o-r}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+r*Math.cos(c),y:o+r*Math.sin(c)});}a.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break}case "hourglass":a.push({type:"path",points:[{x:n-r,y:o-r},{x:n+r,y:o-r},{x:n-r,y:o+r},{x:n+r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "line-horizontal":a.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:i,id:e});break;default:a.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:i,id:e});}}var T=12,V=8,Z=20,De=11,Y=18,X=a=>[...a].length*De*.6;function Me(a,e="vertical"){if(e==="horizontal"){let n=0;for(let o of a)n+=T+V+X(o.name)+Y;return {width:Math.max(0,n-Y),height:Z}}let t=0;for(let n of a)t=Math.max(t,X(n.name));return {width:T+V+t,height:a.length*Z}}function _e(a){let{items:e,x:t,y:n,orientation:o="vertical"}=a,r=[],s=t;return e.forEach((l,i)=>{let m=o==="horizontal"?s:t,u=o==="horizontal"?n:n+i*Z;r.push({type:"rect",x:m,y:u,w:T,h:T,fill:l.color,stroke:h.legendStroke,strokeWidth:1},{type:"text",content:l.name,x:m+T+V,y:u+T-2,fontSize:h.legendFont,fill:h.legendText}),o==="horizontal"&&(s+=T+V+X(l.name)+Y);}),{type:"group",cssClass:"chart-legend",commands:r}}function $e(a){let{xTicks:e,yTicks:t,xRange:n,yRange:o,stroke:r=h.gridStroke,strokeWidth:s=h.gridStrokeWidth,dashed:l=false,opacity:i=h.gridOpacity}=a,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:r,strokeWidth:s,dashed:l,opacity:i});if(e)for(let u of e)m.push({type:"line",x1:u,y1:o[0],x2:u,y2:o[1],stroke:r,strokeWidth:s,dashed:l,opacity:i});return m}var pe=new Map;function Pe(a,e){return `${a}|${JSON.stringify(e??{})}`}function P(a,e){let t=Pe(a,e),n=pe.get(t);return n||(n=new Intl.DateTimeFormat(a,e),pe.set(t,n)),n}var L=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,o]=this.#e,[r,s]=this.#t;return o===n?r:r+(t-n)/(o-n)*(s-r)}invert(e){let[t,n]=this.#e,[o,r]=this.#t;return r===o?t:t+(e-o)/(r-o)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},v=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],R=class{#e;#t;#n;constructor(e){this.#e=new L({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[o,r]=this.#e.domain(),s=r-o;if(s<=0)return {interval:v[0].ms};let l=s/e,i=v[0].ms;for(let c of v)if(c.ms>=l){i=c.ms;break}let m=i,u=Math.round(s/m);for(;u>n&&m<v[v.length-1].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.min(c+1,v.length-1)].ms,u=Math.round(s/m);}for(;u<t&&m>v[0].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.max(c-1,0)].ms,u=Math.round(s/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:o}=this.tickInterval((t+n)/2,t,n),[r,s]=this.#e.domain(),l=[],i=Math.ceil(r/o)*o;for(let m=i;m<=s;m+=o)l.push(m);return l}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return P(this.#t,n).format(new Date(e))}},F=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let o=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-o)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,o]=this.#t,r=this.#e.length;if(r<=1)return (n+o)/2;let s=this.#r*2*Math.abs(o-n),l=Math.abs(o-n)-s,i=o>=n?1:-1,m=l/r;return n+this.#r*Math.abs(o-n)*i+t*m}invert(e){let t=0,n=1/0;for(let o=0;o<this.#e.length;o++){let r=this.map(this.#e[o]),s=Math.abs(e-r);s<n&&(n=s,t=o);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function Re(a){return a==="dotted"?{dash:"dotted"}:a==="dashed"?{dash:"dashed"}:{}}function Fe(a){let{thresholds:e,valueScale:t,xRange:n}=a,[o,r]=n,[s,l]=t.range(),i=Math.min(s,l),m=Math.max(s,l),u=[],c=[];for(let d of e){let p=d.color??h.thresholdColor,f=t.map(d.value);d.fill==="above"?u.push({type:"rect",x:o,y:i,w:r-o,h:Math.max(0,f-i),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&u.push({type:"rect",x:o,y:f,w:r-o,h:Math.max(0,m-f),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??h.thresholdLine;if(g!=="none"){let y=Re(g),b={type:"line",x1:o,y1:f,x2:r,y2:f,stroke:p,strokeWidth:1,...y,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(b.shadowColor=d.shadowColor,b.shadowBlur=d.shadowBlur??4,b.shadowOffsetX=d.shadowOffsetX??0,b.shadowOffsetY=d.shadowOffsetY??2),u.push(b);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let y=typeof d.label=="object"?d.label:void 0,b=typeof d.label=="string"?d.label:y?.text??d.name,S=y?.position??"right";c.push({...We(b,S,o,r,f,p,y),id:d.id?`${d.id}-label`:void 0});}}return {inside:u,labels:c}}function Ae(a){let e=Fe(a);return [...e.inside,...e.labels]}function We(a,e,t,n,o,r,s){let l=(t+n)/2,i={type:"text",content:a,fontSize:h.thresholdFontSize,fill:r},m=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...i,...m,x:t+4,y:o-4,anchor:"start"};case "above":return {...i,...m,x:l,y:o-6,anchor:"middle"};case "below":return {...i,...m,x:l,y:o+14,anchor:"middle"};case "center":return {...i,...m,x:l,y:o-4,anchor:"middle"};case "outside-left":return {...i,...m,x:t-6,y:o+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...i,...m,x:n+6,y:o+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...i,...m,x:n-4,y:o-4,anchor:"end"}}}function fe(a,e,t,n){switch(a){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function E(a){let{ranges:e,timeScale:t,yRange:n,height:o}=a,[r,s]=n,l=[];for(let i of e){let m=t.map(i.startTime),u=t.map(i.endTime);if(i.fill!==void 0&&l.push({type:"rect",x:m,y:r,w:u-m,h:s-r,fill:i.fill,hatch:i.hatch,opacity:i.opacity}),i.edges)for(let c of [m,u])l.push({type:"line",x1:c,y1:r,x2:c,y2:s,stroke:i.edges.stroke,strokeWidth:i.edges.strokeWidth,dash:"dashed"});i.label&&l.push({type:"text",content:i.label,x:(m+u)/2,y:fe(i.labelPosition??"middle",r,s,o),anchor:"middle",fontSize:i.fontSize,fill:i.labelColor,rotate:i.rotate});}return l}function je(a){let{gaps:e,timeScale:t,yRange:n,height:o,fill:r=h.gapFill,hatch:s,fillOpacity:l=h.gapFillOpacity??.15,stroke:i=h.gapStroke,strokeWidth:m=h.gapStrokeWidth,dashed:u=true,fontSize:c=h.gapFontSize,fontFill:d=h.gapFontColor,labelBaseline:p="middle",labelRotate:f}=a;return E({timeScale:t,yRange:n,height:o,ranges:e.map(g=>{let y=g.style??"dashed_border",b=y==="filled"||y==="dashed_border",S=y==="dashed_border"&&u!==false;return {startTime:g.startTime,endTime:g.endTime,...b&&{fill:g.fill??r,hatch:g.hatch??s,opacity:g.fillOpacity??l},...S&&{edges:{stroke:i,strokeWidth:m}},label:g.label,labelPosition:g.labelBaseline??p,labelColor:d,fontSize:c,rotate:g.rotate??f}})})}function Oe(a){let{markers:e,timeScale:t,valueScale:n,yRange:o=[0,300]}=a,[r,s]=o,l=[];for(let i of e){let m=t.map(i.time),u=i.color??h.markerColor,c=i.pointStyle??(i.value!==void 0?"circle":"none"),d=i.lineStyle??"full";if(i.value!==void 0){let p=n.map(i.value);if(d==="to-value"?l.push({type:"line",x1:m,y1:s,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="to-top"?l.push({type:"line",x1:m,y1:r,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="full"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),c!=="none"&&G(l,void 0,c,m,p,h.markerSize,u,u,1.5),i.label){let f=d==="to-value"?p-10:r-6;l.push({type:"text",content:i.label,x:m,y:f,anchor:"middle",fontSize:11,fill:u});}}else d!=="none"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),i.label&&l.push({type:"text",content:i.label,x:m,y:r-6,anchor:"middle",fontSize:11,fill:u});}return l}function Ie(a){let{highlights:e,timeScale:t,yRange:n,height:o}=a;return E({timeScale:t,yRange:n,height:o,ranges:e.map(r=>({startTime:r.startTime,endTime:r.endTime,fill:r.color??h.highlightColor,opacity:r.opacity??h.highlightOpacity,label:r.label,labelPosition:r.labelPosition??"top",labelColor:r.color??h.highlightLabelColor,fontSize:h.annotationFontSize,rotate:r.rotate}))})}function U(a){return a&&a.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function He(a){let{annotations:e,timeScale:t,valueScales:n}=a,o=[],r=s=>{let l=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:l?l.map(s.value):0}};for(let s of e){let l=[],i=m=>l.push(m);switch(s.type){case "line":{let m=r(s.from),u=r(s.to);i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:s.color??h.annotationColor,strokeWidth:s.width??h.annotationWidth,dash:s.dash});break}case "arrow":{let m=r(s.from),u=r(s.to),c=s.color??h.annotationColor,d=s.headSize??h.annotationHead;i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:s.width??h.annotationWidth});let p=Math.hypot(u.x-m.x,u.y-m.y)||1,f=(u.x-m.x)/p,g=(u.y-m.y)/p,y=u.x-f*d,b=u.y-g*d;i({type:"path",points:[{x:u.x,y:u.y},{x:y-g*d*.5,y:b+f*d*.5},{x:y+g*d*.5,y:b-f*d*.5}],fill:c,stroke:"none"});break}case "rect":{let m=r(s.from),u=r(s.to);i({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let m=r(s.at),u=s.color??"#334155",c=s.radius??h.annotationRadius,d=s.shape??"circle";d==="circle"?i({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):d==="square"?i({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(i({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),i({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=r(s.at);i({type:"text",content:s.text,x:m.x+(s.dx??0),y:m.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:h.annotationFontSize,fill:s.color??h.annotationColor,rotate:s.rotate});break}}if(s.id&&l.length>0){let m=U(s.id);o.push({type:"group",cssClass:`annotation annotation--${m}`,commands:l});}else o.push(...l);}return o}var q=class a{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new a({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var K=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
24
+ `.trim()}var p=new Proxy({},{get:(i,e)=>C()[e],has:(i,e)=>e in C(),ownKeys:()=>Reflect.ownKeys(C()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(C(),e)});function B(i){return {id:i.id,line:{stroke:i.stroke??p.stroke,strokeWidth:i.strokeWidth??p.strokeWidth,smoothing:i.smoothing??false,dashed:i.dashed??false},fill:i.fill??p.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??p.pointSize,stroke:i.stroke??p.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function w(i,e,t){let n=[];i.reduce((s,l)=>s+l.data.length,0);let r=B(t);for(let s=0;s<i.length;s++){let l=i[s];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${s}`:void 0,points:l.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${s}`:void 0,cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function he(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function Ce(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function z(i,e,t){let n=[],o=B(t);for(let r=0;r<i.length;r++){let s=i[r];if(s.data.length<2)continue;let l=he(s.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${r}`:void 0,points:l,stroke:s.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Te(i,e,t,n,o){let r=[],s=B(t);for(let l=0;l<i.length;l++){let a=i[l];if(a.data.length<2)continue;let m=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(o(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${l}`:void 0,points:[...m,...u],fill:a.color??s.fill,hatch:t.hatch,stroke:"none"});}return r}function H(i,e,t,n){if(i.length<2)return [];let o=x.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),r=[];for(let s=0;s<o.length;s++){let l=o[s];if(l.data.length<2)continue;let a=t.getColor(l.zoneIndex);if(!a)continue;let m=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...m,...u],fill:a,hatch:t.getHatch?.(l.zoneIndex),stroke:"none"});}return r}function Le(i,e,t,n){let o=x.splitByThreshold(i,e,s=>s.value,x.interpolateDataPoint),r=[];return n.below&&r.push(...w(o.below.map(s=>({data:s})),t,n.below)),n.above&&r.push(...w(o.above.map(s=>({data:s})),t,n.above)),r}function P(i,e,t,n){let o=B(t);if(!o.markers.type||o.markers.type==="none")return [];let r=[];for(let s=0;s<i.length;s++){let l=i[s],a=e.timeScale.map(l.time),m=e.valueScale.map(l.value),u=n(l),c=t.pointStroke??u,d=t.pointFill??u,h=t.pointStrokeWidth??1.5,f=t.id?`${t.id}-marker-${s}`:void 0;G(r,f,o.markers.type,a,m,o.markers.size,c,d,h);}return r}function G(i,e,t,n,o,r,s,l,a){switch(t){case "circle":i.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-r,y:o-r,w:r*2,h:r*2,fill:l,stroke:s,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-r,y1:o-r,x2:n+r,y2:o+r,stroke:s,strokeWidth:a,id:e},{type:"line",x1:n-r,y1:o+r,x2:n+r,y2:o-r,stroke:s,strokeWidth:a,id:e});break;case "diamond":i.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o},{x:n,y:o+r},{x:n-r,y:o}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o+r},{x:n-r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?r:r*.5,d=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(d),y:o+c*Math.sin(d)});}i.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-r,y:o+r},{x:n,y:o-r},{x:n+r,y:o+r}],stroke:s,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:a,id:e},{type:"line",x1:n,y1:o-r,x2:n,y2:o+r,stroke:s,strokeWidth:a,id:e});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:o+r},{x:n+r,y:o-r},{x:n-r,y:o-r}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+r*Math.cos(c),y:o+r*Math.sin(c)});}i.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-r,y:o-r},{x:n+r,y:o-r},{x:n-r,y:o+r},{x:n+r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:a,id:e});}}var L=12,V=8,Y=20,Me=11,Z=18,X=i=>[...i].length*Me*.6;function De(i,e="vertical"){if(e==="horizontal"){let n=0;for(let o of i)n+=L+V+X(o.name)+Z;return {width:Math.max(0,n-Z),height:Y}}let t=0;for(let n of i)t=Math.max(t,X(n.name));return {width:L+V+t,height:i.length*Y}}function _e(i){let{items:e,x:t,y:n,orientation:o="vertical"}=i,r=[],s=t;return e.forEach((l,a)=>{let m=o==="horizontal"?s:t,u=o==="horizontal"?n:n+a*Y;r.push({type:"rect",x:m,y:u,w:L,h:L,fill:l.color,stroke:p.legendStroke,strokeWidth:1},{type:"text",content:l.name,x:m+L+V,y:u+L-2,fontSize:p.legendFont,fill:p.legendText}),o==="horizontal"&&(s+=L+V+X(l.name)+Z);}),{type:"group",cssClass:"chart-legend",commands:r}}function $e(i){let{xTicks:e,yTicks:t,xRange:n,yRange:o,stroke:r=p.gridStroke,strokeWidth:s=p.gridStrokeWidth,dashed:l=false,opacity:a=p.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:r,strokeWidth:s,dashed:l,opacity:a});if(e)for(let u of e)m.push({type:"line",x1:u,y1:o[0],x2:u,y2:o[1],stroke:r,strokeWidth:s,dashed:l,opacity:a});return m}var pe=new Map;function Pe(i,e){return `${i}|${JSON.stringify(e??{})}`}function F(i,e){let t=Pe(i,e),n=pe.get(t);return n||(n=new Intl.DateTimeFormat(i,e),pe.set(t,n)),n}var M=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,o]=this.#e,[r,s]=this.#t;return o===n?r:r+(t-n)/(o-n)*(s-r)}invert(e){let[t,n]=this.#e,[o,r]=this.#t;return r===o?t:t+(e-o)/(r-o)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},v=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],R=class{#e;#t;#n;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[o,r]=this.#e.domain(),s=r-o;if(s<=0)return {interval:v[0].ms};let l=s/e,a=v[0].ms;for(let c of v)if(c.ms>=l){a=c.ms;break}let m=a,u=Math.round(s/m);for(;u>n&&m<v[v.length-1].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.min(c+1,v.length-1)].ms,u=Math.round(s/m);}for(;u<t&&m>v[0].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.max(c-1,0)].ms,u=Math.round(s/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:o}=this.tickInterval((t+n)/2,t,n),[r,s]=this.#e.domain(),l=[],a=Math.ceil(r/o)*o;for(let m=a;m<=s;m+=o)l.push(m);return l}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return F(this.#t,n).format(new Date(e))}},A=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let o=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-o)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,o]=this.#t,r=this.#e.length;if(r<=1)return (n+o)/2;let s=this.#r*2*Math.abs(o-n),l=Math.abs(o-n)-s,a=o>=n?1:-1,m=l/r;return n+this.#r*Math.abs(o-n)*a+t*m}invert(e){let t=0,n=1/0;for(let o=0;o<this.#e.length;o++){let r=this.map(this.#e[o]),s=Math.abs(e-r);s<n&&(n=s,t=o);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function Fe(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Re(i){let{thresholds:e,valueScale:t,xRange:n}=i,[o,r]=n,[s,l]=t.range(),a=Math.min(s,l),m=Math.max(s,l),u=[],c=[];for(let d of e){let h=d.color??p.thresholdColor,f=t.map(d.value);d.fill==="above"?u.push({type:"rect",x:o,y:a,w:r-o,h:Math.max(0,f-a),fill:h,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&u.push({type:"rect",x:o,y:f,w:r-o,h:Math.max(0,m-f),fill:h,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??p.thresholdLine;if(g!=="none"){let y=Fe(g),b={type:"line",x1:o,y1:f,x2:r,y2:f,stroke:h,strokeWidth:1,...y,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(b.shadowColor=d.shadowColor,b.shadowBlur=d.shadowBlur??4,b.shadowOffsetX=d.shadowOffsetX??0,b.shadowOffsetY=d.shadowOffsetY??2),u.push(b);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let y=typeof d.label=="object"?d.label:void 0,b=typeof d.label=="string"?d.label:y?.text??d.name,S=y?.position??"right",T=je(b,S,o,r,f,h,y);c.push({...T,y:We(T.y,Math.min(s,l),Math.max(s,l),p.thresholdFontSize),id:d.id?`${d.id}-label`:void 0});}}return {inside:u,labels:c}}function Ae(i){let e=Re(i);return [...e.inside,...e.labels]}function We(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function je(i,e,t,n,o,r,s){let l=(t+n)/2,a={type:"text",content:i,fontSize:p.thresholdFontSize,fill:r},m=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:o-4,anchor:"start"};case "above":return {...a,...m,x:l,y:o-6,anchor:"middle"};case "below":return {...a,...m,x:l,y:o+14,anchor:"middle"};case "center":return {...a,...m,x:l,y:o-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:o+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:o+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:o-4,anchor:"end"}}}function fe(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function E(i){let{ranges:e,timeScale:t,yRange:n,height:o}=i,[r,s]=n,l=[],[a,m]=t.range(),u=Math.min(a,m),c=Math.max(a,m),d=h=>Math.max(u,Math.min(c,h));for(let h of e){let f=d(t.map(h.startTime)),g=d(t.map(h.endTime));if(h.fill!==void 0&&l.push({type:"rect",x:f,y:r,w:g-f,h:s-r,fill:h.fill,hatch:h.hatch,opacity:h.opacity}),h.edges)for(let y of [f,g])l.push({type:"line",x1:y,y1:r,x2:y,y2:s,stroke:h.edges.stroke,strokeWidth:h.edges.strokeWidth,dash:"dashed"});h.label&&l.push({type:"text",content:h.label,x:(f+g)/2,y:fe(h.labelPosition??"middle",r,s,o),anchor:"middle",fontSize:h.fontSize,fill:h.labelColor,rotate:h.rotate});}return l}function Oe(i){let{gaps:e,timeScale:t,yRange:n,height:o,fill:r=p.gapFill,hatch:s,fillOpacity:l=p.gapFillOpacity??.15,stroke:a=p.gapStroke,strokeWidth:m=p.gapStrokeWidth,dashed:u=true,fontSize:c=p.gapFontSize,fontFill:d=p.gapFontColor,labelBaseline:h="middle",labelRotate:f}=i;return E({timeScale:t,yRange:n,height:o,ranges:e.map(g=>{let y=g.style??"dashed_border",b=y==="filled"||y==="dashed_border",S=y==="dashed_border"&&u!==false;return {startTime:g.startTime,endTime:g.endTime,...b&&{fill:g.fill??r,hatch:g.hatch??s,opacity:g.fillOpacity??l},...S&&{edges:{stroke:a,strokeWidth:m}},label:g.label,labelPosition:g.labelBaseline??h,labelColor:d,fontSize:c,rotate:g.rotate??f}})})}function Ie(i){let{markers:e,timeScale:t,valueScale:n,yRange:o=[0,300]}=i,[r,s]=o,l=[];for(let a of e){let m=t.map(a.time),u=a.color??p.markerColor,c=a.pointStyle??(a.value!==void 0?"circle":"none"),d=a.lineStyle??"full";if(a.value!==void 0){let h=n.map(a.value);if(d==="to-value"?l.push({type:"line",x1:m,y1:s,x2:m,y2:h,stroke:u,strokeWidth:1,dashed:true}):d==="to-top"?l.push({type:"line",x1:m,y1:r,x2:m,y2:h,stroke:u,strokeWidth:1,dashed:true}):d==="full"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),c!=="none"&&G(l,void 0,c,m,h,p.markerSize,u,u,1.5),a.label){let f=d==="to-value"?h-10:r-6;l.push({type:"text",content:a.label,x:m,y:f,anchor:"middle",fontSize:11,fill:u});}}else d!=="none"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),a.label&&l.push({type:"text",content:a.label,x:m,y:r-6,anchor:"middle",fontSize:11,fill:u});}return l}function Be(i){let{highlights:e,timeScale:t,yRange:n,height:o}=i;return E({timeScale:t,yRange:n,height:o,ranges:e.map(r=>({startTime:r.startTime,endTime:r.endTime,fill:r.color??p.highlightColor,opacity:r.opacity??p.highlightOpacity,label:r.label,labelPosition:r.labelPosition??"top",labelColor:r.color??p.highlightLabelColor,fontSize:p.annotationFontSize,rotate:r.rotate}))})}function U(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function He(i){let{annotations:e,timeScale:t,valueScales:n}=i,o=[],r=s=>{let l=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:l?l.map(s.value):0}};for(let s of e){let l=[],a=m=>l.push(m);switch(s.type){case "line":{let m=r(s.from),u=r(s.to);a({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:s.color??p.annotationColor,strokeWidth:s.width??p.annotationWidth,dash:s.dash});break}case "arrow":{let m=r(s.from),u=r(s.to),c=s.color??p.annotationColor,d=s.headSize??p.annotationHead;a({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:s.width??p.annotationWidth});let h=Math.hypot(u.x-m.x,u.y-m.y)||1,f=(u.x-m.x)/h,g=(u.y-m.y)/h,y=u.x-f*d,b=u.y-g*d;a({type:"path",points:[{x:u.x,y:u.y},{x:y-g*d*.5,y:b+f*d*.5},{x:y+g*d*.5,y:b-f*d*.5}],fill:c,stroke:"none"});break}case "rect":{let m=r(s.from),u=r(s.to);a({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let m=r(s.at),u=s.color??"#334155",c=s.radius??p.annotationRadius,d=s.shape??"circle";d==="circle"?a({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):d==="square"?a({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(a({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),a({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=r(s.at);a({type:"text",content:s.text,x:m.x+(s.dx??0),y:m.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:p.annotationFontSize,fill:s.color??p.annotationColor,rotate:s.rotate});break}}if(s.id&&l.length>0){let m=U(s.id);o.push({type:"group",cssClass:`annotation annotation--${m}`,commands:l});}else o.push(...l);}return o}var q=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var K=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
25
25
  `);return `<clipPath id="${e}">
26
26
  ${t}
27
- </clipPath>`}get regions(){return [...this.#e]}};var A={axisColor:h.axisColor,tickColor:h.tickColor,textColor:h.textColor,textSize:h.textSize},W=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??A).axisColor}get tickColor(){return (this.#t.colors??A).tickColor}get textColor(){return (this.#t.colors??A).textColor}get textSize(){return (this.#t.colors??A).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,o=this.#e.ticks({minTicks:e,maxTicks:t}).map(r=>({time:r,x:this.#e.map(r),label:this.tickLabel(r)}));return this.antiOverlap(o)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:o}=this.#e.tickInterval((t+n)/2,t,n),r={};return o<6e4?(r.hour="2-digit",r.minute="2-digit",r.second="2-digit"):o<36e5||o<864e5?(r.hour="2-digit",r.minute="2-digit"):o<31536e6?(r.day="numeric",r.month="short",o>=2592e6&&(r.day=void 0,r.month="long")):(r.year="numeric",o<2*31536e6&&(r.month="short")),this.#e.format(e,r)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let o=1;o<e.length;o++){let r=n[n.length-1].x;Math.abs(e[o].x-r)>=t&&n.push(e[o]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??A,n=this.#t.y??0,o=[],[r,s]=this.#e.range();o.push({type:"line",x1:r,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of e)o.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),o.push({type:"text",content:l.label,x:l.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return o}};var j={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Be(a){return Math.abs(a)>=1e6?`${(a/1e6).toFixed(1)}M`:Math.abs(a)>=1e3?`${(a/1e3).toFixed(1)}k`:Number.isInteger(a)?String(a):a.toFixed(1)}function Ve(a){let e=new Array(a.length).fill(false),t=0;for(;t<a.length;){let n=t;for(;n+1<a.length&&a[n+1].label===a[t].label;)n++;for(let o=t+1;o<n;o++)e[o]=true;t=n+1;}return e}var J=class{#e;#t;constructor(e){this.#e=new L({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??j).axisColor}get tickColor(){return (this.#t.colors??j).tickColor}get textColor(){return (this.#t.colors??j).textColor}get textSize(){return (this.#t.colors??j).textSize}generateTicks(){let e=this.#t.format??Be,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,o]=this.#e.domain(),r=Math.min(n,o),s=Math.max(n,o),l=s-r;if(l===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let i=l/t,m=Math.pow(10,Math.floor(Math.log10(i))),u=i/m,c;if(u<=1.5?c=m:u<=3?c=2*m:u<=7?c=5*m:c=10*m,c<=0||!Number.isFinite(c))return [{value:n,position:this.#e.map(n),label:e(n)}];let d=[],p=Math.ceil(r/c)*c;for(let f=p;f<=s;f+=c)d.push({value:f,position:this.#e.map(f),label:e(f)});return d}render(){let e=this.generateTicks(),t=this.#t.colors??j,n=this.#t.x??0,o=this.#t.orientation??"vertical",r=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,i=u=>s.some(c=>Math.abs(c-u)<=l),m=[];if(o==="vertical"){let[u,c]=this.#e.range();m.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=Ve(e);e.forEach((p,f)=>{let g=i(p.position),y=d[f]?{opacity:0}:{};r==="left"?(m.push({type:"line",x1:n-4,y1:p.position,x2:n,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n-8,y:p.position+4,anchor:"end",fontSize:11,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:p.position,x2:n+4,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n+8,y:p.position+4,anchor:"start",fontSize:11,fill:t.textColor,...y}));});}else {let[u,c]=this.#e.range();m.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)m.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return m}};var Q=class a{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(r=>r.value!==null).sort((r,s)=>r.time-s.time),o=[];for(let r=0;r<n.length;r++){let s=Math.max(0,r-t+1),l=n.slice(s,r+1),i=l.reduce((m,u)=>m+u.value,0)/l.length;o.push({time:n[r].time,value:i});}return o}static exponential(e,t){let n=[...e].filter(l=>l.value!==null).sort((l,i)=>l.time-i.time);if(n.length===0)return [];let o=2/(t+1),r=[],s=n[0].value;r.push({time:n[0].time,value:s});for(let l=1;l<n.length;l++)s=n[l].value*o+s*(1-o),r.push({time:n[l].time,value:s});return r}points(){return (this.#n==="exponential"?a.exponential(this.#e,this.#t):a.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var ee=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,o)=>n-o).map(String);this.#t=t,this.#e=new F({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:o}=this.#n,r=new Set(o??[]);return this.#t.map((s,l)=>{let i=Number(s),m=t?e[i]??String(i):String(i),u=this.#e.map(i),c=n?h.palette[l%h.palette.length]:void 0;return {value:i,label:m,y:u,color:c,isGap:r.has(i)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return h.palette[t%h.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let o of e)o.isGap||n.push({type:"text",content:o.label,x:t,y:o.y+4,anchor:"end",fontSize:11,fill:o.color??h.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var k=class a{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++a.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var te=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,stroke:e.stroke??h.stroke,strokeWidth:e.strokeWidth??h.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??h.pointThreshold,o=e.gapThreshold??h.gapThreshold,r=e.id,s=x.getRuns(this.data,c=>c.value===null,o),l=s.reduce((c,d)=>c+d.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=s.map(c=>({data:c})),u=[];if(u.push(...w(m,i,{...t,id:r?`${r}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&l<=n)for(let c of s)u.push(...$(c,i,{...t,id:r?`${r}-marker`:void 0},()=>t.stroke));return u}};var ne=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(o=>o.value!==null).sort((o,r)=>o.time-r.time),n=[];for(let o=0;o<t.length;o++){let r=this.timeScale.map(t[o].time),s=e.map(t[o].value);o===0?n.push({x:r,y:s}):n.push({x:r,y:n[n.length-1].y},{x:r,y:s});}return n}render(){let e=x.getRuns(this.data,o=>o.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(o=>({data:o}));return z(n,t,{stroke:this.#e.stroke??h.stroke,strokeWidth:this.#e.strokeWidth??h.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var re=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??h.bandFill,n=e.hatch,o=e.avgLine??false,r=e.avgLineColor??h.bandAvgLine,s=e.bandWidth??10,l=[];for(let i of this.data){if(i.min===null||i.max===null)continue;let m=this.timeScale.map(i.time),u=e.valueScale.map(i.max),c=e.valueScale.map(i.min),d=s,p=this.data.indexOf(i);if(l.push({type:"rect",x:m-d/2,y:u,w:d,h:c-u,fill:t,hatch:n,opacity:this.opacity(i.count),id:this.id?`${this.id}-slot-${p}`:void 0}),o&&i.avg!==null){let f=e.valueScale.map(i.avg);l.push({type:"line",x1:m-d/2,y1:f,x2:m+d/2,y2:f,stroke:r,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return l}};var oe=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??h.minColor,n=e.maxColor??h.maxColor,o=e.avgColor??h.avgColor,r=e.avgDashed??true,s=e.smoothing??false,l=e.strokeWidth??h.strokeWidth,i=x.getRuns(this.data,p=>p.min===null||p.max===null||p.avg===null);if(i.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];i.forEach((p,f)=>{p.length<2||(e.fillToMax&&u.push(...B(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...B(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=i.filter(p=>p.length>=2),d=p=>c.map(f=>({data:f.map(g=>({time:g.time,value:p(g)}))}));return u.push(...w(d(p=>p.max),m,{stroke:n,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...w(d(p=>p.min),m,{stroke:t,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...w(d(p=>p.avg),m,{stroke:o,strokeWidth:l,smoothing:s,dashed:r,id:this.id?`${this.id}-avg`:void 0})),u}};var ie=class extends k{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??h.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??h.stroke,n={stroke:t,strokeWidth:e.strokeWidth??h.strokeWidth,smoothing:e.smoothing??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize},o=e.gapThreshold??h.gapThreshold,r=e.pointThreshold??h.pointThreshold,s=x.getRuns(this.data,u=>u.value===null,o),l=s.reduce((u,c)=>u+c.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of s){if(u.length<2)continue;if(e.fill){let f=e.fill.value,g=x.splitByBoundaries(u,[f],b=>b.value,x.interpolateDataPoint),y=e.valueScale.map(f);for(let b=0;b<g.length;b++){let S=g[b];if(S.data.length<2)continue;let O=S.zoneIndex>0;if(e.fill.side==="above"===O){let I=S.data.map(me=>({x:this.timeScale.map(me.time),y:e.valueScale.map(me.value)}));m.push({type:"path",cssClass:"series-fill",id:this.id?`${this.id}-fill-${b}`:void 0,points:[...I,{x:I[I.length-1].x,y},{x:I[0].x,y}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(f=>f.value),p=x.splitByBoundaries(u,c,f=>f.value,x.interpolateDataPoint).map(f=>({data:f.data,color:this.#n(f.zoneIndex)}));m.push(...w(p,i,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&l<=r&&m.push(...$(u,i,{...n,id:this.id?`${this.id}-marker`:void 0},f=>{let g=t;for(let y of this.#t)f.value>=y.value&&(g=y.color);return g}));}return m}};var Ee=1,ae=class{#e;constructor(e,t,n,o){this.#e={...e,xRange:t,y:n,height:o};}render(){let{items:e,timeScale:t,background:n,hatch:o,showAxis:r,xRange:s,y:l,height:i}=this.#e,m=[];n&&m.push({type:"rect",x:s[0],y:l,w:s[1]-s[0],h:i,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),d=t.map(u.endTime);if(d<s[0]||c>s[1])continue;let p=Math.max(s[0],Math.min(s[1],c)),f=Math.max(s[0],Math.min(s[1],d)),g=Math.max(f-p,Ee);p+g>s[1]&&(p=Math.max(s[0],s[1]-g));let y=p+g/2;if(m.push({type:"rect",x:p,y:l,w:g,h:i,hatch:u.hatch??o,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(r){let u=new W({domain:t.domain(),xRange:s,y:l+i+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:o}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+o-t*.25;default:return n+o/2+t*.35}}};var se=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:o=false,showMax:r=false,showAvg:s=true,showMedian:l=false,labelPosition:i="end",lineColor:m=h.statsLineColor,labelColor:u=h.statsLabelColor}=this.#e,c=ue.compute(e),d=[{name:"min",value:c.min,enabled:o},{name:"max",value:c.max,enabled:r},{name:"avg",value:c.avg,enabled:s},{name:"median",value:c.median,enabled:l}],p=[],[f,g]=n;for(let y of d.filter(b=>b.enabled)){let b=t.map(y.value);p.push({type:"line",x1:f,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let S=`${y.name}: ${y.value.toFixed(1)}`;(i==="start"||i==="both")&&p.push({type:"text",content:S,x:f+4,y:b-4,anchor:"start",fontSize:10,fill:u}),(i==="end"||i==="both")&&p.push({type:"text",content:S,x:g-4,y:b-4,anchor:"end",fontSize:10,fill:u}),i==="center"&&p.push({type:"text",content:S,x:(f+g)/2,y:b-4,anchor:"middle",fontSize:10,fill:u});}return p}};var D=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let o=this.#n&&n?this.#r(e,n,t):t;return P(this.#e,o).format(new Date(e))}catch{for(let o of this.#t)try{return P(o,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),o=this.format(t);return `${n} \u2014 ${o}`}#r(e,t,n){let o=Math.abs(e-t),r=864e5,s=36e5,l=6e4,i={};return o<l?(i.second="2-digit",i.minute="2-digit",i.hour="2-digit"):o<s?(i.minute="2-digit",i.hour="2-digit"):o<r?(i.hour="2-digit",i.minute="2-digit"):o<7*r?(i.weekday="short",i.day="numeric"):o<365*r?(i.month="short",i.day="numeric"):(i.month="short",i.year="numeric"),{...n,...i}}};var M=class a{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new a({unit:e,decimals:t})}static temperature(e="\xB0C"){return new a({unit:e,decimals:1})}static percentage(){return new a({unit:"%",decimals:0})}};var _=class a{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((o,r)=>{n[r]=o;}),new a({map:n,showValue:t})}};var Ne={time:new D,value:new M,enum:new _};function le(a,e){let t=C();return {color:a.color??t.stroke,width:a.width??t.strokeWidth,style:a.style??"solid",smoothing:a.smoothing??false,shape:a.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:a.gapThreshold??t.gapThreshold,opacity:a.opacity??1}}function ge(a){let e=a.style?.line;return e===false?[]:e===void 0?[le({},a)]:Array.isArray(e)?e.map(t=>le(t,a)):[le(e,a)]}function ye(a){let e=a.style?.markers;if(!e?.type||e.type==="none")return;let t=C(),o=(a.style?.line&&!Array.isArray(a.style.line)?a.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??o,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function be(a){let e=a.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function xe(a){return a.style?.gap}function Se(a){return a.style?.fill}function ze(a){return {lines:ge(a),fill:Se(a),markers:ye(a),shadow:be(a),gap:xe(a),id:a.style?.id??a.id}}/*!
27
+ </clipPath>`}get regions(){return [...this.#e]}};var W={axisColor:p.axisColor,tickColor:p.tickColor,textColor:p.textColor,textSize:p.textSize},j=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??W).axisColor}get tickColor(){return (this.#t.colors??W).tickColor}get textColor(){return (this.#t.colors??W).textColor}get textSize(){return (this.#t.colors??W).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,o=this.#e.ticks({minTicks:e,maxTicks:t}).map(r=>({time:r,x:this.#e.map(r),label:this.tickLabel(r)}));return this.antiOverlap(o)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:o}=this.#e.tickInterval((t+n)/2,t,n),r={};return o<6e4?(r.hour="2-digit",r.minute="2-digit",r.second="2-digit"):o<36e5||o<864e5?(r.hour="2-digit",r.minute="2-digit"):o<31536e6?(r.day="numeric",r.month="short",o>=2592e6&&(r.day=void 0,r.month="long")):(r.year="numeric",o<2*31536e6&&(r.month="short")),this.#e.format(e,r)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let o=1;o<e.length;o++){let r=n[n.length-1].x;Math.abs(e[o].x-r)>=t&&n.push(e[o]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??W,n=this.#t.y??0,o=[],[r,s]=this.#e.range();o.push({type:"line",x1:r,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of e)o.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),o.push({type:"text",content:l.label,x:l.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return o}};var O={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Ve(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function Ee(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let o=t+1;o<n;o++)e[o]=true;t=n+1;}return e}var J=class{#e;#t;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??O).axisColor}get tickColor(){return (this.#t.colors??O).tickColor}get textColor(){return (this.#t.colors??O).textColor}get textSize(){return (this.#t.colors??O).textSize}generateTicks(){let e=this.#t.format??Ve,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,o]=this.#e.domain(),r=Math.min(n,o),s=Math.max(n,o),l=s-r;if(l===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let a=l/t,m=Math.pow(10,Math.floor(Math.log10(a))),u=a/m,c;if(u<=1.5?c=m:u<=3?c=2*m:u<=7?c=5*m:c=10*m,c<=0||!Number.isFinite(c))return [{value:n,position:this.#e.map(n),label:e(n)}];let d=[],h=Math.ceil(r/c)*c;for(let f=h;f<=s;f+=c)d.push({value:f,position:this.#e.map(f),label:e(f)});return d}render(){let e=this.generateTicks(),t=this.#t.colors??O,n=this.#t.x??0,o=this.#t.orientation??"vertical",r=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,a=u=>s.some(c=>Math.abs(c-u)<=l),m=[];if(o==="vertical"){let[u,c]=this.#e.range();m.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=Ee(e);e.forEach((h,f)=>{let g=a(h.position),y=d[f]?{opacity:0}:{};r==="left"?(m.push({type:"line",x1:n-4,y1:h.position,x2:n,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:h.label,x:n-8,y:h.position+4,anchor:"end",fontSize:11,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:h.position,x2:n+4,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:h.label,x:n+8,y:h.position+4,anchor:"start",fontSize:11,fill:t.textColor,...y}));});}else {let[u,c]=this.#e.range();m.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)m.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return m}};var Q=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(r=>r.value!==null).sort((r,s)=>r.time-s.time),o=[];for(let r=0;r<n.length;r++){let s=Math.max(0,r-t+1),l=n.slice(s,r+1),a=l.reduce((m,u)=>m+u.value,0)/l.length;o.push({time:n[r].time,value:a});}return o}static exponential(e,t){let n=[...e].filter(l=>l.value!==null).sort((l,a)=>l.time-a.time);if(n.length===0)return [];let o=2/(t+1),r=[],s=n[0].value;r.push({time:n[0].time,value:s});for(let l=1;l<n.length;l++)s=n[l].value*o+s*(1-o),r.push({time:n[l].time,value:s});return r}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var ee=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,o)=>n-o).map(String);this.#t=t,this.#e=new A({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:o}=this.#n,r=new Set(o??[]);return this.#t.map((s,l)=>{let a=Number(s),m=t?e[a]??String(a):String(a),u=this.#e.map(a),c=n?p.palette[l%p.palette.length]:void 0;return {value:a,label:m,y:u,color:c,isGap:r.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return p.palette[t%p.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let o of e)o.isGap||n.push({type:"text",content:o.label,x:t,y:o.y+4,anchor:"end",fontSize:11,fill:o.color??p.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var k=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var te=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,stroke:e.stroke??p.stroke,strokeWidth:e.strokeWidth??p.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??p.pointThreshold,o=e.gapThreshold??p.gapThreshold,r=e.id,s=x.getRuns(this.data,c=>c.value===null,o),l=s.reduce((c,d)=>c+d.length,0);if(l===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=s.map(c=>({data:c})),u=[];if(u.push(...w(m,a,{...t,id:r?`${r}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&l<=n)for(let c of s)u.push(...P(c,a,{...t,id:r?`${r}-marker`:void 0},()=>t.stroke));return u}};var ne=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(o=>o.value!==null).sort((o,r)=>o.time-r.time),n=[];for(let o=0;o<t.length;o++){let r=this.timeScale.map(t[o].time),s=e.map(t[o].value);o===0?n.push({x:r,y:s}):n.push({x:r,y:n[n.length-1].y},{x:r,y:s});}return n}render(){let e=x.getRuns(this.data,o=>o.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(o=>({data:o}));return z(n,t,{stroke:this.#e.stroke??p.stroke,strokeWidth:this.#e.strokeWidth??p.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var re=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??p.bandFill,n=e.hatch,o=e.avgLine??false,r=e.avgLineColor??p.bandAvgLine,s=e.bandWidth??10,l=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),u=e.valueScale.map(a.max),c=e.valueScale.map(a.min),d=s,h=this.data.indexOf(a);if(l.push({type:"rect",x:m-d/2,y:u,w:d,h:c-u,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${h}`:void 0}),o&&a.avg!==null){let f=e.valueScale.map(a.avg);l.push({type:"line",x1:m-d/2,y1:f,x2:m+d/2,y2:f,stroke:r,strokeWidth:1,id:this.id?`${this.id}-avg-${h}`:void 0});}}return l}};var oe=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??p.minColor,n=e.maxColor??p.maxColor,o=e.avgColor??p.avgColor,r=e.avgDashed??true,s=e.smoothing??false,l=e.strokeWidth??p.strokeWidth,a=x.getRuns(this.data,h=>h.min===null||h.max===null||h.avg===null);if(a.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];a.forEach((h,f)=>{h.length<2||(e.fillToMax&&u.push(...H(h,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...H(h,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=a.filter(h=>h.length>=2),d=h=>c.map(f=>({data:f.map(g=>({time:g.time,value:h(g)}))}));return u.push(...w(d(h=>h.max),m,{stroke:n,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...w(d(h=>h.min),m,{stroke:t,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...w(d(h=>h.avg),m,{stroke:o,strokeWidth:l,smoothing:s,dashed:r,id:this.id?`${this.id}-avg`:void 0})),u}};var ie=class extends k{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??p.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??p.stroke,n={stroke:t,strokeWidth:e.strokeWidth??p.strokeWidth,smoothing:e.smoothing??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize},o=e.gapThreshold??p.gapThreshold,r=e.pointThreshold??p.pointThreshold,s=x.getRuns(this.data,u=>u.value===null,o),l=s.reduce((u,c)=>u+c.length,0);if(l===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of s){if(u.length<2)continue;if(e.fill){let f=e.fill.value,g=x.splitByBoundaries(u,[f],b=>b.value,x.interpolateDataPoint),y=e.valueScale.map(f);for(let b=0;b<g.length;b++){let S=g[b];if(S.data.length<2)continue;let T=S.zoneIndex>0;if(e.fill.side==="above"===T){let I=S.data.map(me=>({x:this.timeScale.map(me.time),y:e.valueScale.map(me.value)}));m.push({type:"path",cssClass:"series-fill",id:this.id?`${this.id}-fill-${b}`:void 0,points:[...I,{x:I[I.length-1].x,y},{x:I[0].x,y}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(f=>f.value),h=x.splitByBoundaries(u,c,f=>f.value,x.interpolateDataPoint).map(f=>({data:f.data,color:this.#n(f.zoneIndex)}));m.push(...w(h,a,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&l<=r&&m.push(...P(u,a,{...n,id:this.id?`${this.id}-marker`:void 0},f=>{let g=t;for(let y of this.#t)f.value>=y.value&&(g=y.color);return g}));}return m}};var Ne=1,ae=class{#e;constructor(e,t,n,o){this.#e={...e,xRange:t,y:n,height:o};}render(){let{items:e,timeScale:t,background:n,hatch:o,showAxis:r,xRange:s,y:l,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:s[0],y:l,w:s[1]-s[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),d=t.map(u.endTime);if(d<s[0]||c>s[1])continue;let h=Math.max(s[0],Math.min(s[1],c)),f=Math.max(s[0],Math.min(s[1],d)),g=Math.max(f-h,Ne);h+g>s[1]&&(h=Math.max(s[0],s[1]-g));let y=h+g/2;if(m.push({type:"rect",x:h,y:l,w:g,h:a,hatch:u.hatch??o,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(r){let u=new j({domain:t.domain(),xRange:s,y:l+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:o}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+o-t*.25;default:return n+o/2+t*.35}}};var se=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:o=false,showMax:r=false,showAvg:s=true,showMedian:l=false,labelPosition:a="end",lineColor:m=p.statsLineColor,labelColor:u=p.statsLabelColor}=this.#e,c=ue.compute(e),d=[{name:"min",value:c.min,enabled:o},{name:"max",value:c.max,enabled:r},{name:"avg",value:c.avg,enabled:s},{name:"median",value:c.median,enabled:l}],h=[],[f,g]=n;for(let y of d.filter(b=>b.enabled)){let b=t.map(y.value);h.push({type:"line",x1:f,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let S=`${y.name}: ${y.value.toFixed(1)}`;(a==="start"||a==="both")&&h.push({type:"text",content:S,x:f+4,y:b-4,anchor:"start",fontSize:10,fill:u}),(a==="end"||a==="both")&&h.push({type:"text",content:S,x:g-4,y:b-4,anchor:"end",fontSize:10,fill:u}),a==="center"&&h.push({type:"text",content:S,x:(f+g)/2,y:b-4,anchor:"middle",fontSize:10,fill:u});}return h}};var D=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let o=this.#n&&n?this.#r(e,n,t):t;return F(this.#e,o).format(new Date(e))}catch{for(let o of this.#t)try{return F(o,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),o=this.format(t);return `${n} \u2014 ${o}`}#r(e,t,n){let o=Math.abs(e-t),r=864e5,s=36e5,l=6e4,a={};return o<l?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):o<s?(a.minute="2-digit",a.hour="2-digit"):o<r?(a.hour="2-digit",a.minute="2-digit"):o<7*r?(a.weekday="short",a.day="numeric"):o<365*r?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var _=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var $=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((o,r)=>{n[r]=o;}),new i({map:n,showValue:t})}};var ze={time:new D,value:new _,enum:new $};function le(i,e){let t=C();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function ge(i){let e=i.style?.line;return e===false?[]:e===void 0?[le({},i)]:Array.isArray(e)?e.map(t=>le(t,i)):[le(e,i)]}function ye(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=C(),o=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??o,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function be(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function xe(i){return i.style?.gap}function Se(i){return i.style?.fill}function Ge(i){return {lines:ge(i),fill:Se(i),markers:ye(i),shadow:be(i),gap:xe(i),id:i.style?.id??i.id}}/*!
28
28
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
29
29
  * MIT with Attribution: free use incl. commercial requires visible credit to
30
30
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
@@ -43,4 +43,4 @@ var N=class{};var x=class{static interpolateDataPoint(a,e,t){return {time:a.time
43
43
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
44
44
  * MIT with Attribution: free use incl. commercial must have visible credit to
45
45
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
46
- */export{ae as AnnotationBandSeries,F as BandScale,re as BandSeries,K as Clip,ee as EnumAxis,_ as EnumFormatter,Ne as Formatters,q as Layout,te as LineSeries,L as LinearScale,oe as MinMaxAvgSeries,Q as MovingAvg,N as Renderer,se as StatsOverlay,ne as StepSeries,v as TIME_INTERVALS,W as TimeAxis,D as TimeFormatter,R as TimeScale,J as ValueAxis,M as ValueFormatter,ie as ZonedLineSeries,de as getHatch,Me as measureLegend,He as renderAnnotations,Te as renderArea,je as renderGaps,$e as renderGrid,Ie as renderHighlights,_e as renderLegend,w as renderLine,Oe as renderMarkers,$ as renderSeriesMarkers,Le as renderSplitLine,z as renderStep,Ae as renderThresholds,B as renderZonedArea,Se as resolveFill,xe as resolveGap,ge as resolveLines,ye as resolveMarkers,ze as resolveSeriesStyle,be as resolveShadow,U as slugify,h as theme,Ce as toStepData,he as toStepPoints};
46
+ */export{ae as AnnotationBandSeries,A as BandScale,re as BandSeries,K as Clip,ee as EnumAxis,$ as EnumFormatter,ze as Formatters,q as Layout,te as LineSeries,M as LinearScale,oe as MinMaxAvgSeries,Q as MovingAvg,N as Renderer,se as StatsOverlay,ne as StepSeries,v as TIME_INTERVALS,j as TimeAxis,D as TimeFormatter,R as TimeScale,J as ValueAxis,_ as ValueFormatter,ie as ZonedLineSeries,de as getHatch,De as measureLegend,He as renderAnnotations,Te as renderArea,Oe as renderGaps,$e as renderGrid,Be as renderHighlights,_e as renderLegend,w as renderLine,Ie as renderMarkers,P as renderSeriesMarkers,Le as renderSplitLine,z as renderStep,Ae as renderThresholds,H as renderZonedArea,Se as resolveFill,xe as resolveGap,ge as resolveLines,ye as resolveMarkers,Ge as resolveSeriesStyle,be as resolveShadow,U as slugify,p as theme,Ce as toStepData,he as toStepPoints};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-time-graph",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "TypeScript library for time-series charts with rich contextual annotation — telemetry, sensors, metrics, logs, finance. DOM-free SVG output, identical in the browser and on the server.",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",