semiotic 3.5.4 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +61 -3
- package/README.md +17 -10
- package/ai/dist/mcp-server.js +249 -2
- package/ai/schema.json +34 -9
- package/ai/system-prompt.md +1 -1
- package/dist/components/ai/audienceProfile.d.ts +90 -0
- package/dist/components/ai/audiences.d.ts +31 -0
- package/dist/components/ai/chartCapabilities.d.ts +55 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +196 -0
- package/dist/components/ai/diffProfile.d.ts +51 -0
- package/dist/components/ai/inferIntent.d.ts +24 -0
- package/dist/components/ai/intents.d.ts +34 -0
- package/dist/components/ai/profileData.d.ts +16 -0
- package/dist/components/ai/qualityFixtures.d.ts +2 -0
- package/dist/components/ai/qualityScorecard.d.ts +82 -0
- package/dist/components/ai/repairChartConfig.d.ts +73 -0
- package/dist/components/ai/streamingTypes.d.ts +64 -0
- package/dist/components/ai/suggestCharts.d.ts +76 -0
- package/dist/components/ai/suggestDashboard.d.ts +92 -0
- package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
- package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
- package/dist/components/ai/useChartSuggestions.d.ts +22 -0
- package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
- package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
- package/dist/components/charts/index.d.ts +1 -1
- package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
- package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
- package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
- package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
- package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
- package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +0 -34
- package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
- package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
- package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
- package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
- package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
- package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
- package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
- package/dist/components/data/DataSummarizer.d.ts +45 -0
- package/dist/components/semiotic-ai.d.ts +35 -0
- package/dist/components/semiotic-xy.d.ts +1 -1
- package/dist/components/semiotic.d.ts +1 -1
- package/dist/components/store/useChartFocus.d.ts +43 -0
- package/dist/components/store/useChartInterrogation.d.ts +141 -0
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +35 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +1 -1
- package/dist/semiotic.d.ts +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +13 -4
package/dist/xy.module.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as l,useCallback as a,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as f,useId as g,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleSequential as O}from"d3-scale";import{quadtree as S}from"d3-quadtree";import{curveNatural as C,curveBasis as j,curveStepAfter as _,curveStepBefore as M,curveStep as P,curveCatmullRom as L,curveCardinal as N,curveMonotoneY as F,curveMonotoneX as B,line as T,area as H,curveLinear as W}from"d3-shape";import{bin as I}from"d3-array";import{packEnclose as z}from"d3-hierarchy";import D from"regression";function E(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function R(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function $({width:t,height:n,totalWidth:o,totalHeight:l,margin:a,dimension:c,scales:u,onBrush:d,binSize:h,snap:f,binBoundaries:g,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const O=i(u);O.current=u;const S=r(()=>g?[...g].sort((e,t)=>e-t):void 0,[g]),C=i(S);C.current=S;const j=i(!1),_=i(null);return s(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),o="x"===c?m():"y"===c?v():b();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(j.current)return;const r=O.current;if(!r)return;if(!i.selection)return _.current=null,void A.current(null);let s,l;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],l=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;s=[r.x.invert(0),r.x.invert(t)],l=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;s=[r.x.invert(e),r.x.invert(n)],l=[r.y.invert(o),r.y.invert(t)]}if("bin"===f&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[E(e[0],t),R(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const n=r.x(s[0]),l=r.x(s[1]);if(j.current=!0,"x"===c)e.call(o.move,[n,l]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[l,t[1][1]]])}j.current=!1}const a={x:s,y:l};_.current=a,A.current(a)}),e.call(o),w.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),w.current=null}},[t,n,c,f,h,p]),s(()=>{if(!(x&&u&&w.current&&_.current))return;if(!k.current)return;if("y"===c)return;const e=_.current,t=u.x.domain()[0],n=y(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,_.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===f){const e=C.current;e&&e.length>0?o=R(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,_.current=null,void A.current(null);i=!0}const r=u.x(o),s=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[r,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[r,t],[s,o]])}if(j.current=!1,i){const t={x:[o,e.x[1]],y:e.y};_.current=t,A.current(t)}},[u,x,c,f,h]),e("svg",{ref:k,width:o,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const Y=Object.freeze([]);function G(e){if(!e)return Y;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class X{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=G(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=G(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function V(t){let n=null;const o=()=>(n||(n=u(null)),n),s=q(t);return[function({children:n,initialState:s}){const l=i(s),a=r(()=>q(t,l.current),[]),c=o();return e(c.Provider,{value:a,children:n})},e=>{var t;const n=o(),r=null!==(t=l(n))&&void 0!==t?t:s,u=i(e);u.current=e;const d=a(()=>u.current(r.getState()),[r]),h=a(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function q(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function U(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function K(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:Q})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const Q=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Z={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},J={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ee={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Q,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function te(e,t){if("light"===t)return Z;if("dark"===t)return J;if("high-contrast"===t)return ee;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?J:Z;return K(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return K(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[ne,oe]=V(e=>({theme:Z,setTheme(t){e(e=>({theme:te(e.theme,t)}))}}));class ie{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class re{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function se(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),l=n(s);if(null==e||null==l||Number.isNaN(e)||Number.isNaN(l))continue;const a=Math.floor(e/o)*o;let c=r.get(a);if(c||(c={start:a,end:a+o,total:0,categories:new Map},r.set(a,c)),c.total+=l,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+l)}}return r}function le(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const l=Array(s.length),a=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];l[e]=[t.px,t.py],a[e]=t.rawY,c[e]=t.d}return{type:"line",path:l,rawValues:a,style:i,datum:c,group:r}}function ae(e,t,n,o,i,r,s,l){const a=[];for(const r of e){const e=n(r),s=o(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=l?l(r):i;a.push({px:c,topY:t.y(s),botY:t.y(u)})}a.sort((e,t)=>e.px-t.px);const c=Array(a.length),u=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function ce(e,t,n,o){var i,r,s;const l=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;l.set(o,-e/2)}else if("wiggle"===o){e.length>0&&l.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],s=e[o];let a=0,c=0,u=0;for(const e of t){const t=n(e,s)||0;a+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const d=null!==(i=l.get(r))&&void 0!==i?i:0;l.set(s,d-(c>0?a/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=l.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)l.set(t,(null!==(s=l.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)l.set(t,0);return l}function ue(e,t,n,o,i,r,s){const l=n(e),a=o(e);if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c={type:"point",x:t.x(l),y:t.y(a),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function de(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function he(e,t,n,o,i,r,s){const l={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(l.showValues=!0,l.value=s.value,s.valueFormat&&(l.valueFormat=s.valueFormat)),l}function fe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ge(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function pe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ye(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}function me(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ve(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function be(e){const t=e.map(me),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return ve(e,n,o)}if(e>=1){const[e,o,i]=t[n];return ve(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,d]=t[i+1];return ve(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(d-a)*r))}}const xe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ke=be(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),we=be(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ae=be(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Oe=be(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Se=be(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ce=be(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),je=be(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),_e=be(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Me=be(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Pe=be(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Le=be(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Ne=be(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);be(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),be(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),be(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),be(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),be(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),be(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),be(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Fe={category10:xe,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:ke,reds:we,greens:Ae,oranges:Oe,purples:Se,viridis:je,plasma:_e},Be=xe,Te=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],He=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function We(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||He.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Be[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%Be.length]}function Ie(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return x().domain(o).range(n).unknown("#999");const r=Fe[n]||Fe.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:Be;return x().domain(o).range(e).unknown("#999")}}function ze(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[l,a]=n;if(s===r)return(l+a)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}function De(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}function Ee(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function Re(e,t,n){return e+(t-e)*n}function $e(e,t,n){var o,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ye(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function Ge(e,t,n,o){if(!e.scales)return null;const i=[],r=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),l=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(l))continue;const a=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(l);Number.isFinite(a)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([a,c]),r.push([a,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:Ye(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Xe(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Ve(e,t,n){const o=[];for(const i of n){const n=Ge(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function qe(e,t,n,o){const i=[];for(const r of o){const o=Ge(e,t,n,r);o&&i.push(o)}return i}function Ue(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function Ke(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const l=null!==(i=o.r)&&void 0!==i?i:3,a=e.getPointId?e.getPointId(s)+"":void 0,c=ue(s,e.scales,e.getX,r,l,o,a);c&&n.push(c)}}}const Qe={topOpacity:.8,bottomOpacity:.05};function Ze(e){var t,n;if(e)return!0===e?Qe:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Qe.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:Qe.bottomOpacity}}const Je={blues:ke,reds:we,greens:Ae,viridis:je,oranges:Oe,purples:Se,greys:Ce,plasma:_e,inferno:Me,magma:Pe,cividis:Le,turbo:Ne},et=new Map;function tt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function nt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=tt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=ge(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:tt(e.y1Accessor,"y1"),getBottom:tt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class ot{constructor(e){if(this.xExtent=new re,this.yExtent=new re,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new ie(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ge(e.timeAccessor||e.xAccessor,"time"),this.getY=ge(e.valueAccessor||e.yAccessor,"value")):(this.getX=ge(e.xAccessor,"x"),this.getY=ge(e.yAccessor,"y")),this.getGroup=ye(e.groupAccessor),this.getCategory=ye(e.categoryAccessor),this.getSize=e.sizeAccessor?ge(e.sizeAccessor,"size"):void 0,this.getColor=ye(e.colorAccessor),this.getY0=e.y0Accessor?ge(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=nt(e),this.getPointId=ye(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?ge(e.openAccessor,"open"):void 0,this.getHigh=ge(e.highAccessor,"high"),this.getLow=ge(e.lowAccessor,"low"),this.getClose=n?ge(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new ie(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?ge(this.config.timeAccessor||this.config.xAccessor,"time"):ge(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,g;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(n=p.xExtent[0])&&void 0!==n?n:v[0],null!==(o=p.xExtent[1])&&void 0!==o?o:v[1]]:v,O=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const S=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],C="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!S&&y.size>0)if(p.normalize)O=[0,C?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(l=p.stackOrder)&&void 0!==l?l:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)O=this._stackExtentCache.yDomain;else{const t=this.groupData(m),n=new Map,o=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let l=0;for(const n of e.data){const e=this.getX(n),s=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),o.add(e),l+=s;const a=(r.get(e)||0)+s;r.set(e,a),a>i&&(i=a)}n.set(e.key,t),s.set(e.key,l)}const l=null!==(a=p.stackOrder)&&void 0!==a?a:"key",f=(e,t)=>t>e?-1:e>t?1:0;let g;if("insideOut"===l){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(o.push(t),r+=null!==(u=s.get(t))&&void 0!==u?u:0);g=[...o.reverse(),...n]}else g="asc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(e))&&void 0!==n?n:0)-(null!==(o=s.get(t))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}):"desc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}):t.map(e=>e.key).sort(f);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=ce(e,g,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(h=r.get(n))&&void 0!==h?h:0;i>e&&(i=e),e+o>s&&(s=e+o)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const l=s-i,a=C?0:l>0?l*p.extentPadding:1;O=[i-a,s+a]}else O=[0,i+(C?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:O}}}else if("bar"===p.chartType&&p.binSize&&!S&&y.size>0){const[,e]=function(e,t,n,o,i){const r=se(e,t,n,o,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);O=[0,C?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!S&&y.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(y,this.getY),n=t-e,o=C?0:n>0?n*p.extentPadding:1;O=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!S&&O[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(O[0]>n&&(O[0]=n),n>O[1]&&(O[1]=n)),Number.isFinite(o)&&(O[0]>o&&(O[0]=o),o>O[1]&&(O[1]=o))}const e=O[1]-O[0],t=C?0:e>0?e*p.extentPadding:1,n=null===(f=p.yExtent)||void 0===f?void 0:f[0],o=null===(g=p.yExtent)||void 0===g?void 0:g[1];O=[null!=n?O[0]:O[0]-t,null!=o?O[1]:O[1]+t],"log"!==p.yScaleType||O[0]>0||0>=b[0]||C||(O[0]=null!=n?O[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!S){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(O=[null!=e?e:O[0],null!=t?t:O[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];O[0]!==1/0&&O[1]!==-1/0||(O=[0,1]);const j="streaming"===p.runtimeMode,_=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(j)if("x"==("up"===(M=p.arrowOfTime)||"down"===M?"y":"x")){const t="right"===p.arrowOfTime?[_,e.width-_]:[e.width-_,_];this.scales={x:k().domain(x).range(t),y:k().domain(O).range([e.height-_,_])}}else{const t="down"===p.arrowOfTime?[_,e.height-_]:[e.height-_,_];this.scales={x:k().domain(O).range([_,e.width-_]),y:k().domain(x).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)};this.scales={x:t(p.xScaleType,x,[_,e.width-_]),y:t(p.yScaleType,O,[e.height-_,_])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,ot.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=S().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),l=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)},a=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:l(this.config.xScaleType,o,r[0]>r[1]?[e.width-a,a]:[a,e.width-a]),y:l(this.config.yScaleType,i,c?[a,e.height-a]:[e.height-a,a])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,s,l,a;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const a=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:a,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=c.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:Te},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(o=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(l=h.nodes)&&void 0!==l?l:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:r}=Xe(e.ribbons);if(r.length>0&&i.push(...Ve(e,t,r)),n.length>0)for(const t of o)i.push(...qe(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=le(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return Ke(e,o,i),i}(d,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Xe(e.ribbons);if(r.length>0&&o.push(...Ve(e,t,r)),i.length>0)for(const t of n)o.push(...qe(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=ae(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),l=Ze(e.config.gradientFill);l&&(s.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return Ke(e,n,o),o}(d,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Xe(e.ribbons);if(r.length>0&&o.push(...Ve(e,t,r)),i.length>0)for(const t of n)o.push(...qe(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=ae(t.data,e.scales,e.getX,e.getY,r,n,t.key,s),l=Ze(e.config.gradientFill);l&&(i.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=le(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Ke(e,n,o),o}(d,t);case"stackedarea":return function(e,t){var n,o,i,r;const s=e.groupData(t),l=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",a=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===l)a();else if("asc"===l||"desc"===l||"insideOut"===l){const t=new Map;for(const n of s){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else if("desc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else{const e=[...s].sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)}),r=[],l=[];let a=0,c=0;for(const n of e)c>a?(r.push(n),a+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(l.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);s.length=0,s.push(...l.reverse(),...r)}}else a();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,n,o,i,r,s,l="zero"){var a,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let f;if(r){f=new Map;for(const t of d){let n=0;for(const o of e)n+=(null===(a=h.get(o.key))||void 0===a?void 0:a.get(t))||0;f.set(t,n||1)}}const g=ce(d,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},l),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=g.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],l=[],a=new Map;for(const n of d){let i=e.get(n)||0;const s=m.get(n);r&&(i/=f.get(n));const c=s+i,u=t.x(n);l.push([u,t.y(s)]),o.push([u,t.y(c)]),m.set(n,c),a.set(n,c)}y.set(n.key,a);const c={type:"area",topPath:o,bottomPath:l,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),f=d;if(e.config.pointStyle){const t=new WeakMap;for(const n of s){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Ke(e,s,f,n)}return f}(d,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);s=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const l=e.getColor?e.resolveColorMap(t):null,a=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(l&&e.getColor&&!t.fill){const o=e.getColor(n);o&&l.has(o)&&(t=Object.assign(Object.assign({},t),{fill:l.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=ue(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(d,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),l=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),a=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=ge(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,f]=e.scales.y.domain(),g=(d-u||1)/s,p=(f-h||1)/l,y=s*l;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const a=Math.min(Math.floor((i-u)/g),s-1),d=Math.min(Math.floor((r-h)/p),l-1);if(0>a||0>d)continue;const f=d*s+a;m[f]++;const y=c(o);v[f]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(a){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/s,A=n.height/l,O=e.config.showValues,S=e.config.heatmapValueFormat,C=[];for(let e=0;l>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(a){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;C.push(he(n*w,(l-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*g,yCenter:h+(e+.5)*p,agg:a},O?{value:i,showValues:!0,valueFormat:S}:void 0))}}return C}(e,t,n);if(0===t.length)return[];const o=ge(e.config.valueAccessor,"value"),i=pe(e.config.xAccessor,"x"),r=pe(e.config.yAccessor,"y"),s=new Map,l=new Map,a=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=r(n);a[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),l.has(u)||l.set(u,l.size)}const u=s.size,d=l.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),f=Array.from(l.keys()),g=h.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(g){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){f.sort((e,t)=>e-t),l.clear();for(let e=0;f.length>e;e++)l.set(f[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=s.get(a[e]),r=l.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),h=r*u+i,f=b.get(h);let g;void 0!==f?g=f:(g=x++,b.set(h,g)),y[g]=h,m[g]=d,v[g]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Je?e:"blues";let n=et.get(t);if(n)return n;n=Array(256);const o=Je[t]||ke;for(let e=0;256>e;e++)n[e]=o(e/255);return et.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),O=255/(w-k||1),S=n.width/u,C=n.height/d,j=e.config.showValues,_=e.config.heatmapValueFormat,M=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;M.push(he(o*S,(d-1-(n-o)/u)*C,S,C,A[Math.min((t-k)*O+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:_}:void 0))}return M}(d,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=se(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),s=Array.from(t).filter(e=>!o.has(e)).sort(),l=n.filter(e=>t.has(e)),a=l.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===a?r=e.barCategoryCache.order:(r=[...l,...s],e.barCategoryCache={key:a,order:r})}const s=[],l=e.scales,[a,c]=l.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,f="number"!=typeof h||0>h?1:h,g={};(null==u?void 0:u.stroke)&&(g.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(g.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(g.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,a),i=Math.min(t.end,c);if(n>=i)continue;const h=l.x(n),p=l.x(i),y=Math.abs(p-h),m=y>f+1?f:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const a=l.y(n),c=l.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(de(v,Math.min(a,c),b,Math.abs(a-c),Object.assign({fill:h},g),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=l.y(0),n=l.y(t.total);s.push(de(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},g),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(d,t);return this._barCategoryCache=null!==(a=d.barCategoryCache)&&void 0!==a?a:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,l;const a=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,f=c.stroke,g=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=d;if(e.getCategory){const t=e.getCategory(n);s=(null===(l=e.config.barColors)||void 0===l?void 0:l[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:f,strokeWidth:g},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),a.push(c)}return a}(d,t);case"waterfall":return function(e,t,n){var o,i,r,s,l,a,c;const u=[],d=e.scales,h=e.config.waterfallStyle,f=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===f.length)return u;const g=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(a=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(l=e.config.themeSemantic)||void 0===l?void 0:l.danger)&&void 0!==a?a:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;f.length>t;t++){const o=f[t],i=e.getX(o),r=e.getY(o),s=x+r;let l;l=f.length-1>t?e.getX(f[t+1])-i:t>0?i-e.getX(f[t-1]):0;const a=d.x(i),c=0!==l?d.x(i+l):a+n.width/10,k=Math.min(a,c)+y/2,w=Math.max(a,c)-y/2-k;if(0>=w){x=s;continue}const A=d.y(x),O=d.y(s),S=Math.min(A,O),C=Math.abs(A-O),j={fill:0>r?p:g,stroke:m,strokeWidth:v};null!=b&&(j.opacity=b),u.push(de(k,S,w,C,j,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(d,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},l=s.rangeColor||"#6366f1",a=i?l:s.upColor||"#28a745",c=i?l:s.downColor||"#dc3545",u=i?l:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let f=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}f=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else f=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const l=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[l,h].some(e=>null==e||Number.isNaN(e)))continue;const g=h>=l,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:d,isUp:g,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(d,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?De(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const l=s.get(t[n]);null!=l?(o[n]=De(e,l,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let l=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=De(e,o,r),1>i[n]&&(l=!0)):i[n]=1}l&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=De(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const l=De(e,t,r);if("heatcell"===n.type)n.style={opacity:l};else if("candlestick"===n.type)n._decayOpacity=l;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*l})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",a=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const l=Ee(e,r,s);l>i&&(i=l)}i>0&&(n._pulseIntensity=i,n._pulseColor=l);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Ee(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=l,n._pulseGlowRadius=a)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,r,s,l;n.clear(),o.clear();for(let a=0;t.length>a;a++){const c=t[a],u=$e(e,c,a);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(l=c.style)||void 0===l?void 0:l.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=$e(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var r,s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,k,w,A,O,S,C,j,_,M,P,L,N,F,B,T,H,W,I,z,D,E,R,$,Y,G;if(0===o.size&&0===i.size)return n;const X=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let V=!1;const q=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=$e(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];V=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];V=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(a=null!==(l=e.opacity)&&void 0!==l?l:r.style.opacity)&&void 0!==a?a:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;continue}const L=o.get(P);if("point"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(d=L.r)&&void 0!==d?d:r.r,V=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("rect"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(f=r.style.opacity)&&void 0!==f?f:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(g=L.w)&&void 0!==g?g:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,V=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("heatcell"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,V=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){q.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(O=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==O?O:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(j=L.lowY)&&void 0!==j?j:r.lowY,V=!0)}else r._targetOpacity=null!==(M=null===(_=r.style)||void 0===_?void 0:_.opacity)&&void 0!==M?M:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}for(const[e,t]of o)if(!q.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(N=t.r)&&void 0!==N?N:3,style:{opacity:null!==(F=t.opacity)&&void 0!==F?F:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(B=t.w)&&void 0!==B?B:0,h:null!==(T=t.h)&&void 0!==T?T:0,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(W=t.w)&&void 0!==W?W:0,h:null!==(I=t.h)&&void 0!==I?I:0,fill:"#999",datum:null,style:{opacity:null!==(z=t.opacity)&&void 0!==z?z:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(D=t.openY)&&void 0!==D?D:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(E=t.closeY)&&void 0!==E?E:o,highY:null!==(R=t.highY)&&void 0!==R?R:o,lowY:null!==($=t.lowY)&&void 0!==$?$:o,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:X}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,r,s,l,a,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),d=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=Re(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),e.y=Re(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=Re(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=Re(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),e.y=Re(n.y,e._targetY,d),void 0!==n.w&&(e.w=Re(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Re(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Re(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),e.y=Re(n.y,e._targetY,d),void 0!==n.w&&(e.w=Re(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Re(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(l=n.opacity)&&void 0!==l?l:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Re(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=Re(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=Re(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=Re(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=Re(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Re(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Re(t[o][0],n[o][0],d),e.path[o][1]=Re(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Re(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Re(t[n][0],o[n][0],d),e.topPath[n][1]=Re(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Re(n[t][0],i[t][0],d),e.bottomPath[t][1]=Re(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Te,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||Te;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>ot.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,l=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=a||!fe(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=a||!fe(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=ge(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ge(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ge(this.config.xAccessor,"x"),this.getY=ge(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=nt(this.config)),s=!0,l=!0)}if("groupAccessor"in e&&!fe(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ye(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!fe(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ye(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!fe(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ge(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!fe(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ye(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!fe(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?ge(this.config.y0Accessor,"y0"):void 0,s=!0,l=!0),("boundsAccessor"in e&&!fe(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=nt(this.config),s=!0,l=!0),"pointIdAccessor"in e&&!fe(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ye(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!fe(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!fe(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!fe(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!fe(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?ge(this.config.openAccessor,"open"):void 0,this.getHigh=ge(this.config.highAccessor,"high"),this.getLow=ge(this.config.lowAccessor,"low"),this.getClose=t?ge(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,l=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){s=!0;break}}s&&(l&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function it(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function rt(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function st(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function lt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function at(e,t){const n=lt(e);if(!n)return!1;const o=lt(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}ot.GROUP_COLOR_MAP_CAP=1e3,ot.QUADTREE_THRESHOLD=500;const ct=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ut=new WeakMap;let dt=0,ht=!1,ft=null,gt=null,pt=null;function yt(e,t){var n,o;if(!t)return t;const i=ct.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(ht)return;if("undefined"==typeof window||"undefined"==typeof document)return;ht=!0;const e=()=>{dt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ft=new MutationObserver(e),ft.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{gt=window.matchMedia("(prefers-color-scheme: dark)"),pt=e,"function"==typeof gt.addEventListener?gt.addEventListener("change",pt):"function"==typeof gt.addListener&>.addListener(pt)}catch(e){}}();let s=ut.get(r);s&&s.version===dt||(s={version:dt,map:new Map},ut.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}function mt(e){switch(e){case"monotoneX":return B;case"monotoneY":return F;case"cardinal":return N;case"catmullRom":return L;case"step":return P;case"stepBefore":return M;case"stepAfter":return _;case"basis":return j;case"natural":return C;default:return null}}function vt(e,t,n){return null==t?n:"string"!=typeof t?t:yt(e,t)||n}function bt(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const l=e.createLinearGradient(o,i,r,s);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:a}=t;if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,l)),u=Math.max(0,Math.min(1,a)),d=e.createLinearGradient(o,i,r,s),[h,f,g]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function xt(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}const kt=new WeakMap;function wt(e,t){const n=mt(t);if(!n)return e;const o=kt.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const r={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,r,s,l,a){if(!i)return i=[l,a],void o.push([l,a]);const[c,u]=i;for(let i=1;n>=i;i++){const d=i/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*l,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*a])}i=[l,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return T().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return kt.set(e,i),i}function At(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,l=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>l||s>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,l=Math.sqrt(r*r+s*s);st(e.r,o)>=l&&d>l&&(u=e,d=l),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=St(r,t,n,o);break;case"line":e=Ct(r,t,n,o);break;case"rect":if(null==r.datum)break;e=_t(r,t,n);break;case"heatcell":e=Mt(r,t,n);break;case"area":if(!1===r.interactive)break;e=Lt(r,t,n);break;case"candlestick":e=Pt(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Ot(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Nt(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[s,l]=e[i],[a,c]=e[r];return a===s?l:l+Math.max(0,Math.min(1,(t-s)/(a-s)))*(c-l)}function St(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>st(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Ct(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const s=Nt(e.path,t);if(0>s)return null;const[l,a]=e.path[s];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,s-1),r=Math.min(e.path.length-2,s);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[l,a]=e.path[s+1],c=jt(t,n,i,r,l,a);o>c&&(o=c)}c=o}else{const e=t-l,o=n-a;c=Math.sqrt(e*e+o*o)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:l,y:a,distance:c}}function jt(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function _t(e,t,n){const o=rt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Mt(e,t,n){const o=rt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Pt(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+s*s)}}return null}function Lt(e,t,n){if(0===e.topPath.length)return null;const o=Nt(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,l=n-r,a=Math.sqrt(s*s+l*l);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:a}}function Nt(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function Ft(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Bt(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const Tt={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function Ht(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,Tt[n])(o(e,t),i),r}function Wt({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function It(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const zt=(n,o,i,r,s,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=s,{swatchSize:x,labelGap:k,rowHeight:w}=h;return p.forEach((n,d)=>{const h=Ht(n,d,f,g,x),A=It(n,r,s),O=s&&s.size>0&&s.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===l&&d===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?O||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,O&&e(Wt,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=w}),y};function Dt({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:l,label:a,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(l[0]+n*(l[1]-l[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(l[1]-n*(l[1]-l[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[a&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])})]})}function Et(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical",legendLayout:g}=n,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),l=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:l,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(g),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),k="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,g)=>{h+=5,f.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+g)),h+=8,t.label&&(h+=16,f.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),h+=8),f.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:zt(t,o,i,r,s,l,a,g,c,u,d)},"legend-group-"+g)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:f})=>{var g;let p=0;const y=[];n.forEach((n,o)=>{var g;let m=0;n.label&&(m+=16);const v=((n,o,i,r,s,l,a,c,u,d,h,f)=>{const{type:g="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,A=!(!o&&!i),O="isolate"===d||void 0===d&&null!=s,S=y.map(e=>v+b+7*e.label.length),C=[];let j=0,_=0;S.forEach((e,t)=>{const n=0===_?e:_+x+e;f&&f>0&&_>0&&n>f?(C.push({start:j,end:t,width:_}),j=t,_=e):_=n}),y.length>0&&C.push({start:j,end:y.length,width:_}),C.forEach((n,d)=>{let h="center"===w?Math.max(0,((null!=f?f:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=f?f:n.width)-n.width):0;for(let f=n.start;n.end>f;f++){const n=y[f],w=Ht(n,f,g,p,v),C=It(n,r,s),j=s&&s.size>0&&s.has(n.label);m.push(t("g",{transform:`translate(${h},${d*k})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===l&&f===a?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&O?j||!1:void 0,"aria-current":A&&!O&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(f+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:A?e=>{u(c,f),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:C,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,j&&e(Wt,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+f)),h+=S[f]+x}});const M=Math.max(0,...C.map(e=>e.width)),P=C.length;return{items:m,offset:M,totalRows:P,totalHeight:P*k}})(n,r,s,l,a,c,u,o,d,h,f,null!==(g=f.maxWidth)&&void 0!==g?g:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(g=f.maxWidth)&&void 0!==g?g:i;let v=p>m?0:"center"===f.align?Math.max(0,(m-p)/2):"end"===f.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),w=!(!r&&!s);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),k]})}function Rt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function $t(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=t;if(!o)return null;const p="top"===l||"bottom"===l,y=!!c,m=Math.max(1,p?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===l?(v=Math.max(4,s.left-m-10),b=s.top):"top"===l?(v=s.left,b=y?32:8):"bottom"===l?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e(Dt,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Rt(o)?e(Et,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):o)});var x}function Yt(e){return"string"==typeof e?{type:e}:e}function Gt({orient:n,config:o,values:i,scale:s,size:l,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=s.domain(),r=l-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!o)return null;const{q1:l,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=o,g=Math.min(.5*r,20),p=(r-g)/2+4;if(u){const o=s(l),i=s(d),r=s(a),u=s(h),y=s(f),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(p+g/2),x2:y,y2:v+m*(p+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*p,x2:u,y2:v+m*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-p-g:v+p,width:Math.abs(i-o),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-p-g:v+p,x2:r,y2:"top"===n?v-p:v+p+g,stroke:c.fill,strokeWidth:2})]})}{const o=s(l),i=s(d),r=s(a),u=s(h),y=s(f),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(p+g/2),y1:u,x2:v+m*(p+g/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:u,x2:v+m*(p+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+g),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-p-g:v+p,y:Math.min(o,i),width:g,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-p-g:v+p,y1:r,x2:"left"===n?v-p:v+p+g,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=I().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=s(t.x0),l=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(l,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=s(t.x0),l=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+l),width:i,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),l=s((e.x0+e.x1)/2);o.push(u?`${l},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${l}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const l=i.length/h*(r/2),a=s((i.x0+i.x1)/2);o.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,l,a,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Xt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Vt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function qt(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:l,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!l)return e("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let g="start";"topBottom"===h?"right"===f?g="end":"middle"===f&&(g="middle"):g=0>o?"end":"start";const p=16,y=l?d?[l]:Xt(l,u):[],m=s?d?[s]:Xt(s,u):[],v="leftRight"===h?"end"===g?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:g,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:g,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let w=null;if((l||s)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===f?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===f||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),w]})}function Ut(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||l.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&l.push(e("path",{d:Vt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:l})}function Kt(t,n,o,i,r,s){const l=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;a=i+s*h,c=r+l*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(l.push(e("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-a);l.push(e("path",{d:`M${a},${c}L${a+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${a+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:l})}function Qt(e){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:l,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:g,events:p={},"data-testid":y}=e,m=new Set(Array.isArray(g)?g:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=l&&(b=l-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&&Kt(v,b,c,h,x,u),!m.has("subject")&&Ut(x,u,h,n,o),!m.has("note")&&qt(a,v,b,h)]}))}function Zt(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e(Qt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e(Qt,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function Jt(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function en(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function tn(e,t,n){var o,i,r,s;const l=e.anchor||"fixed";if("latest"===l){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=Jt(e,n),c=en(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===l){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function nn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const on={linear:W,monotoneX:B,monotoneY:F,step:P,stepAfter:_,stepBefore:M,basis:j,cardinal:N,catmullRom:L};let rn={positions:new Map};const sn=new Set;function ln(){for(const e of sn)e()}function an(e,t){const n=rn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(rn.positions);o.delete(e),rn={positions:o},ln()}function cn(e,t){const n=rn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(rn.positions);o.delete(e),rn={positions:o},ln()}function un(){return rn}function dn(e){return sn.add(e),()=>sn.delete(e)}const hn={positions:new Map};function fn(){return()=>{}}function gn(){return hn}function pn(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,l=i instanceof Date?i.getTime():i;if(2>t||s===l)return r?[new Date(s),new Date(l)]:[s,l];const a=(l-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:s+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function yn(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function mn(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function vn(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function bn(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function xn(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function kn(n){const{width:o,height:i,totalWidth:s,totalHeight:l,margin:a,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:f,yFormat:g,axisExtent:p}=n,y=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||f||wn,r=Math.max(2,Math.floor(o/70)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(c.x,"exact"===p?Math.max(2,s):Math.min(s,r),p),a=l.map(e=>e.valueOf()),u=l.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,a)})),h=u.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return An(u,Math.max(55,h+8))},[c,d,f,o,p]),m=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||g||wn,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return An((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(c.y,"exact"===p?Math.max(2,s):Math.min(s,r),p)).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,g,i,p]),v=h&&c,b=u&&c;if(!v&&!b)return null;const x=null==d?void 0:d.find(e=>"bottom"===e.orient),k=null==d?void 0:d.find(e=>"left"===e.orient),w=b&&(!x||!1!==x.baseline),A=b&&(!k||!1!==k.baseline),O=(null==x?void 0:x.jaggedBase)||!1,S=(null==k?void 0:k.jaggedBase)||!1,C="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${a.left},${a.top})`,children:[v&&(()=>{var n,r;const s=bn(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),l=bn(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),m.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:l},"ygrid-"+n))]})})(),w&&!O&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:C,strokeWidth:1}),O&&e("path",{d:xn("bottom",o,i),fill:"none",stroke:C,strokeWidth:1}),A&&!S&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),S&&e("path",{d:xn("left",o,i),fill:"none",stroke:C,strokeWidth:1})]})})}function wn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function An(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function On(o){var l,a;const{width:u,height:d,totalWidth:h,totalHeight:f,margin:g,scales:p,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:A,showGrid:O,title:S,legend:C,legendHoverBehavior:j,legendClickBehavior:_,legendHighlightedCategory:M,legendIsolatedCategories:P,legendPosition:L="right",legendLayout:N,foregroundGraphics:F,marginalGraphics:B,xValues:T,yValues:I,annotations:E,svgAnnotationRules:R,xAccessor:$,yAccessor:Y,annotationData:G,pointNodes:X,curve:V,underlayRendered:q,canvasObscuresUnderlay:U=!0,linkedCrosshairName:K,linkedCrosshairSourceId:Q,children:Z}=o,J=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||wn,i=Math.max(2,Math.floor(u/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),l=s.map(e=>e.valueOf()),a=s.map((e,t)=>({value:e,pixel:p.x(e),label:o(e,t,l)})),c=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=An(a,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.x.domain()[1],t=p.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,l);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,m,k,u,A]),ee=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||w||wn,i=Math.max(2,Math.floor(d/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=An((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.y.domain()[1],t=p.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[y,p,m,w,d,A]),te=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||w||wn,i=Math.max(2,Math.floor(d/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return An((null!==(t=n.tickValues)&&void 0!==t?t:pn(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,m,w,d,A]),ne=i(new Map),oe=i(null!==(l=null==E?void 0:E.length)&&void 0!==l?l:0),ie=null!==(a=null==E?void 0:E.length)&&void 0!==a?a:0;oe.current!==ie&&(oe.current=ie,ne.current=new Map);const re=r(()=>{if(!E||0===E.length)return null;const n=function(n,o,i){var r,s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,k,w,A,O,S,C,j,_,M,P,L,N,F,B,T,I,E,R,$,Y,G,X,V,q,U,K,Q,Z,J,ee,te,ne;switch(n.type){case"label":{const t=tn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return nn(r,s,i)?e(Zt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=tn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return nn(r,s,i)?e(Zt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=Jt(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",l=n.labelPosition||"top";let a;return a="bottom"===l?(i.height||0)-4:"center"===l?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:r+4,y:a,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=en(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",l=n.labelPosition||"right";let a,c;return"left"===l?(a=4,c="start"):"center"===l?(a=(i.width||0)/2,c="middle"):(a=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:a,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:Jt(Object.assign(Object.assign({},e),{type:"point"}),i),y:en(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=z(r),l=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+l,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-l-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:Jt(Object.assign(Object.assign({},e),{type:"point"}),i),y:en(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,l=r.map(e=>e.x),a=r.map(e=>e.y),c=Math.min(...l)-s,u=Math.max(...l)+s,d=Math.min(...a)-s,h=Math.max(...a)+s;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=Jt(t,i),l=en(t,i);if(null==r||null==l)return null;const a="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=Jt(n,i),r=en(n,i);return e(Zt,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const f=i.xAccessor||"x",g=i.yAccessor||"y",p="ordinal"===i.frameType,y="horizontal"===i.projection,m=p?f:null,v=p?g:null;let b;const x=[],k=new Map;if(p&&m&&v){for(const e of h){const t=e[m];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=h.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=k.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[f],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(l=i.scales)||void 0===l?void 0:l.time,A=null!==(c=null===(a=i.scales)||void 0===a?void 0:a.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!w||!A)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=w,C=A;let j;if(p)if(y){const e=O(C);j=(t,n)=>[S(n),e(t)]}else{const e=O(S);j=(t,n)=>[e(t),C(n)]}else j=(e,t)=>[S(e),C(t)];const _=n.method||"linear";let M;M="loess"===_?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],g+=t*i[e]*r[e])}if(0===u){l.push([t,r[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))l.push([t,h/u]);else{const e=(u*g-d*h)/p;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===_?D.polynomial(b,{order:n.order||2}):D.linear(b)).points;const P=M.map(([e,t])=>{const[n,o]=j(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",N=M[M.length-1],[F,B]=j(N[0],N[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:F+4,y:B-4,fill:L,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(f=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(g=i.scales)||void 0===g?void 0:g.value,s=null!==(p=null==r?void 0:r(n.y0))&&void 0!==p?p:0,l=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,l),width:i.width||0,height:Math.abs(l-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,l)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",l=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,a=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!l||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const f=on[i.curve||"linear"]||W,g=H().x(e=>l(e[s])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!g)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:g,fill:p,fillOpacity:null!==(A=n.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:l(h[h.length-1][s])+4,y:a(h[h.length-1][c])-4,fill:p,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",l=null!==(S=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(C=i.scales)||void 0===C?void 0:C.time,a=null!==(_=null===(j=i.scales)||void 0===j?void 0:j.y)&&void 0!==_?_:null===(M=i.scales)||void 0===M?void 0:M.value;if(!l||!a)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(P=n.threshold)&&void 0!==P?P:2,g=u-f*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(N=n.anomalyRadius)&&void 0!==N?N:6,x=a(u+f*h),k=a(g),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>f*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=Jt(t,i),r=en(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",l=i.yAccessor||"y",a=null!==(B=null===(F=i.scales)||void 0===F?void 0:F.x)&&void 0!==B?B:null===(T=i.scales)||void 0===T?void 0:T.time,c=null!==(E=null===(I=i.scales)||void 0===I?void 0:I.y)&&void 0!==E?E:null===(R=i.scales)||void 0===R?void 0:R.value;if(!a||!c)return null;const u=r.map(e=>[e[s],e[l]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=D.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,l=(n-s*t)/e;d=e=>l+s*e}const h=u.length,f=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(f/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==($=n.confidence)&&void 0!==$?$:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(Y=n.steps)&&void 0!==Y?Y:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=d(e),n=g*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${a(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${a(e.x)},${c(e.yCenter)}`).join(" "),C=`${a(x)},${c(d(x))}`,j=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(G=n.fillOpacity)&&void 0!==G?G:.15,stroke:"none"}),e("polyline",{points:`${C} ${S}`,fill:"none",stroke:j,strokeWidth:null!==(X=n.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(V=n.strokeDasharray)&&void 0!==V?V:"6,3"}),n.label&&A.length>0&&e("text",{x:a(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:j,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=tn(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!nn(t,r,i))return null;const s=null!==(q=n.dx)&&void 0!==q?q:0,l=null!==(U=n.dy)&&void 0!==U?U:0,a=null!==(K=n.width)&&void 0!==K?K:32,c=null!==(Q=n.height)&&void 0!==Q?Q:32,u=null!==(Z=n.content)&&void 0!==Z?Z:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=tn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,l=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,c=null===(te=i.scales)||void 0===te?void 0:te.y,u=s(l)?l:s(a)?a:s(c)?c:null;if(!u)return null;const d=u(r+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:u===a)?{children:[e("rect",{x:d,y:0,width:h,height:i.height||0,fill:f,fillOpacity:g}),p&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:d,width:i.width||0,height:h,fill:f,fillOpacity:g}),p&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:$,yAccessor:Y,width:u,height:d,data:G,frameType:"xy",pointNodes:X,curve:V,stickyPositionCache:ne.current};return E.map((e,t)=>{if(R){const i=R(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[E,R,u,d,$,Y,G,p,X,V]),se=function(e){var t;const n=c(e?dn:fn,e?un:gn,e?un:gn);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(K);return s(()=>{if(!(null==se?void 0:se.locked)||!K)return;const e=e=>{"Escape"===e.key&&cn(K)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==se?void 0:se.locked,K]),y||S||C||F||B||re&&re.length>0||O||Z||se?t("svg",{role:"img",width:h,height:f,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof S?S:"XY Chart"}),e("desc",{children:"string"==typeof S?S+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${g.left},${g.top})`,children:[O&&p&&(!q||U)&&(()=>{var n,o;const i=bn(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=bn(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[J.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),ee.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&p&&(()=>{const n=null==m?void 0:m.find(e=>"left"===e.orient),o=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,s=(null==n?void 0:n.jaggedBase)||!1,l=(null==o?void 0:o.jaggedBase)||!1,a=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&J.length>1&&(()=>{const e=u/Math.max(J.length-1,1);return J.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},O=null==o?void 0:o.tickAnchor,S=null==n?void 0:n.tickAnchor,C=vn(J),j=vn(ee);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!q||U)&&r&&!l&&e("line",{x1:0,y1:d,x2:u,y2:d,stroke:h,strokeWidth:1}),(!q||U)&&l&&e("path",{d:xn("bottom",u,d),fill:"none",stroke:h,strokeWidth:1}),J.map((n,o)=>{const i=!!a&&("function"==typeof a?a(n.value,o):at(n.value,o>0?J[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":yn(O,n.pixel===C.min,n.pixel===C.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:u/2,y:d+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!q||U)&&i&&!s&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:h,strokeWidth:1}),(!q||U)&&s&&e("path",{d:xn("left",u,d),fill:"none",stroke:h,strokeWidth:1}),ee.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):at(n.value,o>0?ee[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:mn(S,n.pixel===j.min,n.pixel===j.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-g.left,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-g.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n||0===te.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,s=n.tickAnchor,l=vn(te);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:u,y1:0,x2:u,y2:d,stroke:h,strokeWidth:1}),te.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):at(n.value,o>0?te[o-1].value:void 0));return t("g",{transform:`translate(${u},${n.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:mn(s,n.pixel===l.min,n.pixel===l.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:u+g.right-15,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${u+g.right-15}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),re,B&&p&&T&&I&&t(n,{children:[B.top&&e("g",{transform:"translate(0, 0)",children:e(Gt,{orient:"top",config:Yt(B.top),values:T,scale:p.x,size:g.top,length:u})}),B.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(Gt,{orient:"bottom",config:Yt(B.bottom),values:T,scale:p.x,size:g.bottom,length:u})}),B.left&&e("g",{transform:"translate(0, 0)",children:e(Gt,{orient:"left",config:Yt(B.left),values:I,scale:p.y,size:g.left,length:d})}),B.right&&e("g",{transform:`translate(${u}, 0)`,children:e(Gt,{orient:"right",config:Yt(B.right),values:I,scale:p.y,size:g.right,length:d})})]}),F,se&&se.sourceId!==Q&&(null==p?void 0:p.x)&&(()=>{const t=p.x(se.xValue);if(null==t||0>t||t>u)return null;const n=se.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Z]}),S&&e("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof S?S:null}),$t({legend:C,totalWidth:h,totalHeight:f,margin:g,legendPosition:L,title:S,legendLayout:N,legendHoverBehavior:j,legendClickBehavior:_,legendHighlightedCategory:M,legendIsolatedCategories:P})]}):null}function Sn(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Cn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const jn="undefined"==typeof window||"undefined"==typeof document,_n="undefined"!=typeof window?h:s,Mn=()=>()=>{},Pn=()=>!1,Ln=()=>!0;function Nn(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Fn(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Bn(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Tn=o.createContext(null),Hn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Wn(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const In=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},zn="semiotic-accessible-data-table",Dn=zn+" semiotic-accessible-data-table-hidden",En=zn+" semiotic-accessible-data-table-visible",Rn={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},$n={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Yn={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Gn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Xn={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Vn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},qn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function Un({scene:n,chartType:i,tableId:r,chartTitle:s}){var l;const[a,c]=o.useState(!1),u=o.useContext(Tn),d=null!==(l=null==u?void 0:u.visible)&&void 0!==l&&l,h=a||d,f=o.useRef(null),g=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=o.useCallback(()=>{a||d||c(!0)},[a,d]),y=o.useCallback(e=>{var t;d||(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Hn}):null;if(!h)return e("div",{id:r,className:Dn,tabIndex:-1,onFocus:p,style:Hn,role:"region","aria-label":g,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,k,w,A,O,S;const C=[];if(!Array.isArray(e))return C;for(const j of e)if(j&&"object"==typeof j&&null!==j.datum)try{switch(j.type){case"point":C.push({label:"Point",values:{x:j.x,y:j.y}});break;case"line":{const e=j.path,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&C.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=j.topPath,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&C.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=j.datum&&"object"==typeof j.datum?j.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;C.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":C.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":C.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=j.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=j.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=j.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":C.push({label:"Node",values:{id:null!==(h=null===(d=j.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=j.cx)&&void 0!==f?f:j.x,y:null!==(g=j.cy)&&void 0!==g?g:j.y}});break;case"arc":C.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":C.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":C.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=j.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=j.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(O=j.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return C}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${In(e.min)} to ${In(e.max)}, mean ${In(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:f,id:r,className:En,tabIndex:-1,onBlur:y,style:Rn,role:"region","aria-label":g,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Yn,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:$n,children:b}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:Gn,children:[t("caption",{className:"semiotic-accessible-data-table-caption",style:qn,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Xn,children:"type"}),w.map(t=>e("th",{style:Xn,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:Vn,children:n.label}),w.map(t=>{return e("td",{style:Vn,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":In(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function Kn({summary:t}){return t?e("div",{role:"note",style:Hn,children:t}):null}function Qn({tableId:t}){return e("a",{href:"#"+t,style:Hn,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Hn)},children:"Skip to data table"})}function Zn({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Hn,children:n})}const Jn="var(--semiotic-focus, #005fcc)";function eo({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Jn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Jn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Jn,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function to(e){return Array.isArray(e)?e[0]:e}function no(e,t,n,o){return Object.assign({data:to(e),x:t,y:n,__semioticHoverData:!0},o)}const oo={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function io(e,t){return"function"==typeof t?t(e):e[t]}function ro(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function so(n={}){const{fields:o,title:i,format:r,style:s={},className:l=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let a;const c=[];if(i){const e=io(n,i);a=ro(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=io(n,o);c.push({label:t,value:ro(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=ro(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=ro(n[e[0]],r))}}const u=Object.assign(Object.assign({},oo),s);return t("div",{className:("semiotic-tooltip "+l).trim(),style:u,children:[a&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:a}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&a?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function lo(){return n=>{var o,i,r,s,l,a,c;const u=n.allSeries;if(!u||0===u.length){const t=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:oo,children:e("div",{children:ro(t)})})}const d=null!==(a=null!==(s=n.xValue)&&void 0!==s?s:null===(l=n.data)||void 0===l?void 0:l.time)&&void 0!==a?a:null===(c=n.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:oo,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:ro(d)}),u.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:ro(n.value)})]},o))]})}}function ao(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=to(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:oo,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?so(t):so())}}function co({x:t,y:n,containerWidth:i,containerHeight:r,margin:s,children:l,className:a="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,f]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[l,a,i,r]);let g;g=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(l),y=p?null:oo;return u?e("div",{ref:d,className:p?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"}),children:l}):null}function uo(e,t,n){const o=i(null),[r,l]=d(null);return s(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const ho="undefined"==typeof window?s:h;function fo(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function go(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[l,c]=uo(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-u.left-u.right,f=c[1]-u.top-u.bottom,g=fo(e.foregroundGraphics,c,u),p=fo(e.backgroundGraphics,c,u),y=oe(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=a(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),O=i(()=>{}),S=i(null),C=i(0),j=a(()=>{C.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),_=a(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(j))},[j]),M=a(()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),O.current()},[]);s(()=>()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const P=e.themeDirtyRef;return ho(()=>{P&&(dt++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:c,margin:u,adjustedWidth:h,adjustedHeight:f,resolvedForeground:g,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:_,onPointerLeave:M}}function po(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function yo(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function mo(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const vo=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const a=l._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=l.style.stroke||"#007bff",u=yt(e,c)||c,d=l.style.strokeWidth||2,h=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=d,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const m=null!==(i=l.style.opacity)&&void 0!==i?i:1;mo(e,l.path,u,d,m,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=mt(l.curve),p=h&&h.length>0&&f&&f.length===l.path.length,y=l._decayOpacities;if(y&&y.length===l.path.length&&!p){e.strokeStyle=u;const v=null!==(r=l.style.opacity)&&void 0!==r?r:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function C(){O&&(e.stroke(),O=!1)}for(let j=0;l.path.length>j;j++){const[_,M]=l.path[j],P=f[j],L=yo(P,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(_,M);else{const N=[];for(const F of h){const B=F.value;(w>B||B>P)&&(B>w||P>B)||w===B||P===B||N.push({t:(B-w)/(P-w)})}N.sort((e,t)=>e.t-t.t);for(const H of N){const W=x+(_-x)*H.t,I=k+(M-k)*H.t,z=yo(w+(P-w)*Math.min(H.t+1e-4,1),h,u);e.lineTo(W,I),C(),S(z,W,I)}e.lineTo(_,M)}x=_,k=M,w=P,A=L}else S(L,_,M),x=_,k=M,w=P,A=L}C()}else{e.beginPath();const D=l.strokeGradient&&l.path.length>=2?xt(e,l.strokeGradient,l.path[0][0],0,l.path[l.path.length-1][0],0):null;if(e.strokeStyle=D||u,g)T().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[E,R]=l.path[0];e.moveTo(E,R);for(let $=1;l.path.length>$;$++)e.lineTo(l.path[$][0],l.path[$][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=vt(e,l.style.fill,l.style.fill),g&&!p)T().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[G,X]=l.path[0];e.moveTo(G,X);for(let V=1;l.path.length>V;V++)e.lineTo(l.path[V][0],l.path[V][1])}const Y=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==a&&1>a&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function bo(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function xo(e,t,n=.3){bo(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ko(e,t,n=.6){var o,i,r,s,l;if(!bo(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function wo(e,t,n,o=.35){bo(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ao(e,t){const n=mt(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=H().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Oo=(e,t,n,o)=>{var i,r,s;const l=t.filter(e=>"area"===e.type);for(const t of l){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const l=t._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const a=vt(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=a;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Ao(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=bt(e,t.fillGradient,"string"==typeof a?a:"#4e79a7",0,n,0,o);e.fillStyle=i||a,e.globalAlpha=u}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*u,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Ao(e,t),wo(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const n=t.strokeGradient&&t.topPath.length>=2?xt(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=mt(t.curve);if(e.beginPath(),o)T().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==l&&1>l&&e.restore(),n&&e.restore(),e.globalAlpha=1}},So=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=vt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=vt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),ko(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Co(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:l,br:a,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-l,o),l>0&&e.arcTo(n+i,o,n+i,o+l,l),e.lineTo(n+i,o+r-a),a>0&&e.arcTo(n+i,o+r,n+i-a,o+r,a),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function jo(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const _o=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Mo(e,t);else if(t.cornerRadii&&Sn(t.cornerRadii)){const n=vt(e,t.style.fill,yt(e,"var(--semiotic-primary, #007bff)")),o=jo(t),i=t.fillGradient&&"string"==typeof n?bt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Co(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=vt(e,t.style.fill,yt(e,"var(--semiotic-primary, #007bff)")),o=jo(t),i=t.fillGradient&&"string"==typeof n?bt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:l,w:a,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,l),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s,l+c);break;case"left":e.moveTo(s+a,l),e.lineTo(s+r,l),e.arcTo(s,l,s,l+r,r),e.lineTo(s,l+c-r),e.arcTo(s,l+c,s+r,l+c,r),e.lineTo(s+a,l+c);break;case"bottom":e.moveTo(s,l),e.lineTo(s+a,l),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s+r,l+c),e.arcTo(s,l+c,s,l+c-r,r);break;default:e.moveTo(s,l+c),e.lineTo(s,l+r),e.arcTo(s,l,s+r,l,r),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=vt(e,t.style.fill,yt(e,"var(--semiotic-primary, #007bff)")),o=jo(t),i=t.fillGradient&&"string"==typeof n?bt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}xo(e,t),e.globalAlpha=1}};function Mo(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}function Po(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Lo(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const No=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=yt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),xo(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Lo(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=Po(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},Fo=(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const l=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==l&&(e.globalAlpha=l);const a=yt(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=a,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=a,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=yt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}};function Bo(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}const To=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ho(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${To[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${To[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Wo={line:[Oo,vo,So],area:[Oo,So],stackedarea:[Oo,So],scatter:[So],bubble:[So],heatmap:[No],bar:[_o],swarm:[So],waterfall:[(e,t,n,o)=>{var i;_o(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,l=null==s?void 0:s._connectorStroke;if(l){e.save(),e.strokeStyle=yt(e,l)||l,e.lineWidth=null!==(i=null==s?void 0:s._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,l=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==l?void 0:l.baseline))continue;const a=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,a),e.lineTo(u,a),e.stroke()}e.restore()}}],candlestick:[Fo],mixed:[Oo,vo,So],custom:[Oo,_o,No,vo,So,Fo]},Io={top:20,right:20,bottom:30,left:40},zo={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function Do(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const Eo={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Ro({hover:n}){var o,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",l=null!==(o=n.data)&&void 0!==o?o:{},a=null!==(i=l.y)&&void 0!==i?i:l.value,c=null!==(r=l.x)&&void 0!==r?r:l.time;return t("div",{className:"semiotic-tooltip",style:Eo,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(a)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}Ro.ownsChrome=!0;const $o=f(function(n,l){var u,h,f,y,m,v,b,x,k,w,A,O,S;const{chartType:C,runtimeMode:j,data:_,chunkThreshold:M,chunkSize:P,xAccessor:L,yAccessor:N,colorAccessor:F,sizeAccessor:B,groupAccessor:T,lineDataAccessor:H,curve:W,normalize:I,baseline:z,stackOrder:D,binSize:E,valueAccessor:R,arrowOfTime:Y="right",windowMode:V="sliding",windowSize:q=200,timeAccessor:K,xExtent:Q,yExtent:Z,extentPadding:J=.1,scalePadding:ee,sizeRange:te,size:ne=[500,300],responsiveWidth:oe,responsiveHeight:ie,margin:re,className:se,background:le,lineStyle:ae,pointStyle:ce,areaStyle:ue,barStyle:de,waterfallStyle:he,swarmStyle:fe,barColors:ge,colorScheme:pe,boundsAccessor:ye,boundsStyle:me,y0Accessor:ve,band:be,gradientFill:xe,lineGradient:ke,areaGroups:we,openAccessor:Ae,highAccessor:Oe,lowAccessor:Se,closeAccessor:Ce,candlestickStyle:je,showAxes:_e=!0,axes:Me,xLabel:Pe,yLabel:Le,yLabelRight:Ne,xFormat:Fe,yFormat:Be,axisExtent:Te,tickFormatTime:He,tickFormatValue:We,hoverAnnotation:Ie,tooltipContent:ze,customHoverBehavior:De,customClickBehavior:Ee,enableHover:Re,hoverRadius:$e=30,tooltipMode:Ye,annotations:Ge,svgAnnotationRules:Xe,showGrid:Ve,legend:qe,legendHoverBehavior:Ke,legendClickBehavior:Qe,legendHighlightedCategory:Ze,legendIsolatedCategories:Je,legendPosition:et,legendLayout:tt,legendCategoryAccessor:nt,onCategoriesChange:rt,backgroundGraphics:st,foregroundGraphics:lt,canvasPreRenderers:at,svgPreRenderers:ct,title:ut,categoryAccessor:dt,brush:ht,onBrush:ft,decay:gt,pulse:pt,transition:mt,animate:vt,staleness:bt,heatmapAggregation:xt,heatmapXBins:kt,heatmapYBins:St,showValues:Ct,heatmapValueFormat:jt,marginalGraphics:_t,pointIdAccessor:Mt,xScaleType:Pt,yScaleType:Lt,accessibleTable:Tt=!0,description:Ht,summary:Wt,linkedCrosshairName:It,linkedCrosshairSourceId:zt,customLayout:Dt,layoutConfig:Et}=n,Rt=g().replace(/:/g,""),$t=i(!1),Yt=go({sizeProp:ne,responsiveWidth:oe,responsiveHeight:ie,userMargin:re,marginDefault:Io,animate:vt,transitionProp:mt,themeDirtyRef:$t}),Gt=function(){const[e,t]=d(!1);return _n(()=>{t(!0)},[]),e}(),Xt=function(){const e=c(Mn,Pn,Ln);return i(e).current}(),{reducedMotionRef:Vt,responsiveRef:qt,size:Ut,currentTheme:Kt,transition:Qt,introEnabled:Zt,tableId:Jt,rafRef:en,renderFnRef:tn,scheduleRender:nn}=Yt;let on=Yt.margin;if(_t){const e=60,t=Object.assign({},Yt.margin);_t.top&&e>t.top&&(t.top=e),_t.bottom&&e>t.bottom&&(t.bottom=e),_t.left&&e>t.left&&(t.left=e),_t.right&&e>t.right&&(t.right=e),on=t}const rn="function"==typeof lt?lt({size:Ut,margin:on}):lt,sn="function"==typeof st?st({size:Ut,margin:on}):st,ln=Ut[0]-on.left-on.right,an=Ut[1]-on.top-on.bottom,cn=r(()=>G(_),[_]),un=null!=Ie?Ie:Re,dn=i(null),hn=i(null),[fn,gn]=d(0),[pn,yn]=d(null),mn=i(null),vn=i(null),[bn,xn]=d(null),wn=i(zo.primary),An=i([]),Sn=i(nt),Tn=i(rt);Sn.current=nt,Tn.current=rt;const[Hn,In]=d(!1),[zn,Dn]=d([]),[En,Rn]=d([]),$n="streaming"===j||["bar","swarm","waterfall"].includes(C),Yn=r(()=>{var e,t,n;return{chartType:C,runtimeMode:$n?"streaming":"bounded",windowSize:q,windowMode:V,arrowOfTime:$n?Y:"right",extentPadding:J,scalePadding:ee,axisExtent:Te,xAccessor:L,yAccessor:N,timeAccessor:$n?K:void 0,valueAccessor:R,colorAccessor:F,sizeAccessor:B,groupAccessor:T||(H?"_lineGroup":void 0),categoryAccessor:dt,lineDataAccessor:H,xScaleType:Pt,yScaleType:Lt,xExtent:Q,yExtent:Z,sizeRange:te,binSize:E,normalize:I,baseline:z,stackOrder:D,boundsAccessor:ye,boundsStyle:me,y0Accessor:ve,band:be,gradientFill:!0===xe?{topOpacity:.8,bottomOpacity:.05}:!1===xe?void 0:xe,areaGroups:we?new Set(we):void 0,lineGradient:ke,openAccessor:Ae,highAccessor:Oe,lowAccessor:Se,closeAccessor:Ce,candlestickStyle:je,lineStyle:ae,pointStyle:ce,areaStyle:ue,swarmStyle:fe,waterfallStyle:he,colorScheme:pe,barColors:ge,barStyle:de,annotations:Ge,decay:gt,pulse:pt,transition:Qt,introAnimation:Zt,staleness:bt,heatmapAggregation:xt,heatmapXBins:kt,heatmapYBins:St,showValues:Ct,heatmapValueFormat:jt,pointIdAccessor:Mt,curve:W,themeCategorical:null===(e=null==Kt?void 0:Kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:U(Kt),themeSequential:null===(t=null==Kt?void 0:Kt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Kt?void 0:Kt.colors)||void 0===n?void 0:n.diverging,customLayout:Dt,layoutConfig:Et,layoutMargin:on}},[C,q,V,Y,J,ee,Te,L,N,K,R,Pt,Lt,F,B,T,dt,H,Q,Z,te,E,I,z,D,ye,me,ve,be,xe,ke,we,Ae,Oe,Se,Ce,je,ae,ce,ue,fe,he,de,pe,ge,Ge,gt,pt,null==Qt?void 0:Qt.duration,null==Qt?void 0:Qt.easing,Zt,bt,xt,kt,St,Ct,jt,$n,Mt,W,Kt,Dt,Et,on]),Gn=function(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Fn(e,t);if(!Bn(e)||!Bn(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Fn(n,i))return!1}else{if(!Bn(n)||!Bn(i))return!1;if(!Nn(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Yn),Xn=i(null);Xn.current||(Xn.current=new ot(Gn));const Vn=a(()=>{var e,t;const n=Sn.current,o=Tn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Xn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,An.current)||(An.current=i,o(i))},[]);s(()=>{var e;null===(e=Xn.current)||void 0===e||e.updateConfig(Gn),$t.current=!0,nn()},[Gn,nn]);const qn=i(null);qn.current||(qn.current=new X(e=>{const t=Xn.current;t&&t.ingest(e)&&($t.current=!0,nn())},{chunkThreshold:M,chunkSize:P})),s(()=>{var e;null===(e=qn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:M,chunkSize:P})},[M,P]);const Jn=a(e=>{var t;null===(t=qn.current)||void 0===t||t.push(e)},[]),to=a(e=>{var t;null===(t=qn.current)||void 0===t||t.pushMany(e)},[]),oo=a(()=>{var e,t;null===(e=qn.current)||void 0===e||e.clear(),null===(t=Xn.current)||void 0===t||t.clear(),$t.current=!0,nn()},[nn]);p(l,()=>({push:Jn,pushMany:to,remove:e=>{var t,n,o;null===(t=qn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Xn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(mn.current&&i.some(e=>{var t;return e===(null===(t=mn.current)||void 0===t?void 0:t.data)})&&(mn.current=null,xn(null)),$t.current=!0,nn()),i},update:(e,t)=>{var n,o,i;null===(n=qn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Xn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&($t.current=!0,nn()),r},clear:oo,getData:()=>{var e,t,n;return null===(e=qn.current)||void 0===e||e.flush(),null!==(n=null===(t=Xn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Xn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Xn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Jn,to,oo,nn]),s(()=>{var e,t;if(_){if(H&&cn.length>0&&"object"==typeof cn[0]&&null!==cn[0]){const t="string"==typeof H?H:"coordinates";if(Array.isArray(cn[0][t])){const n=[];for(const e of cn){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=qn.current)||void 0===e||e.setBoundedData(n))}}null===(t=qn.current)||void 0===t||t.setBoundedData(cn)}},[_,cn,H]);const{hoverHandlerRef:io,hoverLeaveRef:ro,onPointerMove:so,onPointerLeave:lo}=Yt;io.current=e=>{var t,n;if(!un)return;const o=dn.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-on.left,s=e.clientY-i.top-on.top;if(0>r||r>ln||0>s||s>an)return void(mn.current&&(mn.current=null,vn.current=null,xn(null),De&&(De(null),$t.current=!0),nn()));const l=Xn.current;if(!l||0===l.scene.length)return;const a=At(l.scene,r,s,$e,l.quadtree,l.maxPointRadius),c="multi"===Ye,u=()=>{mn.current&&(mn.current=null,vn.current=null,xn(null),De&&De(null),nn())};if(!a&&!c)return void u();const d=c||!a?r:a.x,h=c||!a?s:a.y;let f=no((null==a?void 0:a.datum)?Ue(a.datum,l.resolvedRibbons):{},d,h);if(c&&l.scene.length>0&&l.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=Ot(wt(e.path,e.curve),t,n);if(null===r)continue;const s=Nt(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=wt(e.topPath,e.curve),s=wt(e.bottomPath,e.curve),l=Ot(r,t,n);if(null===l)continue;const a=Ot(s,t,n),c=Nt(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:l,y0:null!=a?a:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(l.scene,d,Math.max($e,ln));if(e.length>0){const t=l.scales.y.invert,n=l.scales.x.invert,o=wn.current,i=n?n(d):d;if(a)f.xValue=i,f.xPx=d;else{const e={xValue:i};"string"==typeof L&&(e[L]=i),f=no(e,d,h,{xValue:i,xPx:d})}f.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===C&&null!=i?n-i:n,valuePx:e.y,color:e.color||o,datum:Ue(e.datum,l.resolvedRibbons)}})}}a||(null===(t=f.allSeries)||void 0===t?void 0:t.length)?(mn.current=f,vn.current=null!==(n=null==a?void 0:a.node)&&void 0!==n?n:null,xn(f),De&&(De(f),$t.current=!0),nn()):u()},ro.current=()=>{mn.current&&(mn.current=null,vn.current=null,xn(null),De&&(De(null),$t.current=!0),nn())};const ao=i(()=>{});ao.current=e=>{if(!Ee)return;const t=dn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-on.left,i=e.clientY-n.top-on.top;if(0>o||o>ln||0>i||i>an)return void Ee(null);const r=Xn.current;if(!r||0===r.scene.length)return void Ee(null);const s=At(r.scene,o,i,$e,r.quadtree,r.maxPointRadius);Ee(s?no(s.datum||{},s.x,s.y):null)};const uo=a(e=>ao.current(e),[]),ho=i(-1),fo=i(null),yo=i(null),mo=a(e=>{const t=Xn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(yo.current&&yo.current.version===n)o=yo.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});break}case"rect":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:"_default"});break;case"heatcell":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),yo.current={version:n,graph:o}}const i=ho.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),ho.current=0;const n=o.flat[0];fo.current={shape:n.shape,w:n.w,h:n.h};const i=Bt(Object.assign(Object.assign({},n),{datum:Ue(n.datum,t.resolvedRibbons)}));return mn.current=i,xn(i),De&&De(i),void nn()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Ft(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Ft(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return ho.current=-1,fo.current=null,mn.current=null,vn.current=null,xn(null),De&&De(null),void nn();ho.current=s;const l=o.flat[s];fo.current={shape:l.shape,w:l.w,h:l.h};const a=Bt(Object.assign(Object.assign({},l),{datum:Ue(l.datum,t.resolvedRibbons)}));mn.current=a,xn(a),De&&De(a),nn()},[De,nn]),vo=a(e=>{ho.current=-1,fo.current=null,so(e)},[so]);tn.current=()=>{var e,t;en.current=0;const n=dn.current,o=hn.current;if(!n||!o)return;const i=Xn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Vt.current?r+1e6:r),l=!Vt.current&&s,a=$t.current||s;a&&!l&&(i.computeScene({width:ln,height:an}),Vn());const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return zo;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),l=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||l||n||r?{axisStroke:a||zo.axisStroke,tickText:s||zo.tickText,crosshair:s?Do(s,"66"):zo.crosshair,hoverFill:c?Do(c,"4D"):zo.hoverFill,hoverStroke:s?Do(s,"99"):zo.hoverStroke,pointRing:c||zo.pointRing,primary:r||zo.primary}:zo}(n);wn.current=u.primary;const d=null!==(e=null==bt?void 0:bt.threshold)&&void 0!==e?e:5e3,h=bt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(a){const e=po(n,Ut,on,c);if(e){if(e.clearRect(-on.left,-on.top,Ut[0],Ut[1]),h&&(e.globalAlpha=null!==(t=null==bt?void 0:bt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==le&&!st){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=le||(t&&"transparent"!==t?t:null),i=o?yt(e,o):null;i&&(e.fillStyle=i,e.fillRect(-on.left,-on.top,Ut[0],Ut[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,ln,an),e.clip()),at&&i.scales)for(const t of at)e.save(),t(e,i.scene,i.scales,{width:ln,height:an}),e.restore();const o=Dt?Wo.custom:Wo[C];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:ln,height:an});e.restore(),h&&(e.globalAlpha=1)}}{const e=po(o,Ut,on,c);if(e&&(e.clearRect(-on.left,-on.top,Ut[0],Ut[1]),un&&mn.current&&i.scales&&function(e,t,n,o,i,r,s){var l;if(!1===i.crosshair)return;const a=t.allSeries,c=a&&a.length>0,u=null!==(l=t.xPx)&&void 0!==l?l:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,mn.current,ln,an,"object"==typeof un?un:{},vn.current,u),vn.current&&Array.isArray(Ie))){const t=Ie.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s="group"in n?n.group:void 0;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,vn.current,t,u)}}a&&n&&n.setAttribute("aria-label",Wn(i.scene,C+" chart"));const f=$t.current;if($t.current=!1,f&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!pn||e(pn.x.domain()[0])!==e(i.scales.x.domain()[0])||e(pn.x.domain()[1])!==e(i.scales.x.domain()[1])||e(pn.y.domain()[0])!==e(i.scales.y.domain()[0])||e(pn.y.domain()[1])!==e(i.scales.y.domain()[1])||pn.x.range()[0]!==i.scales.x.range()[0]||pn.x.range()[1]!==i.scales.x.range()[1]||pn.y.range()[0]!==i.scales.y.range()[0]||pn.y.range()[1]!==i.scales.y.range()[1])&&yn(i.scales),_t){const e=i.getData(),t="function"==typeof L?L:e=>e[L||"x"],n="function"==typeof N?N:e=>e[N||"y"];Dn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Rn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}f&&Ge&&Ge.length>0&&gn(e=>e+1),(null==bt?void 0:bt.showBadge)&&In(!!h),(l||null!=i.activeTransition||i.hasActivePulses)&&(en.current=requestAnimationFrame(()=>tn.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:a}=e;_n(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,l.current()},[t,n]);const c=i(a);c.current=a,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:Gt,wasHydratingFromSSR:Xt,storeRef:Xn,dirtyRef:$t,renderFnRef:tn,cleanup:()=>{var e;return null===(e=qn.current)||void 0===e?void 0:e.clear()}}),s(()=>{$t.current=!0,nn()},[C,ln,an,_e,le,ae,at,nn]),function(e,t,n,o,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const l=t.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,u=a-l.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,i,o])}(bt,Xn,$t,nn,Hn,In);const bo=r(()=>{if(Fe||He)return;const e=Xn.current;return(null==e?void 0:e.xIsDate)&&pn?Ho(pn.x.domain()):void 0},[Fe,He,pn]),xo=Fe||He||bo,ko=un&&bn?ze?ze(bn):e(Ro,{hover:bn}):null,wo=ko?e(co,{x:bn.x,y:bn.y,containerWidth:ln,containerHeight:an,margin:on,className:"stream-frame-tooltip",children:ko}):null,Ao=fo.current,Oo=e(eo,{active:ho.current>=0,hoverPoint:bn,margin:on,size:Ut,shape:null==Ao?void 0:Ao.shape,width:null==Ao?void 0:Ao.w,height:null==Ao?void 0:Ao.h}),So=Bo(L,K,"__semiotic_resolvedX","__semiotic_resolvedTime"),Co=Bo(N,R,"__semiotic_resolvedY","__semiotic_resolvedValue"),jo=So.key,_o=Co.key,Mo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(So,Co,Ge&&Ge.length>0||!1);if(jn||!Gt&&Xt){const n=Xn.current;n&&_&&(n.ingest({inserts:cn,bounded:!0}),n.computeScene({width:ln,height:an}));const i=null!==(u=null==n?void 0:n.scene)&&void 0!==u?u:[],r=null!==(h=null==n?void 0:n.scales)&&void 0!==h?h:null,s=xo||(()=>{if((null==n?void 0:n.xIsDate)&&r)return Ho(r.x.domain())})();return t("div",{ref:qt,className:"stream-xy-frame"+(se?" "+se:""),role:"img","aria-label":Ht||("string"==typeof ut?ut:"XY chart"),style:{position:"relative",width:oe?"100%":Ut[0],height:ie?"100%":Ut[1]},children:[e(Kn,{summary:Wt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ut[0],height:Ut[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${on.left},${on.top})`,children:sn}),t("g",{transform:`translate(${on.left},${on.top})`,children:[le&&e("rect",{x:0,y:0,width:ln,height:an,fill:le}),ct&&r&&ct.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:ln,height:an})},"svgpre-"+n)),i.map((n,o)=>function(n,o,i){var r,s,l,a,c;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const n=`${i?i+"-":""}area-clip-${o}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:n,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:Cn(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+o)}return e("path",{d:u,fill:Cn(c.style.fill),fillOpacity:null!==(a=null!==(l=c.style.fillOpacity)&&void 0!==l?l:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Cn(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Cn(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,l]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),a=.299*r+.587*s+.114*l>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),l=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:l,stroke:l,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o,Rt)).filter(Boolean)]})]}),e(On,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,scales:r,showAxes:_e,axes:Me,xLabel:Pe,yLabel:Le,yLabelRight:Ne,xFormat:s,yFormat:Be||We,axisExtent:Te,showGrid:Ve,title:ut,legend:qe,legendHoverBehavior:Ke,legendClickBehavior:Qe,legendHighlightedCategory:Ze,legendIsolatedCategories:Je,legendPosition:et,legendLayout:tt,foregroundGraphics:it(rn,null===(f=Xn.current)||void 0===f?void 0:f.customLayoutOverlays),marginalGraphics:_t,xValues:[],yValues:[],annotations:Ge,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:jo,yAccessor:_o,annotationData:Mo(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof W?W:void 0,linkedCrosshairName:It,linkedCrosshairSourceId:zt})]})}return t("div",{ref:qt,className:"stream-xy-frame"+(se?" "+se:""),role:"group","aria-label":Ht||("string"==typeof ut?ut:"XY chart"),tabIndex:0,style:{position:"relative",width:oe?"100%":Ut[0],height:ie?"100%":Ut[1],overflow:"visible"},onKeyDown:mo,children:[Tt&&e(Qn,{tableId:Jt}),Tt&&e(Un,{scene:null!==(m=null===(y=Xn.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],chartType:C+" chart",tableId:Jt,chartTitle:"string"==typeof ut?ut:void 0}),e(Kn,{summary:Wt}),t("div",{role:"img","aria-label":Ht||("string"==typeof ut?ut:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:un?vo:void 0,onMouseLeave:un?lo:void 0,onClick:Ee?uo:void 0,children:[sn&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ut[0],height:Ut[1],pointerEvents:"none"},children:e("g",{transform:`translate(${on.left},${on.top})`,children:sn})}),e(kn,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,scales:pn,showAxes:_e,axes:Me,showGrid:Ve,xFormat:xo,yFormat:Be||We,axisExtent:Te}),e("canvas",{ref:dn,"aria-label":Wn(null!==(b=null===(v=Xn.current)||void 0===v?void 0:v.scene)&&void 0!==b?b:[],C+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:hn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Zn,{hoverPoint:bn}),e(On,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,scales:pn,showAxes:_e,axes:Me,xLabel:Pe,yLabel:Le,yLabelRight:Ne,xFormat:xo,yFormat:Be||We,axisExtent:Te,showGrid:Ve,title:ut,legend:qe,legendHoverBehavior:Ke,legendClickBehavior:Qe,legendHighlightedCategory:Ze,legendIsolatedCategories:Je,legendPosition:et,legendLayout:tt,foregroundGraphics:it(rn,null===(x=Xn.current)||void 0===x?void 0:x.customLayoutOverlays),marginalGraphics:_t,xValues:zn,yValues:En,annotations:Ge,svgAnnotationRules:Xe,annotationFrame:fn,xAccessor:jo,yAccessor:_o,annotationData:Mo(null===(k=Xn.current)||void 0===k?void 0:k.getData()),pointNodes:null===(w=Xn.current)||void 0===w?void 0:w.scene.filter(e=>"point"===e.type),curve:"string"==typeof W?W:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==le&&!st,linkedCrosshairName:It,linkedCrosshairSourceId:zt}),(ht||ft)&&e($,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,dimension:null!==(A=null==ht?void 0:ht.dimension)&&void 0!==A?A:"xy",scales:pn,onBrush:null!=ft?ft:()=>{},binSize:E,snap:null==ht?void 0:ht.snap,binBoundaries:null!==(O=null==ht?void 0:ht.binBoundaries)&&void 0!==O?O:"bar"===C?null===(S=Xn.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==ht?void 0:ht.snapDuring,streaming:"streaming"===j}),(null==bt?void 0:bt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===bt.badgePosition?{top:4,left:4}:"bottom-left"===bt.badgePosition?{bottom:4,left:4}:"bottom-right"===bt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Hn?"#dc3545":"#28a745",color:"white"}),children:Hn?"STALE":"LIVE"}),Oo,wo]})]})});$o.displayName="StreamXYFrame";const Yo=u(null);function Go({colors:t,categories:n,colorScheme:o="category10",children:i}){const s=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:Fe[o]||Be,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e(Yo.Provider,{value:s,children:i})}function Xo(){return l(Yo)}function Vo(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function qo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}Go.displayName="CategoryColorProvider";const[Uo,Ko]=V(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=qo(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=qo(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Qo,Zo]=V(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Jo(e){const t=g(),n=e.clientId||t,{name:o}=e,i=Ko(e=>e.selections.get(o)),s=Ko(e=>e.setClause),l=Ko(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Vo(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:a(()=>{l(o,n)},[l,o,n]),clientId:n}}function ei(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=Jo({name:t});return{onHover:a(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}function ti(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function ni(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:l,clear:c}=Jo({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=a(e=>{if(!e)return void c();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&ti(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&ti(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}const oi=u(!1),ii=u(null),ri="undefined"==typeof window?s:h;function si(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function li(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function ai({selections:e}){const t=Ko(e=>e.setResolution);return s(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function ci({categoryColors:t,interaction:n,selectionName:o,field:l}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],f=ei({name:o,fields:[l]}),g=Jo({name:o,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[m,v]=d(null),b=i(g.selectPoints);b.current=g.selectPoints;const x=i(g.clear);x.current=g.clear,s(()=>{"isolate"===n&&(p.size>0?b.current({[l]:Array.from(p)}):x.current())},[n,p,l]);const k=a(e=>{"highlight"===n&&(e?(v(e.label),f.onHover({[l]:e.label})):(v(null),f.onHover(null)))},[n,l,f]),w=a(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[O]]=uo([0,0],!0,!1),S=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(c.map(([e])=>e),O),[c,O]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*S+8),style:{display:"block",overflow:"visible"},children:e(Et,{legendGroups:h,title:!1,orientation:"horizontal",width:O,height:20,customHoverBehavior:"highlight"===n?k:void 0,customClickBehavior:"isolate"===n?w:void 0,highlightedCategory:m,isolatedCategories:p})})})}function ui({children:n,selections:o,showLegend:s,legendPosition:l="top",legendInteraction:a="none",legendSelectionName:c="legend",legendField:u="category"}){const h=Xo(),[f,g]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const n=si(t);g(t=>{var o;return li(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{g(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(f))for(const n of t)e.push(n);return si(e)},[f]),v=r(()=>{var e;const t=null!=h?h:{},n=p.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of m)t[e]||n[e]||(n[e]=Be[o%Be.length],o++);const i=Object.assign({},t);for(const o of m)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[h,m]),b=void 0===s||s,x=b&&Object.keys(v).length>0;return e(Uo,{children:t(Qo,{children:[o&&e(ai,{selections:o}),e(ii.Provider,{value:y,children:e(Go,{colors:v,children:t(oi.Provider,{value:x,children:[b&&"top"===l&&e(ci,{categoryColors:v,interaction:a,selectionName:c,field:u}),n,b&&"bottom"===l&&e(ci,{categoryColors:v,interaction:a,selectionName:c,field:u})]})})})]})})}function di(e){return e?"string"==typeof e?{name:e}:e:null}function hi(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function fi(){return oe(e=>e.theme)}o.createContext(void 0);const gi="#007bff";function pi(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function yi(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function mi(){var e;const t=fi(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function vi(e,t,n){const o=Xo(),i=mi();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=Ie(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return Ie(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=Ie(e,t,s);return e=>o[e]||n(e)}return Ie(e,t,s)}if(o&&Object.keys(o).length>0){const e=Ie([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}function bi({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:l,chartId:c,onClick:u,hoverHighlight:h,colorByField:f}){const p=g(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=Jo({name:(null==e?void 0:e.name)||"__unused__"}),v=ei({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=Zo(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=d(null),A=f||n[0],O=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,A]),S=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=pi(e,t,y.xField);null!=n&&function(e,t,n){const o=rn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(rn={positions:new Map(rn.positions).set(e,{xValue:t,sourceId:n})},ln())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&an(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const r=yi(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,v,y,p,i,l,c,b,h,A]),C=a(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=pi(e,t,y.xField);null!=n&&function(e,t,n){const o=rn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(rn.positions);return t.delete(e),rn={positions:t},ln(),!1}rn={positions:new Map(rn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},ln()}(y.name||"hover",n,p)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const n=yi(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[u,i,b,l,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{cn(e,p),an(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:p}}function xi(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function ki({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:s="right",userMargin:a,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=l(oi),h=null!==l(ii),f=void 0!==o?o:!d&&!!t,p=!!t&&(f||h),y=r(()=>{if(!p)return[];if(void 0!==u)return u;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[u,t,e,p]);!function(e){const t=l(ii),n=g(),o=si(e),r=i([]);li(r.current,o)||(r.current=o);const s=r.current;ri(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),ri(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?y:[]);const m=r(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=s?o(s,t,n):n?n(i):Te[r%Te.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:We,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),v=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=t=>{const n=e[t];return"number"==typeof n?n:c[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return m&&("right"===s&&!o("right")&&110>n.right?n.right=110:"left"===s&&!o("left")&&110>n.left?n.left=110:"top"===s&&!o("top")&&50>n.top?n.top=50:"bottom"===s&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[c,a,m,s]);return{legend:m,margin:v,legendPosition:s}}function wi(e,t,n){const[o,i]=d(null),[s,l]=d(new Set),c=a(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=a(t=>{"isolate"===e&&l(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:u,legendSelectionHook:h}}const Ai={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Oi(e,t,n){var o,i,r,s,l,a,c;const u=Ai[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Si(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Si(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Ci(e){return"string"==typeof e?e:"value"}function ji(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function _i(e,t){if(!t)return ji(e);try{const n=t(e);return null==n?ji(e):n}catch(t){return ji(e)}}function Mi(e,t){return"function"==typeof t?t(e):e[t]}function Pi(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),n}function Li(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const s=o?_i(Mi(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:oo,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((n,o)=>{const i=_i(Mi(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function Ni({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Fi extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(Ni,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Bi;const Ti="undefined"!=typeof process&&"production"!==(null===(Bi=process.env)||void 0===Bi?void 0:Bi.NODE_ENV);function Hi({componentName:t,width:n,height:o,children:i}){return e(Fi,{fallback:i=>e(Ni,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Wi={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Ii={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function zi(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Wi),{width:n,height:o}),children:i||"No data available"}):null}function Di(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),l=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+l)-l))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ii),{position:"absolute",top:a+o*(s+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function Ei(e,t,n,o){if(!Ti)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Ri(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function $i(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Ri(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Yi({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=$i(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Gi(e){const t=oe(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Xi(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:s,legendPosition:l,selection:c,linkedHover:u,fallbackFields:h,unwrapData:f=!1,onObservation:g,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,loadingContent:A,emptyContent:O,width:S,height:C}=e,j=void 0===n,_=r(()=>G(t),[t]),[M,P]=d([]),L=a(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),N="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:F,hoverSelectionHook:B,customHoverBehavior:T,customClickBehavior:H,crosshairSourceId:W}=bi({selection:c,linkedHover:u,fallbackFields:h,unwrapData:f,onObservation:g,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:N}),I=xi(u,W),z=vi(_,o,i),D=r(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),E=r(()=>j&&M.length>0?M:D,[j,M,D]),R=wi(s,o,E),$=r(()=>B||(R.legendSelectionHook?R.legendSelectionHook:F),[B,R.legendSelectionHook,F]),Y=Gi(c),X=mi(),V=Xo(),q=r(()=>{if(z)return z;if(!o||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:X&&X.length>0?X:Te,t="__streamCat",n=Ie(E.map(e=>({[t]:e})),t,e);return e=>(null==V?void 0:V[e])||n(e)||"#999"},[z,o,E,i,X,V]),{legend:U,margin:K,legendPosition:Q}=ki({data:_,colorBy:o,colorScale:q,showLegend:m,legendPosition:l,userMargin:v,defaults:b,categories:E}),Z=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),s&&"none"!==s&&(e.legendHoverBehavior=R.onLegendHover,e.legendClickBehavior=R.onLegendClick,e.legendHighlightedCategory=R.highlightedCategory,e.legendIsolatedCategories=R.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[U,Q,s,R.onLegendHover,R.onLegendClick,R.highlightedCategory,R.isolatedCategories,j,o,L]),J=Array.isArray(n)?G(n):n,ee=Di(w,S,C,A),te=ee?null:zi(J,S,C,O);return{data:_,colorScale:z,allCategories:E,legendState:R,effectiveSelectionHook:$,activeSelectionHook:F,customHoverBehavior:T,customClickBehavior:H,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:I,resolvedSelection:Y}}function Vi(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function qi(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:i,resolveStroke:s,fillArea:l,areaOpacity:a=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f}=e,g=r(()=>(e,r)=>{const c={strokeWidth:t},u=!0===l||Array.isArray(l)&&null!=r&&l.includes(r);let d;return s?d=s(e,r):n?o&&(d=We(e,n,o)):d=i||gi,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=a)),c},[t,n,o,i,s,l,a]),p=r(()=>Vi(g,{stroke:c,strokeWidth:u,opacity:d}),[g,c,u,d]);return r(()=>hi(p,null!=h?h:null,f),[p,h,f])}function Ui(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const l=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of l){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function Ki(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,l)}a((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Qi="__forecastSegment";let Zi=null;function Ji(){return Ki(this,void 0,void 0,function*(){return Zi||(Zi=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),Zi})}const er="__semiotic_resolvedX",tr="__semiotic_resolvedY";function nr(e){const{data:t,xAccessor:n,yAccessor:o,forecast:l,anomaly:a,groupBy:c}=e,u="string"==typeof n?n:er,h="string"==typeof o?o:tr,f=r(()=>{if(!l&&!a)return t;const e="function"==typeof n,i="function"==typeof o;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[er]=n(t)),i&&(r[tr]=o(t)),r}):t},[t,l,a,n,o]),[g,p]=d(null),[y,m]=d([]),v=i(l),b=i(a);return s(()=>{if(!l&&!a)return void((v.current||b.current)&&(p(null),m([]),v.current=l,b.current=a));let e=!1;const t=l!==v.current||a!==b.current;if(v.current=l,b.current=a,t&&(p(null),m([])),l){const t=c&&"string"==typeof c&&"object"==typeof l?Object.assign(Object.assign({},l),{_groupBy:c}):l;(function(...e){return Ki(this,void 0,void 0,function*(){return(yield Ji()).buildForecast(...e)})})(f,u,h,t,a).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else a&&function(...e){return Ki(this,void 0,void 0,function*(){return(yield Ji()).buildAnomalyAnnotations(...e)})}(a).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[f,l,a,u,h,c]),{effectiveData:g?g.processedData:t,statisticalAnnotations:y,hasForecast:!!g,xAccessorKey:u,yAccessorKey:h}}const or=f(function(t,n){var o,l;const c=i(null);Ui(n,{variant:"xy",frameRef:c});const u=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:f,className:g,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:O="linear",showPoints:S=!1,pointRadius:C=3,fillArea:j=!1,areaOpacity:_=.3,lineWidth:M=2,lineGradient:P,tooltip:L,pointIdAccessor:N,annotations:F,directLabel:B,gapStrategy:T="break",anomaly:H,forecast:W,band:I,xExtent:z,yExtent:D,frameProps:E={},selection:R,linkedHover:$,onObservation:Y,onClick:X,hoverHighlight:V,hoverRadius:q,chartId:U,loading:K,loadingContent:Q,emptyContent:Z,legendInteraction:J,legendPosition:ee,xScaleType:te,yScaleType:ne,color:oe,stroke:ie,strokeWidth:re,opacity:se}=t,{width:le,height:ae,enableHover:ce,showGrid:ue,showLegend:de,title:he,description:fe,summary:ge,accessibleTable:pe,xLabel:ye,yLabel:me}=u,ve=r(()=>G(h),[h]);Ei("LineChart",ve,"xAccessor",v),Ei("LineChart",ve,"yAccessor",b);const{effectiveData:be,statisticalAnnotations:xe}=nr({data:ve,xAccessor:v,yAccessor:b,forecast:W,anomaly:H,groupBy:x}),ke="__compoundGroup",we=!(!W||!x),Ae=we?ke:W?Qi:x,Oe=r(()=>{if(!we)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const n=Object.assign({},t);return n[ke]=`${e(t)}__${t[Qi]||"observed"}`,n})},[be,we,x]),Se=we?Oe:be,Ce=w||x,je=r(()=>{if(!W)return;const e=W.upperBounds,t=W.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[W,be,b]),_e=a(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Me=void 0!==(null===(o=Se[0])||void 0===o?void 0:o[k]),Pe=r(()=>{if(Me)return Se;if(Ae){const e=Se.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[k]:[]};"string"==typeof Ae&&(o[Ae]=n),we&&(o[Qi]=t[Qi],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Se}]},[Se,Ae,k,Me]),{gapProcessedLineData:Le,hasGaps:Ne}=r(()=>{if("interpolate"===T){let e=!1;const t=[];for(const n of Pe){const o=(n[k]||[]).filter(t=>!_e(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const n of Pe){const o=n[k]||[];let i=[],r=0;const s=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const l of o)if(_e(l))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},l),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Pe){const i=o[k]||[],r=[];for(const n of i)_e(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[k]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Pe,hasGaps:!1}},[Pe,T,k,_e,Ae,b]),Fe="object"==typeof B?B:{},Be=Fe.position||"end",Te=Fe.fontSize||11,He=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof Ce?Ce:e=>e[Ce],n=new Set;for(const o of Le){const i=o[k]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Be?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const s=r+"";""!==s&&n.add(s)}return Array.from(n)},[B,Ce,Le,k,Be]),Ie=r(()=>{if(!B)return u.marginDefaults;const e=He.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0)+10,t="end"===Be?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[t]:Math.max(u.marginDefaults[t]||0,e)})},[B,He,Te,Be,u.marginDefaults]),ze=Xi({data:be,rawData:h,colorBy:Ce,colorScheme:A,legendInteraction:J,legendPosition:ee,selection:R,linkedHover:$,fallbackFields:Ce?["string"==typeof Ce?Ce:""]:[],unwrapData:!1,onObservation:Y,onClick:X,hoverHighlight:V,chartType:"LineChart",chartId:U,showLegend:(!B||void 0!==de)&&de,userMargin:f,marginDefaults:Ie,loading:K,loadingContent:Q,emptyContent:Z,width:le,height:ae}),De=ze.colorScale,Ee=ze.customHoverBehavior,Re=ze.customClickBehavior,$e=ze.crosshairProps,Ye=qi({lineWidth:M,colorBy:Ce,colorScale:De,color:oe,fillArea:j,areaOpacity:_,stroke:ie,strokeWidth:re,opacity:se,effectiveSelectionHook:ze.effectiveSelectionHook,resolvedSelection:ze.resolvedSelection}),[Ge,Xe]=d(null);s(()=>{if(!W)return void Xe(null);let e=!1;return function(...e){return Ki(this,void 0,void 0,function*(){return(yield Ji()).createSegmentLineStyle(...e)})}(Ye,W).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,W]);const Ve=Ge||Ye,qe=r(()=>{if(S)return e=>{const t={r:C,fillOpacity:1};return Ce?De&&(t.fill=We(e.parentLine||e,Ce,De)):t.fill=oe||gi,t}},[S,C,Ce,De,oe]),Ue=Array.isArray(j)?"mixed":j?"area":"line",Ke=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof v?v:e=>e[v],n="function"==typeof b?b:e=>e[b],o="function"==typeof Ce?Ce:e=>e[Ce],i=new Map;for(const t of Le){const n=t[k]||[];if(0===n.length)continue;const r="end"===Be?n[n.length-1]:n[0],s=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==s)continue;const l=s+"";""===l||i.has(l)||i.set(l,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(o),["string"==typeof b?b:"y"]:n(o),dx:"end"===Be?6:-6,dy:0,color:De?De(e):gi,fontSize:Te}));r.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",n=r[e-1],o=r[e];Te+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Te+2)}return r},[B,Ce,De,Le,k,v,b,Be,Te]),Qe=ze.margin,Ze=x||w,Je=r(()=>Li([{label:ye||Ci(v),accessor:v,role:"x",format:p},{label:me||Ci(b),accessor:b,role:"y",format:y},...Ze?[{label:Ci(Ze),accessor:Ze,role:"group"}]:[],...Pi(I,y)]),[v,b,ye,me,Ze,p,y,I]),et=Yi({componentName:"LineChart",data:Me?(null===(l=be[0])||void 0===l?void 0:l[k])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),tt=r(()=>Me||Ae||Ne?Le.flatMap(e=>{const t=e[k]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Se,[Le,k,Me,Ae,Se,Ne]),nt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ue},Array.isArray(j)&&{areaGroups:j}),P&&{lineGradient:P}),null!=q&&{hoverRadius:q}),null!=h&&{data:tt}),{xAccessor:v,yAccessor:b,xScaleType:te,yScaleType:ne}),z&&{xExtent:z}),!D||null==D[0]&&null==D[1]?je?{yExtent:je}:{}:{yExtent:D}),{groupAccessor:"break"===T&&Ne?"_gapSegment":Ae||void 0}),I&&{band:I}),{curve:O,lineStyle:Ve}),S&&{pointStyle:qe}),{size:[le,ae],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Qe,showAxes:u.showAxes,xLabel:ye,yLabel:me,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),{enableHover:ce,showGrid:ue}),ze.legendBehaviorProps),he&&{title:he}),fe&&{description:fe}),ge&&{summary:ge}),void 0!==pe&&{accessibleTable:pe}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?lo():ao(L)||Je}),"multi"===L&&{tooltipMode:"multi"}),($||Y||X||V)&&{customHoverBehavior:Ee}),(Y||X||$)&&{customClickBehavior:Re}),N&&{pointIdAccessor:N}),((null==F?void 0:F.length)||xe.length||Ke.length)&&{annotations:[...F||[],...xe,...Ke]}),$e),E);return ze.earlyReturn?ze.earlyReturn:et?e(Ni,{componentName:"LineChart",message:et,width:le,height:ae}):e(Hi,{componentName:"LineChart",width:le,height:ae,children:e($o,Object.assign({ref:c},nt))})});function ir(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:l}=e,a={};return t&&(a.title=t),n&&(a.description=n),o&&(a.summary=o),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),void 0!==l&&(a.axisExtent=l),a}function rr(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:l=!0}=e,a={};return(t||n||o||i)&&(a.customHoverBehavior=r),(l?n||o||t:n||o)&&(a.customClickBehavior=s),a}function sr(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:ao(t)||n}}function lr(e){var t;const{safeData:n,data:o,areaBy:i,lineDataAccessor:s,colorBy:l,colorScale:a,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:O,yFormat:S,groupField:C}=e,j=void 0!==(null===(t=n[0])||void 0===t?void 0:t[s]),_=r(()=>{if(null==o)return[];if(!j&&!i)return n;let e;if(j)e=n;else{const t=i,o=n.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[s]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][s].push(n),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[s]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[o,n,i,s,j]),M=r(()=>e=>{const t={};if(l){if(a){const n=We(e,l,a);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||gi;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[l,a,c,p,y,m]),P=r(()=>Vi(M,{stroke:u,strokeWidth:d,opacity:h}),[M,u,d,h]);return{flattenedData:_,lineStyle:r(()=>hi(P,null!=f?f:null,g),[P,f,g]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return l?a&&(t.fill=We(e.parentLine||e,l,a)):t.fill=c||gi,t}},[v,b,l,a,c]),defaultTooltipContent:r(()=>Li([{label:w||Ci(x),accessor:x,role:"x",format:O},{label:A||Ci(k),accessor:k,role:"y",format:S},...C?[{label:Ci(C),accessor:C,role:"group"}]:[],...Pi(e.band,S)]),[x,k,w,A,C,O,S,e.band])}}function ar(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}or.displayName="LineChart";const cr=f(function(t,n){const o=i(null);Ui(n,{variant:"xy",frameRef:o});const s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",areaBy:g,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:O=!0,lineWidth:S=2,showPoints:C=!1,pointRadius:j=3,tooltip:_,annotations:M,forecast:P,anomaly:L,band:N,xExtent:F,yExtent:B,frameProps:T={},selection:H,linkedHover:W,onObservation:I,onClick:z,hoverHighlight:D,chartId:E,loading:R,loadingContent:$,emptyContent:Y,legendInteraction:X,legendPosition:V,color:q,stroke:U,strokeWidth:K,opacity:Q}=t,{width:Z,height:J,enableHover:ee,showGrid:te,showLegend:ne,title:oe,description:ie,summary:re,accessibleTable:se,xLabel:le,yLabel:ae}=s,ce=r(()=>G(l),[l]),ue=b||g,de=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:ar(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);Ei("AreaChart",ce,"xAccessor",h),Ei("AreaChart",ce,"yAccessor",f);const he=Xi({data:ce,rawData:l,colorBy:ue,colorScheme:x,legendInteraction:X,legendPosition:V,selection:H,linkedHover:W,fallbackFields:ue?["string"==typeof ue?ue:""]:[],unwrapData:!1,onObservation:I,onClick:z,hoverHighlight:D,chartType:"AreaChart",chartId:E,showLegend:ne,userMargin:a,marginDefaults:s.marginDefaults,loading:R,loadingContent:$,emptyContent:Y,width:Z,height:J}),{effectiveData:fe,statisticalAnnotations:ge}=nr({data:ce,xAccessor:h,yAccessor:f,forecast:P,anomaly:L,groupBy:g}),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ve}=lr({safeData:fe,data:l,areaBy:g,lineDataAccessor:v,colorBy:ue,colorScale:he.colorScale,color:q,stroke:U,strokeWidth:K,opacity:Q,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,areaOpacity:w,showLine:O,lineWidth:S,showPoints:C,pointRadius:j,xAccessor:h,yAccessor:f,xLabel:le,yLabel:ae,xFormat:u,yFormat:d,groupField:g||b,band:N}),be=Yi({componentName:"AreaChart",data:l,accessors:{xAccessor:h,yAccessor:f}}),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:pe}),{xAccessor:h,yAccessor:f,groupAccessor:g||void 0}),p&&{y0Accessor:p}),N&&{band:N}),de&&{gradientFill:de}),A&&{lineGradient:A}),{curve:k,lineStyle:ye}),C&&me&&{pointStyle:me}),{size:[Z,J],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:he.margin,showAxes:s.showAxes,xLabel:le,yLabel:ae,xFormat:u,yFormat:d,enableHover:ee}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:te}),he.legendBehaviorProps),ir({title:oe,description:ie,summary:re,accessibleTable:se,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===_?{tooltipContent:lo(),tooltipMode:"multi"}:sr({tooltip:_,defaultTooltipContent:ve})),rr({linkedHover:W,onObservation:I,onClick:z,hoverHighlight:D,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior})),(M&&M.length>0||ge.length>0)&&{annotations:[...M||[],...ge]}),F&&{xExtent:F}),B&&{yExtent:B}),he.crosshairProps),T);return he.earlyReturn?he.earlyReturn:be?e(Ni,{componentName:"AreaChart",message:be,width:Z,height:J}):e(Hi,{componentName:"AreaChart",width:Z,height:J,children:e($o,Object.assign({ref:o},xe))})});function ur(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}cr.displayName="AreaChart";const dr=f(function(n,o){const s=i(null),l=Oi(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:h,xFormat:f,yFormat:g,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:k="var(--semiotic-danger, #dc2626)",seriesBColor:w="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:O=1.5,showPoints:S=!1,pointRadius:C=3,curve:j="linear",areaOpacity:_=.6,gradientFill:M,tooltip:P,annotations:L,xExtent:N,yExtent:F,frameProps:B={},selection:T,linkedHover:H,onObservation:W,onClick:I,hoverHighlight:z,chartId:D,loading:E,loadingContent:R,emptyContent:$,legendInteraction:Y,legendPosition:X,pointIdAccessor:V,windowSize:q}=n,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:ie,yLabel:re}=l,se=r(()=>"function"==typeof y?e=>ur(y(e)):e=>ur(e[y]),[y]),le=r(()=>"function"==typeof m?e=>ur(m(e)):e=>ur(e[m]),[m]),ae=r(()=>"function"==typeof v?e=>ur(v(e)):e=>ur(e[v]),[v]),[ce,ue]=d([]),de=i([]),he=null==c,fe=r(()=>G(he?ce:c),[he,ce,c]),ge=r(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let s=0,l=null,a=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>r.push(e),f=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],g=t(r),p=n(r),y=o(r);if(!Number.isFinite(g)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=l){if(a&&a.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-a.a-(y-a.b);if(0!==n){const o=Math.max(0,Math.min(1,(a.b-a.a)/n));e=a.x+o*(g-a.x),t=a.a+o*(p-a.a)}else e=a.x,t=a.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t}),s++,l=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],l)}else for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:r}),a={x:g,a:p,b:y,w:m}}else{l=m;for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:r}),a={x:g,a:p,b:y,w:m}}else c.push({x:g,y:p,datum:r})}for(const e of c)f(e,null!=l?l:"A");return r}(fe,se,le,ae),[fe,se,le,ae]),pe=r(()=>A?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];for(const e of i){const i=t(e),s=n(e),l=o(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(l)&&r.push({__x:i,__y:l,__diffSegment:"line-B"})}return r}(fe,se,le,ae):[],[A,fe,se,le,ae]),ye=r(()=>[...ge,...pe],[ge,pe]),me=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(o,()=>{const e=e=>{const t=q&&e.length>q?e.slice(e.length-q):e;de.current=t,ue(t)},t=V?"function"==typeof V?V:e=>e[V]:null;return{push:t=>e([...de.current,t]),pushMany:t=>e([...de.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of de.current)o.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],r=[],s=de.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>he?de.current:fe,getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[he,fe,V,q]);const ve=Xi({data:fe,rawData:c,colorBy:"__diffWinner",colorScheme:[k,w],legendInteraction:Y,legendPosition:X,selection:T,linkedHover:H,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:W,onClick:I,hoverHighlight:z,chartType:"DifferenceChart",chartId:D,showLegend:J,userMargin:u,marginDefaults:l.marginDefaults,loading:E,loadingContent:R,emptyContent:$,width:U,height:K}),be=r(()=>{if(!1!==J)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:k},{label:x,color:w}]}]}},[J,b,x,k,w]),xe=a(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?k:w,stroke:"none",fillOpacity:_}},[k,w,_]),ke=a(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,strokeWidth:O,fill:"none"}),[k,w,O]),we=a(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,r:C}),[k,w,C]),Ae=a(n=>{var o;const i=n.data,r=n.allSeries,s=null!==(o=n.xValue)&&void 0!==o?o:null==i?void 0:i.__x;let l=null==i?void 0:i.__valA,a=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(l=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(a=t.value)}if(null!=s&&(null==l||null==a)){const e=fe.find(e=>se(e)===s);e&&(null==l&&(l=le(e)),null==a&&(a=ae(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=f&&null!=s?f(s):null!=s?s+"":"";return t("div",{className:"semiotic-tooltip",style:oo,children:[u&&e("div",{style:{fontWeight:600,marginBottom:4},children:u}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(l)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(a)]})]}),null!=l&&null!=a&&Number.isFinite(l)&&Number.isFinite(a)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(l-a)]})]})},[fe,se,le,ae,f,k,w,b,x]),Oe="multi"===P,Se=r(()=>!1===P?()=>null:Oe?Ae:ao(P)||Ae,[P,Oe,Ae]),Ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:ye,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:me,curve:j,areaStyle:xe,lineStyle:ke},S&&{pointStyle:we}),{size:[U,K],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ve.margin,showAxes:l.showAxes,xLabel:ie,yLabel:re,xFormat:f,yFormat:g,enableHover:Q,showGrid:Z}),M&&{gradientFill:!0===M?{topOpacity:.85,bottomOpacity:.15}:M}),be&&{legend:be,legendPosition:ve.legendPosition}),ir({title:ee,description:te,summary:ne,accessibleTable:oe,className:h,animate:n.animate,axisExtent:n.axisExtent})),{tooltipContent:Se}),Oe&&{tooltipMode:"multi"}),rr({linkedHover:H,onObservation:W,onClick:I,hoverHighlight:z,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),N&&{xExtent:N}),F&&{yExtent:F}),ve.crosshairProps),B);return ve.earlyReturn?ve.earlyReturn:e(Hi,{componentName:"DifferenceChart",width:U,height:K,children:e($o,Object.assign({ref:s},Ce))})});"function"==typeof dr&&(dr.displayName="DifferenceChart");const hr=f(function(t,n){const o=i(null),s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",areaBy:g,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:A=3,normalize:O=!1,baseline:S="zero",stackOrder:C,tooltip:j,annotations:_,xExtent:M,yExtent:P,frameProps:L={},selection:N,linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,chartId:W,loading:I,loadingContent:z,emptyContent:D,legendInteraction:E,legendPosition:R,color:$,stroke:Y,strokeWidth:X,opacity:V}=t,{width:q,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=s,re=r(()=>G(l),[l]),se=y||g;Ui(n,{variant:"xy",frameRef:o});const le=Xi({data:re,rawData:l,colorBy:se,colorScheme:m,legendInteraction:E,legendPosition:R,selection:N,linkedHover:F,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:H,chartType:"StackedAreaChart",chartId:W,showLegend:Z,userMargin:a,marginDefaults:s.marginDefaults,loading:I,loadingContent:z,emptyContent:D,width:q,height:U}),{flattenedData:ae,lineStyle:ce,pointStyle:ue,defaultTooltipContent:de}=lr({safeData:re,data:l,areaBy:g,lineDataAccessor:p,colorBy:se,colorScale:le.colorScale,color:$,stroke:Y,strokeWidth:X,opacity:V,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:A,xAccessor:h,yAccessor:f,xLabel:oe,yLabel:ie,xFormat:u,yFormat:d,groupField:g||y}),he=Yi({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:h,yAccessor:f}}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=l&&{data:ae}),{xAccessor:h,yAccessor:f,groupAccessor:g||void 0,curve:v,normalize:O,baseline:O?"zero":S,stackOrder:C,lineStyle:ce}),w&&ue&&{pointStyle:ue}),{size:[q,U],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le.margin,showAxes:s.showAxes,xLabel:oe,yLabel:ie,xFormat:u,yFormat:d,enableHover:K}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:Q}),le.legendBehaviorProps),ir({title:J,description:ee,summary:te,accessibleTable:ne,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===j?{tooltipContent:lo(),tooltipMode:"multi"}:sr({tooltip:j,defaultTooltipContent:de})),rr({linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),_&&_.length>0&&{annotations:_}),M&&{xExtent:M}),P&&{yExtent:P}),le.crosshairProps),L);return le.earlyReturn?le.earlyReturn:he?e(Ni,{componentName:"StackedAreaChart",message:he,width:q,height:U}):e(Hi,{componentName:"StackedAreaChart",width:q,height:U,children:e($o,Object.assign({ref:o},fe))})});function fr(e){const{colorBy:t,colorScale:n,color:o,pointRadius:i=5,radiusFn:s,fillOpacity:l=1,fallbackFill:a,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,u=r?Object.assign({},r):{};if(void 0===u.fillOpacity&&(u.fillOpacity=l),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=We(o,t,n)}}else u.fill=a?a(e):o||gi;return void 0===u.r&&(u.r=s?s(e):i),u},[t,n,o,i,s,l,a,c,p]),m=r(()=>Vi(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return r(()=>hi(m,null!=f?f:null,g),[m,f,g])}function gr(e){const{accessor:t,data:n,isPushMode:o}=e,s=i(null),[l,c]=d(0),u=a(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(s.current?(s.current[0]>i&&(s.current[0]=i,n=!0),i>s.current[1]&&(s.current[1]=i,n=!0)):(s.current=[i,i],n=!0))}n&&c(e=>e+1)},[o,t]),h=a(()=>{o&&(s.current=null,c(e=>e+1))},[o]),f=r(()=>{var e;if(o)return null!==(e=s.current)&&void 0!==e?e:void 0;if(!t||0===n.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,l=-1/0;for(const e of n){const t=i(e);if(null==t)continue;const n="number"==typeof t?t:Number(t);Number.isFinite(n)&&(r>n&&(r=n),n>l&&(l=n))}return Number.isFinite(r)&&Number.isFinite(l)?[r,l]:void 0},[n,t,o,l]);return{domain:f,trackPushed:u,reset:h}}function pr(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}hr.displayName="StackedAreaChart";const yr=f(function(t,n){const s=i(null),l=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:g="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:A=.8,tooltip:O,marginalGraphics:S,pointIdAccessor:C,annotations:j,regression:_,forecast:M,anomaly:P,xExtent:L,yExtent:N,frameProps:F={},selection:B,linkedHover:T,linkedBrush:H,onObservation:W,onClick:I,hoverHighlight:z,chartId:D,loading:E,loadingContent:R,emptyContent:$,legendInteraction:Y,legendPosition:X,color:V,stroke:q,strokeWidth:U,opacity:K}=t,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:se,yLabel:le}=l,ae=r(()=>G(c),[c]),ce=void 0===c,{domain:ue,trackPushed:de,reset:he}=gr({accessor:x,data:ae,isPushMode:ce}),fe=a(e=>{var t;de([e]),null===(t=s.current)||void 0===t||t.push(e)},[de]),ge=a(e=>{var t;de(e),null===(t=s.current)||void 0===t||t.pushMany(e)},[de]);Ui(n,{variant:"xy",frameRef:s,overrides:{push:fe,pushMany:ge,clear:()=>{var e;he(),null===(e=s.current)||void 0===e||e.clear()}},deps:[fe,ge,he]});const pe=Xi({data:ae,rawData:c,colorBy:v,colorScheme:b,legendInteraction:Y,legendPosition:X,selection:B,linkedHover:T,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:W,onClick:I,hoverHighlight:z,chartType:"Scatterplot",chartId:D,showLegend:te,userMargin:u,marginDefaults:l.marginDefaults,loading:E,loadingContent:R,emptyContent:$,width:Q,height:Z}),ye=di(H),me=ni({name:(null==ye?void 0:ye.name)||"__unused_brush__",xField:(null==ye?void 0:ye.xField)||("string"==typeof g?g:void 0),yField:(null==ye?void 0:ye.yField)||("string"==typeof p?p:void 0)}),ve=ye?"xyBrush"===me.brushInteraction.brush?"xy":"xBrush"===me.brushInteraction.brush?"x":"y":void 0,be=o.useRef(me.brushInteraction);be.current=me.brushInteraction;const xe=a(e=>{const t=be.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(pe.earlyReturn)return pe.earlyReturn;Ei("Scatterplot",ae,"xAccessor",g),Ei("Scatterplot",ae,"yAccessor",p);const ke=r(()=>x?null!=ue?ue:[0,1]:void 0,[x,ue]),we=r(()=>x?e=>ze(e,x,k,ke):void 0,[x,k,ke]),Ae=fr({colorBy:v,colorScale:pe.colorScale,color:V,pointRadius:w,fillOpacity:A,radiusFn:we,stroke:q,strokeWidth:U,opacity:K,effectiveSelectionHook:pe.effectiveSelectionHook,resolvedSelection:pe.resolvedSelection}),Oe=r(()=>Li([{label:se||Ci(g),accessor:g,role:"x",format:h},{label:le||Ci(p),accessor:p,role:"y",format:f},...v?[{label:Ci(v),accessor:v,role:"color"}]:[],...x?[{label:Ci(x),accessor:x,role:"size"}]:[]]),[g,p,se,le,v,x,h,f]),{effectiveData:Se,statisticalAnnotations:Ce}=nr({data:ae,xAccessor:g,yAccessor:p,forecast:M,anomaly:P}),je=r(()=>{const e=pr(_);return e||0!==Ce.length?[...e?[e]:[],...j||[],...Ce]:j},[_,j,Ce]),_e=Yi({componentName:"Scatterplot",data:c,accessors:{xAccessor:g,yAccessor:p}});if(_e)return e(Ni,{componentName:"Scatterplot",message:_e,width:Q,height:Z});const Me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:Se}),{xAccessor:g,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:Ae,colorScheme:b,size:[Q,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe.margin,showAxes:l.showAxes,xLabel:se,yLabel:le,xFormat:h,yFormat:f,enableHover:J,showGrid:ee}),pe.legendBehaviorProps),ir({title:ne,description:oe,summary:ie,accessibleTable:re,className:d,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:O,defaultTooltipContent:Oe})),rr({linkedHover:T,onObservation:W,onClick:I,hoverHighlight:z,customHoverBehavior:pe.customHoverBehavior,customClickBehavior:pe.customClickBehavior})),S&&{marginalGraphics:S}),C&&{pointIdAccessor:C}),je&&je.length>0&&{annotations:je}),L&&{xExtent:L}),N&&{yExtent:N}),ye&&{brush:{dimension:ve},onBrush:xe}),pe.crosshairProps),F);return e(Hi,{componentName:"Scatterplot",width:Q,height:Z,children:e($o,Object.assign({ref:s},Me))})});function mr(e,t){return je(1===t?.5:e/(t-1))}yr.displayName="Scatterplot";const vr=f(function(t,o){var s,l;const a=i(null);Ui(o,{variant:"xy",frameRef:a});const c=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:f,yFormat:g,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,regression:A,forecast:O,anomaly:S,xExtent:C,yExtent:j,frameProps:_={},selection:M,linkedHover:P,onObservation:L,onClick:N,hoverHighlight:F,chartId:B,loading:T,loadingContent:H,emptyContent:W,legendInteraction:I,stroke:z,strokeWidth:D,opacity:E}=t,{width:R,height:$,enableHover:Y,showGrid:G,title:X,description:V,summary:q,accessibleTable:U,xLabel:K,yLabel:Q}=c,Z=u||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let n=Z;if(m&&Z.length>0){const e="function"==typeof m?m:e=>e[m];n=[...Z].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const s of n){const n=e(s),l=t(s);null!=n&&null!=l&&isFinite(n)&&isFinite(l)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Z,m,p,y]);Ei("ConnectedScatterplot",J,"xAccessor",p),Ei("ConnectedScatterplot",J,"yAccessor",y);const te=Xi({data:J,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:M,linkedHover:P,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:N,hoverHighlight:F,chartType:"ConnectedScatterplot",chartId:B,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:T,loadingContent:H,emptyContent:W,width:R,height:$}),ne=null!==(l=null===(s=te.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==l?l:.5,oe=r(()=>(e,t)=>{var n,o,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const l=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.isActive,a=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=s[t],o=s[t+1],d=mr(t,u),h=!l||!a||a(null!==(i=n.datum)&&void 0!==i?i:n)||a(null!==(r=o.datum)&&void 0!==r?r:o),f=l?h?1:ne:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*f,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=f,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,ne]),ie=r(()=>[oe],[oe]),re=r(()=>(t,o,i)=>{var r,s;const l=t.filter(e=>"point"===e.type);if(2>l.length)return null;const a=l.length,c=100>a,u=[];for(let t=0;a-1>t;t++){const n=l[t],o=l[t+1],i=mr(t,a),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,f=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*f},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:f},"seg-"+t))}return e(n,{children:u})},[b]),se=r(()=>[re],[re]),le=r(()=>e=>{var t,n;const o=ee.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?mr(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),ae=fr({colorScale:void 0,baseStyleExtras:le,stroke:z,strokeWidth:D,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),ue=r(()=>Li([{label:K||Ci(p),accessor:p,role:"x",format:f},{label:Q||Ci(y),accessor:y,role:"y",format:g},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,K,Q,m,ce,f,g]),de=Yi({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:fe}=nr({data:J,xAccessor:p,yAccessor:y,forecast:O,anomaly:S}),ge=pr(A),pe=ge||fe.length>0?[...ge?[ge]:[],...w||[],...fe]:w,ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=u&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:ae,size:[R,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:K,yLabel:Q,xFormat:f,yFormat:g,enableHover:Y,showGrid:G}),ir({title:X,description:V,summary:q,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:x,defaultTooltipContent:ue})),rr({linkedHover:P,onObservation:L,onClick:N,hoverHighlight:F,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ie,svgPreRenderers:se}),pe&&pe.length>0&&{annotations:pe}),C&&{xExtent:C}),j&&{yExtent:j}),te.crosshairProps),_);return te.earlyReturn?te.earlyReturn:de?e(Ni,{componentName:"ConnectedScatterplot",message:de,width:R,height:$}):e(Hi,{componentName:"ConnectedScatterplot",width:R,height:$,children:e($o,Object.assign({ref:a},ye))})});vr.displayName="ConnectedScatterplot";const br=f(function(t,n){const o=i(null),s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:g="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:O,annotations:S,regression:C,xExtent:j,yExtent:_,frameProps:M={},selection:P,linkedHover:L,linkedBrush:N,onObservation:F,onClick:B,hoverHighlight:T,chartId:H,loading:W,loadingContent:I,emptyContent:z,legendInteraction:D,legendPosition:E,color:R,stroke:$,strokeWidth:Y,opacity:X}=t,{width:V,height:q,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=s,ie=r(()=>G(l),[l]),re=void 0===l,se=Xi({data:ie,rawData:l,colorBy:m,colorScheme:v,legendInteraction:D,legendPosition:E,selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:F,onClick:B,hoverHighlight:T,chartType:"BubbleChart",chartId:H,showLegend:Q,userMargin:c,marginDefaults:s.marginDefaults,loading:W,loadingContent:I,emptyContent:z,width:V,height:q}),{domain:le,trackPushed:ae,reset:ce}=gr({accessor:p,data:ie,isPushMode:re}),ue=a(e=>{var t;ae([e]),null===(t=o.current)||void 0===t||t.push(e)},[ae]),de=a(e=>{var t;ae(e),null===(t=o.current)||void 0===t||t.pushMany(e)},[ae]);Ui(n,{variant:"xy",frameRef:o,overrides:{push:ue,pushMany:de,clear:()=>{var e;ce(),null===(e=o.current)||void 0===e||e.clear()}},deps:[ue,de,ce]});const he=di(N);ni({name:(null==he?void 0:he.name)||"__unused_brush__",xField:(null==he?void 0:he.xField)||("string"==typeof f?f:void 0),yField:(null==he?void 0:he.yField)||("string"==typeof g?g:void 0)});const fe=r(()=>({stroke:k,strokeWidth:x}),[k,x]),ge=r(()=>null!=le?le:[0,1],[le]),pe=a(e=>ze(e,p,y,ge),[p,y,ge]),ye=fr({colorBy:m,colorScale:se.colorScale,color:R,fillOpacity:b,radiusFn:pe,baseStyleExtras:fe,stroke:$,strokeWidth:Y,opacity:X,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),me=r(()=>Li([{label:ne||Ci(f),accessor:f,role:"x",format:d},{label:oe||Ci(g),accessor:g,role:"y",format:h},{label:Ci(p),accessor:p,role:"size"},...m?[{label:Ci(m),accessor:m,role:"color"}]:[]]),[f,g,ne,oe,p,m,d,h]),ve=Yi({componentName:"BubbleChart",data:l,accessors:{xAccessor:f,yAccessor:g},requiredProps:{sizeBy:p}});if(ve)return e(Ni,{componentName:"BubbleChart",message:ve,width:V,height:q});const be=pr(C),xe=be?[be,...S||[]]:S,ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=l&&{data:ie}),{xAccessor:f,yAccessor:g,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:ye,colorScheme:v,size:[V,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:ne,yLabel:oe,xFormat:d,yFormat:h,enableHover:U,showGrid:K}),se.legendBehaviorProps),ir({title:Z,description:J,summary:ee,accessibleTable:te,className:u,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:w,defaultTooltipContent:me})),rr({linkedHover:L,onObservation:F,onClick:B,hoverHighlight:T,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),A&&{marginalGraphics:A}),O&&{pointIdAccessor:O}),xe&&xe.length>0&&{annotations:xe}),j&&{xExtent:j}),_&&{yExtent:_}),se.crosshairProps),M);return se.earlyReturn?se.earlyReturn:e(Hi,{componentName:"BubbleChart",width:V,height:q,children:e($o,Object.assign({ref:o},ke))})});br.displayName="BubbleChart";const xr=f(function(t,n){var o;const s=i(null);Ui(n,{variant:"xy",frameRef:s});const l=Oi(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:f="value",xFormat:g,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:k,xExtent:w,yExtent:A,frameProps:S={},selection:C,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:P,chartId:L,loading:N,loadingContent:F,emptyContent:B,showLegend:T,legendPosition:H,legendInteraction:W}=t,{width:I,height:z,enableHover:D,title:E,description:R,summary:$,accessibleTable:Y,xLabel:X,yLabel:V}=l,q=Di(N,I,z,F),U=q?null:zi(a,I,z,B),K=r(()=>G(a),[a]),Q=function(){var e;const t=fi();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Z=null!==(o=null!=y?y:Q)&&void 0!==o?o:"blues",J=null!=T&&T,ee=null!=H?H:"right",{margin:te}=ki({data:K,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:ee,userMargin:c,defaults:l.marginDefaults}),{customHoverBehavior:ne,customClickBehavior:oe,crosshairSourceId:ie}=bi({selection:C,linkedHover:j,fallbackFields:[],onObservation:_,onClick:M,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});Gi(C);const re=xi(j,ie);wi(W,void 0,[]);const se=r(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),le=r(()=>{const e=K.map(se);return[Math.min(...e),Math.max(...e)]},[K,se]),ae=r(()=>"custom"===Z&&m?m:O({blues:ke,reds:we,greens:Ae,viridis:je,oranges:Oe,purples:Se,greys:Ce,plasma:_e,inferno:Me,magma:Pe,cividis:Le,turbo:Ne}[Z]||ke).domain(le),[Z,m,le]),ce=r(()=>Li([{label:X||Ci(d),accessor:d,role:"x",format:g},{label:V||Ci(h),accessor:h,role:"y",format:p},{label:Ci(f),accessor:f,role:"value",format:b}]),[d,h,X,V,f,g,p,b]),ue=Yi({componentName:"Heatmap",data:a,accessors:{xAccessor:d,yAccessor:h,valueAccessor:f}}),de=r(()=>{if(J)return{gradient:{colorFn:e=>ae(e),domain:le,label:"string"==typeof f?f:"value",format:b}}},[J,ae,le,f,b]),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=a&&{data:K}),{xAccessor:d,yAccessor:h,valueAccessor:f,colorScheme:"custom"!==Z?Z:void 0,showValues:v,heatmapValueFormat:b,size:[I,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,showAxes:l.showAxes,xLabel:X,yLabel:V,xFormat:g,yFormat:p,enableHover:D}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),de&&{legend:de,legendPosition:ee}),ir({title:E,description:R,summary:$,accessibleTable:Y,className:u,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:x,defaultTooltipContent:ce})),rr({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:P,customHoverBehavior:ne,customClickBehavior:oe})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),re),S);return q||U||(ue?e(Ni,{componentName:"Heatmap",message:ue,width:I,height:z}):e(Hi,{componentName:"Heatmap",width:I,height:z,children:e($o,Object.assign({ref:s},he))}))});xr.displayName="Heatmap";const kr="__splomIdx",wr={top:4,bottom:4,left:4,right:4};function Ar({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),l=n-wr.left-wr.right,a=n-wr.top-wr.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),n=b().extent([[0,0],[l,a]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,s],[l,a]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(l),i.y.invert(a)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[l,a,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${wr.left},${wr.top})`})})}function Or({data:n,xField:o,yField:r,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:f,unselectedOpacity:g,mode:p,onPointHover:y}){const m=i(null),v=Jo({name:h,clientId:`splom-${o}-${r}`}),b=ni({name:h,xField:o,yField:r}),x=Jo({name:f,clientId:"splom-hover-source"}),k=x.selectPoints,w=a(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=a(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[kr];void 0!==n&&(k({[kr]:[n]}),null==y||y(t,e.x+wr.left,e.y+wr.top))},[k,y]),O=a(e=>{const t={opacity:c,r:l};return t.fill=u?We(e,u,d):gi,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*l,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=g),t},[u,d,c,l,p,v.isActive,v.predicate,x.isActive,x.predicate,g]);return t("div",{style:{position:"relative",width:s,height:s},children:[e($o,{ref:m,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:r,pointStyle:O,margin:wr,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(Ar,{frameRef:m,cellSize:s,xField:o,yField:r,onBrush:w})]})}function Sr({data:n,field:o,label:i,cellSize:s,bins:l,colorBy:a,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const f=Jo({name:u,clientId:"splom-diag-"+o}),g=Jo({name:d,clientId:`splom-diag-${o}-hover`}),p="hover"===h?g:f,y=p.isActive,m=p.predicate,v=r(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/l||1,r="string"==typeof a?a:null,c=r?[...new Set(n.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(l).fill(0),h=Array(l).fill(0),f=Array.from({length:l},()=>Array(c.length).fill(0)),g=Array.from({length:l},()=>Array(c.length).fill(0));for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const s=Math.min(Math.floor((n-t)/i),l-1);if(d[s]++,y&&!m(e)||h[s]++,r){const t=u.get(e[r]+"");void 0!==t&&(f[s][t]++,y&&!m(e)||g[s][t]++)}}const p=Math.max(...d,1),v=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(s-24),r={x:t/l*s,w:s/l-1,h:i,y0:n,category:c[o]};return n+=i,r})}),b=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(s-24),r={x:t/l*s,w:s/l-1,h:i,y0:n,category:c[o]};return n+=i,r})});return{bars:d.map((e,t)=>({x:t/l*s,w:s/l-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/l*s,w:s/l-1,h:e/p*(s-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:p,categories:c}},[n,o,l,s,y,m,a]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):gi,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:gi,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):gi,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:gi,opacity:.7},"sel-"+n)))]})}function Cr({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function jr(n){const{data:i,fields:s,fieldLabels:l={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:f=4,pointRadius:g=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:O,className:S,onObservation:C,chartId:j}=n,_="splom",M="splom-hover",P=b?"hover":v?"brush":"hover",L=Ko(e=>e.clearSelection),[N,F]=d(null),B=a(()=>{L(M),F(null)},[L,M]),T=r(()=>(i||[]).map((e,t)=>void 0!==e[kr]?e:Object.assign(Object.assign({},e),{[kr]:t})),[i]),H=vi(T,c,u),W=void 0!==A?A:!!c,I=r(()=>{if(!W||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:H?H(e+""):gi})):null},[W,c,T,H]),z=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:f+"px",width:"fit-content"}),[s,h,f,40]);return t("div",{className:S,style:{position:"relative"},children:[I&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:I.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:z,onMouseLeave:"hover"===P?B:void 0,children:[s.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:l[n]||n}),s.map((t,o)=>i===o?"label"===y?e(Cr,{label:l[n]||n,cellSize:h},"diag-"+n):e(Sr,{data:T,field:n,label:l[n]||n,cellSize:h,bins:m,colorBy:c,colorScale:H,brushSelectionName:_,hoverSelectionName:M,unselectedOpacity:x,mode:P},"diag-"+n):e(Or,{data:T,xField:t,yField:n,fieldLabels:l,cellSize:h,pointRadius:g,pointOpacity:p,colorBy:c,colorScale:H,brushSelectionName:_,hoverSelectionName:M,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(F({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):(F(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:l[t]||t},"col-label-"+t))]}),N&&"hover"===P&&(()=>{const n=N.datum,o=l[N.xField]||N.xField,i=l[N.yField]||N.yField,r=c?"function"==typeof c?c(n):n[c]:null,s=O?"function"==typeof O?O(n):n[O]:"Row "+n[kr];return t("div",{style:{position:"absolute",left:40+N.colIndex*(h+f)+N.px,top:N.rowIndex*(h+f)+N.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[o,": ",null!=n[N.xField]?Number(n[N.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[N.yField]?Number(n[N.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function _r(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(ui,{selections:i,children:e(jr,Object.assign({},t))})}function Mr({width:t,height:n,margin:o,scales:r,brushDirection:l,extent:a,onBrush:c}){const u=i(null),d=i(null),h=i(!1),f=t+o.left+o.right,g=n+o.top+o.bottom;return s(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),o="x"===l?m().extent([[0,0],[t,n]]):v().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===l?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,l,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===l?r.x:r.y;if(h.current=!0,a){const n=[t(a[0]),t(a[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[a,r,l]),e("svg",{ref:u,width:f,height:g,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Pr(n){var o,l;const{data:c,width:u=600,height:h=400,margin:f,className:g,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:O,lineDataAccessor:S="coordinates",colorBy:C,colorScheme:j,curve:_="linear",lineWidth:M=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:N=!1,pointRadius:F=3,enableHover:B=!0,showGrid:T=!1,showLegend:H,legendPosition:W,tooltip:I,minimap:z={},renderBefore:D=!1,onBrush:E,brushExtent:R,yExtent:$,frameProps:Y={},loading:X,loadingContent:V,emptyContent:q}=n,U=Di(X,u,h,V),K=U?null:zi(c,u,h,q),Q=r(()=>G(c),[c]),[Z,J]=d(null),ee=null!=R?R:Z,te=a(e=>{R||J(e),null==E||E(e)},[R,E]),ne=i(null),[oe,ie]=d(null);s(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=ne.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?ie(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const re=void 0!==(null===(o=Q[0])||void 0===o?void 0:o[S]),se=r(()=>{if(re)return Q;if(O){const e=Q.reduce((e,t)=>{const n="function"==typeof O?O(t):t[O];if(!e[n]){const t={[S]:[]};"string"==typeof O&&(t[O]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:Q}]},[Q,O,S,re]),le=r(()=>re||O?se.flatMap(e=>{const t=e[S]||[];return O&&"string"==typeof O?t.map(t=>Object.assign(Object.assign({},t),{[O]:e[O]})):t}):Q,[se,S,re,O,Q]),ae=vi(Q,C,j),ce=qi({lineWidth:M,colorBy:C,colorScale:ae,fillArea:P,areaOpacity:L}),ue=r(()=>{if(z.lineStyle)return z.lineStyle},[z.lineStyle]),de=qi({lineWidth:1,colorBy:C,colorScale:ae}),he=null!=ue?ue:de,fe=r(()=>{if(N)return e=>{const t={r:F,fillOpacity:1};return t.fill=C?We(e.parentLine||e,C,ae):gi,t}},[N,F,C,ae]),{legend:ge,margin:pe,legendPosition:ye}=ki({data:se,colorBy:C,colorScale:ae,showLegend:H,legendPosition:W,userMargin:f}),me=z.height||60,ve=r(()=>{var e,t,n,o,i,r,s,l;return{top:null!==(t=null===(e=z.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=z.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=z.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:pe.left,right:null!==(l=null===(s=z.margin)||void 0===s?void 0:s.right)&&void 0!==l?l:pe.right}},[z.margin,pe]),be=z.brushDirection||"x",xe=Yi({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(xe)return e(Ni,{componentName:"MinimapChart",message:xe,width:u,height:h});const ke=P?"area":"line",we=r(()=>Li([{label:v||Ci(w),accessor:w,role:"x",format:x},{label:b||Ci(A),accessor:A,role:"y",format:k}]),[w,A,v,b,x,k]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ke,data:le,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:_,lineStyle:ce},N&&{pointStyle:fe}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:B,showGrid:T}),ge&&{legend:ge,legendPosition:ye}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===I?()=>null:ao(I)||we}),ee&&{xExtent:ee}),$&&{yExtent:$}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),Y),Oe=Object.assign({chartType:ke,data:le,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:_,lineStyle:he,size:[u,me+ve.top+ve.bottom],margin:ve,showAxes:null!==(l=z.showAxes)&&void 0!==l&&l,background:z.background,enableHover:!1},$&&{yExtent:$}),Se=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e($o,Object.assign({ref:ne},Oe)),e(Mr,{width:u-ve.left-ve.right,height:me,margin:ve,scales:oe,brushDirection:be,extent:ee,onBrush:te})]},"minimap"),Ce=e("div",{style:{overflow:"hidden"},children:e($o,Object.assign({},Ae))},"main");return U||K||e(Hi,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(g?" "+g:""),children:[D?Se:Ce,D?Ce:Se]})})}_r.displayName="ScatterplotMatrix",Pr.displayName="MinimapChart";const Lr=f(function(o,s){const l=i(null);Ui(s,{variant:"xy",frameRef:l});const a=Oi(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:g="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:O,sizeRange:S=[3,15],pointRadius:C=5,pointOpacity:j=.8,tooltip:_,pointIdAccessor:M,annotations:P,frameProps:L={},selection:N,linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,chartId:W,loading:I,loadingContent:z,emptyContent:D,legendInteraction:E,legendPosition:R,color:$,stroke:Y,strokeWidth:X,opacity:V}=o,{width:q,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=a,re=r(()=>G(c),[c]),se=Xi({data:re,rawData:c,colorBy:w,colorScheme:A,legendInteraction:E,legendPosition:R,selection:N,linkedHover:F,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:H,chartType:"QuadrantChart",chartId:W,showLegend:Z,userMargin:u,marginDefaults:a.marginDefaults,loading:I,loadingContent:z,emptyContent:D,width:q,height:U});Ei("QuadrantChart",re,"xAccessor",g),Ei("QuadrantChart",re,"yAccessor",p);const le=r(()=>{if(!re.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of re){const l=e(s),a=t(s);isFinite(l)&&(n>l&&(n=l),l>o&&(o=l)),isFinite(a)&&(i>a&&(i=a),a>r&&(r=a))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),n===1/0)return;const s=.1*(o-n)||1,l=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-l,r+l]}},[re,g,p,y,m]),ae=r(()=>{if(!O||0===re.length)return;const e=re.map(e=>"function"==typeof O?O(e):e[O]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[re,O]),ce=r(()=>"function"==typeof g?g:e=>+e[g],[g]),ue=r(()=>"function"==typeof p?p:e=>+e[p],[p]),de=r(()=>e=>{const t=ce(e),n=ue(e),o=null!=y?t>=y:void 0,i=null!=m?n>=m:void 0;return void 0===i||void 0===o?$||gi:i&&o?v.topRight.color:i&&!o?v.topLeft.color:!i&&o?v.bottomRight.color:v.bottomLeft.color},[ce,ue,y,m,v,$]),he=r(()=>O?e=>ze(e,O,S,ae):void 0,[O,S,ae]),fe=fr({colorBy:w,colorScale:se.colorScale,color:$,pointRadius:C,fillOpacity:j,radiusFn:he,fallbackFill:de,stroke:Y,strokeWidth:X,opacity:V,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ge=r(()=>{if(!re.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof O&&e.add(O);const t=re[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[re,g,p,w,O]),pe=r(()=>Li([...ge?[{label:ge,accessor:ge,role:"title"}]:[],{label:oe||Ci(g),accessor:g,role:"x",format:h},{label:ie||Ci(p),accessor:p,role:"y",format:f},...w?[{label:Ci(w),accessor:w,role:"color"}]:[],...O?[{label:Ci(O),accessor:O,role:"size"}]:[]]),[ge,g,p,oe,ie,w,O,h,f]),ye=Yi({componentName:"QuadrantChart",data:c,accessors:{xAccessor:g,yAccessor:p}}),me=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=i.width,l=i.height,a=null!=y?o.x(y):s/2,c=null!=m?o.y(m):l/2;if(null!=y&&!isFinite(a))return;if(null!=m&&!isFinite(c))return;const u=Math.max(0,Math.min(s,a)),d=Math.max(0,Math.min(l,c)),h=[{config:v.topLeft,x:0,y:0,w:u,h:d},{config:v.topRight,x:u,y:0,w:s-u,h:d},{config:v.bottomLeft,x:0,y:d,w:u,h:l-d},{config:v.bottomRight,x:u,y:d,w:s-u,h:l-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,l),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[y,m,v,b]),ve=r(()=>x?[...me,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,s=null!=y?n.x(y):i/2,l=null!=m?n.y(m):r/2;(null==y||isFinite(s))&&(null==m||isFinite(l))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=v.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(v.topLeft.label,8,8),e.fillStyle=v.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(v.topRight.label,i-8,8),e.fillStyle=v.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(v.bottomLeft.label,8,r-8),e.fillStyle=v.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(v.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:me,[me,x,k,v,y,m]),be=r(()=>{const e=L.canvasPreRenderers||[];return[...ve,...e]},[ve,L.canvasPreRenderers]),xe=r(()=>{var o;const i={stroke:b.stroke||"#999",strokeWidth:null!==(o=b.strokeWidth)&&void 0!==o?o:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(o,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const l=s.width,a=s.height,c=null!=y?r.x(y):l/2,u=null!=m?r.y(m):a/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(u))return null;const d=Math.max(0,Math.min(l,c)),h=Math.max(0,Math.min(a,u));return t(n,{children:[[{config:v.topLeft,x:0,y:0,w:d,h:h},{config:v.topRight,x:d,y:0,w:l-d,h:h},{config:v.bottomLeft,x:0,y:h,w:d,h:a-h},{config:v.bottomRight,x:d,y:h,w:l-d,h:a-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:a,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:l,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(n,{children:[e("text",{x:8,y:8+k,fill:v.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:v.topLeft.label}),e("text",{x:l-8,y:8+k,fill:v.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:v.topRight.label}),e("text",{x:8,y:a-8,fill:v.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:v.bottomLeft.label}),e("text",{x:l-8,y:a-8,fill:v.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:v.bottomRight.label})]})]})}]},[y,m,v,b,x,k]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:re}),{xAccessor:g,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:O||void 0,sizeRange:S,pointStyle:fe,colorScheme:A,size:[q,U],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:se.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ie,xFormat:h,yFormat:f,enableHover:K,showGrid:Q}),le&&{xExtent:le.xExtent,yExtent:le.yExtent}),se.legendBehaviorProps),J&&{title:J}),ee&&{description:ee}),te&&{summary:te}),void 0!==ne&&{accessibleTable:ne}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:!1===_?()=>null:!0===_||void 0===_?pe:ao(_)||pe}),(F||B||T||H)&&{customHoverBehavior:se.customHoverBehavior}),(B||T||F)&&{customClickBehavior:se.customClickBehavior}),M&&{pointIdAccessor:M}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:be}),se.crosshairProps),L),be.length>0&&{canvasPreRenderers:be}),{svgPreRenderers:xe});return se.earlyReturn?se.earlyReturn:ye?e(Ni,{componentName:"QuadrantChart",message:ye,width:q,height:U}):e(Hi,{componentName:"QuadrantChart",width:q,height:U,children:e($o,Object.assign({ref:l},ke))})});Lr.displayName="QuadrantChart";const Nr="__ma_unitized",Fr="__ma_series";function Br(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Tr(e,t){return t[0]+e*(t[1]-t[0])}const Hr=f(function(t,n){var s;const l=i(null),c=i([]),u=i(t.series);u.current=t.series,p(n,()=>{const e=()=>{var e;return(null!==(e=u.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!l.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=r&&isFinite(r)&&l.current.push(Object.assign(Object.assign({},o),{[Nr]:Br(r,i),[Fr]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!l.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||c.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&o.push(Object.assign(Object.assign({},e),{[Nr]:Br(s,r),[Fr]:i.label||"Series "+(t+1)}))}l.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const d=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:f,className:g,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:k=2,tooltip:w,annotations:A,frameProps:O={},selection:S,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:M,chartId:P,loading:L,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:T,stroke:H,strokeWidth:W,opacity:I}=t,{width:z,height:D,enableHover:E,showGrid:R,showLegend:$=!0,title:Y,description:X,summary:V,accessibleTable:q,xLabel:U}=d,K=r(()=>G(h),[h]),Q=r(()=>G(v),[v]),Z=Q,J=2===Q.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||J||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Q.length}. Rendering as a standard multi-line chart.`);const ee=Di(L,z,D,N),te=ee?null:zi(h,z,D,F),ne=mi(),oe=r(()=>{let e;if(Array.isArray(b))e=b;else if(ne&&ne.length>0)e=ne;else{const t=Fe[b];e=Array.isArray(t)?t:Be}return Z.map((t,n)=>t.color||e[n%e.length])},[Z,b,ne]),ie=r(()=>Q.map((e,t)=>e.label||"Series "+(t+1)),[Q]),{unitizedData:re,extents:se}=r(()=>{if(0===K.length){const e=Q.map(e=>e.extent||null).filter(Boolean);return e.length===Q.length&&(c.current=e),{unitizedData:[],extents:e.length===Q.length?e:[]}}const e=Q.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(K,e.yAccessor));if(c.current=e,!J){const t=[];for(const e of K)for(let n=0;Q.length>n;n++){const o=Q[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Nr]:i,[Fr]:ie[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of K)for(let o=0;2>o;o++){const i=Q[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Nr]:Br(r,e[o]),[Fr]:ie[o]}))}return{unitizedData:t,extents:e}},[K,Q,J,ie]),le=r(()=>{if(J&&se.length>=2)return[{orient:"left",label:ie[0],tickFormat:Q[0].format||(e=>{const t=Tr(e,se[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ie[1],tickFormat:Q[1].format||(e=>{const t=Tr(e,se[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[J,se,Q,ie]),ae=Xi({data:r(()=>re.length>0?re:ie.map(e=>({[Fr]:e})),[re,ie]),rawData:h,colorBy:Fr,colorScheme:oe,legendInteraction:B,legendPosition:T,selection:S,linkedHover:C,fallbackFields:[Fr],unwrapData:!1,onObservation:j,onClick:_,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:P,showLegend:$,userMargin:f,marginDefaults:J?Object.assign(Object.assign({},d.marginDefaults),{left:70,right:70}):d.marginDefaults,loading:L,loadingContent:N,emptyContent:F,width:z,height:D});if(ae.earlyReturn)return ae.earlyReturn;const ce=r(()=>{const e=new Map;return ie.forEach((t,n)=>e.set(t,oe[n])),e},[ie,oe]),ue=qi({lineWidth:k,resolveStroke:a(e=>ce.get(e[Fr])||oe[0],[ce,oe]),stroke:H,strokeWidth:W,opacity:I,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),de=r(()=>{if(!1===w)return()=>null;return ao(w)||(e=>{var t;const n=e.data||e,i=n[Fr],r=ie.indexOf(i),s=n[Nr],l=J&&r>=0&&se[r]?Tr(s,se[r]):s,a=r>=0&&(null===(t=Q[r])||void 0===t?void 0:t.format)?Q[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(n):n[m];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:oe[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),o.createElement("div",null,`${i}: ${a(l)}`))})},[w,ie,oe,se,J,Q,m]),he=Yi({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),fe=J?[0,1]:void 0,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:re}),{xAccessor:m,yAccessor:Nr,groupAccessor:Fr,lineStyle:ue,colorScheme:oe,size:[z,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:d.showAxes}),le&&{axes:le}),{xLabel:U}),J?{}:{yLabel:ie[0]}),{xFormat:y}),J&&fe&&{yExtent:fe}),{enableHover:E}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:R,curve:x}),ae.legendBehaviorProps),Y&&{title:Y}),X&&{description:X}),V&&{summary:V}),void 0!==q&&{accessibleTable:q}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:de}),A&&{annotations:A}),(C||j||_||M)&&{customHoverBehavior:ae.customHoverBehavior}),(j||_||C)&&{customClickBehavior:ae.customClickBehavior}),ae.crosshairProps),O);return ee||te||(he?e(Ni,{componentName:"MultiAxisLineChart",message:he,width:z,height:D}):e(Hi,{componentName:"MultiAxisLineChart",width:z,height:D,children:e($o,Object.assign({ref:l},ge))}))});function Wr(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}Hr.displayName="MultiAxisLineChart";const Ir=f(function(t,n){const o=i(null);Ui(n,{variant:"xy",frameRef:o});const s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:f="high",lowAccessor:g="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,onClick:C,chartId:j,loading:_,loadingContent:M,emptyContent:P}=t,{width:L,height:N,enableHover:F,showGrid:B,title:T,description:H,summary:W,accessibleTable:I,xLabel:z,yLabel:D}=s,E=Di(_,L,N,M),R=E?null:zi(l,L,N,P),$=r(()=>G(l),[l]),Y=null==p||null==y;Ei("CandlestickChart",$,"xAccessor",h),Ei("CandlestickChart",$,"highAccessor",f),Ei("CandlestickChart",$,"lowAccessor",g),Y||(Ei("CandlestickChart",$,"openAccessor",p),Ei("CandlestickChart",$,"closeAccessor",y));const{customHoverBehavior:X,customClickBehavior:V,crosshairSourceId:q}=bi({selection:A,linkedHover:O,onObservation:S,onClick:C,chartType:"CandlestickChart",chartId:j}),U=xi(O,q),K=r(()=>{const e=s.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?n:Object.assign(Object.assign({},n),Wr(a))},[a,s.marginDefaults,t.mode]),Q=r(()=>{const e=[{label:z||Ci(h),accessor:h,role:"x",format:u}];return Y?(e.push({label:"High",accessor:f,role:"y",format:d}),e.push({label:"Low",accessor:g,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:f,format:d}),e.push({label:"Low",accessor:g,format:d}),e.push({label:"Close",accessor:y,format:d})),Li(e)},[h,z,u,d,f,g,p,y,Y]),Z=Yi({componentName:"CandlestickChart",data:l,accessors:Object.assign({xAccessor:h,highAccessor:f,lowAccessor:g},!Y&&{openAccessor:p,closeAccessor:y})}),J=Math.max(2,Math.min(12,Math.round(L/40))),ee=L>200?.1:.02,te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=l&&{data:$}),{xAccessor:h,yAccessor:f,highAccessor:f,lowAccessor:g}),!Y&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:J,extentPadding:ee,size:[L,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K,showAxes:s.showAxes,xLabel:z,yLabel:D,xFormat:u,yFormat:d,enableHover:F,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ir({title:T,description:H,summary:W,accessibleTable:I,className:c,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:v,defaultTooltipContent:Q})),rr({linkedHover:O,onObservation:S,onClick:C,customHoverBehavior:X,customClickBehavior:V})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),U),w);return E||R||(Z?e(Ni,{componentName:"CandlestickChart",message:Z,width:L,height:N}):e(Hi,{componentName:"CandlestickChart",width:L,height:N,children:e($o,Object.assign({ref:o},te))}))});Ir.displayName="CandlestickChart";const zr=f(function(t,n){const{data:o,layout:s,layoutConfig:l,xExtent:a,yExtent:c,showAxes:u=!1,margin:d,className:h,annotations:f,onObservation:g,onClick:p,selection:y,linkedHover:m,chartId:v,loading:b,loadingContent:x,emptyContent:k,colorScheme:w,frameProps:A={}}=t,{frameRef:O,resolved:S,safeData:C,setup:j,earlyReturn:_}=function(e){var t;const n=function(e){const t=i(null);return Ui(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Oi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>Wr(e.margin),[e.margin])}}(e),{resolved:o,normalizedMargin:s}=n,l=Xi({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:l.data,setup:l,earlyReturn:l.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorScheme:w,selection:y,linkedHover:m,onObservation:g,onClick:p,chartId:v,loading:b,loadingContent:x,emptyContent:k,margin:d,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel});if(_)return _;const{width:M,height:P,enableHover:L,showGrid:N,title:F,description:B,summary:T,accessibleTable:H,xLabel:W,yLabel:I}=S,z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:C}),{customLayout:s,layoutConfig:l,xExtent:a,yExtent:c,colorScheme:w,size:[M,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:j.margin,showAxes:u,xLabel:W,yLabel:I,enableHover:L,showGrid:N}),j.legendBehaviorProps),ir({title:F,description:B,summary:T,accessibleTable:H,className:h,animate:t.animate,axisExtent:t.axisExtent})),null!=t.tooltip&&{tooltipContent:t.tooltip}),rr({linkedHover:m,onObservation:g,onClick:p,hoverHighlight:!1,customHoverBehavior:j.customHoverBehavior,customClickBehavior:j.customClickBehavior})),f&&f.length>0&&{annotations:f}),j.crosshairProps),A);return e(Hi,{componentName:"XYCustomChart",width:M,height:P,children:e($o,Object.assign({ref:O},z))})});zr.displayName="XYCustomChart";export{cr as AreaChart,br as BubbleChart,Ir as CandlestickChart,vr as ConnectedScatterplot,dr as DifferenceChart,xr as Heatmap,or as LineChart,Pr as MinimapChart,Hr as MultiAxisLineChart,Lr as QuadrantChart,yr as Scatterplot,_r as ScatterplotMatrix,hr as StackedAreaChart,$o as StreamXYFrame,zr as XYCustomChart};
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as l,useCallback as a,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as f,useId as g,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleSequential as O}from"d3-scale";import{quadtree as S}from"d3-quadtree";import{curveNatural as C,curveBasis as j,curveStepAfter as _,curveStepBefore as M,curveStep as P,curveCatmullRom as L,curveCardinal as N,curveMonotoneY as F,curveMonotoneX as B,line as T,area as H,curveLinear as W}from"d3-shape";import{bin as I}from"d3-array";import{packEnclose as D}from"d3-hierarchy";import z from"regression";function E(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function R(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function $({width:t,height:n,totalWidth:o,totalHeight:l,margin:a,dimension:c,scales:u,onBrush:d,binSize:h,snap:f,binBoundaries:g,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const O=i(u);O.current=u;const S=r(()=>g?[...g].sort((e,t)=>e-t):void 0,[g]),C=i(S);C.current=S;const j=i(!1),_=i(null);return s(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),o="x"===c?m():"y"===c?v():b();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(j.current)return;const r=O.current;if(!r)return;if(!i.selection)return _.current=null,void A.current(null);let s,l;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],l=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;s=[r.x.invert(0),r.x.invert(t)],l=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;s=[r.x.invert(e),r.x.invert(n)],l=[r.y.invert(o),r.y.invert(t)]}if("bin"===f&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[E(e[0],t),R(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const n=r.x(s[0]),l=r.x(s[1]);if(j.current=!0,"x"===c)e.call(o.move,[n,l]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[l,t[1][1]]])}j.current=!1}const a={x:s,y:l};_.current=a,A.current(a)}),e.call(o),w.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),w.current=null}},[t,n,c,f,h,p]),s(()=>{if(!(x&&u&&w.current&&_.current))return;if(!k.current)return;if("y"===c)return;const e=_.current,t=u.x.domain()[0],n=y(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,_.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===f){const e=C.current;e&&e.length>0?o=R(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,_.current=null,void A.current(null);i=!0}const r=u.x(o),s=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[r,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[r,t],[s,o]])}if(j.current=!1,i){const t={x:[o,e.x[1]],y:e.y};_.current=t,A.current(t)}},[u,x,c,f,h]),e("svg",{ref:k,width:o,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const Y=Object.freeze([]);function G(e){if(!e)return Y;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class X{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=G(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=G(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function V(t){let n=null;const o=()=>(n||(n=u(null)),n),s=q(t);return[function({children:n,initialState:s}){const l=i(s),a=r(()=>q(t,l.current),[]),c=o();return e(c.Provider,{value:a,children:n})},e=>{var t;const n=o(),r=null!==(t=l(n))&&void 0!==t?t:s,u=i(e);u.current=e;const d=a(()=>u.current(r.getState()),[r]),h=a(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function q(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function U(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function K(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:Q})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const Q=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Z={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},J={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ee={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Q,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function te(e,t){if("light"===t)return Z;if("dark"===t)return J;if("high-contrast"===t)return ee;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?J:Z;return K(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return K(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[ne,oe]=V(e=>({theme:Z,setTheme(t){e(e=>({theme:te(e.theme,t)}))}}));class ie{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class re{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function se(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),l=n(s);if(null==e||null==l||Number.isNaN(e)||Number.isNaN(l))continue;const a=Math.floor(e/o)*o;let c=r.get(a);if(c||(c={start:a,end:a+o,total:0,categories:new Map},r.set(a,c)),c.total+=l,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+l)}}return r}function le(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const l=Array(s.length),a=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];l[e]=[t.px,t.py],a[e]=t.rawY,c[e]=t.d}return{type:"line",path:l,rawValues:a,style:i,datum:c,group:r}}function ae(e,t,n,o,i,r,s,l){const a=[];for(const r of e){const e=n(r),s=o(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=l?l(r):i;a.push({px:c,topY:t.y(s),botY:t.y(u)})}a.sort((e,t)=>e.px-t.px);const c=Array(a.length),u=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function ce(e,t,n,o){var i,r,s;const l=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;l.set(o,-e/2)}else if("wiggle"===o){e.length>0&&l.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],s=e[o];let a=0,c=0,u=0;for(const e of t){const t=n(e,s)||0;a+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const d=null!==(i=l.get(r))&&void 0!==i?i:0;l.set(s,d-(c>0?a/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=l.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)l.set(t,(null!==(s=l.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)l.set(t,0);return l}function ue(e,t,n,o,i,r,s){const l=n(e),a=o(e);if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c={type:"point",x:t.x(l),y:t.y(a),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function de(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function he(e,t,n,o,i,r,s){const l={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(l.showValues=!0,l.value=s.value,s.valueFormat&&(l.valueFormat=s.valueFormat)),l}function fe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ge(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function pe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ye(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}function me(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ve(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function be(e){const t=e.map(me),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return ve(e,n,o)}if(e>=1){const[e,o,i]=t[n];return ve(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,d]=t[i+1];return ve(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(d-a)*r))}}const xe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ke=be(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),we=be(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ae=be(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Oe=be(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Se=be(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ce=be(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),je=be(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),_e=be(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Me=be(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Pe=be(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Le=be(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Ne=be(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);be(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),be(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),be(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),be(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),be(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),be(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),be(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Fe={category10:xe,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:ke,reds:we,greens:Ae,oranges:Oe,purples:Se,viridis:je,plasma:_e},Be=xe,Te=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],He=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function We(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||He.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Be[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%Be.length]}function Ie(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return x().domain(o).range(n).unknown("#999");const r=Fe[n]||Fe.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:Be;return x().domain(o).range(e).unknown("#999")}}function De(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[l,a]=n;if(s===r)return(l+a)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}function ze(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}function Ee(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function Re(e,t,n){return e+(t-e)*n}function $e(e,t,n){var o,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ye(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function Ge(e,t,n,o){if(!e.scales)return null;const i=[],r=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),l=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(l))continue;const a=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(l);Number.isFinite(a)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([a,c]),r.push([a,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:Ye(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Xe(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Ve(e,t,n){const o=[];for(const i of n){const n=Ge(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function qe(e,t,n,o){const i=[];for(const r of o){const o=Ge(e,t,n,r);o&&i.push(o)}return i}function Ue(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function Ke(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const l=null!==(i=o.r)&&void 0!==i?i:3,a=e.getPointId?e.getPointId(s)+"":void 0,c=ue(s,e.scales,e.getX,r,l,o,a);c&&n.push(c)}}}const Qe={topOpacity:.8,bottomOpacity:.05};function Ze(e){var t,n;if(e)return!0===e?Qe:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Qe.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:Qe.bottomOpacity}}const Je={blues:ke,reds:we,greens:Ae,viridis:je,oranges:Oe,purples:Se,greys:Ce,plasma:_e,inferno:Me,magma:Pe,cividis:Le,turbo:Ne},et=new Map;function tt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function nt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=tt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=ge(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:tt(e.y1Accessor,"y1"),getBottom:tt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class ot{constructor(e){if(this.xExtent=new re,this.yExtent=new re,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new ie(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ge(e.timeAccessor||e.xAccessor,"time"),this.getY=ge(e.valueAccessor||e.yAccessor,"value")):(this.getX=ge(e.xAccessor,"x"),this.getY=ge(e.yAccessor,"y")),this.getGroup=ye(e.groupAccessor),this.getCategory=ye(e.categoryAccessor),this.getSize=e.sizeAccessor?ge(e.sizeAccessor,"size"):void 0,this.getColor=ye(e.colorAccessor),this.getY0=e.y0Accessor?ge(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=nt(e),this.getPointId=ye(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?ge(e.openAccessor,"open"):void 0,this.getHigh=ge(e.highAccessor,"high"),this.getLow=ge(e.lowAccessor,"low"),this.getClose=n?ge(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new ie(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?ge(this.config.timeAccessor||this.config.xAccessor,"time"):ge(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,g;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(n=p.xExtent[0])&&void 0!==n?n:v[0],null!==(o=p.xExtent[1])&&void 0!==o?o:v[1]]:v,O=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const S=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],C="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!S&&y.size>0)if(p.normalize)O=[0,C?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(l=p.stackOrder)&&void 0!==l?l:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)O=this._stackExtentCache.yDomain;else{const t=this.groupData(m),n=new Map,o=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let l=0;for(const n of e.data){const e=this.getX(n),s=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),o.add(e),l+=s;const a=(r.get(e)||0)+s;r.set(e,a),a>i&&(i=a)}n.set(e.key,t),s.set(e.key,l)}const l=null!==(a=p.stackOrder)&&void 0!==a?a:"key",f=(e,t)=>t>e?-1:e>t?1:0;let g;if("insideOut"===l){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(o.push(t),r+=null!==(u=s.get(t))&&void 0!==u?u:0);g=[...o.reverse(),...n]}else g="asc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(e))&&void 0!==n?n:0)-(null!==(o=s.get(t))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}):"desc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:f(e,t)}):t.map(e=>e.key).sort(f);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=ce(e,g,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(h=r.get(n))&&void 0!==h?h:0;i>e&&(i=e),e+o>s&&(s=e+o)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const l=s-i,a=C?0:l>0?l*p.extentPadding:1;O=[i-a,s+a]}else O=[0,i+(C?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:O}}}else if("bar"===p.chartType&&p.binSize&&!S&&y.size>0){const[,e]=function(e,t,n,o,i){const r=se(e,t,n,o,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);O=[0,C?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!S&&y.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(y,this.getY),n=t-e,o=C?0:n>0?n*p.extentPadding:1;O=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!S&&O[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(O[0]>n&&(O[0]=n),n>O[1]&&(O[1]=n)),Number.isFinite(o)&&(O[0]>o&&(O[0]=o),o>O[1]&&(O[1]=o))}const e=O[1]-O[0],t=C?0:e>0?e*p.extentPadding:1,n=null===(f=p.yExtent)||void 0===f?void 0:f[0],o=null===(g=p.yExtent)||void 0===g?void 0:g[1];O=[null!=n?O[0]:O[0]-t,null!=o?O[1]:O[1]+t],"log"!==p.yScaleType||O[0]>0||0>=b[0]||C||(O[0]=null!=n?O[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!S){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(O=[null!=e?e:O[0],null!=t?t:O[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];O[0]!==1/0&&O[1]!==-1/0||(O=[0,1]);const j="streaming"===p.runtimeMode,_=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(j)if("x"==("up"===(M=p.arrowOfTime)||"down"===M?"y":"x")){const t="right"===p.arrowOfTime?[_,e.width-_]:[e.width-_,_];this.scales={x:k().domain(x).range(t),y:k().domain(O).range([e.height-_,_])}}else{const t="down"===p.arrowOfTime?[_,e.height-_]:[e.height-_,_];this.scales={x:k().domain(O).range([_,e.width-_]),y:k().domain(x).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)};this.scales={x:t(p.xScaleType,x,[_,e.width-_]),y:t(p.yScaleType,O,[e.height-_,_])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,ot.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=S().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),l=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)},a=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:l(this.config.xScaleType,o,r[0]>r[1]?[e.width-a,a]:[a,e.width-a]),y:l(this.config.yScaleType,i,c?[a,e.height-a]:[e.height-a,a])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,s,l,a;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const a=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:a,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=c.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:Te},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(o=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(l=h.nodes)&&void 0!==l?l:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:r}=Xe(e.ribbons);if(r.length>0&&i.push(...Ve(e,t,r)),n.length>0)for(const t of o)i.push(...qe(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=le(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return Ke(e,o,i),i}(d,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Xe(e.ribbons);if(r.length>0&&o.push(...Ve(e,t,r)),i.length>0)for(const t of n)o.push(...qe(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=ae(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),l=Ze(e.config.gradientFill);l&&(s.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return Ke(e,n,o),o}(d,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Xe(e.ribbons);if(r.length>0&&o.push(...Ve(e,t,r)),i.length>0)for(const t of n)o.push(...qe(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=ae(t.data,e.scales,e.getX,e.getY,r,n,t.key,s),l=Ze(e.config.gradientFill);l&&(i.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=le(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Ke(e,n,o),o}(d,t);case"stackedarea":return function(e,t){var n,o,i,r;const s=e.groupData(t),l=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",a=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===l)a();else if("asc"===l||"desc"===l||"insideOut"===l){const t=new Map;for(const n of s){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else if("desc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else{const e=[...s].sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)}),r=[],l=[];let a=0,c=0;for(const n of e)c>a?(r.push(n),a+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(l.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);s.length=0,s.push(...l.reverse(),...r)}}else a();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,n,o,i,r,s,l="zero"){var a,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let f;if(r){f=new Map;for(const t of d){let n=0;for(const o of e)n+=(null===(a=h.get(o.key))||void 0===a?void 0:a.get(t))||0;f.set(t,n||1)}}const g=ce(d,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},l),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=g.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],l=[],a=new Map;for(const n of d){let i=e.get(n)||0;const s=m.get(n);r&&(i/=f.get(n));const c=s+i,u=t.x(n);l.push([u,t.y(s)]),o.push([u,t.y(c)]),m.set(n,c),a.set(n,c)}y.set(n.key,a);const c={type:"area",topPath:o,bottomPath:l,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),f=d;if(e.config.pointStyle){const t=new WeakMap;for(const n of s){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Ke(e,s,f,n)}return f}(d,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);s=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const l=e.getColor?e.resolveColorMap(t):null,a=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(l&&e.getColor&&!t.fill){const o=e.getColor(n);o&&l.has(o)&&(t=Object.assign(Object.assign({},t),{fill:l.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=ue(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(d,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),l=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),a=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=ge(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,f]=e.scales.y.domain(),g=(d-u||1)/s,p=(f-h||1)/l,y=s*l;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const a=Math.min(Math.floor((i-u)/g),s-1),d=Math.min(Math.floor((r-h)/p),l-1);if(0>a||0>d)continue;const f=d*s+a;m[f]++;const y=c(o);v[f]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(a){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/s,A=n.height/l,O=e.config.showValues,S=e.config.heatmapValueFormat,C=[];for(let e=0;l>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(a){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;C.push(he(n*w,(l-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*g,yCenter:h+(e+.5)*p,agg:a},O?{value:i,showValues:!0,valueFormat:S}:void 0))}}return C}(e,t,n);if(0===t.length)return[];const o=ge(e.config.valueAccessor,"value"),i=pe(e.config.xAccessor,"x"),r=pe(e.config.yAccessor,"y"),s=new Map,l=new Map,a=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=r(n);a[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),l.has(u)||l.set(u,l.size)}const u=s.size,d=l.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),f=Array.from(l.keys()),g=h.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(g){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){f.sort((e,t)=>e-t),l.clear();for(let e=0;f.length>e;e++)l.set(f[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=s.get(a[e]),r=l.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),h=r*u+i,f=b.get(h);let g;void 0!==f?g=f:(g=x++,b.set(h,g)),y[g]=h,m[g]=d,v[g]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Je?e:"blues";let n=et.get(t);if(n)return n;n=Array(256);const o=Je[t]||ke;for(let e=0;256>e;e++)n[e]=o(e/255);return et.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),O=255/(w-k||1),S=n.width/u,C=n.height/d,j=e.config.showValues,_=e.config.heatmapValueFormat,M=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;M.push(he(o*S,(d-1-(n-o)/u)*C,S,C,A[Math.min((t-k)*O+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:_}:void 0))}return M}(d,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=se(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),s=Array.from(t).filter(e=>!o.has(e)).sort(),l=n.filter(e=>t.has(e)),a=l.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===a?r=e.barCategoryCache.order:(r=[...l,...s],e.barCategoryCache={key:a,order:r})}const s=[],l=e.scales,[a,c]=l.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,f="number"!=typeof h||0>h?1:h,g={};(null==u?void 0:u.stroke)&&(g.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(g.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(g.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,a),i=Math.min(t.end,c);if(n>=i)continue;const h=l.x(n),p=l.x(i),y=Math.abs(p-h),m=y>f+1?f:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const a=l.y(n),c=l.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(de(v,Math.min(a,c),b,Math.abs(a-c),Object.assign({fill:h},g),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=l.y(0),n=l.y(t.total);s.push(de(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},g),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(d,t);return this._barCategoryCache=null!==(a=d.barCategoryCache)&&void 0!==a?a:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,l;const a=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,f=c.stroke,g=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=d;if(e.getCategory){const t=e.getCategory(n);s=(null===(l=e.config.barColors)||void 0===l?void 0:l[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:f,strokeWidth:g},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),a.push(c)}return a}(d,t);case"waterfall":return function(e,t,n){var o,i,r,s,l,a,c;const u=[],d=e.scales,h=e.config.waterfallStyle,f=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===f.length)return u;const g=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(a=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(l=e.config.themeSemantic)||void 0===l?void 0:l.danger)&&void 0!==a?a:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;f.length>t;t++){const o=f[t],i=e.getX(o),r=e.getY(o),s=x+r;let l;l=f.length-1>t?e.getX(f[t+1])-i:t>0?i-e.getX(f[t-1]):0;const a=d.x(i),c=0!==l?d.x(i+l):a+n.width/10,k=Math.min(a,c)+y/2,w=Math.max(a,c)-y/2-k;if(0>=w){x=s;continue}const A=d.y(x),O=d.y(s),S=Math.min(A,O),C=Math.abs(A-O),j={fill:0>r?p:g,stroke:m,strokeWidth:v};null!=b&&(j.opacity=b),u.push(de(k,S,w,C,j,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(d,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},l=s.rangeColor||"#6366f1",a=i?l:s.upColor||"#28a745",c=i?l:s.downColor||"#dc3545",u=i?l:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let f=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}f=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else f=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const l=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[l,h].some(e=>null==e||Number.isNaN(e)))continue;const g=h>=l,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:d,isUp:g,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(d,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?ze(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const l=s.get(t[n]);null!=l?(o[n]=ze(e,l,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let l=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=ze(e,o,r),1>i[n]&&(l=!0)):i[n]=1}l&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=ze(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const l=ze(e,t,r);if("heatcell"===n.type)n.style={opacity:l};else if("candlestick"===n.type)n._decayOpacity=l;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*l})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",a=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const l=Ee(e,r,s);l>i&&(i=l)}i>0&&(n._pulseIntensity=i,n._pulseColor=l);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Ee(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=l,n._pulseGlowRadius=a)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,r,s,l;n.clear(),o.clear();for(let a=0;t.length>a;a++){const c=t[a],u=$e(e,c,a);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(l=c.style)||void 0===l?void 0:l.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=$e(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var r,s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,k,w,A,O,S,C,j,_,M,P,L,N,F,B,T,H,W,I,D,z,E,R,$,Y,G;if(0===o.size&&0===i.size)return n;const X=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let V=!1;const q=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=$e(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];V=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];V=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(a=null!==(l=e.opacity)&&void 0!==l?l:r.style.opacity)&&void 0!==a?a:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;continue}const L=o.get(P);if("point"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(d=L.r)&&void 0!==d?d:r.r,V=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("rect"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(f=r.style.opacity)&&void 0!==f?f:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(g=L.w)&&void 0!==g?g:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,V=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("heatcell"===r.type)if(L){q.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,V=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){q.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(O=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==O?O:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(j=L.lowY)&&void 0!==j?j:r.lowY,V=!0)}else r._targetOpacity=null!==(M=null===(_=r.style)||void 0===_?void 0:_.opacity)&&void 0!==M?M:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}for(const[e,t]of o)if(!q.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(N=t.r)&&void 0!==N?N:3,style:{opacity:null!==(F=t.opacity)&&void 0!==F?F:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(B=t.w)&&void 0!==B?B:0,h:null!==(T=t.h)&&void 0!==T?T:0,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(W=t.w)&&void 0!==W?W:0,h:null!==(I=t.h)&&void 0!==I?I:0,fill:"#999",datum:null,style:{opacity:null!==(D=t.opacity)&&void 0!==D?D:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(z=t.openY)&&void 0!==z?z:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(E=t.closeY)&&void 0!==E?E:o,highY:null!==(R=t.highY)&&void 0!==R?R:o,lowY:null!==($=t.lowY)&&void 0!==$?$:o,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:X}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,r,s,l,a,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),d=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=Re(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),e.y=Re(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=Re(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=Re(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),e.y=Re(n.y,e._targetY,d),void 0!==n.w&&(e.w=Re(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Re(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Re(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),e.y=Re(n.y,e._targetY,d),void 0!==n.w&&(e.w=Re(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Re(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(l=n.opacity)&&void 0!==l?l:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Re(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=Re(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=Re(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=Re(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=Re(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Re(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Re(t[o][0],n[o][0],d),e.path[o][1]=Re(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Re(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Re(t[n][0],o[n][0],d),e.topPath[n][1]=Re(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Re(n[t][0],i[t][0],d),e.bottomPath[t][1]=Re(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Te,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||Te;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>ot.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,l=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=a||!fe(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=a||!fe(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=ge(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ge(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ge(this.config.xAccessor,"x"),this.getY=ge(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=nt(this.config)),s=!0,l=!0)}if("groupAccessor"in e&&!fe(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ye(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!fe(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ye(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!fe(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ge(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!fe(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ye(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!fe(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?ge(this.config.y0Accessor,"y0"):void 0,s=!0,l=!0),("boundsAccessor"in e&&!fe(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=nt(this.config),s=!0,l=!0),"pointIdAccessor"in e&&!fe(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ye(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!fe(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!fe(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!fe(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!fe(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?ge(this.config.openAccessor,"open"):void 0,this.getHigh=ge(this.config.highAccessor,"high"),this.getLow=ge(this.config.lowAccessor,"low"),this.getClose=t?ge(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,l=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){s=!0;break}}s&&(l&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function it(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function rt(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function st(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function lt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function at(e,t){const n=lt(e);if(!n)return!1;const o=lt(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}ot.GROUP_COLOR_MAP_CAP=1e3,ot.QUADTREE_THRESHOLD=500;const ct=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ut=new WeakMap;let dt=0,ht=!1,ft=null,gt=null,pt=null;function yt(e,t){var n,o;if(!t)return t;const i=ct.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(ht)return;if("undefined"==typeof window||"undefined"==typeof document)return;ht=!0;const e=()=>{dt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ft=new MutationObserver(e),ft.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{gt=window.matchMedia("(prefers-color-scheme: dark)"),pt=e,"function"==typeof gt.addEventListener?gt.addEventListener("change",pt):"function"==typeof gt.addListener&>.addListener(pt)}catch(e){}}();let s=ut.get(r);s&&s.version===dt||(s={version:dt,map:new Map},ut.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}function mt(e){switch(e){case"monotoneX":return B;case"monotoneY":return F;case"cardinal":return N;case"catmullRom":return L;case"step":return P;case"stepBefore":return M;case"stepAfter":return _;case"basis":return j;case"natural":return C;default:return null}}function vt(e,t,n){return null==t?n:"string"!=typeof t?t:yt(e,t)||n}function bt(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const l=e.createLinearGradient(o,i,r,s);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:a}=t;if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,l)),u=Math.max(0,Math.min(1,a)),d=e.createLinearGradient(o,i,r,s),[h,f,g]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function xt(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}const kt=new WeakMap;function wt(e,t){const n=mt(t);if(!n)return e;const o=kt.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const r={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,r,s,l,a){if(!i)return i=[l,a],void o.push([l,a]);const[c,u]=i;for(let i=1;n>=i;i++){const d=i/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*l,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*a])}i=[l,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return T().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return kt.set(e,i),i}function At(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,l=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>l||s>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,l=Math.sqrt(r*r+s*s);st(e.r,o)>=l&&d>l&&(u=e,d=l),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=St(r,t,n,o);break;case"line":e=Ct(r,t,n,o);break;case"rect":if(null==r.datum)break;e=_t(r,t,n);break;case"heatcell":e=Mt(r,t,n);break;case"area":if(!1===r.interactive)break;e=Lt(r,t,n);break;case"candlestick":e=Pt(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Ot(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Nt(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[s,l]=e[i],[a,c]=e[r];return a===s?l:l+Math.max(0,Math.min(1,(t-s)/(a-s)))*(c-l)}function St(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>st(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Ct(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const s=Nt(e.path,t);if(0>s)return null;const[l,a]=e.path[s];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,s-1),r=Math.min(e.path.length-2,s);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[l,a]=e.path[s+1],c=jt(t,n,i,r,l,a);o>c&&(o=c)}c=o}else{const e=t-l,o=n-a;c=Math.sqrt(e*e+o*o)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:l,y:a,distance:c}}function jt(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function _t(e,t,n){const o=rt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Mt(e,t,n){const o=rt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Pt(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+s*s)}}return null}function Lt(e,t,n){if(0===e.topPath.length)return null;const o=Nt(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,l=n-r,a=Math.sqrt(s*s+l*l);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:a}}function Nt(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function Ft(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Bt(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const Tt={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function Ht(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,Tt[n])(o(e,t),i),r}function Wt({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function It(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Dt=(n,o,i,r,s,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=s,{swatchSize:x,labelGap:k,rowHeight:w}=h;return p.forEach((n,d)=>{const h=Ht(n,d,f,g,x),A=It(n,r,s),O=s&&s.size>0&&s.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===l&&d===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?O||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,O&&e(Wt,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=w}),y};function zt({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:l,label:a,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(l[0]+n*(l[1]-l[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(l[1]-n*(l[1]-l[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[a&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])})]})}function Et(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical",legendLayout:g}=n,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),l=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:l,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(g),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),k="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,g)=>{h+=5,f.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+g)),h+=8,t.label&&(h+=16,f.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),h+=8),f.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:Dt(t,o,i,r,s,l,a,g,c,u,d)},"legend-group-"+g)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:f})=>{var g;let p=0;const y=[];n.forEach((n,o)=>{var g;let m=0;n.label&&(m+=16);const v=((n,o,i,r,s,l,a,c,u,d,h,f)=>{const{type:g="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,A=!(!o&&!i),O="isolate"===d||void 0===d&&null!=s,S=y.map(e=>v+b+7*e.label.length),C=[];let j=0,_=0;S.forEach((e,t)=>{const n=0===_?e:_+x+e;f&&f>0&&_>0&&n>f?(C.push({start:j,end:t,width:_}),j=t,_=e):_=n}),y.length>0&&C.push({start:j,end:y.length,width:_}),C.forEach((n,d)=>{let h="center"===w?Math.max(0,((null!=f?f:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=f?f:n.width)-n.width):0;for(let f=n.start;n.end>f;f++){const n=y[f],w=Ht(n,f,g,p,v),C=It(n,r,s),j=s&&s.size>0&&s.has(n.label);m.push(t("g",{transform:`translate(${h},${d*k})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===l&&f===a?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&O?j||!1:void 0,"aria-current":A&&!O&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(f+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:A?e=>{u(c,f),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:C,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,j&&e(Wt,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+f)),h+=S[f]+x}});const M=Math.max(0,...C.map(e=>e.width)),P=C.length;return{items:m,offset:M,totalRows:P,totalHeight:P*k}})(n,r,s,l,a,c,u,o,d,h,f,null!==(g=f.maxWidth)&&void 0!==g?g:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(g=f.maxWidth)&&void 0!==g?g:i;let v=p>m?0:"center"===f.align?Math.max(0,(m-p)/2):"end"===f.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:l,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),w=!(!r&&!s);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),k]})}function Rt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function $t(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=t;if(!o)return null;const p="top"===l||"bottom"===l,y=!!c,m=Math.max(1,p?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===l?(v=Math.max(4,s.left-m-10),b=s.top):"top"===l?(v=s.left,b=y?32:8):"bottom"===l?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e(zt,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Rt(o)?e(Et,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):o)});var x}function Yt(e){return"string"==typeof e?{type:e}:e}function Gt({orient:n,config:o,values:i,scale:s,size:l,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=s.domain(),r=l-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!o)return null;const{q1:l,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=o,g=Math.min(.5*r,20),p=(r-g)/2+4;if(u){const o=s(l),i=s(d),r=s(a),u=s(h),y=s(f),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(p+g/2),x2:y,y2:v+m*(p+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*p,x2:u,y2:v+m*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-p-g:v+p,width:Math.abs(i-o),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-p-g:v+p,x2:r,y2:"top"===n?v-p:v+p+g,stroke:c.fill,strokeWidth:2})]})}{const o=s(l),i=s(d),r=s(a),u=s(h),y=s(f),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(p+g/2),y1:u,x2:v+m*(p+g/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:u,x2:v+m*(p+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+g),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-p-g:v+p,y:Math.min(o,i),width:g,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-p-g:v+p,y1:r,x2:"left"===n?v-p:v+p+g,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=I().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=s(t.x0),l=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(l,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=s(t.x0),l=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+l),width:i,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),l=s((e.x0+e.x1)/2);o.push(u?`${l},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${l}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const l=i.length/h*(r/2),a=s((i.x0+i.x1)/2);o.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,l,a,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Xt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Vt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function qt(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:l,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!l)return e("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let g="start";"topBottom"===h?"right"===f?g="end":"middle"===f&&(g="middle"):g=0>o?"end":"start";const p=16,y=l?d?[l]:Xt(l,u):[],m=s?d?[s]:Xt(s,u):[],v="leftRight"===h?"end"===g?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:g,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:g,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let w=null;if((l||s)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===f?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===f||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),w]})}function Ut(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||l.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&l.push(e("path",{d:Vt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:l})}function Kt(t,n,o,i,r,s){const l=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;a=i+s*h,c=r+l*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(l.push(e("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-a);l.push(e("path",{d:`M${a},${c}L${a+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${a+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:l})}function Qt(e){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:l,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:g,events:p={},"data-testid":y}=e,m=new Set(Array.isArray(g)?g:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=l&&(b=l-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&&Kt(v,b,c,h,x,u),!m.has("subject")&&Ut(x,u,h,n,o),!m.has("note")&&qt(a,v,b,h)]}))}function Zt(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e(Qt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e(Qt,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function Jt(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function en(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function tn(e,t,n){var o,i,r,s;const l=e.anchor||"fixed";if("latest"===l){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=Jt(e,n),c=en(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===l){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function nn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const on={linear:W,monotoneX:B,monotoneY:F,step:P,stepAfter:_,stepBefore:M,basis:j,cardinal:N,catmullRom:L};let rn={positions:new Map};const sn=new Set;function ln(){for(const e of sn)e()}function an(e,t){const n=rn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(rn.positions);o.delete(e),rn={positions:o},ln()}function cn(e,t){const n=rn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(rn.positions);o.delete(e),rn={positions:o},ln()}function un(){return rn}function dn(e){return sn.add(e),()=>sn.delete(e)}const hn={positions:new Map};function fn(){return()=>{}}function gn(){return hn}function pn(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,l=i instanceof Date?i.getTime():i;if(2>t||s===l)return r?[new Date(s),new Date(l)]:[s,l];const a=(l-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:s+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function yn(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function mn(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function vn(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function bn(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function xn(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function kn(n){const{width:o,height:i,totalWidth:s,totalHeight:l,margin:a,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:f,yFormat:g,axisExtent:p}=n,y=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||f||wn,r=Math.max(2,Math.floor(o/70)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(c.x,"exact"===p?Math.max(2,s):Math.min(s,r),p),a=l.map(e=>e.valueOf()),u=l.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,a)})),h=u.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return An(u,Math.max(55,h+8))},[c,d,f,o,p]),m=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||g||wn,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return An((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(c.y,"exact"===p?Math.max(2,s):Math.min(s,r),p)).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,g,i,p]),v=h&&c,b=u&&c;if(!v&&!b)return null;const x=null==d?void 0:d.find(e=>"bottom"===e.orient),k=null==d?void 0:d.find(e=>"left"===e.orient),w=b&&(!x||!1!==x.baseline),A=b&&(!k||!1!==k.baseline),O=(null==x?void 0:x.jaggedBase)||!1,S=(null==k?void 0:k.jaggedBase)||!1,C="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${a.left},${a.top})`,children:[v&&(()=>{var n,r;const s=bn(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),l=bn(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),m.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:l},"ygrid-"+n))]})})(),w&&!O&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:C,strokeWidth:1}),O&&e("path",{d:xn("bottom",o,i),fill:"none",stroke:C,strokeWidth:1}),A&&!S&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),S&&e("path",{d:xn("left",o,i),fill:"none",stroke:C,strokeWidth:1})]})})}function wn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function An(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function On(o){var l,a;const{width:u,height:d,totalWidth:h,totalHeight:f,margin:g,scales:p,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:A,showGrid:O,title:S,legend:C,legendHoverBehavior:j,legendClickBehavior:_,legendHighlightedCategory:M,legendIsolatedCategories:P,legendPosition:L="right",legendLayout:N,foregroundGraphics:F,marginalGraphics:B,xValues:T,yValues:I,annotations:E,svgAnnotationRules:R,xAccessor:$,yAccessor:Y,annotationData:G,pointNodes:X,curve:V,underlayRendered:q,canvasObscuresUnderlay:U=!0,linkedCrosshairName:K,linkedCrosshairSourceId:Q,children:Z}=o,J=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||wn,i=Math.max(2,Math.floor(u/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),l=s.map(e=>e.valueOf()),a=s.map((e,t)=>({value:e,pixel:p.x(e),label:o(e,t,l)})),c=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=An(a,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.x.domain()[1],t=p.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,l);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,m,k,u,A]),ee=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||w||wn,i=Math.max(2,Math.floor(d/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=An((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:pn(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.y.domain()[1],t=p.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[y,p,m,w,d,A]),te=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||w||wn,i=Math.max(2,Math.floor(d/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return An((null!==(t=n.tickValues)&&void 0!==t?t:pn(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,m,w,d,A]),ne=i(new Map),oe=i(null!==(l=null==E?void 0:E.length)&&void 0!==l?l:0),ie=null!==(a=null==E?void 0:E.length)&&void 0!==a?a:0;oe.current!==ie&&(oe.current=ie,ne.current=new Map);const re=r(()=>{if(!E||0===E.length)return null;const n=function(n,o,i){var r,s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,k,w,A,O,S,C,j,_,M,P,L,N,F,B,T,I,E,R,$,Y,G,X,V,q,U,K,Q,Z,J,ee,te,ne;switch(n.type){case"label":{const t=tn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return nn(r,s,i)?e(Zt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=tn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return nn(r,s,i)?e(Zt,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=Jt(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",l=n.labelPosition||"top";let a;return a="bottom"===l?(i.height||0)-4:"center"===l?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:r+4,y:a,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=en(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",l=n.labelPosition||"right";let a,c;return"left"===l?(a=4,c="start"):"center"===l?(a=(i.width||0)/2,c="middle"):(a=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:a,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:Jt(Object.assign(Object.assign({},e),{type:"point"}),i),y:en(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=D(r),l=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+l,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-l-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:Jt(Object.assign(Object.assign({},e),{type:"point"}),i),y:en(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,l=r.map(e=>e.x),a=r.map(e=>e.y),c=Math.min(...l)-s,u=Math.max(...l)+s,d=Math.min(...a)-s,h=Math.max(...a)+s;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=Jt(t,i),l=en(t,i);if(null==r||null==l)return null;const a="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=Jt(n,i),r=en(n,i);return e(Zt,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const f=i.xAccessor||"x",g=i.yAccessor||"y",p="ordinal"===i.frameType,y="horizontal"===i.projection,m=p?f:null,v=p?g:null;let b;const x=[],k=new Map;if(p&&m&&v){for(const e of h){const t=e[m];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=h.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=k.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[f],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(l=i.scales)||void 0===l?void 0:l.time,A=null!==(c=null===(a=i.scales)||void 0===a?void 0:a.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!w||!A)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=w,C=A;let j;if(p)if(y){const e=O(C);j=(t,n)=>[S(n),e(t)]}else{const e=O(S);j=(t,n)=>[e(t),C(n)]}else j=(e,t)=>[S(e),C(t)];const _=n.method||"linear";let M;M="loess"===_?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],g+=t*i[e]*r[e])}if(0===u){l.push([t,r[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))l.push([t,h/u]);else{const e=(u*g-d*h)/p;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===_?z.polynomial(b,{order:n.order||2}):z.linear(b)).points;const P=M.map(([e,t])=>{const[n,o]=j(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",N=M[M.length-1],[F,B]=j(N[0],N[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:F+4,y:B-4,fill:L,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(f=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(g=i.scales)||void 0===g?void 0:g.value,s=null!==(p=null==r?void 0:r(n.y0))&&void 0!==p?p:0,l=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,l),width:i.width||0,height:Math.abs(l-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,l)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",l=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,a=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!l||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const f=on[i.curve||"linear"]||W,g=H().x(e=>l(e[s])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!g)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:g,fill:p,fillOpacity:null!==(A=n.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:l(h[h.length-1][s])+4,y:a(h[h.length-1][c])-4,fill:p,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",l=null!==(S=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(C=i.scales)||void 0===C?void 0:C.time,a=null!==(_=null===(j=i.scales)||void 0===j?void 0:j.y)&&void 0!==_?_:null===(M=i.scales)||void 0===M?void 0:M.value;if(!l||!a)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(P=n.threshold)&&void 0!==P?P:2,g=u-f*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(N=n.anomalyRadius)&&void 0!==N?N:6,x=a(u+f*h),k=a(g),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>f*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=Jt(t,i),r=en(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",l=i.yAccessor||"y",a=null!==(B=null===(F=i.scales)||void 0===F?void 0:F.x)&&void 0!==B?B:null===(T=i.scales)||void 0===T?void 0:T.time,c=null!==(E=null===(I=i.scales)||void 0===I?void 0:I.y)&&void 0!==E?E:null===(R=i.scales)||void 0===R?void 0:R.value;if(!a||!c)return null;const u=r.map(e=>[e[s],e[l]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=z.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,l=(n-s*t)/e;d=e=>l+s*e}const h=u.length,f=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(f/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==($=n.confidence)&&void 0!==$?$:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(Y=n.steps)&&void 0!==Y?Y:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=d(e),n=g*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${a(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${a(e.x)},${c(e.yCenter)}`).join(" "),C=`${a(x)},${c(d(x))}`,j=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(G=n.fillOpacity)&&void 0!==G?G:.15,stroke:"none"}),e("polyline",{points:`${C} ${S}`,fill:"none",stroke:j,strokeWidth:null!==(X=n.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(V=n.strokeDasharray)&&void 0!==V?V:"6,3"}),n.label&&A.length>0&&e("text",{x:a(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:j,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=tn(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!nn(t,r,i))return null;const s=null!==(q=n.dx)&&void 0!==q?q:0,l=null!==(U=n.dy)&&void 0!==U?U:0,a=null!==(K=n.width)&&void 0!==K?K:32,c=null!==(Q=n.height)&&void 0!==Q?Q:32,u=null!==(Z=n.content)&&void 0!==Z?Z:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=tn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,l=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,c=null===(te=i.scales)||void 0===te?void 0:te.y,u=s(l)?l:s(a)?a:s(c)?c:null;if(!u)return null;const d=u(r+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:u===a)?{children:[e("rect",{x:d,y:0,width:h,height:i.height||0,fill:f,fillOpacity:g}),p&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:d,width:i.width||0,height:h,fill:f,fillOpacity:g}),p&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:$,yAccessor:Y,width:u,height:d,data:G,frameType:"xy",pointNodes:X,curve:V,stickyPositionCache:ne.current};return E.map((e,t)=>{if(R){const i=R(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[E,R,u,d,$,Y,G,p,X,V]),se=function(e){var t;const n=c(e?dn:fn,e?un:gn,e?un:gn);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(K);return s(()=>{if(!(null==se?void 0:se.locked)||!K)return;const e=e=>{"Escape"===e.key&&cn(K)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==se?void 0:se.locked,K]),y||S||C||F||B||re&&re.length>0||O||Z||se?t("svg",{role:"img",width:h,height:f,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof S?S:"XY Chart"}),e("desc",{children:"string"==typeof S?S+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${g.left},${g.top})`,children:[O&&p&&(!q||U)&&(()=>{var n,o;const i=bn(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=bn(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[J.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),ee.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&p&&(()=>{const n=null==m?void 0:m.find(e=>"left"===e.orient),o=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,s=(null==n?void 0:n.jaggedBase)||!1,l=(null==o?void 0:o.jaggedBase)||!1,a=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&J.length>1&&(()=>{const e=u/Math.max(J.length-1,1);return J.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},O=null==o?void 0:o.tickAnchor,S=null==n?void 0:n.tickAnchor,C=vn(J),j=vn(ee);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!q||U)&&r&&!l&&e("line",{x1:0,y1:d,x2:u,y2:d,stroke:h,strokeWidth:1}),(!q||U)&&l&&e("path",{d:xn("bottom",u,d),fill:"none",stroke:h,strokeWidth:1}),J.map((n,o)=>{const i=!!a&&("function"==typeof a?a(n.value,o):at(n.value,o>0?J[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":yn(O,n.pixel===C.min,n.pixel===C.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:u/2,y:d+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!q||U)&&i&&!s&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:h,strokeWidth:1}),(!q||U)&&s&&e("path",{d:xn("left",u,d),fill:"none",stroke:h,strokeWidth:1}),ee.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):at(n.value,o>0?ee[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:mn(S,n.pixel===j.min,n.pixel===j.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-g.left,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-g.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n||0===te.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,s=n.tickAnchor,l=vn(te);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:u,y1:0,x2:u,y2:d,stroke:h,strokeWidth:1}),te.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):at(n.value,o>0?te[o-1].value:void 0));return t("g",{transform:`translate(${u},${n.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:mn(s,n.pixel===l.min,n.pixel===l.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:u+g.right-15,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${u+g.right-15}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),re,B&&p&&T&&I&&t(n,{children:[B.top&&e("g",{transform:"translate(0, 0)",children:e(Gt,{orient:"top",config:Yt(B.top),values:T,scale:p.x,size:g.top,length:u})}),B.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(Gt,{orient:"bottom",config:Yt(B.bottom),values:T,scale:p.x,size:g.bottom,length:u})}),B.left&&e("g",{transform:"translate(0, 0)",children:e(Gt,{orient:"left",config:Yt(B.left),values:I,scale:p.y,size:g.left,length:d})}),B.right&&e("g",{transform:`translate(${u}, 0)`,children:e(Gt,{orient:"right",config:Yt(B.right),values:I,scale:p.y,size:g.right,length:d})})]}),F,se&&se.sourceId!==Q&&(null==p?void 0:p.x)&&(()=>{const t=p.x(se.xValue);if(null==t||0>t||t>u)return null;const n=se.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Z]}),S&&e("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof S?S:null}),$t({legend:C,totalWidth:h,totalHeight:f,margin:g,legendPosition:L,title:S,legendLayout:N,legendHoverBehavior:j,legendClickBehavior:_,legendHighlightedCategory:M,legendIsolatedCategories:P})]}):null}function Sn(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Cn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const jn="undefined"==typeof window||"undefined"==typeof document,_n="undefined"!=typeof window?h:s,Mn=()=>()=>{},Pn=()=>!1,Ln=()=>!0;function Nn(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Fn(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Bn(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Tn=o.createContext(null),Hn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Wn(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const In=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Dn="semiotic-accessible-data-table",zn=Dn+" semiotic-accessible-data-table-hidden",En=Dn+" semiotic-accessible-data-table-visible",Rn={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},$n={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Yn={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Gn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Xn={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Vn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},qn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function Un({scene:n,chartType:i,tableId:r,chartTitle:s}){var l;const[a,c]=o.useState(!1),u=o.useContext(Tn),d=null!==(l=null==u?void 0:u.visible)&&void 0!==l&&l,h=a||d,f=o.useRef(null),g=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=o.useCallback(()=>{a||d||c(!0)},[a,d]),y=o.useCallback(e=>{var t;d||(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Hn}):null;if(!h)return e("div",{id:r,className:zn,tabIndex:-1,onFocus:p,style:Hn,role:"region","aria-label":g,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,g,p,y,m,v,b,x,k,w,A,O,S;const C=[];if(!Array.isArray(e))return C;for(const j of e)if(j&&"object"==typeof j&&null!==j.datum)try{switch(j.type){case"point":C.push({label:"Point",values:{x:j.x,y:j.y}});break;case"line":{const e=j.path,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&C.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=j.topPath,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&C.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=j.datum&&"object"==typeof j.datum?j.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;C.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":C.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":C.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=j.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=j.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=j.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":C.push({label:"Node",values:{id:null!==(h=null===(d=j.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=j.cx)&&void 0!==f?f:j.x,y:null!==(g=j.cy)&&void 0!==g?g:j.y}});break;case"arc":C.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":C.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":C.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=j.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=j.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(O=j.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return C}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${In(e.min)} to ${In(e.max)}, mean ${In(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:f,id:r,className:En,tabIndex:-1,onBlur:y,style:Rn,role:"region","aria-label":g,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Yn,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:$n,children:b}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:Gn,children:[t("caption",{className:"semiotic-accessible-data-table-caption",style:qn,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Xn,children:"type"}),w.map(t=>e("th",{style:Xn,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:Vn,children:n.label}),w.map(t=>{return e("td",{style:Vn,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":In(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function Kn({summary:t}){return t?e("div",{role:"note",style:Hn,children:t}):null}function Qn({tableId:t}){return e("a",{href:"#"+t,style:Hn,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Hn)},children:"Skip to data table"})}function Zn({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Hn,children:n})}const Jn="var(--semiotic-focus, #005fcc)";function eo({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Jn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Jn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Jn,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function to(e){return Array.isArray(e)?e[0]:e}function no(e,t,n,o){return Object.assign({data:to(e),x:t,y:n,__semioticHoverData:!0},o)}const oo={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function io(e,t){return"function"==typeof t?t(e):e[t]}function ro(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function so(n={}){const{fields:o,title:i,format:r,style:s={},className:l=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let a;const c=[];if(i){const e=io(n,i);a=ro(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=io(n,o);c.push({label:t,value:ro(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=ro(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=ro(n[e[0]],r))}}const u=Object.assign(Object.assign({},oo),s);return t("div",{className:("semiotic-tooltip "+l).trim(),style:u,children:[a&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:a}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&a?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function lo(){return n=>{var o,i,r,s,l,a,c;const u=n.allSeries;if(!u||0===u.length){const t=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:oo,children:e("div",{children:ro(t)})})}const d=null!==(a=null!==(s=n.xValue)&&void 0!==s?s:null===(l=n.data)||void 0===l?void 0:l.time)&&void 0!==a?a:null===(c=n.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:oo,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:ro(d)}),u.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:ro(n.value)})]},o))]})}}function ao(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=to(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:oo,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?so(t):so())}}function co({x:t,y:n,containerWidth:i,containerHeight:r,margin:s,children:l,className:a="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,f]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[l,a,i,r]);let g;g=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(l),y=p?null:oo;return u?e("div",{ref:d,className:p?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"}),children:l}):null}function uo(e,t,n){const o=i(null),[r,l]=d(null);return s(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const ho="undefined"==typeof window?s:h;function fo(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function go(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[l,c]=uo(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-u.left-u.right,f=c[1]-u.top-u.bottom,g=fo(e.foregroundGraphics,c,u),p=fo(e.backgroundGraphics,c,u),y=oe(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=a(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),O=i(()=>{}),S=i(null),C=i(0),j=a(()=>{C.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),_=a(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(j))},[j]),M=a(()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),O.current()},[]);s(()=>()=>{S.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const P=e.themeDirtyRef;return ho(()=>{P&&(dt++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:c,margin:u,adjustedWidth:h,adjustedHeight:f,resolvedForeground:g,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:_,onPointerLeave:M}}function po(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function yo(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function mo(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const vo=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const a=l._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=l.style.stroke||"#007bff",u=yt(e,c)||c,d=l.style.strokeWidth||2,h=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=d,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const m=null!==(i=l.style.opacity)&&void 0!==i?i:1;mo(e,l.path,u,d,m,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=mt(l.curve),p=h&&h.length>0&&f&&f.length===l.path.length,y=l._decayOpacities;if(y&&y.length===l.path.length&&!p){e.strokeStyle=u;const v=null!==(r=l.style.opacity)&&void 0!==r?r:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function C(){O&&(e.stroke(),O=!1)}for(let j=0;l.path.length>j;j++){const[_,M]=l.path[j],P=f[j],L=yo(P,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(_,M);else{const N=[];for(const F of h){const B=F.value;(w>B||B>P)&&(B>w||P>B)||w===B||P===B||N.push({t:(B-w)/(P-w)})}N.sort((e,t)=>e.t-t.t);for(const H of N){const W=x+(_-x)*H.t,I=k+(M-k)*H.t,D=yo(w+(P-w)*Math.min(H.t+1e-4,1),h,u);e.lineTo(W,I),C(),S(D,W,I)}e.lineTo(_,M)}x=_,k=M,w=P,A=L}else S(L,_,M),x=_,k=M,w=P,A=L}C()}else{e.beginPath();const z=l.strokeGradient&&l.path.length>=2?xt(e,l.strokeGradient,l.path[0][0],0,l.path[l.path.length-1][0],0):null;if(e.strokeStyle=z||u,g)T().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[E,R]=l.path[0];e.moveTo(E,R);for(let $=1;l.path.length>$;$++)e.lineTo(l.path[$][0],l.path[$][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=vt(e,l.style.fill,l.style.fill),g&&!p)T().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[G,X]=l.path[0];e.moveTo(G,X);for(let V=1;l.path.length>V;V++)e.lineTo(l.path[V][0],l.path[V][1])}const Y=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==a&&1>a&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function bo(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function xo(e,t,n=.3){bo(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ko(e,t,n=.6){var o,i,r,s,l;if(!bo(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function wo(e,t,n,o=.35){bo(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ao(e,t){const n=mt(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=H().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Oo=(e,t,n,o)=>{var i,r,s;const l=t.filter(e=>"area"===e.type);for(const t of l){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const l=t._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const a=vt(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=a;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Ao(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=bt(e,t.fillGradient,"string"==typeof a?a:"#4e79a7",0,n,0,o);e.fillStyle=i||a,e.globalAlpha=u}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*u,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Ao(e,t),wo(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const n=t.strokeGradient&&t.topPath.length>=2?xt(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=mt(t.curve);if(e.beginPath(),o)T().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==l&&1>l&&e.restore(),n&&e.restore(),e.globalAlpha=1}},So=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=vt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=vt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),ko(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Co(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:l,br:a,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-l,o),l>0&&e.arcTo(n+i,o,n+i,o+l,l),e.lineTo(n+i,o+r-a),a>0&&e.arcTo(n+i,o+r,n+i-a,o+r,a),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function jo(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const _o=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Mo(e,t);else if(t.cornerRadii&&Sn(t.cornerRadii)){const n=vt(e,t.style.fill,yt(e,"var(--semiotic-primary, #007bff)")),o=jo(t),i=t.fillGradient&&"string"==typeof n?bt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Co(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=vt(e,t.style.fill,yt(e,"var(--semiotic-primary, #007bff)")),o=jo(t),i=t.fillGradient&&"string"==typeof n?bt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:l,w:a,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,l),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s,l+c);break;case"left":e.moveTo(s+a,l),e.lineTo(s+r,l),e.arcTo(s,l,s,l+r,r),e.lineTo(s,l+c-r),e.arcTo(s,l+c,s+r,l+c,r),e.lineTo(s+a,l+c);break;case"bottom":e.moveTo(s,l),e.lineTo(s+a,l),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s+r,l+c),e.arcTo(s,l+c,s,l+c-r,r);break;default:e.moveTo(s,l+c),e.lineTo(s,l+r),e.arcTo(s,l,s+r,l,r),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=vt(e,t.style.fill,yt(e,"var(--semiotic-primary, #007bff)")),o=jo(t),i=t.fillGradient&&"string"==typeof n?bt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=yt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}xo(e,t),e.globalAlpha=1}};function Mo(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}function Po(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Lo(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const No=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=yt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),xo(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Lo(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=Po(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},Fo=(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const l=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==l&&(e.globalAlpha=l);const a=yt(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=a,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=a,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=yt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}};function Bo(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}const To=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ho(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${To[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${To[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Wo={line:[Oo,vo,So],area:[Oo,So],stackedarea:[Oo,So],scatter:[So],bubble:[So],heatmap:[No],bar:[_o],swarm:[So],waterfall:[(e,t,n,o)=>{var i;_o(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,l=null==s?void 0:s._connectorStroke;if(l){e.save(),e.strokeStyle=yt(e,l)||l,e.lineWidth=null!==(i=null==s?void 0:s._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,l=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==l?void 0:l.baseline))continue;const a=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,a),e.lineTo(u,a),e.stroke()}e.restore()}}],candlestick:[Fo],mixed:[Oo,vo,So],custom:[Oo,_o,No,vo,So,Fo]},Io={top:20,right:20,bottom:30,left:40},Do={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function zo(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const Eo={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Ro({hover:n}){var o,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",l=null!==(o=n.data)&&void 0!==o?o:{},a=null!==(i=l.y)&&void 0!==i?i:l.value,c=null!==(r=l.x)&&void 0!==r?r:l.time;return t("div",{className:"semiotic-tooltip",style:Eo,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(a)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}Ro.ownsChrome=!0;const $o=f(function(n,l){var u,h,f,y,m,v,b,x,k,w,A,O,S;const{chartType:C,runtimeMode:j,data:_,chunkThreshold:M,chunkSize:P,xAccessor:L,yAccessor:N,colorAccessor:F,sizeAccessor:B,groupAccessor:T,lineDataAccessor:H,curve:W,normalize:I,baseline:D,stackOrder:z,binSize:E,valueAccessor:R,arrowOfTime:Y="right",windowMode:V="sliding",windowSize:q=200,timeAccessor:K,xExtent:Q,yExtent:Z,extentPadding:J=.1,scalePadding:ee,sizeRange:te,size:ne=[500,300],responsiveWidth:oe,responsiveHeight:ie,margin:re,className:se,background:le,lineStyle:ae,pointStyle:ce,areaStyle:ue,barStyle:de,waterfallStyle:he,swarmStyle:fe,barColors:ge,colorScheme:pe,boundsAccessor:ye,boundsStyle:me,y0Accessor:ve,band:be,gradientFill:xe,lineGradient:ke,areaGroups:we,openAccessor:Ae,highAccessor:Oe,lowAccessor:Se,closeAccessor:Ce,candlestickStyle:je,showAxes:_e=!0,axes:Me,xLabel:Pe,yLabel:Le,yLabelRight:Ne,xFormat:Fe,yFormat:Be,axisExtent:Te,tickFormatTime:He,tickFormatValue:We,hoverAnnotation:Ie,tooltipContent:De,customHoverBehavior:ze,customClickBehavior:Ee,enableHover:Re,hoverRadius:$e=30,tooltipMode:Ye,annotations:Ge,svgAnnotationRules:Xe,showGrid:Ve,legend:qe,legendHoverBehavior:Ke,legendClickBehavior:Qe,legendHighlightedCategory:Ze,legendIsolatedCategories:Je,legendPosition:et,legendLayout:tt,legendCategoryAccessor:nt,onCategoriesChange:rt,backgroundGraphics:st,foregroundGraphics:lt,canvasPreRenderers:at,svgPreRenderers:ct,title:ut,categoryAccessor:dt,brush:ht,onBrush:ft,decay:gt,pulse:pt,transition:mt,animate:vt,staleness:bt,heatmapAggregation:xt,heatmapXBins:kt,heatmapYBins:St,showValues:Ct,heatmapValueFormat:jt,marginalGraphics:_t,pointIdAccessor:Mt,xScaleType:Pt,yScaleType:Lt,accessibleTable:Tt=!0,description:Ht,summary:Wt,linkedCrosshairName:It,linkedCrosshairSourceId:Dt,customLayout:zt,layoutConfig:Et}=n,Rt=g().replace(/:/g,""),$t=i(!1),Yt=go({sizeProp:ne,responsiveWidth:oe,responsiveHeight:ie,userMargin:re,marginDefault:Io,animate:vt,transitionProp:mt,themeDirtyRef:$t}),Gt=function(){const[e,t]=d(!1);return _n(()=>{t(!0)},[]),e}(),Xt=function(){const e=c(Mn,Pn,Ln);return i(e).current}(),{reducedMotionRef:Vt,responsiveRef:qt,size:Ut,currentTheme:Kt,transition:Qt,introEnabled:Zt,tableId:Jt,rafRef:en,renderFnRef:tn,scheduleRender:nn}=Yt;let on=Yt.margin;if(_t){const e=60,t=Object.assign({},Yt.margin);_t.top&&e>t.top&&(t.top=e),_t.bottom&&e>t.bottom&&(t.bottom=e),_t.left&&e>t.left&&(t.left=e),_t.right&&e>t.right&&(t.right=e),on=t}const rn="function"==typeof lt?lt({size:Ut,margin:on}):lt,sn="function"==typeof st?st({size:Ut,margin:on}):st,ln=Ut[0]-on.left-on.right,an=Ut[1]-on.top-on.bottom,cn=r(()=>G(_),[_]),un=null!=Ie?Ie:Re,dn=i(null),hn=i(null),[fn,gn]=d(0),[pn,yn]=d(null),mn=i(null),vn=i(null),[bn,xn]=d(null),wn=i(Do.primary),An=i([]),Sn=i(nt),Tn=i(rt);Sn.current=nt,Tn.current=rt;const[Hn,In]=d(!1),[Dn,zn]=d([]),[En,Rn]=d([]),$n="streaming"===j||["bar","swarm","waterfall"].includes(C),Yn=r(()=>{var e,t,n;return{chartType:C,runtimeMode:$n?"streaming":"bounded",windowSize:q,windowMode:V,arrowOfTime:$n?Y:"right",extentPadding:J,scalePadding:ee,axisExtent:Te,xAccessor:L,yAccessor:N,timeAccessor:$n?K:void 0,valueAccessor:R,colorAccessor:F,sizeAccessor:B,groupAccessor:T||(H?"_lineGroup":void 0),categoryAccessor:dt,lineDataAccessor:H,xScaleType:Pt,yScaleType:Lt,xExtent:Q,yExtent:Z,sizeRange:te,binSize:E,normalize:I,baseline:D,stackOrder:z,boundsAccessor:ye,boundsStyle:me,y0Accessor:ve,band:be,gradientFill:!0===xe?{topOpacity:.8,bottomOpacity:.05}:!1===xe?void 0:xe,areaGroups:we?new Set(we):void 0,lineGradient:ke,openAccessor:Ae,highAccessor:Oe,lowAccessor:Se,closeAccessor:Ce,candlestickStyle:je,lineStyle:ae,pointStyle:ce,areaStyle:ue,swarmStyle:fe,waterfallStyle:he,colorScheme:pe,barColors:ge,barStyle:de,annotations:Ge,decay:gt,pulse:pt,transition:Qt,introAnimation:Zt,staleness:bt,heatmapAggregation:xt,heatmapXBins:kt,heatmapYBins:St,showValues:Ct,heatmapValueFormat:jt,pointIdAccessor:Mt,curve:W,themeCategorical:null===(e=null==Kt?void 0:Kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:U(Kt),themeSequential:null===(t=null==Kt?void 0:Kt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Kt?void 0:Kt.colors)||void 0===n?void 0:n.diverging,customLayout:zt,layoutConfig:Et,layoutMargin:on}},[C,q,V,Y,J,ee,Te,L,N,K,R,Pt,Lt,F,B,T,dt,H,Q,Z,te,E,I,D,z,ye,me,ve,be,xe,ke,we,Ae,Oe,Se,Ce,je,ae,ce,ue,fe,he,de,pe,ge,Ge,gt,pt,null==Qt?void 0:Qt.duration,null==Qt?void 0:Qt.easing,Zt,bt,xt,kt,St,Ct,jt,$n,Mt,W,Kt,zt,Et,on]),Gn=function(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Fn(e,t);if(!Bn(e)||!Bn(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Fn(n,i))return!1}else{if(!Bn(n)||!Bn(i))return!1;if(!Nn(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Yn),Xn=i(null);Xn.current||(Xn.current=new ot(Gn));const Vn=a(()=>{var e,t;const n=Sn.current,o=Tn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Xn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,An.current)||(An.current=i,o(i))},[]);s(()=>{var e;null===(e=Xn.current)||void 0===e||e.updateConfig(Gn),$t.current=!0,nn()},[Gn,nn]);const qn=i(null);qn.current||(qn.current=new X(e=>{const t=Xn.current;t&&t.ingest(e)&&($t.current=!0,nn())},{chunkThreshold:M,chunkSize:P})),s(()=>{var e;null===(e=qn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:M,chunkSize:P})},[M,P]);const Jn=a(e=>{var t;null===(t=qn.current)||void 0===t||t.push(e)},[]),to=a(e=>{var t;null===(t=qn.current)||void 0===t||t.pushMany(e)},[]),oo=a(()=>{var e,t;null===(e=qn.current)||void 0===e||e.clear(),null===(t=Xn.current)||void 0===t||t.clear(),$t.current=!0,nn()},[nn]);p(l,()=>({push:Jn,pushMany:to,remove:e=>{var t,n,o;null===(t=qn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Xn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(mn.current&&i.some(e=>{var t;return e===(null===(t=mn.current)||void 0===t?void 0:t.data)})&&(mn.current=null,xn(null)),$t.current=!0,nn()),i},update:(e,t)=>{var n,o,i;null===(n=qn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Xn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&($t.current=!0,nn()),r},clear:oo,getData:()=>{var e,t,n;return null===(e=qn.current)||void 0===e||e.flush(),null!==(n=null===(t=Xn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Xn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Xn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Jn,to,oo,nn]),s(()=>{var e,t;if(_){if(H&&cn.length>0&&"object"==typeof cn[0]&&null!==cn[0]){const t="string"==typeof H?H:"coordinates";if(Array.isArray(cn[0][t])){const n=[];for(const e of cn){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=qn.current)||void 0===e||e.setBoundedData(n))}}null===(t=qn.current)||void 0===t||t.setBoundedData(cn)}},[_,cn,H]);const{hoverHandlerRef:io,hoverLeaveRef:ro,onPointerMove:so,onPointerLeave:lo}=Yt;io.current=e=>{var t,n;if(!un)return;const o=dn.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-on.left,s=e.clientY-i.top-on.top;if(0>r||r>ln||0>s||s>an)return void(mn.current&&(mn.current=null,vn.current=null,xn(null),ze&&(ze(null),$t.current=!0),nn()));const l=Xn.current;if(!l||0===l.scene.length)return;const a=At(l.scene,r,s,$e,l.quadtree,l.maxPointRadius),c="multi"===Ye,u=()=>{mn.current&&(mn.current=null,vn.current=null,xn(null),ze&&ze(null),nn())};if(!a&&!c)return void u();const d=c||!a?r:a.x,h=c||!a?s:a.y;let f=no((null==a?void 0:a.datum)?Ue(a.datum,l.resolvedRibbons):{},d,h);if(c&&l.scene.length>0&&l.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=Ot(wt(e.path,e.curve),t,n);if(null===r)continue;const s=Nt(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=wt(e.topPath,e.curve),s=wt(e.bottomPath,e.curve),l=Ot(r,t,n);if(null===l)continue;const a=Ot(s,t,n),c=Nt(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:l,y0:null!=a?a:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(l.scene,d,Math.max($e,ln));if(e.length>0){const t=l.scales.y.invert,n=l.scales.x.invert,o=wn.current,i=n?n(d):d;if(a)f.xValue=i,f.xPx=d;else{const e={xValue:i};"string"==typeof L&&(e[L]=i),f=no(e,d,h,{xValue:i,xPx:d})}f.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===C&&null!=i?n-i:n,valuePx:e.y,color:e.color||o,datum:Ue(e.datum,l.resolvedRibbons)}})}}a||(null===(t=f.allSeries)||void 0===t?void 0:t.length)?(mn.current=f,vn.current=null!==(n=null==a?void 0:a.node)&&void 0!==n?n:null,xn(f),ze&&(ze(f),$t.current=!0),nn()):u()},ro.current=()=>{mn.current&&(mn.current=null,vn.current=null,xn(null),ze&&(ze(null),$t.current=!0),nn())};const ao=i(()=>{});ao.current=e=>{if(!Ee)return;const t=dn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-on.left,i=e.clientY-n.top-on.top;if(0>o||o>ln||0>i||i>an)return void Ee(null);const r=Xn.current;if(!r||0===r.scene.length)return void Ee(null);const s=At(r.scene,o,i,$e,r.quadtree,r.maxPointRadius);Ee(s?no(s.datum||{},s.x,s.y):null)};const uo=a(e=>ao.current(e),[]),ho=i(-1),fo=i(null),yo=i(null),mo=a(e=>{const t=Xn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(yo.current&&yo.current.version===n)o=yo.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});break}case"rect":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:"_default"});break;case"heatcell":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),yo.current={version:n,graph:o}}const i=ho.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),ho.current=0;const n=o.flat[0];fo.current={shape:n.shape,w:n.w,h:n.h};const i=Bt(Object.assign(Object.assign({},n),{datum:Ue(n.datum,t.resolvedRibbons)}));return mn.current=i,xn(i),ze&&ze(i),void nn()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Ft(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Ft(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return ho.current=-1,fo.current=null,mn.current=null,vn.current=null,xn(null),ze&&ze(null),void nn();ho.current=s;const l=o.flat[s];fo.current={shape:l.shape,w:l.w,h:l.h};const a=Bt(Object.assign(Object.assign({},l),{datum:Ue(l.datum,t.resolvedRibbons)}));mn.current=a,xn(a),ze&&ze(a),nn()},[ze,nn]),vo=a(e=>{ho.current=-1,fo.current=null,so(e)},[so]);tn.current=()=>{var e,t;en.current=0;const n=dn.current,o=hn.current;if(!n||!o)return;const i=Xn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Vt.current?r+1e6:r),l=!Vt.current&&s,a=$t.current||s;a&&!l&&(i.computeScene({width:ln,height:an}),Vn());const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return Do;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),l=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||l||n||r?{axisStroke:a||Do.axisStroke,tickText:s||Do.tickText,crosshair:s?zo(s,"66"):Do.crosshair,hoverFill:c?zo(c,"4D"):Do.hoverFill,hoverStroke:s?zo(s,"99"):Do.hoverStroke,pointRing:c||Do.pointRing,primary:r||Do.primary}:Do}(n);wn.current=u.primary;const d=null!==(e=null==bt?void 0:bt.threshold)&&void 0!==e?e:5e3,h=bt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(a){const e=po(n,Ut,on,c);if(e){if(e.clearRect(-on.left,-on.top,Ut[0],Ut[1]),h&&(e.globalAlpha=null!==(t=null==bt?void 0:bt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==le&&!st){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=le||(t&&"transparent"!==t?t:null),i=o?yt(e,o):null;i&&(e.fillStyle=i,e.fillRect(-on.left,-on.top,Ut[0],Ut[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,ln,an),e.clip()),at&&i.scales)for(const t of at)e.save(),t(e,i.scene,i.scales,{width:ln,height:an}),e.restore();const o=zt?Wo.custom:Wo[C];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:ln,height:an});e.restore(),h&&(e.globalAlpha=1)}}{const e=po(o,Ut,on,c);if(e&&(e.clearRect(-on.left,-on.top,Ut[0],Ut[1]),un&&mn.current&&i.scales&&function(e,t,n,o,i,r,s){var l;if(!1===i.crosshair)return;const a=t.allSeries,c=a&&a.length>0,u=null!==(l=t.xPx)&&void 0!==l?l:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,mn.current,ln,an,"object"==typeof un?un:{},vn.current,u),vn.current&&Array.isArray(Ie))){const t=Ie.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s="group"in n?n.group:void 0;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,vn.current,t,u)}}a&&n&&n.setAttribute("aria-label",Wn(i.scene,C+" chart"));const f=$t.current;if($t.current=!1,f&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!pn||e(pn.x.domain()[0])!==e(i.scales.x.domain()[0])||e(pn.x.domain()[1])!==e(i.scales.x.domain()[1])||e(pn.y.domain()[0])!==e(i.scales.y.domain()[0])||e(pn.y.domain()[1])!==e(i.scales.y.domain()[1])||pn.x.range()[0]!==i.scales.x.range()[0]||pn.x.range()[1]!==i.scales.x.range()[1]||pn.y.range()[0]!==i.scales.y.range()[0]||pn.y.range()[1]!==i.scales.y.range()[1])&&yn(i.scales),_t){const e=i.getData(),t="function"==typeof L?L:e=>e[L||"x"],n="function"==typeof N?N:e=>e[N||"y"];zn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Rn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}f&&Ge&&Ge.length>0&&gn(e=>e+1),(null==bt?void 0:bt.showBadge)&&In(!!h),(l||null!=i.activeTransition||i.hasActivePulses)&&(en.current=requestAnimationFrame(()=>tn.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:a}=e;_n(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,l.current()},[t,n]);const c=i(a);c.current=a,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:Gt,wasHydratingFromSSR:Xt,storeRef:Xn,dirtyRef:$t,renderFnRef:tn,cleanup:()=>{var e;return null===(e=qn.current)||void 0===e?void 0:e.clear()}}),s(()=>{$t.current=!0,nn()},[C,ln,an,_e,le,ae,at,nn]),function(e,t,n,o,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const l=t.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,u=a-l.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,i,o])}(bt,Xn,$t,nn,Hn,In);const bo=r(()=>{if(Fe||He)return;const e=Xn.current;return(null==e?void 0:e.xIsDate)&&pn?Ho(pn.x.domain()):void 0},[Fe,He,pn]),xo=Fe||He||bo,ko=un&&bn?De?De(bn):e(Ro,{hover:bn}):null,wo=ko?e(co,{x:bn.x,y:bn.y,containerWidth:ln,containerHeight:an,margin:on,className:"stream-frame-tooltip",children:ko}):null,Ao=fo.current,Oo=e(eo,{active:ho.current>=0,hoverPoint:bn,margin:on,size:Ut,shape:null==Ao?void 0:Ao.shape,width:null==Ao?void 0:Ao.w,height:null==Ao?void 0:Ao.h}),So=Bo(L,K,"__semiotic_resolvedX","__semiotic_resolvedTime"),Co=Bo(N,R,"__semiotic_resolvedY","__semiotic_resolvedValue"),jo=So.key,_o=Co.key,Mo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(So,Co,Ge&&Ge.length>0||!1);if(jn||!Gt&&Xt){const n=Xn.current;n&&_&&(n.ingest({inserts:cn,bounded:!0}),n.computeScene({width:ln,height:an}));const i=null!==(u=null==n?void 0:n.scene)&&void 0!==u?u:[],r=null!==(h=null==n?void 0:n.scales)&&void 0!==h?h:null,s=xo||(()=>{if((null==n?void 0:n.xIsDate)&&r)return Ho(r.x.domain())})();return t("div",{ref:qt,className:"stream-xy-frame"+(se?" "+se:""),role:"img","aria-label":Ht||("string"==typeof ut?ut:"XY chart"),style:{position:"relative",width:oe?"100%":Ut[0],height:ie?"100%":Ut[1]},children:[e(Kn,{summary:Wt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ut[0],height:Ut[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${on.left},${on.top})`,children:sn}),t("g",{transform:`translate(${on.left},${on.top})`,children:[le&&e("rect",{x:0,y:0,width:ln,height:an,fill:le}),ct&&r&&ct.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:ln,height:an})},"svgpre-"+n)),i.map((n,o)=>function(n,o,i){var r,s,l,a,c;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const n=`${i?i+"-":""}area-clip-${o}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:n,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:Cn(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+o)}return e("path",{d:u,fill:Cn(c.style.fill),fillOpacity:null!==(a=null!==(l=c.style.fillOpacity)&&void 0!==l?l:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Cn(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Cn(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,l]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),a=.299*r+.587*s+.114*l>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),l=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:l,stroke:l,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o,Rt)).filter(Boolean)]})]}),e(On,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,scales:r,showAxes:_e,axes:Me,xLabel:Pe,yLabel:Le,yLabelRight:Ne,xFormat:s,yFormat:Be||We,axisExtent:Te,showGrid:Ve,title:ut,legend:qe,legendHoverBehavior:Ke,legendClickBehavior:Qe,legendHighlightedCategory:Ze,legendIsolatedCategories:Je,legendPosition:et,legendLayout:tt,foregroundGraphics:it(rn,null===(f=Xn.current)||void 0===f?void 0:f.customLayoutOverlays),marginalGraphics:_t,xValues:[],yValues:[],annotations:Ge,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:jo,yAccessor:_o,annotationData:Mo(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof W?W:void 0,linkedCrosshairName:It,linkedCrosshairSourceId:Dt})]})}return t("div",{ref:qt,className:"stream-xy-frame"+(se?" "+se:""),role:"group","aria-label":Ht||("string"==typeof ut?ut:"XY chart"),tabIndex:0,style:{position:"relative",width:oe?"100%":Ut[0],height:ie?"100%":Ut[1],overflow:"visible"},onKeyDown:mo,children:[Tt&&e(Qn,{tableId:Jt}),Tt&&e(Un,{scene:null!==(m=null===(y=Xn.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],chartType:C+" chart",tableId:Jt,chartTitle:"string"==typeof ut?ut:void 0}),e(Kn,{summary:Wt}),t("div",{role:"img","aria-label":Ht||("string"==typeof ut?ut:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:un?vo:void 0,onMouseLeave:un?lo:void 0,onClick:Ee?uo:void 0,children:[sn&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ut[0],height:Ut[1],pointerEvents:"none"},children:e("g",{transform:`translate(${on.left},${on.top})`,children:sn})}),e(kn,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,scales:pn,showAxes:_e,axes:Me,showGrid:Ve,xFormat:xo,yFormat:Be||We,axisExtent:Te}),e("canvas",{ref:dn,"aria-label":Wn(null!==(b=null===(v=Xn.current)||void 0===v?void 0:v.scene)&&void 0!==b?b:[],C+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:hn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Zn,{hoverPoint:bn}),e(On,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,scales:pn,showAxes:_e,axes:Me,xLabel:Pe,yLabel:Le,yLabelRight:Ne,xFormat:xo,yFormat:Be||We,axisExtent:Te,showGrid:Ve,title:ut,legend:qe,legendHoverBehavior:Ke,legendClickBehavior:Qe,legendHighlightedCategory:Ze,legendIsolatedCategories:Je,legendPosition:et,legendLayout:tt,foregroundGraphics:it(rn,null===(x=Xn.current)||void 0===x?void 0:x.customLayoutOverlays),marginalGraphics:_t,xValues:Dn,yValues:En,annotations:Ge,svgAnnotationRules:Xe,annotationFrame:fn,xAccessor:jo,yAccessor:_o,annotationData:Mo(null===(k=Xn.current)||void 0===k?void 0:k.getData()),pointNodes:null===(w=Xn.current)||void 0===w?void 0:w.scene.filter(e=>"point"===e.type),curve:"string"==typeof W?W:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==le&&!st,linkedCrosshairName:It,linkedCrosshairSourceId:Dt}),(ht||ft)&&e($,{width:ln,height:an,totalWidth:Ut[0],totalHeight:Ut[1],margin:on,dimension:null!==(A=null==ht?void 0:ht.dimension)&&void 0!==A?A:"xy",scales:pn,onBrush:null!=ft?ft:()=>{},binSize:E,snap:null==ht?void 0:ht.snap,binBoundaries:null!==(O=null==ht?void 0:ht.binBoundaries)&&void 0!==O?O:"bar"===C?null===(S=Xn.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==ht?void 0:ht.snapDuring,streaming:"streaming"===j}),(null==bt?void 0:bt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===bt.badgePosition?{top:4,left:4}:"bottom-left"===bt.badgePosition?{bottom:4,left:4}:"bottom-right"===bt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Hn?"#dc3545":"#28a745",color:"white"}),children:Hn?"STALE":"LIVE"}),Oo,wo]})]})});$o.displayName="StreamXYFrame";const Yo=u(null);function Go({colors:t,categories:n,colorScheme:o="category10",children:i}){const s=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:Fe[o]||Be,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e(Yo.Provider,{value:s,children:i})}function Xo(){return l(Yo)}function Vo(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function qo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}Go.displayName="CategoryColorProvider";const[Uo,Ko]=V(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=qo(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=qo(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Qo,Zo]=V(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Jo(e){const t=g(),n=e.clientId||t,{name:o}=e,i=Ko(e=>e.selections.get(o)),s=Ko(e=>e.setClause),l=Ko(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Vo(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:a(()=>{l(o,n)},[l,o,n]),clientId:n}}function ei(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=Jo({name:t});return{onHover:a(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}function ti(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function ni(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:l,clear:c}=Jo({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=a(e=>{if(!e)return void c();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&ti(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&ti(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}const oi=u(!1),ii=u(null),ri="undefined"==typeof window?s:h;function si(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function li(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function ai({selections:e}){const t=Ko(e=>e.setResolution);return s(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function ci({categoryColors:t,interaction:n,selectionName:o,field:l}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],f=ei({name:o,fields:[l]}),g=Jo({name:o,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[m,v]=d(null),b=i(g.selectPoints);b.current=g.selectPoints;const x=i(g.clear);x.current=g.clear,s(()=>{"isolate"===n&&(p.size>0?b.current({[l]:Array.from(p)}):x.current())},[n,p,l]);const k=a(e=>{"highlight"===n&&(e?(v(e.label),f.onHover({[l]:e.label})):(v(null),f.onHover(null)))},[n,l,f]),w=a(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[O]]=uo([0,0],!0,!1),S=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(c.map(([e])=>e),O),[c,O]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*S+8),style:{display:"block",overflow:"visible"},children:e(Et,{legendGroups:h,title:!1,orientation:"horizontal",width:O,height:20,customHoverBehavior:"highlight"===n?k:void 0,customClickBehavior:"isolate"===n?w:void 0,highlightedCategory:m,isolatedCategories:p})})})}function ui({children:n,selections:o,showLegend:s,legendPosition:l="top",legendInteraction:a="none",legendSelectionName:c="legend",legendField:u="category"}){const h=Xo(),[f,g]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const n=si(t);g(t=>{var o;return li(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{g(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(f))for(const n of t)e.push(n);return si(e)},[f]),v=r(()=>{var e;const t=null!=h?h:{},n=p.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of m)t[e]||n[e]||(n[e]=Be[o%Be.length],o++);const i=Object.assign({},t);for(const o of m)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[h,m]),b=void 0===s||s,x=b&&Object.keys(v).length>0;return e(Uo,{children:t(Qo,{children:[o&&e(ai,{selections:o}),e(ii.Provider,{value:y,children:e(Go,{colors:v,children:t(oi.Provider,{value:x,children:[b&&"top"===l&&e(ci,{categoryColors:v,interaction:a,selectionName:c,field:u}),n,b&&"bottom"===l&&e(ci,{categoryColors:v,interaction:a,selectionName:c,field:u})]})})})]})})}function di(e){return e?"string"==typeof e?{name:e}:e:null}function hi(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function fi(){return oe(e=>e.theme)}o.createContext(void 0);const gi="#007bff";function pi(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function yi(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function mi(){var e;const t=fi(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function vi(e,t,n){const o=Xo(),i=mi();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=Ie(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return Ie(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=Ie(e,t,s);return e=>o[e]||n(e)}return Ie(e,t,s)}if(o&&Object.keys(o).length>0){const e=Ie([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}function bi({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:l,chartId:c,onClick:u,hoverHighlight:h,colorByField:f}){const p=g(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=Jo({name:(null==e?void 0:e.name)||"__unused__"}),v=ei({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=Zo(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=d(null),A=f||n[0],O=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,A]),S=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=pi(e,t,y.xField);null!=n&&function(e,t,n){const o=rn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(rn={positions:new Map(rn.positions).set(e,{xValue:t,sourceId:n})},ln())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&an(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const r=yi(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,v,y,p,i,l,c,b,h,A]),C=a(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=pi(e,t,y.xField);null!=n&&function(e,t,n){const o=rn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(rn.positions);return t.delete(e),rn={positions:t},ln(),!1}rn={positions:new Map(rn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},ln()}(y.name||"hover",n,p)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const n=yi(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[u,i,b,l,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{cn(e,p),an(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:p}}function xi(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function ki({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:s="right",userMargin:a,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=l(oi),h=null!==l(ii),f=void 0!==o?o:!d&&!!t,p=!!t&&(f||h),y=r(()=>{if(!p)return[];if(void 0!==u)return u;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[u,t,e,p]);!function(e){const t=l(ii),n=g(),o=si(e),r=i([]);li(r.current,o)||(r.current=o);const s=r.current;ri(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),ri(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?y:[]);const m=r(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=s?o(s,t,n):n?n(i):Te[r%Te.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:We,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),v=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=t=>{const n=e[t];return"number"==typeof n?n:c[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return m&&("right"===s&&!o("right")&&110>n.right?n.right=110:"left"===s&&!o("left")&&110>n.left?n.left=110:"top"===s&&!o("top")&&50>n.top?n.top=50:"bottom"===s&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[c,a,m,s]);return{legend:m,margin:v,legendPosition:s}}function wi(e,t,n){const[o,i]=d(null),[s,l]=d(new Set),c=a(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=a(t=>{"isolate"===e&&l(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:u,legendSelectionHook:h}}const Ai={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Oi(e,t,n){var o,i,r,s,l,a,c;const u=Ai[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Si(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Si(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Ci(e){return"string"==typeof e?e:"value"}function ji(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function _i(e,t){if(!t)return ji(e);try{const n=t(e);return null==n?ji(e):n}catch(t){return ji(e)}}function Mi(e,t){return"function"==typeof t?t(e):e[t]}function Pi(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),n}function Li(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const s=o?_i(Mi(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:oo,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((n,o)=>{const i=_i(Mi(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function Ni({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Fi extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(Ni,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Bi;const Ti="undefined"!=typeof process&&"production"!==(null===(Bi=process.env)||void 0===Bi?void 0:Bi.NODE_ENV);function Hi({componentName:t,width:n,height:o,children:i}){return e(Fi,{fallback:i=>e(Ni,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Wi={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Ii={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Di(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Wi),{width:n,height:o}),children:i||"No data available"}):null}function zi(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),l=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+l)-l))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ii),{position:"absolute",top:a+o*(s+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function Ei(e,t,n,o){if(!Ti)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Ri(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function $i(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Ri(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Yi({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=$i(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Gi(e){const t=oe(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Xi(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:s,legendPosition:l,selection:c,linkedHover:u,fallbackFields:h,unwrapData:f=!1,onObservation:g,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,loadingContent:A,emptyContent:O,width:S,height:C}=e,j=void 0===n,_=r(()=>G(t),[t]),[M,P]=d([]),L=a(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),N="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:F,hoverSelectionHook:B,customHoverBehavior:T,customClickBehavior:H,crosshairSourceId:W}=bi({selection:c,linkedHover:u,fallbackFields:h,unwrapData:f,onObservation:g,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:N}),I=xi(u,W),D=vi(_,o,i),z=r(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),E=r(()=>j&&M.length>0?M:z,[j,M,z]),R=wi(s,o,E),$=r(()=>B||(R.legendSelectionHook?R.legendSelectionHook:F),[B,R.legendSelectionHook,F]),Y=Gi(c),X=mi(),V=Xo(),q=r(()=>{if(D)return D;if(!o||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:X&&X.length>0?X:Te,t="__streamCat",n=Ie(E.map(e=>({[t]:e})),t,e);return e=>(null==V?void 0:V[e])||n(e)||"#999"},[D,o,E,i,X,V]),{legend:U,margin:K,legendPosition:Q}=ki({data:_,colorBy:o,colorScale:q,showLegend:m,legendPosition:l,userMargin:v,defaults:b,categories:E}),Z=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),s&&"none"!==s&&(e.legendHoverBehavior=R.onLegendHover,e.legendClickBehavior=R.onLegendClick,e.legendHighlightedCategory=R.highlightedCategory,e.legendIsolatedCategories=R.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[U,Q,s,R.onLegendHover,R.onLegendClick,R.highlightedCategory,R.isolatedCategories,j,o,L]),J=Array.isArray(n)?G(n):n,ee=zi(w,S,C,A),te=ee?null:Di(J,S,C,O);return{data:_,colorScale:D,allCategories:E,legendState:R,effectiveSelectionHook:$,activeSelectionHook:F,customHoverBehavior:T,customClickBehavior:H,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:I,resolvedSelection:Y}}function Vi(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function qi(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:i,resolveStroke:s,fillArea:l,areaOpacity:a=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f}=e,g=r(()=>(e,r)=>{const c={strokeWidth:t},u=!0===l||Array.isArray(l)&&null!=r&&l.includes(r);let d;return s?d=s(e,r):n?o&&(d=We(e,n,o)):d=i||gi,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=a)),c},[t,n,o,i,s,l,a]),p=r(()=>Vi(g,{stroke:c,strokeWidth:u,opacity:d}),[g,c,u,d]);return r(()=>hi(p,null!=h?h:null,f),[p,h,f])}function Ui(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const l=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of l){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function Ki(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,l)}a((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Qi="__forecastSegment";let Zi=null;function Ji(){return Ki(this,void 0,void 0,function*(){return Zi||(Zi=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),Zi})}const er="__semiotic_resolvedX",tr="__semiotic_resolvedY";function nr(e){const{data:t,xAccessor:n,yAccessor:o,forecast:l,anomaly:a,groupBy:c}=e,u="string"==typeof n?n:er,h="string"==typeof o?o:tr,f=r(()=>{if(!l&&!a)return t;const e="function"==typeof n,i="function"==typeof o;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[er]=n(t)),i&&(r[tr]=o(t)),r}):t},[t,l,a,n,o]),[g,p]=d(null),[y,m]=d([]),v=i(l),b=i(a);return s(()=>{if(!l&&!a)return void((v.current||b.current)&&(p(null),m([]),v.current=l,b.current=a));let e=!1;const t=l!==v.current||a!==b.current;if(v.current=l,b.current=a,t&&(p(null),m([])),l){const t=c&&"string"==typeof c&&"object"==typeof l?Object.assign(Object.assign({},l),{_groupBy:c}):l;(function(...e){return Ki(this,void 0,void 0,function*(){return(yield Ji()).buildForecast(...e)})})(f,u,h,t,a).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else a&&function(...e){return Ki(this,void 0,void 0,function*(){return(yield Ji()).buildAnomalyAnnotations(...e)})}(a).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[f,l,a,u,h,c]),{effectiveData:g?g.processedData:t,statisticalAnnotations:y,hasForecast:!!g,xAccessorKey:u,yAccessorKey:h}}const or=f(function(t,n){var o,l;const c=i(null);Ui(n,{variant:"xy",frameRef:c});const u=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:f,className:g,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:O="linear",showPoints:S=!1,pointRadius:C=3,fillArea:j=!1,areaOpacity:_=.3,lineWidth:M=2,lineGradient:P,tooltip:L,pointIdAccessor:N,annotations:F,directLabel:B,gapStrategy:T="break",anomaly:H,forecast:W,band:I,xExtent:D,yExtent:z,frameProps:E={},selection:R,linkedHover:$,onObservation:Y,onClick:X,hoverHighlight:V,hoverRadius:q,chartId:U,loading:K,loadingContent:Q,emptyContent:Z,legendInteraction:J,legendPosition:ee,xScaleType:te,yScaleType:ne,color:oe,stroke:ie,strokeWidth:re,opacity:se}=t,{width:le,height:ae,enableHover:ce,showGrid:ue,showLegend:de,title:he,description:fe,summary:ge,accessibleTable:pe,xLabel:ye,yLabel:me}=u,ve=r(()=>G(h),[h]);Ei("LineChart",ve,"xAccessor",v),Ei("LineChart",ve,"yAccessor",b);const{effectiveData:be,statisticalAnnotations:xe}=nr({data:ve,xAccessor:v,yAccessor:b,forecast:W,anomaly:H,groupBy:x}),ke="__compoundGroup",we=!(!W||!x),Ae=we?ke:W?Qi:x,Oe=r(()=>{if(!we)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const n=Object.assign({},t);return n[ke]=`${e(t)}__${t[Qi]||"observed"}`,n})},[be,we,x]),Se=we?Oe:be,Ce=w||x,je=r(()=>{if(!W)return;const e=W.upperBounds,t=W.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[W,be,b]),_e=a(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Me=void 0!==(null===(o=Se[0])||void 0===o?void 0:o[k]),Pe=r(()=>{if(Me)return Se;if(Ae){const e=Se.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[k]:[]};"string"==typeof Ae&&(o[Ae]=n),we&&(o[Qi]=t[Qi],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Se}]},[Se,Ae,k,Me]),{gapProcessedLineData:Le,hasGaps:Ne}=r(()=>{if("interpolate"===T){let e=!1;const t=[];for(const n of Pe){const o=(n[k]||[]).filter(t=>!_e(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const n of Pe){const o=n[k]||[];let i=[],r=0;const s=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const l of o)if(_e(l))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},l),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Pe){const i=o[k]||[],r=[];for(const n of i)_e(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[k]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Pe,hasGaps:!1}},[Pe,T,k,_e,Ae,b]),Fe="object"==typeof B?B:{},Be=Fe.position||"end",Te=Fe.fontSize||11,He=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof Ce?Ce:e=>e[Ce],n=new Set;for(const o of Le){const i=o[k]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Be?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const s=r+"";""!==s&&n.add(s)}return Array.from(n)},[B,Ce,Le,k,Be]),Ie=r(()=>{if(!B)return u.marginDefaults;const e=He.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0)+10,t="end"===Be?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[t]:Math.max(u.marginDefaults[t]||0,e)})},[B,He,Te,Be,u.marginDefaults]),De=Xi({data:be,rawData:h,colorBy:Ce,colorScheme:A,legendInteraction:J,legendPosition:ee,selection:R,linkedHover:$,fallbackFields:Ce?["string"==typeof Ce?Ce:""]:[],unwrapData:!1,onObservation:Y,onClick:X,hoverHighlight:V,chartType:"LineChart",chartId:U,showLegend:(!B||void 0!==de)&&de,userMargin:f,marginDefaults:Ie,loading:K,loadingContent:Q,emptyContent:Z,width:le,height:ae}),ze=De.colorScale,Ee=De.customHoverBehavior,Re=De.customClickBehavior,$e=De.crosshairProps,Ye=qi({lineWidth:M,colorBy:Ce,colorScale:ze,color:oe,fillArea:j,areaOpacity:_,stroke:ie,strokeWidth:re,opacity:se,effectiveSelectionHook:De.effectiveSelectionHook,resolvedSelection:De.resolvedSelection}),[Ge,Xe]=d(null);s(()=>{if(!W)return void Xe(null);let e=!1;return function(...e){return Ki(this,void 0,void 0,function*(){return(yield Ji()).createSegmentLineStyle(...e)})}(Ye,W).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,W]);const Ve=Ge||Ye,qe=r(()=>{if(S)return e=>{const t={r:C,fillOpacity:1};return Ce?ze&&(t.fill=We(e.parentLine||e,Ce,ze)):t.fill=oe||gi,t}},[S,C,Ce,ze,oe]),Ue=Array.isArray(j)?"mixed":j?"area":"line",Ke=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof v?v:e=>e[v],n="function"==typeof b?b:e=>e[b],o="function"==typeof Ce?Ce:e=>e[Ce],i=new Map;for(const t of Le){const n=t[k]||[];if(0===n.length)continue;const r="end"===Be?n[n.length-1]:n[0],s=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==s)continue;const l=s+"";""===l||i.has(l)||i.set(l,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(o),["string"==typeof b?b:"y"]:n(o),dx:"end"===Be?6:-6,dy:0,color:ze?ze(e):gi,fontSize:Te}));r.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",n=r[e-1],o=r[e];Te+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Te+2)}return r},[B,Ce,ze,Le,k,v,b,Be,Te]),Qe=De.margin,Ze=x||w,Je=r(()=>Li([{label:ye||Ci(v),accessor:v,role:"x",format:p},{label:me||Ci(b),accessor:b,role:"y",format:y},...Ze?[{label:Ci(Ze),accessor:Ze,role:"group"}]:[],...Pi(I,y)]),[v,b,ye,me,Ze,p,y,I]),et=Yi({componentName:"LineChart",data:Me?(null===(l=be[0])||void 0===l?void 0:l[k])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),tt=r(()=>Me||Ae||Ne?Le.flatMap(e=>{const t=e[k]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Se,[Le,k,Me,Ae,Se,Ne]),nt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ue},Array.isArray(j)&&{areaGroups:j}),P&&{lineGradient:P}),null!=q&&{hoverRadius:q}),null!=h&&{data:tt}),{xAccessor:v,yAccessor:b,xScaleType:te,yScaleType:ne}),D&&{xExtent:D}),!z||null==z[0]&&null==z[1]?je?{yExtent:je}:{}:{yExtent:z}),{groupAccessor:"break"===T&&Ne?"_gapSegment":Ae||void 0}),I&&{band:I}),{curve:O,lineStyle:Ve}),S&&{pointStyle:qe}),{size:[le,ae],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Qe,showAxes:u.showAxes,xLabel:ye,yLabel:me,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),{enableHover:ce,showGrid:ue}),De.legendBehaviorProps),he&&{title:he}),fe&&{description:fe}),ge&&{summary:ge}),void 0!==pe&&{accessibleTable:pe}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?lo():ao(L)||Je}),"multi"===L&&{tooltipMode:"multi"}),($||Y||X||V)&&{customHoverBehavior:Ee}),(Y||X||$)&&{customClickBehavior:Re}),N&&{pointIdAccessor:N}),((null==F?void 0:F.length)||xe.length||Ke.length)&&{annotations:[...F||[],...xe,...Ke]}),$e),E);return De.earlyReturn?De.earlyReturn:et?e(Ni,{componentName:"LineChart",message:et,width:le,height:ae}):e(Hi,{componentName:"LineChart",width:le,height:ae,children:e($o,Object.assign({ref:c},nt))})});function ir(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:l}=e,a={};return t&&(a.title=t),n&&(a.description=n),o&&(a.summary=o),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),void 0!==l&&(a.axisExtent=l),a}function rr(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:l=!0}=e,a={};return(t||n||o||i)&&(a.customHoverBehavior=r),(l?n||o||t:n||o)&&(a.customClickBehavior=s),a}function sr(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:ao(t)||n}}function lr(e){var t;const{safeData:n,data:o,areaBy:i,lineDataAccessor:s,colorBy:l,colorScale:a,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:O,yFormat:S,groupField:C}=e,j=void 0!==(null===(t=n[0])||void 0===t?void 0:t[s]),_=r(()=>{if(null==o)return[];if(!j&&!i)return n;let e;if(j)e=n;else{const t=i,o=n.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[s]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][s].push(n),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[s]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[o,n,i,s,j]),M=r(()=>e=>{const t={};if(l){if(a){const n=We(e,l,a);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||gi;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[l,a,c,p,y,m]),P=r(()=>Vi(M,{stroke:u,strokeWidth:d,opacity:h}),[M,u,d,h]);return{flattenedData:_,lineStyle:r(()=>hi(P,null!=f?f:null,g),[P,f,g]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return l?a&&(t.fill=We(e.parentLine||e,l,a)):t.fill=c||gi,t}},[v,b,l,a,c]),defaultTooltipContent:r(()=>Li([{label:w||Ci(x),accessor:x,role:"x",format:O},{label:A||Ci(k),accessor:k,role:"y",format:S},...C?[{label:Ci(C),accessor:C,role:"group"}]:[],...Pi(e.band,S)]),[x,k,w,A,C,O,S,e.band])}}function ar(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}or.displayName="LineChart";const cr=f(function(t,n){const o=i(null);Ui(n,{variant:"xy",frameRef:o});const s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",areaBy:g,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:O=!0,lineWidth:S=2,showPoints:C=!1,pointRadius:j=3,tooltip:_,annotations:M,forecast:P,anomaly:L,band:N,xExtent:F,yExtent:B,frameProps:T={},selection:H,linkedHover:W,onObservation:I,onClick:D,hoverHighlight:z,chartId:E,loading:R,loadingContent:$,emptyContent:Y,legendInteraction:X,legendPosition:V,color:q,stroke:U,strokeWidth:K,opacity:Q}=t,{width:Z,height:J,enableHover:ee,showGrid:te,showLegend:ne,title:oe,description:ie,summary:re,accessibleTable:se,xLabel:le,yLabel:ae}=s,ce=r(()=>G(l),[l]),ue=b||g,de=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:ar(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);Ei("AreaChart",ce,"xAccessor",h),Ei("AreaChart",ce,"yAccessor",f);const he=Xi({data:ce,rawData:l,colorBy:ue,colorScheme:x,legendInteraction:X,legendPosition:V,selection:H,linkedHover:W,fallbackFields:ue?["string"==typeof ue?ue:""]:[],unwrapData:!1,onObservation:I,onClick:D,hoverHighlight:z,chartType:"AreaChart",chartId:E,showLegend:ne,userMargin:a,marginDefaults:s.marginDefaults,loading:R,loadingContent:$,emptyContent:Y,width:Z,height:J}),{effectiveData:fe,statisticalAnnotations:ge}=nr({data:ce,xAccessor:h,yAccessor:f,forecast:P,anomaly:L,groupBy:g}),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ve}=lr({safeData:fe,data:l,areaBy:g,lineDataAccessor:v,colorBy:ue,colorScale:he.colorScale,color:q,stroke:U,strokeWidth:K,opacity:Q,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,areaOpacity:w,showLine:O,lineWidth:S,showPoints:C,pointRadius:j,xAccessor:h,yAccessor:f,xLabel:le,yLabel:ae,xFormat:u,yFormat:d,groupField:g||b,band:N}),be=Yi({componentName:"AreaChart",data:l,accessors:{xAccessor:h,yAccessor:f}}),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:pe}),{xAccessor:h,yAccessor:f,groupAccessor:g||void 0}),p&&{y0Accessor:p}),N&&{band:N}),de&&{gradientFill:de}),A&&{lineGradient:A}),{curve:k,lineStyle:ye}),C&&me&&{pointStyle:me}),{size:[Z,J],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:he.margin,showAxes:s.showAxes,xLabel:le,yLabel:ae,xFormat:u,yFormat:d,enableHover:ee}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:te}),he.legendBehaviorProps),ir({title:oe,description:ie,summary:re,accessibleTable:se,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===_?{tooltipContent:lo(),tooltipMode:"multi"}:sr({tooltip:_,defaultTooltipContent:ve})),rr({linkedHover:W,onObservation:I,onClick:D,hoverHighlight:z,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior})),(M&&M.length>0||ge.length>0)&&{annotations:[...M||[],...ge]}),F&&{xExtent:F}),B&&{yExtent:B}),he.crosshairProps),T);return he.earlyReturn?he.earlyReturn:be?e(Ni,{componentName:"AreaChart",message:be,width:Z,height:J}):e(Hi,{componentName:"AreaChart",width:Z,height:J,children:e($o,Object.assign({ref:o},xe))})});function ur(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}cr.displayName="AreaChart";const dr=f(function(n,o){const s=i(null),l=Oi(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:h,xFormat:f,yFormat:g,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:k="var(--semiotic-danger, #dc2626)",seriesBColor:w="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:O=1.5,showPoints:S=!1,pointRadius:C=3,curve:j="linear",areaOpacity:_=.6,gradientFill:M,tooltip:P,annotations:L,xExtent:N,yExtent:F,frameProps:B={},selection:T,linkedHover:H,onObservation:W,onClick:I,hoverHighlight:D,chartId:z,loading:E,loadingContent:R,emptyContent:$,legendInteraction:Y,legendPosition:X,pointIdAccessor:V,windowSize:q}=n,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:ie,yLabel:re}=l,se=r(()=>"function"==typeof y?e=>ur(y(e)):e=>ur(e[y]),[y]),le=r(()=>"function"==typeof m?e=>ur(m(e)):e=>ur(e[m]),[m]),ae=r(()=>"function"==typeof v?e=>ur(v(e)):e=>ur(e[v]),[v]),[ce,ue]=d([]),de=i([]),he=null==c,fe=r(()=>G(he?ce:c),[he,ce,c]),ge=r(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let s=0,l=null,a=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>r.push(e),f=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],g=t(r),p=n(r),y=o(r);if(!Number.isFinite(g)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=l){if(a&&a.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-a.a-(y-a.b);if(0!==n){const o=Math.max(0,Math.min(1,(a.b-a.a)/n));e=a.x+o*(g-a.x),t=a.a+o*(p-a.a)}else e=a.x,t=a.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t}),s++,l=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],l)}else for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:r}),a={x:g,a:p,b:y,w:m}}else{l=m;for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:r}),a={x:g,a:p,b:y,w:m}}else c.push({x:g,y:p,datum:r})}for(const e of c)f(e,null!=l?l:"A");return r}(fe,se,le,ae),[fe,se,le,ae]),pe=r(()=>A?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];for(const e of i){const i=t(e),s=n(e),l=o(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(l)&&r.push({__x:i,__y:l,__diffSegment:"line-B"})}return r}(fe,se,le,ae):[],[A,fe,se,le,ae]),ye=r(()=>[...ge,...pe],[ge,pe]),me=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(o,()=>{const e=e=>{const t=q&&e.length>q?e.slice(e.length-q):e;de.current=t,ue(t)},t=V?"function"==typeof V?V:e=>e[V]:null;return{push:t=>e([...de.current,t]),pushMany:t=>e([...de.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of de.current)o.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],r=[],s=de.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>he?de.current:fe,getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[he,fe,V,q]);const ve=Xi({data:fe,rawData:c,colorBy:"__diffWinner",colorScheme:[k,w],legendInteraction:Y,legendPosition:X,selection:T,linkedHover:H,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:W,onClick:I,hoverHighlight:D,chartType:"DifferenceChart",chartId:z,showLegend:J,userMargin:u,marginDefaults:l.marginDefaults,loading:E,loadingContent:R,emptyContent:$,width:U,height:K}),be=r(()=>{if(!1!==J)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:k},{label:x,color:w}]}]}},[J,b,x,k,w]),xe=a(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?k:w,stroke:"none",fillOpacity:_}},[k,w,_]),ke=a(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,strokeWidth:O,fill:"none"}),[k,w,O]),we=a(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,r:C}),[k,w,C]),Ae=a(n=>{var o;const i=n.data,r=n.allSeries,s=null!==(o=n.xValue)&&void 0!==o?o:null==i?void 0:i.__x;let l=null==i?void 0:i.__valA,a=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(l=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(a=t.value)}if(null!=s&&(null==l||null==a)){const e=fe.find(e=>se(e)===s);e&&(null==l&&(l=le(e)),null==a&&(a=ae(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=f&&null!=s?f(s):null!=s?s+"":"";return t("div",{className:"semiotic-tooltip",style:oo,children:[u&&e("div",{style:{fontWeight:600,marginBottom:4},children:u}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(l)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(a)]})]}),null!=l&&null!=a&&Number.isFinite(l)&&Number.isFinite(a)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(l-a)]})]})},[fe,se,le,ae,f,k,w,b,x]),Oe="multi"===P,Se=r(()=>!1===P?()=>null:Oe?Ae:ao(P)||Ae,[P,Oe,Ae]),Ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:ye,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:me,curve:j,areaStyle:xe,lineStyle:ke},S&&{pointStyle:we}),{size:[U,K],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ve.margin,showAxes:l.showAxes,xLabel:ie,yLabel:re,xFormat:f,yFormat:g,enableHover:Q,showGrid:Z}),M&&{gradientFill:!0===M?{topOpacity:.85,bottomOpacity:.15}:M}),be&&{legend:be,legendPosition:ve.legendPosition}),ir({title:ee,description:te,summary:ne,accessibleTable:oe,className:h,animate:n.animate,axisExtent:n.axisExtent})),{tooltipContent:Se}),Oe&&{tooltipMode:"multi"}),rr({linkedHover:H,onObservation:W,onClick:I,hoverHighlight:D,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),N&&{xExtent:N}),F&&{yExtent:F}),ve.crosshairProps),B);return ve.earlyReturn?ve.earlyReturn:e(Hi,{componentName:"DifferenceChart",width:U,height:K,children:e($o,Object.assign({ref:s},Ce))})});"function"==typeof dr&&(dr.displayName="DifferenceChart");const hr=f(function(t,n){const o=i(null),s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",areaBy:g,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:A=3,normalize:O=!1,baseline:S="zero",stackOrder:C,tooltip:j,annotations:_,xExtent:M,yExtent:P,frameProps:L={},selection:N,linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,chartId:W,loading:I,loadingContent:D,emptyContent:z,legendInteraction:E,legendPosition:R,color:$,stroke:Y,strokeWidth:X,opacity:V}=t,{width:q,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=s,re=r(()=>G(l),[l]),se=y||g;Ui(n,{variant:"xy",frameRef:o});const le=Xi({data:re,rawData:l,colorBy:se,colorScheme:m,legendInteraction:E,legendPosition:R,selection:N,linkedHover:F,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:H,chartType:"StackedAreaChart",chartId:W,showLegend:Z,userMargin:a,marginDefaults:s.marginDefaults,loading:I,loadingContent:D,emptyContent:z,width:q,height:U}),{flattenedData:ae,lineStyle:ce,pointStyle:ue,defaultTooltipContent:de}=lr({safeData:re,data:l,areaBy:g,lineDataAccessor:p,colorBy:se,colorScale:le.colorScale,color:$,stroke:Y,strokeWidth:X,opacity:V,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:A,xAccessor:h,yAccessor:f,xLabel:oe,yLabel:ie,xFormat:u,yFormat:d,groupField:g||y}),he=Yi({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:h,yAccessor:f}}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=l&&{data:ae}),{xAccessor:h,yAccessor:f,groupAccessor:g||void 0,curve:v,normalize:O,baseline:O?"zero":S,stackOrder:C,lineStyle:ce}),w&&ue&&{pointStyle:ue}),{size:[q,U],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le.margin,showAxes:s.showAxes,xLabel:oe,yLabel:ie,xFormat:u,yFormat:d,enableHover:K}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:Q}),le.legendBehaviorProps),ir({title:J,description:ee,summary:te,accessibleTable:ne,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===j?{tooltipContent:lo(),tooltipMode:"multi"}:sr({tooltip:j,defaultTooltipContent:de})),rr({linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),_&&_.length>0&&{annotations:_}),M&&{xExtent:M}),P&&{yExtent:P}),le.crosshairProps),L);return le.earlyReturn?le.earlyReturn:he?e(Ni,{componentName:"StackedAreaChart",message:he,width:q,height:U}):e(Hi,{componentName:"StackedAreaChart",width:q,height:U,children:e($o,Object.assign({ref:o},fe))})});function fr(e){const{colorBy:t,colorScale:n,color:o,pointRadius:i=5,radiusFn:s,fillOpacity:l=1,fallbackFill:a,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,u=r?Object.assign({},r):{};if(void 0===u.fillOpacity&&(u.fillOpacity=l),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=We(o,t,n)}}else u.fill=a?a(e):o||gi;return void 0===u.r&&(u.r=s?s(e):i),u},[t,n,o,i,s,l,a,c,p]),m=r(()=>Vi(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return r(()=>hi(m,null!=f?f:null,g),[m,f,g])}function gr(e){const{accessor:t,data:n,isPushMode:o}=e,s=i(null),[l,c]=d(0),u=a(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(s.current?(s.current[0]>i&&(s.current[0]=i,n=!0),i>s.current[1]&&(s.current[1]=i,n=!0)):(s.current=[i,i],n=!0))}n&&c(e=>e+1)},[o,t]),h=a(()=>{o&&(s.current=null,c(e=>e+1))},[o]),f=r(()=>{var e;if(o)return null!==(e=s.current)&&void 0!==e?e:void 0;if(!t||0===n.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,l=-1/0;for(const e of n){const t=i(e);if(null==t)continue;const n="number"==typeof t?t:Number(t);Number.isFinite(n)&&(r>n&&(r=n),n>l&&(l=n))}return Number.isFinite(r)&&Number.isFinite(l)?[r,l]:void 0},[n,t,o,l]);return{domain:f,trackPushed:u,reset:h}}function pr(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}hr.displayName="StackedAreaChart";const yr=f(function(t,n){const s=i(null),l=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:g="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:A=.8,tooltip:O,marginalGraphics:S,pointIdAccessor:C,annotations:j,regression:_,forecast:M,anomaly:P,xExtent:L,yExtent:N,frameProps:F={},selection:B,linkedHover:T,linkedBrush:H,onObservation:W,onClick:I,hoverHighlight:D,chartId:z,loading:E,loadingContent:R,emptyContent:$,legendInteraction:Y,legendPosition:X,color:V,stroke:q,strokeWidth:U,opacity:K}=t,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:se,yLabel:le}=l,ae=r(()=>G(c),[c]),ce=void 0===c,{domain:ue,trackPushed:de,reset:he}=gr({accessor:x,data:ae,isPushMode:ce}),fe=a(e=>{var t;de([e]),null===(t=s.current)||void 0===t||t.push(e)},[de]),ge=a(e=>{var t;de(e),null===(t=s.current)||void 0===t||t.pushMany(e)},[de]);Ui(n,{variant:"xy",frameRef:s,overrides:{push:fe,pushMany:ge,clear:()=>{var e;he(),null===(e=s.current)||void 0===e||e.clear()}},deps:[fe,ge,he]});const pe=Xi({data:ae,rawData:c,colorBy:v,colorScheme:b,legendInteraction:Y,legendPosition:X,selection:B,linkedHover:T,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:W,onClick:I,hoverHighlight:D,chartType:"Scatterplot",chartId:z,showLegend:te,userMargin:u,marginDefaults:l.marginDefaults,loading:E,loadingContent:R,emptyContent:$,width:Q,height:Z}),ye=di(H),me=ni({name:(null==ye?void 0:ye.name)||"__unused_brush__",xField:(null==ye?void 0:ye.xField)||("string"==typeof g?g:void 0),yField:(null==ye?void 0:ye.yField)||("string"==typeof p?p:void 0)}),ve=ye?"xyBrush"===me.brushInteraction.brush?"xy":"xBrush"===me.brushInteraction.brush?"x":"y":void 0,be=o.useRef(me.brushInteraction);be.current=me.brushInteraction;const xe=a(e=>{const t=be.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(pe.earlyReturn)return pe.earlyReturn;Ei("Scatterplot",ae,"xAccessor",g),Ei("Scatterplot",ae,"yAccessor",p);const ke=r(()=>x?null!=ue?ue:[0,1]:void 0,[x,ue]),we=r(()=>x?e=>De(e,x,k,ke):void 0,[x,k,ke]),Ae=fr({colorBy:v,colorScale:pe.colorScale,color:V,pointRadius:w,fillOpacity:A,radiusFn:we,stroke:q,strokeWidth:U,opacity:K,effectiveSelectionHook:pe.effectiveSelectionHook,resolvedSelection:pe.resolvedSelection}),Oe=r(()=>Li([{label:se||Ci(g),accessor:g,role:"x",format:h},{label:le||Ci(p),accessor:p,role:"y",format:f},...v?[{label:Ci(v),accessor:v,role:"color"}]:[],...x?[{label:Ci(x),accessor:x,role:"size"}]:[]]),[g,p,se,le,v,x,h,f]),{effectiveData:Se,statisticalAnnotations:Ce}=nr({data:ae,xAccessor:g,yAccessor:p,forecast:M,anomaly:P}),je=r(()=>{const e=pr(_);return e||0!==Ce.length?[...e?[e]:[],...j||[],...Ce]:j},[_,j,Ce]),_e=Yi({componentName:"Scatterplot",data:c,accessors:{xAccessor:g,yAccessor:p}});if(_e)return e(Ni,{componentName:"Scatterplot",message:_e,width:Q,height:Z});const Me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:Se}),{xAccessor:g,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:Ae,colorScheme:b,size:[Q,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe.margin,showAxes:l.showAxes,xLabel:se,yLabel:le,xFormat:h,yFormat:f,enableHover:J,showGrid:ee}),pe.legendBehaviorProps),ir({title:ne,description:oe,summary:ie,accessibleTable:re,className:d,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:O,defaultTooltipContent:Oe})),rr({linkedHover:T,onObservation:W,onClick:I,hoverHighlight:D,customHoverBehavior:pe.customHoverBehavior,customClickBehavior:pe.customClickBehavior})),S&&{marginalGraphics:S}),C&&{pointIdAccessor:C}),je&&je.length>0&&{annotations:je}),L&&{xExtent:L}),N&&{yExtent:N}),ye&&{brush:{dimension:ve},onBrush:xe}),pe.crosshairProps),F);return e(Hi,{componentName:"Scatterplot",width:Q,height:Z,children:e($o,Object.assign({ref:s},Me))})});function mr(e,t){return je(1===t?.5:e/(t-1))}yr.displayName="Scatterplot";const vr=f(function(t,o){var s,l;const a=i(null);Ui(o,{variant:"xy",frameRef:a});const c=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:f,yFormat:g,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,regression:A,forecast:O,anomaly:S,xExtent:C,yExtent:j,frameProps:_={},selection:M,linkedHover:P,onObservation:L,onClick:N,hoverHighlight:F,chartId:B,loading:T,loadingContent:H,emptyContent:W,legendInteraction:I,stroke:D,strokeWidth:z,opacity:E}=t,{width:R,height:$,enableHover:Y,showGrid:G,title:X,description:V,summary:q,accessibleTable:U,xLabel:K,yLabel:Q}=c,Z=u||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let n=Z;if(m&&Z.length>0){const e="function"==typeof m?m:e=>e[m];n=[...Z].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const s of n){const n=e(s),l=t(s);null!=n&&null!=l&&isFinite(n)&&isFinite(l)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Z,m,p,y]);Ei("ConnectedScatterplot",J,"xAccessor",p),Ei("ConnectedScatterplot",J,"yAccessor",y);const te=Xi({data:J,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:M,linkedHover:P,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:N,hoverHighlight:F,chartType:"ConnectedScatterplot",chartId:B,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:T,loadingContent:H,emptyContent:W,width:R,height:$}),ne=null!==(l=null===(s=te.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==l?l:.5,oe=r(()=>(e,t)=>{var n,o,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const l=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.isActive,a=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=s[t],o=s[t+1],d=mr(t,u),h=!l||!a||a(null!==(i=n.datum)&&void 0!==i?i:n)||a(null!==(r=o.datum)&&void 0!==r?r:o),f=l?h?1:ne:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*f,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=f,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,ne]),ie=r(()=>[oe],[oe]),re=r(()=>(t,o,i)=>{var r,s;const l=t.filter(e=>"point"===e.type);if(2>l.length)return null;const a=l.length,c=100>a,u=[];for(let t=0;a-1>t;t++){const n=l[t],o=l[t+1],i=mr(t,a),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,f=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*f},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:f},"seg-"+t))}return e(n,{children:u})},[b]),se=r(()=>[re],[re]),le=r(()=>e=>{var t,n;const o=ee.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?mr(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),ae=fr({colorScale:void 0,baseStyleExtras:le,stroke:D,strokeWidth:z,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),ue=r(()=>Li([{label:K||Ci(p),accessor:p,role:"x",format:f},{label:Q||Ci(y),accessor:y,role:"y",format:g},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,K,Q,m,ce,f,g]),de=Yi({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:fe}=nr({data:J,xAccessor:p,yAccessor:y,forecast:O,anomaly:S}),ge=pr(A),pe=ge||fe.length>0?[...ge?[ge]:[],...w||[],...fe]:w,ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=u&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:ae,size:[R,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:K,yLabel:Q,xFormat:f,yFormat:g,enableHover:Y,showGrid:G}),ir({title:X,description:V,summary:q,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:x,defaultTooltipContent:ue})),rr({linkedHover:P,onObservation:L,onClick:N,hoverHighlight:F,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ie,svgPreRenderers:se}),pe&&pe.length>0&&{annotations:pe}),C&&{xExtent:C}),j&&{yExtent:j}),te.crosshairProps),_);return te.earlyReturn?te.earlyReturn:de?e(Ni,{componentName:"ConnectedScatterplot",message:de,width:R,height:$}):e(Hi,{componentName:"ConnectedScatterplot",width:R,height:$,children:e($o,Object.assign({ref:a},ye))})});vr.displayName="ConnectedScatterplot";const br=f(function(t,n){const o=i(null),s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:g="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:O,annotations:S,regression:C,xExtent:j,yExtent:_,frameProps:M={},selection:P,linkedHover:L,linkedBrush:N,onObservation:F,onClick:B,hoverHighlight:T,chartId:H,loading:W,loadingContent:I,emptyContent:D,legendInteraction:z,legendPosition:E,color:R,stroke:$,strokeWidth:Y,opacity:X}=t,{width:V,height:q,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=s,ie=r(()=>G(l),[l]),re=void 0===l,se=Xi({data:ie,rawData:l,colorBy:m,colorScheme:v,legendInteraction:z,legendPosition:E,selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:F,onClick:B,hoverHighlight:T,chartType:"BubbleChart",chartId:H,showLegend:Q,userMargin:c,marginDefaults:s.marginDefaults,loading:W,loadingContent:I,emptyContent:D,width:V,height:q}),{domain:le,trackPushed:ae,reset:ce}=gr({accessor:p,data:ie,isPushMode:re}),ue=a(e=>{var t;ae([e]),null===(t=o.current)||void 0===t||t.push(e)},[ae]),de=a(e=>{var t;ae(e),null===(t=o.current)||void 0===t||t.pushMany(e)},[ae]);Ui(n,{variant:"xy",frameRef:o,overrides:{push:ue,pushMany:de,clear:()=>{var e;ce(),null===(e=o.current)||void 0===e||e.clear()}},deps:[ue,de,ce]});const he=di(N);ni({name:(null==he?void 0:he.name)||"__unused_brush__",xField:(null==he?void 0:he.xField)||("string"==typeof f?f:void 0),yField:(null==he?void 0:he.yField)||("string"==typeof g?g:void 0)});const fe=r(()=>({stroke:k,strokeWidth:x}),[k,x]),ge=r(()=>null!=le?le:[0,1],[le]),pe=a(e=>De(e,p,y,ge),[p,y,ge]),ye=fr({colorBy:m,colorScale:se.colorScale,color:R,fillOpacity:b,radiusFn:pe,baseStyleExtras:fe,stroke:$,strokeWidth:Y,opacity:X,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),me=r(()=>Li([{label:ne||Ci(f),accessor:f,role:"x",format:d},{label:oe||Ci(g),accessor:g,role:"y",format:h},{label:Ci(p),accessor:p,role:"size"},...m?[{label:Ci(m),accessor:m,role:"color"}]:[]]),[f,g,ne,oe,p,m,d,h]),ve=Yi({componentName:"BubbleChart",data:l,accessors:{xAccessor:f,yAccessor:g},requiredProps:{sizeBy:p}});if(ve)return e(Ni,{componentName:"BubbleChart",message:ve,width:V,height:q});const be=pr(C),xe=be?[be,...S||[]]:S,ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=l&&{data:ie}),{xAccessor:f,yAccessor:g,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:ye,colorScheme:v,size:[V,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:ne,yLabel:oe,xFormat:d,yFormat:h,enableHover:U,showGrid:K}),se.legendBehaviorProps),ir({title:Z,description:J,summary:ee,accessibleTable:te,className:u,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:w,defaultTooltipContent:me})),rr({linkedHover:L,onObservation:F,onClick:B,hoverHighlight:T,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),A&&{marginalGraphics:A}),O&&{pointIdAccessor:O}),xe&&xe.length>0&&{annotations:xe}),j&&{xExtent:j}),_&&{yExtent:_}),se.crosshairProps),M);return se.earlyReturn?se.earlyReturn:e(Hi,{componentName:"BubbleChart",width:V,height:q,children:e($o,Object.assign({ref:o},ke))})});br.displayName="BubbleChart";const xr=f(function(t,n){var o;const s=i(null);Ui(n,{variant:"xy",frameRef:s});const l=Oi(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:f="value",xFormat:g,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:k,xExtent:w,yExtent:A,frameProps:S={},selection:C,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:P,chartId:L,loading:N,loadingContent:F,emptyContent:B,showLegend:T,legendPosition:H,legendInteraction:W}=t,{width:I,height:D,enableHover:z,title:E,description:R,summary:$,accessibleTable:Y,xLabel:X,yLabel:V}=l,q=zi(N,I,D,F),U=q?null:Di(a,I,D,B),K=r(()=>G(a),[a]),Q=function(){var e;const t=fi();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Z=null!==(o=null!=y?y:Q)&&void 0!==o?o:"blues",J=null!=T&&T,ee=null!=H?H:"right",{margin:te}=ki({data:K,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:ee,userMargin:c,defaults:l.marginDefaults}),{customHoverBehavior:ne,customClickBehavior:oe,crosshairSourceId:ie}=bi({selection:C,linkedHover:j,fallbackFields:[],onObservation:_,onClick:M,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});Gi(C);const re=xi(j,ie);wi(W,void 0,[]);const se=r(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),le=r(()=>{const e=K.map(se);return[Math.min(...e),Math.max(...e)]},[K,se]),ae=r(()=>"custom"===Z&&m?m:O({blues:ke,reds:we,greens:Ae,viridis:je,oranges:Oe,purples:Se,greys:Ce,plasma:_e,inferno:Me,magma:Pe,cividis:Le,turbo:Ne}[Z]||ke).domain(le),[Z,m,le]),ce=r(()=>Li([{label:X||Ci(d),accessor:d,role:"x",format:g},{label:V||Ci(h),accessor:h,role:"y",format:p},{label:Ci(f),accessor:f,role:"value",format:b}]),[d,h,X,V,f,g,p,b]),ue=Yi({componentName:"Heatmap",data:a,accessors:{xAccessor:d,yAccessor:h,valueAccessor:f}}),de=r(()=>{if(J)return{gradient:{colorFn:e=>ae(e),domain:le,label:"string"==typeof f?f:"value",format:b}}},[J,ae,le,f,b]),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=a&&{data:K}),{xAccessor:d,yAccessor:h,valueAccessor:f,colorScheme:"custom"!==Z?Z:void 0,showValues:v,heatmapValueFormat:b,size:[I,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,showAxes:l.showAxes,xLabel:X,yLabel:V,xFormat:g,yFormat:p,enableHover:z}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),de&&{legend:de,legendPosition:ee}),ir({title:E,description:R,summary:$,accessibleTable:Y,className:u,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:x,defaultTooltipContent:ce})),rr({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:P,customHoverBehavior:ne,customClickBehavior:oe})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),re),S);return q||U||(ue?e(Ni,{componentName:"Heatmap",message:ue,width:I,height:D}):e(Hi,{componentName:"Heatmap",width:I,height:D,children:e($o,Object.assign({ref:s},he))}))});xr.displayName="Heatmap";const kr="__splomIdx",wr={top:4,bottom:4,left:4,right:4};function Ar({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),l=n-wr.left-wr.right,a=n-wr.top-wr.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),n=b().extent([[0,0],[l,a]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,s],[l,a]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(l),i.y.invert(a)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[l,a,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${wr.left},${wr.top})`})})}function Or({data:n,xField:o,yField:r,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:f,unselectedOpacity:g,mode:p,onPointHover:y}){const m=i(null),v=Jo({name:h,clientId:`splom-${o}-${r}`}),b=ni({name:h,xField:o,yField:r}),x=Jo({name:f,clientId:"splom-hover-source"}),k=x.selectPoints,w=a(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=a(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[kr];void 0!==n&&(k({[kr]:[n]}),null==y||y(t,e.x+wr.left,e.y+wr.top))},[k,y]),O=a(e=>{const t={opacity:c,r:l};return t.fill=u?We(e,u,d):gi,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*l,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=g),t},[u,d,c,l,p,v.isActive,v.predicate,x.isActive,x.predicate,g]);return t("div",{style:{position:"relative",width:s,height:s},children:[e($o,{ref:m,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:r,pointStyle:O,margin:wr,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(Ar,{frameRef:m,cellSize:s,xField:o,yField:r,onBrush:w})]})}function Sr({data:n,field:o,label:i,cellSize:s,bins:l,colorBy:a,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const f=Jo({name:u,clientId:"splom-diag-"+o}),g=Jo({name:d,clientId:`splom-diag-${o}-hover`}),p="hover"===h?g:f,y=p.isActive,m=p.predicate,v=r(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/l||1,r="string"==typeof a?a:null,c=r?[...new Set(n.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(l).fill(0),h=Array(l).fill(0),f=Array.from({length:l},()=>Array(c.length).fill(0)),g=Array.from({length:l},()=>Array(c.length).fill(0));for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const s=Math.min(Math.floor((n-t)/i),l-1);if(d[s]++,y&&!m(e)||h[s]++,r){const t=u.get(e[r]+"");void 0!==t&&(f[s][t]++,y&&!m(e)||g[s][t]++)}}const p=Math.max(...d,1),v=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(s-24),r={x:t/l*s,w:s/l-1,h:i,y0:n,category:c[o]};return n+=i,r})}),b=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(s-24),r={x:t/l*s,w:s/l-1,h:i,y0:n,category:c[o]};return n+=i,r})});return{bars:d.map((e,t)=>({x:t/l*s,w:s/l-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/l*s,w:s/l-1,h:e/p*(s-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:p,categories:c}},[n,o,l,s,y,m,a]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):gi,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:gi,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):gi,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:gi,opacity:.7},"sel-"+n)))]})}function Cr({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function jr(n){const{data:i,fields:s,fieldLabels:l={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:f=4,pointRadius:g=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:O,className:S,onObservation:C,chartId:j}=n,_="splom",M="splom-hover",P=b?"hover":v?"brush":"hover",L=Ko(e=>e.clearSelection),[N,F]=d(null),B=a(()=>{L(M),F(null)},[L,M]),T=r(()=>(i||[]).map((e,t)=>void 0!==e[kr]?e:Object.assign(Object.assign({},e),{[kr]:t})),[i]),H=vi(T,c,u),W=void 0!==A?A:!!c,I=r(()=>{if(!W||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:H?H(e+""):gi})):null},[W,c,T,H]),D=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:f+"px",width:"fit-content"}),[s,h,f,40]);return t("div",{className:S,style:{position:"relative"},children:[I&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:I.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:D,onMouseLeave:"hover"===P?B:void 0,children:[s.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:l[n]||n}),s.map((t,o)=>i===o?"label"===y?e(Cr,{label:l[n]||n,cellSize:h},"diag-"+n):e(Sr,{data:T,field:n,label:l[n]||n,cellSize:h,bins:m,colorBy:c,colorScale:H,brushSelectionName:_,hoverSelectionName:M,unselectedOpacity:x,mode:P},"diag-"+n):e(Or,{data:T,xField:t,yField:n,fieldLabels:l,cellSize:h,pointRadius:g,pointOpacity:p,colorBy:c,colorScale:H,brushSelectionName:_,hoverSelectionName:M,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(F({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):(F(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:l[t]||t},"col-label-"+t))]}),N&&"hover"===P&&(()=>{const n=N.datum,o=l[N.xField]||N.xField,i=l[N.yField]||N.yField,r=c?"function"==typeof c?c(n):n[c]:null,s=O?"function"==typeof O?O(n):n[O]:"Row "+n[kr];return t("div",{style:{position:"absolute",left:40+N.colIndex*(h+f)+N.px,top:N.rowIndex*(h+f)+N.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[o,": ",null!=n[N.xField]?Number(n[N.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[N.yField]?Number(n[N.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function _r(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(ui,{selections:i,children:e(jr,Object.assign({},t))})}function Mr({width:t,height:n,margin:o,scales:r,brushDirection:l,extent:a,onBrush:c}){const u=i(null),d=i(null),h=i(!1),f=t+o.left+o.right,g=n+o.top+o.bottom;return s(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),o="x"===l?m().extent([[0,0],[t,n]]):v().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===l?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,l,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===l?r.x:r.y;if(h.current=!0,a){const n=[t(a[0]),t(a[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[a,r,l]),e("svg",{ref:u,width:f,height:g,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Pr(n){var o,l;const{data:c,width:u=600,height:h=400,margin:f,className:g,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:O,lineDataAccessor:S="coordinates",colorBy:C,colorScheme:j,curve:_="linear",lineWidth:M=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:N=!1,pointRadius:F=3,enableHover:B=!0,showGrid:T=!1,showLegend:H,legendPosition:W,tooltip:I,minimap:D={},renderBefore:z=!1,onBrush:E,brushExtent:R,yExtent:$,frameProps:Y={},loading:X,loadingContent:V,emptyContent:q}=n,U=zi(X,u,h,V),K=U?null:Di(c,u,h,q),Q=r(()=>G(c),[c]),[Z,J]=d(null),ee=null!=R?R:Z,te=a(e=>{R||J(e),null==E||E(e)},[R,E]),ne=i(null),[oe,ie]=d(null);s(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=ne.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?ie(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const re=void 0!==(null===(o=Q[0])||void 0===o?void 0:o[S]),se=r(()=>{if(re)return Q;if(O){const e=Q.reduce((e,t)=>{const n="function"==typeof O?O(t):t[O];if(!e[n]){const t={[S]:[]};"string"==typeof O&&(t[O]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:Q}]},[Q,O,S,re]),le=r(()=>re||O?se.flatMap(e=>{const t=e[S]||[];return O&&"string"==typeof O?t.map(t=>Object.assign(Object.assign({},t),{[O]:e[O]})):t}):Q,[se,S,re,O,Q]),ae=vi(Q,C,j),ce=qi({lineWidth:M,colorBy:C,colorScale:ae,fillArea:P,areaOpacity:L}),ue=r(()=>{if(D.lineStyle)return D.lineStyle},[D.lineStyle]),de=qi({lineWidth:1,colorBy:C,colorScale:ae}),he=null!=ue?ue:de,fe=r(()=>{if(N)return e=>{const t={r:F,fillOpacity:1};return t.fill=C?We(e.parentLine||e,C,ae):gi,t}},[N,F,C,ae]),{legend:ge,margin:pe,legendPosition:ye}=ki({data:se,colorBy:C,colorScale:ae,showLegend:H,legendPosition:W,userMargin:f}),me=D.height||60,ve=r(()=>{var e,t,n,o,i,r,s,l;return{top:null!==(t=null===(e=D.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=D.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=D.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:pe.left,right:null!==(l=null===(s=D.margin)||void 0===s?void 0:s.right)&&void 0!==l?l:pe.right}},[D.margin,pe]),be=D.brushDirection||"x",xe=Yi({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(xe)return e(Ni,{componentName:"MinimapChart",message:xe,width:u,height:h});const ke=P?"area":"line",we=r(()=>Li([{label:v||Ci(w),accessor:w,role:"x",format:x},{label:b||Ci(A),accessor:A,role:"y",format:k}]),[w,A,v,b,x,k]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ke,data:le,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:_,lineStyle:ce},N&&{pointStyle:fe}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:B,showGrid:T}),ge&&{legend:ge,legendPosition:ye}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===I?()=>null:ao(I)||we}),ee&&{xExtent:ee}),$&&{yExtent:$}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),Y),Oe=Object.assign({chartType:ke,data:le,xAccessor:w,yAccessor:A,groupAccessor:O||void 0,curve:_,lineStyle:he,size:[u,me+ve.top+ve.bottom],margin:ve,showAxes:null!==(l=D.showAxes)&&void 0!==l&&l,background:D.background,enableHover:!1},$&&{yExtent:$}),Se=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e($o,Object.assign({ref:ne},Oe)),e(Mr,{width:u-ve.left-ve.right,height:me,margin:ve,scales:oe,brushDirection:be,extent:ee,onBrush:te})]},"minimap"),Ce=e("div",{style:{overflow:"hidden"},children:e($o,Object.assign({},Ae))},"main");return U||K||e(Hi,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(g?" "+g:""),children:[z?Se:Ce,z?Ce:Se]})})}_r.displayName="ScatterplotMatrix",Pr.displayName="MinimapChart";const Lr={label:"Low / High",color:"#E9C46A",opacity:.08},Nr={label:"High / High",color:"#2A9D8F",opacity:.08},Fr={label:"Low / Low",color:"#E76F51",opacity:.08},Br={label:"High / Low",color:"#86BBD8",opacity:.08};function Tr(e,t){var n,o,i;return{label:null!==(n=null==t?void 0:t.label)&&void 0!==n?n:e.label,color:null!==(o=null==t?void 0:t.color)&&void 0!==o?o:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const Hr=f(function(o,s){const l=i(null);Ui(s,{variant:"xy",frameRef:l});const a=Oi(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:g="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:O,sizeRange:S=[3,15],pointRadius:C=5,pointOpacity:j=.8,tooltip:_,pointIdAccessor:M,annotations:P,frameProps:L={},selection:N,linkedHover:F,onObservation:B,onClick:T,hoverHighlight:H,chartId:W,loading:I,loadingContent:D,emptyContent:z,legendInteraction:E,legendPosition:R,color:$,stroke:Y,strokeWidth:X,opacity:V}=o,{width:q,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=a,re=r(()=>({topLeft:Tr(Lr,null==v?void 0:v.topLeft),topRight:Tr(Nr,null==v?void 0:v.topRight),bottomLeft:Tr(Fr,null==v?void 0:v.bottomLeft),bottomRight:Tr(Br,null==v?void 0:v.bottomRight)}),[v]),se=r(()=>G(c),[c]),le=Xi({data:se,rawData:c,colorBy:w,colorScheme:A,legendInteraction:E,legendPosition:R,selection:N,linkedHover:F,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:H,chartType:"QuadrantChart",chartId:W,showLegend:Z,userMargin:u,marginDefaults:a.marginDefaults,loading:I,loadingContent:D,emptyContent:z,width:q,height:U});Ei("QuadrantChart",se,"xAccessor",g),Ei("QuadrantChart",se,"yAccessor",p);const ae=r(()=>{if(!se.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of se){const l=e(s),a=t(s);isFinite(l)&&(n>l&&(n=l),l>o&&(o=l)),isFinite(a)&&(i>a&&(i=a),a>r&&(r=a))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),n===1/0)return;const s=.1*(o-n)||1,l=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-l,r+l]}},[se,g,p,y,m]),ce=r(()=>{if(!O||0===se.length)return;const e=se.map(e=>"function"==typeof O?O(e):e[O]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[se,O]),ue=r(()=>"function"==typeof g?g:e=>+e[g],[g]),de=r(()=>"function"==typeof p?p:e=>+e[p],[p]),he=r(()=>e=>{const t=ue(e),n=de(e),o=null!=y?t>=y:void 0,i=null!=m?n>=m:void 0;return void 0===i||void 0===o?$||gi:i&&o?re.topRight.color:i&&!o?re.topLeft.color:!i&&o?re.bottomRight.color:re.bottomLeft.color},[ue,de,y,m,re,$]),fe=r(()=>O?e=>De(e,O,S,ce):void 0,[O,S,ce]),ge=fr({colorBy:w,colorScale:le.colorScale,color:$,pointRadius:C,fillOpacity:j,radiusFn:fe,fallbackFill:he,stroke:Y,strokeWidth:X,opacity:V,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection}),pe=r(()=>{if(!se.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof O&&e.add(O);const t=se[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[se,g,p,w,O]),ye=r(()=>Li([...pe?[{label:pe,accessor:pe,role:"title"}]:[],{label:oe||Ci(g),accessor:g,role:"x",format:h},{label:ie||Ci(p),accessor:p,role:"y",format:f},...w?[{label:Ci(w),accessor:w,role:"color"}]:[],...O?[{label:Ci(O),accessor:O,role:"size"}]:[]]),[pe,g,p,oe,ie,w,O,h,f]),me=Yi({componentName:"QuadrantChart",data:c,accessors:{xAccessor:g,yAccessor:p}}),ve=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=i.width,l=i.height,a=null!=y?o.x(y):s/2,c=null!=m?o.y(m):l/2;if(null!=y&&!isFinite(a))return;if(null!=m&&!isFinite(c))return;const u=Math.max(0,Math.min(s,a)),d=Math.max(0,Math.min(l,c)),h=[{config:re.topLeft,x:0,y:0,w:u,h:d},{config:re.topRight,x:u,y:0,w:s-u,h:d},{config:re.bottomLeft,x:0,y:d,w:u,h:l-d},{config:re.bottomRight,x:u,y:d,w:s-u,h:l-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,l),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[y,m,re,b]),be=r(()=>x?[...ve,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,s=null!=y?n.x(y):i/2,l=null!=m?n.y(m):r/2;(null==y||isFinite(s))&&(null==m||isFinite(l))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=re.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(re.topLeft.label,8,8),e.fillStyle=re.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(re.topRight.label,i-8,8),e.fillStyle=re.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(re.bottomLeft.label,8,r-8),e.fillStyle=re.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(re.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ve,[ve,x,k,re,y,m]),xe=r(()=>{const e=L.canvasPreRenderers||[];return[...be,...e]},[be,L.canvasPreRenderers]),ke=r(()=>{var o;const i={stroke:b.stroke||"#999",strokeWidth:null!==(o=b.strokeWidth)&&void 0!==o?o:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(o,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const l=s.width,a=s.height,c=null!=y?r.x(y):l/2,u=null!=m?r.y(m):a/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(u))return null;const d=Math.max(0,Math.min(l,c)),h=Math.max(0,Math.min(a,u));return t(n,{children:[[{config:re.topLeft,x:0,y:0,w:d,h:h},{config:re.topRight,x:d,y:0,w:l-d,h:h},{config:re.bottomLeft,x:0,y:h,w:d,h:a-h},{config:re.bottomRight,x:d,y:h,w:l-d,h:a-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:a,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:l,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(n,{children:[e("text",{x:8,y:8+k,fill:re.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:re.topLeft.label}),e("text",{x:l-8,y:8+k,fill:re.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:re.topRight.label}),e("text",{x:8,y:a-8,fill:re.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:re.bottomLeft.label}),e("text",{x:l-8,y:a-8,fill:re.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:re.bottomRight.label})]})]})}]},[y,m,re,b,x,k]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:se}),{xAccessor:g,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:O||void 0,sizeRange:S,pointStyle:ge,colorScheme:A,size:[q,U],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:le.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ie,xFormat:h,yFormat:f,enableHover:K,showGrid:Q}),ae&&{xExtent:ae.xExtent,yExtent:ae.yExtent}),le.legendBehaviorProps),J&&{title:J}),ee&&{description:ee}),te&&{summary:te}),void 0!==ne&&{accessibleTable:ne}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:!1===_?()=>null:!0===_||void 0===_?ye:ao(_)||ye}),(F||B||T||H)&&{customHoverBehavior:le.customHoverBehavior}),(B||T||F)&&{customClickBehavior:le.customClickBehavior}),M&&{pointIdAccessor:M}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:xe}),le.crosshairProps),L),xe.length>0&&{canvasPreRenderers:xe}),{svgPreRenderers:ke});return le.earlyReturn?le.earlyReturn:me?e(Ni,{componentName:"QuadrantChart",message:me,width:q,height:U}):e(Hi,{componentName:"QuadrantChart",width:q,height:U,children:e($o,Object.assign({ref:l},we))})});Hr.displayName="QuadrantChart";const Wr="__ma_unitized",Ir="__ma_series";function Dr(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function zr(e,t){return t[0]+e*(t[1]-t[0])}const Er=f(function(t,n){var s;const l=i(null),c=i([]),u=i(t.series);u.current=t.series,p(n,()=>{const e=()=>{var e;return(null!==(e=u.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!l.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=r&&isFinite(r)&&l.current.push(Object.assign(Object.assign({},o),{[Wr]:Dr(r,i),[Ir]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!l.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||c.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&o.push(Object.assign(Object.assign({},e),{[Wr]:Dr(s,r),[Ir]:i.label||"Series "+(t+1)}))}l.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const d=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:f,className:g,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:k=2,tooltip:w,annotations:A,frameProps:O={},selection:S,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:M,chartId:P,loading:L,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:T,stroke:H,strokeWidth:W,opacity:I}=t,{width:D,height:z,enableHover:E,showGrid:R,showLegend:$=!0,title:Y,description:X,summary:V,accessibleTable:q,xLabel:U}=d,K=r(()=>G(h),[h]),Q=r(()=>G(v),[v]),Z=Q,J=2===Q.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||J||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Q.length}. Rendering as a standard multi-line chart.`);const ee=zi(L,D,z,N),te=ee?null:Di(h,D,z,F),ne=mi(),oe=r(()=>{let e;if(Array.isArray(b))e=b;else if(ne&&ne.length>0)e=ne;else{const t=Fe[b];e=Array.isArray(t)?t:Be}return Z.map((t,n)=>t.color||e[n%e.length])},[Z,b,ne]),ie=r(()=>Q.map((e,t)=>e.label||"Series "+(t+1)),[Q]),{unitizedData:re,extents:se}=r(()=>{if(0===K.length){const e=Q.map(e=>e.extent||null).filter(Boolean);return e.length===Q.length&&(c.current=e),{unitizedData:[],extents:e.length===Q.length?e:[]}}const e=Q.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(K,e.yAccessor));if(c.current=e,!J){const t=[];for(const e of K)for(let n=0;Q.length>n;n++){const o=Q[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Wr]:i,[Ir]:ie[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of K)for(let o=0;2>o;o++){const i=Q[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Wr]:Dr(r,e[o]),[Ir]:ie[o]}))}return{unitizedData:t,extents:e}},[K,Q,J,ie]),le=r(()=>{if(J&&se.length>=2)return[{orient:"left",label:ie[0],tickFormat:Q[0].format||(e=>{const t=zr(e,se[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ie[1],tickFormat:Q[1].format||(e=>{const t=zr(e,se[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[J,se,Q,ie]),ae=Xi({data:r(()=>re.length>0?re:ie.map(e=>({[Ir]:e})),[re,ie]),rawData:h,colorBy:Ir,colorScheme:oe,legendInteraction:B,legendPosition:T,selection:S,linkedHover:C,fallbackFields:[Ir],unwrapData:!1,onObservation:j,onClick:_,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:P,showLegend:$,userMargin:f,marginDefaults:J?Object.assign(Object.assign({},d.marginDefaults),{left:70,right:70}):d.marginDefaults,loading:L,loadingContent:N,emptyContent:F,width:D,height:z});if(ae.earlyReturn)return ae.earlyReturn;const ce=r(()=>{const e=new Map;return ie.forEach((t,n)=>e.set(t,oe[n])),e},[ie,oe]),ue=qi({lineWidth:k,resolveStroke:a(e=>ce.get(e[Ir])||oe[0],[ce,oe]),stroke:H,strokeWidth:W,opacity:I,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),de=r(()=>{if(!1===w)return()=>null;return ao(w)||(e=>{var t;const n=e.data||e,i=n[Ir],r=ie.indexOf(i),s=n[Wr],l=J&&r>=0&&se[r]?zr(s,se[r]):s,a=r>=0&&(null===(t=Q[r])||void 0===t?void 0:t.format)?Q[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(n):n[m];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:oe[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),o.createElement("div",null,`${i}: ${a(l)}`))})},[w,ie,oe,se,J,Q,m]),he=Yi({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),fe=J?[0,1]:void 0,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:re}),{xAccessor:m,yAccessor:Wr,groupAccessor:Ir,lineStyle:ue,colorScheme:oe,size:[D,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:d.showAxes}),le&&{axes:le}),{xLabel:U}),J?{}:{yLabel:ie[0]}),{xFormat:y}),J&&fe&&{yExtent:fe}),{enableHover:E}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:R,curve:x}),ae.legendBehaviorProps),Y&&{title:Y}),X&&{description:X}),V&&{summary:V}),void 0!==q&&{accessibleTable:q}),g&&{className:g}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:de}),A&&{annotations:A}),(C||j||_||M)&&{customHoverBehavior:ae.customHoverBehavior}),(j||_||C)&&{customClickBehavior:ae.customClickBehavior}),ae.crosshairProps),O);return ee||te||(he?e(Ni,{componentName:"MultiAxisLineChart",message:he,width:D,height:z}):e(Hi,{componentName:"MultiAxisLineChart",width:D,height:z,children:e($o,Object.assign({ref:l},ge))}))});function Rr(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}Er.displayName="MultiAxisLineChart";const $r=f(function(t,n){const o=i(null);Ui(n,{variant:"xy",frameRef:o});const s=Oi(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:l,margin:a,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:f="high",lowAccessor:g="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,onClick:C,chartId:j,loading:_,loadingContent:M,emptyContent:P}=t,{width:L,height:N,enableHover:F,showGrid:B,title:T,description:H,summary:W,accessibleTable:I,xLabel:D,yLabel:z}=s,E=zi(_,L,N,M),R=E?null:Di(l,L,N,P),$=r(()=>G(l),[l]),Y=null==p||null==y;Ei("CandlestickChart",$,"xAccessor",h),Ei("CandlestickChart",$,"highAccessor",f),Ei("CandlestickChart",$,"lowAccessor",g),Y||(Ei("CandlestickChart",$,"openAccessor",p),Ei("CandlestickChart",$,"closeAccessor",y));const{customHoverBehavior:X,customClickBehavior:V,crosshairSourceId:q}=bi({selection:A,linkedHover:O,onObservation:S,onClick:C,chartType:"CandlestickChart",chartId:j}),U=xi(O,q),K=r(()=>{const e=s.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?n:Object.assign(Object.assign({},n),Rr(a))},[a,s.marginDefaults,t.mode]),Q=r(()=>{const e=[{label:D||Ci(h),accessor:h,role:"x",format:u}];return Y?(e.push({label:"High",accessor:f,role:"y",format:d}),e.push({label:"Low",accessor:g,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:f,format:d}),e.push({label:"Low",accessor:g,format:d}),e.push({label:"Close",accessor:y,format:d})),Li(e)},[h,D,u,d,f,g,p,y,Y]),Z=Yi({componentName:"CandlestickChart",data:l,accessors:Object.assign({xAccessor:h,highAccessor:f,lowAccessor:g},!Y&&{openAccessor:p,closeAccessor:y})}),J=Math.max(2,Math.min(12,Math.round(L/40))),ee=L>200?.1:.02,te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=l&&{data:$}),{xAccessor:h,yAccessor:f,highAccessor:f,lowAccessor:g}),!Y&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:J,extentPadding:ee,size:[L,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K,showAxes:s.showAxes,xLabel:D,yLabel:z,xFormat:u,yFormat:d,enableHover:F,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ir({title:T,description:H,summary:W,accessibleTable:I,className:c,animate:t.animate,axisExtent:t.axisExtent})),sr({tooltip:v,defaultTooltipContent:Q})),rr({linkedHover:O,onObservation:S,onClick:C,customHoverBehavior:X,customClickBehavior:V})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),U),w);return E||R||(Z?e(Ni,{componentName:"CandlestickChart",message:Z,width:L,height:N}):e(Hi,{componentName:"CandlestickChart",width:L,height:N,children:e($o,Object.assign({ref:o},te))}))});$r.displayName="CandlestickChart";const Yr=f(function(t,n){const{data:o,layout:s,layoutConfig:l,xExtent:a,yExtent:c,showAxes:u=!1,margin:d,className:h,annotations:f,onObservation:g,onClick:p,selection:y,linkedHover:m,chartId:v,loading:b,loadingContent:x,emptyContent:k,colorScheme:w,frameProps:A={}}=t,{frameRef:O,resolved:S,safeData:C,setup:j,earlyReturn:_}=function(e){var t;const n=function(e){const t=i(null);return Ui(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Oi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>Rr(e.margin),[e.margin])}}(e),{resolved:o,normalizedMargin:s}=n,l=Xi({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:l.data,setup:l,earlyReturn:l.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorScheme:w,selection:y,linkedHover:m,onObservation:g,onClick:p,chartId:v,loading:b,loadingContent:x,emptyContent:k,margin:d,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel});if(_)return _;const{width:M,height:P,enableHover:L,showGrid:N,title:F,description:B,summary:T,accessibleTable:H,xLabel:W,yLabel:I}=S,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:C}),{customLayout:s,layoutConfig:l,xExtent:a,yExtent:c,colorScheme:w,size:[M,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:j.margin,showAxes:u,xLabel:W,yLabel:I,enableHover:L,showGrid:N}),j.legendBehaviorProps),ir({title:F,description:B,summary:T,accessibleTable:H,className:h,animate:t.animate,axisExtent:t.axisExtent})),null!=t.tooltip&&{tooltipContent:t.tooltip}),rr({linkedHover:m,onObservation:g,onClick:p,hoverHighlight:!1,customHoverBehavior:j.customHoverBehavior,customClickBehavior:j.customClickBehavior})),f&&f.length>0&&{annotations:f}),j.crosshairProps),A);return e(Hi,{componentName:"XYCustomChart",width:M,height:P,children:e($o,Object.assign({ref:O},D))})});Yr.displayName="XYCustomChart";export{cr as AreaChart,br as BubbleChart,$r as CandlestickChart,vr as ConnectedScatterplot,dr as DifferenceChart,xr as Heatmap,or as LineChart,Pr as MinimapChart,Er as MultiAxisLineChart,Hr as QuadrantChart,yr as Scatterplot,_r as ScatterplotMatrix,hr as StackedAreaChart,$o as StreamXYFrame,Yr as XYCustomChart};
|