semiotic 3.0.0-beta.3 → 3.0.0-beta.4
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 +93 -753
- package/README.md +80 -7
- package/dist/ChartContainer.d.ts +60 -0
- package/dist/DetailsPanel.d.ts +37 -0
- package/dist/LinkedCharts.d.ts +2 -0
- package/dist/Tooltip/Tooltip.d.ts +2 -2
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
- package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
- package/dist/charts/shared/annotationRules.d.ts +3 -0
- package/dist/charts/shared/colorUtils.d.ts +17 -11
- package/dist/charts/shared/hooks.d.ts +96 -1
- package/dist/charts/shared/loess.d.ts +13 -0
- package/dist/charts/shared/networkUtils.d.ts +31 -0
- package/dist/charts/shared/tooltipUtils.d.ts +16 -0
- package/dist/charts/shared/types.d.ts +17 -2
- package/dist/charts/shared/validateChartData.d.ts +2 -3
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +4 -0
- package/dist/charts/xy/BubbleChart.d.ts +6 -0
- package/dist/charts/xy/Heatmap.d.ts +4 -0
- package/dist/charts/xy/LineChart.d.ts +6 -0
- package/dist/charts/xy/Scatterplot.d.ts +4 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
- package/dist/data/fromVegaLite.d.ts +48 -0
- package/dist/export/chartConfig.d.ts +29 -0
- package/dist/export/selectionSerializer.d.ts +20 -0
- package/dist/geometry/sankeyLinks.d.ts +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime/types.d.ts +20 -6
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +14 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +9 -19
- package/dist/semiotic-ordinal.d.ts +12 -14
- package/dist/semiotic-xy.d.ts +12 -18
- package/dist/semiotic.d.ts +16 -13
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/store/ObservationStore.d.ts +61 -0
- package/dist/store/SelectionStore.d.ts +9 -1
- package/dist/store/ThemeStore.d.ts +6 -1
- package/dist/store/TooltipStore.d.ts +3 -1
- package/dist/store/createStore.d.ts +4 -1
- package/dist/store/useObservation.d.ts +18 -0
- package/dist/stream/MarginalGraphics.d.ts +1 -1
- package/dist/stream/NetworkPipelineStore.d.ts +44 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
- package/dist/stream/ParticlePool.d.ts +2 -1
- package/dist/stream/PipelineStore.d.ts +11 -0
- package/dist/stream/SVGOverlay.d.ts +21 -2
- package/dist/stream/SceneGraph.d.ts +1 -1
- package/dist/stream/networkTypes.d.ts +58 -1
- package/dist/stream/ordinalTypes.d.ts +13 -0
- package/dist/stream/types.d.ts +14 -0
- package/dist/types/annotationTypes.d.ts +10 -0
- package/dist/types/networkTypes.d.ts +1 -2
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +27 -38
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
- package/dist/Axis/Axis.d.ts +0 -7
- package/dist/Axis/axisTitle.d.ts +0 -10
- package/dist/Axis/index.d.ts +0 -2
- package/dist/Axis/summaryGraphic.d.ts +0 -17
- package/dist/Brush.d.ts +0 -12
- package/dist/DividedLine.d.ts +0 -16
- package/dist/TooltipPositioner/index.d.ts +0 -7
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/annotationRules/baseRules.d.ts +0 -25
- package/dist/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/batchWork.d.ts +0 -6
- package/dist/constants/coordinateNames.d.ts +0 -8
- package/dist/constants/frame_props.d.ts +0 -13
- package/dist/data/dataFunctions.d.ts +0 -45
- package/dist/data/multiAccessorUtils.d.ts +0 -1
- package/dist/data/unflowedFunctions.d.ts +0 -1
- package/dist/generic_utilities/functions.d.ts +0 -1
- package/dist/geometry/areaDrawing.d.ts +0 -21
- package/dist/geometry/contourLayout.d.ts +0 -6
- package/dist/geometry/hexbinLayout.d.ts +0 -7
- package/dist/geometry/lineDrawing.d.ts +0 -71
- package/dist/geometry/summaryLayouts.d.ts +0 -45
- package/dist/index.d.ts +0 -1
- package/dist/processing/InteractionItems.d.ts +0 -13
- package/dist/processing/hierarchyUtils.d.ts +0 -16
- package/dist/processing/layouts/chordLayout.d.ts +0 -2
- package/dist/processing/layouts/forceLayout.d.ts +0 -3
- package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
- package/dist/processing/layouts/index.d.ts +0 -8
- package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
- package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
- package/dist/processing/layouts/types.d.ts +0 -17
- package/dist/processing/networkDefaults.d.ts +0 -36
- package/dist/realtime/renderers/barRenderer.d.ts +0 -2
- package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
- package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
- package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
- package/dist/stream/NetworkSceneGraph.d.ts +0 -14
- package/dist/stream/index.d.ts +0 -16
- package/dist/types/canvasTypes.d.ts +0 -9
- package/dist/types/xyTypes.d.ts +0 -24
- package/dist/useBoundingRect.d.ts +0 -2
- package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
- package/dist/visualizationLayerBehavior/general.d.ts +0 -80
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t,{useMemo as n,forwardRef as o,useRef as r,useState as i,useCallback as s,useEffect as a,useImperativeHandle as l,createContext as c,useContext as u,useLayoutEffect as d,useId as h}from"react";import{brushX as f,brushY as p,brush as y}from"d3-brush";import{select as g}from"d3-selection";import{scaleLinear as m,scaleBand as v,scaleOrdinal as b,scaleSequential as x}from"d3-scale";import{bin as w,quantile as k,min as A,max as E,sum as S}from"d3-array";import{interpolateNumber as M}from"d3-interpolate";import{sankeyCircular as O,sankeyJustify as j,sankeyCenter as P,sankeyRight as N,sankeyLeft as _}from"d3-sankey-circular";import{schemeCategory10 as z,interpolatePlasma as $,interpolateViridis as B,interpolatePurples as C,interpolateOranges as D,interpolateGreens as W,interpolateReds as L,interpolateBlues as T,schemeSet3 as F,schemeTableau10 as R}from"d3-scale-chromatic";import{line as H,curveLinearClosed as I,arc as Y,curveLinear as X,curveCardinal as G}from"d3-shape";import{forceLink as V,forceSimulation as q,forceManyBody as U,forceX as Z,forceY as K}from"d3-force";import{ribbon as Q,chord as J}from"d3-chord";import{hierarchy as ee,partition as te,pack as ne,treemap as oe,treemapBinary as re,cluster as ie,tree as se}from"d3-hierarchy";import ae from"labella";import le from"regression";import{contourDensity as ce}from"d3-contour";import{hexbin as ue}from"d3-hexbin";const de=5e3;class he{constructor(e){this.lastBoundedData=null,this.chunkTimer=0,this.callback=e}setBoundedData(e){if(e===this.lastBoundedData)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,de),bounded:!0,totalSize:e.length});let t=de;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+de,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)}push(e){this.callback({inserts:[e],bounded:!1})}pushMany(e){0!==e.length&&this.callback({inserts:e,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class fe{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;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}toArray(){const e=[];for(const t of this)e.push(t);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}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 pe{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(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.isNaN(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 ye(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function ge(e,t,n,o,r,i){const s=[],a=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||(s.push([t.x(e),t.y(i)]),a.push(i))}return{type:"line",path:s,rawValues:a,style:r,datum:e,group:i}}function me(e,t,n,o,r,i,s){const a=[],l=[];for(const i of e){const e=n(i),s=o(i);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e);a.push([c,t.y(s)]),l.push([c,t.y(r)])}return{type:"area",topPath:a,bottomPath:l,style:i,datum:e,group:s}}function ve(e,t,n,o,r,i){const s=n(e),a=o(e);return null==s||null==a||Number.isNaN(s)||Number.isNaN(a)?null:{type:"point",x:t.x(s),y:t.y(a),r:r,style:i,datum:e}}function be(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function xe(e,t,n,o,r,i){return{type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i}}function we(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function ke(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}class Ae{constructor(e){this.xExtent=new pe,this.yExtent=new pe,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version=0,this.config=e,this.buffer=new fe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=we(e.timeAccessor||e.xAccessor,"time"),this.getY=we(e.valueAccessor||e.yAccessor,"value")):(this.getX=we(e.xAccessor,"x"),this.getY=we(e.yAccessor,"y")),this.getGroup=ke(e.groupAccessor),this.getCategory=ke(e.categoryAccessor),this.getSize=e.sizeAccessor?we(e.sizeAccessor,"size"):void 0,this.getColor=ke(e.colorAccessor),this.getBounds=e.boundsAccessor?we(e.boundsAccessor,"bounds"):void 0,"candlestick"===e.chartType&&(this.getOpen=we(e.openAccessor,"open"),this.getHigh=we(e.highAccessor,"high"),this.getLow=we(e.lowAccessor,"low"),this.getClose=we(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new fe(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();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)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))):this.yExtent.push(this.getY(n))}else for(const n of e.inserts){"growing"===this.config.windowMode&&this.buffer.full&&(this.growingCap*=2,this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap));const e=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))):this.yExtent.push(this.getY(n)),null!=e&&(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)))}return!0}computeScene(e){var t,n,o,r,i,s;const{config:a,buffer:l}=this;if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===a.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.xExtent.extent,u=this.yExtent.extent;let d=a.xExtent?[null!==(t=a.xExtent[0])&&void 0!==t?t:c[0],null!==(n=a.xExtent[1])&&void 0!==n?n:c[1]]:c,h=a.yExtent?[null!==(o=a.yExtent[0])&&void 0!==o?o:u[0],null!==(r=a.yExtent[1])&&void 0!==r?r:u[1]]:u;const f=a.yExtent&&null!=a.yExtent[0]&&null!=a.yExtent[1];if("stackedarea"===a.chartType&&!f&&l.size>0)if(a.normalize)h=[0,1+a.extentPadding];else{const e=l.toArray(),t=this.groupData(e),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);h=[0,o+(o>0?o*a.extentPadding:1)]}else if("bar"===a.chartType&&a.binSize&&!f&&l.size>0){const[,e]=function(e,t,n,o,r){const i=ye(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(l,this.getX,this.getY,a.binSize,this.getCategory);h=[0,e+e*a.extentPadding]}else if("waterfall"===a.chartType&&!f&&l.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(l,this.getY),n=t-e,o=n>0?n*a.extentPadding:1;h=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!f&&h[0]!==1/0){if(this.getBounds){const e=l.toArray();for(const t of e){const e=this.getY(t),n=this.getBounds(t);null!=e&&!Number.isNaN(e)&&n&&(e+n>h[1]&&(h[1]=e+n),h[0]>e-n&&(h[0]=e-n))}}const e=h[1]-h[0],t=e>0?e*a.extentPadding:1,n=null===(i=a.yExtent)||void 0===i?void 0:i[0],o=null===(s=a.yExtent)||void 0===s?void 0:s[1];h=[null!=n?h[0]:h[0]-t,null!=o?h[1]:h[1]+t]}if(d[0]!==1/0&&d[1]!==-1/0||(d=[0,1]),h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),void 0!==a.arrowOfTime)if("x"==("up"===(p=a.arrowOfTime)||"down"===p?"y":"x")){const t="right"===a.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:m().domain(d).range(t),y:m().domain(h).range([e.height,0])}}else{const t="down"===a.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:m().domain(h).range([0,e.width]),y:m().domain(d).range(t)}}else this.scales={x:m().domain(d).range([0,e.width]),y:m().domain(h).range([e.height,0])};var p;this.config.transition&&this.scene.length>0&&this.snapshotPositions();const y=l.toArray();this.scene=this.buildSceneNodes(e),this.config.decay&&this.applyDecay(this.scene,y),this.config.pulse&&this.applyPulse(this.scene,y),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}buildSceneNodes(e){const{config:t,buffer:n,scales:o}=this;if(!o||0===n.size)return[];const r=n.toArray();switch(t.chartType){case"line":return this.buildLineScene(r);case"area":return this.buildAreaScene(r);case"stackedarea":return this.buildStackedAreaScene(r);case"scatter":case"bubble":return this.buildPointScene(r);case"heatmap":return this.buildHeatmapScene(r,e);case"bar":return this.buildBarScene(r);case"swarm":return this.buildSwarmScene(r);case"waterfall":return this.buildWaterfallScene(r,e);case"candlestick":return this.buildCandlestickScene(r,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=ge(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]);n.push(me(e.data,this.scales,this.getX,this.getY,o,t,e.key))}return n}buildStackedAreaScene(e){return function(e,t,n,o,r,i){var s;const a=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||a.add(t)}const l=Array.from(a).sort((e,t)=>e-t),c=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}c.set(t.key,e)}let u;if(i){u=new Map;for(const t of l){let n=0;for(const o of e)n+=(null===(s=c.get(o.key))||void 0===s?void 0:s.get(t))||0;u.set(t,n||1)}}const d=[],h=new Map;for(const e of l)h.set(e,0);for(const n of e){const e=c.get(n.key),o=[],s=[];for(const n of l){let r=e.get(n)||0;const a=h.get(n);i&&(r/=u.get(n));const l=t.x(n);s.push([l,t.y(a)]),o.push([l,t.y(a+r)]),h.set(n,a+r)}d.push({type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key})}return d}(this.groupData(e),this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){const e=Math.min(...t),n=Math.max(...t);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}let i=null;if(this.getColor&&!this.config.pointStyle){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];i=new Map;let o=0;for(const e of t)i.set(e,n[o%n.length]),o++}for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},s=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(s=r(e))}if(i&&this.getColor){const t=this.getColor(o);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const a=ve(o,this.scales,this.getX,this.getY,s,e);a&&t.push(a)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=we(this.config.valueAccessor,"value"),r=new Set,i=new Set;for(const t of e)r.add(this.getX(t)),i.add(this.getY(t));const s=Array.from(r).sort((e,t)=>e-t),a=Array.from(i).sort((e,t)=>e-t);if(0===s.length||0===a.length)return n;const l=t.width/s.length,c=t.height/a.length,u=new Map;for(const t of e){const e=`${this.getX(t)}_${this.getY(t)}`;u.set(e,{val:o(t),datum:t})}let d=1/0,h=-1/0;for(const{val:e}of u.values())d>e&&(d=e),e>h&&(h=e);const f=h-d||1;for(let e=0;s.length>e;e++)for(let t=0;a.length>t;t++){const o=u.get(`${s[e]}_${a[t]}`);if(!o)continue;const r=(o.val-d)/f;n.push(xe(e*l,(a.length-1-t)*c,l,c,`rgb(${Math.round(220-180*r)},${Math.round(220-100*r)},${Math.round(255-50*r)})`,o.datum))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const i=[],s=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,a=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=we(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,d]=this.scales.x.domain(),[h,f]=this.scales.y.domain(),p=(d-u||1)/s,y=(f-h||1)/a,g=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/p),s-1),r=Math.min(Math.floor((n-h)/y),a-1);if(0>o||0>r)continue;const i=`${o}_${r}`;let l=g.get(i);l||(l={sum:0,count:0,data:[]},g.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of g){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,w=t.width/s,k=t.height/a;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,s=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=g.get(e);i.push(xe(r*w,(a-1-s)*k,w,k,c,{xi:r,yi:s,value:t,count:u.count,sum:u.sum,data:u.data}))}return i}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=ye(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort();o=[...t.filter(t=>e.has(t)),...i]}const r=[],i=this.scales,[s,a]=i.x.domain();for(const e of n.values()){const n=Math.max(e.start,s),l=Math.min(e.end,a);if(n>=l)continue;const c=i.x(n),u=i.x(l),d=Math.min(c,u)+.5,h=Math.max(c,u)-.5-d;if(h>0)if(o&&e.categories.size>0){let n=0;for(const s of o){const o=e.categories.get(s)||0;if(0===o)continue;const a=i.y(n),l=i.y(n+o);r.push(be(d,Math.min(a,l),h,Math.abs(a-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[s])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:s,categoryValue:o},s)),n+=o}}else{const t=i.y(0),n=i.y(e.total);r.push(be(d,Math.min(t,n),h,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const i=[],s=this.config.swarmStyle||{},a=null!==(t=s.radius)&&void 0!==t?t:3,l=null!==(n=s.fill)&&void 0!==n?n:"#007bff",c=null!==(o=s.opacity)&&void 0!==o?o:.7,u=s.stroke,d=s.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),s=this.scales.y(n);let h=l;if(this.getCategory){const e=this.getCategory(t);h=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||h}i.push({type:"point",x:o,y:s,r:a,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t})}return i}buildWaterfallScene(e,t){const n=[],o=this.scales,r=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===r.length)return n;let i=0;for(let e=0;r.length>e;e++){const s=r[e],a=this.getX(s),l=this.getY(s),c=i+l;let u;u=r.length-1>e?this.getX(r[e+1])-a:e>0?a-this.getX(r[e-1]):0;const d=o.x(a),h=0!==u?o.x(a+u):d+t.width/10,f=Math.min(d,h)+.5,p=Math.max(d,h)-.5-f;if(0>=p){i=c;continue}const y=o.y(i),g=o.y(c);n.push(be(f,Math.min(y,g),p,Math.abs(y-g),{fill:0>l?"#dc3545":"#28a745"},Object.assign(Object.assign({},s),{baseline:i,cumEnd:c,delta:l}))),i=c}return n}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",s=o.wickColor||"#333",a=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([o,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(d),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:i,wickColor:s,wickWidth:a,isUp:h,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=this.getBounds(t),s=this.scales.x(e);if(i&&0!==i)n.push([s,this.scales.y(r+i)]),o.push([s,this.scales.y(r-i)]);else{const e=this.scales.y(r);n.push([s,e]),o.push([s,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>a?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:s};else if("candlestick"===t.type)t._decayOpacity=s;else{const e=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:e*s})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var n;if(!this.config.pulse||!this.timestampBuffer)return;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const s=this.computePulseIntensity(n,o);s>0&&(t._pulseIntensity=s,t._pulseColor=r)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){this.prevPositionMap.clear();for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeIdentity(t,e);n&&("point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:t.r}):"rect"===t.type||"heatcell"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,w:t.w,h:t.h}):"candlestick"===t.type&&this.prevPositionMap.set(n,{x:t.x,y:t.openY}))}}getNodeIdentity(e,t){var n,o,r,i;switch(e.type){case"point":return`p:${void 0===e.datum?t:this.getX(e.datum)}_${this.getY(e.datum)}`;case"rect":return`r:${e.group||""}:${null!==(i=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==i?i:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return"c:"+this.getX(e.datum);default:return null}}startTransition(){var e,t,n,o,r,i;if(!this.config.transition||0===this.prevPositionMap.size)return;const s=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let a=!1;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeIdentity(s,e);if(!l)continue;const c=this.prevPositionMap.get(l);if(c)if("point"===s.type){const e={x:s.x,y:s.y,r:s.r};c.x===e.x&&c.y===e.y||(s._targetX=e.x,s._targetY=e.y,s._targetR=e.r,s.x=c.x,s.y=c.y,s.r=null!==(t=c.r)&&void 0!==t?t:s.r,a=!0)}else if("rect"===s.type){const e={x:s.x,y:s.y,w:s.w,h:s.h};c.x===e.x&&c.y===e.y&&c.w===e.w&&c.h===e.h||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=c.x,s.y=c.y,s.w=null!==(n=c.w)&&void 0!==n?n:s.w,s.h=null!==(o=c.h)&&void 0!==o?o:s.h,a=!0)}else if("heatcell"===s.type){const e={x:s.x,y:s.y,w:s.w,h:s.h};c.x===e.x&&c.y===e.y||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,a=!0)}}a&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:s})}advanceTransition(e){var t;if(!this.activeTransition)return!1;const n=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),o="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?n:1-Math.pow(1-n,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==e._targetR&&void 0!==n.r&&(e.r=n.r+(e._targetR-n.r)*o)}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}else if("heatcell"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}if(n>=1){for(const e of this.scene)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}return this.activeTransition=null,!1}return!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}))}resolveLineStyle(e,t){const n=this.config.lineStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle)return this.config.areaStyle(t||{});const o=this.config.lineStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}getData(){return this.buffer.toArray()}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.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],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){Object.assign(this.config,e)}}function Ee(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function Se(e,t,n){if(0===e.path.length)return null;const o=Ne(e.path,t);if(0>o)return null;const[r,i]=e.path[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function Me(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function Oe(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function je(e,t,n){const o=e.bodyWidth/2,r=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=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function Pe(e,t,n){if(0===e.topPath.length)return null;const o=Ne(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i;return{node:e,datum:e.datum,x:r,y:i,distance:Math.sqrt(s*s+a*a)}}function Ne(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}const _e={fill:t=>e.createElement("rect",{style:t,width:20,height:20}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:20,y2:20})};function ze(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,_e[n])(o(e,t)),r}function $e(t){const{legendGroups:n,customClickBehavior:o,title:r="Legend",width:i=100,height:s=20,orientation:a="vertical"}=t,l="vertical"===a?(({legendGroups:t,width:n,customClickBehavior:o})=>{let r=30;const i=[];return t.forEach((t,s)=>{r+=5,i.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+s,stroke:"gray",x1:0,y1:r,x2:n,y2:r})),r+=10,t.label&&(r+=20,i.push(e.createElement("text",{key:"legend-text-"+s,y:r,className:"legend-group-label"},t.label)),r+=10),i.push(e.createElement("g",{key:"legend-group-"+s,className:"legend-item",transform:`translate(0,${r})`},((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,s=[];let a=0;return i.forEach((t,i)=>{const l=ze(t,i,o,r);s.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(0,${a})`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:30},t.label))),a+=25}),s})(t,o))),r+=25*t.items.length+10}),i})({legendGroups:n,width:i,customClickBehavior:o}):(({legendGroups:t,title:n,height:o,customClickBehavior:r})=>{let i=0;const s=[],a=!1===n?10:40;return t.forEach((n,l)=>{n.label&&(s.push(e.createElement("text",{key:"legend-text-"+l,transform:`translate(${i},${a}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},n.label)),i+=20);const c=((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,s=[];let a=0;return i.forEach((t,i)=>{const l=ze(t,i,o,r);s.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(${a},0)`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:25},t.label))),a+=35,a+=8*t.label.length}),{items:s,offset:a}})(n,r);s.push(e.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(${i},${a})`},c.items)),i+=c.offset+5,t[l+1]&&s.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:i,y1:a-10,x2:i,y2:o+a+10})),i+=15}),e.createElement("g",null,!1!==n&&e.createElement("line",{x1:0,x2:i+10,y1:a-10,y2:a-10,stroke:"gray",className:"title-neatline"}),s)})({legendGroups:n,title:r,height:s,customClickBehavior:o});return e.createElement("g",null,void 0!==r&&e.createElement("text",{className:"legend-title",y:20,x:"horizontal"===a?0:i/2,textAnchor:"horizontal"===a?"start":"middle"},r),l)}function Be(e){return"string"==typeof e?{type:e}:e}function Ce({orient:t,config:o,values:r,scale:i,size:s,length:a}){const l=function(e){var t,n,o,r,i;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!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=n(()=>{if(0===r.length)return null;const n=i.domain(),o=s-8;if("boxplot"===l.type){const n=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)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(r);if(!n)return null;const{q1:s,median:a,q3:u,whiskerLow:d,whiskerHigh:h}=n,f=Math.min(.5*o,20),p=(o-f)/2+4;if(c){const n=i(s),o=i(u),r=i(a),c=i(d),y=i(h),g="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+g*(p+f/2),x2:y,y2:m+g*(p+f/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+g*p,x2:c,y2:m+g*(p+f),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:y,y1:m+g*p,x2:y,y2:m+g*(p+f),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-p-f:m+p,width:Math.abs(o-n),height:f,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-p-f:m+p,x2:r,y2:"top"===t?m-p:m+p+f,stroke:l.fill,strokeWidth:2}))}{const n=i(s),o=i(u),r=i(a),c=i(d),y=i(h),g="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+g*(p+f/2),y1:c,x2:m+g*(p+f/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+g*p,y1:c,x2:m+g*(p+f),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+g*p,y1:y,x2:m+g*(p+f),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-p-f:m+p,y:Math.min(n,o),width:f,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-p-f:m+p,y1:r,x2:"left"===t?m-p:m+p+f,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=w().domain(n).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,r)=>{if(null==n.x0||null==n.x1)return null;const s=n.length/d*o;if(c){const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-s:4,y:Math.min(o,o+a),width:s,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const s=e.length/d*(o/2),a=i((e.x0+e.x1)/2);r.push(c?`${a},${"top"===t?-(n-s):n-s}`:`${"left"===t?-(n-s):n-s},${a}`)}for(let e=u.length-1;e>=0;e--){const s=u[e];if(null==s.x0||null==s.x1)continue;const a=s.length/d*(o/2),l=i((s.x0+s.x1)/2);r.push(c?`${l},${"top"===t?-(n+a):n+a}`:`${"left"===t?-(n+a):n+a},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${s},${"top"===t?-r-4:r+4}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${s},${e}`),n.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${s}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${e},${s}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,s,a,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function De(e){return Math.round(100*e)/100+""}function We(t){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,xLabel:u,yLabel:d,xFormat:h,yFormat:f,showGrid:p,title:y,legend:g,foregroundGraphics:m,marginalGraphics:v,xValues:b,yValues:x,annotations:w,svgAnnotationRules:k,annotationFrame:A,children:E}=t,S=n(()=>c&&l?l.x.ticks(5).map(e=>({value:e,pixel:l.x(e),label:(h||De)(e)})):[],[c,l,h]),M=n(()=>c&&l?l.y.ticks(5).map(e=>({value:e,pixel:l.y(e),label:(f||De)(e)})):[],[c,l,f]),O=n(()=>w&&0!==w.length&&k?w.map((e,t)=>k(e,t,{scales:l?{time:l.x,value:l.y}:null,timeAxis:"x",width:o,height:r})).filter(Boolean):null,[w,k,o,r,A]);return c||y||g||m||v||O&&O.length>0||p||E?e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},p&&l&&e.createElement("g",{className:"stream-grid"},S.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"#e0e0e0",strokeWidth:1})),M.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"#e0e0e0",strokeWidth:1}))),c&&l&&e.createElement("g",{className:"stream-axes"},e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"#ccc",strokeWidth:1}),S.map((t,n)=>e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"#ccc",strokeWidth:1}),M.map((t,n)=>e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:15-a.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-a.left}, ${r/2})`,style:{userSelect:"none"}},d)),O,v&&l&&b&&x&&e.createElement(e.Fragment,null,v.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ce,{orient:"top",config:Be(v.top),values:b,scale:l.x,size:a.top,length:o})),v.bottom&&e.createElement("g",{transform:`translate(0, ${r})`},e.createElement(Ce,{orient:"bottom",config:Be(v.bottom),values:b,scale:l.x,size:a.bottom,length:o})),v.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ce,{orient:"left",config:Be(v.left),values:x,scale:l.y,size:a.left,length:r})),v.right&&e.createElement("g",{transform:`translate(${o}, 0)`},e.createElement(Ce,{orient:"right",config:Be(v.right),values:x,scale:l.y,size:a.right,length:r}))),m,E),y&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof y?y:null),g&&e.createElement("g",{transform:`translate(${i-a.right+10}, ${a.top})`},"object"==typeof(j=g)&&null!==j&&!e.isValidElement(j)&&"legendGroups"in j?e.createElement($e,{legendGroups:g.legendGroups,title:"",width:100}):g)):null;var j}function Le(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}const Te=(e,t,n,o)=>{var r;const i=t.filter(e=>"area"===e.type);for(const t of i){if(2>t.topPath.length)continue;e.beginPath();const[n,o]=t.topPath[0];e.moveTo(n,o);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();const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;if(e.globalAlpha=i,e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=1,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),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]);e.stroke()}e.globalAlpha=1}},Fe=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;if(null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=4;e.beginPath(),e.arc(t.x,t.y,t.r+n*t._pulseIntensity,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.5*t._pulseIntensity,e.stroke()}e.globalAlpha=1}},Re=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?He(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1};function He(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.w)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}const Ie={line:[Te,(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const i of r){if(2>i.path.length)continue;const s=i.style.stroke||"#007bff",a=i.style.strokeWidth||2,l=i.colorThresholds,c=i.rawValues;if(e.setLineDash(i.style.strokeDasharray?i.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=i.style.opacity&&(e.globalAlpha=i.style.opacity),e.lineWidth=a,l&&0!==l.length&&c&&c.length===i.path.length){let u=null,d=null,h=null,f=null,p=!1;function y(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),p=!0}function g(){p&&(e.stroke(),p=!1)}for(let m=0;i.path.length>m;m++){const[v,b]=i.path[m],x=c[m],w=Le(x,l,s);if(null!==u&&null!==f&&null!==h){if(w===f)e.lineTo(v,b);else{const k=[];for(const A of l){const E=A.value;(h>E||E>x)&&(E>h||x>E)||h===E||x===E||k.push({t:(E-h)/(x-h)})}k.sort((e,t)=>e.t-t.t);for(const S of k){const M=u+(v-u)*S.t,O=d+(b-d)*S.t,j=Le(h+(x-h)*Math.min(S.t+1e-4,1),l,s);e.lineTo(M,O),g(),y(j,M,O)}e.lineTo(v,b)}u=v,d=b,h=x,f=w}else y(w,v,b),u=v,d=b,h=x,f=w}g()}else{e.beginPath(),e.strokeStyle=s;const[P,N]=i.path[0];e.moveTo(P,N);for(let _=1;i.path.length>_;_++)e.lineTo(i.path[_][0],i.path[_][1]);e.stroke()}if(i.style.fill&&i.style.fillOpacity&&i.style.fillOpacity>0){e.beginPath(),e.globalAlpha=i.style.fillOpacity,e.fillStyle=i.style.fill;const[z,$]=i.path[0];e.moveTo(z,$);for(let C=1;i.path.length>C;C++)e.lineTo(i.path[C][0],i.path[C][1]);const B=i.path[0][0];e.lineTo(i.path[i.path.length-1][0],o.height),e.lineTo(B,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([])}}],area:[Te],stackedarea:[Te],scatter:[Fe],bubble:[Fe],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);for(const t of r){const n=t.style;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="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1}}],bar:[Re],swarm:[Fe],waterfall:[(e,t,n,o)=>{var r,i;Re(e,t);const s=t.filter(e=>"rect"===e.type);if(s.length>=2){e.save(),e.strokeStyle="#999",e.lineWidth=1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],a=s[t+1];if(!(null===(r=o.datum)||void 0===r?void 0:r.cumEnd)||!(null===(i=a.datum)||void 0===i?void 0:i.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=a.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke();const o=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1))}}]},Ye={top:20,right:20,bottom:30,left:40},Xe={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"},Ge={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 Ve({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:Ge},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}function qe({width:t,height:n,totalWidth:o,totalHeight:i,margin:s,dimension:l,scales:c,onBrush:u}){const d=r(null),h=r(null);return a(()=>{if(!d.current)return;const e=g(d.current).select(".brush-g"),o="x"===l?f():"y"===l?p():y();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(!c)return;if(!e.selection)return void u(null);let o,r;if("x"===l){const[t,i]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(n),c.y.invert(0)]}else if("y"===l){const[n,i]=e.selection;o=[c.x.invert(0),c.x.invert(t)],r=[c.y.invert(i),c.y.invert(n)]}else{const[[t,n],[i,s]]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(s),c.y.invert(n)]}u({x:o,y:r})}),e.call(o),h.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),h.current=null}},[t,n,l,c,u]),e.createElement("svg",{ref:d,width:o,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`}))}const Ue=o(function(t,o){var c;const{chartType:u,runtimeMode:d,data:h,xAccessor:f,yAccessor:p,colorAccessor:y,sizeAccessor:g,groupAccessor:m,lineDataAccessor:v,normalize:b,binSize:x,valueAccessor:w,arrowOfTime:k="right",windowMode:A="sliding",windowSize:E=200,timeAccessor:S,xExtent:M,yExtent:O,extentPadding:j=.1,sizeRange:P,size:N=[500,300],margin:_,className:z,background:$,lineStyle:B,pointStyle:C,areaStyle:D,swarmStyle:W,barColors:L,colorScheme:T,boundsAccessor:F,boundsStyle:R,openAccessor:H,highAccessor:I,lowAccessor:Y,closeAccessor:X,candlestickStyle:G,showAxes:V=!0,xLabel:q,yLabel:U,xFormat:Z,yFormat:K,tickFormatTime:Q,tickFormatValue:J,hoverAnnotation:ee,tooltipContent:te,customHoverBehavior:ne,enableHover:oe,annotations:re,svgAnnotationRules:ie,showGrid:se,legend:ae,backgroundGraphics:le,foregroundGraphics:ce,title:ue,categoryAccessor:de,brush:fe,onBrush:pe,decay:ye,pulse:ge,transition:me,staleness:ve,heatmapAggregation:be,heatmapXBins:xe,heatmapYBins:we,marginalGraphics:ke}=t,Ne=Object.assign(Object.assign({},Ye),_);if(ke){const e=60;ke.top&&e>Ne.top&&(Ne.top=e),ke.bottom&&e>Ne.bottom&&(Ne.bottom=e),ke.left&&e>Ne.left&&(Ne.left=e),ke.right&&e>Ne.right&&(Ne.right=e)}const _e=N[0]-Ne.left-Ne.right,ze=N[1]-Ne.top-Ne.bottom,$e=null!=ee?ee:oe,Be=r(null),Ce=r(0),De=r(!1),[Le,Te]=i(0),[Fe,Re]=i(null),He=r(null),[Ge,Ue]=i(null),[Ze,Ke]=i(!1),[Qe,Je]=i([]),[et,tt]=i([]),nt=r(()=>{}),ot="streaming"===d||["bar","swarm","waterfall"].includes(u),rt=n(()=>({chartType:u,runtimeMode:ot?"streaming":"bounded",windowSize:E,windowMode:A,arrowOfTime:ot?k:"right",extentPadding:j,xAccessor:ot?void 0:f,yAccessor:ot?void 0:p,timeAccessor:ot?S:void 0,valueAccessor:w,colorAccessor:y,sizeAccessor:g,groupAccessor:m,categoryAccessor:de,lineDataAccessor:v,xExtent:M,yExtent:O,sizeRange:P,binSize:x,normalize:b,boundsAccessor:F,boundsStyle:R,openAccessor:H,highAccessor:I,lowAccessor:Y,closeAccessor:X,candlestickStyle:G,lineStyle:B,pointStyle:C,areaStyle:D,swarmStyle:W,colorScheme:T,barColors:L,annotations:re,decay:ye,pulse:ge,transition:me,staleness:ve,heatmapAggregation:be,heatmapXBins:xe,heatmapYBins:we}),[u,E,A,k,j,f,p,S,w,y,g,m,de,v,M,O,P,x,b,F,R,H,I,Y,X,G,B,C,D,W,T,L,re,ye,ge,me,ve,be,xe,we,ot]),it=r(null);it.current||(it.current=new Ae(rt));const st=s(()=>{Ce.current||(Ce.current=requestAnimationFrame(()=>nt.current()))},[]);a(()=>{var e;null===(e=it.current)||void 0===e||e.updateConfig(rt),De.current=!0,st()},[rt,st]);const at=r(null);at.current||(at.current=new he(e=>{const t=it.current;t&&t.ingest(e)&&(De.current=!0,st())}));const lt=s(e=>{var t;null===(t=at.current)||void 0===t||t.push(e)},[]),ct=s(e=>{var t;null===(t=at.current)||void 0===t||t.pushMany(e)},[]),ut=s(()=>{var e,t;null===(e=at.current)||void 0===e||e.clear(),null===(t=it.current)||void 0===t||t.clear(),De.current=!0,st()},[st]);l(o,()=>({push:lt,pushMany:ct,clear:ut,getData:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[lt,ct,ut]),a(()=>{var e;h&&(null===(e=at.current)||void 0===e||e.setBoundedData(h))},[h]);const dt=r(()=>{}),ht=r(()=>{});dt.current=e=>{if(!$e)return;const t=Be.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ne.left,r=e.clientY-n.top-Ne.top;if(0>o||o>_e||0>r||r>ze)return void(He.current&&(He.current=null,Ue(null),ne&&ne(null),st()));const i=it.current;if(!i||0===i.scene.length)return;const s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"point":e=Ee(i,t,n);break;case"line":e=Se(i,t,n);break;case"rect":e=Me(i,t,n);break;case"heatcell":e=Oe(i,t,n);break;case"area":if(!1===i.interactive)break;e=Pe(i,t,n);break;case"candlestick":e=je(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,o,r);if(!s)return void(He.current&&(He.current=null,Ue(null),ne&&ne(null),st()));const a={data:s.datum,time:s.x,value:s.y,x:s.x,y:s.y};He.current=a,Ue(a),ne&&ne(a),st()},ht.current=()=>{He.current&&(He.current=null,Ue(null),ne&&ne(null),st())};const ft=s(e=>dt.current(e),[]),pt=s(()=>ht.current(),[]);nt.current=()=>{var e,t;Ce.current=0;const n=Be.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=it.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(i);s||r.computeScene({width:_e,height:ze});const a="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=N[0]*a,n.height=N[1]*a,n.style.width=N[0]+"px",n.style.height=N[1]+"px",o.scale(a,a),o.translate(Ne.left,Ne.top),o.clearRect(-Ne.left,-Ne.top,N[0],N[1]);const l=function(e){if(!e)return Xe;const t=getComputedStyle(e),n=t.getPropertyValue("--text-secondary").trim(),o=t.getPropertyValue("--text-primary").trim(),r=t.getPropertyValue("--surface-3").trim(),i=t.getPropertyValue("--surface-0").trim();return n||o?{axisStroke:r||Xe.axisStroke,tickText:n||Xe.tickText,crosshair:n?n+"66":Xe.crosshair,hoverFill:i?i+"4D":Xe.hoverFill,hoverStroke:n?n+"99":Xe.hoverStroke,pointRing:i||Xe.pointRing}:Xe}(n),c=null!==(e=null==ve?void 0:ve.threshold)&&void 0!==e?e:5e3,d=ve&&r.lastIngestTime>0&&i-r.lastIngestTime>c;d&&(o.globalAlpha=null!==(t=null==ve?void 0:ve.dimOpacity)&&void 0!==t?t:.5),$&&(o.fillStyle=$,o.fillRect(0,0,_e,ze));const h=Ie[u];if(h&&r.scales)for(const e of h)e(o,r.scene,r.scales,{width:_e,height:ze});d&&(o.globalAlpha=1),$e&&He.current&&r.scales&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;e.save();const a="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=a.stroke||s.crosshair,e.lineWidth=a.strokeWidth||1,e.setLineDash(a.strokeDasharray?a.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle="#007bff",e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}(o,He.current,_e,ze,"object"==typeof $e?$e:{},0,l);const y=De.current;if(De.current=!1,y&&r.scales&&(Re(r.scales),ke)){const e=r.getData(),t="function"==typeof f?f:e=>e[f||"x"],n="function"==typeof p?p:e=>e[p||"y"];Je(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),tt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}y&&re&&re.length>0&&ie&&Te(e=>e+1),(null==ve?void 0:ve.showBadge)&&Ke(!!d),(s||r.hasActivePulses)&&(Ce.current=requestAnimationFrame(()=>nt.current()))},a(()=>(st(),()=>{Ce.current&&cancelAnimationFrame(Ce.current)}),[st]),a(()=>{De.current=!0,st()},[u,_e,ze,V,$,B,st]),a(()=>{if(!ve)return;const e=setInterval(()=>{var e;const t=it.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=ve.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Ze&&(Ke(r),De.current=!0,st())},1e3);return()=>clearInterval(e)},[ve,Ze,st]);const yt=$e&&Ge?te?te(Ge):e.createElement(Ve,{hover:Ge}):null,gt=yt?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:Ne.left+Ge.x,top:Ne.top+Ge.y,transform:`translate(${Ge.x>.7*_e?"calc(-100% - 12px)":"12px"}, ${.3*ze>Ge.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},yt):null;return e.createElement("div",{className:"stream-xy-frame"+(z?" "+z:""),style:{position:"relative",width:N[0],height:N[1]},onMouseMove:$e?ft:void 0,onMouseLeave:$e?pt:void 0},le&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:N[0],height:N[1],pointerEvents:"none"}},le),e.createElement("canvas",{ref:Be,style:{position:"absolute",left:0,top:0}}),e.createElement(We,{width:_e,height:ze,totalWidth:N[0],totalHeight:N[1],margin:Ne,scales:Fe,showAxes:V,xLabel:q,yLabel:U,xFormat:Z||Q,yFormat:K||J,showGrid:se,title:ue,legend:ae,foregroundGraphics:ce,marginalGraphics:ke,xValues:Qe,yValues:et,annotations:re,svgAnnotationRules:ie,annotationFrame:Le}),(fe||pe)&&e.createElement(qe,{width:_e,height:ze,totalWidth:N[0],totalHeight:N[1],margin:Ne,dimension:null!==(c=null==fe?void 0:fe.dimension)&&void 0!==c?c:"xy",scales:Fe,onBrush:null!=pe?pe:()=>{}}),(null==ve?void 0:ve.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ve.badgePosition?{top:4,left:4}:"bottom-left"===ve.badgePosition?{bottom:4,left:4}:"bottom-right"===ve.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ze?"#dc3545":"#28a745",color:"white"})},Ze?"STALE":"LIVE"),gt)});function Ze(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}Ue.displayName="StreamXYFrame";const Ke={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[i,c]of t){let t=c.total;f&&n>0&&(t/=n);const p=a(c.pieces[0],s?i:e.name),y=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),s=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(be(e.x,n,e.width,Math.abs(s),p,y,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),s=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(be(n,e.x,Math.abs(s),e.width,p,y,i)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const f=d.length||1;for(const e of Object.values(o)){const t=e.width/f,n=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;d.length>o;o++){const i=n.get(d[o])||[];for(const n of i){const i=r(n),l=s(n,e.name);if(u){const r=e.x+o*t,s=a(0),u=a(i);c.push(be(r,Math.min(s,u),t,Math.abs(s-u),l,n,d[o]))}else{const r=e.x+o*t,s=a(0),u=a(i);c.push(be(Math.min(s,u),r,Math.abs(u-s),t,l,n,d[o]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,f="radial"===u,p=a.length>0,y=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(f){const t=g+(e.pctStart+e.pct/2)*y,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,f=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:f,y:p,r:d,style:u,datum:o})}}return l},pie:Ze,donut:Ze,boxplot:function(e,t){var n,o,r,i,s;const{scales:a,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:f}=a,p=[],y="vertical"===f,g=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const a=t[0],l=t[t.length-1],c=null!==(n=k(t,.25))&&void 0!==n?n:a,f=null!==(o=k(t,.5))&&void 0!==o?o:(a+l)/2,m=null!==(r=k(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,w=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:a,A=null!==(s=[...t].reverse().find(e=>x>=e))&&void 0!==s?s:l,E=d(e.pieceData[0],e.name),S=[];if(g)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=y?e.middle:h(n),r=y?h(n):e.middle;S.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(f),q3Pos:h(m),maxPos:h(A),stats:{min:w,q1:c,median:f,q3:m,max:A},style:E,datum:e.pieceData,category:e.name,outliers:S}),g)for(const e of S)p.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,o,r;const{scales:i,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],f="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],s=t[t.length-1],a=(s-i)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/a),p-1)]++;const g=Math.max(...d,1),m=e.width/2*.9;let v="";if(f){for(let t=0;p>t;t++){const n=u(i+(t+.5)*a),o=d[t]/g*m;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=p-1;t>=0;t--){const n=u(i+(t+.5)*a);v+=` L ${e.middle-d[t]/g*m} ${n}`}v+=" Z"}else{for(let t=0;p>t;t++){const n=u(i+(t+.5)*a),o=d[t]/g*m;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=p-1;t>=0;t--)v+=` L ${u(i+(t+.5)*a)} ${e.middle+d[t]/g*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const e=null!==(n=k(t,.25))&&void 0!==n?n:i,a=null!==(o=k(t,.5))&&void 0!==o?o:(i+s)/2,l=null!==(r=k(t,.75))&&void 0!==r?r:s;x={q1Pos:u(e),medianPos:u(a),q3Pos:u(l)}}const w=f?{x:e.x,y:Math.min(u(s),u(i)),width:e.width,height:Math.abs(u(s)-u(i))}:{x:Math.min(u(i),u(s)),y:e.x,width:Math.abs(u(s)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),f=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,s=a(n+t*o),c=a(n+(t+1)*o);l.push(be(Math.min(s,c),e.x+e.width-i,Math.abs(c-s),i,f,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,f=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/i),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),g=e.width*f;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/p*g}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/p*g} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(be(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(be(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class Qe{constructor(e){this.rExtent=new pe,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new fe(e.windowSize),this.getO=ke(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>we(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new pe)):(this.getR=we(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=ke(e.stackBy),this.getGroup=ke(e.groupBy),this.getColor=ke(e.colorAccessor),this.getConnector=ke(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new fe(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();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)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,i),a="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=v().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(s).range([o,n])}else a?(c=v().domain(i).range([0,e.height]).padding(l),u=m().domain(s).range([0,e.width])):(c=v().domain(i).range([0,e.width]).padding(l),u=m().domain(s).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[s,l]=i.extent;s===1/0&&(s=0,l=1);const c=l-s,u=c>0?c*(t.extentPadding||.05):1;return s-=u,l+=u,s>0&&(s=0),a?m().domain([s,l]).range([0,e.width]):m().domain([s,l]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===n)return t;if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let s=0,a=0;if("bar"===r&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>a&&(a=e);for(const e of n.values())s>e&&(s=e)}else if("bar"===r){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>a&&(a=e),s>e&&(s=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>a&&(a=e),s>e&&(s=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(s=e),t!==-1/0&&(a=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(s=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(a=this.config.rExtent[1]));const l=a-s,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(s-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(a+=c),"bar"!==r&&"clusterbar"!==r||(s>0&&(s=0),0>a&&(a=0)),[s,a]}buildColumns(e,t,n,o,r){var i;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,f;u?(c=h,f=u.get(e)||n.bandwidth(),h+=f+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,f=n.bandwidth()),s[e]={name:e,x:c,y:0,width:f,middle:c+f/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=Ke[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return s}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(e,t):this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>a?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",a=new Map;for(let e=0;t.length>e;e++)a.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=a.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=r-n;i>o&&(t._pulseIntensity=1-o/i,t._pulseColor=s)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const r=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,r;if(!this.config.transition||0===this.prevPositionMap.size)return;const i=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let s=!1;for(let e=0;this.scene.length>e;e++){const i=this.scene[e];let a=null;if("point"===i.type?a="p:"+e:"rect"===i.type&&(a=`r:${i.group||""}:${null!==(n=null===(t=i.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!a)continue;const l=this.prevPositionMap.get(a);l&&("point"===i.type?l.x===i.x&&l.y===i.y||(i._targetX=i.x,i._targetY=i.y,i.x=l.x,i.y=l.y,s=!0):"rect"===i.type&&(l.x===i.x&&l.y===i.y&&l.w===i.w&&l.h===i.h||(i._targetX=i.x,i._targetY=i.y,i._targetW=i.w,i._targetH=i.h,i.x=l.x,i.y=l.y,i.w=null!==(o=l.w)&&void 0!==o?o:i.w,i.h=null!==(r=l.h)&&void 0!==r?r:i.h,s=!0)))}s&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:i})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),i="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?r:1-Math.pow(1-r,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.prevPositionMap.get("p:0");if(!t)continue;e.x=t.x+(e._targetX-t.x)*i,e.y=t.y+(e._targetY-t.y)*i}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:0}`,r=this.prevPositionMap.get(t);if(!r)continue;e.x=r.x+(e._targetX-r.x)*i,e.y=r.y+(e._targetY-r.y)*i,void 0!==r.w&&(e.w=r.w+(e._targetW-r.w)*i,e.h=r.h+(e._targetH-r.h)*i)}if(r>=1){for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function Je(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{datum:e.datum,x:e.x+e.w/2,y:e.y,distance:0,category:e.group}}function et(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function tt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;let s=Math.atan2(r,o);0>s&&(s+=2*Math.PI);let a=e.startAngle%(2*Math.PI),l=e.endAngle%(2*Math.PI);if(0>a&&(a+=2*Math.PI),0>l&&(l+=2*Math.PI),!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function nt(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category}}return null}function ot(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category}}function rt(e){return Math.round(100*e)/100+""}function it(t){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,oLabel:u,rLabel:d,oFormat:h,rFormat:f,showGrid:p,title:y,legend:g,foregroundGraphics:m,annotations:v,svgAnnotationRules:b,annotationFrame:x,children:w}=t,k="radial"===(null==l?void 0:l.projection),A="horizontal"===(null==l?void 0:l.projection),E=n(()=>c&&l&&!k?l.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2,label:h?h(e):e}}):[],[c,l,h,k]),S=n(()=>c&&l&&!k?l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(f||rt)(e)})):[],[c,l,f,k]),M=n(()=>v&&0!==v.length&&b?v.map((e,t)=>b(e,t,{scales:l?{time:l.r,value:l.r}:null,timeAxis:"x",width:o,height:r})).filter(Boolean):null,[v,b,o,r,x]);return c||y||g||m||M&&M.length>0||p||w?e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},p&&l&&!k&&e.createElement("g",{className:"ordinal-grid"},S.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:A?t.pixel:0,y1:A?0:t.pixel,x2:A?t.pixel:o,y2:A?r:t.pixel,stroke:"#e0e0e0",strokeWidth:1}))),c&&l&&!k&&e.createElement("g",{className:"ordinal-axes"},A?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"#ccc",strokeWidth:1}),E.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:15-a.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-a.left}, ${r/2})`,style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"#ccc",strokeWidth:1}),S.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},d)):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"#ccc",strokeWidth:1}),E.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"#ccc",strokeWidth:1}),S.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:15-a.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-a.left}, ${r/2})`,style:{userSelect:"none"}},d))),M,m,w),y&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof y?y:null),g&&e.createElement("g",{transform:`translate(${i-a.right+10}, ${a.top})`},"object"==typeof(O=g)&&null!==O&&!e.isValidElement(O)&&"legendGroups"in O?e.createElement($e,{legendGroups:g.legendGroups,title:"",width:100}):g)):null;var O}const st=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath(),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),null!=t.style.fillOpacity&&(e.globalAlpha=t.style.fillOpacity),e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1},at=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine&&(e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8,e.beginPath(),e.moveTo(0,t.iqrLine.q1Pos),e.lineTo(0,t.iqrLine.q3Pos),e.stroke(),e.beginPath(),e.arc(0,t.iqrLine.medianPos,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1),e.restore()}},lt=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},ct=e=>[lt,...e],ut={bar:ct([Re]),clusterbar:ct([Re]),point:ct([Fe]),swarm:ct([Fe]),pie:[st],donut:[st],boxplot:ct([(e,t,n,o)=>{var r,i;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=a,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},Fe]),violin:ct([at]),histogram:ct([Re]),ridgeline:ct([at]),timeline:ct([Re])},dt={top:50,right:40,bottom:60,left:70},ht={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function ft({hover:t}){var n,o,r,i;const s=t.data||{};if(Array.isArray(s)){const t=(null===(n=s[0])||void 0===n?void 0:n.category)||"",o=s.length;return e.createElement("div",{className:"semiotic-tooltip",style:ht},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=s.bin&&null!=s.count){const t=s.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:ht},s.category&&e.createElement("div",{style:{fontWeight:"bold"}},s.category+""),e.createElement("div",null,"Count: ",s.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const a=s.category||s.name||s.group||s.__rName||"",l=null!==(i=null!==(r=null!==(o=s.value)&&void 0!==o?o:s.__rValue)&&void 0!==r?r:s.pct)&&void 0!==i?i:"";if(!a&&""===l){const t=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:ht},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:ht},a&&e.createElement("div",{style:{fontWeight:"bold"}},a+""),""!==l&&e.createElement("div",null,"number"==typeof l?l.toLocaleString():l+""))}const pt=o(function(t,o){const{chartType:c,runtimeMode:u,data:d,oAccessor:h="category",rAccessor:f="value",colorAccessor:p,stackBy:y,groupBy:g,multiAxis:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,projection:w="vertical",size:k=[600,400],margin:A,barPadding:E,innerRadius:S,normalize:M,startAngle:O,dynamicColumnWidth:j,bins:P,showOutliers:N,showIQR:_,amplitude:z,connectorAccessor:$,connectorStyle:B,rExtent:C,oExtent:D,extentPadding:W=.05,oSort:L,windowMode:T="sliding",windowSize:F=200,pieceStyle:R,summaryStyle:H,colorScheme:I,barColors:Y,showAxes:X=!0,oLabel:G,rLabel:V,oFormat:q,rFormat:U,enableHover:Z=!0,hoverAnnotation:K,tooltipContent:Q,customHoverBehavior:J,annotations:ee,svgAnnotationRules:te,showGrid:ne=!1,legend:oe,backgroundGraphics:re,foregroundGraphics:ie,title:se,className:ae,background:le,centerContent:ce,decay:ue,pulse:de,transition:fe,staleness:pe}=t,ye=n(()=>Object.assign(Object.assign({},dt),A),[A]),ge=k[0]-ye.left-ye.right,me=k[1]-ye.top-ye.bottom,ve=r(null),be=r(!0),xe=r(0),we=r(null),ke=r(()=>{}),[Ae,Ee]=i(null),[Se,Me]=i(null),[Oe,je]=i(0),[Pe,Ne]=i(!1),_e=Z||K,ze="streaming"===u,$e=n(()=>({chartType:c,runtimeMode:ze?"streaming":"bounded",windowSize:F,windowMode:T,extentPadding:W,projection:w,oAccessor:ze?void 0:h,rAccessor:ze?void 0:f,colorAccessor:p,stackBy:y,groupBy:g,multiAxis:m,timeAccessor:ze?v:void 0,valueAccessor:ze?b||("string"==typeof f||"function"==typeof f?f:void 0):void 0,categoryAccessor:ze?x||h:void 0,rExtent:C,oExtent:D,barPadding:E,innerRadius:S,normalize:M,startAngle:O,dynamicColumnWidth:j,bins:P,showOutliers:N,showIQR:_,amplitude:z,connectorAccessor:$,connectorStyle:B,oSort:L,pieceStyle:R,summaryStyle:H,colorScheme:I,barColors:Y,decay:ue,pulse:de,transition:fe,staleness:pe}),[c,F,T,W,w,h,f,p,y,g,m,v,b,x,C,D,E,S,M,O,j,P,N,_,z,$,B,L,R,H,I,Y,ue,de,fe,pe,ze]),Be=r(null);Be.current||(Be.current=new Qe($e));const Ce=s(()=>{xe.current||(xe.current=requestAnimationFrame(()=>ke.current()))},[]);a(()=>{var e;null===(e=Be.current)||void 0===e||e.updateConfig($e),be.current=!0,Ce()},[$e,Ce]);const De=r(null);De.current||(De.current=new he(e=>{const t=Be.current;t&&t.ingest(e)&&(be.current=!0,Ce())}));const We=s(e=>{var t;null===(t=De.current)||void 0===t||t.push(e)},[]),Le=s(e=>{var t;null===(t=De.current)||void 0===t||t.pushMany(e)},[]),Te=s(()=>{var e,t;null===(e=De.current)||void 0===e||e.clear(),null===(t=Be.current)||void 0===t||t.clear(),be.current=!0,Ce()},[Ce]);l(o,()=>({push:We,pushMany:Le,clear:Te,getData:()=>{var e,t;return null!==(t=null===(e=Be.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Be.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[We,Le,Te]),a(()=>{var e;d&&(null===(e=De.current)||void 0===e||e.setBoundedData(d))},[d]);const Fe=r(()=>{}),Re=r(()=>{});Fe.current=e=>{if(!_e)return;const t=ve.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ye.left,r=e.clientY-n.top-ye.top;if(0>o||o>ge||0>r||r>me)return void(we.current&&(we.current=null,Ee(null),J&&J(null),Ce()));const i=Be.current;if(!i||0===i.scene.length)return;const s="radial"===w,a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=Je(i,t,n);break;case"point":e=et(i,t,n);break;case"wedge":e=tt(i,t,n);break;case"boxplot":e=nt(i,t,n);break;case"violin":e=ot(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,s?o-ge/2:o,s?r-me/2:r);if(!a)return void(we.current&&(we.current=null,Ee(null),J&&J(null),Ce()));const l={data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y};we.current=l,Ee(l),J&&J(l),Ce()},Re.current=()=>{we.current&&(we.current=null,Ee(null),J&&J(null),Ce())};const He=s(e=>Fe.current(e),[]),Ie=s(()=>Re.current(),[]);ke.current=()=>{var e,t;xe.current=0;const n=ve.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Be.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(i),a=be.current;a&&!s&&(r.computeScene({width:ge,height:me}),be.current=!1);const l="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=k[0]*l,n.height=k[1]*l,n.style.width=k[0]+"px",n.style.height=k[1]+"px",o.scale(l,l),o.clearRect(0,0,k[0],k[1]);const u=null!==(e=null==pe?void 0:pe.threshold)&&void 0!==e?e:5e3,d=pe&&r.lastIngestTime>0&&i-r.lastIngestTime>u;d&&(o.globalAlpha=null!==(t=null==pe?void 0:pe.dimOpacity)&&void 0!==t?t:.5),le&&(o.fillStyle=le,o.fillRect(0,0,k[0],k[1]));const h="radial"===w;h?(o.save(),o.translate(ye.left+ge/2,ye.top+me/2)):o.translate(ye.left,ye.top);const f=ut[c]||[],p={width:ge,height:me};for(const e of f)e(o,r.scene,r.scales,p);h&&o.restore(),d&&(o.globalAlpha=1),a&&r.scales&&(Me(r.scales),je(e=>e+1)),(null==pe?void 0:pe.showBadge)&&Ne(!!d),(s||r.hasActivePulses)&&(xe.current=requestAnimationFrame(()=>ke.current()))},a(()=>(Ce(),()=>{xe.current&&cancelAnimationFrame(xe.current)}),[Ce]),a(()=>{be.current=!0,Ce()},[c,ge,me,X,le,Ce]),a(()=>{if(!pe)return;const e=setInterval(()=>{var e;const t=Be.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=pe.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Pe&&(Ne(r),be.current=!0,Ce())},1e3);return()=>clearInterval(e)},[pe,Pe,Ce]);const Ye=_e&&Ae?Q?Q(Ae):e.createElement(ft,{hover:Ae}):null,Xe="radial"===w,Ge=Ae?Xe?Ae.x+ge/2:Ae.x:0,Ve=Ae?Xe?Ae.y+me/2:Ae.y:0,qe=Ye?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:ye.left+Ge,top:ye.top+Ve,transform:`translate(${Ge>.7*ge?"calc(-100% - 12px)":"12px"}, ${.3*me>Ve?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},Ye):null;return e.createElement("div",{className:"stream-ordinal-frame"+(ae?" "+ae:""),style:{position:"relative",width:k[0],height:k[1]},onMouseMove:_e?He:void 0,onMouseLeave:_e?Ie:void 0},re&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:k[0],height:k[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${ye.left},${ye.top})`},re)),e.createElement("canvas",{ref:ve,style:{position:"absolute",top:0,left:0,width:k[0],height:k[1]}}),e.createElement(it,{width:ge,height:me,totalWidth:k[0],totalHeight:k[1],margin:ye,scales:Se,showAxes:X,oLabel:G,rLabel:V,oFormat:q,rFormat:U,showGrid:ne,title:se,legend:oe,foregroundGraphics:ie,annotations:ee,svgAnnotationRules:te,annotationFrame:Oe}),ce&&"radial"===w&&e.createElement("div",{style:{position:"absolute",left:ye.left+ge/2,top:ye.top+me/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ce),(null==pe?void 0:pe.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pe.badgePosition?{top:4,left:4}:"bottom-left"===pe.badgePosition?{bottom:4,left:4}:"bottom-right"===pe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Pe?"#dc3545":"#28a745",color:"white"})},Pe?"STALE":"LIVE"),qe)});pt.displayName="StreamOrdinalFrame";const yt={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},gt={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class mt{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n){for(let o=0;this.capacity>o;o++){const r=this.particles[o];if(!r.active)continue;const i=n[r.edgeIndex];if(!i||!i.bezier){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=vt(i.bezier,r.t,r.offset);r.x=s.x,r.y=s.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function vt(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,s=Math.min(Math.floor(i),r-1),a=i-s,[l,c,u,d]=e[s],h=bt(l,c,u,d,a),f=d.x-l.x,p=d.y-l.y,y=Math.sqrt(f*f+p*p);if(y>.001){const e=f/y;h.x+=-p/y*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,s]=e.points,a=bt(o,r,i,s,t),l=s.x-o.x,c=s.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;a.x+=-c/u*n*e.halfWidth*2,a.y+=t*n*e.halfWidth*2}return a}function bt(e,t,n,o,r){const i=1-r,s=i*i,a=s*i,l=r*r,c=l*r;return{x:a*e.x+3*s*r*t.x+3*i*l*n.x+c*o.x,y:a*e.y+3*s*r*t.y+3*i*l*n.y+c*o.y}}const xt=(e=1)=>(t,n)=>{const o=t[t.length-1];return o&&Math.round(o.x/e)===Math.round(n.x/e)&&Math.round(o.y/e)===Math.round(n.y/e)||t.push(n),t},wt=e=>{let t,n,o,r,i,s,a,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.y1,s=e.target.y0,a=M(i,s),l=a(.5),c=a(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${s}L${o},${s}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,a=M(t,n),o=a(.5),r=a(.5),i=e.y0-e.sankeyWidth/2,s=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${s} ${n},${s}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function kt(e){const t=function(){const e=H();let t=function(e){return e.x},n=function(e){return e.y},o=function(e){return e.r},r=I;function i(i){if(i.multiple){const s=o,l=i.multiple.reduce((e,t)=>e+t.weight,0);o=()=>l;let c=a(i.points).filter(e=>"forward"===e.direction).reduce(xt(),[]);const u=[];return i.multiple.forEach((e,t)=>{o=()=>e.weight;const n=a(c);u.push(n);const r=i.multiple[t+1];if(r){const e=n.reverse().filter(e=>"back"===e.direction).reduce(xt(),[]);o=()=>r.weight;const t=a(e);c=t.reverse().filter(e=>"back"===e.direction).reduce(xt(),[])}}),o=s,u.map(o=>e.x(t).y(n).curve(r)(o))}const s=a(i).reduce(xt(),[]);return e.x(t).y(n).curve(r)(s)}return i.x=function(e){return arguments.length?(t=e,i):t},i.y=function(e){return arguments.length?(n=e,i):n},i.r=function(e){return arguments.length?(o=e,i):o},i.interpolate=function(e){return arguments.length?(r=e,i):r},i;function s(e){const r=n(e.target)-n(e.source),i=t(e.target)-t(e.source),s=Math.atan2(i,r)+Math.PI/2,a=s+.5*Math.PI,l=s+.5*Math.PI;return{x1:t(e.source)+o(e.source)*Math.cos(a),y1:n(e.source)-o(e.source)*Math.sin(a),x2:t(e.target)+o(e.target)*Math.cos(l),y2:n(e.target)-o(e.target)*Math.sin(l)}}function a(e){const t=[];let n=0,o={x1:0,y1:0,x2:0,y2:0};for(;e.length>n;){if(n!==e.length-1&&(o=s({source:e[n],target:e[n+1]}),t.push({x:o.x1,y:o.y1,direction:"forward"},{x:o.x2,y:o.y2,direction:"forward"}),t.length>3)){const e=t.length-1,n={a:t[e-3],b:t[e-2]},o={a:t[e-1],b:t[e]},r=l(n.a.x,n.a.y,n.b.x,n.b.y,o.a.x,o.a.y,o.b.x,o.b.y);!0===r.found&&(n.b.x=r.x,n.b.y=r.y,o.a.x=r.x,o.a.y=r.y)}n++}for(n--;n>=0;){if(0!==n&&(o=s({source:e[n],target:e[n-1]}),t.push({x:o.x1,y:o.y1,direction:"back"},{x:o.x2,y:o.y2,direction:"back"}),t.length>3)){const e=t.length-1,n={a:t[e-3],b:t[e-2]},o={a:t[e-1],b:t[e]},r=l(n.a.x,n.a.y,n.b.x,n.b.y,o.a.x,o.a.y,o.b.x,o.b.y);!0===r.found&&(n.b.x=r.x,n.b.y=r.y,o.a.x=r.x,o.a.y=r.y)}n--}return t}function l(e,t,n,o,r,i,s,a){let l,c;const u={x:null,y:null,found:!1},d=(a-i)*(n-e)-(s-r)*(o-t);if(0===d)return u;l=t-i,c=e-r;const h=(n-e)*l-(o-t)*c;return l=((s-r)*l-(a-i)*c)/d,c=h/d,u.x=e+l*(n-e),u.y=t+l*(o-t),l>0&&1>l&&c>0&&1>c&&(u.found=!0),u}}();return t.x(e=>e.x),t.y(e=>e.y),t.r(()=>e.sankeyWidth/2),t("down"===e.direction?[{x:e.circularPathData.sourceY,y:e.circularPathData.sourceX},{x:e.circularPathData.sourceY,y:e.circularPathData.leftFullExtent},{x:e.circularPathData.verticalFullExtent,y:e.circularPathData.leftFullExtent},{x:e.circularPathData.verticalFullExtent,y:e.circularPathData.rightFullExtent},{x:e.circularPathData.targetY,y:e.circularPathData.rightFullExtent},{x:e.circularPathData.targetY,y:e.circularPathData.targetX}]:[{x:e.circularPathData.sourceX,y:e.circularPathData.sourceY},{x:e.circularPathData.leftFullExtent,y:e.circularPathData.sourceY},{x:e.circularPathData.leftFullExtent,y:e.circularPathData.verticalFullExtent},{x:e.circularPathData.rightFullExtent,y:e.circularPathData.verticalFullExtent},{x:e.circularPathData.rightFullExtent,y:e.circularPathData.targetY},{x:e.circularPathData.targetX,y:e.circularPathData.targetY}])}const At={left:_,right:N,center:P,justify:j},Et={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,s,a;if(0===e.length)return;const l="vertical"===n.orientation?"down":"right",c=n.nodeAlign||"justify",u=null!==(r=n.nodeWidth)&&void 0!==r?r:15,d=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,h=null!==(s=n.iterations)&&void 0!==s?s:100,f=e.map(e=>Object.assign({},e)),p=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));let y;y="down"===l?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const g=O().extent(y).links(p).nodes(f).nodeAlign(At[c]||j).nodeId(e=>e.id).nodeWidth(u).iterations(h);g.nodePaddingRatio&&g.nodePaddingRatio(d),g();for(const t of f){const n=e.find(e=>e.id===t.id);n&&(n.x0=t.x0,n.x1=t.x1,n.y0=t.y0,n.y1=t.y1,n.value=t.value,n.depth=t.depth,n.sourceLinks=t.sourceLinks,n.targetLinks=t.targetLinks,n.width=t.x1-t.x0,n.height=t.y1-t.y0,n.x=t.x0+(t.x1-t.x0)/2,n.y=t.y0+(t.y1-t.y0)/2)}for(const n of p){const o=n.source,r=n.target,i="object"==typeof o&&null!==o?o.id:o+"",s="object"==typeof r&&null!==r?r.id:r+"",c=t.find(e=>("string"==typeof e.source?e.source:e.source.id)===i&&("string"==typeof e.target?e.target:e.target.id)===s);if(c){c.y0=n.y0,c.y1=n.y1,c.sankeyWidth=null!==(a=n.width)&&void 0!==a?a:0,c.circular=!!n.circular,c.circularPathData=n.circularPathData,c.direction=l;const t=e.find(e=>e.id===i),o=e.find(e=>e.id===s);t&&(c.source=t),o&&(c.target=o)}}},buildScene(e,t,n,o){var r,i;const s="vertical"===n.orientation?"down":"right",a=n.nodeStyle,l=n.edgeStyle,c=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,u=n.edgeColorBy||"source",d=Array.isArray(n.colorScheme)?n.colorScheme:z,h=new Map;e.forEach((e,t)=>{h.set(e.id,d[t%d.length])});const f=[],p=[],y=[];for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=a?a(t):{},r={fill:o.fill||h.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};f.push({type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const g=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of g){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o;o=e.circular&&e.circularPathData?kt(e):wt(e);let r="#999";l?r=l(e).fill||r:"target"===u&&n?r=h.get(n.id)||r:t&&(r=h.get(t.id)||r);const s=l?l(e):{},a={fill:r,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:c,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity};p.push({type:"bezier",pathD:o,bezierCache:e.bezier,style:a,datum:e})}if(!1!==n.showLabels){const t=(m=n.nodeLabel)?"function"==typeof m?m:e=>e[m]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,l,c;"down"===s?(a=n.x0+e/2,l=n.y1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),l=n.y0+r/2),y.push({x:a,y:l,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var m;return{sceneNodes:f,sceneEdges:p,labels:y}}},St={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const s=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),a=null!==(i=n.forceStrength)&&void 0!==i?i:.1,l=o[0]/2,c=o[1]/2;for(let t=0;e.length>t;t++){const n=e[t];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(t+.5),o=2.399963229728653*t;n.x=l+e*Math.cos(o),n.y=c+e*Math.sin(o)}}const u=Ot(n.nodeSize,n.nodeSizeRange,e),d=V().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),h=o[1]/o[0],f=q().force("charge",U().strength(e=>-25*(e=>u(e))(e))).force("x",Z(o[0]/2).strength(.1*h)).force("y",K(o[1]/2).strength(.1));if(f.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));f.force("link",d),f.force("link").links(e)}.1>f.alpha()&&f.alpha(1),f.stop();for(let e=0;s>e;++e)f.tick();for(const n of t){if("string"==typeof n.source){const t=e.find(e=>e.id===n.source);t&&(n.source=t)}if("string"==typeof n.target){const t=e.find(e=>e.id===n.target);t&&(n.target=t)}}},buildScene(e,t,n,o){var r,i,s;const a=n.nodeStyle,l=n.edgeStyle,c=Ot(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:z,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],f=[],p=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(t),n=a?a(t):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}for(const n of t){const t="object"==typeof n.source?n.source:Mt(e,n.source),o="object"==typeof n.target?n.target:Mt(e,n.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const r=l?l(n):{},a={stroke:r.stroke||"#999",strokeWidth:null!==(i=r.strokeWidth)&&void 0!==i?i:1,opacity:null!==(s=r.opacity)&&void 0!==s?s:.6};f.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:a,datum:n})}if(!1!==n.showLabels){const t=(y=n.nodeLabel)?"function"==typeof y?y:e=>e[y]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(n);p.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:h,sceneEdges:f,labels:p}}};function Mt(e,t){return e.find(e=>e.id===t)}function Ot(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],s=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>i[0];const a=null!==(o=A(s))&&void 0!==o?o:0,l=null!==(r=E(s))&&void 0!==r?r:1;if(a===l)return()=>(i[0]+i[1])/2;const c=m().domain([a,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const jt=z,Pt={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:s}=n,a=Math.min(o[0],o[1])/2,l=a-i,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const p=e.length,y=Array.from({length:p},()=>Array.from({length:p},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=f.get("string"==typeof e.source?e.source:e.source.id),o=f.get(t);if(void 0===n||void 0===o)continue;const r=d(e);y[n][o]=r}const g=J().padAngle(r);s&&g.sortGroups(s);const m=g(y),v=m.groups,b=Y().innerRadius(l).outerRadius(a);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}for(const n of t){const t="string"==typeof n.source?n.source:n.source.id,o="string"==typeof n.target?n.target:n.target.id,r=e.find(e=>e.id===t),i=e.find(e=>e.id===o);r&&(n.source=r),i&&(n.target=i)}for(const n of m){const o=e[n.source.index].id,r=e[n.target.index].id,i=t.find(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id;return t===o&&n===r||t===r&&n===o});i&&(i.chordData=n)}},buildScene(e,t,n,o){var r,i;const{groupWidth:s=20,edgeOpacity:a=.5}=n,l=Math.min(o[0],o[1])/2,c=l-s,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,f=n.edgeStyle,p=n.edgeColorBy||"source",y=Array.isArray(n.colorScheme)?n.colorScheme:jt,g=new Map;e.forEach((e,t)=>{g.set(e.id,y[t%y.length])});const m=Q().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(n).fill||g.get(n.id)||y[t%y.length]:g.get(n.id)||y[t%y.length];const s=h?h(n):{},a={fill:i,stroke:s.stroke||"black",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:a,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m({source:Object.assign(Object.assign({},t.source),{startAngle:t.source.startAngle-Math.PI/2,endAngle:t.source.endAngle-Math.PI/2}),target:Object.assign(Object.assign({},t.target),{startAngle:t.target.startAngle-Math.PI/2,endAngle:t.target.endAngle-Math.PI/2})});if(!n)continue;const o=Nt(n,u,d);let r="#999";if(f)r=f(e).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===p&&n?r=g.get(n.id)||r:t&&(r=g.get(t.id)||r)}const s=f?f(e):{},l={fill:r,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:a,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(w=n.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,s=i-Math.PI/2;x.push({x:u+Math.cos(s)*o,y:d+Math.sin(s)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:b,labels:x}}};function Nt(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const _t={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const s=n.chartType,a=(l=n.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=ee(i,a);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(s){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=se();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=ie();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var r,i;const s=null!==(r=t.padding)&&void 0!==r?r:4,a=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=oe().size([n,o]).tile(re).padding(s);a>0&&l.paddingTop(a),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;ne().size([n,o]).padding(i)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var r;te().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,d,h)}const f=u.descendants();e.length=0,t.length=0;const p=new Map;for(let t=0;f.length>t;t++){const o=f[t],i={id:Dt(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===s||"cluster"===s?zt(i,o,n):"treemap"===s||"partition"===s?$t(i,o):"circlepack"===s&&Bt(i,o),i.__hierarchyNode=o,e.push(i),p.set(o,i)}if("tree"===s||"cluster"===s)for(const e of f)if(e.parent){const n=p.get(e.parent),o=p.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var s,a,l,c,u;const d=[],h=[],f=[],p=n.treeOrientation||"vertical",y="radial"===p,g=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,n=t.y;y&&(e+=g,n+=m);const o=r(t),i={fill:o.fill||"#4d430c",stroke:o.stroke||"#fff",strokeWidth:null!==(s=o.strokeWidth)&&void 0!==s?s:1,opacity:o.opacity};d.push({type:"circle",cx:e,cy:n,r:v,style:i,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(a=n.edgeOpacity)&&void 0!==a?a:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,s=n.x,a=n.y;y&&(o+=g,r+=m,s+=g,a+=m);const u=Ct(o,r,s,a,p),d=i(e),f={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:f,datum:e})}if(!1!==n.showLabels){const t=Wt(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,s=n.x,a=n.y;if(y&&(s+=g,a+=m),y){const e=s-g,t=a-m,n=Math.sqrt(e*e+t*t);n>0?(o=s+e/n*10,r=a+t/n*10,i=0>e?"end":"start"):(o=s,r=a-12,i="middle")}else"horizontal"===p?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=s-v-6,i="end"):(o=s+v+6,i="start"),r=a):(o=s,r=a+v+14,i="middle");f.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:f}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const s=[],a=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const a=o(n);let c=a.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const u={fill:c,stroke:a.stroke||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};s.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Wt(t.nodeLabel);for(const o of e){const e=o.x1-o.x0,r=o.y1-o.y0;if(0>=e||0>=r)continue;if((null===(i=o.data)||void 0===i?void 0:i.children)&&o.data.children.length>0&&"partition"!==t.chartType)continue;const s=n?n(o):o.id;s&&(30>e||16>r||a.push({x:o.x0+e/2,y:o.y0+r/2,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,r)/6))}))}}return{sceneNodes:s,sceneEdges:[],labels:a}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,s,a,l;const c=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const a=o(n);let l=a.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=d[n.depth%d.length]);const u={fill:l,stroke:a.stroke||"#fff",strokeWidth:null!==(i=a.strokeWidth)&&void 0!==i?i:1,opacity:null!==(s=a.opacity)&&void 0!==s?s:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Wt(t.nodeLabel);for(const t of e){const e=null!==(a=t.__radius)&&void 0!==a?a:5,o=n?n(t):t.id;if(!o)continue;if(15>e)continue;const r=!((null===(l=t.data)||void 0===l?void 0:l.children)&&t.data.children.length>0);u.push({x:t.x,y:r?t.y:t.y-e+14,text:o+"",anchor:"middle",baseline:r?"middle":"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:r?void 0:"#000",stroke:r?void 0:"#fff",strokeWidth:r?void 0:3,paintOrder:r?void 0:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function zt(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function $t(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Bt(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Ct(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}function Dt(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Wt(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}const Lt={sankey:Et,force:St,chord:Pt,tree:_t,cluster:_t,treemap:_t,circlepack:_t,partition:_t};function Tt(e){return Lt[e]}class Ft{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},yt),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new mt(2e3))}updateConfig(e){this.config=e,this.tensionConfig=Object.assign(Object.assign({},yt),e.tensionConfig),"sankey"===e.chartType&&e.showParticles?this.particlePool||(this.particlePool=new mt(2e3)):this.particlePool=null}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:s="value"}=this.config,a="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear();for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Rt(e)),{data:t}))}for(const e of t){const t=l(e)+"",n=c(e)+"",o=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},Rt(t)),{data:e})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Rt(n)),{data:e})),this.edges.set(`${t}\0${n}`,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:e})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;this.nodes.has(t)||(this.nodes.set(t,Rt(t)),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Rt(n)),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),a=this.edges.get(s);return a?(a.value+=o,this.tension+=this.tensionConfig.weightChange):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||this.tension>=this.tensionConfig.threshold}runLayout(e){const t=Tt(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());if(0!==n.length||t.hierarchical){if(this.prepareForRelayout(),t.computeLayout(n,o,this.config,e),t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear();for(const e of n)this.nodes.set(e.id,e);for(const e of o)this.edges.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e)}this.finalizeLayout(),this.saveTargetPositions(),n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration}),this.layoutVersion++}}buildScene(e){const t=Tt(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:s}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=s}advanceTransition(e){if(!this.transition)return!1;const t=Math.min((e-this.transition.startTime)/this.transition.duration,1),n=1-Math.pow(1-t,3);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0+(e._targetX0-e._prevX0)*n,e.x1=e._prevX1+(e._targetX1-e._prevX1)*n,e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n);for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n,e.sankeyWidth=e._prevSankeyWidth+(e._targetSankeyWidth-e._prevSankeyWidth)*n);return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.y1,i=n.y0,s=M(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,s=M(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e.sankeyWidth||1)/2,n=e.circularPathData;let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.leftFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.targetY,y:n.rightFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.leftFullExtent,y:n.sourceY},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.rightFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,s=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+s/3},{x:t.x+2*i/3,y:t.y+2*s/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}clear(){this.nodes.clear(),this.edges.clear(),this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.particlePool&&this.particlePool.clear()}}function Rt(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Ht(e,t,n){switch(e.type){case"circle":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,n);case"rect":return function(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{type:"node",datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;let s=Math.atan2(r,o);0>s&&(s+=2*Math.PI);let a,l=e.startAngle,c=e.endAngle;if(0>l&&(l+=2*Math.PI),0>c&&(c+=2*Math.PI),a=l>c?s>=l||c>=s:s>=l&&c>=s,a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}function It(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),s=document.createElement("canvas").getContext("2d");if(!s)return null;if(s.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,s="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&s?(i.x1+s.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let s=((t-e.x1)*o+(n-e.y1)*r)/i;s=Math.max(0,Math.min(1,s));const a=e.x1+s*o,l=e.y1+s*r,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=document.createElement("canvas").getContext("2d");if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0}}catch(e){}return null}(e,t,n);default:return null}}function Yt(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:s,labels:a,title:l,legend:c,foregroundGraphics:u,annotations:d,svgAnnotationRules:h}=t;return e.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},a.map((t,n)=>e.createElement("text",{key:"label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),d&&h&&d.map((t,r)=>{const i=h(t,r,{width:n,height:o});return i?e.createElement(e.Fragment,{key:"annotation-"+r},i):null}),u),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:s.top},l):null,c&&"object"==typeof c&&"legendGroups"in c?e.createElement("g",{transform:`translate(${r-s.right+10},${s.top})`},c.legendGroups.map((t,n)=>{var o;return e.createElement("g",{key:"legend-group-"+n},null===(o=t.items)||void 0===o?void 0:o.map((t,n)=>e.createElement("g",{key:"legend-item-"+n,transform:`translate(0,${20*n})`},e.createElement("rect",{x:0,y:0,width:12,height:12,fill:t.color,rx:2}),e.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},t.label))))})):c?e.createElement("g",{transform:`translate(${r-s.right+10},${s.top})`},c):null)}function Xt(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const s=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.5*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(s)),e.restore()}function Gt(e,t){var n;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),e.restore()}function Vt(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const s=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(s)),e.restore()}function qt(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Yt.displayName="NetworkSVGOverlay";const Ut={category10:z,tableau10:R,set3:F,blues:T,reds:L,greens:W,oranges:D,purples:C,viridis:B,plasma:$},Zt=z;function Kt(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):Zt[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+""))%Zt.length]}function Qt(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>e[t]))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return b().domain(o).range(n).unknown("#999");const i=Ut[n]||Ut.category10;if(r&&"function"==typeof i)return e=>i(Number(e)/Math.max(...o.map(Number)));{const e=Array.isArray(i)?i:Zt;return b().domain(o).range(e).unknown("#999")}}function Jt(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}const en={top:20,right:80,bottom:20,left:80},tn={top:40,right:40,bottom:40,left:40},nn=new Set(["chord","force","circlepack"]),on=[800,600],rn={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 sn({data:t}){var n,o,r,i,s,a;if("edge"===t.type){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:rn},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let s=c;for(;s;){const e=null!==(i=null!==(o=null===(n=s.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=s.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),s=s.parent}t.length>1&&t.shift();const a=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:rn},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===a?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(s=l.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(a=l.targetLinks)||void 0===a?void 0:a.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:rn},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const an=o(function(t,o){const{chartType:c,nodes:u,edges:d,data:h,initialEdges:f,nodeIDAccessor:p="id",sourceAccessor:y="source",targetAccessor:g="target",valueAccessor:m="value",childrenAccessor:v,hierarchySum:b,orientation:x="horizontal",nodeAlign:w="justify",nodePaddingRatio:k=.05,nodeWidth:A=15,iterations:E=300,forceStrength:S=.1,padAngle:M=.01,groupWidth:O=20,sortGroups:j,edgeSort:P,treeOrientation:N="vertical",edgeType:_="curve",padding:z,paddingTop:$,tensionConfig:B,showParticles:C=!1,particleStyle:D,nodeStyle:W,edgeStyle:L,colorBy:T,colorScheme:F="category10",edgeColorBy:R="source",edgeOpacity:H=.5,colorByDepth:I=!1,nodeSize:Y=8,nodeSizeRange:X=[5,20],nodeLabel:G,showLabels:V=!0,size:q=on,margin:U,className:Z,background:K,enableHover:Q=!0,tooltipContent:J,onTopologyChange:ee,annotations:te,svgAnnotationRules:ne,legend:oe,title:re,foregroundGraphics:ie,backgroundGraphics:se}=t,ae=nn.has(c)?tn:en,le=Object.assign(Object.assign({},ae),U),ce=q[0]-le.left-le.right,ue=q[1]-le.top-le.bottom,de=n(()=>Object.assign(Object.assign({},yt),B),[B]),he=n(()=>Object.assign(Object.assign({},gt),D),[D]),fe=n(()=>({chartType:c,nodeIDAccessor:p,sourceAccessor:y,targetAccessor:g,valueAccessor:m,childrenAccessor:v,hierarchySum:b,orientation:x,nodeAlign:w,nodePaddingRatio:k,nodeWidth:A,iterations:E,forceStrength:S,padAngle:M,groupWidth:O,sortGroups:j,edgeSort:P,treeOrientation:N,edgeType:_,padding:z,paddingTop:$,tensionConfig:de,showParticles:C,particleStyle:he,nodeStyle:W,edgeStyle:L,nodeLabel:G,showLabels:V,colorBy:T,colorScheme:F,edgeColorBy:R,edgeOpacity:H,colorByDepth:I,nodeSize:Y,nodeSizeRange:X}),[c,p,y,g,m,v,b,x,w,k,A,E,S,M,O,j,P,N,_,z,$,de,C,he,W,L,G,V,T,F,R,H,I,Y,X]),pe=r(null),ye=r(0),ge=r(0),me=r(!0),ve=r(()=>{}),be=r(null);be.current||(be.current=new Ft(fe));const[xe,we]=i(null),[ke,Ae]=i(0),[Ee,Se]=i(0),Me=r(null),Oe=r(new Map),je=r(0),Pe=s(e=>{if("function"==typeof T)return T(e);if("string"==typeof T&&e.data){const t=e.data[T];if(void 0!==t){if(!Oe.current.has(t+"")){const e=Array.isArray(F)?F:Zt;Oe.current.set(t+"",e[je.current++%e.length])}return Oe.current.get(t+"")}}if(!Oe.current.has(e.id)){const t=Array.isArray(F)?F:Zt;Oe.current.set(e.id,t[je.current++%t.length])}return Oe.current.get(e.id)},[T,F]);s(e=>{if("function"==typeof R)return R(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===R&&n?Pe(n):t?Pe(t):"#999"},[R,Pe]);const Ne=s(e=>{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===(he.colorBy||"source")&&n?Pe(n):t?Pe(t):"#999"},[he.colorBy,Pe]),_e="sankey"===c&&C,ze=s(()=>{ye.current&&!_e||ye.current||(ye.current=requestAnimationFrame(()=>ve.current()))},[_e]);a(()=>{var e;null===(e=be.current)||void 0===e||e.updateConfig(fe),me.current=!0,ze()},[fe,ze]);const $e=s(()=>{const e=be.current;if(e&&(e.runLayout([ce,ue]),e.buildScene([ce,ue]),me.current=!0,Ae(e.layoutVersion),ee)){const{nodes:t,edges:n}=e.getLayoutData();ee(t,n)}},[ce,ue,ee]),Be=s(e=>{const t=be.current;t&&(t.ingestEdge(e)&&$e(),ze())},[$e,ze]),Ce=s(e=>{const t=be.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&$e(),ze()},[$e,ze]),De=s(()=>{var e;null===(e=be.current)||void 0===e||e.clear(),Oe.current.clear(),je.current=0,Ae(0),we(null),Me.current=null,me.current=!0,ze()},[ze]),We=s(()=>{const e=be.current;e&&(e.tension+=999,$e(),ze())},[$e,ze]);l(o,()=>({push:Be,pushMany:Ce,clear:De,getTopology:()=>{var e,t;return null!==(t=null===(e=be.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},relayout:We,getTension:()=>{var e,t;return null!==(t=null===(e=be.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Be,Ce,De,We]);const Le=["tree","cluster","treemap","circlepack","partition"].includes(c),Te=Le?h||(Array.isArray(d)?void 0:d):void 0;a(()=>{const e=be.current;if(e)if(Le&&Te)e.ingestHierarchy(Te,[ce,ue]),e.buildScene([ce,ue]),me.current=!0,ze();else{const t=u||[],n=Array.isArray(d)?d:[];if(0===t.length&&0===n.length)return;e.ingestBounded(t,n,[ce,ue]),e.buildScene([ce,ue]),me.current=!0,ze()}},[u,d,h,Te,Le,ce,ue,fe,ze]),a(()=>{f&&f.length>0&&Ce(f)},[]);const Fe=r(()=>{}),Re=r(()=>{});Fe.current=e=>{if(!Q)return;const t=pe.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-le.left,r=e.clientY-n.top-le.top;if(0>o||o>ce||0>r||r>ue)return void(Me.current&&(Me.current=null,we(null),ze()));const i=be.current;if(!i)return;const s=function(e,t,n,o,r=30){let i=null,s=r,a=1/0;for(const t of e){const e=Ht(t,n,o);if(e)if("rect"===t.type){const n=t.w*t.h;a>n&&(i=e,a=n)}else s>e.distance&&(i=e,s=e.distance)}if(i)return i;for(const e of t){const t=It(e,n,o);t&&s>t.distance&&(i=t,s=t.distance)}return i}(i.sceneNodes,i.sceneEdges,o,r);if(!s)return void(Me.current&&(Me.current=null,we(null),ze()));const a={type:s.type,data:s.datum,x:s.x,y:s.y};Me.current=a,we(a),ze()},Re.current=()=>{Me.current&&(Me.current=null,we(null),ze())};const He=s(e=>Fe.current(e),[]),Ie=s(()=>Re.current(),[]);ve.current=()=>{var e;ye.current=0;const t=pe.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const o=be.current;if(!o)return;const r=performance.now(),i=ge.current?Math.min((r-ge.current)/1e3,.1):.016;ge.current=r;const s=o.advanceTransition(r);(s||me.current)&&o.buildScene([ce,ue]);const a="undefined"!=typeof window&&window.devicePixelRatio||1;if(t.width=q[0]*a,t.height=q[1]*a,t.style.width=q[0]+"px",t.style.height=q[1]+"px",n.scale(a,a),n.translate(le.left,le.top),n.clearRect(-le.left,-le.top,q[0],q[1]),K&&(n.fillStyle=K,n.fillRect(0,0,ce,ue)),function(e,t){for(const n of t)switch(n.type){case"bezier":Xt(e,n);break;case"line":Gt(e,n);break;case"ribbon":Vt(e,n);break;case"curved":qt(e,n)}}(n,o.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),e.restore())}}(n,o.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore())}}(n,o.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(n,o.sceneNodes),C&&o.particlePool){const t=Array.from(o.edges.values());if(t.length>0){!function(e,t,n,o){var r,i;const s=null!==(r=o.spawnRate)&&void 0!==r?r:gt.spawnRate,a=null!==(i=o.maxPerEdge)&&void 0!==i?i:gt.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=a)continue;const i=r.value*s*n,l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<a;t++)e.spawn(o)}}(o.particlePool,t,i,he);const r=.5*(null!==(e=he.speedMultiplier)&&void 0!==e?e:1);o.particlePool.step(i,r,t),function(e,t,n,o,r){var i,s;const a=null!==(i=o.radius)&&void 0!==i?i:gt.radius,l=null!==(s=o.opacity)&&void 0!==s?s:gt.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const s=t.particles[i];if(!s.active)continue;const l=n[s.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(n,o.particlePool,t,he,Ne)}}const l=me.current;me.current=!1,(l||s)&&Se(e=>e+1),(_e||s)&&(ye.current=requestAnimationFrame(()=>ve.current()))},a(()=>(ze(),()=>{ye.current&&cancelAnimationFrame(ye.current)}),[ze]),a(()=>{me.current=!0,ze()},[c,ce,ue,K,ze]);const Ye=Q&&xe?e.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:le.left+xe.x,top:le.top+xe.y,transform:`translate(${xe.x>.6*ce?"calc(-100% - 12px)":"12px"}, ${.3*ue>xe.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},J?J(xe):e.createElement(sn,{data:xe})):null,Xe=be.current;return e.createElement("div",{className:"stream-network-frame"+(Z?" "+Z:""),style:{position:"relative",width:q[0],height:q[1]},onMouseMove:Q?He:void 0,onMouseLeave:Q?Ie:void 0},se&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:q[0],height:q[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${le.left},${le.top})`},se)),e.createElement("canvas",{ref:pe,style:{position:"absolute",top:0,left:0}}),e.createElement(Yt,{width:ce,height:ue,totalWidth:q[0],totalHeight:q[1],margin:le,labels:(null==Xe?void 0:Xe.labels)||[],title:re,legend:oe,foregroundGraphics:ie,annotations:te,svgAnnotationRules:ne,annotationFrame:Ee}),Ye)});an.displayName="StreamNetworkFrame";const ln=(e,t,n,o)=>{const r=(e.note.label||e.note.title).length;return[Math.min(e.note.wrap||120,r*t)+2*o,Math.ceil(r*t/120)*n+2*o]};function cn(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function un(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 dn(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:f,disable:p,events:y={},"data-testid":g}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-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 e.createElement("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":g},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=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);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}));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&&a.push(e.createElement("path",{key:"bracket-path",d:un((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||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const p=16,y=s?u?[s]:cn(s,c):[],g=i?u?[i]:cn(i,c):[],m="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[];y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:f,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),g.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:f,y:v},g.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:p},t))));let x=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(y.length+g.length)*p+(g.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const w=(y.length+g.length)*p+(g.length>0?p:0);let k=0;return"topBottom"===d?0>o&&(k=-w):"leftRight"===d&&("middle"===h?k=-w/2:("bottom"===h||0>o)&&(k=-w)),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(l,v,b,h))}function hn(t){const{noteData:n}=t,{screenCoordinates:o}=n,r="string"==typeof n.type?n.type:"label",i=n.eventListeners||n.events||{};if(n.coordinates&&o){const t=n.nx||o[0][0]+n.dx,i=n.ny||o[0][1]+n.dy,s=o.map((o,s)=>{const a=Object.assign({},n,{note:0===s?n.note:{label:""},x:o[0],y:o[1],nx:t,ny:i});return e.createElement(dn,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+s},a,{type:r}))});return e.createElement("g",null,s)}const s=n.note||{title:"none",label:n.label};return e.createElement(dn,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${n.i}`,events:i},n,{type:r}))}function fn(t){let o=c(null),r=pn(t);return[function({children:r}){let i=n(()=>pn(t),[]);return e.createElement(o.Provider,{value:i,children:r})},e=>{var t;let n=null!==(t=u(o))&&void 0!==t?t:r;return function(e,t){const[n,o]=i(t);return d(()=>e(()=>o(t)),[e]),n}(n.subscribe,()=>e(n.getState()))}]}function pn(e){let t=new EventTarget,n=e(function(e){n=Object.assign(n,e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}let[yn,gn]=fn(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function mn(e,t,n){return"number"==typeof n?n:t&&t.find(t=>t.props.orient===e)?50:10}const vn=(e,t,n)=>`${e.map(bn).join(",")}${JSON.stringify(t)}${n.join(",")}`;function bn(e){if(!e||!e.props||!e.props.noteData)return"";const{note:t={}}=e.props.noteData,{label:n,title:o}=t;return`${e.props.noteData.id||`${e.props.noteData.x}-${e.props.noteData.y}`}-${n}=${o}`}function xn(e,n=8,o){const{noteWidth:r=o}=e;let i=r;"number"==typeof r&&(i=()=>r);const s=e.note&&e.note.wrap||120,a=e.note.label||e.note.label||"";return r&&i(e)||(t.isValidElement(e.note)?100:Math.min(s,a.length*n))}function wn(e,n=8,o=20,r){const{noteHeight:i=r}=e;let s=i;"number"==typeof i&&(s=()=>i);const a=e.note&&e.note.wrap||120,l=e.note.label||e.note.title||"";return i&&s(e)||(t.isValidElement(e.note)?30:Math.ceil(l.length*n/a)*o+(e.note.label&&e.note.title?o:0))}const kn=(e,t)=>t.map((t,n)=>e.svgAnnotationRule(t,n,e)).filter(e=>null!=e),An=(t,n)=>{let o=n.adjustedAnnotations,r=n.adjustedAnnotationsKey,i=n.adjustableAnnotations,s=n.fixedAnnotations,a=[],l=[];const c=n.adjustedAnnotationsKey,u=n.adjustedAnnotationsDataVersion,{annotations:d,annotationHandling:h=!1,size:f,svgAnnotationRule:p,htmlAnnotationRule:y}=t,g="object"==typeof h?h:{layout:{type:h},dataVersion:""},{dataVersion:m=""}=g;if(p){const n=kn(t,d);r=vn(n,g,f),!1===h&&(o=i),o=o.length!==i.length||c!==r||u!==m?((t,n,o)=>{const{layout:r={type:!1,noteHeight:void 0,noteWidth:void 0}}=n;if(!1===r.type)return t;const{noteWidth:i,noteHeight:s}=r;let{margin:a={top:0,bottom:0,left:0,right:0}}=o;const{size:l,axes:c=[]}=o;if(a="number"==typeof a?{top:a,left:a,right:a,bottom:a}:a,"bump"===r.type)return function(e,t,n,o,r){const{padding:i=1,characterWidth:s=8,lineHeight:a=20,iterations:l=500,pointSizeFunction:c=o,labelSizeFunction:u=r||ln}=t,d=e.map((e,t)=>{const n=(e.props.noteData.x[0]||e.props.noteData.x)+(void 0!==e.props.noteData.dx?e.props.noteData.dx:-10*(t%3-1)),o=(e.props.noteData.y[0]||e.props.noteData.y)+(void 0!==e.props.noteData.dy?e.props.noteData.dy:10*(t%3-1)),[r,l]=u(e.props.noteData,s,a,i);return{x:n,y:o,above:e.props.noteData.y>o,left:e.props.noteData.x>n,width:r,height:l,type:"label",name:"",originalNote:e}}),h=e.map(e=>({x:e.props.noteData.x,y:e.props.noteData.y,fx:e.props.noteData.x,fy:e.props.noteData.y,r:c&&c(e.props.noteData)||5,type:"point",originalNote:e})),f=function(){let e,t=[],n=[],o=1,r=1,i={start:e=>{},width:e=>{},height:e=>{},label:e=>{},anchor:e=>{},alt_energy:e=>{},alt_schedule:e=>{}},s=!1;const a=function(e){let o=t.length,r=0,i=t[e].x-n[e].x,s=n[e].y-t[e].y,a=Math.sqrt(i*i+s*s);a>0&&(r+=.2*a),i/=a,s/=a,r+=i>0&&s>0?0:0>i&&s>0?3:0>i&&0>s?6:9;let l,c,d,h,f,p,y,g=t[e].x,m=t[e].y-t[e].height+2,v=t[e].x+t[e].width,b=t[e].y+2;for(let i=0;o>i;i++)i!==e&&(u(n[e].x,t[e].x,n[i].x,t[i].x,n[e].y,t[e].y,n[i].y,t[i].y)&&(r+=1),l=t[i].x,d=t[i].y-t[i].height+2,c=t[i].x+t[i].width,h=t[i].y+2,f=Math.max(0,Math.min(c,v)-Math.max(l,g)),p=Math.max(0,Math.min(h,b)-Math.max(d,m)),y=f*p,r+=30*y),l=n[i].x-n[i].r,d=n[i].y-n[i].r,c=n[i].x+n[i].r,h=n[i].y+n[i].r,f=Math.max(0,Math.min(c,v)-Math.max(l,g)),p=Math.max(0,Math.min(h,b)-Math.max(d,m)),y=f*p,r+=30*y;return r},l=function(i){let l,c,u=Math.floor(Math.random()*t.length),d=t[u].x,h=t[u].y;l=s?e(u,t,n):a(u),t[u].x+=5*(Math.random()-.5),t[u].y+=5*(Math.random()-.5),t[u].x>o&&(t[u].x=d),0>t[u].x&&(t[u].x=d),t[u].y>r&&(t[u].y=h),0>t[u].y&&(t[u].y=h),c=s?e(u,t,n):a(u);let f=c-l;Math.random()<Math.exp(-f/i)||(t[u].x=d,t[u].y=h)},c=function(i){let l,c=Math.floor(Math.random()*t.length),u=t[c].x,d=t[c].y;l=s?e(c,t,n):a(c);let h=.5*(Math.random()-.5),f=Math.sin(h),p=Math.cos(h);t[c].x-=n[c].x,t[c].y-=n[c].y;let y,g=t[c].x*f+t[c].y*p;t[c].x=t[c].x*p-t[c].y*f+n[c].x,t[c].y=g+n[c].y,t[c].x>o&&(t[c].x=u),0>t[c].x&&(t[c].x=u),t[c].y>r&&(t[c].y=d),0>t[c].y&&(t[c].y=d),y=s?e(c,t,n):a(c);let m=y-l;Math.random()<Math.exp(-m/i)||(t[c].x=u,t[c].y=d)},u=function(e,t,n,o,r,i,s,a){let l,c,u,d,h;return u=(a-s)*(t-e)-(o-n)*(i-r),d=(o-n)*(r-s)-(a-s)*(e-n),h=(t-e)*(r-s)-(i-r)*(e-n),l=d/u,c=h/u,!(0>l||l>1||0>c||c>1)},d=function(e,t,n){return e-t/n};return i.start=function(e){let n=t.length,o=1;for(let t=0;e>t;t++){for(let e=0;n>e;e++).5>Math.random()?l(o):c(o);o=d(o,1,e)}},i.width=function(e){return arguments.length?(o=e,i):o},i.height=function(e){return arguments.length?(r=e,i):r},i.label=function(e){return arguments.length?(t=e,i):t},i.anchor=function(e){return arguments.length?(n=e,i):n},i.alt_energy=function(t){return arguments.length?(e=t,s=!0,i):a},i.alt_schedule=function(e){return arguments.length?i:d},i}();return f.label(d),f.anchor(h),f.width(n[0]),f.height(n[1]),f.start(l),d.forEach(e=>{if("label"===e.type){const t=function(e,t,n){return e.y>t.y?[t.x+t.width/2+n/2,t.y-t.height+n/2]:[t.x+t.width/2,t.y]}(e.originalNote.props.noteData,e,i);e.originalNote.props.noteData.nx=t[0],e.originalNote.props.noteData.ny=t[1]}}),e}(t,r,l,o.pointSizeFunction,o.labelSizeFunction);if("marginalia"===r.type){const{marginOffset:n,orient:o="nearest",characterWidth:u=8,lineHeight:d=20,padding:h=2,axisMarginOverride:f={}}=r,p="nearest"===o?["left","right","top","bottom"]:Array.isArray(o)?o:[o],y=p.find(e=>"left"===e),g=p.find(e=>"right"===e),m=p.find(e=>"top"===e),v=p.find(e=>"bottom"===e),b=[],x=[],w=[],k=[];for(const e of t){const t=e.props.noteData,n=t.x[0]||t.x,o=t.y[0]||t.y,r=y?n:1/0,i=g?l[0]-n:1/0,s=m?o:1/0,a=Math.min(r,i,s,v?l[1]-o:1/0);r===a?b.push(e):i===a?x.push(e):s===a?w.push(e):k.push(e)}const A=new ae.Force({minPos:void 0!==f.top?0+f.top:0-a.top,maxPos:void 0!==f.bottom?l[1]-f.bottom:v?l[1]:l[1]+a.bottom}).nodes(b.map(e=>new ae.Node(e.props.noteData.y[0]||e.props.noteData.y,wn(e.props.noteData,u,d,i)+h))).compute(),E=new ae.Force({minPos:void 0!==f.top?0+f.top:m?0:0-a.top,maxPos:void 0!==f.bottom?l[1]-f.bottom:l[1]+a.bottom}).nodes(x.map(e=>new ae.Node(e.props.noteData.y[0]||e.props.noteData.y,wn(e.props.noteData,u,d,i)+h))).compute(),S=new ae.Force({minPos:void 0!==f.left?0+f.left:y?0:0-a.left,maxPos:void 0!==f.right?l[0]-f.right:l[0]+a.right}).nodes(w.map(e=>new ae.Node(e.props.noteData.x[0]||e.props.noteData.x,xn(e.props.noteData,u,s)+h))).compute(),M=new ae.Force({minPos:void 0!==f.left?0+f.left:0-a.left,maxPos:void 0!==f.right?l[0]-f.right:g?l[0]:l[0]+a.right}).nodes(k.map(e=>new ae.Node(e.props.noteData.x[0]||e.props.noteData.x,xn(e.props.noteData,u,s)+h))).compute(),O=Math.max(...k.map(e=>wn(e.props.noteData,u,d,i)+h)),j=Math.max(...w.map(e=>wn(e.props.noteData,u,d,i)+h)),P=Math.max(...b.map(e=>xn(e.props.noteData,u,s)+h)),N=Math.max(...x.map(e=>xn(e.props.noteData,u,s)+h)),_=A.nodes(),z=E.nodes(),$=S.nodes(),B=M.nodes();return b.forEach((t,o)=>{const r=0-_[o].layerIndex*P-mn("left",c,n),i=_[o].currentPos;t.props.noteData.nx=r,t.props.noteData.ny=i,t.props.noteData.note&&!e.isValidElement(t)&&(t.props.noteData.note.orientation=t.props.noteData.note.orientation||"leftRight",t.props.noteData.note.align=t.props.noteData.note.align||"right")}),x.forEach((t,o)=>{const r=l[0]+z[o].layerIndex*N+mn("right",c,n),i=z[o].currentPos;t.props.noteData.nx=r,t.props.noteData.ny=i,t.props.noteData.note&&!e.isValidElement(t)&&(t.props.noteData.note.orientation=t.props.noteData.note.orientation||"leftRight",t.props.noteData.note.align=t.props.noteData.note.align||"left")}),w.forEach((e,t)=>{const o=$[t].currentPos,r=0-$[t].layerIndex*j-mn("top",c,n);e.props.noteData.nx=o,e.props.noteData.ny=r}),k.forEach((e,t)=>{const o=B[t].currentPos,r=l[1]+B[t].layerIndex*O+mn("bottom",c,n);e.props.noteData.nx=o,e.props.noteData.ny=r}),t}return t})(i,g,t):i.map((t,n)=>{const r=Object.assign(Object.assign({},o[n].props.noteData),t.props.noteData);return e.createElement(hn,{key:t.key,noteData:r})}),a=[...o,...s]}return y&&(l=((e,t)=>t.map((t,n)=>e.htmlAnnotationRule(t,n,e)).filter(e=>null!=e))(t,d)),{svgAnnotations:a,htmlAnnotations:l,adjustedAnnotations:o,adjustedAnnotationsKey:r,adjustedAnnotationsDataVersion:m}};function En(t){const{legendSettings:n,margin:o,size:r,annotations:s,annotationHandling:l}=t,c=gn(e=>e.tooltip);let u=null!=c?s.concat(c):s,d=gn(e=>e.changeTooltip);const h=Object.assign(Object.assign({},t),{annotations:u,voronoiHover:e=>{d(e)}}),f="object"==typeof l?l:{layout:{type:l},dataVersion:""},{dataVersion:p=""}=f,[y,g]=i([]),[m,v]=i([]),[b,x]=i([]),[w,k]=i(""),[A,E]=i(p),S=kn(h,u),M=S.filter(e=>e.props&&e.props.noteData&&!e.props.noteData.fixedPosition),O=vn(M,f,r);let j;if(a(()=>{const e=S.filter(e=>!e.props||!e.props.noteData||e.props.noteData.fixedPosition),t=An(h,{adjustedAnnotations:y,adjustedAnnotationsKey:w,adjustedAnnotationsDataVersion:A,adjustableAnnotations:M,fixedAnnotations:e});g(t.adjustedAnnotations),k(t.adjustedAnnotationsKey),E(t.adjustedAnnotationsDataVersion),v(t.svgAnnotations),x(t.htmlAnnotations)},[O,p,u.length,u.map(e=>function(e){const t=new Set;return JSON.stringify(e,(e,n)=>t.has(n)?"...":"object"==typeof n?(t.add(n),"note"===e?`${n.label}-${n.title}`:"connector"===e?`${n.end}-${n.type}`:"subject"===e?""+n.radius:"object"==typeof n.column?`${n.column.x}-${n.column.y}-${n.column.name}`:n.voronoiX||n.voronoiY||n.x||n.y||n.dx||n.dy||n.label||n.type||n.key||n.hierarchicalID||n.id||n.name?`${n.voronoiX}-${n.voronoiY}-${n.dx}-${n.dy}-${n.x}-${n.y}-${n.label}-${n.type}-${n.key}-${n.hierarchicalID}-${n.id}-${n.name}`:"..."):n)}(e)).join("-")]),n){const t={left:[15,15],right:[r[0]+15,15]},{position:o="right",title:i="Legend"}=n;j=e.createElement("g",{transform:`translate(${t[o].join(",")})`},e.createElement($e,Object.assign({},n,{title:i,position:o})))}return 0!==u.length||n?e.createElement("div",{className:"annotation-layer",style:{position:"absolute",pointerEvents:"none",background:"none"}},e.createElement("svg",{className:"annotation-layer-svg",height:r[1],width:r[0],style:{background:"none",pointerEvents:"none",position:"absolute",left:o.left+"px",top:o.top+"px",overflow:"visible"}},e.createElement("g",null,j,m)),e.createElement("div",{className:"annotation-layer-html",style:{background:"none",pointerEvents:"none",position:"absolute",height:r[1]+"px",width:r[0]+"px",left:o.left+"px",top:o.top+"px"}},b)):null}function Sn(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const Mn=e=>e instanceof Date?e.getTime():e,On=({data:e,lineDataAccessor:t,xProp:n,xPropTop:o,xPropBottom:r,yProp:i,yPropTop:s,yPropBottom:a,xAccessor:l,yAccessor:c})=>{Array.isArray(e)||(e=[e]);const u=[];return t.forEach((t,d)=>{l.forEach((l,h)=>{c.forEach((c,f)=>{e.forEach(e=>{const p=Object.assign(Object.assign({},e),{xIndex:h,yIndex:f,lineIndex:d});p.data=t(e).map((e,t)=>{const u={data:e};return u[n]=l(e,t),u[o]=u[n],u[r]=u[n],u[i]=c(e,t),u[s]=u[i],u[a]=u[i],u}),p.key=p.key||u.length,u.push(p)})})})}),u},jn=({type:e="stackedarea",data:t,xProp:n,yProp:o,yPropMiddle:r,sort:i,yPropTop:s,yPropBottom:a})=>{const l=new Map,c=t.map(()=>0);let u=0;for(const e of t){e.__lineIndex=u;for(const t of e.data){const e=Mn(t[n]);c[u]+=t[o],l.has(e)||l.set(e,[]),l.get(e)[u]=t}u++}let d=(e,t)=>c[t.key]-c[e.key];"stackedpercent-invert"!==e&&"stackedarea-invert"!==e||(d=(e,t)=>c[e.key]-c[t.key]),null!==(i=void 0===i?d:i)&&(t=t.sort(i));const h=t.map(e=>e.__lineIndex);for(const[,t]of l){let n=0,i=0;const l=S(t,e=>(null==e?void 0:e[o])>0?e[o]:0),c=S(t,e=>0>(null==e?void 0:e[o])?e[o]:0);for(const u of h){const d=t[u];if(d)if(0>d[o]){if("linepercent"===e||"stackedpercent"===e||"stackedpercent-invert"===e){const t=d[o]/c;if(d.percent=t,"linepercent"===e)d[a]=d[a]=d[s]=d[r]=t;else{const e=0>c?t:0;d[a]=0===c?0:-n/c,d[s]=d[a]-e,d[r]=d[a]-e/2}}else d[a]=n,d[s]=n+d[o],d[r]=n+d[o]/2;n+=d[o]}else{if("linepercent"===e||"stackedpercent"===e||"stackedpercent-invert"===e){const t=d[o]/l;if(d.percent=t,"linepercent"===e)d[a]=d[s]=d[r]=t;else{const e=l>0?t:0;d[a]=0===l?0:i/l,d[s]=d[a]+e,d[r]=d[a]+e/2}}else d[a]=i,d[s]=i+d[o],d[r]=i+d[o]/2;i+=d[o]}}}return t},Pn=({data:e,y1:t,x1:n,yPropTop:o,yPropMiddle:r,yPropBottom:i,xPropTop:s,xPropMiddle:a,xPropBottom:l})=>{if(t)for(const n of e)for(const e of n.data)e[i]=t(e),e[r]=e[o];if(n)for(const t of e)for(const e of t.data)e[l]=n(e),e[a]=(e[l]+e[s])/2;return e},Nn=({data:e,y1:t,yPropTop:n,yPropMiddle:o,yPropBottom:r,type:i="cumulative"})=>{for(const s of e){let e=0;const a="cumulative-reverse"===i?s.data.reverse():s.data;for(const i of a)e+=i[n],i[r]=i[n]=i[o]=e,t&&(i[r]=t(i),i[o]=i[r]+i[n]/2)}return e},_n=({type:e="bumpline",data:t,xProp:n,yProp:o,yPropMiddle:r,yPropTop:i,yPropBottom:s})=>{const a=new Map;for(const e of t)for(const t of e.data){const e=Mn(t[n]);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=(e,t)=>e[o]>t[o]?1:-1;"bumparea-invert"!==e&&"bumpline-invert"!==e||(l=(e,t)=>t[o]>e[o]?1:-1);for(const[,t]of a){let n=0,a=0;t.sort(l);let c=1;for(const l of t)"bumparea"===e||"bumparea-invert"===e?0>l[o]?(l[i]=n+l[o],l[r]=n+l[o]/2,l[s]=n,n+=l[o]):(l[i]=a+l[o],l[r]=a+l[o]/2,l[s]=a,a+=l[o]):(l[o]=c,l[i]=c,l[s]=c),c++}return t};function zn({pointA:e,pointB:t,currentParameters:n,parameters:o,keys:r}){const i={};return r.forEach(n=>{i[n]="number"==typeof e[n]?(e[n]+t[n])/2:void 0}),JSON.stringify(o(i))===JSON.stringify(n)?[i,t]:[e,i]}function $n({data:e,steps:t,key:n}){const o=[];return Array.isArray(e)||(e=[e]),t||(t=e.map(e=>Object.keys(e)).reduce((e,t)=>e.concat(t),[])),e.forEach((e,r)=>{const i=n?e[n]:r;t.forEach(t=>{const n={funnelKey:i,stepName:"",stepValue:0};n.stepName=t,n.stepValue=e[t]?e[t]:0,o.push(n)})}),o}function Bn(t){const n=(t=>{const{parameters:n,className:o,interpolate:r=X,customAccessors:i,lineDataAccessor:s,data:a,searchIterations:l}=t,c=Sn(t,["parameters","className","interpolate","customAccessors","lineDataAccessor","data","searchIterations"]),{x:u,y:d}=i,h=On({data:a,lineDataAccessor:[s],xProp:"x",yProp:"y",xAccessor:[u],yAccessor:[d]});for(const e of h)e.data=e.data.map(e=>Object.assign(Object.assign({},e.data),e));const f=((e,t,n=10)=>{let o=e(t[0],0),r=[];const i=[{key:o,points:r}];return t.forEach((t,s)=>{const a=e(t,s);let l=a===o;const c=JSON.stringify(a),u=JSON.stringify(o);if("object"==typeof o&&(l=c===u),l)r.push(t);else{let s=r[r.length-1],l=t,u=c,d=0;for(;n>d&&c===u;){const t=zn({pointA:s,pointB:l,currentParameters:o,parameters:e,keys:Object.keys(s)});s=t[0],l=t[1],u=JSON.stringify(e(l)),d++}r.push(l),r=[l,t],i.push({key:a,points:r}),o=a}}),i})(n,h[0].data,l),p=H().curve(r).x(e=>e.x).y(e=>e.y);return f.map((t,n)=>e.createElement("path",Object.assign({},c,{className:o,key:"DividedLine-"+n,style:t.key,d:p(t.points)})))})(t);return e.createElement("g",null,n)}const Cn=({xy:t,orient:n,i:o,className:r="",jaggedBase:i})=>{let s=`M${t.x1},${t.y1}L${t.x2},${t.y2}`;return i&&0===o&&(s=((e,t)=>{let n="";const{x1:o,x2:r,y1:i,y2:s}=t;if("left"===e||"right"===e){const t=Math.abs(r-o);n=((e,t,n,o)=>{const r=e/t;let i=0,s="M0,"+n;const a="right"===o?-1:1;for(;e>=i;)s+=`L${i},${n}`,e>i&&(s+=`L${i+r/2},${n+10*a}`),i+=r;return s})(t,Math.ceil(t/40),"right"===e?0:i,e)}else{const t=Math.abs(s-i);n=((e,t,n,o)=>{const r=e/t;let i=0,s=`M${n},0`;const a="bottom"===o?-1:1;for(;e>=i;)s+=`L${n},${i}`,e>i&&(s+=`L${n+10*a},${i+r/2}`),i+=r;return s})(t,Math.ceil(t/40),o,e)}return n})(n,t)),e.createElement("path",{key:o,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:s,className:`tick-line tick ${n} ${r}`})};function Dn(e,t,n){const o=Math.abs(n.range()[1]-n.range()[0]);return e||(t||(t=Math.max(1,Math.floor(o/40))),e=n.ticks&&n.ticks(t)||n.domain()),e}function Wn({t:e,o:t,w:n}){return"contour"!==e&&"boxplot"!==e||"left"!==t&&"right"!==t?0:n/2}function Ln({t:e,o:t,w:n}){return"contour"!==e&&"boxplot"!==e||"top"!==t&&"bottom"!==t?0:n/2}function Tn(e){const{translation:n,orient:o,decoratedSummaryType:r,summaryWidth:i,renderedSummary:s,points:a}=e;return t.createElement("g",{className:"marginal-graphics",transform:`translate(${n[o]})`},t.createElement("g",{transform:`translate(${Wn({t:r.type,o:o,w:i})},${Ln({t:r.type,o:o,w:i})})`},s),a)}function Fn(e){const{className:n,translation:o,position:r,rotation:i,labelName:s,anchorMod:a}=e;return t.createElement("g",{className:"axis-title "+n,transform:`translate(${[o[0]+r[0],o[1]+r[1]]}) rotate(${i})`},t.isValidElement(s)?s:t.createElement("text",{textAnchor:a},s))}function Rn(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),n=Math.abs(t);return 1e9>n?1e6>n?1e4>n?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}function Hn(t){const{rotate:n,label:o,dynamicLabelPosition:s,orient:l="left",marginalSummaryType:c,tickFormat:u=(c?()=>"":Rn),size:d,width:h=d&&d[0]||0,height:f=d&&d[1]||0,className:p,padding:y,tickValues:g,scale:m,ticks:v,footer:b,tickSize:x,tickLineGenerator:w,baseline:k=!0,margin:A={top:0,bottom:0,left:0,right:0},center:E=!1,annotationFunction:S,glyphFunction:M,xyPoints:O}=t,[j,P]=i(0),[N,_]=i(void 0),z=r(null);a(()=>{if(!(null==o?void 0:o.position)&&s){const e=((e,t)=>{const n=e.current;if(!n)return 30;const o="left"===t||"right"===t?"width":"height";return Math.max(...[...n.querySelectorAll(".axis-label")].map(e=>e.getBBox&&e.getBBox()||{height:30,width:30}).map(e=>e[o]))+25})(z,l);e!==N&&_(e)}},[o,s]);let $,{axisParts:B,position:C=[0,0]}=t;if(B||(B=function({renderMode:e=()=>{},padding:t=5,scale:n,ticks:o,tickValues:r=Dn(void 0,o,n),orient:i="left",size:s,footer:a=!1,tickSize:l=(a?-10:["top","bottom"].find(e=>e===i)?s?s[1]:0:s?s[0]:0),jaggedBase:c}){let u,d,h,f,p,y,g=[],m=0,v=0,b="middle";switch(i){case"top":u="x1",d="x2",h="y1",f="y2",g=[0,l],p="tx",y="ty",m-=20-t;break;case"bottom":u="x1",d="x2",h="y2",f="y1",g=s?[s[1],s[1]-l]:[0,-l],p="tx",y="ty",m+=20+t;break;case"right":u="y2",d="y1",h="x2",f="x1",g=s?[s[0],s[0]-l]:[0,-l],p="ty",y="tx",m+=5+t,v+=5,b="start";break;default:u="y1",d="y2",h="x1",f="x2",g=[0,l],p="ty",y="tx",m-=5+t,v+=5,b="end"}let x=r instanceof Function?r({orient:i}):r;return c&&void 0===x.find(e=>e===n.domain()[0])&&(x=[n.domain()[0],...x]),x.map((t,o)=>{const r=n(t);return{[u]:r,[d]:r,[h]:g[0],[f]:g[1],[p]:r+v,[y]:g[0]+m,defaultAnchor:b,renderMode:e(t,o),value:t}})}({padding:y,tickValues:g,scale:m,ticks:v,orient:l,size:[h,f],footer:b,tickSize:x}),$=e.createElement("g",{className:"axis "+p},(({axisParts:t,orient:n,tickLineGenerator:o=Cn,className:r,jaggedBase:i,scale:s,showOutboundTickLines:a=!1})=>{const l=t.map((e,t)=>o({xy:e,orient:n,i:t,className:r,jaggedBase:i,scale:s})),c=a?t.map((t,o)=>(({xy:t,orient:n,i:o,className:r=""})=>{let i=`M-4,${t.y1}L${t.x1},${t.y2}`;return"left"===n?i=`M${t.x1-8},${t.y1}L${t.x1},${t.y2}`:"right"===n?i=`M${t.x2},${t.y1}L${t.x2+8},${t.y2}`:"top"===n?i=`M${t.x1},${t.y1-8}L${t.x1},${t.y1}`:"bottom"===n&&(i=`M${t.x1},${t.y2}L${t.x1},${t.y2+8}`),e.createElement("path",{key:o,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:i,className:`outbound-tick-line tick ${n} ${r}`})})({xy:t,orient:n,i:o,className:r})):[];return[...l,c]})({axisParts:B,orient:l,tickLineGenerator:w,className:p,scale:m}))),0===B.length)return null;let D,W,L,T,F=50,R=f,H=-50,I=0,Y=0,X=0,G=0,V=f,q=25,U=-25,Z=18,K=h+25,Q=0,J=j,ee=0,te="y";switch(l){case"right":C=[C[0],C[1]],H=h,G=Y=h,ee=A.top,K=-h-25,U=5,D=e=>{P(e.nativeEvent.offsetY-ee)},!0===E&&(G=Y=h/2);break;case"top":C=[C[0],0],F=h,R=50,I=-50,H=0,ee=A.left,te="x",G=h,V=0,!0===E&&(V=X=f/2),D=e=>{P(e.nativeEvent.offsetX-ee)},q=j,J=25,U=0,Z=-10,K=0,Q=f+25;break;case"bottom":C=[C[0],0],F=h,R=50,X=V=I=f,Y=H=0,G=h,ee=A.left,D=e=>{P(e.nativeEvent.offsetX-ee)},q=j,J=25,U=0,Z=15,K=0,Q=-f-25,te="x",!0===E&&(V=X=f/2);break;default:C=[C[0],C[1]],ee=A.top,!0===E&&(G=Y=h/2),D=e=>{P(e.nativeEvent.offsetY-ee)}}if(S){const n=function(e,t){return t.tickFormat?t.tickFormat(e):e.toString?""+e:e}(m.invert(j),t),o=M?M({lineHeight:Q,lineWidth:K,value:m.invert(j)}):e.createElement("g",null,e.isValidElement(n)?e.createElement("g",{transform:`translate(${U},${Z})`},n):e.createElement("text",{x:U,y:Z},n),e.createElement("circle",{r:5}),e.createElement("line",{x1:K,y1:Q,style:{stroke:"black"}})),r=j?e.createElement("g",{style:{pointerEvents:"none"},transform:`translate(${q},${J})`},o):null;W=e.createElement("g",{className:"annotation-brush",transform:`translate(${H},${I})`},e.createElement("rect",{style:{fillOpacity:0},height:R,width:F,onMouseMove:D,onClick:e=>S({className:"dynamic-axis-annotation",type:te,value:m.invert(j),e:e}),onMouseOut:()=>{P(void 0)}}),r)}if(c&&O){const t=Math.max(A[l]-6,5),n="string"==typeof c?{type:c}:c;void 0!==n.flip||"bottom"!==l&&"right"!==l||(n.flip=!0);const o=n.summaryStyle?()=>n.summaryStyle:()=>({fill:"black",fillOpacity:.5,stroke:"black",strokeDasharray:"0"}),r=n.renderMode?()=>n.renderMode:()=>{},i=n.summaryClass?()=>n.summaryClass:()=>"",s=n.filter||(()=>!0),a=O.filter(e=>void 0!==e.x&&void 0!==e.y&&s(e.data)).map(e=>Object.assign(Object.assign({},e),{xy:{x:"top"===l||"bottom"===l?m(e.x):0,y:"left"===l||"right"===l?m(e.y):0},piece:{scaledVerticalValue:m(e.y),scaledValue:m(e.x)},value:m("top"===l||"bottom"===l?e.y:e.x),scaledValue:m(e.x),scaledVerticalValue:m(e.y)})),u=function(t){const n=[];for(const o of t){const t=[],{elements:r,containerProps:i}=o;if(o.Mark)n.push(o.Mark);else{for(let n=0;r.length>n;n++){const o=r[n],{markType:i,style:s={}}=o,a=Sn(o,["markType","style"]),l=Object.assign({},a);void 0!==s.fill&&(l.fill=s.fill),void 0!==s.stroke&&(l.stroke=s.stroke),void 0!==s.strokeWidth&&(l.strokeWidth=s.strokeWidth),void 0!==s.opacity&&(l.opacity=s.opacity),void 0!==s.fillOpacity&&(l.fillOpacity=s.fillOpacity),void 0!==s.strokeOpacity&&(l.strokeOpacity=s.strokeOpacity);const c=Object.assign({},s);delete c.fill,delete c.stroke,delete c.strokeWidth,delete c.opacity,delete c.fillOpacity,delete c.strokeOpacity,Object.keys(c).length>0&&(l.style=c),l.key=o.key||n,i&&t.push(e.createElement(i,l))}i?n.push(e.createElement("g",Object.assign({},i),t)):n.push(...t)}}return n}((({data:e,type:t,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:i,projection:s,adjustedSize:a,margin:l,axisCreator:c})=>{if(t&&t.type)return function({data:e,type:t,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:i,projection:s,adjustedSize:a,chartSize:l,margin:c,axisCreator:u}){return"function"==typeof t.type?t.type({data:e,type:t,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:i,projection:s,adjustedSize:a,chartSize:l,margin:c,axisCreator:u}):(console.error(`Invalid summary type: ${t.type} - Must be a function`),{})}({data:e,type:t="string"==typeof t?{type:t}:t,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:i,projection:s,adjustedSize:a,chartSize:"vertical"===s?a[1]:a[0],margin:l,axisCreator:c})})({data:{column:{middle:t/2,pieceData:a,width:t,xyData:a}},type:n,renderMode:r,eventListenersGenerator:n.eventListenersGenerator||(()=>({})),styleFn:o,classFn:i,projection:"top"===l||"bottom"===l?"horizontal":"vertical",adjustedSize:d,margin:{top:0,bottom:0,left:0,right:0}}).marks);let h;if(!0===n.showPoints){const o=((e,t,n)=>{const o="left"===e||"right"===e?t/2:0,r="bottom"===e||"top"===e?t/2:0;return n.map(e=>[e.xy.x+o,e.xy.y+r])})(l,t,a);h=o.map((t,o)=>e.createElement("circle",{key:"axis-summary-point-"+o,cx:t[0],cy:t[1],r:n.r||3,style:n.pointStyle||{fill:"black",fillOpacity:.1}}))}L=e.createElement(Tn,{translation:{left:[2-A.left,0],right:[d[0]+2,0],top:[0,2-A.top],bottom:[0,d[1]+2]},orient:l,decoratedSummaryType:n,summaryWidth:t,renderedSummary:u,points:h})}const ne=(({axisParts:t,tickFormat:n,rotate:o=0,center:r=!1,orient:i})=>{const s=t.map((e,t)=>({axisPart:e,i:t,formatted:n(e.value,t)})),a="left"===i||"right"===i;let l=s;if(!o&&s.length>1){const e=8,t=14,n=8,o=e=>"string"==typeof e?e:"number"==typeof e?e+"":null;if("top"===i||"bottom"===i){const t=[...s].sort((e,t)=>e.axisPart.tx-t.axisPart.tx);let r=-1/0;const i=new Set;for(const s of t){const t=o(s.formatted);if(!t){i.add(s.i);continue}const a=t.length*e/2;r+n>s.axisPart.tx-a||(i.add(s.i),r=s.axisPart.tx+a)}l=s.filter(e=>i.has(e.i))}else if(a){const e=[...s].sort((e,t)=>e.axisPart.ty-t.axisPart.ty);let o=-1/0;const r=new Set;for(const i of e)o+t+n>i.axisPart.ty||(r.add(i.i),o=i.axisPart.ty);l=s.filter(e=>r.has(e.i))}}return l.map(({axisPart:t,i:n,formatted:s})=>{("object"!=typeof s||s instanceof Date)&&(s=e.createElement("text",{textAnchor:t.defaultAnchor,className:"axis-label"},s.toString?""+s:s));let a=t.tx,l=t.ty;if(r)switch(i){case"right":a-=(t.x2-t.x1)/2;break;case"left":a+=(t.x2-t.x1)/2;break;case"top":l+=(t.y2-t.y1)/2;break;case"bottom":l-=(t.y2-t.y1)/2}return e.createElement("g",{key:n,pointerEvents:"none",transform:`translate(${a},${l}) rotate(${o})`,className:"axis-label"},s)})})({tickFormat:u,axisParts:B,orient:l,rotate:n,center:E});if(o){const t=o.name||o,n=o.position||{};let r=n.anchor||"middle";const i=o.locationDistance||N,s=n.rotation||{left:-90,right:90,top:0,bottom:0}[l],a={left:{start:[0,d[1]],middle:[0,d[1]/2],end:[0,0],inside:[i||15,0],outside:[-(i||45),0]},right:{start:[d[0]+0,d[1]],middle:[d[0]+0,d[1]/2],end:[d[0]+0,0],inside:[-(i||15),0],outside:[i||45,0]},top:{start:[0,0],middle:[0+d[0]/2,0],end:[0+d[0],0],inside:[0,i||15],outside:[0,-(i||40)]},bottom:{start:[0,d[1]],middle:[0+d[0]/2,d[1]],end:[0+d[0],d[1]],inside:[0,-(i||5)],outside:[0,i||50]}},c=a[l][r],u=a[l][n.location||"outside"];c[0]=c[0]+u[0],c[1]=c[1]+u[1],"start"===r&&"right"===l?r="end":"end"===r&&"right"===l&&(r="start"),T=e.createElement(Fn,{className:p,translation:c,position:C,rotation:s,labelName:t,anchorMod:r})}const oe=`${l} axis ${B&&B.length>0&&`from ${u(B[0].value,0)} to ${u(B[B.length-1].value,B.length-1)}`||"without ticks"}`;return e.createElement("g",{className:p,"aria-label":oe,ref:z},W,ne,$,!0===k?e.createElement("line",{key:"baseline",className:"axis-baseline "+p,stroke:"black",strokeLinecap:"square",x1:Y,x2:G,y1:X,y2:V}):null,T,L)}const In=e=>e.reduce((e,t)=>e.concat(Array.isArray(t)?In(t.slice().sort((e,t)=>e-t)):t),[]);function Yn(e=[]){if(!Array.isArray(e))return"not-array";let t=e.slice();return Array.isArray(t[0])||(t=t.slice().sort((e,t)=>e-t)),""+In(t).map(e=>e instanceof Date&&""+e||void 0!==e&&e.toFixed&&e.toFixed(2)||"empty")}function Xn(t){const{extent:n,selectedExtent:o}=t,i=r(null),s=Yn(n),l=Yn(o);a(()=>{(null==i?void 0:i.current)&&((e,t)=>{const{svgBrush:n,selectedExtent:o}=t;if(g(e).call(n),o){let t=o;if(Array.isArray(o[0])){const e=[t[0][1],t[1][1]].sort((e,t)=>e-t);t=[[t[0][0],e[0]],[t[1][0],e[1]]]}g(e).call(n.move,t)}})(i.current,t)},[s,l,i]);const{position:c=[0,0]}=t;return e.createElement("g",{transform:`translate(${c})`,ref:i,className:"xybrush"})}const Gn="x",Vn="y",qn="yMiddle",Un="yTop",Zn="yBottom",Kn="xMiddle",Qn="xTop",Jn="xBottom";function eo({preprocess:t=!0,processedData:n=!1,summaryType:o,data:r,finalXExtent:i,finalYExtent:s,size:a,xScaleType:l=m(),yScaleType:c=m(),margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p}){let y=i,g=s;if(!y){const e=r.coordinates.map(e=>e.x);y=[Math.min(...e),Math.max(...e)]}if(!g){const e=r.coordinates.map(e=>e.y);g=[Math.min(...e),Math.max(...e)]}if(n&&r)return r.coordinates;let v,b=[];v=o.type?o:{type:v};const{bins:x=.05,cellPx:w,binValue:k=e=>e.length,binMax:A,customMark:E}=v;r.coordinates&&!r._xyfCoordinates&&(r._xyfCoordinates=r.coordinates.map(e=>[e.x,e.y]));const S=Array.isArray(r)?r:[r],M=l.domain(y).range([0,a[0]]),O=c.domain(g).range([0,a[1]]),j=w&&w/2||(x>1?1/x:x)*a[0]/2,P=ue().x(e=>M(e._xyfPoint[0])).y(e=>O(e._xyfPoint[1])).radius(j).size(a);let N;const _=P.centers();return S.forEach(t=>{N=0;const n=P(t._xyfCoordinates.map((e,n)=>Object.assign({_xyfPoint:e},t.coordinates[n]))),o={};n.forEach(e=>{o[`${parseInt(e.x)}-${parseInt(e.y)}`]=!0}),_.forEach(e=>{if(!o[`${parseInt(e[0])}-${parseInt(e[1])}`]){const t=[];t.x=e[0],t.y=e[1],n.push(t)}}),N=Math.max(...n.map(e=>k(e))),A&&A(N);const r=[[0,-1],[.866,-.5],[.866,.5],[0,1],[-.866,.5],[-.866,-.5]],i=M.invert(j)-y[0],s=O.invert(j)-g[0],l=r.map(e=>[e[0]*i,e[1]*s]),c=n.map(n=>{const o=k(n),i=n.x,s=n.y;n.x=M.invert(n.x),n.y=O.invert(n.y);const c=o/N;return{customMark:E&&e.createElement("g",{transform:`translate(${i},${a[1]-s})`},E({d:Object.assign(Object.assign({},n),{binItems:n,percent:c,value:o,radius:j,hexCoordinates:r.map(e=>[e[0]*j,e[1]*j])}),margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p,adjustedSize:a})),_xyfCoordinates:l.map(e=>[e[0]+n.x,e[1]+n.y]),value:o,percent:c,data:n,parentSummary:t,centroid:!0}});b=[...b,...c]}),t?(b.forEach(e=>{e.x=e.data.x,e.y=e.data.y}),{type:"hexbin",processedData:!0,coordinates:b,binMax:N}):b}const to=(e,t,n,o)=>[...e.map((e,o)=>[e[0],e[1]+n(t[o])]),...e.map((e,n)=>[e[0],e[1]-o(t[n])]).reverse()];function no({preprocess:t=!0,processedData:n=!1,summaryType:o,data:r,finalXExtent:i=[Math.min(...r.coordinates.map(e=>e.x)),Math.max(...r.coordinates.map(e=>e.x))],finalYExtent:s=[Math.min(...r.coordinates.map(e=>e.y)),Math.max(...r.coordinates.map(e=>e.y))],size:a,xScaleType:l=m(),yScaleType:c=m(),margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p}){if(n&&r)return r.coordinates;r.coordinates&&!r._xyfCoordinates&&(r._xyfCoordinates=r.coordinates.map(e=>[e.x,e.y]));const y=Array.isArray(r)?r:[r];let g,v=[];g=o.type?o:{type:g};const{binValue:b=e=>e.length,xBins:x=g.yBins||.05,yBins:w=x,xCellPx:k=!g.xBins&&g.xCellPx,yCellPx:A=!g.yBins&&g.yCellPx,customMark:E,binMax:S}=g,M=1>x?x:1/x,O=1>w?w:1/w,j=l.domain(i).range([0,a[0]]),P=c.domain(s).range([a[1],0]),N=[Math.ceil((k&&k/a[0]||M)*a[0]*10)/10,Math.ceil((A&&A/a[1]||O)*a[1]*10)/10];let _=-1/0;return y.forEach(t=>{const n=[],o=[];let r,i;for(let e=0;a[0]>Math.ceil(e);e+=N[0]){const s=j.invert(e),l=j.invert(e+N[0]);i=[],n.push(i);for(let n=0;a[1]>Math.ceil(n);n+=N[1]){const a=P.invert(n),c=P.invert(n+N[1]);r={gx:e,gy:n,gw:N[0],gh:N[1],x:(s+l)/2,y:(a+c)/2,binItems:[],value:0,_xyfCoordinates:[[s,a],[l,a],[l,c],[s,c]],parentSummary:t},i.push(r),o.push(r)}i.push(r)}n.push(i),t._xyfCoordinates.forEach((e,o)=>{const r=j(e[0]),i=P(e[1]),s=Math.floor(r/N[0]),a=Math.floor(i/N[1]);n[s][a]&&n[s][a].binItems.push(t.coordinates[o])}),o.forEach(e=>{e.value=b(e.binItems),_=Math.max(_,e.value)}),o.forEach(t=>{t.percent=t.value/_,t.customMark=E&&e.createElement("g",{transform:`translate(${t.gx},${t.gy})`},E({d:t,margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p,adjustedSize:a}))}),v=[...v,...o]}),S&&S(_),t?{type:"heatmap",processedData:!0,_baseData:[],_xyfCoordinates:[],data:[],bounds:[],x:0,y:0,coordinates:v,binMax:_}:v}const oo=e=>e&&e.extent||Array.isArray(e)&&e||[],ro=()=>!0,io={top:Un,bottom:Zn,orphan:Vn},so={top:Qn,bottom:Jn,orphan:Gn},ao={stackedarea:jn,"stackedarea-invert":jn,stackedpercent:jn,"stackedpercent-invert":jn,linepercent:jn,difference:({data:e,yProp:t,yPropTop:n,yPropBottom:o})=>(e.forEach((r,i)=>{r.data.forEach((r,s)=>{const a=0===i?1:0;r[t]>e[a].data[s][t]?(r[o]=e[a].data[s][t],r[n]=r[t]):(r[n]=r[t],r[o]=r[t])})}),e),bumparea:_n,bumpline:_n,"bumparea-invert":_n,line:Pn,area:Pn,cumulative:Nn,"cumulative-reverse":Nn};function lo(e,t){const n=[];for(const e of t)n.push(Object.assign({},e));for(const t of e)t.parentSummary||n.push(t);return n}const co=({lineDataAccessor:e,xAccessor:t,yAccessor:n,summaries:o,points:r,lines:i,lineType:s,showLinePoints:a,showSummaryPoints:l,xExtent:c,yExtent:u,invertX:d,invertY:h,summaryDataAccessor:f,summaryType:p,adjustedSize:y,margin:g,summaryStyleFn:v,summaryClassFn:b,summaryRenderModeFn:x,chartSize:w,filterRenderedLines:k,filterRenderedSummaries:A,filterRenderedPoints:E,defined:S=ro,annotations:M=[]})=>{let O=[],j=[],P=[],N=[],_=[];if(r){t.forEach((e,t)=>{n.forEach((n,o)=>{let i=0;for(const s of r){const r=e(s,i),a=n(s,i),l={x:r,y:a,data:s,xIndex:t,yIndex:o};Array.isArray(a)&&(l[Zn]=Math.min(...a),l[Un]=Math.max(...a),l[qn]=(l[Zn]+l[Un])/2),Array.isArray(r)&&(l[Jn]=Math.min(...r),l[Qn]=Math.max(...r),l[Kn]=(l[Jn]+l[Qn])/2),P.push(l),i++}})});for(const e of P)O.push(Object.assign(Object.assign({},e),{[Gn]:e[Qn]||e[Jn]||e.x,[Vn]:e[Un]||e[Zn]||e.y}))}if(i){j=On({data:i,lineDataAccessor:e,xProp:Gn,xPropTop:Qn,xPropBottom:Jn,yProp:Vn,yPropTop:Un,yPropBottom:Zn,xAccessor:t,yAccessor:n}),N=function(e,t){return n=>ao[uo(e.type,n)](Object.assign(Object.assign(Object.assign({},e),t),{data:n}))}(s,{xProp:Gn,yProp:Vn,yPropMiddle:qn,yPropTop:Un,yPropBottom:Zn,xPropMiddle:Kn,xPropTop:Qn,xPropBottom:Jn})(j);for(const e of N)for(let t=0;e.data.length>t;t++){const n=e.data[t];if(!S(Object.assign({},n.data,n),t))continue;const o={parentLine:e,y:n.y,x:n.x,xTop:n.xTop,xMiddle:n.xMiddle,xBottom:n.xBottom,yTop:n.yTop,yMiddle:n.yMiddle,yBottom:n.yBottom,data:n.data};n.percent&&(o.percent=n.percent),O.push(o)}if(a){const e=!0===a?Kn:so[a],t=!0===a?qn:io[a];N.forEach(n=>{n.data.filter((e,t)=>{if(S(Object.assign({},e.data,e))){if("orphan"===a){const e=n.data[t-1],o=n.data[t+1];return!(e&&S(Object.assign({},e.data,e))||o&&S(Object.assign({},o.data,o)))}return!0}return!1}).forEach(o=>{P.push(Object.assign(Object.assign({},o),{parentLine:n,[Vn]:void 0!==o[t]?o[t]:void 0!==o[qn]?o[qn]:void 0!==o[Zn]?o[Zn]:o.y,[Gn]:void 0!==o[e]?o[e]:void 0!==o[Kn]?o[Kn]:void 0!==o[Jn]?o[Jn]:o.y}))})})}}o&&(_=(({data:e,summaryDataAccessor:t,xAccessor:n,yAccessor:o})=>{const r=[];return t.forEach(t=>{n.forEach(n=>{o.forEach(o=>{const i=e=>t(e).map((e,t)=>[n(e,t),o(e,t)]);e.forEach(e=>{r.push(Object.assign(Object.assign({},e),{_baseData:t(e),_xyfCoordinates:i(e)}))})})})}),r})({data:o,summaryDataAccessor:f,xAccessor:t,yAccessor:n}),_.forEach(e=>{const t=e._baseData;e._xyfCoordinates.length>0&&e._xyfCoordinates[0][0][0]?e._xyfCoordinates[0].forEach(n=>{Array.isArray(n)&&n.map((n,o)=>Object.assign({parentSummary:e},t[o],{[Gn]:n[0],[Vn]:n[1]})).forEach(e=>{l&&P.push(Object.assign(Object.assign({x:0},e),{[Vn]:e[Un]||e[Zn]||e[Vn]})),O.push(Object.assign({x:0,y:0},e))})}):e._xyfCoordinates.length>0&&Array.isArray(e._xyfCoordinates)&&e._xyfCoordinates.map((n,o)=>Object.assign(Object.assign({parentSummary:e},t[o]),{[Gn]:n[0],[Vn]:n[1]})).forEach(e=>{l&&P.push(Object.assign(Object.assign({x:0},e),{[Vn]:e[Un]||e[Zn]||e[Vn]})),O.push(Object.assign({x:0,y:0},e))})}));let z,$,B,C,D=[],W=[];c&&!Array.isArray(c)&&!0===c.includeAnnotations&&t.forEach(e=>{M.forEach((t,n)=>{const o=e(t,n);isFinite(o)&&D.push({[Gn]:o})})}),u&&!Array.isArray(u)&&!0===u.includeAnnotations&&n.forEach(e=>{M.forEach((t,n)=>{const o=e(t,n);isFinite(o)&&W.push({[Vn]:o})})});for(const e of O){const t=void 0===e[Jn]?e[Gn]:Math.min(e[Qn],e[Jn]),n=void 0===e[Qn]?e[Gn]:Math.max(e[Jn],e[Qn]),o=void 0===e[Zn]?e[Vn]:Math.min(e[Un],e[Zn]),r=void 0===e[Un]?e[Vn]:Math.max(e[Zn],e[Un]);void 0===t||void 0!==z&&t>=z||(z=t),void 0===n||void 0!==$&&$>=n||($=n),void 0===o||void 0!==B&&o>=B||(B=o),void 0===r||void 0!==C&&C>=r||(C=r)}for(const e of D){const t=e[Gn];void 0===t||void 0!==z&&t>=z||(z=t),void 0===t||void 0!==$&&$>=t||($=t)}for(const e of W){const t=e[Vn];void 0===t||void 0!==B&&t>=B||(B=t),void 0===t||void 0!==C&&C>=t||(C=t)}const L=[z,$],T=[B,C],F=oo(c),R=oo(u);let H=[R&&void 0!==R[0]?R[0]:T[0],R&&void 0!==R[1]?R[1]:T[1]],I=[F&&void 0!==F[0]?F[0]:L[0],F&&void 0!==F[1]?F[1]:L[1]];if(!d||F&&2===F.length||(I=[I[1],I[0]]),"bumpline"!==s.type&&!h||R&&2===R.length||(H=[H[1],H[0]]),p.type&&"contour"===p.type)_=function({summaryType:e,data:t,finalXExtent:n,finalYExtent:o}){let r=[];e.type||(e={type:e});const{resolution:i=500,thresholds:s=10,bandwidth:a=20,neighborhood:l}=e,c=m().domain(n).rangeRound([0,i]).nice(),u=m().domain(o).rangeRound([i,0]).nice();return t.forEach(e=>{let t=ce().size([i,i]).x(e=>c(e[0])).y(e=>u(e[1])).thresholds(s).bandwidth(a)(e._xyfCoordinates);l&&(t=[t[0]]);const n=Math.max(...t.map(e=>e.value));t.forEach(t=>{t.parentSummary=e,t.bounds=[],t.percent=t.value/n,t.coordinates.forEach(e=>{e.forEach((n,o)=>{e[o]=n.map(e=>[c.invert(e[0]),u.invert(e[1])]),0===o&&t.bounds.push(function(e){let t=[1/0,0],n=[-1/0,0],o=[0,1/0],r=[0,-1/0];return e.forEach(e=>{t=t[0]>e[0]?e:t,n=e[0]>n[0]?e:n,r=e[1]>r[1]?e:r,o=o[1]>e[1]?e:o}),{center:[(t[0]+n[0])/2,(o[1]+r[1])/2],top:o,left:t,right:n,bottom:r}}(e[o]))})})}),r=[...r,...t]}),r}({summaryType:p,data:_,finalXExtent:I,finalYExtent:H});else if(p.type&&"linebounds"===p.type){if(_=function({summaryType:e,data:t,defined:n}){let o=[];e.type||(e={type:e});const{boundingAccessor:r,topBoundingAccessor:i=r,bottomBoundingAccessor:s=r}=e;return t.forEach(e=>{const t=e._baseData.map(n);let r=[],a=[];const l=[{xyf:a,base:r}];t.forEach((n,o)=>{!0===n?(r.push(e._baseData[o]),a.push(e._xyfCoordinates[o])):t[o+1]&&(r=[],a=[],l.push({xyf:a,base:r}))}),l.forEach(({xyf:t,base:n})=>{const r={data:e,parentSummary:e,_xyfCoordinates:to(t,n,i,s)};o=[...o,r]})}),o}({summaryType:p,data:_,defined:S}),!R||2!==R.length)for(const e of _)for(const t of e._xyfCoordinates){const e=t[1];void 0!==e&&isFinite(e)&&(H[0]>e&&(H[0]=e),e>H[1]&&(H[1]=e))}}else p.type&&"hexbin"===p.type?(_=eo({summaryType:p,data:_[0],processedData:o&&!!o[0].processedData,preprocess:!1,finalXExtent:I,finalYExtent:H,size:y,margin:g,styleFn:v,classFn:b,renderFn:x,chartSize:w}),O=lo(O,_)):p.type&&"heatmap"===p.type?(_=no({summaryType:p,data:_[0],processedData:o&&!!o[0].processedData,preprocess:!1,finalXExtent:I,finalYExtent:H,size:y,margin:g,styleFn:v,classFn:b,renderFn:x,chartSize:w}),O=lo(O,_)):p.type&&"trendline"===p.type&&(_=function({preprocess:e=!1,summaryType:t,data:n,finalXExtent:o=[Math.min(...n.coordinates.map(e=>e.x)),Math.max(...n.coordinates.map(e=>e.x))],xScaleType:r=m()}){if(e)return n[0].coordinates;let i,s=[];i=t.type?t:{type:i};const{regressionType:a="linear",order:l=2,precision:c=4,controlPoints:u=20,curve:d=G}=i;let h=a;o[0]>=0||"logarithmic"!==a&&"power"!==a&&"exponential"!==a||(console.error(`Cannot use this ${a} regressionType type with value range that goes below 0, defaulting to linear`),h="linear"),n.coordinates&&!n._xyfCoordinates&&(n._xyfCoordinates=n.coordinates.map(e=>[e.x,e.y]));const f=Array.isArray(n)?n:[n],p=r.domain([0,1]).range(o);return s=[],f.forEach(e=>{const t=le[h](e._xyfCoordinates.map(e=>{let t=e[0],n=e[1];return"number"!=typeof t&&(t=t.getTime()),"number"!=typeof n&&(n=n.getTime()),[t,n]}),{order:l,precision:c}),n=1/u;let o=[0,1];if("linear"!==h){o=[];for(let e=0;1+n>e;e+=n)o.push(e)}const r=[];o.forEach(e=>{r.push(t.predict(p(e)))}),s.push({centroid:!1,customMark:void 0,data:e,parentSummary:e,value:t.string,r2:t.r2,curve:d,_xyfCoordinates:r})}),s}({summaryType:p,data:_[0],preprocess:o&&!!o[0].processedData,finalXExtent:I}),O=lo(O,_));return k&&(N=N.filter(k),O=O.filter((e,t)=>!e.parentLine||k(e.parentLine,t,[]))),E&&(O=O.filter(E)),A&&(_=_.filter(A),O=O.filter((e,t)=>!e.parentSummary||A(e.parentSummary,t,[]))),{xExtent:I,yExtent:H,projectedLines:N,projectedPoints:P,projectedSummaries:_,fullDataset:O,calculatedXExtent:L,calculatedYExtent:T}},uo=(e,t)=>!ao[e]||"difference"===e&&2!==t.length?"line":e;function ho(e,t,n){return t.parent&&(n=`${n}-${ho(e,Object.assign(Object.assign({},t.parent),t.parent.data),n)}`),`${n}-${e(Object.assign(Object.assign({},t),t.data))}`}const fo=e=>e.id||e.descendantIndex,po=(e,t=fo)=>{var n,o;const r=[],i=[],s=(e.descendants?e:ee(e)).descendants();let a=0;for(const e of s)e.descendantIndex=a,a++;for(const e of s){const s=`${null!==(n=t(Object.assign(Object.assign({},e),e.data)))&&void 0!==n?n:fo(e)}-${e.parent?null!==(o=ho(t,Object.assign(Object.assign({},e.parent),e.parent.data),""))&&void 0!==o?o:e.parent.name:"root"}`,a=Object.assign(e,e.data||{},{hierarchicalID:s});if(i.push(a),null!==e.parent){const t=Object.assign(e.parent,e.parent.data||{});r.push({source:t,target:a,depth:e.depth,weight:1,value:1,_NWFEdgeKey:s})}}return{edges:r,nodes:i}};function yo({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==r&&(t.stroke=r),void 0!==i&&(t.strokeWidth=i),t},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:s}}),label:""}]}}const go={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function mo(e,t){return"function"==typeof t?t(e):e[t]}function vo(e,t){return t?t(e):null==e?"":"number"==typeof e?e.toLocaleString():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 bo(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=mo(t,o);a=vo(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=mo(t,o);l.push({label:n,value:vo(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=vo(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=vo(t[e[0]],r))}}const c=Object.assign(Object.assign({},go),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function xo(t={}){const{fields:n=[],title:o,format:r,style:i={},className:s="",showLabels:a=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=mo(t,o);c.push({value:vo(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=vo(mo(t,o),i);c.push({label:a?n:void 0,value:s})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:a?e:void 0,value:vo(t[e],r)})});const u=Object.assign(Object.assign({},go),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function wo(e){return!0===e||("function"==typeof e?e:!1!==e&&void 0!==e&&("object"!=typeof e||null===e||!("fields"in e)&&!("title"in e)||bo(e)))}function ko(e){return"string"==typeof e?e:"value"}function Ao(t){return n=>{const o=n.data;return o?e.createElement("div",{className:"semiotic-tooltip",style:go},t.map((t,n)=>{const r=function(e,t){return"function"==typeof t?t(e):e[t]}(o,t.accessor),i=null==(s=r)?"–":"number"==typeof s?s.toLocaleString():s instanceof Date?s.toLocaleDateString():s+"";var s;return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.8}},t.label,": "),e.createElement("span",{style:{fontWeight:"color"===t.role||"group"===t.role?"bold":"normal"}},i))})):null}}const Eo="#007bff";function So(e){return"function"==typeof e?e:t=>t[e]}function Mo(e,t,o="category10"){return n(()=>{if(t&&"function"!=typeof t)return Qt(e,t,o)},[e,t,o])}function Oo(e,t,o){return n(()=>{if(!t)return e;const n=[...e];if("function"==typeof t)return n.sort(t);const r=So(o);return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function jo({componentName:t,message:n,width:o,height:r}){return e.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n)))}function Po({data:e,accessors:t,requiredProps:n}){if(n)for(const[e,t]of Object.entries(n))if(null==t)return e+" is required. Provide a field name or function.";if(!e||!Array.isArray(e)||0===e.length)return"No data provided. Pass a non-empty array to the data prop.";if(t){const n=e[0];if(n&&"object"==typeof n)for(const[e,o]of Object.entries(t))if(o&&"string"==typeof o&&!(o in n))return`${e} "${o}" not found in data. Available fields: ${Object.keys(n).join(", ")}.`}return null}function No({data:e,dataLabel:t="data"}){return null==e?`No ${t} provided. Pass a hierarchical data object to the ${t} prop.`:null}function _o({nodes:e,edges:t,nodesRequired:n=!1,edgesRequired:o=!0,accessors:r}){if(o&&(!t||!Array.isArray(t)||0===t.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(n&&(!e||!Array.isArray(e)||0===e.length))return"No nodes provided. Pass a non-empty array to the nodes prop.";if(r&&e&&e.length>0){const t=e[0];if(t&&"object"==typeof t)for(const[e,n]of Object.entries(r))if(n&&"string"==typeof n&&!(n in t))return`${e} "${n}" not found in node data. Available fields: ${Object.keys(t).join(", ")}.`}return null}function zo(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}function $o(e){return e?"string"==typeof e?{name:e}:e:null}function Bo(e,t,n){return t?o=>{var r,i;const s=Object.assign({},e(o));return t.isActive&&(t.predicate(o)?(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle):(s.fillOpacity=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2,s.strokeOpacity=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.2,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle))),s}:e}function Co(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,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Do(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Co(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Wo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Lo,To]=fn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Wo(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Wo(o,t);return o.set(t,Object.assign(Object.assign({},r),{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}})}}));function Fo(e){const t=h(),o=e.clientId||t,{name:r}=e,i=To(e=>e.selections.get(r)),a=To(e=>e.setClause),l=To(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?Do(i,o):()=>!0,[i,o]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:s(()=>{l(r,o)},[l,r,o]),clientId:o}}function Ro(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=Fo({name:t});return{onHover:s(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a]),predicate:o,isActive:r}}function Ho(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:l,clear:c}=Fo({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=s(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function Io(e,t,o){const r=To(e=>e.selections.get(t));return n(()=>{if(!r||0===r.clauses.size)return e;const t=Do(r,o);return e.filter(t)},[e,r,o])}function Yo(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,xLabel:u,yLabel:d,xFormat:h,yFormat:f,xAccessor:p="x",yAccessor:y="y",colorBy:g,colorScheme:m="category10",sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:w=.8,enableHover:k=!0,showGrid:A=!1,showLegend:E,tooltip:S,marginalGraphics:M,frameProps:O={},selection:j,linkedHover:P,linkedBrush:N}=t,_=o||[],z=zo(P,g?["string"==typeof g?g:""]:[]),$=$o(N),B=Fo({name:(null==j?void 0:j.name)||"__unused__"}),C=Ro({name:(null==z?void 0:z.name)||"hover",fields:(null==z?void 0:z.fields)||[]});Ho({name:(null==$?void 0:$.name)||"__unused_brush__",xField:(null==$?void 0:$.xField)||("string"==typeof p?p:void 0),yField:(null==$?void 0:$.yField)||("string"==typeof y?y:void 0)});const D=j?{isActive:B.isActive,predicate:B.predicate}:null,W=Mo(_,g,m),L=n(()=>{if(!v||0===_.length)return;const e=_.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[_,v]),T=n(()=>e=>{const t={fillOpacity:w};return t.fill=g?Kt(e,g,W):Eo,t.r=v?Jt(e,v,b,L):x,t},[g,W,v,b,L,x,w]),F=n(()=>Bo(T,D,j),[T,D,j]),R=void 0!==E?E:!!g,H=n(()=>{if(R&&g)return yo({data:_,colorBy:g,colorScale:W,getColor:Kt})},[R,g,_,W]),I=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return H&&120>e.right&&(e.right=120),e},[a,H]),Y=s(e=>{P&&C.onHover(e)},[P,C]),X=n(()=>Ao([{label:u||ko(p),accessor:p,role:"x"},{label:d||ko(y),accessor:y,role:"y"},...g?[{label:ko(g),accessor:g,role:"color"}]:[],...v?[{label:ko(v),accessor:v,role:"size"}]:[]]),[p,y,u,d,g,v]),G=Po({componentName:"Scatterplot",data:_,accessors:{xAccessor:p,yAccessor:y}});if(G)return e.createElement(jo,{componentName:"Scatterplot",message:G,width:r,height:i});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter",data:_,xAccessor:p,yAccessor:y,colorAccessor:g||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:F,colorScheme:m,size:[r,i],margin:I,showAxes:!0,xLabel:u,yLabel:d,xFormat:h,yFormat:f,enableHover:k,showGrid:A},H&&{legend:H}),c&&{title:c}),l&&{className:l}),{tooltipContent:S?wo(S):X}),P&&{customHoverBehavior:Y}),M&&{marginalGraphics:M}),O);return e.createElement(Ue,Object.assign({},V))}function Xo(t){var o;const{data:r,width:i=600,height:a=400,margin:l,className:c,title:u,xLabel:d,yLabel:h,xFormat:f,yFormat:p,xAccessor:y="x",yAccessor:g="y",lineBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:w="linear",showPoints:k=!1,pointRadius:A=3,fillArea:E=!1,areaOpacity:S=.3,lineWidth:M=2,enableHover:O=!0,showGrid:j=!1,showLegend:P,tooltip:N,frameProps:_={},selection:z,linkedHover:$}=t,B=r||[],C=zo($,b?["string"==typeof b?b:""]:[]),D=Fo({name:(null==z?void 0:z.name)||"__unused__"}),W=Ro({name:(null==C?void 0:C.name)||"hover",fields:(null==C?void 0:C.fields)||[]}),L=z?{isActive:D.isActive,predicate:D.predicate}:null,T=void 0!==(null===(o=B[0])||void 0===o?void 0:o[v]),F=n(()=>{if(T)return B;if(m){const e=B.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:B}]},[B,m,v,T]),R=Mo(B,b,x),H=n(()=>e=>{const t={strokeWidth:M};return t.stroke=b?Kt(e,b,R):Eo,E&&(t.fill=t.stroke,t.fillOpacity=S),t},[b,R,M,E,S]),I=n(()=>Bo(H,L,z),[H,L,z]),Y=n(()=>{if(k)return e=>{const t={r:A,fillOpacity:1};return t.fill=b?Kt(e.parentLine||e,b,R):Eo,t}},[k,A,b,R]),X=E?"area":"line",G=void 0!==P?P:F.length>1,V=n(()=>{if(G&&b)return yo({data:F,colorBy:b,colorScale:R,getColor:Kt})},[G,b,F,R]),q=n(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),l);return V&&120>e.right&&(e.right=120),e},[l,V]),U=s(e=>{$&&W.onHover(e)},[$,W]),Z=m||b,K=n(()=>Ao([{label:d||ko(y),accessor:y,role:"x"},{label:h||ko(g),accessor:g,role:"y"},...Z?[{label:ko(Z),accessor:Z,role:"group"}]:[]]),[y,g,d,h,Z]),Q=Po({componentName:"LineChart",data:B,accessors:{xAccessor:y,yAccessor:g}});if(Q)return e.createElement(jo,{componentName:"LineChart",message:Q,width:i,height:a});const J=n(()=>T||m?F.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):B,[F,v,T,m,B]),ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:X,data:J,xAccessor:y,yAccessor:g,groupAccessor:m||void 0,curve:w,lineStyle:I},k&&{pointStyle:Y}),{size:[i,a],margin:q,showAxes:!0,xLabel:d,yLabel:h,xFormat:f,yFormat:p,enableHover:O,showGrid:j}),V&&{legend:V}),u&&{title:u}),c&&{className:c}),{tooltipContent:N?wo(N):K}),$&&{customHoverBehavior:U}),_);return e.createElement(Ue,Object.assign({},ee))}function Go(t){var o;const{data:r,width:i=600,height:a=400,margin:l,className:c,title:u,xLabel:d,yLabel:h,xFormat:f,yFormat:p,xAccessor:y="x",yAccessor:g="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:w="monotoneX",areaOpacity:k=.7,showLine:A=!0,lineWidth:E=2,enableHover:S=!0,showGrid:M=!1,showLegend:O,tooltip:j,frameProps:P={},selection:N,linkedHover:_}=t,z=r||[],$=zo(_,b?["string"==typeof b?b:""]:[]),B=Fo({name:(null==N?void 0:N.name)||"__unused__"}),C=Ro({name:(null==$?void 0:$.name)||"hover",fields:(null==$?void 0:$.fields)||[]}),D=N?{isActive:B.isActive,predicate:B.predicate}:null,W=void 0!==(null===(o=z[0])||void 0===o?void 0:o[v]),L=n(()=>{if(W)return z;if(m){const e=z.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:z}]},[z,m,v,W]),T=Mo(z,b,x),F=n(()=>e=>{const t={},n=b?Kt(e,b,T):Eo;return t.fill=n,t.fillOpacity=k,A?(t.stroke=n,t.strokeWidth=E):t.stroke="none",t},[b,T,k,A,E]),R=n(()=>Bo(F,D,N),[F,D,N]),H=void 0!==O?O:L.length>1,I=n(()=>{if(H&&b)return yo({data:L,colorBy:b,colorScale:T,getColor:Kt})},[H,b,L,T]),Y=n(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),l);return I&&120>e.right&&(e.right=120),e},[l,I]),X=s(e=>{_&&C.onHover(e)},[_,C]),G=m||b,V=n(()=>Ao([{label:d||ko(y),accessor:y,role:"x"},{label:h||ko(g),accessor:g,role:"y"},...G?[{label:ko(G),accessor:G,role:"group"}]:[]]),[y,g,d,h,G]),q=Po({componentName:"AreaChart",data:z,accessors:{xAccessor:y,yAccessor:g}});if(q)return e.createElement(jo,{componentName:"AreaChart",message:q,width:i,height:a});const U=n(()=>W||m?L.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):z,[L,v,W,m,z]),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area",data:U,xAccessor:y,yAccessor:g,groupAccessor:m||void 0,curve:w,lineStyle:R,size:[i,a],margin:Y,showAxes:!0,xLabel:d,yLabel:h,xFormat:f,yFormat:p,enableHover:S,showGrid:M},I&&{legend:I}),u&&{title:u}),c&&{className:c}),{tooltipContent:j?wo(j):V}),_&&{customHoverBehavior:X}),P);return e.createElement(Ue,Object.assign({},Z))}function Vo(t){var o;const{data:r,width:i=600,height:a=400,margin:l,className:c,title:u,xLabel:d,yLabel:h,xFormat:f,yFormat:p,xAccessor:y="x",yAccessor:g="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:w="monotoneX",areaOpacity:k=.7,showLine:A=!0,lineWidth:E=2,normalize:S=!1,enableHover:M=!0,showGrid:O=!1,showLegend:j,tooltip:P,frameProps:N={},selection:_,linkedHover:z}=t,$=r||[],B=zo(z,b?["string"==typeof b?b:""]:[]),C=Fo({name:(null==_?void 0:_.name)||"__unused__"}),D=Ro({name:(null==B?void 0:B.name)||"hover",fields:(null==B?void 0:B.fields)||[]}),W=_?{isActive:C.isActive,predicate:C.predicate}:null,L=void 0!==(null===(o=$[0])||void 0===o?void 0:o[v]),T=n(()=>{if(L)return $;if(m){const e=$.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:$}]},[$,m,v,L]),F=Mo($,b,x),R=n(()=>e=>{const t={},n=b?Kt(e,b,F):Eo;return t.fill=n,t.fillOpacity=k,A?(t.stroke=n,t.strokeWidth=E):t.stroke="none",t},[b,F,k,A,E]),H=n(()=>Bo(R,W,_),[R,W,_]),I=void 0!==j?j:T.length>1,Y=n(()=>{if(I&&b)return yo({data:T,colorBy:b,colorScale:F,getColor:Kt})},[I,b,T,F]),X=n(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),l);return Y&&120>e.right&&(e.right=120),e},[l,Y]),G=s(e=>{z&&D.onHover(e)},[z,D]),V=m||b,q=n(()=>Ao([{label:d||ko(y),accessor:y,role:"x"},{label:h||ko(g),accessor:g,role:"y"},...V?[{label:ko(V),accessor:V,role:"group"}]:[]]),[y,g,d,h,V]),U=Po({componentName:"StackedAreaChart",data:$,accessors:{xAccessor:y,yAccessor:g}});if(U)return e.createElement(jo,{componentName:"StackedAreaChart",message:U,width:i,height:a});const Z=n(()=>L||m?T.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):$,[T,v,L,m,$]),K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea",data:Z,xAccessor:y,yAccessor:g,groupAccessor:m||void 0,curve:w,normalize:S,lineStyle:H,size:[i,a],margin:X,showAxes:!0,xLabel:d,yLabel:h,xFormat:f,yFormat:p,enableHover:M,showGrid:O},Y&&{legend:Y}),u&&{title:u}),c&&{className:c}),{tooltipContent:P?wo(P):q}),z&&{customHoverBehavior:G}),N);return e.createElement(Ue,Object.assign({},K))}function qo(t){const{data:o,width:r=600,height:i=400,margin:a={top:50,bottom:60,left:70,right:80},className:l,title:c,xAccessor:u="x",yAccessor:d="y",valueAccessor:h="value",xLabel:f,yLabel:p,xFormat:y,yFormat:g,colorScheme:m="blues",customColorScale:v,showValues:b=!1,valueFormat:w,cellBorderColor:k="#fff",cellBorderWidth:A=1,enableHover:E=!0,tooltip:S,frameProps:M={},selection:O,linkedHover:j}=t,P=o||[],N=zo(j,[]),_=Fo({name:(null==O?void 0:O.name)||"__unused__"}),z=Ro({name:(null==N?void 0:N.name)||"hover",fields:(null==N?void 0:N.fields)||[]}),$=O?{isActive:_.isActive,predicate:_.predicate}:null,C=n(()=>"function"==typeof h?e=>h(e):e=>e[h],[h]),D=n(()=>{const e=P.map(C);return[Math.min(...e),Math.max(...e)]},[P,C]),F=n(()=>"custom"===m&&v?v:x({blues:T,reds:L,greens:W,viridis:B}[m]||T).domain(D),[m,v,D]);n(()=>{const e=So(u),t=So(d);return{xBinCount:new Set(P.map(e)).size,yBinCount:new Set(P.map(t)).size}},[P,u,d]),n(()=>({coordinates:P}),[P]);const R=n(()=>e=>{const t=C(e);return{fill:F(t),stroke:k,strokeWidth:A}},[C,F,k,A]);n(()=>Bo(R,$,O),[R,$,O]),n(()=>{if(!b)return;const t=(D[0]+D[1])/2;return(n,o)=>{const r=C(n),i=w?w(r):r+"";return e.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fill:C(n)>t?"#fff":"#000",fontSize:"12px"},i)}},[b,C,w,D]);const H=s(e=>{j&&z.onHover(e)},[j,z]),I=n(()=>Ao([{label:f||ko(u),accessor:u,role:"x"},{label:p||ko(d),accessor:d,role:"y"},{label:ko(h),accessor:h,role:"value"}]),[u,d,f,p,h]),Y=Po({componentName:"Heatmap",data:P,accessors:{xAccessor:u,yAccessor:d,valueAccessor:h}});if(Y)return e.createElement(jo,{componentName:"Heatmap",message:Y,width:r,height:i});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap",data:P,xAccessor:u,yAccessor:d,valueAccessor:h,size:[r,i],margin:a,showAxes:!0,xLabel:f,yLabel:p,xFormat:y,yFormat:g,enableHover:E},c&&{title:c}),l&&{className:l}),{tooltipContent:S?wo(S):I}),j&&{customHoverBehavior:H}),M);return e.createElement(Ue,Object.assign({},X))}function Uo(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,xLabel:u,yLabel:d,xFormat:h,yFormat:f,xAccessor:p="x",yAccessor:y="y",sizeBy:g,sizeRange:m=[5,40],colorBy:v,colorScheme:b="category10",bubbleOpacity:x=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:k="white",enableHover:A=!0,showGrid:E=!1,showLegend:S,tooltip:M,marginalGraphics:O,frameProps:j={},selection:P,linkedHover:N,linkedBrush:_}=t,z=o||[],$=zo(N,v?["string"==typeof v?v:""]:[]),B=$o(_),C=Fo({name:(null==P?void 0:P.name)||"__unused__"}),D=Ro({name:(null==$?void 0:$.name)||"hover",fields:(null==$?void 0:$.fields)||[]});Ho({name:(null==B?void 0:B.name)||"__unused_brush__",xField:(null==B?void 0:B.xField)||("string"==typeof p?p:void 0),yField:(null==B?void 0:B.yField)||("string"==typeof y?y:void 0)});const W=P?{isActive:C.isActive,predicate:C.predicate}:null,L=Mo(z,v,b),T=n(()=>{const e=z.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[z,g]),F=n(()=>e=>{const t={fillOpacity:x,strokeWidth:w,stroke:k};return t.fill=v?Kt(e,v,L):Eo,t.r=Jt(e,g,m,T),t},[v,L,g,m,T,x,w,k]),R=n(()=>Bo(F,W,P),[F,W,P]),H=void 0!==S?S:!!v,I=n(()=>{if(H&&v)return yo({data:z,colorBy:v,colorScale:L,getColor:Kt,strokeColor:k,strokeWidth:w})},[H,v,z,L,k,w]),Y=n(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),a);return I&&120>e.right&&(e.right=120),e},[a,I]),X=s(e=>{N&&D.onHover(e)},[N,D]),G=n(()=>Ao([{label:u||ko(p),accessor:p,role:"x"},{label:d||ko(y),accessor:y,role:"y"},{label:ko(g),accessor:g,role:"size"},...v?[{label:ko(v),accessor:v,role:"color"}]:[]]),[p,y,u,d,g,v]),V=Po({componentName:"BubbleChart",data:z,accessors:{xAccessor:p,yAccessor:y},requiredProps:{sizeBy:g}});if(V)return e.createElement(jo,{componentName:"BubbleChart",message:V,width:r,height:i});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble",data:z,xAccessor:p,yAccessor:y,colorAccessor:v||void 0,sizeAccessor:g,sizeRange:m,pointStyle:R,colorScheme:b,size:[r,i],margin:Y,showAxes:!0,xLabel:u,yLabel:d,xFormat:h,yFormat:f,enableHover:A,showGrid:E},I&&{legend:I}),c&&{title:c}),l&&{className:l}),{tooltipContent:M?wo(M):G}),N&&{customHoverBehavior:X}),O&&{marginalGraphics:O}),j);return e.createElement(Ue,Object.assign({},q))}function Zo({selections:e}){const t=To(e=>e.setResolution);return a(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[]),null}function Ko({children:t,selections:n}){return e.createElement(Lo,null,n&&e.createElement(Zo,{selections:n}),t)}Yo.displayName="Scatterplot",Xo.displayName="LineChart",Go.displayName="AreaChart",Vo.displayName="StackedAreaChart",qo.displayName="Heatmap",Uo.displayName="BubbleChart";const Qo="__splomIdx",Jo={top:4,bottom:4,left:4,right:4};function er({frameRef:t,cellSize:n,onBrush:o}){const i=r(null),s=n-Jo.left-Jo.right,l=n-Jo.top-Jo.bottom;return a(()=>{if(!i.current)return;const e=g(i.current).select(".brush-g"),n=y().extent([[0,0],[s,l]]).on("brush end",e=>{var n;const r=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!r)return;if(!e.selection)return void o(null);const[[i,s],[a,l]]=e.selection,c=[[r.x.invert(i),r.y.invert(s)],[r.x.invert(a),r.y.invert(l)]];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)}},[s,l,t,o]),e.createElement("svg",{ref:i,width:n,height:n,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${Jo.left},${Jo.top})`}))}function tr({data:t,xField:n,yField:o,cellSize:i,pointRadius:a,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:f,mode:p,onPointHover:y}){const g=r(null),m=Fo({name:d,clientId:`splom-${n}-${o}`}),v=Ho({name:d,xField:n,yField:o}),b=Fo({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,w=s(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),k=s(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[Qo];void 0!==n&&(x({[Qo]:[n]}),null==y||y(t,e.x+Jo.left,e.y+Jo.top))},[x,y]),A=s(e=>{const t={opacity:l,r:a};return t.fill=c?Kt(e,c,u):Eo,"hover"===p?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=f),t},[c,u,l,a,p,m.isActive,m.predicate,b.isActive,b.predicate,f]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(Ue,{ref:g,chartType:"scatter",data:t,size:[i,i],xAccessor:n,yAccessor:o,pointStyle:A,margin:Jo,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?k:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e.createElement(er,{frameRef:g,cellSize:i,xField:n,yField:o,onBrush:w}))}function nr({data:t,field:o,label:r,cellSize:i,bins:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=Fo({name:a,clientId:"splom-diag-"+o}),d=Fo({name:l,clientId:`splom-diag-${o}-hover`}),h="hover"===c?d:u,f=h.isActive,p=h.predicate,y=n(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],max:0};const n=Math.min(...e),r=(Math.max(...e)-n)/s||1,a=Array(s).fill(0),l=Array(s).fill(0);for(const e of t){const t=e[o];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-n)/r),s-1);a[i]++,f&&!p(e)||l[i]++}const c=Math.max(...a,1);return{bars:a.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/c*(i-24),count:e})),selectedBars:l.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/c*(i-24),count:e})),max:c}},[t,o,s,i,f,p]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),y.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:"#ccc",opacity:f?.3:.6})),f&&y.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Eo,opacity:.7})))}function or({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function rr(t){const{data:o,fields:r,fieldLabels:a={},colorBy:l,colorScheme:c="category10",cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:f=.5,diagonal:p="histogram",histogramBins:y=20,brushMode:g="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:w,idAccessor:k,className:A}=t,E="splom",S="splom-hover",M=m?"hover":g?"brush":"hover",O=To(e=>e.clearSelection),[j,P]=i(null),N=s(()=>{O(S),P(null)},[O,S]),_=n(()=>(o||[]).map((e,t)=>void 0!==e[Qo]?e:Object.assign(Object.assign({},e),{[Qo]:t})),[o]),z=Mo(_,l,c),$=void 0!==w?w:!!l,B=n(()=>{if(!$||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(_.map(t=>t[e]))].map(e=>({label:e+"",color:z?z(e+""):Eo})):null},[$,l,_,z]),C=n(()=>({display:"grid",gridTemplateColumns:"40px "+r.map(()=>u+"px").join(" "),gridTemplateRows:r.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[r,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},B&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},B.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:C,onMouseLeave:"hover"===M?N:void 0},r.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t),r.map((o,r)=>n===r?"label"===p?e.createElement(or,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(nr,{key:"diag-"+t,data:_,field:t,label:a[t]||t,cellSize:u,bins:y,colorBy:l,colorScale:z,brushSelectionName:E,hoverSelectionName:S,unselectedOpacity:v,mode:M}):e.createElement(tr,{key:`cell-${t}-${o}`,data:_,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:f,colorBy:l,colorScale:z,brushSelectionName:E,hoverSelectionName:S,unselectedOpacity:v,showGrid:b,tooltip:x,mode:M,onPointHover:"hover"===M?(e,i,s)=>{P(e?{datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=s?s:0}:null)}:void 0})))),e.createElement("div",null)," ",r.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t))),j&&"hover"===M&&(()=>{const t=j.datum,n=a[j.xField]||j.xField,o=a[j.yField]||j.yField,r=l?"function"==typeof l?l(t):t[l]:null,i=k?"function"==typeof k?k(t):t[k]:"Row "+t[Qo];return e.createElement("div",{style:{position:"absolute",left:40+j.colIndex*(u+d)+j.px,top:j.rowIndex*(u+d)+j.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}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[j.xField]?Number(t[j.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[j.yField]?Number(t[j.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof l?l:"group",": ",r+""))})())}function ir(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(Ko,{selections:r},e.createElement(rr,Object.assign({},t)))}function sr({width:t,height:n,margin:o,scales:i,brushDirection:s,extent:l,onBrush:c}){const u=r(null),d=r(null),h=r(!1),y=t+o.left+o.right,m=n+o.top+o.bottom;return a(()=>{if(!u.current||!i)return;const e=g(u.current).select(".brush-group"),o="x"===s?f().extent([[0,0],[t,n]]):p().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"===s?i.x:i.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)}},[i,t,n,s,c]),a(()=>{if(!d.current||!i||!u.current)return;const e=g(u.current).select(".brush-group"),t="x"===s?i.x:i.y;if(h.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[l,i,s]),e.createElement("svg",{ref:u,width:y,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`}))}function ar(t){var o,l;const{data:c,width:u=600,height:d=400,margin:h,className:f,title:p,xLabel:y,yLabel:g,xFormat:m,yFormat:v,xAccessor:b="x",yAccessor:x="y",lineBy:w,lineDataAccessor:k="coordinates",colorBy:A,colorScheme:E="category10",curve:S="linear",lineWidth:M=2,fillArea:O=!1,areaOpacity:j=.3,showPoints:P=!1,pointRadius:N=3,enableHover:_=!0,showGrid:z=!1,showLegend:$,tooltip:B,minimap:C={},renderBefore:D=!1,onBrush:W,brushExtent:L,frameProps:T={}}=t,F=c||[],[R,H]=i(null),I=null!=L?L:R,Y=s(e=>{L||H(e),null==W||W(e)},[L,W]),X=r(null),[G,V]=i(null);a(()=>{const e=()=>{var t,n;const o=null===(n=null===(t=X.current)||void 0===t?void 0:t.getScales)||void 0===n?void 0:n.call(t);o?V(o):requestAnimationFrame(e)};requestAnimationFrame(e)},[c]);const q=void 0!==(null===(o=F[0])||void 0===o?void 0:o[k]),U=n(()=>{if(q)return F;if(w){const e=F.reduce((e,t)=>{const n="function"==typeof w?w(t):t[w];if(!e[n]){const t={[k]:[]};"string"==typeof w&&(t[w]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:F}]},[F,w,k,q]),Z=n(()=>q||w?U.flatMap(e=>{const t=e[k]||[];return w&&"string"==typeof w?t.map(t=>Object.assign(Object.assign({},t),{[w]:e[w]})):t}):F,[U,k,q,w,F]),K=Mo(F,A,E),Q=n(()=>e=>{const t={strokeWidth:M};return t.stroke=A?Kt(e,A,K):Eo,O&&(t.fill=t.stroke,t.fillOpacity=j),t},[A,K,M,O,j]),J=n(()=>C.lineStyle?C.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=A?Kt(e,A,K):Eo,t},[A,K,C.lineStyle]),ee=n(()=>{if(P)return e=>{const t={r:N,fillOpacity:1};return t.fill=A?Kt(e.parentLine||e,A,K):Eo,t}},[P,N,A,K]),te=void 0!==$?$:U.length>1,ne=n(()=>{if(te&&A)return yo({data:U,colorBy:A,colorScale:K,getColor:Kt})},[te,A,U,K]),oe=n(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),h);return ne&&120>e.right&&(e.right=120),e},[h,ne]),re=C.height||60,ie=n(()=>{var e,t,n,o,r,i,s,a;return{top:null!==(t=null===(e=C.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=C.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=C.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:oe.left,right:null!==(a=null===(s=C.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:oe.right}},[C.margin,oe]),se=C.brushDirection||"x",ae=Po({componentName:"MinimapChart",data:F,accessors:{xAccessor:b,yAccessor:x}});if(ae)return e.createElement(jo,{componentName:"MinimapChart",message:ae,width:u,height:d});const le=O?"area":"line",ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:le,data:Z,xAccessor:b,yAccessor:x,groupAccessor:w||void 0,curve:S,lineStyle:Q},P&&{pointStyle:ee}),{size:[u,d],margin:oe,showAxes:!0,xLabel:y,yLabel:g,xFormat:m,yFormat:v,enableHover:_,showGrid:z}),ne&&{legend:ne}),p&&{title:p}),B&&{tooltipContent:wo(B)}),I&&{xExtent:I}),T),ue={chartType:le,data:Z,xAccessor:b,yAccessor:x,groupAccessor:w||void 0,curve:S,lineStyle:J,size:[u,re+ie.top+ie.bottom],margin:ie,showAxes:null!==(l=C.showAxes)&&void 0!==l&&l,background:C.background,enableHover:!1},de=e.createElement("div",{key:"minimap",style:{position:"relative",width:u}},e.createElement(Ue,Object.assign({ref:X},ue)),e.createElement(sr,{width:u-ie.left-ie.right,height:re,margin:ie,scales:G,brushDirection:se,extent:I,onBrush:Y})),he=e.createElement("div",{key:"main"},e.createElement(Ue,Object.assign({},ce)));return e.createElement("div",{className:"minimap-chart"+(f?" "+f:"")},D?de:he,D?he:de)}function lr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",categoryLabel:f,valueLabel:p,valueFormat:y,colorBy:g,colorScheme:m="category10",sort:v=!1,barPadding:b=5,enableHover:x=!0,showGrid:w=!1,showLegend:k,tooltip:A,frameProps:E={},selection:S,linkedHover:M}=t,O=o||[],j=zo(M,g?["string"==typeof g?g:""]:[]),P=Fo({name:(null==S?void 0:S.name)||"__unused__"}),N=Ro({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),_=S?{isActive:P.isActive,predicate:P.predicate}:null,z=Oo(O,v,d),$=Mo(O,g,m),B=n(()=>e=>{const t={};return t.fill=g?Kt(e,g,$):Eo,t},[g,$]),C=n(()=>Bo(B,_,S),[B,_,S]),D=void 0!==k?k:!!g,W=n(()=>{if(D&&g)return yo({data:z,colorBy:g,colorScale:$,getColor:Kt})},[D,g,z,$]),L=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return W&&120>e.right&&(e.right=120),e},[a,W]),T=s(e=>{M&&N.onHover(e?e.data||e:null)},[M,N]),F=n(()=>{const t=g&&g!==u;return n=>{const o=n.data||n,r="function"==typeof u?u(o):o[u],i="function"==typeof d?d(o):o[d],s=t?"function"==typeof g?g(o):o[g]:null;return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},r+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof i?i.toLocaleString():i+""),null!=s&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof g?g:"group",": ",s+""))}},[u,d,g]),R=Po({componentName:"BarChart",data:O,accessors:{categoryAccessor:u,valueAccessor:d}});if(R)return e.createElement(jo,{componentName:"BarChart",message:R,width:r,height:i});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:z,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:C,size:[r,i],margin:L,barPadding:b,enableHover:x,showAxes:!0,oLabel:f,rLabel:p,rFormat:y,showGrid:w,oSort:v},W&&{legend:W}),c&&{title:c}),l&&{className:l}),{tooltipContent:A?wo(A):F}),M&&{customHoverBehavior:T}),E);return e.createElement(pt,Object.assign({},H))}function cr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:f="vertical",categoryLabel:p,valueLabel:y,valueFormat:g,colorBy:m,colorScheme:v="category10",normalize:b=!1,barPadding:x=5,enableHover:w=!0,showGrid:k=!1,showLegend:A=!0,tooltip:E,frameProps:S={},selection:M,linkedHover:O}=t,j=o||[],P=m||d,N=zo(O,P?["string"==typeof P?P:""]:[]),_=Fo({name:(null==M?void 0:M.name)||"__unused__"}),z=Ro({name:(null==N?void 0:N.name)||"hover",fields:(null==N?void 0:N.fields)||[]}),$=M?{isActive:_.isActive,predicate:_.predicate}:null,B=Mo(j,P,v),C=n(()=>e=>P?{fill:Kt(e,P,B)}:{fill:Eo},[P,B]),D=n(()=>Bo(C,$,M),[C,$,M]),W=n(()=>{if(A)return yo({data:j,colorBy:P,colorScale:B,getColor:Kt})},[A,j,P,B]),L=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:120},a);return W&&120>e.right&&(e.right=120),e},[a,W]),T=s(e=>{O&&z.onHover(e)},[O,z]),F=n(()=>{const t=So(d),n=So(u),o=So(h);return r=>{const i=r.data||r;return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},t(i)+""),e.createElement("div",{style:{marginTop:"4px"}},n(i)+""," · ",Number(o(i)).toLocaleString()))}},[d,u,h]),R=Po({componentName:"StackedBarChart",data:j,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}});if(R)return e.createElement(jo,{componentName:"StackedBarChart",message:R,width:r,height:i});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:j,oAccessor:u,rAccessor:h,stackBy:d,normalize:b,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:D,size:[r,i],margin:L,barPadding:x,enableHover:w,showAxes:!0,oLabel:p,rLabel:y,rFormat:g,showGrid:k},W&&{legend:W}),c&&{title:c}),l&&{className:l}),{tooltipContent:E?wo(E):F}),O&&{customHoverBehavior:T}),S);return e.createElement(pt,Object.assign({},H))}function ur(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",categoryLabel:f,valueLabel:p,valueFormat:y,colorBy:g,colorScheme:m="category10",sizeBy:v,sizeRange:b=[3,8],pointRadius:x=4,pointOpacity:w=.7,categoryPadding:k=20,enableHover:A=!0,showGrid:E=!1,showLegend:S,tooltip:M,frameProps:O={},selection:j,linkedHover:P}=t,N=o||[],_=zo(P,g?["string"==typeof g?g:""]:["string"==typeof u?u:""]),z=Fo({name:(null==j?void 0:j.name)||"__unused__"}),$=Ro({name:(null==_?void 0:_.name)||"hover",fields:(null==_?void 0:_.fields)||[]}),B=j?{isActive:z.isActive,predicate:z.predicate}:null,C=Mo(N,g,m),D=n(()=>{if(!v)return;const e=N.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[N,v]),W=n(()=>e=>{const t={fillOpacity:w};return t.fill=g?Kt(e,g,C):Eo,t.r=v?Jt(e,v,b,D):x,t},[g,C,v,b,D,x,w]),L=n(()=>Bo(W,B,j),[W,B,j]),T=void 0!==S?S:!!g,F=n(()=>{if(T&&g)return yo({data:N,colorBy:g,colorScale:C,getColor:Kt})},[T,g,N,C]),R=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return F&&120>e.right&&(e.right=120),e},[a,F]),H=s(e=>{P&&$.onHover(e)},[P,$]),I=n(()=>{const t=So(d),n=So(u);return o=>{const r=o.data||o,i=n(r),s=t(r),a=g?"function"==typeof g?g(r):r[g]:null,l=v?"function"==typeof v?v(r):r[v]:null;return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},i+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=a&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof g?g:"color",": ",a+""),null!=l&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof v?v:"size",": ","number"==typeof l?l.toLocaleString():l+""))}},[u,d,g,v]),Y=Po({componentName:"SwarmPlot",data:N,accessors:{categoryAccessor:u,valueAccessor:d}});if(Y)return e.createElement(jo,{componentName:"SwarmPlot",message:Y,width:r,height:i});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:N,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:L,size:[r,i],margin:R,barPadding:k,enableHover:A,showAxes:!0,oLabel:f,rLabel:p,rFormat:y,showGrid:E},F&&{legend:F}),c&&{title:c}),l&&{className:l}),{tooltipContent:M?wo(M):I}),P&&{customHoverBehavior:H}),O);return e.createElement(pt,Object.assign({},X))}function dr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",categoryLabel:f,valueLabel:p,valueFormat:y,colorBy:g,colorScheme:m="category10",showOutliers:v=!0,categoryPadding:b=20,enableHover:x=!0,showGrid:w=!1,showLegend:k,tooltip:A,frameProps:E={},selection:S,linkedHover:M}=t,O=o||[],j=zo(M,g?["string"==typeof g?g:""]:["string"==typeof u?u:""]),P=Fo({name:(null==S?void 0:S.name)||"__unused__"}),N=Ro({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),_=S?{isActive:P.isActive,predicate:P.predicate}:null,z=Mo(O,g,m),$=n(()=>e=>{const t=g?Kt(e,g,z):Eo;return{fill:t,stroke:t,fillOpacity:.8}},[g,z]),B=n(()=>Bo($,_,S),[$,_,S]),C=void 0!==k?k:!!g,D=n(()=>{if(C&&g)return yo({data:O,colorBy:g,colorScale:z,getColor:Kt})},[C,g,O,z]),W=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return D&&120>e.right&&(e.right=120),e},[a,D]),L=s(e=>{M&&N.onHover(e)},[M,N]),T=n(()=>t=>{const n=t.data||t,o=n.stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(n.category||t.category||"")+""),null!=o.median&&e.createElement(e.Fragment,null,e.createElement("div",null,"Median: ",o.median.toLocaleString()),e.createElement("div",null,"Q1: ",o.q1.toLocaleString()),e.createElement("div",null,"Q3: ",o.q3.toLocaleString()),e.createElement("div",null,"Min: ",o.min.toLocaleString()),e.createElement("div",null,"Max: ",o.max.toLocaleString())))},[]),F=Po({componentName:"BoxPlot",data:O,accessors:{categoryAccessor:u,valueAccessor:d}});if(F)return e.createElement(jo,{componentName:"BoxPlot",message:F,width:r,height:i});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:O,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:B,showOutliers:v,size:[r,i],margin:W,barPadding:b,enableHover:x,showAxes:!0,oLabel:f,rLabel:p,rFormat:y,showGrid:w},D&&{legend:D}),c&&{title:c}),l&&{className:l}),{tooltipContent:A?wo(A):T}),M&&{customHoverBehavior:L}),E);return e.createElement(pt,Object.assign({},R))}function hr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",bins:h=25,relative:f=!1,categoryLabel:p,valueLabel:y,valueFormat:g,colorBy:m,colorScheme:v="category10",categoryPadding:b=20,enableHover:x=!0,showGrid:w=!1,showLegend:k,tooltip:A,frameProps:E={},selection:S,linkedHover:M}=t,O=o||[],j=zo(M,m?["string"==typeof m?m:""]:["string"==typeof u?u:""]),P=Fo({name:(null==S?void 0:S.name)||"__unused__"}),N=Ro({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),_=S?{isActive:P.isActive,predicate:P.predicate}:null,z=Mo(O,m,v),$=n(()=>e=>{const t=m?Kt(e,m,z):Eo;return{fill:t,stroke:t,fillOpacity:.8}},[m,z]),B=n(()=>Bo($,_,S),[$,_,S]),C=void 0!==k?k:!!m,D=n(()=>{if(C&&m)return yo({data:O,colorBy:m,colorScale:z,getColor:Kt})},[C,m,O,z]),W=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return D&&120>e.right&&(e.right=120),e},[a,D]),L=s(e=>{M&&N.onHover(e)},[M,N]),T=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:go},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),F=Po({componentName:"Histogram",data:O,accessors:{categoryAccessor:u,valueAccessor:d}});if(F)return e.createElement(jo,{componentName:"Histogram",message:F,width:r,height:i});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:O,oAccessor:u,rAccessor:d,projection:"horizontal",summaryStyle:B,bins:h,normalize:f,size:[r,i],margin:W,barPadding:b,enableHover:x,showAxes:!0,oLabel:p,rLabel:y,rFormat:g,showGrid:w},D&&{legend:D}),c&&{title:c}),l&&{className:l}),{tooltipContent:A?wo(A):T}),M&&{customHoverBehavior:L}),E);return e.createElement(pt,Object.assign({},R))}function fr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:f=25,showIQR:p=!0,categoryLabel:y,valueLabel:g,valueFormat:m,colorBy:v,colorScheme:b="category10",categoryPadding:x=20,enableHover:w=!0,showGrid:k=!1,showLegend:A,tooltip:E,frameProps:S={},selection:M,linkedHover:O}=t,j=o||[],P=zo(O,v?["string"==typeof v?v:""]:["string"==typeof u?u:""]),N=Fo({name:(null==M?void 0:M.name)||"__unused__"}),_=Ro({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),z=M?{isActive:N.isActive,predicate:N.predicate}:null,$=Mo(j,v,b),B=n(()=>e=>{const t=v?Kt(e,v,$):Eo;return{fill:t,stroke:t,fillOpacity:.6}},[v,$]),C=n(()=>Bo(B,z,M),[B,z,M]),D=void 0!==A?A:!!v,W=n(()=>{if(D&&v)return yo({data:j,colorBy:v,colorScale:$,getColor:Kt})},[D,v,j,$]),L=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return W&&120>e.right&&(e.right=120),e},[a,W]),T=s(e=>{O&&_.onHover(e)},[O,_]),F=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=(Array.isArray(n)?n:[]).map(e=>{const t="function"==typeof d?d(e):e[d];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),i=r.length,s=i>0?r[Math.floor(i/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:go},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),i>0&&e.createElement("div",null,"n = ",i),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))},[d]),R=Po({componentName:"ViolinPlot",data:j,accessors:{categoryAccessor:u,valueAccessor:d}});if(R)return e.createElement(jo,{componentName:"ViolinPlot",message:R,width:r,height:i});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:j,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:C,bins:f,showIQR:p,size:[r,i],margin:L,barPadding:x,enableHover:w,showAxes:!0,oLabel:y,rLabel:g,rFormat:m,showGrid:k},W&&{legend:W}),c&&{title:c}),l&&{className:l}),{tooltipContent:E?wo(E):F}),O&&{customHoverBehavior:T}),S);return e.createElement(pt,Object.assign({},H))}function pr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:f=20,amplitude:p=1.5,categoryLabel:y,valueLabel:g,valueFormat:m,colorBy:v,colorScheme:b="category10",categoryPadding:x=5,enableHover:w=!0,showGrid:k=!1,showLegend:A,tooltip:E,frameProps:S={},selection:M,linkedHover:O}=t,j=o||[],P=zo(O,v?["string"==typeof v?v:""]:["string"==typeof u?u:""]),N=Fo({name:(null==M?void 0:M.name)||"__unused__"}),_=Ro({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),z=M?{isActive:N.isActive,predicate:N.predicate}:null,$=Mo(j,v,b),B=n(()=>e=>{const t=v?Kt(e,v,$):Eo;return{fill:t,stroke:t,fillOpacity:.5}},[v,$]),C=n(()=>Bo(B,z,M),[B,z,M]),D=void 0!==A?A:!!v,W=n(()=>{if(D&&v)return yo({data:j,colorBy:v,colorScale:$,getColor:Kt})},[D,v,j,$]),L=n(()=>{const e=Object.assign({top:50,bottom:60,left:"horizontal"===h?120:70,right:40},a);return W&&120>e.right&&(e.right=120),e},[a,W,h]),T=s(e=>{O&&_.onHover(e)},[O,_]),F=n(()=>t=>e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},((t.data||t).category||t.category||"")+"")),[]),R=Po({componentName:"RidgelinePlot",data:j,accessors:{categoryAccessor:u,valueAccessor:d}});if(R)return e.createElement(jo,{componentName:"RidgelinePlot",message:R,width:r,height:i});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline",data:j,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:C,bins:f,size:[r,i],margin:L,barPadding:x,enableHover:w,showAxes:!0,oLabel:y,rLabel:g,rFormat:m,showGrid:k,oSort:!1},W&&{legend:W}),c&&{title:c}),l&&{className:l}),{tooltipContent:E?wo(E):F}),O&&{customHoverBehavior:T}),S);return H.amplitude=p,e.createElement(pt,Object.assign({},H))}function yr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",categoryLabel:f,valueLabel:p,valueFormat:y,colorBy:g,colorScheme:m="category10",sort:v=!0,dotRadius:b=5,categoryPadding:x=10,enableHover:w=!0,showGrid:k=!0,showLegend:A,tooltip:E,frameProps:S={},selection:M,linkedHover:O}=t,j=o||[],P=zo(O,g?["string"==typeof g?g:""]:["string"==typeof u?u:""]),N=Fo({name:(null==M?void 0:M.name)||"__unused__"}),_=Ro({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),z=M?{isActive:N.isActive,predicate:N.predicate}:null,$=Oo(j,v,d),B=Mo(j,g,m),C=n(()=>e=>{const t={r:b,fillOpacity:.8};return t.fill=g?Kt(e,g,B):Eo,t},[g,B,b]),D=n(()=>Bo(C,z,M),[C,z,M]),W=void 0!==A?A:!!g,L=n(()=>{if(W&&g)return yo({data:$,colorBy:g,colorScale:B,getColor:Kt})},[W,g,$,B]),T=n(()=>{const e=Object.assign({top:50,bottom:60,left:120,right:40},a);return L&&120>e.right&&(e.right=120),e},[a,L]),F=s(e=>{O&&_.onHover(e)},[O,_]),R=n(()=>t=>{const n=t.data||t,o="function"==typeof u?u(n):n[u],r="function"==typeof d?d(n):n[d];return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof r?r.toLocaleString():r+""))},[u,d]),H=Po({componentName:"DotPlot",data:j,accessors:{categoryAccessor:u,valueAccessor:d}});if(H)return e.createElement(jo,{componentName:"DotPlot",message:H,width:r,height:i});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:$,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:D,size:[r,i],margin:T,barPadding:x,enableHover:w,showAxes:!0,oLabel:f,rLabel:p,rFormat:y,showGrid:k,oSort:v},L&&{legend:L}),c&&{title:c}),l&&{className:l}),{tooltipContent:E?wo(E):R}),O&&{customHoverBehavior:F}),S);return e.createElement(pt,Object.assign({},I))}function gr(t){const{data:o,width:r=400,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",colorBy:h,colorScheme:f="category10",startAngle:p=0,enableHover:y=!0,showLegend:g=!0,tooltip:m,frameProps:v={},selection:b,linkedHover:x}=t,w=o||[],k=h||u,A=zo(x,k?["string"==typeof k?k:""]:[]),E=Fo({name:(null==b?void 0:b.name)||"__unused__"}),S=Ro({name:(null==A?void 0:A.name)||"hover",fields:(null==A?void 0:A.fields)||[]}),M=b?{isActive:E.isActive,predicate:E.predicate}:null,O=Mo(w,k,f),j=n(()=>e=>k?{fill:Kt(e,k,O)}:{fill:Eo},[k,O]),P=n(()=>Bo(j,M,b),[j,M,b]),N=n(()=>{if(g)return yo({data:w,colorBy:k,colorScale:O,getColor:Kt})},[g,w,k,O]),_=n(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},a);return N&&120>e.right&&(e.right=120),e},[a,N]),z=s(e=>{x&&S.onHover(e)},[x,S]),$=n(()=>{const t=h&&h!==u;return n=>{var o;const r=(null===(o=n.data)||void 0===o?void 0:o[0])||n.data||n,i="function"==typeof u?u(r):r[u],s="function"==typeof d?d(r):r[d],a=t?"function"==typeof h?h(r):r[h]:null;return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},i+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=a&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof h?h:"group",": ",a+""))}},[u,d,h]),B=Po({componentName:"PieChart",data:w,accessors:{categoryAccessor:u,valueAccessor:d}});if(B)return e.createElement(jo,{componentName:"PieChart",message:B,width:r,height:i});const C=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:w,oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:P,startAngle:p,size:[r,i],margin:_,enableHover:y,showAxes:!1},N&&{legend:N}),c&&{title:c}),l&&{className:l}),{tooltipContent:m?wo(m):$}),x&&{customHoverBehavior:z}),v);return e.createElement(pt,Object.assign({},C))}function mr(t){const{data:o,width:r=400,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h=60,centerContent:f,colorBy:p,colorScheme:y="category10",startAngle:g=0,enableHover:m=!0,showLegend:v=!0,tooltip:b,frameProps:x={},selection:w,linkedHover:k}=t,A=o||[],E=p||u,S=zo(k,E?["string"==typeof E?E:""]:[]),M=Fo({name:(null==w?void 0:w.name)||"__unused__"}),O=Ro({name:(null==S?void 0:S.name)||"hover",fields:(null==S?void 0:S.fields)||[]}),j=w?{isActive:M.isActive,predicate:M.predicate}:null,P=Mo(A,E,y),N=n(()=>e=>E?{fill:Kt(e,E,P)}:{fill:Eo},[E,P]),_=n(()=>Bo(N,j,w),[N,j,w]),z=n(()=>{if(v)return yo({data:A,colorBy:E,colorScale:P,getColor:Kt})},[v,A,E,P]),$=n(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},a);return z&&120>e.right&&(e.right=120),e},[a,z]),B=s(e=>{k&&O.onHover(e)},[k,O]),C=n(()=>{const t=p&&p!==u;return n=>{var o;const r=(null===(o=n.data)||void 0===o?void 0:o[0])||n.data||n,i="function"==typeof u?u(r):r[u],s="function"==typeof d?d(r):r[d],a=t?"function"==typeof p?p(r):r[p]:null;return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},i+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=a&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof p?p:"group",": ",a+""))}},[u,d,p]),D=Po({componentName:"DonutChart",data:A,accessors:{categoryAccessor:u,valueAccessor:d}});if(D)return e.createElement(jo,{componentName:"DonutChart",message:D,width:r,height:i});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:A,oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:_,innerRadius:h,startAngle:g,centerContent:f,size:[r,i],margin:$,enableHover:m,showAxes:!1},z&&{legend:z}),c&&{title:c}),l&&{className:l}),{tooltipContent:b?wo(b):C}),k&&{customHoverBehavior:B}),x);return e.createElement(pt,Object.assign({},W))}function vr(t){const{data:o,width:r=600,height:i=400,margin:a,className:l,title:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:f="vertical",categoryLabel:p,valueLabel:y,valueFormat:g,colorBy:m,colorScheme:v="category10",barPadding:b=5,enableHover:x=!0,showGrid:w=!1,showLegend:k=!0,tooltip:A,frameProps:E={},selection:S,linkedHover:M}=t,O=o||[],j=m||d,P=zo(M,j?["string"==typeof j?j:""]:[]),N=Fo({name:(null==S?void 0:S.name)||"__unused__"}),_=Ro({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),z=S?{isActive:N.isActive,predicate:N.predicate}:null,$=Mo(O,j,v),B=n(()=>e=>j?{fill:Kt(e,j,$)}:{fill:Eo},[j,$]),C=n(()=>Bo(B,z,S),[B,z,S]),D=n(()=>{if(k)return yo({data:O,colorBy:j,colorScale:$,getColor:Kt})},[k,O,j,$]),W=n(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return D&&120>e.right&&(e.right=120),e},[a,D]),L=s(e=>{M&&_.onHover(e)},[M,_]),T=n(()=>{const t=So(d),n=So(u),o=So(h);return r=>{const i=r.data||r;return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:"bold"}},t(i)+""),e.createElement("div",{style:{marginTop:"4px"}},n(i)+""," · ",Number(o(i)).toLocaleString()))}},[d,u,h]),F=Po({componentName:"GroupedBarChart",data:O,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}});if(F)return e.createElement(jo,{componentName:"GroupedBarChart",message:F,width:r,height:i});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:O,oAccessor:u,rAccessor:h,groupBy:d,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:C,size:[r,i],margin:W,barPadding:b,enableHover:x,showAxes:!0,oLabel:p,rLabel:y,rFormat:g,showGrid:w},D&&{legend:D}),c&&{title:c}),l&&{className:l}),{tooltipContent:A?wo(A):T}),M&&{customHoverBehavior:L}),E);return e.createElement(pt,Object.assign({},R))}function br(t){const{nodes:o,edges:r,width:i=600,height:s=600,margin:a,className:l,title:c,nodeIDAccessor:u="id",sourceAccessor:d="source",targetAccessor:h="target",nodeLabel:f,colorBy:p,colorScheme:y="category10",nodeSize:g=8,nodeSizeRange:m=[5,20],edgeWidth:v=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:w=300,forceStrength:k=.1,showLabels:A=!1,enableHover:E=!0,showLegend:S,tooltip:M,frameProps:O={}}=t,j=o||[],P=r||[],N=Mo(j,p,y),_=n(()=>e=>{const t={};return t.fill=p?Kt(e.data||e,p,N):Eo,"number"==typeof g&&(t.r=g),t},[p,N,g]),z=n(()=>e=>({stroke:b,strokeWidth:"number"==typeof v?v:"function"==typeof v?v(e):e[v]||1,opacity:x}),[v,b,x]),$=n(()=>{if(A&&f)return"function"==typeof f?f:e=>e[f]},[A,f]),B=void 0!==S?S:!!p,C=n(()=>{if(B&&p)return yo({data:j,colorBy:p,colorScale:N,getColor:Kt})},[B,p,j,N]),D=n(()=>{const e=Object.assign(Object.assign({},{top:20,bottom:20,left:20,right:20}),a);return C&&120>e.right&&(e.right=120),e},[a,C]),W=_o({componentName:"ForceDirectedGraph",nodes:o,edges:r,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:u}});return W?e.createElement(jo,{componentName:"ForceDirectedGraph",message:W,width:i,height:s}):e.createElement(an,Object.assign({chartType:"force",nodes:j,edges:P,size:[i,s],margin:D,nodeIDAccessor:u,sourceAccessor:d,targetAccessor:h,iterations:w,forceStrength:k,nodeStyle:_,edgeStyle:z,colorBy:p,colorScheme:y,nodeSize:g,nodeSizeRange:m,nodeLabel:$,showLabels:A,enableHover:E,tooltipContent:M?e=>wo(M)(e.data):void 0,legend:C,className:l,title:c},O))}function xr(t){const{nodes:o,edges:r,width:i=600,height:s=600,margin:a={top:50,bottom:50,left:50,right:50},className:l,title:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y="category10",edgeColorBy:g="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,showLabels:w=!0,enableHover:k=!0,edgeOpacity:A=.5,tooltip:E,frameProps:S={}}=t,M=r||[],O=n(()=>{if(o&&o.length>0)return o;const e=new Set;return M.forEach(t=>{const n="function"==typeof u?u(t):t[u],o="function"==typeof d?d(t):t[d];e.add(n),e.add(o)}),Array.from(e).map(e=>({id:e}))},[o,M,u,d]),j=Mo(O,p,y),P=n(()=>(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(p)r.fill=Kt(e.data||e,p,j);else{const i=Array.isArray(y)?y:Ut[y]||Zt,s=Array.isArray(i)?i:Zt,a=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=s[a%s.length]}return r},[p,j,y]),N=n(()=>e=>{const t={stroke:"black",strokeWidth:.5,fillOpacity:A,strokeOpacity:A};if("function"==typeof g)t.fill=g(e);else if("source"===g){const n="object"==typeof e.source?e.source:null;p&&n?t.fill=Kt(n.data||n,p,j):n&&(t.fill=P(n,n.index).fill)}else if("target"===g){const n="object"==typeof e.target?e.target:null;p&&n?t.fill=Kt(n.data||n,p,j):n&&(t.fill=P(n,n.index).fill)}return t},[g,p,j,P,A]),_=n(()=>{if(!w)return;const e=x||f;return"function"==typeof e?e:t=>t[e]},[w,x,f]),z=_o({componentName:"ChordDiagram",edges:r,edgesRequired:!0});return z?e.createElement(jo,{componentName:"ChordDiagram",message:z,width:i,height:s}):e.createElement(an,Object.assign({chartType:"chord",nodes:O,edges:M,size:[i,s],margin:a,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:P,edgeStyle:N,colorBy:p,colorScheme:y,edgeColorBy:g,edgeOpacity:A,nodeLabel:_,showLabels:w,enableHover:k,tooltipContent:E?e=>wo(E)(e.data):void 0,className:l,title:c},S))}function wr(t){const{nodes:o,edges:r,width:i=800,height:s=600,margin:a={top:50,bottom:50,left:50,right:50},className:l,title:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y="category10",edgeColorBy:g="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:w,showLabels:k=!0,enableHover:A=!0,edgeOpacity:E=.5,edgeSort:S,tooltip:M,frameProps:O={}}=t,j=r||[],P=n(()=>{if(o&&o.length>0)return o;const e=new Set;return j.forEach(t=>{const n="function"==typeof u?u(t):t[u],o="function"==typeof d?d(t):t[d];e.add(n),e.add(o)}),Array.from(e).map(e=>({id:e}))},[o,j,u,d]),N=Mo(P,p,y),_=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?Kt(e.data||e,p,N):"#4d430c",t},[p,N]),z=n(()=>e=>{const t={stroke:"none",strokeWidth:0,fillOpacity:E};if("function"==typeof g)t.fill=g(e);else if("source"===g){const n="object"==typeof e.source?e.source:null;p&&n?t.fill=Kt(n.data||n,p,N):n&&(t.fill=_(n).fill)}else if("target"===g){const n="object"==typeof e.target?e.target:null;p&&n?t.fill=Kt(n.data||n,p,N):n&&(t.fill=_(n).fill)}else"gradient"===g&&(t.fill="#999",t.fillOpacity=.7*E);return t},[g,p,N,_,E]),$=n(()=>{if(!k)return;const e=w||f;return"function"==typeof e?e:t=>t[e]},[k,w,f]),B=n(()=>{if("function"==typeof M)return M},[M]),C=_o({componentName:"SankeyDiagram",edges:r,edgesRequired:!0});return C?e.createElement(jo,{componentName:"SankeyDiagram",message:C,width:i,height:s}):e.createElement(an,Object.assign({chartType:"sankey",nodes:P,edges:j,size:[i,s],margin:a,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:_,edgeStyle:z,colorBy:p,colorScheme:y,edgeColorBy:g,edgeOpacity:E,edgeSort:S,nodeLabel:$,showLabels:k,enableHover:A,tooltipContent:B?e=>B(e.data):void 0,className:l,title:c},O))}function kr(t){const{data:o,width:r=600,height:i=600,margin:s={top:50,bottom:50,left:50,right:50},className:a,title:l,layout:c="tree",orientation:u="vertical",childrenAccessor:d="children",valueAccessor:h="value",nodeIdAccessor:f="name",colorBy:p,colorScheme:y="category10",colorByDepth:g=!1,edgeStyle:m="curve",nodeLabel:v,showLabels:b=!0,nodeSize:x=5,enableHover:w=!0,tooltip:k,frameProps:A={}}=t,E=n(()=>{if(!o)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof d?d(n):n[d];o&&Array.isArray(o)&&o.forEach(t)};return t(o),e},[o,d]),S=n(()=>g?Qt(E.map((e,t)=>({depth:t%5})),"depth",y):p&&"function"!=typeof p?Qt(E,p,y):void 0,[E,p,g,y]),M=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=g?Kt({depth:e.depth||0},"depth",S):p?Kt(e.data||e,p,S):Eo,t},[p,g,S]),O=n(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),j=n(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return"function"==typeof h?h:e=>e[h]||1},[c,h]),P=No({componentName:"TreeDiagram",data:o});return P?e.createElement(jo,{componentName:"TreeDiagram",message:P,width:r,height:i}):e.createElement(an,Object.assign({chartType:c,data:o,size:[r,i],margin:s,nodeIDAccessor:f,childrenAccessor:d,hierarchySum:j,treeOrientation:u,edgeType:m,nodeStyle:M,edgeStyle:O,colorBy:p,colorScheme:y,colorByDepth:g,nodeSize:x,nodeLabel:b?v||f:void 0,showLabels:b,enableHover:w,tooltipContent:k?e=>wo(k)(e.data):void 0,className:a,title:l},A))}function Ar(t){const{data:o,width:r=600,height:i=600,margin:s={top:10,bottom:10,left:10,right:10},className:a,title:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:f="category10",colorByDepth:p=!1,showLabels:y=!0,labelMode:g="leaf",nodeLabel:m,padding:v=4,paddingTop:b,enableHover:x=!0,tooltip:w,frameProps:k={}}=t,A=n(()=>{if(!o)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof c?c(n):n[c];o&&Array.isArray(o)&&o.forEach(t)};return t(o),e},[o,c]),E=n(()=>{if(!p&&h&&"function"!=typeof h)return Qt(A,h,f)},[A,h,p,f]),S=n(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const n={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return n.fill=p?e[(t.depth||0)%e.length]:h?Kt(t.data||t,h,E):Eo,n}},[h,p,E]),M=n(()=>"function"==typeof u?u:e=>e[u]||1,[u]),O=void 0!==b?b:y&&"parent"===g?18:void 0,j=No({componentName:"Treemap",data:o});return j?e.createElement(jo,{componentName:"Treemap",message:j,width:r,height:i}):e.createElement(an,Object.assign({chartType:"treemap",data:o,size:[r,i],margin:s,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:M,padding:v,paddingTop:O,nodeStyle:S,colorBy:h,colorScheme:f,colorByDepth:p,nodeLabel:y?m||d:void 0,showLabels:y,enableHover:x,tooltipContent:w?e=>wo(w)(e.data):void 0,className:a,title:l},k))}function Er(t){const{data:o,width:r=600,height:i=600,margin:s={top:10,bottom:10,left:10,right:10},className:a,title:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:f="category10",colorByDepth:p=!1,showLabels:y=!0,nodeLabel:g,circleOpacity:m=.7,padding:v=4,enableHover:b=!0,tooltip:x,frameProps:w={}}=t,k=n(()=>{if(!o)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof c?c(n):n[c];o&&Array.isArray(o)&&o.forEach(t)};return t(o),e},[o,c]),A=n(()=>{if(!p&&h&&"function"!=typeof h)return Qt(k,h,f)},[k,h,p,f]),E=n(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const n={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:m};return n.fill=p?e[(t.depth||0)%e.length]:h?Kt(t.data||t,h,A):Eo,n}},[h,p,A,m]),S=n(()=>"function"==typeof u?u:e=>e[u]||1,[u]),M=No({componentName:"CirclePack",data:o});return M?e.createElement(jo,{componentName:"CirclePack",message:M,width:r,height:i}):e.createElement(an,Object.assign({chartType:"circlepack",data:o,size:[r,i],margin:s,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:S,padding:v,nodeStyle:E,colorBy:h,colorScheme:f,colorByDepth:p,nodeLabel:y?g||d:void 0,showLabels:y,enableHover:b,tooltipContent:x?e=>wo(x)(e.data):void 0,className:a,title:l},w))}ir.displayName="ScatterplotMatrix",ar.displayName="MinimapChart",lr.displayName="BarChart",cr.displayName="StackedBarChart",ur.displayName="SwarmPlot",dr.displayName="BoxPlot",hr.displayName="Histogram",fr.displayName="ViolinPlot",pr.displayName="RidgelinePlot",yr.displayName="DotPlot",gr.displayName="PieChart",mr.displayName="DonutChart",vr.displayName="GroupedBarChart",br.displayName="ForceDirectedGraph",xr.displayName="ChordDiagram",wr.displayName="SankeyDiagram",kr.displayName="TreeDiagram",Ar.displayName="Treemap",Er.displayName="CirclePack";const Sr=o(function(t,n){const{size:o,width:i,height:a,margin:c,className:u,arrowOfTime:d="right",windowMode:h="sliding",windowSize:f=200,data:p,timeAccessor:y,valueAccessor:g,timeExtent:m,valueExtent:v,extentPadding:b,stroke:x="#007bff",strokeWidth:w=2,strokeDasharray:k,showAxes:A=!0,background:E,enableHover:S,tooltipContent:M,tooltip:O,onHover:j,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:$,pulse:B,staleness:C,transition:D,linkedHover:W}=t,L=null!=i&&null!=a?[i,a]:o||[500,300],T=null!=M?M:O,F=r(null),R=zo(W),H=Ro({name:(null==R?void 0:R.name)||"hover",fields:(null==R?void 0:R.fields)||[]}),I=s(e=>{j&&j(e),W&&H.onHover(e?e.data||e:null)},[j,W,H]);return l(n,()=>({push:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=F.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=F.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),e.createElement(Ue,{ref:F,chartType:"line",runtimeMode:"streaming",size:L,margin:c,className:u,arrowOfTime:d,windowMode:h,windowSize:f,data:p,timeAccessor:y,valueAccessor:g,xExtent:m,yExtent:v,extentPadding:b,lineStyle:{stroke:x,strokeWidth:w,strokeDasharray:k},showAxes:A,background:E,hoverAnnotation:S,tooltipContent:T,customHoverBehavior:I,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:$,pulse:B,staleness:C,transition:D})});Sr.displayName="RealtimeLineChart";const Mr=o(function(t,n){const{binSize:o,size:i,width:a,height:c,margin:u,className:d,arrowOfTime:h="right",windowMode:f="sliding",windowSize:p=200,data:y,timeAccessor:g,valueAccessor:m,timeExtent:v,valueExtent:b,extentPadding:x,categoryAccessor:w,colors:k,fill:A,stroke:E,strokeWidth:S,gap:M,showAxes:O=!0,background:j,enableHover:P,tooltipContent:N,tooltip:_,onHover:z,annotations:$,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:D,linkedHover:W}=t,L=null!=a&&null!=c?[a,c]:i||[500,300],T=null!=N?N:_,F=r(null),R=zo(W),H=Ro({name:(null==R?void 0:R.name)||"hover",fields:(null==R?void 0:R.fields)||[]}),I=s(e=>{z&&z(e),W&&H.onHover(e?e.data||e:null)},[z,W,H]);l(n,()=>({push:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=F.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=F.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const Y={};return null!=A&&(Y.fill=A),null!=E&&(Y.stroke=E),null!=S&&(Y.strokeWidth=S),null!=M&&(Y.gap=M),e.createElement(Ue,{ref:F,chartType:"bar",runtimeMode:"streaming",size:L,margin:u,className:d,arrowOfTime:h,windowMode:f,windowSize:p,data:y,timeAccessor:g,valueAccessor:m,xExtent:v,yExtent:b,extentPadding:x,binSize:o,categoryAccessor:w,barColors:k,barStyle:Y,showAxes:O,background:j,hoverAnnotation:P,tooltipContent:T,customHoverBehavior:I,annotations:$,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:D})});Mr.displayName="RealtimeTemporalHistogram";const Or=Mr,jr=o(function(t,n){const{size:o,width:i,height:a,margin:c,className:u,arrowOfTime:d="right",windowMode:h="sliding",windowSize:f=200,data:p,timeAccessor:y,valueAccessor:g,timeExtent:m,valueExtent:v,extentPadding:b,categoryAccessor:x,colors:w,radius:k,fill:A,opacity:E,stroke:S,strokeWidth:M,showAxes:O=!0,background:j,enableHover:P,tooltipContent:N,tooltip:_,onHover:z,annotations:$,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:D,linkedHover:W}=t,L=null!=i&&null!=a?[i,a]:o||[500,300],T=null!=N?N:_,F=r(null),R=zo(W),H=Ro({name:(null==R?void 0:R.name)||"hover",fields:(null==R?void 0:R.fields)||[]}),I=s(e=>{z&&z(e),W&&H.onHover(e?e.data||e:null)},[z,W,H]);l(n,()=>({push:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=F.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=F.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const Y={};return null!=k&&(Y.radius=k),null!=A&&(Y.fill=A),null!=E&&(Y.opacity=E),null!=S&&(Y.stroke=S),null!=M&&(Y.strokeWidth=M),e.createElement(Ue,{ref:F,chartType:"swarm",runtimeMode:"streaming",size:L,margin:c,className:u,arrowOfTime:d,windowMode:h,windowSize:f,data:p,timeAccessor:y,valueAccessor:g,xExtent:m,yExtent:v,extentPadding:b,categoryAccessor:x,barColors:w,swarmStyle:Y,showAxes:O,background:j,hoverAnnotation:P,tooltipContent:T,customHoverBehavior:I,annotations:$,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:D})});jr.displayName="RealtimeSwarmChart";const Pr=o(function(t,n){const{size:o,width:i,height:a,margin:c,className:u,arrowOfTime:d="right",windowMode:h="sliding",windowSize:f=200,data:p,timeAccessor:y,valueAccessor:g,timeExtent:m,valueExtent:v,extentPadding:b,positiveColor:x,negativeColor:w,connectorStroke:k,connectorWidth:A,gap:E,stroke:S,strokeWidth:M,showAxes:O=!0,background:j,enableHover:P,tooltipContent:N,tooltip:_,onHover:z,annotations:$,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:D,linkedHover:W}=t,L=null!=i&&null!=a?[i,a]:o||[500,300],T=null!=N?N:_,F=r(null),R=zo(W),H=Ro({name:(null==R?void 0:R.name)||"hover",fields:(null==R?void 0:R.fields)||[]}),I=s(e=>{z&&z(e),W&&H.onHover(e?e.data||e:null)},[z,W,H]);l(n,()=>({push:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=F.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=F.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const Y={};return null!=x&&(Y.positiveColor=x),null!=w&&(Y.negativeColor=w),null!=k&&(Y.connectorStroke=k),null!=A&&(Y.connectorWidth=A),null!=E&&(Y.gap=E),null!=S&&(Y.stroke=S),null!=M&&(Y.strokeWidth=M),e.createElement(Ue,{ref:F,chartType:"waterfall",runtimeMode:"streaming",size:L,margin:c,className:u,arrowOfTime:d,windowMode:h,windowSize:f,data:p,timeAccessor:y,valueAccessor:g,xExtent:m,yExtent:v,extentPadding:b,waterfallStyle:Y,showAxes:O,background:j,hoverAnnotation:P,tooltipContent:T,customHoverBehavior:I,annotations:$,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:D})});Pr.displayName="RealtimeWaterfallChart";const Nr=o(function(t,n){const{size:o,width:i,height:s,margin:a,className:c,arrowOfTime:u="right",windowMode:d="sliding",windowSize:h=200,data:f,timeAccessor:p,valueAccessor:y,categoryAccessor:g,timeExtent:m,valueExtent:v,extentPadding:b,heatmapXBins:x=20,heatmapYBins:w=20,aggregation:k="count",showAxes:A=!0,background:E,enableHover:S,tooltipContent:M,tooltip:O,onHover:j,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:$,pulse:B,staleness:C}=t,D=null!=i&&null!=s?[i,s]:o||[500,300],W=null!=M?M:O,L=r(null);return l(n,()=>({push:e=>{var t;return null===(t=L.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=L.current)||void 0===t?void 0:t.pushMany(e)},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:[]}})),e.createElement(Ue,{ref:L,chartType:"heatmap",runtimeMode:"streaming",size:D,margin:a,className:c,arrowOfTime:u,windowMode:d,windowSize:h,data:f,timeAccessor:p,valueAccessor:y,categoryAccessor:g,xExtent:m,yExtent:v,extentPadding:b,heatmapXBins:x,heatmapYBins:w,heatmapAggregation:k,showAxes:A,background:E,hoverAnnotation:S,tooltipContent:W,customHoverBehavior:j,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:$,pulse:B,staleness:C})});Nr.displayName="RealtimeHeatmap";const _r={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},zr={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[$r,Br]=fn(e=>({theme:_r,setTheme(t){e(e=>"light"===t?{theme:_r}:"dark"===t?{theme:zr}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}}));function Cr({theme:t}){const n=Br(e=>e.setTheme);return e.useEffect(()=>{void 0!==t&&n(t)},[t,n]),null}function Dr({children:t}){const n=Br(e=>e.theme);return e.createElement("div",{style:{position:"relative","--semiotic-bg":n.colors.background,"--semiotic-text":n.colors.text,"--semiotic-text-secondary":n.colors.textSecondary,"--semiotic-grid":n.colors.grid,"--semiotic-border":n.colors.border,"--semiotic-primary":n.colors.primary,"--semiotic-font-family":n.typography.fontFamily}},t)}function Wr({theme:t,children:n}){return e.createElement($r,null,e.createElement(Cr,{theme:t}),e.createElement(Dr,null,n))}function Lr(){return Br(e=>e.theme)}function Tr(e,t){return n=this,o=void 0,i=function*(){const{format:n="svg",filename:o="chart",scale:r=2,background:i="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),Fr(s,a),"svg"===n){const e=(new XMLSerializer).serializeToString(a);Rr(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const e=l.width*r,t=l.height*r,n=(new XMLSerializer).serializeToString(a),s=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(s),u=new Image;u.width=l.width,u.height=l.height,yield new Promise((n,s)=>{u.onload=()=>{const a=document.createElement("canvas");a.width=e,a.height=t;const l=a.getContext("2d");l.fillStyle=i,l.fillRect(0,0,e,t),l.scale(r,r),l.drawImage(u,0,0),a.toBlob(e=>{e?(Rr(e,o+".png"),n()):s(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(c)},u.onerror=()=>{URL.revokeObjectURL(c),s(Error("Failed to load SVG image"))},u.src=c})}},new((r=void 0)||(r=Promise))(function(e,t){function s(e){try{l(i.next(e))}catch(e){t(e)}}function a(e){try{l(i.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(e){e(n)})).then(s,a)}l((i=i.apply(n,o||[])).next())});var n,o,r,i}function Fr(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Fr(o[e],r[e])}function Rr(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}class Hr extends e.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.createElement(jo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}export{hn as Annotation,En as AnnotationLayer,Go as AreaChart,Hn as Axis,lr as BarChart,dr as BoxPlot,Xn as Brush,Uo as BubbleChart,Hr as ChartErrorBoundary,xr as ChordDiagram,Er as CirclePack,zr as DARK_THEME,Bn as DividedLine,mr as DonutChart,yr as DotPlot,br as ForceDirectedGraph,vr as GroupedBarChart,qo as Heatmap,hr as Histogram,pe as IncrementalExtent,_r as LIGHT_THEME,$e as Legend,Xo as LineChart,Ko as LinkedCharts,ar as MinimapChart,xo as MultiLineTooltip,gr as PieChart,Nr as RealtimeHeatmap,Or as RealtimeHistogram,Sr as RealtimeLineChart,jr as RealtimeSwarmChart,Mr as RealtimeTemporalHistogram,Pr as RealtimeWaterfallChart,pr as RidgelinePlot,fe as RingBuffer,wr as SankeyDiagram,Yo as Scatterplot,ir as ScatterplotMatrix,Vo as StackedAreaChart,cr as StackedBarChart,an as StreamNetworkFrame,pt as StreamOrdinalFrame,Ue as StreamXYFrame,ur as SwarmPlot,Wr as ThemeProvider,bo as Tooltip,kr as TreeDiagram,Ar as Treemap,fr as ViolinPlot,co as calculateDataExtent,Tr as exportChart,$n as funnelize,no as heatmapping,eo as hexbinning,po as nodesEdgesFromHierarchy,wo as normalizeTooltip,Rn as smartTickFormat,Ho as useBrushSelection,Io as useFilteredData,Ro as useLinkedHover,Fo as useSelection,Lr as useTheme};
|
|
1
|
+
import*as e from"react";import{useMemo as t,forwardRef as n,useRef as o,useState as r,useCallback as i,useEffect as a,useImperativeHandle as s,createContext as l,useContext as c,useLayoutEffect as u,useId as d}from"react";import{brushX as h,brushY as g,brush as y}from"d3-brush";import{select as f}from"d3-selection";import{scaleLinear as p,scaleBand as m,scaleOrdinal as v,scaleSequential as b}from"d3-scale";import{bin as x,quantile as w,min as k,groups as A,max as S,sum as E,mean as O,group as L}from"d3-array";import{packEnclose as j,hierarchy as P,partition as M,pack as N,treemap as D,treemapBinary as T,cluster as B,tree as C}from"d3-hierarchy";import{interpolateNumber as z}from"d3-interpolate";import{schemeCategory10 as W,interpolatePlasma as _,interpolateViridis as $,interpolatePurples as H,interpolateOranges as I,interpolateGreens as R,interpolateReds as F,interpolateBlues as Y,schemeSet3 as X,schemeTableau10 as G}from"d3-scale-chromatic";import{forceLink as q,forceSimulation as V,forceManyBody as U,forceX as Z,forceY as Q}from"d3-force";import{ribbon as J,chord as K}from"d3-chord";import{arc as ee}from"d3-shape";const te=5e3;class ne{constructor(e){this.lastBoundedData=null,this.chunkTimer=0,this.callback=e}setBoundedData(e){if(e===this.lastBoundedData)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,te),bounded:!0,totalSize:e.length});let t=te;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+te,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)}push(e){this.callback({inserts:[e],bounded:!1})}pushMany(e){0!==e.length&&this.callback({inserts:e,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class oe{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;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}toArray(){const e=[];for(const t of this)e.push(t);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}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.isNaN(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.isNaN(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 ie(e,t,n,o,r){const i=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function ae(e,t,n,o,r,i){const a=[],s=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||(a.push([t.x(e),t.y(i)]),s.push(i))}return{type:"line",path:a,rawValues:s,style:r,datum:e,group:i}}function se(e,t,n,o,r,i,a){const s=[],l=[];for(const i of e){const e=n(i),a=o(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const c=t.x(e);s.push([c,t.y(a)]),l.push([c,t.y(r)])}return{type:"area",topPath:s,bottomPath:l,style:i,datum:e,group:a}}function le(e,t,n,o,r,i,a){const s=n(e),l=o(e);if(null==s||null==l||Number.isNaN(s)||Number.isNaN(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function ce(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function ue(e,t,n,o,r,i){return{type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i}}function de(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function he(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}class ge{constructor(e){this.xExtent=new re,this.yExtent=new re,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version=0,this.config=e,this.buffer=new oe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=de(e.timeAccessor||e.xAccessor,"time"),this.getY=de(e.valueAccessor||e.yAccessor,"value")):(this.getX=de(e.xAccessor,"x"),this.getY=de(e.yAccessor,"y")),this.getGroup=he(e.groupAccessor),this.getCategory=he(e.categoryAccessor),this.getSize=e.sizeAccessor?de(e.sizeAccessor,"size"):void 0,this.getColor=he(e.colorAccessor),this.getBounds=e.boundsAccessor?de(e.boundsAccessor,"bounds"):void 0,this.getPointId=he(e.pointIdAccessor),"candlestick"===e.chartType&&(this.getOpen=de(e.openAccessor,"open"),this.getHigh=de(e.highAccessor,"high"),this.getLow=de(e.lowAccessor,"low"),this.getClose=de(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new oe(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();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)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))):this.yExtent.push(this.getY(n))}else for(const n of e.inserts){"growing"===this.config.windowMode&&this.buffer.full&&(this.growingCap*=2,this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap));const e=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))):this.yExtent.push(this.getY(n)),null!=e&&(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)))}return!0}computeScene(e){var t,n,o,r,i,a;const{config:s,buffer:l}=this;if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===s.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.xExtent.extent,u=this.yExtent.extent;let d=s.xExtent?[null!==(t=s.xExtent[0])&&void 0!==t?t:c[0],null!==(n=s.xExtent[1])&&void 0!==n?n:c[1]]:c,h=s.yExtent?[null!==(o=s.yExtent[0])&&void 0!==o?o:u[0],null!==(r=s.yExtent[1])&&void 0!==r?r:u[1]]:u;const g=s.yExtent&&null!=s.yExtent[0]&&null!=s.yExtent[1];if("stackedarea"===s.chartType&&!g&&l.size>0)if(s.normalize)h=[0,1+s.extentPadding];else{const e=l.toArray(),t=this.groupData(e),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);h=[0,o+(o>0?o*s.extentPadding:1)]}else if("bar"===s.chartType&&s.binSize&&!g&&l.size>0){const[,e]=function(e,t,n,o,r){const i=ie(e,t,n,o,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(l,this.getX,this.getY,s.binSize,this.getCategory);h=[0,e+e*s.extentPadding]}else if("waterfall"===s.chartType&&!g&&l.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(l,this.getY),n=t-e,o=n>0?n*s.extentPadding:1;h=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!g&&h[0]!==1/0){if(this.getBounds){const e=l.toArray();for(const t of e){const e=this.getY(t),n=this.getBounds(t);null!=e&&!Number.isNaN(e)&&n&&(e+n>h[1]&&(h[1]=e+n),h[0]>e-n&&(h[0]=e-n))}}const e=h[1]-h[0],t=e>0?e*s.extentPadding:1,n=null===(i=s.yExtent)||void 0===i?void 0:i[0],o=null===(a=s.yExtent)||void 0===a?void 0:a[1];h=[null!=n?h[0]:h[0]-t,null!=o?h[1]:h[1]+t]}if(d[0]!==1/0&&d[1]!==-1/0||(d=[0,1]),h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),void 0!==s.arrowOfTime)if("x"==("up"===(y=s.arrowOfTime)||"down"===y?"y":"x")){const t="right"===s.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:p().domain(d).range(t),y:p().domain(h).range([e.height,0])}}else{const t="down"===s.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:p().domain(h).range([0,e.width]),y:p().domain(d).range(t)}}else this.scales={x:p().domain(d).range([0,e.width]),y:p().domain(h).range([e.height,0])};var y;this.config.transition&&this.scene.length>0&&this.snapshotPositions();const f=l.toArray();this.scene=this.buildSceneNodes(e),this.config.decay&&this.applyDecay(this.scene,f),this.config.pulse&&this.applyPulse(this.scene,f),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}buildSceneNodes(e){const{config:t,buffer:n,scales:o}=this;if(!o||0===n.size)return[];const r=n.toArray();switch(t.chartType){case"line":return this.buildLineScene(r);case"area":return this.buildAreaScene(r);case"stackedarea":return this.buildStackedAreaScene(r);case"scatter":case"bubble":return this.buildPointScene(r);case"heatmap":return this.buildHeatmapScene(r,e);case"bar":return this.buildBarScene(r);case"swarm":return this.buildSwarmScene(r);case"waterfall":return this.buildWaterfallScene(r,e);case"candlestick":return this.buildCandlestickScene(r,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=ae(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]);n.push(se(e.data,this.scales,this.getX,this.getY,o,t,e.key))}return n}buildStackedAreaScene(e){const t=this.groupData(e);return t.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0),function(e,t,n,o,r,i){var a;const s=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||s.add(t)}const l=Array.from(s).sort((e,t)=>e-t),c=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}c.set(t.key,e)}let u;if(i){u=new Map;for(const t of l){let n=0;for(const o of e)n+=(null===(a=c.get(o.key))||void 0===a?void 0:a.get(t))||0;u.set(t,n||1)}}const d=[],h=new Map;for(const e of l)h.set(e,0);for(const n of e){const e=c.get(n.key),o=[],a=[];for(const n of l){let r=e.get(n)||0;const s=h.get(n);i&&(r/=u.get(n));const l=t.x(n);a.push([l,t.y(s)]),o.push([l,t.y(s+r)]),h.set(n,s+r)}d.push({type:"area",topPath:o,bottomPath:a,style:r(n.key,n.data[0]),datum:n.data,group:n.key})}return d}(t,this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){const e=Math.min(...t),n=Math.max(...t);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}let i=null;if(this.getColor&&!this.config.pointStyle){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];i=new Map;let o=0;for(const e of t)i.set(e,n[o%n.length]),o++}for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},a=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(a=r(e))}if(i&&this.getColor){const t=this.getColor(o);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const s=this.getPointId?this.getPointId(o)+"":void 0,l=le(o,this.scales,this.getX,this.getY,a,e,s);l&&t.push(l)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=de(this.config.valueAccessor,"value"),r=new Set,i=new Set;for(const t of e)r.add(this.getX(t)),i.add(this.getY(t));const a=Array.from(r).sort((e,t)=>e-t),s=Array.from(i).sort((e,t)=>e-t);if(0===a.length||0===s.length)return n;const l=t.width/a.length,c=t.height/s.length,u=new Map;for(const t of e){const e=`${this.getX(t)}_${this.getY(t)}`;u.set(e,{val:o(t),datum:t})}let d=1/0,h=-1/0;for(const{val:e}of u.values())d>e&&(d=e),e>h&&(h=e);const g=h-d||1;for(let e=0;a.length>e;e++)for(let t=0;s.length>t;t++){const o=u.get(`${a[e]}_${s[t]}`);if(!o)continue;const r=(o.val-d)/g;n.push(ue(e*l,(s.length-1-t)*c,l,c,`rgb(${Math.round(220-180*r)},${Math.round(220-100*r)},${Math.round(255-50*r)})`,o.datum))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const i=[],a=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,s=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=de(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,d]=this.scales.x.domain(),[h,g]=this.scales.y.domain(),y=(d-u||1)/a,f=(g-h||1)/s,p=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/y),a-1),r=Math.min(Math.floor((n-h)/f),s-1);if(0>o||0>r)continue;const i=`${o}_${r}`;let l=p.get(i);l||(l={sum:0,count:0,data:[]},p.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of p){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,w=t.width/a,k=t.height/s;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,a=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=p.get(e);i.push(ue(r*w,(s-1-a)*k,w,k,c,{xi:r,yi:a,value:t,count:u.count,sum:u.sum,data:u.data}))}return i}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=ie(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort();o=[...t.filter(t=>e.has(t)),...i]}const r=[],i=this.scales,[a,s]=i.x.domain();for(const e of n.values()){const n=Math.max(e.start,a),l=Math.min(e.end,s);if(n>=l)continue;const c=i.x(n),u=i.x(l),d=Math.min(c,u)+.5,h=Math.max(c,u)-.5-d;if(h>0)if(o&&e.categories.size>0){let n=0;for(const a of o){const o=e.categories.get(a)||0;if(0===o)continue;const s=i.y(n),l=i.y(n+o);r.push(ce(d,Math.min(s,l),h,Math.abs(s-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[a])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:a,categoryValue:o},a)),n+=o}}else{const t=i.y(0),n=i.y(e.total);r.push(ce(d,Math.min(t,n),h,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const i=[],a=this.config.swarmStyle||{},s=null!==(t=a.radius)&&void 0!==t?t:3,l=null!==(n=a.fill)&&void 0!==n?n:"#007bff",c=null!==(o=a.opacity)&&void 0!==o?o:.7,u=a.stroke,d=a.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),a=this.scales.y(n);let h=l;if(this.getCategory){const e=this.getCategory(t);h=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||h}const g={type:"point",x:o,y:a,r:s,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t};this.getPointId&&(g.pointId=this.getPointId(t)+""),i.push(g)}return i}buildWaterfallScene(e,t){var n,o,r;const i=[],a=this.scales,s=this.config.waterfallStyle,l=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===l.length)return i;const c=null!==(n=null==s?void 0:s.positiveColor)&&void 0!==n?n:"#28a745",u=null!==(o=null==s?void 0:s.negativeColor)&&void 0!==o?o:"#dc3545",d=null!==(r=null==s?void 0:s.gap)&&void 0!==r?r:1,h=null==s?void 0:s.stroke,g=null==s?void 0:s.strokeWidth;let y=0;for(let e=0;l.length>e;e++){const n=l[e],o=this.getX(n),r=this.getY(n),f=y+r;let p;p=l.length-1>e?this.getX(l[e+1])-o:e>0?o-this.getX(l[e-1]):0;const m=a.x(o),v=0!==p?a.x(o+p):m+t.width/10,b=Math.min(m,v)+d/2,x=Math.max(m,v)-d/2-b;if(0>=x){y=f;continue}const w=a.y(y),k=a.y(f);i.push(ce(b,Math.min(w,k),x,Math.abs(w-k),{fill:0>r?u:c,stroke:h,strokeWidth:g},Object.assign(Object.assign({},n),{baseline:y,cumEnd:f,delta:r,_connectorStroke:null==s?void 0:s.connectorStroke,_connectorWidth:null==s?void 0:s.connectorWidth}))),y=f}return i}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",a=o.wickColor||"#333",s=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([o,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(d),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:i,wickColor:a,wickWidth:s,isUp:h,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=this.getBounds(t),a=this.scales.x(e);if(i&&0!==i)n.push([a,this.scales.y(r+i)]),o.push([a,this.scales.y(r-i)]);else{const e=this.scales.y(r);n.push([a,e]),o.push([a,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:a};else if("candlestick"===t.type)t._decayOpacity=a;else{const e=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:e*a})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",a=null!==(o=this.config.pulse.glowRadius)&&void 0!==o?o:4,s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=this.computePulseIntensity(n,r);o>0&&(t._pulseIntensity=o,t._pulseColor=i,t._pulseGlowRadius=a)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){this.prevPositionMap.clear();for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeIdentity(t,e);n&&("point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:t.r}):"rect"===t.type||"heatcell"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,w:t.w,h:t.h}):"candlestick"===t.type&&this.prevPositionMap.set(n,{x:t.x,y:t.openY}))}}getNodeIdentity(e,t){var n,o,r,i;switch(e.type){case"point":return`p:${void 0===e.datum?t:this.getX(e.datum)}_${this.getY(e.datum)}`;case"rect":return`r:${e.group||""}:${null!==(i=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==i?i:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return"c:"+this.getX(e.datum);default:return null}}startTransition(){var e,t,n,o,r,i;if(!this.config.transition||0===this.prevPositionMap.size)return;const a=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let s=!1;for(let e=0;this.scene.length>e;e++){const a=this.scene[e],l=this.getNodeIdentity(a,e);if(!l)continue;const c=this.prevPositionMap.get(l);if(c)if("point"===a.type){const e={x:a.x,y:a.y,r:a.r};c.x===e.x&&c.y===e.y||(a._targetX=e.x,a._targetY=e.y,a._targetR=e.r,a.x=c.x,a.y=c.y,a.r=null!==(t=c.r)&&void 0!==t?t:a.r,s=!0)}else if("rect"===a.type){const e={x:a.x,y:a.y,w:a.w,h:a.h};c.x===e.x&&c.y===e.y&&c.w===e.w&&c.h===e.h||(a._targetX=e.x,a._targetY=e.y,a._targetW=e.w,a._targetH=e.h,a.x=c.x,a.y=c.y,a.w=null!==(n=c.w)&&void 0!==n?n:a.w,a.h=null!==(o=c.h)&&void 0!==o?o:a.h,s=!0)}else if("heatcell"===a.type){const e={x:a.x,y:a.y,w:a.w,h:a.h};c.x===e.x&&c.y===e.y||(a._targetX=e.x,a._targetY=e.y,a._targetW=e.w,a._targetH=e.h,a.x=c.x,a.y=c.y,a.w=null!==(r=c.w)&&void 0!==r?r:a.w,a.h=null!==(i=c.h)&&void 0!==i?i:a.h,s=!0)}}s&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:a})}advanceTransition(e){var t;if(!this.activeTransition)return!1;const n=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),o="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?n:1-Math.pow(1-n,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==e._targetR&&void 0!==n.r&&(e.r=n.r+(e._targetR-n.r)*o)}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}else if("heatcell"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}if(n>=1){for(const e of this.scene)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}return this.activeTransition=null,!1}return!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}))}resolveLineStyle(e,t){const n=this.config.lineStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle)return this.config.areaStyle(t||{});const o=this.config.lineStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}getData(){return this.buffer.toArray()}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.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],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){Object.assign(this.config,e)}}function ye(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function fe(e,t,n){if(0===e.path.length)return null;const o=xe(e.path,t);if(0>o)return null;const[r,i]=e.path[o],a=t-r,s=n-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function pe(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function me(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function ve(e,t,n){const o=e.bodyWidth/2,r=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=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+a*a)}}return null}function be(e,t,n){if(0===e.topPath.length)return null;const o=xe(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],a=t-r,s=n-i;return{node:e,datum:e.datum,x:r,y:i,distance:Math.sqrt(a*a+s*s)}}function xe(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}const we={fill:t=>e.createElement("rect",{style:t,width:20,height:20}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:20,y2:20})};function ke(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,we[n])(o(e,t)),r}function Ae(t){const{legendGroups:n,customClickBehavior:o,title:r="Legend",width:i=100,height:a=20,orientation:s="vertical"}=t,l="vertical"===s?(({legendGroups:t,width:n,customClickBehavior:o})=>{let r=30;const i=[];return t.forEach((t,a)=>{r+=5,i.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+a,stroke:"gray",x1:0,y1:r,x2:n,y2:r})),r+=10,t.label&&(r+=20,i.push(e.createElement("text",{key:"legend-text-"+a,y:r,className:"legend-group-label"},t.label)),r+=10),i.push(e.createElement("g",{key:"legend-group-"+a,className:"legend-item",transform:`translate(0,${r})`},((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,a=[];let s=0;return i.forEach((t,i)=>{const l=ke(t,i,o,r);a.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(0,${s})`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:30},t.label))),s+=25}),a})(t,o))),r+=25*t.items.length+10}),i})({legendGroups:n,width:i,customClickBehavior:o}):(({legendGroups:t,title:n,height:o,customClickBehavior:r})=>{let i=0;const a=[],s=!1===n?10:40;return t.forEach((n,l)=>{n.label&&(a.push(e.createElement("text",{key:"legend-text-"+l,transform:`translate(${i},${s}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},n.label)),i+=20);const c=((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,a=[];let s=0;return i.forEach((t,i)=>{const l=ke(t,i,o,r);a.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(${s},0)`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:25},t.label))),s+=35,s+=8*t.label.length}),{items:a,offset:s}})(n,r);a.push(e.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(${i},${s})`},c.items)),i+=c.offset+5,t[l+1]&&a.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:i,y1:s-10,x2:i,y2:o+s+10})),i+=15}),e.createElement("g",null,!1!==n&&e.createElement("line",{x1:0,x2:i+10,y1:s-10,y2:s-10,stroke:"gray",className:"title-neatline"}),a)})({legendGroups:n,title:r,height:a,customClickBehavior:o});return e.createElement("g",null,void 0!==r&&e.createElement("text",{className:"legend-title",y:20,x:"horizontal"===s?0:i/2,textAnchor:"horizontal"===s?"start":"middle"},r),l)}function Se(e){return"string"==typeof e?{type:e}:e}function Ee({orient:n,config:o,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;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!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===n||"bottom"===n,u=t(()=>{if(0===r.length)return null;const t=i.domain(),o=a-8;if("boxplot"===l.type){const t=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)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!t)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*o,20),y=(o-g)/2+4;if(c){const t=i(a),o=i(u),r=i(s),c=i(d),f=i(h),p="top"===n?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+n},e.createElement("line",{x1:c,y1:m+p*(y+g/2),x2:f,y2:m+p*(y+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+p*y,x2:c,y2:m+p*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:f,y1:m+p*y,x2:f,y2:m+p*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(t,o),y:"top"===n?m-y-g:m+y,width:Math.abs(o-t),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===n?m-y-g:m+y,x2:r,y2:"top"===n?m-y:m+y+g,stroke:l.fill,strokeWidth:2}))}{const t=i(a),o=i(u),r=i(s),c=i(d),f=i(h),p="left"===n?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+n},e.createElement("line",{x1:m+p*(y+g/2),y1:c,x2:m+p*(y+g/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+p*y,y1:c,x2:m+p*(y+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+p*y,y1:f,x2:m+p*(y+g),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===n?m-y-g:m+y,y:Math.min(t,o),width:g,height:Math.abs(o-t),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===n?m-y-g:m+y,y1:r,x2:"left"===n?m-y:m+y+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=x().domain(t).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+n},u.map((t,r)=>{if(null==t.x0||null==t.x1)return null;const a=t.length/d*o;if(c){const o=i(t.x0),s=i(t.x1)-i(t.x0);return e.createElement("rect",{key:r,x:o,y:"top"===n?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(t.x0),s=i(t.x1)-i(t.x0);return e.createElement("rect",{key:r,x:"left"===n?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const t=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===n?-(t-a):t-a}`:`${"left"===n?-(t-a):t-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+n},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const t=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;t.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);t.push(`L${a},${"top"===n?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;t.push(`L${a},${e}`),t.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;t.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);t.push(`L${"left"===n?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;t.push(`L${e},${a}`),t.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+n},e.createElement("path",{d:t.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,n,c,4]);return u?e.createElement("g",{className:"marginal-"+n,"data-testid":"marginal-"+n},u):null}function Oe(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Le(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 je(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:y,events:f={},"data-testid":p}=t,m=new Set(Array.isArray(y)?y:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-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 e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":p},f),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Le((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||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const y=16,f=a?u?[a]:Oe(a,c):[],p=i?u?[i]:Oe(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t)))),v=f.length*y),p.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t))));let x=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(f.length+p.length)*y+(p.length>0?y:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const w=Math.max(0,f.length+p.length-1)*y;let k=0;return"topBottom"===d?k=0>o?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+y+(p.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(l,v,b,h))}function Pe(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(je,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(je,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Me(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function Ne(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function De(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Te(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,y,f,p,m,v,b,x,w,k,A,S,E,O,L,P,M,N,D,T,B,C,z;switch(t.type){case"label":{let r=null,i=null;if(null!=t.pointId&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===t.pointId);if(!e)return null;r=e.x,i=e.y}else r=Me(t,o),i=Ne(t,o);return null==r||null==i?null:De(r,i,o)?e.createElement(Pe,{key:"ann-"+n,noteData:{x:r,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{let r=null,i=null;if(null!=t.pointId&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===t.pointId);if(!e)return null;r=e.x,i=e.y}else r=Me(t,o),i=Ne(t,o);return null==r||null==i?null:De(r,i,o)?e.createElement(Pe,{key:"ann-"+n,noteData:{x:r,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Me(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=Ne(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Me(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ne(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=j(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Me(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ne(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a=t.style||{stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Me(n,o),s=Ne(n,o);return null==i||null==s?null:e.createElement("circle",Object.assign({key:r,cx:i,cy:s,r:t.r||6},a))}))}case"bracket":{const r=Me(t,o),i=Ne(t,o);return e.createElement(Pe,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",y=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,p=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!f||!p)return null;const m=t.method||"linear";let v;if("loess"===m)v=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]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))s.push([t,h/u]);else{const e=(u*y-d*h)/f;s.push([t,(h-e*d)/u+e*t])}}return s}(y,null!==(u=t.bandwidth)&&void 0!==u?u:.3);else{let e;try{const n=require("regression");e="polynomial"===m?n.polynomial(y,{order:t.order||2}):n.linear(y)}catch(e){return null}v=e.points}const b=v.map(([e,t])=>`${f(e)},${p(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:f(v[v.length-1][0])+4,y:p(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(y=null==r?void 0:r(t.y0))&&void 0!==y?y:0,a=null!==(f=null==r?void 0:r(t.y1))&&void 0!==f?f:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"#6366f1",fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(m=null===(p=o.scales)||void 0===p?void 0:p.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,s=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.value;if(!a||!s)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(k=t.threshold)&&void 0!==k?k:2,g=c-h*d,y=!1!==t.showBand,f=t.fill||"#6366f1",E=null!==(A=t.fillOpacity)&&void 0!==A?A:.1,O=t.anomalyColor||"#ef4444",L=null!==(S=t.anomalyRadius)&&void 0!==S?S:6,j=s(c+h*d),P=s(g),M=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},y&&e.createElement("rect",{x:0,y:Math.min(j,P),width:o.width||0,height:Math.abs(P-j),fill:f,fillOpacity:E}),M.map((t,n)=>{const r=Me(t,o),i=Ne(t,o);return null==r||null==i?null:e.createElement("circle",{key:n,cx:r,cy:i,r:L,fill:O,fillOpacity:.7,stroke:O,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(j,P)-4,textAnchor:"end",fill:f,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(O=null===(E=o.scales)||void 0===E?void 0:E.x)&&void 0!==O?O:null===(L=o.scales)||void 0===L?void 0:L.time,l=null!==(M=null===(P=o.scales)||void 0===P?void 0:P.y)&&void 0!==M?M:null===(N=o.scales)||void 0===N?void 0:N.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear"))try{const e=require("regression").polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}catch(e){return null}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),y=c.reduce((e,t)=>e+t[0],0)/d,f=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),p=null!==(D=t.confidence)&&void 0!==D?D:.95,m=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,v=null!==(T=t.steps)&&void 0!==T?T:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const k=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(f>0?Math.pow(e-y,2)/f:0))*m;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),j=`${s(b)},${l(u(b))}`,W=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(B=t.fillOpacity)&&void 0!==B?B:.15,stroke:"none"}),e.createElement("polyline",{points:`${j} ${S}`,fill:"none",stroke:W,strokeWidth:null!==(C=t.strokeWidth)&&void 0!==C?C:2,strokeDasharray:null!==(z=t.strokeDasharray)&&void 0!==z?z:"6,3"}),t.label&&k.length>0&&e.createElement("text",{x:s(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:W,fontSize:11},t.label))}default:return null}}}function Be(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function Ce(e){return Math.round(100*e)/100+""}function ze(n){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,xLabel:d,yLabel:h,xFormat:g,yFormat:y,showGrid:f,title:p,legend:m,foregroundGraphics:v,marginalGraphics:b,xValues:x,yValues:w,annotations:k,svgAnnotationRules:A,annotationFrame:S,xAccessor:E,yAccessor:O,annotationData:L,pointNodes:j,children:P}=n,M=t(()=>c&&l?l.x.ticks(5).map(e=>({value:e,pixel:l.x(e),label:(g||Ce)(e)})):[],[c,l,g]),N=t(()=>c&&l?l.y.ticks(5).map(e=>({value:e,pixel:l.y(e),label:(y||Ce)(e)})):[],[c,l,y]),D=t(()=>{if(!k||0===k.length)return null;const e=Te(),t={scales:l?{x:l.x,y:l.y,time:l.x,value:l.y}:null,timeAxis:"x",xAccessor:E,yAccessor:O,width:o,height:r,data:L,frameType:"xy",pointNodes:j};return k.map((n,o)=>{if(A){const r=A(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[k,A,o,r,S,E,O,L]);return c||p||m||v||b||D&&D.length>0||f||P?e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},f&&l&&e.createElement("g",{className:"stream-grid"},M.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),N.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),c&&l&&(()=>{const t=null==u?void 0:u.find(e=>"left"===e.orient),n=null==u?void 0:u.find(e=>"bottom"===e.orient),i=!t||!1!==t.baseline,a=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,c="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, #666)",y="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes"},(!n||!1!==n.baseline)&&!l&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:c,strokeWidth:1}),l&&e.createElement("path",{d:Be("bottom",o,r),fill:"none",stroke:c,strokeWidth:1}),M.map((t,n)=>e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:c,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:g,style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"}},d),i&&!a&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:c,strokeWidth:1}),a&&e.createElement("path",{d:Be("left",o,r),fill:"none",stroke:c,strokeWidth:1}),N.map((t,n)=>e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:c,strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:g,style:{userSelect:"none"}},t.label))),h&&e.createElement("text",{x:15-s.left,y:r/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-s.left}, ${r/2})`,style:{userSelect:"none"}},h))})(),D,b&&l&&x&&w&&e.createElement(e.Fragment,null,b.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ee,{orient:"top",config:Se(b.top),values:x,scale:l.x,size:s.top,length:o})),b.bottom&&e.createElement("g",{transform:`translate(0, ${r})`},e.createElement(Ee,{orient:"bottom",config:Se(b.bottom),values:x,scale:l.x,size:s.bottom,length:o})),b.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ee,{orient:"left",config:Se(b.left),values:w,scale:l.y,size:s.left,length:r})),b.right&&e.createElement("g",{transform:`translate(${o}, 0)`},e.createElement(Ee,{orient:"right",config:Se(b.right),values:w,scale:l.y,size:s.right,length:r}))),v,P),p&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof p?p:null),m&&e.createElement("g",{transform:`translate(${i-s.right+10}, ${s.top})`},function(t){return"object"==typeof t&&null!==t&&!e.isValidElement(t)&&"legendGroups"in t}(m)?e.createElement(Ae,{legendGroups:m.legendGroups,title:"",width:100}):m)):null}function We(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}const _e=(e,t,n,o)=>{var r;const i=t.filter(e=>"area"===e.type);for(const t of i){if(2>t.topPath.length)continue;e.beginPath();const[n,o]=t.topPath[0];e.moveTo(n,o);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();const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;if(e.globalAlpha=i,e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=1,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),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]);e.stroke()}e.globalAlpha=1}},$e=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"point"===e.type);for(const t of a){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;if(null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=null!==(i=t._pulseGlowRadius)&&void 0!==i?i:4,o=t.r+n*t._pulseIntensity;e.beginPath(),e.arc(t.x,t.y,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.6*t._pulseIntensity,e.stroke()}e.globalAlpha=1}},He=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?Ie(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1};function Ie(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.w)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}const Re={line:[_e,(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const i of r){if(2>i.path.length)continue;const a=i.style.stroke||"#007bff",s=i.style.strokeWidth||2,l=i.colorThresholds,c=i.rawValues;if(e.setLineDash(i.style.strokeDasharray?i.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=i.style.opacity&&(e.globalAlpha=i.style.opacity),e.lineWidth=s,l&&0!==l.length&&c&&c.length===i.path.length){let u=null,d=null,h=null,g=null,y=!1;function f(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),y=!0}function p(){y&&(e.stroke(),y=!1)}for(let m=0;i.path.length>m;m++){const[v,b]=i.path[m],x=c[m],w=We(x,l,a);if(null!==u&&null!==g&&null!==h){if(w===g)e.lineTo(v,b);else{const k=[];for(const A of l){const S=A.value;(h>S||S>x)&&(S>h||x>S)||h===S||x===S||k.push({t:(S-h)/(x-h)})}k.sort((e,t)=>e.t-t.t);for(const E of k){const O=u+(v-u)*E.t,L=d+(b-d)*E.t,j=We(h+(x-h)*Math.min(E.t+1e-4,1),l,a);e.lineTo(O,L),p(),f(j,O,L)}e.lineTo(v,b)}u=v,d=b,h=x,g=w}else f(w,v,b),u=v,d=b,h=x,g=w}p()}else{e.beginPath(),e.strokeStyle=a;const[P,M]=i.path[0];e.moveTo(P,M);for(let N=1;i.path.length>N;N++)e.lineTo(i.path[N][0],i.path[N][1]);e.stroke()}if(i.style.fill&&i.style.fillOpacity&&i.style.fillOpacity>0){e.beginPath(),e.globalAlpha=i.style.fillOpacity,e.fillStyle=i.style.fill;const[D,T]=i.path[0];e.moveTo(D,T);for(let C=1;i.path.length>C;C++)e.lineTo(i.path[C][0],i.path[C][1]);const B=i.path[0][0];e.lineTo(i.path[i.path.length-1][0],o.height),e.lineTo(B,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([])}}],area:[_e],stackedarea:[_e],scatter:[$e],bubble:[$e],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);for(const t of r){const n=t.style;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="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1}}],bar:[He],swarm:[$e],waterfall:[(e,t,n,o)=>{var r,i,a;He(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const l=s[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],r=s[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(a=r.datum)||void 0===a?void 0:a.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke();const o=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1))}}]},Fe={top:20,right:20,bottom:30,left:40},Ye={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"},Xe={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 Ge({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:Xe},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}function qe({width:t,height:n,totalWidth:r,totalHeight:i,margin:s,dimension:l,scales:c,onBrush:u}){const d=o(null),p=o(null);return a(()=>{if(!d.current)return;const e=f(d.current).select(".brush-g"),o="x"===l?h():"y"===l?g():y();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(!c)return;if(!e.selection)return void u(null);let o,r;if("x"===l){const[t,i]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(n),c.y.invert(0)]}else if("y"===l){const[n,i]=e.selection;o=[c.x.invert(0),c.x.invert(t)],r=[c.y.invert(i),c.y.invert(n)]}else{const[[t,n],[i,a]]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(a),c.y.invert(n)]}u({x:o,y:r})}),e.call(o),p.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),p.current=null}},[t,n,l,c,u]),e.createElement("svg",{ref:d,width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`}))}const Ve=n(function(n,l){var c,u,d;const{chartType:h,runtimeMode:g,data:y,xAccessor:f,yAccessor:p,colorAccessor:m,sizeAccessor:v,groupAccessor:b,lineDataAccessor:x,normalize:w,binSize:k,valueAccessor:A,arrowOfTime:S="right",windowMode:E="sliding",windowSize:O=200,timeAccessor:L,xExtent:j,yExtent:P,extentPadding:M=.1,sizeRange:N,size:D=[500,300],margin:T,className:B,background:C,lineStyle:z,pointStyle:W,areaStyle:_,waterfallStyle:$,swarmStyle:H,barColors:I,colorScheme:R,boundsAccessor:F,boundsStyle:Y,openAccessor:X,highAccessor:G,lowAccessor:q,closeAccessor:V,candlestickStyle:U,showAxes:Z=!0,axes:Q,xLabel:J,yLabel:K,xFormat:ee,yFormat:te,tickFormatTime:oe,tickFormatValue:re,hoverAnnotation:ie,tooltipContent:ae,customHoverBehavior:se,enableHover:le,annotations:ce,svgAnnotationRules:ue,showGrid:de,legend:he,backgroundGraphics:xe,foregroundGraphics:we,title:ke,categoryAccessor:Ae,brush:Se,onBrush:Ee,decay:Oe,pulse:Le,transition:je,staleness:Pe,heatmapAggregation:Me,heatmapXBins:Ne,heatmapYBins:De,marginalGraphics:Te,pointIdAccessor:Be}=n,Ce=Object.assign(Object.assign({},Fe),T);if(Te){const e=60;Te.top&&e>Ce.top&&(Ce.top=e),Te.bottom&&e>Ce.bottom&&(Ce.bottom=e),Te.left&&e>Ce.left&&(Ce.left=e),Te.right&&e>Ce.right&&(Ce.right=e)}const We=D[0]-Ce.left-Ce.right,_e=D[1]-Ce.top-Ce.bottom,$e=null!=ie?ie:le,He=o(null),Ie=o(0),Xe=o(!1),[Ve,Ue]=r(0),[Ze,Qe]=r(null),Je=o(null),Ke=o(null),[et,tt]=r(null),[nt,ot]=r(!1),[rt,it]=r([]),[at,st]=r([]),lt=o(()=>{}),ct="streaming"===g||["bar","swarm","waterfall"].includes(h),ut=t(()=>({chartType:h,runtimeMode:ct?"streaming":"bounded",windowSize:O,windowMode:E,arrowOfTime:ct?S:"right",extentPadding:M,xAccessor:ct?void 0:f,yAccessor:ct?void 0:p,timeAccessor:ct?L:void 0,valueAccessor:A,colorAccessor:m,sizeAccessor:v,groupAccessor:b,categoryAccessor:Ae,lineDataAccessor:x,xExtent:j,yExtent:P,sizeRange:N,binSize:k,normalize:w,boundsAccessor:F,boundsStyle:Y,openAccessor:X,highAccessor:G,lowAccessor:q,closeAccessor:V,candlestickStyle:U,lineStyle:z,pointStyle:W,areaStyle:_,swarmStyle:H,waterfallStyle:$,colorScheme:R,barColors:I,annotations:ce,decay:Oe,pulse:Le,transition:je,staleness:Pe,heatmapAggregation:Me,heatmapXBins:Ne,heatmapYBins:De,pointIdAccessor:Be}),[h,O,E,S,M,f,p,L,A,m,v,b,Ae,x,j,P,N,k,w,F,Y,X,G,q,V,U,z,W,_,H,$,R,I,ce,Oe,Le,je,Pe,Me,Ne,De,ct,Be]),dt=o(null);dt.current||(dt.current=new ge(ut));const ht=i(()=>{Ie.current||(Ie.current=requestAnimationFrame(()=>lt.current()))},[]);a(()=>{var e;null===(e=dt.current)||void 0===e||e.updateConfig(ut),Xe.current=!0,ht()},[ut,ht]);const gt=o(null);gt.current||(gt.current=new ne(e=>{const t=dt.current;t&&t.ingest(e)&&(Xe.current=!0,ht())}));const yt=i(e=>{var t;null===(t=gt.current)||void 0===t||t.push(e)},[]),ft=i(e=>{var t;null===(t=gt.current)||void 0===t||t.pushMany(e)},[]),pt=i(()=>{var e,t;null===(e=gt.current)||void 0===e||e.clear(),null===(t=dt.current)||void 0===t||t.clear(),Xe.current=!0,ht()},[ht]);s(l,()=>({push:yt,pushMany:ft,clear:pt,getData:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[yt,ft,pt]),a(()=>{var e;y&&(null===(e=gt.current)||void 0===e||e.setBoundedData(y))},[y]);const mt=o(()=>{}),vt=o(()=>{});mt.current=e=>{if(!$e)return;const t=He.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ce.left,r=e.clientY-n.top-Ce.top;if(0>o||o>We||0>r||r>_e)return void(Je.current&&(Je.current=null,Ke.current=null,tt(null),se&&se(null),ht()));const i=dt.current;if(!i||0===i.scene.length)return;const a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"point":e=ye(i,t,n);break;case"line":e=fe(i,t,n);break;case"rect":e=pe(i,t,n);break;case"heatcell":e=me(i,t,n);break;case"area":if(!1===i.interactive)break;e=be(i,t,n);break;case"candlestick":e=ve(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,o,r);if(!a)return void(Je.current&&(Je.current=null,Ke.current=null,tt(null),se&&se(null),ht()));const s={data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y};Je.current=s,Ke.current=a.node,tt(s),se&&se(s),ht()},vt.current=()=>{Je.current&&(Je.current=null,Ke.current=null,tt(null),se&&se(null),ht())};const bt=i(e=>mt.current(e),[]),xt=i(()=>vt.current(),[]);lt.current=()=>{var e,t;Ie.current=0;const n=He.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=dt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i);a||r.computeScene({width:We,height:_e});const s="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=D[0]*s,n.height=D[1]*s,n.style.width=D[0]+"px",n.style.height=D[1]+"px",o.scale(s,s),o.translate(Ce.left,Ce.top),o.clearRect(-Ce.left,-Ce.top,D[0],D[1]);const l=function(e){if(!e)return Ye;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),s=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||a||n?{axisStroke:s||Ye.axisStroke,tickText:i||Ye.tickText,crosshair:i?i+"66":Ye.crosshair,hoverFill:l?l+"4D":Ye.hoverFill,hoverStroke:i?i+"99":Ye.hoverStroke,pointRing:l||Ye.pointRing}:Ye}(n),c=null!==(e=null==Pe?void 0:Pe.threshold)&&void 0!==e?e:5e3,u=Pe&&r.lastIngestTime>0&&i-r.lastIngestTime>c;u&&(o.globalAlpha=null!==(t=null==Pe?void 0:Pe.dimOpacity)&&void 0!==t?t:.5);const d=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=C||(d&&"transparent"!==d?d:null);g&&(o.fillStyle=g,o.fillRect(-Ce.left,-Ce.top,D[0],D[1])),o.save(),"function"==typeof o.rect&&(o.beginPath(),o.rect(0,0,We,_e),o.clip());const y=Re[h];if(y&&r.scales)for(const e of y)e(o,r.scene,r.scales,{width:We,height:_e});if(o.restore(),u&&(o.globalAlpha=1),$e&&Je.current&&r.scales&&function(e,t,n,o,r,i,a){if(!1===r.crosshair)return;e.save();const s="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=s.stroke||a.crosshair,e.lineWidth=s.strokeWidth||1,e.setLineDash(s.strokeDasharray?s.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle="#007bff",e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}(o,Je.current,We,_e,"object"==typeof $e?$e:{},0,l),Ke.current&&Array.isArray(ie)){const e=ie.find(e=>e&&"object"==typeof e&&"highlight"===e.type);e&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?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||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(o,r.scene,Ke.current,e)}const m=Xe.current;if(Xe.current=!1,m&&r.scales&&(Qe(r.scales),Te)){const e=r.getData(),t="function"==typeof f?f:e=>e[f||"x"],n="function"==typeof p?p:e=>e[p||"y"];it(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),st(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}m&&ce&&ce.length>0&&Ue(e=>e+1),(null==Pe?void 0:Pe.showBadge)&&ot(!!u),(a||r.hasActivePulses)&&(Ie.current=requestAnimationFrame(()=>lt.current()))},a(()=>(ht(),()=>{Ie.current&&cancelAnimationFrame(Ie.current)}),[ht]),a(()=>{Xe.current=!0,ht()},[h,We,_e,Z,C,z,ht]),a(()=>{if(!Pe)return;const e=setInterval(()=>{var e;const t=dt.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=Pe.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==nt&&(ot(r),Xe.current=!0,ht())},1e3);return()=>clearInterval(e)},[Pe,nt,ht]);const wt=$e&&et?ae?ae(et):e.createElement(Ge,{hover:et}):null,kt=wt?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:Ce.left+et.x,top:Ce.top+et.y,transform:`translate(${et.x>.7*We?"calc(-100% - 12px)":"12px"}, ${.3*_e>et.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},wt):null;return e.createElement("div",{className:"stream-xy-frame"+(B?" "+B:""),role:"img","aria-label":"string"==typeof ke?ke:"XY chart",style:{position:"relative",width:D[0],height:D[1]},onMouseMove:$e?bt:void 0,onMouseLeave:$e?xt:void 0},xe&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:D[0],height:D[1],pointerEvents:"none"}},xe),e.createElement("canvas",{ref:He,style:{position:"absolute",left:0,top:0}}),e.createElement(ze,{width:We,height:_e,totalWidth:D[0],totalHeight:D[1],margin:Ce,scales:Ze,showAxes:Z,axes:Q,xLabel:J,yLabel:K,xFormat:ee||oe,yFormat:te||re,showGrid:de,title:ke,legend:he,foregroundGraphics:we,marginalGraphics:Te,xValues:rt,yValues:at,annotations:ce,svgAnnotationRules:ue,annotationFrame:Ve,xAccessor:"string"==typeof f?f:"string"==typeof L?L:void 0,yAccessor:"string"==typeof p?p:"string"==typeof A?A:void 0,annotationData:null===(c=dt.current)||void 0===c?void 0:c.getData(),pointNodes:null===(u=dt.current)||void 0===u?void 0:u.scene.filter(e=>"point"===e.type)}),(Se||Ee)&&e.createElement(qe,{width:We,height:_e,totalWidth:D[0],totalHeight:D[1],margin:Ce,dimension:null!==(d=null==Se?void 0:Se.dimension)&&void 0!==d?d:"xy",scales:Ze,onBrush:null!=Ee?Ee:()=>{}}),(null==Pe?void 0:Pe.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Pe.badgePosition?{top:4,left:4}:"bottom-left"===Pe.badgePosition?{bottom:4,left:4}:"bottom-right"===Pe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:nt?"#dc3545":"#28a745",color:"white"})},nt?"STALE":"LIVE"),kt)});function Ue(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function Ze(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=w(e,.25))&&void 0!==t?t:i,median:null!==(n=w(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=w(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}Ve.displayName="StreamXYFrame";const Qe={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[i,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=s(c.pieces[0],a?i:e.name),f=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),a=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(ce(e.x,n,e.width,Math.abs(a),y,f,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),a=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(ce(n,e.x,Math.abs(a),e.width,y,f,i)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;d.length>o;o++){const i=n.get(d[o])||[];for(const n of i){const i=r(n),l=a(n,e.name);if(u){const r=e.x+o*t,a=s(0),u=s(i);c.push(ce(r,Math.min(a,u),t,Math.abs(a-u),l,n,d[o]))}else{const r=e.x+o*t,a=s(0),u=s(i);c.push(ce(Math.min(a,u),r,Math.abs(u-a),t,l,n,d[o]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,y=s.length>0,f=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=y&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=p+(e.pctStart+e.pct/2)*f,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),y=c?a(s):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:Ue,donut:Ue,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,y=[],f="vertical"===g,p=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=w(t,.25))&&void 0!==n?n:s,g=null!==(o=w(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=w(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,k=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,A=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,S=d(e.pieceData[0],e.name),E=[];if(p)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=f?e.middle:h(n),r=f?h(n):e.middle;E.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(k),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(A),stats:{min:k,q1:c,median:g,q3:m,max:A},style:S,datum:e.pieceData,category:e.name,outliers:E}),p)for(const e of E)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:S.fill||"#999",opacity:.6},datum:e.datum})}return y},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,y=s.bins||20,f=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],s=(a-i)/y||1,d=Array(y).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),y-1)]++;const p=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/p*m;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/p*m} ${n}`}v+=" Z"}else{for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/p*m;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/p*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(f&&t.length>=4){const s=null!==(n=w(t,.25))&&void 0!==n?n:i,l=null!==(o=w(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=w(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Ze(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,a=s(n+t*o),c=s(n+(t+1)*o);l.push(ce(Math.min(a,c),e.x+e.width-i,Math.abs(c-a),i,g,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),f=s(e.pieceData[0],e.name),p=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/y*p}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/y*p} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:Ze(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(ce(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(ce(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class Je{constructor(e){this.rExtent=new re,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new oe(e.windowSize),this.getO=he(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>de(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new re)):(this.getR=de(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=he(e.stackBy),this.getGroup=he(e.groupBy),this.getColor=he(e.colorAccessor),this.getConnector=he(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new oe(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();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)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=m().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=p().domain(a).range([o,n])}else s?(c=m().domain(i).range([0,e.height]).padding(l),u=p().domain(a).range([0,e.width])):(c=m().domain(i).range([0,e.width]).padding(l),u=p().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[a,l]=i.extent;a===1/0&&(a=0,l=1);const c=l-a,u=c>0?c*(t.extentPadding||.05):1;return a-=u,l+=u,a>0&&(a=0),s?p().domain([a,l]).range([0,e.width]):p().domain([a,l]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===n)return t;if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let a=0,s=0;if("bar"===r&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>s&&(s=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===r){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(a-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(s+=c),"bar"!==r&&"clusterbar"!==r||(a>0&&(a=0),0>s&&(s=0)),[a,s]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=Qe[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(e,t):this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=c.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=i-n;a>o&&(t._pulseIntensity=1-o/a,t._pulseColor=s,t._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const r=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,r;if(!this.config.transition||0===this.prevPositionMap.size)return;const i=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let a=!1;for(let e=0;this.scene.length>e;e++){const i=this.scene[e];let s=null;if("point"===i.type?s="p:"+e:"rect"===i.type&&(s=`r:${i.group||""}:${null!==(n=null===(t=i.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!s)continue;const l=this.prevPositionMap.get(s);l&&("point"===i.type?l.x===i.x&&l.y===i.y||(i._targetX=i.x,i._targetY=i.y,i.x=l.x,i.y=l.y,a=!0):"rect"===i.type&&(l.x===i.x&&l.y===i.y&&l.w===i.w&&l.h===i.h||(i._targetX=i.x,i._targetY=i.y,i._targetW=i.w,i._targetH=i.h,i.x=l.x,i.y=l.y,i.w=null!==(o=l.w)&&void 0!==o?o:i.w,i.h=null!==(r=l.h)&&void 0!==r?r:i.h,a=!0)))}a&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:i})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),i="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?r:1-Math.pow(1-r,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.prevPositionMap.get("p:0");if(!t)continue;e.x=t.x+(e._targetX-t.x)*i,e.y=t.y+(e._targetY-t.y)*i}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:0}`,r=this.prevPositionMap.get(t);if(!r)continue;e.x=r.x+(e._targetX-r.x)*i,e.y=r.y+(e._targetY-r.y)*i,void 0!==r.w&&(e.w=r.w+(e._targetW-r.w)*i,e.h=r.h+(e._targetH-r.h)*i)}if(r>=1){for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function Ke(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{datum:e.datum,x:e.x+e.w/2,y:e.y,distance:0,category:e.group}}function et(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function tt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;let a=Math.atan2(r,o);0>a&&(a+=2*Math.PI);let s=e.startAngle%(2*Math.PI),l=e.endAngle%(2*Math.PI);if(0>s&&(s+=2*Math.PI),0>l&&(l+=2*Math.PI),!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function nt(e,t,n){const o=e.columnWidth/2,r=e.stats?Object.assign(Object.assign({},e.stats),{n:Array.isArray(e.datum)?e.datum.length:0,mean:(e.stats.q1+e.stats.median+e.stats.q3)/3}):void 0;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:r}}else{const i=e.y-o,a=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>a))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:r}}return null}function ot(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function rt(e){return Math.round(100*e)/100+""}function it(n){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,oLabel:u,rLabel:d,oFormat:h,rFormat:g,showGrid:y,title:f,legend:p,foregroundGraphics:m,annotations:v,svgAnnotationRules:b,annotationFrame:x,xAccessor:w,yAccessor:k,annotationData:A,children:S}=n,E="radial"===(null==l?void 0:l.projection),O="horizontal"===(null==l?void 0:l.projection),L=t(()=>c&&l&&!E?l.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2,label:h?h(e):e}}):[],[c,l,h,E]),j=t(()=>c&&l&&!E?l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(g||rt)(e)})):[],[c,l,g,E]),P=t(()=>{if(!v||0===v.length)return null;const e=Te(),t={scales:l?{x:l.r,y:l.r,time:l.r,value:l.r}:null,timeAxis:"x",xAccessor:w,yAccessor:k,width:o,height:r,data:A,frameType:"ordinal"};return v.map((n,o)=>{if(b){const r=b(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[v,b,o,r,x,w,k,A]);return c||f||p||m||P&&P.length>0||y||S?e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&l&&!E&&e.createElement("g",{className:"ordinal-grid"},j.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:O?t.pixel:0,y1:O?0:t.pixel,x2:O?t.pixel:o,y2:O?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),c&&l&&!E&&e.createElement("g",{className:"ordinal-axes"},O?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),L.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:15-s.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-s.left}, ${r/2})`,style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),j.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},d)):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),L.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),j.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:15-s.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-s.left}, ${r/2})`,style:{userSelect:"none"}},d))),P,m,S),f&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof f?f:null),p&&e.createElement("g",{transform:`translate(${i-s.right+10}, ${s.top})`},function(t){return"object"==typeof t&&null!==t&&!e.isValidElement(t)&&"legendGroups"in t}(p)?e.createElement(Ae,{legendGroups:p.legendGroups,title:"",width:100}):p)):null}const at=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath(),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),null!=t.style.fillOpacity&&(e.globalAlpha=t.style.fillOpacity),e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1},st=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},lt=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},ct=e=>[lt,...e],ut={bar:ct([He]),clusterbar:ct([He]),point:ct([$e]),swarm:ct([$e]),pie:[at],donut:[at],boxplot:ct([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},$e]),violin:ct([st]),histogram:ct([He]),ridgeline:ct([st]),timeline:ct([He])},dt={top:50,right:40,bottom:60,left:70},ht={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function gt({hover:t}){var n,o,r,i;const a=t.data||{},s=t.stats,l=t.category;if(Array.isArray(a)){const t=l||(null===(n=a[0])||void 0===n?void 0:n.category)||"";if(s)return e.createElement("div",{className:"semiotic-tooltip",style:ht},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",s.n),e.createElement("div",null,"Min: ",s.min.toLocaleString()),e.createElement("div",null,"Q1: ",s.q1.toLocaleString()),e.createElement("div",null,"Median: ",s.median.toLocaleString()),e.createElement("div",null,"Q3: ",s.q3.toLocaleString()),e.createElement("div",null,"Max: ",s.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=a.length;return e.createElement("div",{className:"semiotic-tooltip",style:ht},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=a.bin&&null!=a.count){const t=a.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:ht},a.category&&e.createElement("div",{style:{fontWeight:"bold"}},a.category+""),e.createElement("div",null,"Count: ",a.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const c=a.category||a.name||a.group||a.__rName||"",u=null!==(i=null!==(r=null!==(o=a.value)&&void 0!==o?o:a.__rValue)&&void 0!==r?r:a.pct)&&void 0!==i?i:"";if(!c&&""===u){const t=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:ht},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:ht},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),""!==u&&e.createElement("div",null,"number"==typeof u?u.toLocaleString():u+""))}const yt=n(function(n,l){var c;const{chartType:u,runtimeMode:d,data:h,oAccessor:g="category",rAccessor:y="value",colorAccessor:f,stackBy:p,groupBy:m,multiAxis:v,timeAccessor:b,valueAccessor:x,categoryAccessor:w,projection:k="vertical",size:A=[600,400],margin:S,barPadding:E,innerRadius:O,normalize:L,startAngle:j,dynamicColumnWidth:P,bins:M,showOutliers:N,showIQR:D,amplitude:T,connectorAccessor:B,connectorStyle:C,rExtent:z,oExtent:W,extentPadding:_=.05,oSort:$,windowMode:H="sliding",windowSize:I=200,pieceStyle:R,summaryStyle:F,colorScheme:Y,barColors:X,showAxes:G=!0,oLabel:q,rLabel:V,oFormat:U,rFormat:Z,enableHover:Q=!0,hoverAnnotation:J,tooltipContent:K,customHoverBehavior:ee,annotations:te,svgAnnotationRules:oe,showGrid:re=!1,legend:ie,backgroundGraphics:ae,foregroundGraphics:se,title:le,className:ce,background:ue,centerContent:de,decay:he,pulse:ge,transition:ye,staleness:fe}=n,pe=t(()=>Object.assign(Object.assign({},dt),S),[S]),me=A[0]-pe.left-pe.right,ve=A[1]-pe.top-pe.bottom,be=o(null),xe=o(!0),we=o(0),ke=o(null),Ae=o(()=>{}),[Se,Ee]=r(null),[Oe,Le]=r(null),[je,Pe]=r(0),[Me,Ne]=r(!1),De=Q||J,Te="streaming"===d,Be=t(()=>({chartType:u,runtimeMode:Te?"streaming":"bounded",windowSize:I,windowMode:H,extentPadding:_,projection:k,oAccessor:Te?void 0:g,rAccessor:Te?void 0:y,colorAccessor:f,stackBy:p,groupBy:m,multiAxis:v,timeAccessor:Te?b:void 0,valueAccessor:Te?x||("string"==typeof y||"function"==typeof y?y:void 0):void 0,categoryAccessor:Te?w||g:void 0,rExtent:z,oExtent:W,barPadding:E,innerRadius:O,normalize:L,startAngle:j,dynamicColumnWidth:P,bins:M,showOutliers:N,showIQR:D,amplitude:T,connectorAccessor:B,connectorStyle:C,oSort:$,pieceStyle:R,summaryStyle:F,colorScheme:Y,barColors:X,decay:he,pulse:ge,transition:ye,staleness:fe}),[u,I,H,_,k,g,y,f,p,m,v,b,x,w,z,W,E,O,L,j,P,M,N,D,T,B,C,$,R,F,Y,X,he,ge,ye,fe,Te]),Ce=o(null);Ce.current||(Ce.current=new Je(Be));const ze=i(()=>{we.current||(we.current=requestAnimationFrame(()=>Ae.current()))},[]);a(()=>{var e;null===(e=Ce.current)||void 0===e||e.updateConfig(Be),xe.current=!0,ze()},[Be,ze]);const We=o(null);We.current||(We.current=new ne(e=>{const t=Ce.current;t&&t.ingest(e)&&(xe.current=!0,ze())}));const _e=i(e=>{var t;null===(t=We.current)||void 0===t||t.push(e)},[]),$e=i(e=>{var t;null===(t=We.current)||void 0===t||t.pushMany(e)},[]),He=i(()=>{var e,t;null===(e=We.current)||void 0===e||e.clear(),null===(t=Ce.current)||void 0===t||t.clear(),xe.current=!0,ze()},[ze]);s(l,()=>({push:_e,pushMany:$e,clear:He,getData:()=>{var e,t;return null!==(t=null===(e=Ce.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Ce.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[_e,$e,He]),a(()=>{var e;h&&(null===(e=We.current)||void 0===e||e.setBoundedData(h))},[h]);const Ie=o(()=>{}),Re=o(()=>{});Ie.current=e=>{if(!De)return;const t=be.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pe.left,r=e.clientY-n.top-pe.top;if(0>o||o>me||0>r||r>ve)return void(ke.current&&(ke.current=null,Ee(null),ee&&ee(null),ze()));const i=Ce.current;if(!i||0===i.scene.length)return;const a="radial"===k,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=Ke(i,t,n);break;case"point":e=et(i,t,n);break;case"wedge":e=tt(i,t,n);break;case"boxplot":e=nt(i,t,n);break;case"violin":e=ot(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-me/2:o,a?r-ve/2:r);if(!s)return void(ke.current&&(ke.current=null,Ee(null),ee&&ee(null),ze()));const l=Object.assign(Object.assign({data:s.datum,time:s.x,value:s.y,x:s.x,y:s.y},s.stats&&{stats:s.stats}),s.category&&{category:s.category});ke.current=l,Ee(l),ee&&ee(l),ze()},Re.current=()=>{ke.current&&(ke.current=null,Ee(null),ee&&ee(null),ze())};const Fe=i(e=>Ie.current(e),[]),Ye=i(()=>Re.current(),[]);Ae.current=()=>{var e,t;we.current=0;const n=be.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Ce.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=xe.current;s&&!a&&(r.computeScene({width:me,height:ve}),xe.current=!1);const l="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=A[0]*l,n.height=A[1]*l,n.style.width=A[0]+"px",n.style.height=A[1]+"px",o.scale(l,l),o.clearRect(0,0,A[0],A[1]);const c=null!==(e=null==fe?void 0:fe.threshold)&&void 0!==e?e:5e3,d=fe&&r.lastIngestTime>0&&i-r.lastIngestTime>c;d&&(o.globalAlpha=null!==(t=null==fe?void 0:fe.dimOpacity)&&void 0!==t?t:.5);const h=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=ue||(h&&"transparent"!==h?h:null);g&&(o.fillStyle=g,o.fillRect(0,0,A[0],A[1]));const y="radial"===k;y?(o.save(),o.translate(pe.left+me/2,pe.top+ve/2)):o.translate(pe.left,pe.top);const f=ut[u]||[],p={width:me,height:ve};for(const e of f)e(o,r.scene,r.scales,p);y&&o.restore(),d&&(o.globalAlpha=1),s&&r.scales&&(Le(r.scales),Pe(e=>e+1)),(null==fe?void 0:fe.showBadge)&&Ne(!!d),(a||r.hasActivePulses)&&(we.current=requestAnimationFrame(()=>Ae.current()))},a(()=>(ze(),()=>{we.current&&cancelAnimationFrame(we.current)}),[ze]),a(()=>{xe.current=!0,ze()},[u,me,ve,G,ue,ze]),a(()=>{if(!fe)return;const e=setInterval(()=>{var e;const t=Ce.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=fe.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Me&&(Ne(r),xe.current=!0,ze())},1e3);return()=>clearInterval(e)},[fe,Me,ze]);const Xe=De&&Se?K?K(Se):e.createElement(gt,{hover:Se}):null,Ge="radial"===k,qe=Se?Ge?Se.x+me/2:Se.x:0,Ve=Se?Ge?Se.y+ve/2:Se.y:0,Ue=Xe?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:pe.left+qe,top:pe.top+Ve,transform:`translate(${qe>.7*me?"calc(-100% - 12px)":"12px"}, ${.3*ve>Ve?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},Xe):null;return e.createElement("div",{className:"stream-ordinal-frame"+(ce?" "+ce:""),role:"img","aria-label":"string"==typeof le?le:"Ordinal chart",style:{position:"relative",width:A[0],height:A[1]},onMouseMove:De?Fe:void 0,onMouseLeave:De?Ye:void 0},ae&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:A[0],height:A[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${pe.left},${pe.top})`},ae)),e.createElement("canvas",{ref:be,style:{position:"absolute",top:0,left:0,width:A[0],height:A[1]}}),e.createElement(it,{width:me,height:ve,totalWidth:A[0],totalHeight:A[1],margin:pe,scales:Oe,showAxes:G,oLabel:q,rLabel:V,oFormat:U,rFormat:Z,showGrid:re,title:le,legend:ie,foregroundGraphics:se,annotations:te,svgAnnotationRules:oe,annotationFrame:je,xAccessor:"string"==typeof g?g:void 0,yAccessor:"string"==typeof y?y:void 0,annotationData:null===(c=Ce.current)||void 0===c?void 0:c.getData()}),de&&"radial"===k&&e.createElement("div",{style:{position:"absolute",left:pe.left+me/2,top:pe.top+ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},de),(null==fe?void 0:fe.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===fe.badgePosition?{top:4,left:4}:"bottom-left"===fe.badgePosition?{bottom:4,left:4}:"bottom-right"===fe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Me?"#dc3545":"#28a745",color:"white"})},Me?"STALE":"LIVE"),Ue)});yt.displayName="StreamOrdinalFrame";const ft={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},pt={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class mt{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){var r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;if(a.t+=e*t*l*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const c=vt(s.bezier,a.t,a.offset);a.x=c.x,a.y=c.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function vt(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),s=i-a,[l,c,u,d]=e[a],h=bt(l,c,u,d,s),g=d.x-l.x,y=d.y-l.y,f=Math.sqrt(g*g+y*y);if(f>.001){const e=g/f;h.x+=-y/f*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,a]=e.points,s=bt(o,r,i,a,t),l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;s.x+=-c/u*n*e.halfWidth*2,s.y+=t*n*e.halfWidth*2}return s}function bt(e,t,n,o,r){const i=1-r,a=i*i,s=a*i,l=r*r,c=l*r;return{x:s*e.x+3*a*r*t.x+3*i*l*n.x+c*o.x,y:s*e.y+3*a*r*t.y+3*i*l*n.y+c*o.y}}function xt(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function wt(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,r),d=!0):i[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,r[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>i[t]){for(var y=i[t];g.length>y;++y){var f=g[y];if(0>n[f]){n[f]=o[f]=u,r[f]=!0,u+=1,l.push(f),c.push(f);break}r[f]&&(o[t]=0|Math.min(o[t],o[f])),0>a[f]||s[t].push(a[f])}i[t]=y}else{if(o[t]===n[t]){var p=[],m=[],v=0;for(y=l.length-1;y>=0;--y){var b=l[y];if(r[b]=!1,p.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=y;break}}d.push(p);var x=Array(v);for(y=0;m.length>y;y++)for(var w=0;m[y].length>w;w++)x[--v]=m[y][w];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var y=h[l];if(0!==y.length){y.sort(function(e,t){return e-t}),c=[y[0]];for(var f=1;y.length>f;f++)y[f]!==y[f-1]&&c.push(y[f]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:i,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var y=0;s.length>y;y++)for(var f=0;s[y].length>f;f++){var p=s[y][f];i[+p]=!1,a[p]={}}c(n),n+=1}else n=h}return o}function kt(e){return e.y0-e.y1>0?"up":"down"}function At(e,t){return t(e.source)==t(e.target)}function St(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function Et(e){return e.target.x0-e.source.x1}function Ot(e,t){var n=jt(e),o=Et(t)/Math.tan(n);return"up"==kt(e)?e.y1-o:e.y1+o}function Lt(e,t){var n=jt(e),o=Et(t)/Math.tan(n);return"up"==kt(e)?e.y1+o:e.y1-o}function jt(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Pt(e,t){return t(e)}function Mt(e){return Dt(e.source)}function Nt(e){return Dt(e.target)}function Dt(e){return(e.y0+e.y1)/2}function Tt(e){return e.virtual?0:e.value}function Bt(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!At(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!At(e,t)?o+1:o}),n+o}function Ct(e){return e.target.depth}function zt(e,t){return e.sourceLinks.length?e.depth:t-1}function Wt(e,t){return e.y0-t.y0}function _t(e,t){return t.y0-e.y0}function $t(e,t){return e.y1-t.y1}function Ht(e,t){return t.y1-e.y1}function It(e,t){return Ft(e.source,t.source)||e.index-t.index}function Rt(e,t){return Ft(e.target,t.target)||e.index-t.index}function Ft(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Yt(e,t){return Xt(e)==Xt(t)?"bottom"==e.circularLinkType?_t(e,t):Wt(e,t):Xt(t)-Xt(e)}function Xt(e){return e.target.column-e.source.column}function Gt(e,t){return qt(e)==qt(t)}function qt(e){return e.y0-e.y1>0?"up":"down"}function Vt(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=k(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Ut(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Ut(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,At(e,t)&&St(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?_t:Wt);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Ht:$t),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function Ut(e,t,n){e.sort(Yt);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(At(e,t)&&St(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Zt(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Zt(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Qt(e){return function(){return e}}function Jt(e){return e.index}function Kt(e){return e.nodes}function en(e){return e.links}function tn(e,t,n){var o=A(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(r){var i=r.length;r.sort(t||function(e,t){return e.circularLinkType==t.circularLinkType?Bt(t,n)-Bt(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0}),r.forEach(function(t,r){t.depth==o.length-1&&1==i||0==t.depth&&1==i?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Bt(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/i*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-i/2+r,t.y1=t.y0+t.value*e.ky)})})}function nn(e,t,n,o,r,i){var a=A(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&Bt(r,n)>0){var l=O(r.sourceLinks,Nt),c=O(r.targetLinks,Mt),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Dt(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=O(r.sourceLinks,Nt),g=O(r.targetLinks,Mt),y=((h&&g?(h+g)/2:h||g)-Dt(r))*t;r.y0+=y,r.y1+=y}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||Ft),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function on(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Rt),e.targetLinks.sort(It)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function rn(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=Jt,l=zt,c=void 0,u=32,d=2,h=Kt,g=en;function y(){var y={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return L(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,r=e.target;"object"!=typeof o&&(o=e.source=xt(n,o)),"object"!=typeof r&&(r=e.target=xt(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=wt(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){Pt(e,t)!=Pt(r.source,t)&&Pt(e,t)!=Pt(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),At(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(E(e.sourceLinks,Tt),E(e.targetLinks,Tt)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var g=i;if(null!==a){var y=A(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),f=S(y,function(e){return e.length});f>1&&(g=Math.max(1,(o-t)*a/(f-1)))}(function(e,t,n){var o=A(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=k(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/E(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=S(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,r),tn(h,c,s),nn(h,c,s,g,g,u),on(h),Vt(h,s,d,10,8),tn(h,c,s),nn(h,c,s,g,g,u),on(h),Vt(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return Pt(n.source,t)==Pt(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Gt(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Ot(t,e);return e.y1-n}if(t.target.column>e.target.column)return Ot(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return Pt(n.target,t)==Pt(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Gt(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Lt(t,e);return e.y0-n}if(t.source.column>e.source.column)return Lt(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=k(t,function(e){return e.y0}),a=S(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),Vt(h,s,d,10,8)}(y),y}return y.update=function(e){return on(e),Vt(e,s,d,10,8),e},y.nodeWidth=function(e){return arguments.length?(r=+e,y):r},y.nodePadding=function(e){return arguments.length?(i=+e,y):i},y.nodePaddingRatio=function(e){return arguments.length?(a=+e,y):a},y.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Qt(e),y):h},y.links=function(e){return arguments.length?(g="function"==typeof e?e:Qt(e),y):g},y.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Qt(e),y):s},y.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Qt(e),y):l},y.nodeSort=function(e){return arguments.length?(c=e,y):c},y.iterations=function(e){return arguments.length?(u=+e,y):u},y.circularLinkGap=function(e){return arguments.length?(d=+e,y):d},y.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],y):[[e,t],[n,o]]},y.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],y):[n-e,o-t]},y}const an=e=>{let t,n,o,r,i,a,s,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.y1,a=e.target.y0,s=z(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,s=z(t,n),o=s(.5),r=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${a} ${n},${a}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function sn(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,u=r.leftFullExtent,d=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u},${l+h*n}L${u},${d-h*o}L${c},${d-h*o}L${c},${a+h*n}L${i},${a+h*n}Z`}const ln={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Ct))-1:0},justify:zt},cn={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(r=n.nodeWidth)&&void 0!==r?r:15,y=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,f=null!==(a=n.iterations)&&void 0!==a?a:100,p=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=rn().extent(v).links(m).nodes(p).nodeAlign(ln[h]||zt).nodeId(e=>e.id).nodeWidth(g).iterations(f);b.nodePaddingRatio&&b.nodePaddingRatio(y),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of p)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,u=o[0],d=o[1];if(i>0&&a>0&&(0>e||0>n||t>u||r>d)){const t=Math.min(u/i,d/a),o=-e*t+(u-i*t)/2,r=-n*t+(d-a*t)/2;for(const e of p)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of m)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of p){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const w=new Map;for(const e of t)w.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=e.source,n=e.target,o="object"==typeof t&&null!==t?t.id:t+"",r="object"==typeof n&&null!==n?n.id:n+"",i=w.get(`${o}\0${r}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(o),n=x.get(r);t&&(i.source=t),n&&(i.target=n)}}},buildScene(e,t,n,o){var r,i,a,s;const l="vertical"===n.orientation?"down":"right",c=n.nodeStyle,u=n.edgeStyle,d=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,h=n.edgeColorBy||"source",g=Array.isArray(n.colorScheme)?n.colorScheme:W,y=new Map;e.forEach((e,t)=>{y.set(e.id,g[t%g.length])});const f=[],p=[],m=[];for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=c?c(t):{},r={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};f.push({type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const v=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of v){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o="#999";u?o=u(e).fill||o:"target"===h&&n?o=y.get(n.id)||o:t&&(o=y.get(t.id)||o);const r=u?u(e):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),l=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=r.fill||o;p.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+s},${t.sourceY-n}L${t.sourceX+s},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:null!==(i=r.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),p.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-l},${t.targetY-n}L${t.targetX-l},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:null!==(a=r.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-l,x1:t.targetX}});continue}let l;if(l=e.circular&&e.circularPathData?sn(e):an(e),!l)continue;const c={fill:r.fill||o,fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:d,stroke:r.stroke||"none",strokeWidth:r.strokeWidth,opacity:r.opacity};p.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(b=n.nodeLabel)?"function"==typeof b?b:e=>e[b]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,c;"down"===l?(a=n.x0+e/2,s=n.y1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),s=n.y0+r/2),m.push({x:a,y:s,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var b;return{sceneNodes:f,sceneEdges:p,labels:m}}},un={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),s=null!==(i=n.forceStrength)&&void 0!==i?i:.1,l=o[0]/2,c=o[1]/2;for(let t=0;e.length>t;t++){const n=e[t];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(t+.5),o=2.399963229728653*t;n.x=l+e*Math.cos(o),n.y=c+e*Math.sin(o)}}const u=dn(n.nodeSize,n.nodeSizeRange,e),d=q().strength(e=>Math.min(2.5,e.weight?e.weight*s:s)).id(e=>e.id),h=o[1]/o[0],g=V().force("charge",U().strength(e=>-25*(e=>u(e))(e))).force("x",Z(o[0]/2).strength(.1*h)).force("y",Q(o[1]/2).strength(.1));if(g.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));g.force("link",d),g.force("link").links(e)}.1>g.alpha()&&g.alpha(1),g.stop();for(let e=0;a>e;++e)g.tick();const y=new Map;for(const t of e)y.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=y.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=y.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var r,i,a;const s=n.nodeStyle,l=n.edgeStyle,c=dn(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:W,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],y=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(t),n=s?s(t):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:f.get(e.source),n="object"==typeof e.target?e.target:f.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=l?l(e):{},r={stroke:o.stroke||"#999",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(p=n.nodeLabel)?"function"==typeof p?p:e=>e[p]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(n);y.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var p;return{sceneNodes:h,sceneEdges:g,labels:y}}};function dn(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(o=k(a))&&void 0!==o?o:0,l=null!==(r=S(a))&&void 0!==r?r:1;if(s===l)return()=>(i[0]+i[1])/2;const c=p().domain([s,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const hn=W,gn={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const y=e.length,f=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);f[n][o]=r}const p=K().padAngle(r);a&&p.sortGroups(a);const m=p(f),v=m.groups,b=ee().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const w=new Map;for(const e of t)w.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,r=w.get(`${n}\0${o}`)||w.get(`${o}\0${n}`);r&&(r.chordData=t)}},buildScene(e,t,n,o){var r,i;const{groupWidth:a=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-a,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,y=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:hn,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const m=J().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(n).fill||p.get(n.id)||f[t%f.length]:p.get(n.id)||f[t%f.length];const a=h?h(n):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m(t);if(!n)continue;const o=yn(n,u,d);let r="#999";if(g)r=g(e).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?r=p.get(n.id)||r:t&&(r=p.get(t.id)||r)}const a=g?g(e):{},l={fill:r,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(w=n.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*o,y:d+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:b,labels:x}}};function yn(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const fn={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=(l=n.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=P(i,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=C();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=B();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=D().size([n,o]).tile(T).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;N().size([n,o]).padding(i)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var r;M().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const y=new Map;for(let t=0;g.length>t;t++){const o=g[t],i={id:xn(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?pn(i,o,n):"treemap"===a||"partition"===a?mn(i,o):"circlepack"===a&&vn(i,o),i.__hierarchyNode=o,e.push(i),y.set(o,i)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=y.get(e.parent),o=y.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,u;const d=[],h=[],g=[],y=n.treeOrientation||"vertical",f="radial"===y,p=o[0]/2,m=o[1]/2,v="number"==typeof(x=n.nodeSize)?x:5,b=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];var x;for(const t of e){let e=t.x,o=t.y;f&&(e+=p,o+=m);const i=r(t);let s=i.fill||"#4d430c";n.colorByDepth&&void 0!==t.depth&&(s=b[t.depth%b.length]);const l={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const w=null!==(s=n.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,a=n.x,s=n.y;f&&(o+=p,r+=m,a+=p,s+=m);const u=bn(o,r,a,s,y),d=i(e),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:w};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=wn(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(f&&(a+=p,s+=m),f){const e=a-p,t=s-m,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===y?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=a-v-6,i="end"):(o=a+v+6,i="start"),r=s):(o=a,r=s+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const a=[],s=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const s=o(n);let c=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const u={fill:c,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};a.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=wn(t.nodeLabel);for(const o of e){const e=o.x1-o.x0,r=o.y1-o.y0;if(0>=e||0>=r)continue;if((null===(i=o.data)||void 0===i?void 0:i.children)&&o.data.children.length>0&&"partition"!==t.chartType)continue;const a=n?n(o):o.id;a&&(30>e||16>r||s.push({x:o.x0+e/2,y:o.y0+r/2,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,r)/6))}))}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l;const c=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(n);let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=d[n.depth%d.length]);const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=wn(t.nodeLabel);for(const t of e){const e=null!==(s=t.__radius)&&void 0!==s?s:5,o=n?n(t):t.id;if(!o)continue;if(15>e)continue;const r=!((null===(l=t.data)||void 0===l?void 0:l.children)&&t.data.children.length>0);u.push({x:t.x,y:r?t.y:t.y-e+14,text:o+"",anchor:"middle",baseline:r?"middle":"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:r?void 0:"#000",stroke:r?void 0:"#fff",strokeWidth:r?void 0:3,paintOrder:r?void 0:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function pn(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function mn(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function vn(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function bn(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}function xn(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function wn(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}const kn={sankey:cn,force:un,chord:gn,tree:fn,cluster:fn,treemap:fn,circlepack:fn,partition:fn};function An(e){return kn[e]}class Sn{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.config=e,this.tensionConfig=Object.assign(Object.assign({},ft),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new mt(2e3))}updateConfig(e){this.config=e,this.tensionConfig=Object.assign(Object.assign({},ft),e.tensionConfig),"sankey"===e.chartType&&e.showParticles?this.particlePool||(this.particlePool=new mt(2e3)):this.particlePool=null}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear();for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},En(e)),{data:t}))}for(const e of t){const t=l(e)+"",n=c(e)+"",o=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},En(t)),{data:e})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},En(n)),{data:e})),this.edges.set(`${t}\0${n}`,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:e})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this.nodes.has(t)||(this.nodes.set(t,En(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,En(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||this.tension>=this.tensionConfig.threshold}runLayout(e){const t=An(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());if(0===n.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.computeLayout(n,o,this.config,e),t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear();for(const e of n)this.nodes.set(e.id,e);for(const e of o)this.edges.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e)}this.finalizeLayout(),this.saveTargetPositions(),n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const r=new Set(this.nodes.keys()),i=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of r)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)r.has(e)||this.removedNodes.add(e);for(const e of i)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)i.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=r,this.previousEdgeKeys=i,this.layoutVersion++}buildScene(e){const t=An(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a}advanceTransition(e){if(!this.transition)return!1;const t=Math.min((e-this.transition.startTime)/this.transition.duration,1),n=1-Math.pow(1-t,3);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0+(e._targetX0-e._prevX0)*n,e.x1=e._prevX1+(e._targetX1-e._prevX1)*n,e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n);for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n,e.sankeyWidth=e._prevSankeyWidth+(e._targetSankeyWidth-e._prevSankeyWidth)*n);return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.y1,i=n.y0,a=z(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=z(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t,n,o,r;const i=this.config.decay;if(!i)return;const a=null!==(e=i.minOpacity)&&void 0!==e?e:.1,s=this.nodeTimestamps.size;if(1>=s)return;const l=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]),c=new Map;for(let e=0;l.length>e;e++)c.set(l[e][0],e);for(const e of this.sceneNodes){const l=e.id;if(!l)continue;const u=c.get(l);if(void 0===u)continue;const d=s-1-u;let h;switch(i.type){case"linear":h=a+(1-d/(s-1))*(1-a);break;case"exponential":{const e=null!==(t=i.halfLife)&&void 0!==t?t:s/2;h=a+Math.pow(.5,d/e)*(1-a);break}case"step":h=(null!==(n=i.stepThreshold)&&void 0!==n?n:.5*s)>d?1:a;break;default:h=1}const g=null!==(r=null===(o=e.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;e.style=Object.assign(Object.assign({},e.style),{opacity:g*h})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}clear(){this.nodes.clear(),this.edges.clear(),this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.lastIngestTime=0,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function En(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function On(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=Ln(t,n,o);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(i=e,s=n)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=jn(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function Ln(e,t,n){switch(e.type){case"circle":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,n);case"rect":return function(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{type:"node",datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;let a=Math.atan2(r,o);0>a&&(a+=2*Math.PI);let s,l=e.startAngle,c=e.endAngle;if(0>l&&(l+=2*Math.PI),0>c&&(c+=2*Math.PI),s=l>c?a>=l||c>=a:a>=l&&c>=a,s){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}function jn(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=document.createElement("canvas").getContext("2d");if(!a)return null;if(a.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,a="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=document.createElement("canvas").getContext("2d");if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0}}catch(e){}return null}(e,t,n);default:return null}}function Pn(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,labels:s,title:l,legend:c,foregroundGraphics:u,annotations:d,svgAnnotationRules:h}=t;return e.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,n)=>e.createElement("text",{key:"label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),d&&h&&d.map((t,r)=>{const i=h(t,r,{width:n,height:o});return i?e.createElement(e.Fragment,{key:"annotation-"+r},i):null}),u),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:a.top},l):null,c&&"object"==typeof c&&"legendGroups"in c?e.createElement("g",{transform:`translate(${r-a.right+10},${a.top})`},c.legendGroups.map((t,n)=>{var o;return e.createElement("g",{key:"legend-group-"+n},null===(o=t.items)||void 0===o?void 0:o.map((t,n)=>e.createElement("g",{key:"legend-item-"+n,transform:`translate(0,${20*n})`},e.createElement("rect",{x:0,y:0,width:12,height:12,fill:t.color,rx:2}),e.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},t.label))))})):c?e.createElement("g",{transform:`translate(${r-a.right+10},${a.top})`},c):null)}function Mn(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s=t.style.fill;r.addColorStop(0,1===a.from?s:"transparent"),r.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Nn(e,t){var n,o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Dn(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),e.restore()}function Tn(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Pn.displayName="NetworkSVGOverlay";const Bn={category10:W,tableau10:G,set3:X,blues:Y,reds:F,greens:R,oranges:I,purples:H,viridis:$,plasma:_},Cn=W,zn=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];function Wn(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):Cn[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+""))%Cn.length]}function _n(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>e[t]))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return v().domain(o).range(n).unknown("#999");const i=Bn[n]||Bn.category10;if(r&&"function"==typeof i)return e=>i(Number(e)/Math.max(...o.map(Number)));{const e=Array.isArray(i)?i:Cn;return v().domain(o).range(e).unknown("#999")}}function $n(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}const Hn={top:20,right:80,bottom:20,left:80},In={top:40,right:40,bottom:40,left:40},Rn=new Set(["chord","force","circlepack"]),Fn=[800,600],Yn={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 Xn({data:t}){var n,o,r,i,a,s;if("edge"===t.type){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:Yn},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let a=c;for(;a;){const e=null!==(i=null!==(o=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:Yn},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(a=l.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:Yn},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const Gn=n(function(n,l){const{chartType:c,nodes:u,edges:d,data:h,initialEdges:g,nodeIDAccessor:y="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:m="value",childrenAccessor:v,hierarchySum:b,orientation:x="horizontal",nodeAlign:w="justify",nodePaddingRatio:k=.05,nodeWidth:A=15,iterations:S=300,forceStrength:E=.1,padAngle:O=.01,groupWidth:L=20,sortGroups:j,edgeSort:P,treeOrientation:M="vertical",edgeType:N="curve",padding:D,paddingTop:T,tensionConfig:B,showParticles:C=!1,particleStyle:z,nodeStyle:W,edgeStyle:_,colorBy:$,colorScheme:H="category10",edgeColorBy:I="source",edgeOpacity:R=.5,colorByDepth:F=!1,nodeSize:Y=8,nodeSizeRange:X=[5,20],nodeLabel:G,showLabels:q=!0,size:V=Fn,margin:U,className:Z,background:Q,enableHover:J=!0,tooltipContent:K,customHoverBehavior:ee,customClickBehavior:te,onObservation:ne,chartId:oe,onTopologyChange:re,annotations:ie,svgAnnotationRules:ae,legend:se,title:le,foregroundGraphics:ce,backgroundGraphics:ue,decay:de,pulse:he,staleness:ge,thresholds:ye}=n,fe=Rn.has(c)?In:Hn,pe=Object.assign(Object.assign({},fe),U),me=V[0]-pe.left-pe.right,ve=V[1]-pe.top-pe.bottom,be=t(()=>Object.assign(Object.assign({},ft),B),[B]),xe=t(()=>Object.assign(Object.assign({},pt),z),[z]),we=t(()=>({chartType:c,nodeIDAccessor:y,sourceAccessor:f,targetAccessor:p,valueAccessor:m,childrenAccessor:v,hierarchySum:b,orientation:x,nodeAlign:w,nodePaddingRatio:k,nodeWidth:A,iterations:S,forceStrength:E,padAngle:O,groupWidth:L,sortGroups:j,edgeSort:P,treeOrientation:M,edgeType:N,padding:D,paddingTop:T,tensionConfig:be,showParticles:C,particleStyle:xe,nodeStyle:W,edgeStyle:_,nodeLabel:G,showLabels:q,colorBy:$,colorScheme:H,edgeColorBy:I,edgeOpacity:R,colorByDepth:F,nodeSize:Y,nodeSizeRange:X,decay:de,pulse:he,staleness:ge,thresholds:ye}),[c,y,f,p,m,v,b,x,w,k,A,S,E,O,L,j,P,M,N,D,T,be,C,xe,W,_,G,q,$,H,I,R,F,Y,X,de,he,ge,ye]),ke=o(null),Ae=o(0),Se=o(0),Ee=o(!0),Oe=o(()=>{}),Le=o(null);Le.current||(Le.current=new Sn(we));const[je,Pe]=r(null),[Me,Ne]=r(0),[De,Te]=r(0),[Be,Ce]=r(!1),ze=o(null),We=o(new Map),_e=o(0),$e=i(e=>{if("function"==typeof $)return $(e);if("string"==typeof $&&e.data){const t=e.data[$];if(void 0!==t){if(!We.current.has(t+"")){const e=Array.isArray(H)?H:Cn;We.current.set(t+"",e[_e.current++%e.length])}return We.current.get(t+"")}}if(!We.current.has(e.id)){const t=Array.isArray(H)?H:Cn;We.current.set(e.id,t[_e.current++%t.length])}return We.current.get(e.id)},[$,H]),He=i(e=>{if("function"==typeof I)return I(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===I&&n?$e(n):t?$e(t):"#999"},[I,$e]),Ie=i(e=>{if(!(null==z?void 0:z.colorBy))return He(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===xe.colorBy&&n?$e(n):t?$e(t):"#999"},[null==z?void 0:z.colorBy,xe.colorBy,$e,He]),Re="sankey"===c&&C||!!he,Fe=i(()=>{Ae.current&&!Re||Ae.current||(Ae.current=requestAnimationFrame(()=>Oe.current()))},[Re]);a(()=>{var e;null===(e=Le.current)||void 0===e||e.updateConfig(we),Ee.current=!0,Fe()},[we,Fe]);const Ye=i(()=>{const e=Le.current;if(!e)return;e.runLayout([me,ve]),e.buildScene([me,ve]),Ee.current=!0;const t=Array.isArray(H)?H:Cn,n=Array.from(e.nodes.values());for(let e=0;n.length>e;e++){const o=n[e];We.current.has(o.id)||We.current.set(o.id,t[e%t.length])}if(_e.current=n.length,Ne(e.layoutVersion),re){const{nodes:t,edges:n}=e.getLayoutData();re(t,n)}},[me,ve,re,H]),Xe=i(e=>{const t=Le.current;t&&(t.ingestEdge(e)&&Ye(),Fe())},[Ye,Fe]),Ge=i(e=>{const t=Le.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Ye(),Fe()},[Ye,Fe]),qe=i(()=>{var e;null===(e=Le.current)||void 0===e||e.clear(),We.current.clear(),_e.current=0,Ne(0),Pe(null),ze.current=null,Ee.current=!0,Fe()},[Fe]),Ve=i(()=>{const e=Le.current;e&&(e.tension+=999,Ye(),Fe())},[Ye,Fe]);s(l,()=>({push:Xe,pushMany:Ge,clear:qe,getTopology:()=>{var e,t;return null!==(t=null===(e=Le.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Le.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Ve,getTension:()=>{var e,t;return null!==(t=null===(e=Le.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Xe,Ge,qe,Ve]);const Ue=["tree","cluster","treemap","circlepack","partition"].includes(c),Ze=Ue?h||(Array.isArray(d)?void 0:d):void 0;a(()=>{const e=Le.current;if(e)if(Ue&&Ze)e.ingestHierarchy(Ze,[me,ve]),e.buildScene([me,ve]),Ee.current=!0,Fe();else{const t=u||[],n=Array.isArray(d)?d:[];if(0===t.length&&0===n.length)return;e.ingestBounded(t,n,[me,ve]),e.buildScene([me,ve]);const o=Array.isArray(H)?H:Cn,r=Array.from(e.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];We.current.has(t.id)||We.current.set(t.id,o[e%o.length])}_e.current=r.length,Ee.current=!0,Fe()}},[u,d,h,Ze,Ue,me,ve,we,Fe,H]),a(()=>{g&&g.length>0&&Ge(g)},[]);const Qe=i(e=>{if(ee&&ee(e),ne){const t=Date.now();ne(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:oe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:oe})}},[ee,ne,oe]),Je=i(e=>{if(te&&te(e),ne){const t=Date.now();ne(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:oe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:oe})}},[te,ne,oe]),Ke=o(()=>{}),et=o(()=>{});Ke.current=e=>{if(!J)return;const t=ke.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pe.left,r=e.clientY-n.top-pe.top;if(0>o||o>me||0>r||r>ve)return void(ze.current&&(ze.current=null,Pe(null),Qe&&Qe(null),Fe()));const i=Le.current;if(!i)return;const a=On(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(ze.current&&(ze.current=null,Pe(null),Qe&&Qe(null),Fe()));const s={type:a.type,data:a.datum,x:a.x,y:a.y};ze.current=s,Pe(s),Qe&&Qe(s),Fe()},et.current=()=>{ze.current&&(ze.current=null,Pe(null),Qe&&Qe(null),Fe())};const tt=o(()=>{});tt.current=e=>{if(!te&&!ne)return;const t=ke.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pe.left,r=e.clientY-n.top-pe.top;if(0>o||o>me||0>r||r>ve)return;const i=Le.current;if(!i)return;const a=On(i.sceneNodes,i.sceneEdges,o,r);Je(a?{type:a.type,data:a.datum,x:a.x,y:a.y}:null)};const nt=i(e=>Ke.current(e),[]),ot=i(()=>et.current(),[]),rt=i(e=>tt.current(e),[]);Oe.current=()=>{var e,t,n;Ae.current=0;const o=ke.current;if(!o)return;const r=o.getContext("2d");if(!r)return;const i=Le.current;if(!i)return;const a=performance.now(),s=Se.current?Math.min((a-Se.current)/1e3,.1):.016;Se.current=a;const l=i.advanceTransition(a);(l||Ee.current)&&i.buildScene([me,ve]);const c="undefined"!=typeof window&&window.devicePixelRatio||1;o.width=V[0]*c,o.height=V[1]*c,o.style.width=V[0]+"px",o.style.height=V[1]+"px",r.scale(c,c),r.translate(pe.left,pe.top),r.clearRect(-pe.left,-pe.top,V[0],V[1]),Q&&(r.fillStyle=Q,r.fillRect(0,0,me,ve)),de&&i.applyDecay(),he&&i.applyPulse(a),ye&&i.applyThresholds(a),i.applyTopologyDiff(a);const u=null!==(e=null==ge?void 0:ge.threshold)&&void 0!==e?e:5e3,d=ge&&i.lastIngestTime>0&&a-i.lastIngestTime>u;if(d&&(r.globalAlpha=null!==(t=null==ge?void 0:ge.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Mn(e,n);break;case"line":Nn(e,n);break;case"ribbon":Dn(e,n);break;case"curved":Tn(e,n)}}(r,i.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.restore())}}(r,i.sceneNodes),function(e,t){var n,o,r,i;for(const a of t){if("circle"!==a.type)continue;const t=a;if(t.r>0){if(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=null!==(i=t._pulseGlowRadius)&&void 0!==i?i:4,o=t.r+n*t._pulseIntensity;e.beginPath(),e.arc(t.cx,t.cy,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.6*t._pulseIntensity,e.stroke()}e.restore()}}}(r,i.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(r,i.sceneNodes),C&&i.particlePool&&!d){const e=Array.from(i.edges.values());if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:pt.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:pt.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(i.particlePool,e,s,xe);const t=.5*(null!==(n=xe.speedMultiplier)&&void 0!==n?n:1);let o;if(xe.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}i.particlePool.step(s,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:pt.radius,l=null!==(a=o.opacity)&&void 0!==a?a:pt.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(r,i.particlePool,e,xe,Ie)}}d&&(r.globalAlpha=1);const h=Ee.current;Ee.current=!1,(h||l)&&Te(e=>e+1),(Re||l||i.hasActivePulses||i.hasActiveThresholds||i.hasActiveTopologyDiff)&&(Ae.current=requestAnimationFrame(()=>Oe.current()))},a(()=>(Fe(),()=>{Ae.current&&cancelAnimationFrame(Ae.current)}),[Fe]),a(()=>{Ee.current=!0,Fe()},[c,me,ve,Q,Fe]),a(()=>{if(!ge)return;const e=setInterval(()=>{var e;const t=Le.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=ge.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Be&&(Ce(r),Ee.current=!0,Fe())},1e3);return()=>clearInterval(e)},[ge,Be,Fe]);const it=J&&je?e.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:pe.left+je.x,top:pe.top+je.y,transform:`translate(${je.x>.6*me?"calc(-100% - 12px)":"12px"}, ${.3*ve>je.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},K?K(je):e.createElement(Xn,{data:je})):null,at=Le.current;return e.createElement("div",{className:"stream-network-frame"+(Z?" "+Z:""),role:"img","aria-label":"string"==typeof le?le:"Network chart",style:{position:"relative",width:V[0],height:V[1]},onMouseMove:J?nt:void 0,onMouseLeave:J?ot:void 0,onClick:te||ne?rt:void 0},ue&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:V[0],height:V[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${pe.left},${pe.top})`},ue)),e.createElement("canvas",{ref:ke,style:{position:"absolute",top:0,left:0}}),e.createElement(Pn,{width:me,height:ve,totalWidth:V[0],totalHeight:V[1],margin:pe,labels:(null==at?void 0:at.labels)||[],title:le,legend:se,foregroundGraphics:ce,annotations:ie,svgAnnotationRules:ae,annotationFrame:De}),it,(null==ge?void 0:ge.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ge.badgePosition?{top:4,left:4}:"bottom-left"===ge.badgePosition?{bottom:4,left:4}:"bottom-right"===ge.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Be?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},Be?"STALE":"LIVE"))});Gn.displayName="StreamNetworkFrame";const qn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Vn(e,t){return"function"==typeof t?t(e):e[t]}function Un(e,t){return t?t(e):null==e?"":"number"==typeof e?e.toLocaleString():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 Zn(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=Vn(t,o);s=Un(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Vn(t,o);l.push({label:n,value:Un(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=Un(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=Un(t[e[0]],r))}}const c=Object.assign(Object.assign({},qn),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function Qn(t={}){const{fields:n=[],title:o,format:r,style:i={},className:a="",showLabels:s=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=Vn(t,o);c.push({value:Un(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Un(Vn(t,o),i);c.push({label:s?n:void 0,value:a})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:s?e:void 0,value:Un(t[e],r)})});const u=Object.assign(Object.assign({},qn),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function Jn(e){return!0===e||("function"==typeof e?e:!1!==e&&void 0!==e&&("object"!=typeof e||null===e||!("fields"in e)&&!("title"in e)||Zn(e)))}function Kn(e){return"string"==typeof e?e:"value"}function eo(e){return null==e?"–":"number"==typeof e?e.toLocaleString():e instanceof Date?e.toLocaleDateString():e+""}function to(e,t){return"function"==typeof t?t(e):e[t]}function no(t){return n=>{const o=n.data;return o?e.createElement("div",{className:"semiotic-tooltip",style:qn},t.map((t,n)=>{const r=eo(to(o,t.accessor));return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.8}},t.label,": "),e.createElement("span",{style:{fontWeight:"color"===t.role||"group"===t.role?"bold":"normal"}},r))})):null}}function oo({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return a=>{var s;const l=i?(null===(s=a.data)||void 0===s?void 0:s[0])||a.data||a:a.data||a,c=to(l,t),u=to(l,n),d=o?to(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:qn},e.createElement("div",{style:{fontWeight:"bold"}},eo(c)),e.createElement("div",{style:{marginTop:4}},eo(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||Kn(o),": ",eo(d)))}}function ro(e){return e?"string"==typeof e?{name:e}:e:null}function io(e,t,n){return t?o=>{var r,i;const a=Object.assign({},e(o));return t.isActive&&(t.predicate(o)?(null==n?void 0:n.selectedStyle)&&Object.assign(a,n.selectedStyle):(a.fillOpacity=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2,a.strokeOpacity=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.2,(null==n?void 0:n.unselectedStyle)&&Object.assign(a,n.unselectedStyle))),a}:e}function ao(n){const o=l(null),i=so(n);return[function({children:r}){const i=t(()=>so(n),[]);return e.createElement(o.Provider,{value:i,children:r})},e=>{var t;const n=null!==(t=c(o))&&void 0!==t?t:i;return function(e,t){const[n,o]=r(t);return u(()=>e(()=>o(t)),[e]),n}(n.subscribe,()=>e(n.getState()))}]}function so(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function lo(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,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function co(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(lo(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function uo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[ho,go]=ao(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=uo(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=uo(o,t);return o.set(t,Object.assign(Object.assign({},r),{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}})}}));function yo(e){const n=d(),o=e.clientId||n,{name:r}=e,a=go(e=>e.selections.get(r)),s=go(e=>e.setClause),l=go(e=>e.clearClause),c=t(()=>!!a&&a.clauses.size>0,[a]);return{predicate:t(()=>a&&0!==a.clauses.size?co(a,o):()=>!0,[a,o]),isActive:c,selectPoints:i(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:i(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:i(()=>{l(r,o)},[l,r,o]),clientId:o}}function fo(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:a,clear:s}=yo({name:t});return{onHover:i(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&&a(t)},[n,a,s]),predicate:o,isActive:r}}function po(e){const{name:n,xField:o,yField:r}=e,{predicate:a,isActive:s,selectInterval:l,clear:c}=yo({name:n}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=i(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:t(()=>({brush:u,during:d,end:d}),[u,d]),predicate:a,isActive:s,clear:c}}function mo(e,n,o){const r=go(e=>e.selections.get(n));return t(()=>{if(!r||0===r.clauses.size)return e;const t=co(r,o);return e.filter(t)},[e,r,o])}const[vo,bo]=ao(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}))}})),xo="#007bff";function wo(e){return"function"==typeof e?e:t=>t[e]}function ko(e,n,o="category10"){return t(()=>{if(n&&"function"!=typeof n)return _n(e,n,o)},[e,n,o])}function Ao(e,n,o){return t(()=>{if(!n)return e;const t=[...e];if("function"==typeof n)return t.sort(n);const r=wo(o);return t.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,n,o])}function So({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:a,chartId:s}){const l=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}:null}(t,n),c=yo({name:(null==e?void 0:e.name)||"__unused__"}),u=fo({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||[]}),d=bo(e=>e.pushObservation);return{activeSelectionHook:e?{isActive:c.isActive,predicate:c.predicate}:null,customHoverBehavior:i(e=>{var n,o;if(t){let t=e&&(e.data||e.datum)||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}if(r||d){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),d&&d(e)}}},[t,u,r,a,s,d]),customClickBehavior:i(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,a,s])}}function Eo({data:e,colorBy:n,colorScale:o,showLegend:r,userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40}}){const s=void 0!==r?r:!!n,l=t(()=>{if(s&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){const a=Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}});return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==r&&(t.stroke=r),void 0!==i&&(t.strokeWidth=i),t},type:"fill",items:a,label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:Wn})},[s,n,e,o]),c=t(()=>{const e=Object.assign(Object.assign({},a),i);return l&&120>e.right&&(e.right=120),e},[a,i,l]);return{legend:l,margin:c}}const Oo={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 Lo(e,t,n){var o,r,i,a,s,l;const c=Oo[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?c.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?c.height:n.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}function jo({componentName:t,message:n,width:o,height:r}){return e.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n)))}function Po(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Mo({data:e,accessors:t,requiredProps:n}){if(n)for(const[e,t]of Object.entries(n))if(null==t)return e+" is required. Provide a field name or function.";if(!e||!Array.isArray(e)||0===e.length)return"No data provided. Pass a non-empty array to the data prop.";if(t)for(const n of Po(e))if(n&&"object"==typeof n)for(const[e,o]of Object.entries(t))if(o&&"string"==typeof o&&!(o in n))return`${e} "${o}" not found in data. Available fields: ${Object.keys(n).join(", ")}.`;return null}function No({data:e,dataLabel:t="data"}){return null==e?`No ${t} provided. Pass a hierarchical data object to the ${t} prop.`:null}function Do({nodes:e,edges:t,nodesRequired:n=!1,edgesRequired:o=!0,accessors:r}){if(o&&(!t||!Array.isArray(t)||0===t.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(n&&(!e||!Array.isArray(e)||0===e.length))return"No nodes provided. Pass a non-empty array to the nodes prop.";if(r&&e&&e.length>0)for(const t of Po(e))if(t&&"object"==typeof t)for(const[e,n]of Object.entries(r))if(n&&"string"==typeof n&&!(n in t))return`${e} "${n}" not found in node data. Available fields: ${Object.keys(t).join(", ")}.`;return null}function To(n){const o=Lo(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:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",colorBy:d,colorScheme:h="category10",sizeBy:g,sizeRange:y=[3,15],pointRadius:f=5,pointOpacity:p=.8,tooltip:m,marginalGraphics:v,pointIdAccessor:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,linkedBrush:S,onObservation:E,chartId:O}=n,L=o.width,j=o.height,P=o.enableHover,M=o.showGrid,N=o.showLegend,D=o.title,T=o.xLabel,B=o.yLabel,C=r||[],{activeSelectionHook:z,customHoverBehavior:W}=So({selection:k,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],onObservation:E,chartType:"Scatterplot",chartId:O}),_=ro(S);po({name:(null==_?void 0:_.name)||"__unused_brush__",xField:(null==_?void 0:_.xField)||("string"==typeof c?c:void 0),yField:(null==_?void 0:_.yField)||("string"==typeof u?u:void 0)});const $=ko(C,d,h),H=t(()=>{if(!g||0===C.length)return;const e=C.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[C,g]),I=t(()=>e=>{const t={fillOpacity:p};return t.fill=d?Wn(e,d,$):xo,t.r=g?$n(e,g,y,H):f,t},[d,$,g,y,H,f,p]),R=t(()=>io(I,z,k),[I,z,k]),{legend:F,margin:Y}=Eo({data:C,colorBy:d,colorScale:$,showLegend:N,userMargin:i,defaults:o.marginDefaults}),X=t(()=>no([{label:T||Kn(c),accessor:c,role:"x"},{label:B||Kn(u),accessor:u,role:"y"},...d?[{label:Kn(d),accessor:d,role:"color"}]:[],...g?[{label:Kn(g),accessor:g,role:"size"}]:[]]),[c,u,T,B,d,g]),G=Mo({componentName:"Scatterplot",data:C,accessors:{xAccessor:c,yAccessor:u}});if(G)return e.createElement(jo,{componentName:"Scatterplot",message:G,width:L,height:j});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter",data:C,xAccessor:c,yAccessor:u,colorAccessor:d||void 0,sizeAccessor:g||void 0,sizeRange:y,pointStyle:R,colorScheme:h,size:[L,j],margin:Y,showAxes:o.showAxes,xLabel:T,yLabel:B,xFormat:s,yFormat:l,enableHover:P,showGrid:M},F&&{legend:F}),D&&{title:D}),a&&{className:a}),{tooltipContent:m?Jn(m):X}),(A||E)&&{customHoverBehavior:W}),v&&{marginalGraphics:v}),b&&{pointIdAccessor:b}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Ve,Object.assign({},q))}function Bo(n){var o,r;const i=Lo(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:a,margin:s,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",lineBy:g,lineDataAccessor:y="coordinates",colorBy:f,colorScheme:p="category10",curve:m="linear",showPoints:v=!1,pointRadius:b=3,fillArea:x=!1,areaOpacity:w=.3,lineWidth:k=2,tooltip:A,pointIdAccessor:S,annotations:E,frameProps:O={},selection:L,linkedHover:j,onObservation:P,chartId:M}=n,N=i.width,D=i.height,T=i.enableHover,B=i.showGrid,C=i.showLegend,z=i.title,W=i.xLabel,_=i.yLabel,$=a||[],{activeSelectionHook:H,customHoverBehavior:I}=So({selection:L,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],onObservation:P,chartType:"LineChart",chartId:M}),R=void 0!==(null===(o=$[0])||void 0===o?void 0:o[y]),F=t(()=>{if(R)return $;if(g){const e=$.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[y]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][y].push(t),e},{});return Object.values(e)}return[{[y]:$}]},[$,g,y,R]),Y=ko($,f,p),X=t(()=>e=>{const t={strokeWidth:k};return t.stroke=f?Wn(e,f,Y):xo,x&&(t.fill=t.stroke,t.fillOpacity=w),t},[f,Y,k,x,w]),G=t(()=>io(X,H,L),[X,H,L]),q=t(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return t.fill=f?Wn(e.parentLine||e,f,Y):xo,t}},[v,b,f,Y]),V=x?"area":"line",{legend:U,margin:Z}=Eo({data:F,colorBy:f,colorScale:Y,showLegend:C,userMargin:s,defaults:i.marginDefaults}),Q=g||f,J=t(()=>no([{label:W||Kn(d),accessor:d,role:"x"},{label:_||Kn(h),accessor:h,role:"y"},...Q?[{label:Kn(Q),accessor:Q,role:"group"}]:[]]),[d,h,W,_,Q]),K=Mo({componentName:"LineChart",data:R?(null===(r=$[0])||void 0===r?void 0:r[y])||[]:$,accessors:{xAccessor:d,yAccessor:h}});if(K)return e.createElement(jo,{componentName:"LineChart",message:K,width:N,height:D});const ee=t(()=>R||g?F.flatMap(e=>{const t=e[y]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):$,[F,y,R,g,$]),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:V,data:ee,xAccessor:d,yAccessor:h,groupAccessor:g||void 0,curve:m,lineStyle:G},v&&{pointStyle:q}),{size:[N,D],margin:Z,showAxes:i.showAxes,xLabel:W,yLabel:_,xFormat:c,yFormat:u,enableHover:T,showGrid:B}),U&&{legend:U}),z&&{title:z}),l&&{className:l}),{tooltipContent:A?Jn(A):J}),(j||P)&&{customHoverBehavior:I}),S&&{pointIdAccessor:S}),E&&E.length>0&&{annotations:E}),O);return e.createElement(Ve,Object.assign({},te))}function Co(n){var o;const r=Lo(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:i,margin:a,className:s,xFormat:l,yFormat:c,xAccessor:u="x",yAccessor:d="y",areaBy:h,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:f="category10",curve:p="monotoneX",areaOpacity:m=.7,showLine:v=!0,lineWidth:b=2,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:S,onObservation:E,chartId:O}=n,L=r.width,j=r.height,P=r.enableHover,M=r.showGrid,N=r.showLegend,D=r.title,T=r.xLabel,B=r.yLabel,C=i||[],{activeSelectionHook:z,customHoverBehavior:W}=So({selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:E,chartType:"AreaChart",chartId:O}),_=void 0!==(null===(o=C[0])||void 0===o?void 0:o[g]),$=t(()=>{if(_)return C;if(h){const e=C.reduce((e,t)=>{const n="function"==typeof h?h(t):t[h];if(!e[n]){const t={[g]:[]};"string"==typeof h&&(t[h]=n),e[n]=t}return e[n][g].push(t),e},{});return Object.values(e)}return[{[g]:C}]},[C,h,g,_]),H=ko(C,y,f),I=t(()=>e=>{const t={},n=y?Wn(e,y,H):xo;return t.fill=n,t.fillOpacity=m,v?(t.stroke=n,t.strokeWidth=b):t.stroke="none",t},[y,H,m,v,b]),R=t(()=>io(I,z,A),[I,z,A]),{legend:F,margin:Y}=Eo({data:$,colorBy:y,colorScale:H,showLegend:N,userMargin:a,defaults:r.marginDefaults}),X=h||y,G=t(()=>no([{label:T||Kn(u),accessor:u,role:"x"},{label:B||Kn(d),accessor:d,role:"y"},...X?[{label:Kn(X),accessor:X,role:"group"}]:[]]),[u,d,T,B,X]),q=Mo({componentName:"AreaChart",data:C,accessors:{xAccessor:u,yAccessor:d}});if(q)return e.createElement(jo,{componentName:"AreaChart",message:q,width:L,height:j});const V=t(()=>_||h?$.flatMap(e=>{const t=e[g]||[];return h&&"string"==typeof h?t.map(t=>Object.assign(Object.assign({},t),{[h]:e[h]})):t}):C,[$,g,_,h,C]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area",data:V,xAccessor:u,yAccessor:d,groupAccessor:h||void 0,curve:p,lineStyle:R,size:[L,j],margin:Y,showAxes:r.showAxes,xLabel:T,yLabel:B,xFormat:l,yFormat:c,enableHover:P,showGrid:M},F&&{legend:F}),D&&{title:D}),s&&{className:s}),{tooltipContent:x?Jn(x):G}),(S||E)&&{customHoverBehavior:W}),w&&w.length>0&&{annotations:w}),k);return e.createElement(Ve,Object.assign({},U))}function zo(n){var o;const r=Lo(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:i,margin:a,className:s,xFormat:l,yFormat:c,xAccessor:u="x",yAccessor:d="y",areaBy:h,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:f="category10",curve:p="monotoneX",areaOpacity:m=.7,showLine:v=!0,lineWidth:b=2,normalize:x=!1,tooltip:w,annotations:k,frameProps:A={},selection:S,linkedHover:E,onObservation:O,chartId:L}=n,j=r.width,P=r.height,M=r.enableHover,N=r.showGrid,D=r.showLegend,T=r.title,B=r.xLabel,C=r.yLabel,z=i||[],{activeSelectionHook:W,customHoverBehavior:_}=So({selection:S,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:O,chartType:"StackedAreaChart",chartId:L}),$=void 0!==(null===(o=z[0])||void 0===o?void 0:o[g]),H=t(()=>{if($)return z;if(h){const e=z.reduce((e,t)=>{const n="function"==typeof h?h(t):t[h];if(!e[n]){const t={[g]:[]};"string"==typeof h&&(t[h]=n),e[n]=t}return e[n][g].push(t),e},{});return Object.values(e)}return[{[g]:z}]},[z,h,g,$]),I=ko(z,y,f),R=t(()=>e=>{const t={},n=y?Wn(e,y,I):xo;return t.fill=n,t.fillOpacity=m,v?(t.stroke=n,t.strokeWidth=b):t.stroke="none",t},[y,I,m,v,b]),F=t(()=>io(R,W,S),[R,W,S]),{legend:Y,margin:X}=Eo({data:H,colorBy:y,colorScale:I,showLegend:D,userMargin:a,defaults:r.marginDefaults}),G=h||y,q=t(()=>no([{label:B||Kn(u),accessor:u,role:"x"},{label:C||Kn(d),accessor:d,role:"y"},...G?[{label:Kn(G),accessor:G,role:"group"}]:[]]),[u,d,B,C,G]),V=Mo({componentName:"StackedAreaChart",data:z,accessors:{xAccessor:u,yAccessor:d}});if(V)return e.createElement(jo,{componentName:"StackedAreaChart",message:V,width:j,height:P});const U=t(()=>$||h?H.flatMap(e=>{const t=e[g]||[];return h&&"string"==typeof h?t.map(t=>Object.assign(Object.assign({},t),{[h]:e[h]})):t}):z,[H,g,$,h,z]),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea",data:U,xAccessor:u,yAccessor:d,groupAccessor:h||void 0,curve:p,normalize:x,lineStyle:F,size:[j,P],margin:X,showAxes:r.showAxes,xLabel:B,yLabel:C,xFormat:l,yFormat:c,enableHover:M,showGrid:N},Y&&{legend:Y}),T&&{title:T}),s&&{className:s}),{tooltipContent:w?Jn(w):q}),(E||O)&&{customHoverBehavior:_}),k&&k.length>0&&{annotations:k}),A);return e.createElement(Ve,Object.assign({},Z))}function Wo(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:i,className:a,xAccessor:s="x",yAccessor:l="y",valueAccessor:c="value",xFormat:u,yFormat:d,colorScheme:h="blues",customColorScale:g,showValues:y=!1,valueFormat:f,cellBorderColor:p="#fff",cellBorderWidth:m=1,tooltip:v,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:S,chartId:E}=n,O=o.width,L=o.height,j=o.enableHover,P=o.title,M=o.xLabel,N=o.yLabel,D=r||[],{margin:T}=Eo({data:D,colorBy:void 0,colorScale:void 0,showLegend:!1,userMargin:i,defaults:o.marginDefaults}),{activeSelectionHook:B,customHoverBehavior:C}=So({selection:k,linkedHover:A,fallbackFields:[],onObservation:S,chartType:"Heatmap",chartId:E}),z=t(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),W=t(()=>{const e=D.map(z);return[Math.min(...e),Math.max(...e)]},[D,z]),_=t(()=>"custom"===h&&g?g:b({blues:Y,reds:F,greens:R,viridis:$}[h]||Y).domain(W),[h,g,W]);t(()=>{const e=wo(s),t=wo(l);return{xBinCount:new Set(D.map(e)).size,yBinCount:new Set(D.map(t)).size}},[D,s,l]),t(()=>({coordinates:D}),[D]);const H=t(()=>e=>{const t=z(e);return{fill:_(t),stroke:p,strokeWidth:m}},[z,_,p,m]);t(()=>io(H,B,k),[H,B,k]),t(()=>{if(!y)return;const t=(W[0]+W[1])/2;return(n,o)=>{const r=z(n),i=f?f(r):r+"";return e.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fill:z(n)>t?"#fff":"#000",fontSize:"12px"},i)}},[y,z,f,W]);const I=t(()=>no([{label:M||Kn(s),accessor:s,role:"x"},{label:N||Kn(l),accessor:l,role:"y"},{label:Kn(c),accessor:c,role:"value"}]),[s,l,M,N,c]),X=Mo({componentName:"Heatmap",data:D,accessors:{xAccessor:s,yAccessor:l,valueAccessor:c}});if(X)return e.createElement(jo,{componentName:"Heatmap",message:X,width:O,height:L});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap",data:D,xAccessor:s,yAccessor:l,valueAccessor:c,size:[O,L],margin:T,showAxes:o.showAxes,xLabel:M,yLabel:N,xFormat:u,yFormat:d,enableHover:j},P&&{title:P}),a&&{className:a}),{tooltipContent:v?Jn(v):I}),(A||S)&&{customHoverBehavior:C}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Ve,Object.assign({},G))}function _o(n){const o=Lo(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:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:d,sizeRange:h=[5,40],colorBy:g,colorScheme:y="category10",bubbleOpacity:f=.6,bubbleStrokeWidth:p=1,bubbleStrokeColor:m="white",tooltip:v,marginalGraphics:b,pointIdAccessor:x,annotations:w,frameProps:k={},selection:A,linkedHover:S,linkedBrush:E,onObservation:O,chartId:L}=n,j=o.width,P=o.height,M=o.enableHover,N=o.showGrid,D=o.showLegend,T=o.title,B=o.xLabel,C=o.yLabel,z=r||[],{activeSelectionHook:W,customHoverBehavior:_}=So({selection:A,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:[],onObservation:O,chartType:"BubbleChart",chartId:L}),$=ro(E);po({name:(null==$?void 0:$.name)||"__unused_brush__",xField:(null==$?void 0:$.xField)||("string"==typeof c?c:void 0),yField:(null==$?void 0:$.yField)||("string"==typeof u?u:void 0)});const H=ko(z,g,y),I=t(()=>{const e=z.map(e=>"function"==typeof d?d(e):e[d]);return[Math.min(...e),Math.max(...e)]},[z,d]),R=t(()=>e=>{const t={fillOpacity:f,strokeWidth:p,stroke:m};return t.fill=g?Wn(e,g,H):xo,t.r=$n(e,d,h,I),t},[g,H,d,h,I,f,p,m]),F=t(()=>io(R,W,A),[R,W,A]),{legend:Y,margin:X}=Eo({data:z,colorBy:g,colorScale:H,showLegend:D,userMargin:i,defaults:o.marginDefaults}),G=t(()=>no([{label:B||Kn(c),accessor:c,role:"x"},{label:C||Kn(u),accessor:u,role:"y"},{label:Kn(d),accessor:d,role:"size"},...g?[{label:Kn(g),accessor:g,role:"color"}]:[]]),[c,u,B,C,d,g]),q=Mo({componentName:"BubbleChart",data:z,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(q)return e.createElement(jo,{componentName:"BubbleChart",message:q,width:j,height:P});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble",data:z,xAccessor:c,yAccessor:u,colorAccessor:g||void 0,sizeAccessor:d,sizeRange:h,pointStyle:F,colorScheme:y,size:[j,P],margin:X,showAxes:o.showAxes,xLabel:B,yLabel:C,xFormat:s,yFormat:l,enableHover:M,showGrid:N},Y&&{legend:Y}),T&&{title:T}),a&&{className:a}),{tooltipContent:v?Jn(v):G}),(S||O)&&{customHoverBehavior:_}),b&&{marginalGraphics:b}),x&&{pointIdAccessor:x}),w&&w.length>0&&{annotations:w}),k);return e.createElement(Ve,Object.assign({},V))}function $o(e={}){const{limit:n=50,types:o,chartId:r}=e,i=bo(e=>e.version),a=bo(e=>e.observations),s=bo(e=>e.clearObservations),l=t(()=>{let e=a;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>n&&(e=e.slice(e.length-n)),e},[a,o,r,n,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}function Ho({selections:e}){const t=go(e=>e.setResolution);return a(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[]),null}function Io({children:t,selections:n}){return e.createElement(ho,null,e.createElement(vo,null,n&&e.createElement(Ho,{selections:n}),t))}To.displayName="Scatterplot",Bo.displayName="LineChart",Co.displayName="AreaChart",zo.displayName="StackedAreaChart",Wo.displayName="Heatmap",_o.displayName="BubbleChart";const Ro="__splomIdx",Fo={top:4,bottom:4,left:4,right:4};function Yo({frameRef:t,cellSize:n,onBrush:r}){const i=o(null),s=n-Fo.left-Fo.right,l=n-Fo.top-Fo.bottom;return a(()=>{if(!i.current)return;const e=f(i.current).select(".brush-g"),n=y().extent([[0,0],[s,l]]).on("brush end",e=>{var n;const o=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!o)return;if(!e.selection)return void r(null);const[[i,a],[s,l]]=e.selection,c=[[o.x.invert(i),o.y.invert(a)],[o.x.invert(s),o.y.invert(l)]];r(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)}},[s,l,t,r]),e.createElement("svg",{ref:i,width:n,height:n,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${Fo.left},${Fo.top})`}))}function Xo({data:t,xField:n,yField:r,cellSize:a,pointRadius:s,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:y,onPointHover:f}){const p=o(null),m=yo({name:d,clientId:`splom-${n}-${r}`}),v=po({name:d,xField:n,yField:r}),b=yo({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,w=i(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),k=i(e=>{if(!e)return void(null==f||f(null));const t=e.data,n=null==t?void 0:t[Ro];void 0!==n&&(x({[Ro]:[n]}),null==f||f(t,e.x+Fo.left,e.y+Fo.top))},[x,f]),A=i(e=>{const t={opacity:l,r:s};return t.fill=c?Wn(e,c,u):xo,"hover"===y?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,s,y,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:a,height:a}},e.createElement(Ve,{ref:p,chartType:"scatter",data:t,size:[a,a],xAccessor:n,yAccessor:r,pointStyle:A,margin:Fo,showAxes:!1,enableHover:"hover"===y,customHoverBehavior:"hover"===y?k:void 0,tooltipContent:"hover"===y?()=>null:void 0}),"brush"===y&&e.createElement(Yo,{frameRef:p,cellSize:a,xField:n,yField:r,onBrush:w}))}function Go({data:n,field:o,label:r,cellSize:i,bins:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const u=yo({name:s,clientId:"splom-diag-"+o}),d=yo({name:l,clientId:`splom-diag-${o}-hover`}),h="hover"===c?d:u,g=h.isActive,y=h.predicate,f=t(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],max:0};const t=Math.min(...e),r=(Math.max(...e)-t)/a||1,s=Array(a).fill(0),l=Array(a).fill(0);for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const i=Math.min(Math.floor((n-t)/r),a-1);s[i]++,g&&!y(e)||l[i]++}const c=Math.max(...s,1);return{bars:s.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/c*(i-24),count:e})),selectedBars:l.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/c*(i-24),count:e})),max:c}},[n,o,a,i,g,y]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),f.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:"#ccc",opacity:g?.3:.6})),g&&f.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:xo,opacity:.7})))}function qo({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function Vo(n){const{data:o,fields:a,fieldLabels:s={},colorBy:l,colorScheme:c="category10",cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:y="histogram",histogramBins:f=20,brushMode:p="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:w,idAccessor:k,className:A,onObservation:S,chartId:E}=n,O="splom",L="splom-hover",j=m?"hover":p?"brush":"hover",P=go(e=>e.clearSelection),[M,N]=r(null),D=i(()=>{P(L),N(null)},[P,L]),T=t(()=>(o||[]).map((e,t)=>void 0!==e[Ro]?e:Object.assign(Object.assign({},e),{[Ro]:t})),[o]),B=ko(T,l,c),C=void 0!==w?w:!!l,z=t(()=>{if(!C||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:B?B(e+""):xo})):null},[C,l,T,B]),W=t(()=>({display:"grid",gridTemplateColumns:"40px "+a.map(()=>u+"px").join(" "),gridTemplateRows:a.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[a,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},z&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},z.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:W,onMouseLeave:"hover"===j?D:void 0},a.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t),a.map((o,r)=>n===r?"label"===y?e.createElement(qo,{key:"diag-"+t,label:s[t]||t,cellSize:u}):e.createElement(Go,{key:"diag-"+t,data:T,field:t,label:s[t]||t,cellSize:u,bins:f,colorBy:l,colorScale:B,brushSelectionName:O,hoverSelectionName:L,unselectedOpacity:v,mode:j}):e.createElement(Xo,{key:`cell-${t}-${o}`,data:T,xField:o,yField:t,fieldLabels:s,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:l,colorScale:B,brushSelectionName:O,hoverSelectionName:L,unselectedOpacity:v,showGrid:b,tooltip:x,mode:j,onPointHover:"hover"===j?(e,i,a)=>{e?(N({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=a?a:0}),S&&S({type:"hover",datum:e,x:null!=i?i:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:E})):(N(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:E}))}:void 0})))),e.createElement("div",null)," ",a.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t))),M&&"hover"===j&&(()=>{const t=M.datum,n=s[M.xField]||M.xField,o=s[M.yField]||M.yField,r=l?"function"==typeof l?l(t):t[l]:null,i=k?"function"==typeof k?k(t):t[k]:"Row "+t[Ro];return e.createElement("div",{style:{position:"absolute",left:40+M.colIndex*(u+d)+M.px,top:M.rowIndex*(u+d)+M.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}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[M.xField]?Number(t[M.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[M.yField]?Number(t[M.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof l?l:"group",": ",r+""))})())}function Uo(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(Io,{selections:r},e.createElement(Vo,Object.assign({},t)))}function Zo({width:t,height:n,margin:r,scales:i,brushDirection:s,extent:l,onBrush:c}){const u=o(null),d=o(null),y=o(!1),p=t+r.left+r.right,m=n+r.top+r.bottom;return a(()=>{if(!u.current||!i)return;const e=f(u.current).select(".brush-group"),o="x"===s?h().extent([[0,0],[t,n]]):g().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(y.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===s?i.x:i.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)}},[i,t,n,s,c]),a(()=>{if(!d.current||!i||!u.current)return;const e=f(u.current).select(".brush-group"),t="x"===s?i.x:i.y;if(y.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);y.current=!1},[l,i,s]),e.createElement("svg",{ref:u,width:p,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${r.left},${r.top})`}))}function Qo(n){var s,l;const{data:c,width:u=600,height:d=400,margin:h,className:g,title:y,xLabel:f,yLabel:p,xFormat:m,yFormat:v,xAccessor:b="x",yAccessor:x="y",lineBy:w,lineDataAccessor:k="coordinates",colorBy:A,colorScheme:S="category10",curve:E="linear",lineWidth:O=2,fillArea:L=!1,areaOpacity:j=.3,showPoints:P=!1,pointRadius:M=3,enableHover:N=!0,showGrid:D=!1,showLegend:T,tooltip:B,minimap:C={},renderBefore:z=!1,onBrush:W,brushExtent:_,frameProps:$={}}=n,H=c||[],[I,R]=r(null),F=null!=_?_:I,Y=i(e=>{_||R(e),null==W||W(e)},[_,W]),X=o(null),[G,q]=r(null);a(()=>{const e=()=>{var t,n;const o=null===(n=null===(t=X.current)||void 0===t?void 0:t.getScales)||void 0===n?void 0:n.call(t);o?q(o):requestAnimationFrame(e)};requestAnimationFrame(e)},[c]);const V=void 0!==(null===(s=H[0])||void 0===s?void 0:s[k]),U=t(()=>{if(V)return H;if(w){const e=H.reduce((e,t)=>{const n="function"==typeof w?w(t):t[w];if(!e[n]){const t={[k]:[]};"string"==typeof w&&(t[w]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:H}]},[H,w,k,V]),Z=t(()=>V||w?U.flatMap(e=>{const t=e[k]||[];return w&&"string"==typeof w?t.map(t=>Object.assign(Object.assign({},t),{[w]:e[w]})):t}):H,[U,k,V,w,H]),Q=ko(H,A,S),J=t(()=>e=>{const t={strokeWidth:O};return t.stroke=A?Wn(e,A,Q):xo,L&&(t.fill=t.stroke,t.fillOpacity=j),t},[A,Q,O,L,j]),K=t(()=>C.lineStyle?C.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=A?Wn(e,A,Q):xo,t},[A,Q,C.lineStyle]),ee=t(()=>{if(P)return e=>{const t={r:M,fillOpacity:1};return t.fill=A?Wn(e.parentLine||e,A,Q):xo,t}},[P,M,A,Q]),{legend:te,margin:ne}=Eo({data:U,colorBy:A,colorScale:Q,showLegend:T,userMargin:h}),oe=C.height||60,re=t(()=>{var e,t,n,o,r,i,a,s;return{top:null!==(t=null===(e=C.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=C.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=C.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ne.left,right:null!==(s=null===(a=C.margin)||void 0===a?void 0:a.right)&&void 0!==s?s:ne.right}},[C.margin,ne]),ie=C.brushDirection||"x",ae=Mo({componentName:"MinimapChart",data:H,accessors:{xAccessor:b,yAccessor:x}});if(ae)return e.createElement(jo,{componentName:"MinimapChart",message:ae,width:u,height:d});const se=L?"area":"line",le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:se,data:Z,xAccessor:b,yAccessor:x,groupAccessor:w||void 0,curve:E,lineStyle:J},P&&{pointStyle:ee}),{size:[u,d],margin:ne,showAxes:!0,xLabel:f,yLabel:p,xFormat:m,yFormat:v,enableHover:N,showGrid:D}),te&&{legend:te}),y&&{title:y}),B&&{tooltipContent:Jn(B)}),F&&{xExtent:F}),$),ce={chartType:se,data:Z,xAccessor:b,yAccessor:x,groupAccessor:w||void 0,curve:E,lineStyle:K,size:[u,oe+re.top+re.bottom],margin:re,showAxes:null!==(l=C.showAxes)&&void 0!==l&&l,background:C.background,enableHover:!1},ue=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(Ve,Object.assign({ref:X},ce)),e.createElement(Zo,{width:u-re.left-re.right,height:oe,margin:re,scales:G,brushDirection:ie,extent:F,onBrush:Y})),de=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(Ve,Object.assign({},le)));return e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},z?ue:de,z?de:ue)}function Jo(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",sort:g=!1,barPadding:y=5,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,O=o.showLegend,L=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],{activeSelectionHook:N,customHoverBehavior:D}=So({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:x,chartType:"BarChart",chartId:w}),T=Ao(M,g,l),B=ko(M,d,h),C=t(()=>e=>{const t={};return t.fill=d?Wn(e,d,B):xo,t},[d,B]),z=t(()=>io(C,N,v),[C,N,v]),{legend:W,margin:_}=Eo({data:T,colorBy:d,colorScale:B,showLegend:O,userMargin:i,defaults:o.marginDefaults}),$=t(()=>oo({categoryAccessor:s,valueAccessor:l,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group"}),[s,l,d]),H=Mo({componentName:"BarChart",data:M,accessors:{categoryAccessor:s,valueAccessor:l}});if(H)return e.createElement(jo,{componentName:"BarChart",message:H,width:k,height:A});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:T,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:z,size:[k,A],margin:_,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:u,showGrid:E,oSort:g},W&&{legend:W}),L&&{title:L}),a&&{className:a}),{tooltipContent:f?Jn(f):$}),(b||x)&&{customHoverBehavior:D}),p&&p.length>0&&{annotations:p}),m);return e.createElement(yt,Object.assign({},I))}function Ko(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:g="category10",normalize:y=!1,barPadding:f=5,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=o.width,S=o.height,E=o.enableHover,O=o.showGrid,L=o.showLegend,j=o.title,P=o.categoryLabel,M=o.valueLabel,N=r||[],D=h||l,{activeSelectionHook:T,customHoverBehavior:B}=So({selection:b,linkedHover:x,fallbackFields:D?["string"==typeof D?D:""]:[],unwrapData:!0,onObservation:w,chartType:"StackedBarChart",chartId:k}),C=ko(N,D,g),z=t(()=>e=>D?{fill:Wn(e,D,C)}:{fill:xo},[D,C]),W=t(()=>io(z,T,b),[z,T,b]),{legend:_,margin:$}=Eo({data:N,colorBy:D,colorScale:C,showLegend:L,userMargin:i,defaults:o.marginDefaults}),H=t(()=>oo({categoryAccessor:l,valueAccessor:c,groupAccessor:s}),[l,s,c]),I=Mo({componentName:"StackedBarChart",data:N,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{stackBy:l}});if(I)return e.createElement(jo,{componentName:"StackedBarChart",message:I,width:A,height:S});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:N,oAccessor:s,rAccessor:c,stackBy:l,normalize:y,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:W,size:[A,S],margin:$,barPadding:f,enableHover:E,showAxes:o.showAxes,oLabel:P,rLabel:M,rFormat:d,showGrid:O},_&&{legend:_}),j&&{title:j}),a&&{className:a}),{tooltipContent:p?Jn(p):H}),(x||w)&&{customHoverBehavior:B}),m&&m.length>0&&{annotations:m}),v);return e.createElement(yt,Object.assign({},R))}function er(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",sizeBy:g,sizeRange:y=[3,8],pointRadius:f=4,pointOpacity:p=.7,categoryPadding:m=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:S}=n,E=o.width,O=o.height,L=o.enableHover,j=o.showGrid,P=o.showLegend,M=o.title,N=o.categoryLabel,D=o.valueLabel,T=r||[],{activeSelectionHook:B,customHoverBehavior:C}=So({selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,chartType:"SwarmPlot",chartId:S}),z=ko(T,d,h),W=t(()=>{if(!g)return;const e=T.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[T,g]),_=t(()=>e=>{const t={fillOpacity:p};return t.fill=d?Wn(e,d,z):xo,t.r=g?$n(e,g,y,W):f,t},[d,z,g,y,W,f,p]),$=t(()=>io(_,B,w),[_,B,w]),{legend:H,margin:I}=Eo({data:T,colorBy:d,colorScale:z,showLegend:P,userMargin:i,defaults:o.marginDefaults}),R=t(()=>oo({categoryAccessor:s,valueAccessor:l,groupAccessor:d||void 0}),[s,l,d]),F=Mo({componentName:"SwarmPlot",data:T,accessors:{categoryAccessor:s,valueAccessor:l}});if(F)return e.createElement(jo,{componentName:"SwarmPlot",message:F,width:E,height:O});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:T,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:$,size:[E,O],margin:I,barPadding:m,enableHover:L,showAxes:o.showAxes,oLabel:N,rLabel:D,rFormat:u,showGrid:j},H&&{legend:H}),M&&{title:M}),a&&{className:a}),{tooltipContent:v?Jn(v):R}),(k||A)&&{customHoverBehavior:C}),b&&b.length>0&&{annotations:b}),x);return e.createElement(yt,Object.assign({},Y))}function tr(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",showOutliers:g=!0,categoryPadding:y=20,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,O=o.showLegend,L=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],{activeSelectionHook:N,customHoverBehavior:D}=So({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"BoxPlot",chartId:w}),T=ko(M,d,h),B=t(()=>e=>{const t=d?Wn(e,d,T):xo;return{fill:t,stroke:t,fillOpacity:.8}},[d,T]),C=t(()=>io(B,N,v),[B,N,v]),{legend:z,margin:W}=Eo({data:M,colorBy:d,colorScale:T,showLegend:O,userMargin:i,defaults:o.marginDefaults}),_=t(()=>t=>{const n=t.stats||(t.data||t).stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:qn},e.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(t.category||(t.data||t).category||"")+""),null!=n.median&&e.createElement(e.Fragment,null,null!=n.n&&e.createElement("div",null,"n = ",n.n),e.createElement("div",null,"Median: ",n.median.toLocaleString()),e.createElement("div",null,"Q1: ",n.q1.toLocaleString()),e.createElement("div",null,"Q3: ",n.q3.toLocaleString()),e.createElement("div",null,"Min: ",n.min.toLocaleString()),e.createElement("div",null,"Max: ",n.max.toLocaleString())))},[]),$=Mo({componentName:"BoxPlot",data:M,accessors:{categoryAccessor:s,valueAccessor:l}});if($)return e.createElement(jo,{componentName:"BoxPlot",message:$,width:k,height:A});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:M,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:C,showOutliers:g,size:[k,A],margin:W,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:u,showGrid:E},z&&{legend:z}),L&&{title:L}),a&&{className:a}),{tooltipContent:f?Jn(f):_}),(b||x)&&{customHoverBehavior:D}),p&&p.length>0&&{annotations:p}),m);return e.createElement(yt,Object.assign({},H))}function nr(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:g="category10",categoryPadding:y=20,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,O=o.showLegend,L=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],{activeSelectionHook:N,customHoverBehavior:D}=So({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"Histogram",chartId:w}),T=ko(M,h,g),B=t(()=>e=>{const t=h?Wn(e,h,T):xo;return{fill:t,stroke:t,fillOpacity:.8}},[h,T]),C=t(()=>io(B,N,v),[B,N,v]),{legend:z,margin:W}=Eo({data:M,colorBy:h,colorScale:T,showLegend:O,userMargin:i,defaults:o.marginDefaults}),_=t(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:qn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),$=Mo({componentName:"Histogram",data:M,accessors:{categoryAccessor:s,valueAccessor:l}});if($)return e.createElement(jo,{componentName:"Histogram",message:$,width:k,height:A});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:M,oAccessor:s,rAccessor:l,projection:"horizontal",summaryStyle:C,bins:c,normalize:u,size:[k,A],margin:W,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:d,showGrid:E},z&&{legend:z}),L&&{title:L}),a&&{className:a}),{tooltipContent:f?Jn(f):_}),(b||x)&&{customHoverBehavior:D}),p&&p.length>0&&{annotations:p}),m);return e.createElement(yt,Object.assign({},H))}function or(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,showIQR:d=!0,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:f=20,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=o.width,S=o.height,E=o.enableHover,O=o.showGrid,L=o.showLegend,j=o.title,P=o.categoryLabel,M=o.valueLabel,N=r||[],{activeSelectionHook:D,customHoverBehavior:T}=So({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"ViolinPlot",chartId:k}),B=ko(N,g,y),C=t(()=>e=>{const t=g?Wn(e,g,B):xo;return{fill:t,stroke:t,fillOpacity:.6}},[g,B]),z=t(()=>io(C,D,b),[C,D,b]),{legend:W,margin:_}=Eo({data:N,colorBy:g,colorScale:B,showLegend:L,userMargin:i,defaults:o.marginDefaults}),$=t(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;if(r)return e.createElement("div",{className:"semiotic-tooltip",style:qn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(t.data)?t.data:[]).map(e=>{const t="function"==typeof l?l(e):e[l];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),a=i.length,s=a>0?i[Math.floor(a/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:qn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))},[l]),H=Mo({componentName:"ViolinPlot",data:N,accessors:{categoryAccessor:s,valueAccessor:l}});if(H)return e.createElement(jo,{componentName:"ViolinPlot",message:H,width:A,height:S});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:N,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:z,bins:u,showIQR:d,size:[A,S],margin:_,barPadding:f,enableHover:E,showAxes:o.showAxes,oLabel:P,rLabel:M,rFormat:h,showGrid:O},W&&{legend:W}),j&&{title:j}),a&&{className:a}),{tooltipContent:p?Jn(p):$}),(x||w)&&{customHoverBehavior:T}),m&&m.length>0&&{annotations:m}),v);return e.createElement(yt,Object.assign({},I))}function rr(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:f=5,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=o.width,S=o.height,E=o.enableHover,O=o.showGrid,L=o.showLegend,j=o.title,P=o.categoryLabel,M=o.valueLabel,N=r||[],{activeSelectionHook:D,customHoverBehavior:T}=So({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:k}),B=ko(N,g,y),C=t(()=>e=>{const t=g?Wn(e,g,B):xo;return{fill:t,stroke:t,fillOpacity:.5}},[g,B]),z=t(()=>io(C,D,b),[C,D,b]),{legend:W,margin:_}=Eo({data:N,colorBy:g,colorScale:B,showLegend:L,userMargin:i,defaults:o.marginDefaults}),$=t(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;return r?e.createElement("div",{className:"semiotic-tooltip",style:qn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):e.createElement("div",{className:"semiotic-tooltip",style:qn},e.createElement("div",{style:{fontWeight:"bold"}},o+""))},[]),H=Mo({componentName:"RidgelinePlot",data:N,accessors:{categoryAccessor:s,valueAccessor:l}});if(H)return e.createElement(jo,{componentName:"RidgelinePlot",message:H,width:A,height:S});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline",data:N,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:z,bins:u,size:[A,S],margin:_,barPadding:f,enableHover:E,showAxes:o.showAxes,oLabel:P,rLabel:M,rFormat:h,showGrid:O,oSort:!1},W&&{legend:W}),j&&{title:j}),a&&{className:a}),{tooltipContent:p?Jn(p):$}),(x||w)&&{customHoverBehavior:T}),m&&m.length>0&&{annotations:m}),v);return I.amplitude=d,e.createElement(yt,Object.assign({},I))}function ir(n){var o;const r=Lo(n.mode,{width:n.width,height:n.height,showGrid:null===(o=n.showGrid)||void 0===o||o,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:g="category10",sort:y=!0,dotRadius:f=5,categoryPadding:p=10,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:A}=n,S=r.width,E=r.height,O=r.enableHover,L=r.showGrid,j=r.showLegend,P=r.title,M=r.categoryLabel,N=r.valueLabel,D=i||[],{activeSelectionHook:T,customHoverBehavior:B}=So({selection:x,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"DotPlot",chartId:A}),C=Ao(D,y,c),z=ko(D,h,g),W=t(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=h?Wn(e,h,z):xo,t},[h,z,f]),_=t(()=>io(W,T,x),[W,T,x]),{legend:$,margin:H}=Eo({data:C,colorBy:h,colorScale:z,showLegend:j,userMargin:a,defaults:r.marginDefaults}),I=t(()=>oo({categoryAccessor:l,valueAccessor:c}),[l,c]),R=Mo({componentName:"DotPlot",data:D,accessors:{categoryAccessor:l,valueAccessor:c}});if(R)return e.createElement(jo,{componentName:"DotPlot",message:R,width:S,height:E});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:C,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:_,size:[S,E],margin:H,barPadding:p,enableHover:O,showAxes:r.showAxes,oLabel:M,rLabel:N,rFormat:d,showGrid:L,oSort:y},$&&{legend:$}),P&&{title:P}),s&&{className:s}),{tooltipContent:m?Jn(m):I}),(w||k)&&{customHoverBehavior:B}),v&&v.length>0&&{annotations:v}),b);return e.createElement(yt,Object.assign({},F))}function ar(n){var o,r;const i=Lo(n.mode,{width:null!==(o=n.width)&&void 0!==o?o:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title}),{data:a,margin:s,className:l,categoryAccessor:c="category",valueAccessor:u="value",colorBy:d,colorScheme:h="category10",startAngle:g=0,tooltip:y,annotations:f,frameProps:p={},selection:m,linkedHover:v,onObservation:b,chartId:x}=n,w=i.width,k=i.height,A=i.enableHover,S=i.showLegend,E=i.title,O=a||[],L=d||c,{activeSelectionHook:j,customHoverBehavior:P}=So({selection:m,linkedHover:v,fallbackFields:L?["string"==typeof L?L:""]:[],unwrapData:!0,onObservation:b,chartType:"PieChart",chartId:x}),M=ko(O,L,h),N=t(()=>e=>L?{fill:Wn(e,L,M)}:{fill:xo},[L,M]),D=t(()=>io(N,j,m),[N,j,m]),{legend:T,margin:B}=Eo({data:O,colorBy:L,colorScale:M,showLegend:S,userMargin:s,defaults:i.marginDefaults}),C=t(()=>oo({categoryAccessor:c,valueAccessor:u,groupAccessor:d&&d!==c?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[c,u,d]),z=Mo({componentName:"PieChart",data:O,accessors:{categoryAccessor:c,valueAccessor:u}});if(z)return e.createElement(jo,{componentName:"PieChart",message:z,width:w,height:k});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:O,oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:D,startAngle:g,size:[w,k],margin:B,enableHover:A,showAxes:!1},T&&{legend:T}),E&&{title:E}),l&&{className:l}),{tooltipContent:y?Jn(y):C}),(v||b)&&{customHoverBehavior:P}),f&&f.length>0&&{annotations:f}),p);return e.createElement(yt,Object.assign({},W))}function sr(n){var o,r;const i=Lo(n.mode,{width:null!==(o=n.width)&&void 0!==o?o:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,linkedHover:n.linkedHover}),{data:a,margin:s,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d=60,centerContent:h,colorBy:g,colorScheme:y="category10",startAngle:f=0,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=i.width,S=i.height,E=i.enableHover,O=i.showLegend,L=i.title,j=a||[],P=g||c,{activeSelectionHook:M,customHoverBehavior:N}=So({selection:b,linkedHover:x,fallbackFields:P?["string"==typeof P?P:""]:[],unwrapData:!0,onObservation:w,chartType:"DonutChart",chartId:k}),D=ko(j,P,y),T=t(()=>e=>P?{fill:Wn(e,P,D)}:{fill:xo},[P,D]),B=t(()=>io(T,M,b),[T,M,b]),{legend:C,margin:z}=Eo({data:j,colorBy:P,colorScale:D,showLegend:O,userMargin:s,defaults:i.marginDefaults}),W=t(()=>oo({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),_=Mo({componentName:"DonutChart",data:j,accessors:{categoryAccessor:c,valueAccessor:u}});if(_)return e.createElement(jo,{componentName:"DonutChart",message:_,width:A,height:S});const $=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:j,oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:B,innerRadius:d,startAngle:f,centerContent:h,size:[A,S],margin:z,enableHover:E,showAxes:!1},C&&{legend:C}),L&&{title:L}),l&&{className:l}),{tooltipContent:p?Jn(p):W}),(x||w)&&{customHoverBehavior:N}),m&&m.length>0&&{annotations:m}),v);return e.createElement(yt,Object.assign({},$))}function lr(n){const o=Lo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:g="category10",barPadding:y=5,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,O=o.showLegend,L=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],N=h||l,{activeSelectionHook:D,customHoverBehavior:T}=So({selection:v,linkedHover:b,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:x,chartType:"GroupedBarChart",chartId:w}),B=ko(M,N,g),C=t(()=>e=>N?{fill:Wn(e,N,B)}:{fill:xo},[N,B]),z=t(()=>io(C,D,v),[C,D,v]),{legend:W,margin:_}=Eo({data:M,colorBy:N,colorScale:B,showLegend:O,userMargin:i,defaults:o.marginDefaults}),$=t(()=>oo({categoryAccessor:l,valueAccessor:c,groupAccessor:s}),[l,s,c]),H=Mo({componentName:"GroupedBarChart",data:M,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{groupBy:l}});if(H)return e.createElement(jo,{componentName:"GroupedBarChart",message:H,width:k,height:A});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:M,oAccessor:s,rAccessor:c,groupBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:z,size:[k,A],margin:_,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:d,showGrid:E},W&&{legend:W}),L&&{title:L}),a&&{className:a}),{tooltipContent:f?Jn(f):$}),(b||x)&&{customHoverBehavior:T}),p&&p.length>0&&{annotations:p}),m);return e.createElement(yt,Object.assign({},I))}function cr(n){var o;const r=Lo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:a,edges:s,margin:l,className:c,nodeIDAccessor:u="id",sourceAccessor:d="source",targetAccessor:h="target",nodeLabel:g,colorBy:y,colorScheme:f="category10",nodeSize:p=8,nodeSizeRange:m=[5,20],edgeWidth:v=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:w=300,forceStrength:k=.1,tooltip:A,frameProps:S={},onObservation:E,chartId:O}=n,L=r.width,j=r.height,P=r.enableHover,M=r.showLegend,N=null!==(o=r.showLabels)&&void 0!==o&&o,D=r.title,T=a||[],B=s||[],C=ko(T,y,f),z=t(()=>e=>{const t={};return t.fill=y?Wn(e.data||e,y,C):xo,"number"==typeof p&&(t.r=p),t},[y,C,p]),W=t(()=>e=>({stroke:b,strokeWidth:"number"==typeof v?v:"function"==typeof v?v(e):e[v]||1,opacity:x}),[v,b,x]),_=t(()=>{if(N&&g)return"function"==typeof g?g:e=>e[g]},[N,g]),{legend:$,margin:H}=Eo({data:T,colorBy:y,colorScale:C,showLegend:M,userMargin:l,defaults:r.marginDefaults}),I=i(e=>{if(!E)return;const t=Date.now();E(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"ForceDirectedGraph",chartId:O}:{type:"hover-end",timestamp:t,chartType:"ForceDirectedGraph",chartId:O})},[E,O]),R=Do({componentName:"ForceDirectedGraph",nodes:a,edges:s,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:u}});return R?e.createElement(jo,{componentName:"ForceDirectedGraph",message:R,width:L,height:j}):e.createElement(Gn,Object.assign({chartType:"force",nodes:T,edges:B,size:[L,j],margin:H,nodeIDAccessor:u,sourceAccessor:d,targetAccessor:h,iterations:w,forceStrength:k,nodeStyle:z,edgeStyle:W,colorBy:y,colorScheme:f,nodeSize:p,nodeSizeRange:m,nodeLabel:_,showLabels:N,enableHover:P,tooltipContent:A?e=>Jn(A)(e.data):void 0,customHoverBehavior:E?I:void 0,legend:$,className:c,title:D},S))}function ur(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function dr(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function hr(e){return"function"==typeof e?e:t=>t[e]||1}function gr({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Wn(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Wn(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}function yr(n){var o;const r=Lo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:a,edges:s,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:f="category10",edgeColorBy:p="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,edgeOpacity:w=.5,tooltip:k,frameProps:A={},onObservation:S,chartId:E}=n,O=r.width,L=r.height,j=r.enableHover,P=null===(o=r.showLabels)||void 0===o||o,M=r.title,N=s||[],D=t(()=>dr(a,N,u,d),[a,N,u,d]),T=ko(D,y,f),B=t(()=>(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(y)r.fill=Wn(e.data||e,y,T);else{const i=Array.isArray(f)?f:Bn[f]||Cn,a=Array.isArray(i)?i:Cn,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r},[y,T,f]),C=t(()=>gr({edgeColorBy:p,colorBy:y,colorScale:T,nodeStyleFn:B,edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}}),[p,y,T,B,w]),z=t(()=>{if(!P)return;const e=x||g;return"function"==typeof e?e:t=>t[e]},[P,x,g]),W=Object.assign(Object.assign({},r.marginDefaults),l),_=i(e=>{if(!S)return;const t=Date.now();S(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"ChordDiagram",chartId:E}:{type:"hover-end",timestamp:t,chartType:"ChordDiagram",chartId:E})},[S,E]),$=Do({componentName:"ChordDiagram",edges:s,edgesRequired:!0});return $?e.createElement(jo,{componentName:"ChordDiagram",message:$,width:O,height:L}):e.createElement(Gn,Object.assign({chartType:"chord",nodes:D,edges:N,size:[O,L],margin:W,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:B,edgeStyle:C,colorBy:y,colorScheme:f,edgeColorBy:p,edgeOpacity:w,nodeLabel:z,showLabels:P,enableHover:j,tooltipContent:k?e=>Jn(k)(e.data):void 0,customHoverBehavior:S?_:void 0,className:c,title:M},A))}function fr(n){var o;const r=Lo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:800,height:600}),{nodes:a,edges:s,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:f="category10",edgeColorBy:p="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:w,edgeOpacity:k=.5,edgeSort:A,tooltip:S,frameProps:E={},onObservation:O,chartId:L}=n,j=r.width,P=r.height,M=r.enableHover,N=null===(o=r.showLabels)||void 0===o||o,D=r.title,T=s||[],B=t(()=>dr(a,T,u,d),[a,T,u,d]),C=ko(B,y,f),z=t(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=y?Wn(e.data||e,y,C):"#4d430c",t},[y,C]),W=t(()=>gr({edgeColorBy:p,colorBy:y,colorScale:C,nodeStyleFn:z,edgeOpacity:k,baseStyle:{stroke:"none",strokeWidth:0}}),[p,y,C,z,k]),_=t(()=>{if(!N)return;const e=w||g;return"function"==typeof e?e:t=>t[e]},[N,w,g]),$=Object.assign(Object.assign({},r.marginDefaults),l),H=bo(e=>e.pushObservation),I=i(e=>{const t=Date.now();if(e){const n={type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"SankeyDiagram",chartId:L};O&&O(n),H&&H(n)}else{const e={type:"hover-end",timestamp:t,chartType:"SankeyDiagram",chartId:L};O&&O(e),H&&H(e)}},[O,L,H]),R=i(e=>{const t=Date.now();if(e){const n={type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"SankeyDiagram",chartId:L};O&&O(n),H&&H(n)}else{const e={type:"click-end",timestamp:t,chartType:"SankeyDiagram",chartId:L};O&&O(e),H&&H(e)}},[O,L,H]),F=Do({componentName:"SankeyDiagram",edges:s,edgesRequired:!0});return F?e.createElement(jo,{componentName:"SankeyDiagram",message:F,width:j,height:P}):e.createElement(Gn,Object.assign({chartType:"sankey",nodes:B,edges:T,size:[j,P],margin:$,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:z,edgeStyle:W,colorBy:y,colorScheme:f,edgeColorBy:p,edgeOpacity:k,edgeSort:A,nodeLabel:_,showLabels:N,enableHover:M,tooltipContent:S?e=>Jn(S)(e.data):void 0,customHoverBehavior:O?I:void 0,customClickBehavior:O?R:void 0,className:c,title:D},E))}function pr(n){var o;const r=Lo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{data:a,margin:s,className:l,layout:c="tree",orientation:u="vertical",childrenAccessor:d="children",valueAccessor:h="value",nodeIdAccessor:g="name",colorBy:y,colorScheme:f="category10",colorByDepth:p=!1,edgeStyle:m="curve",nodeLabel:v,nodeSize:b=5,tooltip:x,frameProps:w={},onObservation:k,chartId:A}=n,S=r.width,E=r.height,O=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,j=r.title,P=t(()=>ur(a,d),[a,d]),M=t(()=>{if(!p&&y&&"function"!=typeof y)return _n(P,y,f)},[P,y,p,f]),N=t(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?zn[(e.depth||0)%zn.length]:y?Wn(e.data||e,y,M):xo,t},[y,p,M]),D=t(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),T=t(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return hr(h)},[c,h]),B=Object.assign(Object.assign({},r.marginDefaults),s),C=i(e=>{if(!k)return;const t=Date.now();k(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"TreeDiagram",chartId:A}:{type:"hover-end",timestamp:t,chartType:"TreeDiagram",chartId:A})},[k,A]),z=No({componentName:"TreeDiagram",data:a});return z?e.createElement(jo,{componentName:"TreeDiagram",message:z,width:S,height:E}):e.createElement(Gn,Object.assign({chartType:c,data:a,size:[S,E],margin:B,nodeIDAccessor:g,childrenAccessor:d,hierarchySum:T,treeOrientation:u,edgeType:m,nodeStyle:N,edgeStyle:D,colorBy:y,colorScheme:f,colorByDepth:p,nodeSize:b,nodeLabel:L?v||g:void 0,showLabels:L,enableHover:O,tooltipContent:x?e=>Jn(x)(e.data):void 0,customHoverBehavior:k?C:void 0,className:l,title:j},w))}function mr(n){var o;const r=Lo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,linkedHover:n.linkedHover},{width:600,height:600}),{data:a,margin:s,className:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,labelMode:f="leaf",nodeLabel:p,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:S}=n,E=r.width,O=r.height,L=r.enableHover,j=null===(o=r.showLabels)||void 0===o||o,P=r.title,{activeSelectionHook:M,customHoverBehavior:N}=So({selection:w,linkedHover:k,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,chartType:"Treemap",chartId:S}),D=i(e=>{if(!e)return N(null);const t=e.data||e;N({data:(null==t?void 0:t.data)||t})},[N]),T=t(()=>ur(a,c),[a,c]),B=t(()=>{if(y)return;if(!h||"function"==typeof h)return;const e=h;return _n(T.filter(t=>null!=t[e]),e,g)},[T,h,y,g]),C=t(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=y?zn[(e.depth||0)%zn.length]:h?Wn(e.data||e,h,B):xo,t},[h,y,B]),z=t(()=>M?e=>{var t,n;const o=Object.assign({},C(e));return M.isActive&&(M.predicate(e.data||e)?(null==w?void 0:w.selectedStyle)&&Object.assign(o,w.selectedStyle):(o.fillOpacity=null!==(t=null==w?void 0:w.unselectedOpacity)&&void 0!==t?t:.2,o.strokeOpacity=null!==(n=null==w?void 0:w.unselectedOpacity)&&void 0!==n?n:.2,(null==w?void 0:w.unselectedStyle)&&Object.assign(o,w.unselectedStyle))),o}:C,[C,M,w]),W=t(()=>hr(u),[u]),_=void 0!==v?v:j&&"parent"===f?18:void 0,$=Object.assign(Object.assign({},r.marginDefaults),s),H=No({componentName:"Treemap",data:a});return H?e.createElement(jo,{componentName:"Treemap",message:H,width:E,height:O}):e.createElement(Gn,Object.assign({chartType:"treemap",data:a,size:[E,O],margin:$,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:W,padding:m,paddingTop:_,nodeStyle:z,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:j?p||d:void 0,showLabels:j,enableHover:L,tooltipContent:b?e=>Jn(b)(e.data):void 0},(k||A)&&{customHoverBehavior:D},{className:l,title:P},x))}function vr(n){var o;const r=Lo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{data:a,margin:s,className:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,nodeLabel:f,circleOpacity:p=.7,padding:m=4,tooltip:v,frameProps:b={},onObservation:x,chartId:w}=n,k=r.width,A=r.height,S=r.enableHover,E=null===(o=r.showLabels)||void 0===o||o,O=r.title,L=t(()=>ur(a,c),[a,c]),j=t(()=>{if(!y&&h&&"function"!=typeof h)return _n(L,h,g)},[L,h,y,g]),P=t(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=y?zn[(e.depth||0)%zn.length]:h?Wn(e.data||e,h,j):xo,t},[h,y,j,p]),M=t(()=>hr(u),[u]),N=Object.assign(Object.assign({},r.marginDefaults),s),D=i(e=>{if(!x)return;const t=Date.now();x(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"CirclePack",chartId:w}:{type:"hover-end",timestamp:t,chartType:"CirclePack",chartId:w})},[x,w]),T=No({componentName:"CirclePack",data:a});return T?e.createElement(jo,{componentName:"CirclePack",message:T,width:k,height:A}):e.createElement(Gn,Object.assign({chartType:"circlepack",data:a,size:[k,A],margin:N,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:M,padding:m,nodeStyle:P,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:E?f||d:void 0,showLabels:E,enableHover:S,tooltipContent:v?e=>Jn(v)(e.data):void 0,customHoverBehavior:x?D:void 0,className:l,title:O},b))}Uo.displayName="ScatterplotMatrix",Qo.displayName="MinimapChart",Jo.displayName="BarChart",Ko.displayName="StackedBarChart",er.displayName="SwarmPlot",tr.displayName="BoxPlot",nr.displayName="Histogram",or.displayName="ViolinPlot",rr.displayName="RidgelinePlot",ir.displayName="DotPlot",ar.displayName="PieChart",sr.displayName="DonutChart",lr.displayName="GroupedBarChart",cr.displayName="ForceDirectedGraph",yr.displayName="ChordDiagram",fr.displayName="SankeyDiagram",pr.displayName="TreeDiagram",mr.displayName="Treemap",vr.displayName="CirclePack";const br=n(function(t,n){var r,a,l,c;const u=Lo(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:w,extentPadding:k,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:E,background:O,tooltipContent:L,tooltip:j,onHover:P,annotations:M,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:T,decay:B,pulse:C,staleness:z,transition:W,linkedHover:_,onObservation:$,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=L?L:j,G=o(null),{customHoverBehavior:q}=So({linkedHover:_,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:H}),V=i(e=>{P&&P(e),q(e)},[P,q]);return s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),e.createElement(Ve,{ref:G,chartType:"line",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:w,extentPadding:k,lineStyle:{stroke:A,strokeWidth:S,strokeDasharray:E},showAxes:I,background:O,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:M,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:T,decay:B,pulse:C,staleness:z,transition:W})});br.displayName="RealtimeLineChart";const xr=n(function(t,n){var r,a,l,c;const u=Lo(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{binSize:d,size:h,margin:g,className:y,arrowOfTime:f="right",windowMode:p="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:w,valueExtent:k,extentPadding:A,categoryAccessor:S,colors:E,fill:O,stroke:L,strokeWidth:j,gap:P,background:M,tooltipContent:N,tooltip:D,onHover:T,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:W,linkedHover:_,decay:$,pulse:H,staleness:I,transition:R,onObservation:F,chartId:Y}=t,X=u.showAxes,G=u.enableHover,q=null!=g?g:u.marginDefaults,V=null!=h?h:[u.width,u.height],U=null!=N?N:D,Z=o(null),{customHoverBehavior:Q}=So({linkedHover:_,unwrapData:!0,onObservation:F,chartType:"RealtimeTemporalHistogram",chartId:Y}),J=i(e=>{T&&T(e),Q(e)},[T,Q]);s(n,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const K={};return null!=O&&(K.fill=O),null!=L&&(K.stroke=L),null!=j&&(K.strokeWidth=j),null!=P&&(K.gap=P),e.createElement(Ve,{ref:Z,chartType:"bar",runtimeMode:"streaming",size:V,margin:q,className:y,arrowOfTime:f,windowMode:p,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:w,yExtent:k,extentPadding:A,binSize:d,categoryAccessor:S,barColors:E,barStyle:K,showAxes:X,background:M,hoverAnnotation:G,tooltipContent:U,customHoverBehavior:J,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:W,decay:$,pulse:H,staleness:I,transition:R})});xr.displayName="RealtimeTemporalHistogram";const wr=xr,kr=n(function(t,n){var r,a,l,c;const u=Lo(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:w,extentPadding:k,categoryAccessor:A,colors:S,radius:E,fill:O,opacity:L,stroke:j,strokeWidth:P,background:M,tooltipContent:N,tooltip:D,onHover:T,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:W,linkedHover:_,onObservation:$,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=N?N:D,G=o(null),{customHoverBehavior:q}=So({linkedHover:_,unwrapData:!0,onObservation:$,chartType:"RealtimeSwarmChart",chartId:H}),V=i(e=>{T&&T(e),q(e)},[T,q]);s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const U={};return null!=E&&(U.radius=E),null!=O&&(U.fill=O),null!=L&&(U.opacity=L),null!=j&&(U.stroke=j),null!=P&&(U.strokeWidth=P),e.createElement(Ve,{ref:G,chartType:"swarm",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:w,extentPadding:k,categoryAccessor:A,barColors:S,swarmStyle:U,showAxes:I,background:M,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:W})});kr.displayName="RealtimeSwarmChart";const Ar=n(function(t,n){var r,a,l,c;const u=Lo(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:w,extentPadding:k,positiveColor:A,negativeColor:S,connectorStroke:E,connectorWidth:O,gap:L,stroke:j,strokeWidth:P,background:M,tooltipContent:N,tooltip:D,onHover:T,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:W,linkedHover:_,onObservation:$,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=N?N:D,G=o(null),{customHoverBehavior:q}=So({linkedHover:_,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:H}),V=i(e=>{T&&T(e),q(e)},[T,q]);s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const U={};return null!=A&&(U.positiveColor=A),null!=S&&(U.negativeColor=S),null!=E&&(U.connectorStroke=E),null!=O&&(U.connectorWidth=O),null!=L&&(U.gap=L),null!=j&&(U.stroke=j),null!=P&&(U.strokeWidth=P),e.createElement(Ve,{ref:G,chartType:"waterfall",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:w,extentPadding:k,waterfallStyle:U,showAxes:I,background:M,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:W})});Ar.displayName="RealtimeWaterfallChart";const Sr=n(function(t,n){var r,a,l,c;const u=Lo(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:w,valueExtent:k,extentPadding:A,heatmapXBins:S=20,heatmapYBins:E=20,aggregation:O="count",background:L,tooltipContent:j,tooltip:P,onHover:M,annotations:N,svgAnnotationRules:D,tickFormatTime:T,tickFormatValue:B,decay:C,pulse:z,staleness:W,linkedHover:_,onObservation:$,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=j?j:P,G=o(null),{customHoverBehavior:q}=So({linkedHover:_,unwrapData:!0,onObservation:$,chartType:"RealtimeHeatmap",chartId:H}),V=i(e=>{M&&M(e),q(e)},[M,q]);return s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),e.createElement(Ve,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:w,yExtent:k,extentPadding:A,heatmapXBins:S,heatmapYBins:E,heatmapAggregation:O,showAxes:I,background:L,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:N,svgAnnotationRules:D,tickFormatTime:T,tickFormatValue:B,decay:C,pulse:z,staleness:W})});function Er(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),n=Math.abs(t);return 1e9>n?1e6>n?1e4>n?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}Sr.displayName="RealtimeHeatmap";const Or={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Lr={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[jr,Pr]=ao(e=>({theme:Or,setTheme(t){e(e=>"light"===t?{theme:Or}:"dark"===t?{theme:Lr}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}}));function Mr({theme:t}){const n=Pr(e=>e.setTheme);return e.useEffect(()=>{void 0!==t&&n(t)},[t,n]),null}function Nr({children:t}){const n=Pr(e=>e.theme);return e.createElement("div",{style:{position:"relative","--semiotic-bg":n.colors.background,"--semiotic-text":n.colors.text,"--semiotic-text-secondary":n.colors.textSecondary,"--semiotic-grid":n.colors.grid,"--semiotic-border":n.colors.border,"--semiotic-primary":n.colors.primary,"--semiotic-font-family":n.typography.fontFamily}},t)}function Dr({theme:t,children:n}){return e.createElement(jr,null,e.createElement(Mr,{theme:t}),e.createElement(Nr,null,n))}function Tr(){return Pr(e=>e.theme)}function Br(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}function Cr(e,t){return Br(this,void 0,void 0,function*(){const{format:n="svg",filename:o="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),zr(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);Wr(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const e=l.width*r,t=l.height*r,n=(new XMLSerializer).serializeToString(s),a=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(a),u=new Image;u.width=l.width,u.height=l.height,yield new Promise((n,a)=>{u.onload=()=>{const s=document.createElement("canvas");s.width=e,s.height=t;const l=s.getContext("2d");l.fillStyle=i,l.fillRect(0,0,e,t),l.scale(r,r),l.drawImage(u,0,0),s.toBlob(e=>{e?(Wr(e,o+".png"),n()):a(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(c)},u.onerror=()=>{URL.revokeObjectURL(c),a(Error("Failed to load SVG image"))},u.src=c})}})}function zr(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)zr(o[e],r[e])}function Wr(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}"function"==typeof SuppressedError&&SuppressedError;const _r={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["function","object"]},frameProps:{type:"object"}},$r={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Hr={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},Ir=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Rr=["vertical","horizontal"],Fr={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),$r),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ir},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),$r),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ir},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),$r),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ir},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),$r),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),$r),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),$r),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Rr},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Rr},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Rr},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Rr},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Rr},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Rr},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_r),Hr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Rr},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},_r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},_r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_r),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_r),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Rr},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_r),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_r),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_r),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_r),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}},Yr=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Xr=new Set(["data","nodes","edges"]),Gr="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function qr(e,t,n){if(!Fr[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Fr).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(Yr.has(e)||!o&&Xr.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Gr(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Vr(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Fr[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Gr(e.props)}}function Ur(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Zr(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Qr(e){return Br(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Jr(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function Jr(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function Kr(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function ei(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function ti(e){return"nominal"===e||"ordinal"===e}function ni(e){return"quantitative"===e||"temporal"===e}const oi={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},ri={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},ii={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function ai(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,y;const f=[],{type:p,markProps:m}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"])}}(e.mark),v=e.encoding||{},b=v.x,x=v.y,w=v.color,k=v.size,A=v.theta,S=v.opacity;let E;(null===(t=e.data)||void 0===t?void 0:t.values)?E=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&f.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&f.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite().");const O={};e.width&&(O.width=e.width),e.height&&(O.height=e.height);const L=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(L&&(O.title=L),(null==w?void 0:w.field)&&(O.colorBy=w.field,null===(o=w.scale)||void 0===o?void 0:o.scheme)){const e=oi[w.scale.scheme];e&&(O.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(O.pointOpacity=S.value);const j=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(E&&(j||P)){const e=P?x:b,t=P?b:x,n=ii[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)E=function(e,t){const{groupBy:n,value:o,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[n]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of i){let o;switch(r){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(E,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&E){const e=new Map;for(const n of E){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}E=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";E&&(O.data=E),(null==b?void 0:b.bin)?(O.valueAccessor=b.field,(null==x?void 0:x.field)&&(O.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(O.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(O.valueAccessor=x.field,(null==b?void 0:b.field)&&(O.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(O.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(a=null==b?void 0:b.bin)||void 0===a?void 0:a.maxbins)||(null===(s=null==x?void 0:x.bin)||void 0===s?void 0:s.maxbins):void 0;return t&&(O.bins=t),li(e,O,f)}let M;switch(p){case"bar":M=function(e,t,n,o,r,i,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",ti(null==e?void 0:e.type)&&ni(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):ni(null==e?void 0:e.type)&&ti(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=i?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),r&&(o.data=r),g}(b,x,w,O,E,j,P);break;case"line":if(M="LineChart",si(b,x,O,j,P),(null==w?void 0:w.field)&&(O.lineBy=w.field),m.interpolate){const e=ri[m.interpolate];e&&(O.curve=e)}!0===m.point&&(O.showPoints=!0),E&&(O.data=E);break;case"area":if((null==w?void 0:w.field)?(M="StackedAreaChart",O.areaBy=w.field):M="AreaChart",si(b,x,O,j,P),m.interpolate){const e=ri[m.interpolate];e&&(O.curve=e)}void 0!==m.opacity&&(O.areaOpacity=m.opacity),E&&(O.data=E);break;case"point":case"circle":case"square":(null==k?void 0:k.field)?(M="BubbleChart",O.sizeBy=k.field,(null===(l=k.scale)||void 0===l?void 0:l.range)&&(O.sizeRange=k.scale.range)):M="Scatterplot",si(b,x,O,j,P),E&&(O.data=E);break;case"rect":M="Heatmap",(null==b?void 0:b.field)&&(O.xAccessor=b.field),(null==x?void 0:x.field)&&(O.yAccessor=x.field),(null==w?void 0:w.field)&&(O.valueAccessor=w.field,delete O.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(O.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(O.yLabel=x.axis.title),E&&(O.data=E);break;case"arc":m.innerRadius&&m.innerRadius>0?(M="DonutChart",O.innerRadius=m.innerRadius):M="PieChart",(null==A?void 0:A.field)?O.valueAccessor=A.field:(null==x?void 0:x.field)&&(O.valueAccessor=P?"value":x.field),(null==w?void 0:w.field)&&(O.categoryAccessor=w.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(O.categoryAccessor=b.field),E&&(O.data=E);break;case"tick":M="DotPlot",ti(null==b?void 0:b.type)?(O.categoryAccessor=b.field,(null==x?void 0:x.field)&&(O.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(O.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(O.valueLabel=x.axis.title)):ti(null==x?void 0:x.type)?(O.categoryAccessor=x.field,(null==b?void 0:b.field)&&(O.valueAccessor=j?"value":b.field),O.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(O.categoryLabel=x.axis.title),(null===(y=null==b?void 0:b.axis)||void 0===y?void 0:y.title)&&(O.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(O.categoryAccessor=b.field),(null==x?void 0:x.field)&&(O.valueAccessor=P?"value":x.field)),E&&(O.data=E);break;default:f.push(`Unsupported mark type "${p}". Defaulting to Scatterplot.`),M="Scatterplot",si(b,x,O,j,P),E&&(O.data=E)}return li(M,O,f)}function si(e,t,n,o,r){var i,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=r?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function li(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};return n.length>0&&(o.warnings=n),o}class ci extends e.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.createElement(jo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}const ui={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function di({height:t}){return e.createElement("div",{style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function hi({error:t}){return e.createElement("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5}},t))}const gi=e.forwardRef(function({title:t,subtitle:n,children:o,width:r="100%",height:i=400,actions:a,chartConfig:s,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:y,style:f},p){const m=e.useRef(null),v=e.useRef(null),[b,x]=e.useState(!1),w=!1!==(null==a?void 0:a.export)&&void 0!==(null==a?void 0:a.export),k=!1!==(null==a?void 0:a.fullscreen)&&void 0!==(null==a?void 0:a.fullscreen),A=!1!==(null==a?void 0:a.copyConfig)&&void 0!==(null==a?void 0:a.copyConfig)&&s,S="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",O=e.useCallback(e=>Br(this,void 0,void 0,function*(){v.current&&(yield Cr(v.current,Object.assign(Object.assign({},S),e)))}),[S]),L=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),j=e.useCallback(e=>Br(this,void 0,void 0,function*(){s&&(yield Qr(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(p,()=>({export:O,toggleFullscreen:L,copyConfig:j,element:m.current}),[O,L,j]);const P=t||n||l||w||k||A||h,M=c?e.createElement(di,{height:i}):u?e.createElement(hi,{error:u}):d?e.createElement(ci,null,o):o;return e.createElement(e.Fragment,null,e.createElement("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.createElement("div",{ref:m,className:"semiotic-chart-container"+(y?" "+y:""),style:Object.assign(Object.assign({width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:8,overflow:"hidden",background:"var(--semiotic-bg, #fff)",position:"relative"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),f)},P&&e.createElement("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}},e.createElement("div",{className:"semiotic-chart-title-area"},t&&e.createElement("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"}},t),n&&e.createElement("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0}},n)),e.createElement("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4}},l,w&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>O(),title:"Export chart",style:yi},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.createElement("path",{d:"M2 12h10"}))),k&&e.createElement("button",{className:"semiotic-chart-action",onClick:L,title:b?"Exit fullscreen":"Fullscreen",style:yi},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b?e.createElement(e.Fragment,null,e.createElement("path",{d:"M9 1v4h4"}),e.createElement("path",{d:"M5 13V9H1"}),e.createElement("path",{d:"M13 5H9V1"}),e.createElement("path",{d:"M1 9h4v4"})):e.createElement(e.Fragment,null,e.createElement("path",{d:"M1 5V1h4"}),e.createElement("path",{d:"M13 9v4H9"}),e.createElement("path",{d:"M9 1h4v4"}),e.createElement("path",{d:"M5 13H1V9"})))),A&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Copy config",style:yi},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.createElement("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"}))),h&&e.createElement("div",{className:"semiotic-chart-status",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:ui[h].bg,color:ui[h].color,lineHeight:"18px"}},h))),e.createElement("div",{className:"semiotic-chart-body",ref:v,style:Object.assign({position:"relative",overflow:"hidden"},b?{flex:1}:{height:i})},M,g)))}),yi={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function fi({children:t,position:n="right",size:s=300,trigger:l="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:y,style:f}){const[p,m]=r(null),[v,b]=r(null),[x,w]=r(!1),[k,A]=r(!1),S=o(null),E=o(),O="click"===l?["click","click-end"]:["hover","hover-end"],{latest:L}=$o({types:O,chartId:c,limit:1}),j=void 0!==u?u:L;a(()=>{if(j)if("click"===j.type||"hover"===j.type){const e=j;m(e.datum),b(e),x||(w(!0),A(!0),clearTimeout(E.current),E.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==j.type&&"hover-end"!==j.type||P()},[j]),a(()=>{null==g||g(x)},[x,g]);const P=i(()=>{A(!0),w(!1),clearTimeout(E.current),E.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(a(()=>()=>clearTimeout(E.current),[]),!p&&!k)return null;const M=p&&v?t(p,v):null;if(null===M&&!k)return null;const N=function(e,t,n,o){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},r),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,s,x,k);return e.createElement("div",{ref:S,className:`semiotic-details-panel semiotic-details-${n}${y?" "+y:""}`,style:Object.assign(Object.assign({},N),f)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:pi},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},e.createElement("path",{d:"M2 2l8 8M10 2l-8 8"}))),e.createElement("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1}},M))}const pi={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};fi.displayName="DetailsPanel";export{Co as AreaChart,Jo as BarChart,tr as BoxPlot,_o as BubbleChart,gi as ChartContainer,ci as ChartErrorBoundary,yr as ChordDiagram,vr as CirclePack,Lr as DARK_THEME,fi as DetailsPanel,sr as DonutChart,ir as DotPlot,cr as ForceDirectedGraph,lr as GroupedBarChart,Wo as Heatmap,nr as Histogram,re as IncrementalExtent,Or as LIGHT_THEME,Bo as LineChart,Io as LinkedCharts,Qo as MinimapChart,Qn as MultiLineTooltip,ar as PieChart,Sr as RealtimeHeatmap,wr as RealtimeHistogram,br as RealtimeLineChart,kr as RealtimeSwarmChart,xr as RealtimeTemporalHistogram,Ar as RealtimeWaterfallChart,rr as RidgelinePlot,oe as RingBuffer,fr as SankeyDiagram,To as Scatterplot,Uo as ScatterplotMatrix,zo as StackedAreaChart,Ko as StackedBarChart,Gn as StreamNetworkFrame,yt as StreamOrdinalFrame,Ve as StreamXYFrame,er as SwarmPlot,Dr as ThemeProvider,Zn as Tooltip,pr as TreeDiagram,mr as Treemap,or as ViolinPlot,Jr as configToJSX,Qr as copyConfig,ei as deserializeSelections,Cr as exportChart,Vr as fromConfig,Zr as fromURL,ai as fromVegaLite,Jn as normalizeTooltip,Kr as serializeSelections,Er as smartTickFormat,qr as toConfig,Ur as toURL,po as useBrushSelection,$o as useChartObserver,mo as useFilteredData,fo as useLinkedHover,yo as useSelection,Tr as useTheme};
|